Titans Form Changes - Core HCP Connect Drive
Specific Folder FTP Upload / ftp-deploy (push) Successful in 49s Details

This commit is contained in:
Tanuja Pansare 2026-10-01 15:00:19 +05:30
parent d0765b9a8c
commit 5592a34619
1 changed files with 274 additions and 74 deletions

View File

@ -169,6 +169,13 @@
enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{ $form_id }}">
@csrf
<!-- Drive Count Fields -->
<input type="hidden" name="Count of Plans_LHC" id="count-plans-lhc" value="0">
<input type="hidden" name="Count of Execution_LHC" id="count-execution-lhc" value="0">
<input type="hidden" name="Count of Plans_Novel" id="count-plans-novel" value="0">
<input type="hidden" name="Count of Execution_Novel" id="count-execution-novel" value="0">
@if ($id)
<input type="hidden" name="id" value="{{ $id }}">
@endif
@ -285,7 +292,24 @@
enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{ $form_id }}">
@csrf
<input type="hidden" name="id" value="" id="execution-id">
<input type="hidden" name="execution_mode" id="execution-mode" value="no">
<!-- Drive Count Fields -->
<input type="hidden" name="Count of Plans_LHC"
id="execution-count-plans-lhc" value="0">
<input type="hidden" name="Count of Execution_LHC"
id="execution-count-execution-lhc" value="0">
<input type="hidden" name="Count of Plans_Novel"
id="execution-count-plans-novel" value="0">
<input type="hidden" name="Count of Execution_Novel"
id="execution-count-execution-novel" value="0">
{{-- <input type="hidden" name="execution_done" value="yes"> --}}
@foreach ($questions as $question)
<div class="col-md-12 mb-2">
@ -421,6 +445,66 @@
$('#execution-no_of_patients_screened').closest('.col-md-12').hide();
$('#execution-no_of_patients_screened').prop('required', false);
// =====================================================
// DRIVE COUNT FUNCTIONS
// =====================================================
// Plan Filling
function setPlanDriveCount() {
const activity = ($('#field-activity').val() || '').trim().toUpperCase();
$('#drive-count-plans-lhc').val('0');
$('#drive-count-execution-lhc').val('0');
$('#drive-count-plans-novel').val('0');
$('#drive-count-execution-novel').val('0');
if (activity === 'LHC') {
$('#drive-count-plans-lhc').val('1');
} else if (activity === 'NOVEL') {
$('#drive-count-plans-novel').val('1');
}
}
// Execution
function setExecutionDriveCount() {
const activity = ($('#execution-activity').val() || '').trim().toUpperCase();
$('#execution-drive-count-plans-lhc').val('0');
$('#execution-drive-count-execution-lhc').val('0');
$('#execution-drive-count-plans-novel').val('0');
$('#execution-drive-count-execution-novel').val('0');
if (activity === 'LHC') {
$('#execution-drive-count-execution-lhc').val('1');
} else if (activity === 'NOVEL') {
$('#execution-drive-count-execution-novel').val('1');
}
}
// Activity change - Plan
$('#field-activity').on('change.driveCount', function() {
setPlanDriveCount();
});
// Activity change - Execution
$('#execution-activity').on('change.driveCount', function() {
setExecutionDriveCount();
});
// Initialize Plan count
setPlanDriveCount();
$('#add-camp-btn').click(function() {
@ -433,6 +517,7 @@
})
$('.edit-btn').click(function() {
$('#execution-mode').val('yes');
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
@ -498,6 +583,10 @@
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
// Set execution drive count
setExecutionDriveCount();
// Show Patients Screened only for LHC during Execution
const selectedActivity = ($('#execution-activity').val() || '').trim().toUpperCase();
@ -625,6 +714,12 @@
// $('#execution-'+k).val(selected[k]);
}
$('#execution-activity').on('change.driveCount', function() {
setExecutionDriveCount();
});
let docid = $('#execution-contact_id option').map(function() {
@ -731,36 +826,67 @@
})
$('#report-form').on('submit', function(event) {
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function(data) {
$("#pageloader").fadeOut();
if (data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
window.location.reload();
//$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
// Get the currently selected activity
const activity = ($('#field-activity').val() || '').trim().toUpperCase();
// Reset all Plan/Execution counters
$('#count-plans-lhc').val('0');
$('#count-execution-lhc').val('0');
$('#count-plans-novel').val('0');
$('#count-execution-novel').val('0');
// Set Plan counter based on selected Activity
if (activity === 'LHC') {
$('#count-plans-lhc').val('1');
} else if (activity === 'NOVEL') {
$('#count-plans-novel').val('1');
}
// Debug - check before submitting
console.log('Plan Activity:', activity);
console.log('Count of Plans_LHC:', $('#count-plans-lhc').val());
console.log('Count of Plans_Novel:', $('#count-plans-novel').val());
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function(data) {
$("#pageloader").fadeOut();
if (data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
});
window.location.reload();
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
});
}
}
});
});
$('#field-core_value').parent().hide();
@ -783,6 +909,8 @@
$('#field-core_value').val($('option:selected', this).attr('core_value'))
})
$('#field-msl_code').prop('readonly', true);
$('#field-speciality').prop('readonly', true);
@ -829,62 +957,134 @@
$('#execution-form').on('submit', function(event) {
const activity = ($('#execution-activity').val() || '').trim().toUpperCase();
const activity = ($('#execution-activity').val() || '')
.trim()
.toUpperCase();
if (activity === 'LHC') {
const executionMode = $('#execution-mode').val();
const patientsScreened = $('#execution-no_of_patients_screened').val();
/*
* Reset all counters first
*/
$('#execution-count-plans-lhc').val('0');
$('#execution-count-execution-lhc').val('0');
$('#execution-count-plans-novel').val('0');
$('#execution-count-execution-novel').val('0');
if (
patientsScreened === '' ||
!/^\d+$/.test(patientsScreened)
) {
event.preventDefault();
Swal.fire({
icon: 'error',
title: 'Invalid No. of Patients Screened',
text: 'Please enter a valid whole number. Negative numbers and decimal values are not allowed.'
});
/*
* Only set Execution counters when
* this is actual Execution, NOT Edit Plan.
*/
if (executionMode === 'yes') {
$('#execution-no_of_patients_screened').focus();
if (activity === 'LHC') {
return;
}
}
$('#execution-count-execution-lhc').val('1');
} else if (activity === 'NOVEL') {
$('#execution-count-execution-novel').val('1');
}
}
/*
* Patients Screened validation
*/
if (activity === 'LHC') {
const patientsScreened =
$('#execution-no_of_patients_screened').val();
if (
patientsScreened === '' ||
!/^\d+$/.test(patientsScreened)
) {
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#execution-form')[0]),
processData: false,
contentType: false,
success: function(data) {
$("#pageloader").fadeOut();
if (data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
}).then(() => {
location.reload(); // 🔥 page refresh here
});
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
Swal.fire({
icon: 'error',
title: 'Invalid No. of Patients Screened',
text: 'Please enter a valid whole number. Negative numbers and decimal values are not allowed.'
});
$('#execution-no_of_patients_screened').focus();
return false;
}
}
/*
* Debug before submission
*/
console.log('Execution Mode:', executionMode);
console.log('Execution Activity:', activity);
console.log(
'Count of Execution_LHC:',
$('#execution-count-execution-lhc').val()
);
console.log(
'Count of Execution_Novel:',
$('#execution-count-execution-novel').val()
);
/*
* Submit
*/
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#execution-form')[0]),
processData: false,
contentType: false,
success: function(data) {
$("#pageloader").fadeOut();
if (data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
}).then(() => {
location.reload();
});
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
});
}
},
error: function() {
$("#pageloader").fadeOut();
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
});
}
});
});
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');