Titans (Core HCP Connect Drive) - Novel & Oscar Plan and Execution Count

This commit is contained in:
zeeshan 2026-10-07 17:06:37 +05:30
parent 11f670e0b9
commit eeb37216d7
1 changed files with 55 additions and 160 deletions

View File

@ -171,11 +171,9 @@
@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">
<input type="hidden" name="count_of_plans_lhc" id="count-plans-lhc" value="0">
<input type="hidden" name="count_of_plans_novel" id="count-plans-novel" value="0">
@if ($id)
<input type="hidden" name="id" value="{{ $id }}">
@endif
@ -298,17 +296,9 @@
<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="count_of_execution_lhc" id="execution-count-execution-lhc" 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)
@ -445,66 +435,30 @@
$('#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();
$('#field-activity').on('change', function() {
let activity=$(this).val();
console.log("Activity selected in Plan:",activity);
if (activity === 'Oscar Screening Camps') {
$('#count-plans-lhc').val('1');
}
else if (activity === 'Novel') {
$('#count-plans-novel').val('1');
}
else{
$('#count-plans-lhc').val('0');
$('#count-plans-novel').val('0');
}
});
// Activity change - Execution
$('#execution-activity').on('change.driveCount', function() {
setExecutionDriveCount();
});
// Initialize Plan count
setPlanDriveCount();
$('#add-camp-btn').click(function() {
@ -585,12 +539,12 @@
$('#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();
if (selectedActivity === 'LHC') {
if (selectedActivity === 'Oscar Screening Camps') {
$('#execution-no_of_patients_screened')
.closest('.col-md-12')
.show();
@ -611,7 +565,7 @@
const activity = ($(this).val() || '').trim().toUpperCase();
if (activity === 'LHC') {
if (activity === 'Oscar Screening Camps') {
$('#execution-no_of_patients_screened')
.closest('.col-md-12')
@ -665,6 +619,21 @@
})
let activityName=$('#execution-activity').val();
console.log("Activity selected in Execution:",activityName);
if(activityName==='Oscar Screening Camps'){
$('#execution-count-execution-lhc').val('1');
$('#execution-count-execution-novel').val('0');
}
else if(activityName==='Novel'){
$('#execution-count-execution-lhc').val('0');
$('#execution-count-execution-novel').val('1');
}
else{
$('#execution-count-execution-lhc').val('0');
$('#execution-count-execution-novel').val('0');
}
})
@ -717,9 +686,7 @@
$('#execution-activity').on('change.driveCount', function() {
setExecutionDriveCount();
});
let docid = $('#execution-contact_id option').map(function() {
@ -779,31 +746,13 @@
/* $('#execution-plan_date').on('change', function () {
const monthNames = [
"Oct-26", "Nov-26", "Dec-26"
];
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
if (selectedDateVal) {
// 'YYYY-MM-DD' split karun month extract karane (timezone issue yet nahi)
const parts = selectedDateVal.split('-');
const monthNumber = parts[1]; // "10", "11", किंवा "12"
const targetMonth = monthNames[monthNumber] || '';
// Dropdown madhe toh month select karne
$('#execution-month_of_engagement').val(monthNames).trigger('change');
} else {
// Jar user ne date clear keli tar dropdown reset karne
$('#execution-month_of_engagement').val('').trigger('change');
}
}); */
$('#execution-plan_date').on('change', function () {
const monthNames = [
"Oct-26", // Index 0 (10 व्या महिन्यासाठी)
"Nov-26", // Index 1 (11 व्या महिन्यासाठी)
"Dec-26" // Index 2 (12 व्या महिन्यासाठी)
"Oct-26", // Index 0
"Nov-26", // Index 1
"Dec-26" // Index 2
];
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
@ -812,7 +761,7 @@
const parts = selectedDateVal.split('-');
const monthNumber = parseInt(parts[1], 10); // 10, 11, किंवा 12
// 10 वजा करून 0, 1, 2 इंडेक्स मिळवणे
const targetMonth = monthNames[monthNumber - 10] || '';
// Dropdown madhe targetMonth select karne
@ -827,29 +776,7 @@
$('#report-form').on('submit', function(event) {
// 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();
@ -921,9 +848,9 @@
$(document).ready(function () {
const monthNames = [
"Oct-26", // index 0 (10 व्या महिन्यासाठी)
"Nov-26", // index 1 (11 व्या महिन्यासाठी)
"Dec-26" // index 2 (12 व्या महिन्यासाठी)
"Oct-26", // index 0
"Nov-26", // index 1
"Dec-26" // index 2
];
$('#field-plan_date').on('change', function () {
@ -966,33 +893,20 @@
/*
* 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');
/*
* Only set Execution counters when
* this is actual Execution, NOT Edit Plan.
*/
if (executionMode === 'yes') {
if (activity === 'LHC') {
$('#execution-count-execution-lhc').val('1');
} else if (activity === 'NOVEL') {
$('#execution-count-execution-novel').val('1');
}
}
/*
* Patients Screened validation
*/
if (activity === 'LHC') {
if (activity === 'Oscar Screening Camps') {
const patientsScreened =
$('#execution-no_of_patients_screened').val();
@ -1017,26 +931,7 @@
}
/*
* 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();