Titans Form Changes - Core HCP Connect Drive
Specific Folder FTP Upload / ftp-deploy (push) Successful in 49s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 49s
Details
This commit is contained in:
parent
d0765b9a8c
commit
5592a34619
|
|
@ -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();
|
||||
|
||||
|
|
@ -627,6 +716,12 @@
|
|||
|
||||
|
||||
|
||||
|
||||
$('#execution-activity').on('change.driveCount', function() {
|
||||
setExecutionDriveCount();
|
||||
});
|
||||
|
||||
|
||||
let docid = $('#execution-contact_id option').map(function() {
|
||||
if ($(this).text().trim() == selected['contact_id'] || $(this).val().trim() == selected['cont_id']) return this;
|
||||
}).attr('value')
|
||||
|
|
@ -732,37 +827,68 @@
|
|||
|
||||
$('#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();
|
||||
|
||||
$("#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!'
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#field-core_value').parent().hide();
|
||||
$('#field-core_value').prop('required',false);
|
||||
|
||||
|
|
@ -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,16 +957,51 @@
|
|||
|
||||
$('#execution-form').on('submit', function(event) {
|
||||
|
||||
const activity = ($('#execution-activity').val() || '').trim().toUpperCase();
|
||||
const activity = ($('#execution-activity').val() || '')
|
||||
.trim()
|
||||
.toUpperCase();
|
||||
|
||||
const executionMode = $('#execution-mode').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');
|
||||
|
||||
|
||||
/*
|
||||
* Only set Execution counters when
|
||||
* this is actual Execution, NOT Edit Plan.
|
||||
*/
|
||||
if (executionMode === 'yes') {
|
||||
|
||||
if (activity === 'LHC') {
|
||||
|
||||
const patientsScreened = $('#execution-no_of_patients_screened').val();
|
||||
$('#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();
|
||||
|
||||
Swal.fire({
|
||||
|
|
@ -849,10 +1012,31 @@
|
|||
|
||||
$('#execution-no_of_patients_screened').focus();
|
||||
|
||||
return;
|
||||
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();
|
||||
|
|
@ -863,27 +1047,43 @@
|
|||
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
|
||||
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!'
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue