lifemankind Form changes Asthakind - Bemisaal Budhwaar
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m49s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m49s
Details
This commit is contained in:
parent
9331d4cd72
commit
30d174ea31
|
|
@ -40,6 +40,15 @@
|
|||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden"
|
||||
name="ACTUAL_GUDCEF_METRIC_CODE"
|
||||
id="activity_gudcef_metric"
|
||||
value="0">
|
||||
|
||||
<input type="hidden"
|
||||
name="ACTUAL_ASTHAKIND_METRIC_CODE"
|
||||
id="activity_asthakind_metric"
|
||||
value="0">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
|
|
@ -237,34 +246,77 @@
|
|||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com':'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// Get selected activity
|
||||
var activity = $('#field-activity_name option:selected').text().trim();
|
||||
|
||||
// Create FormData
|
||||
var formData = new FormData(this);
|
||||
|
||||
// Reset both metric values
|
||||
formData.set('ACTUAL_GUDCEF_METRIC_CODE', '0');
|
||||
formData.set('ACTUAL_ASTHAKIND_METRIC_CODE', '0');
|
||||
|
||||
// Set selected activity metric to 1
|
||||
if (activity === 'GUDCEF MONDAY') {
|
||||
|
||||
formData.set('ACTUAL_GUDCEF_METRIC_CODE', '1');
|
||||
|
||||
} else if (
|
||||
activity === 'ASTHAKIND - BEMISAAL BUDHWAAR / WINNING WEDNESDAY'
|
||||
) {
|
||||
|
||||
formData.set('ACTUAL_ASTHAKIND_METRIC_CODE', '1');
|
||||
}
|
||||
|
||||
// Debug
|
||||
console.log('Submitting Activity:', activity);
|
||||
console.log(
|
||||
'Submitting GUDCEF:',
|
||||
formData.get('ACTUAL_GUDCEF_METRIC_CODE')
|
||||
);
|
||||
console.log(
|
||||
'Submitting ASTHAKIND:',
|
||||
formData.get('ACTUAL_ASTHAKIND_METRIC_CODE')
|
||||
);
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: formData,
|
||||
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'
|
||||
});
|
||||
|
||||
$('#report-form').trigger("reset");
|
||||
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message')
|
||||
? 'You are not mapped to any position code'
|
||||
: 'Data not submitted',
|
||||
text: data.hasOwnProperty('message')
|
||||
? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com'
|
||||
: 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
|
|
@ -327,6 +379,12 @@
|
|||
|
||||
function hideActivityFields() {
|
||||
|
||||
$('#field-day_of_activity_for_gudcef_monday')
|
||||
.closest('.col-md-12')
|
||||
.hide()
|
||||
.find('input, select, textarea')
|
||||
.prop('required', false);
|
||||
|
||||
$('#field-number_of_gudcef_monday_input_distributed_to_doctors')
|
||||
.closest('.col-md-12')
|
||||
.hide()
|
||||
|
|
@ -392,6 +450,12 @@ $('#field-activity_name').on('change', function () {
|
|||
// GUDCEF MONDAY
|
||||
if (activity === 'GUDCEF MONDAY') {
|
||||
|
||||
$('#field-day_of_activity_for_gudcef_monday')
|
||||
.closest('.col-md-12')
|
||||
.show()
|
||||
.find('input, select, textarea')
|
||||
.prop('required', true);
|
||||
|
||||
$('#field-number_of_gudcef_monday_input_distributed_to_doctors')
|
||||
.closest('.col-md-12')
|
||||
.show()
|
||||
|
|
@ -448,6 +512,34 @@ $('#field-activity_name').on('change', function () {
|
|||
.prop('required', true);
|
||||
}
|
||||
|
||||
|
||||
$('#field-activity_name').on('change', function () {
|
||||
|
||||
var activity = $('#field-activity_name option:selected').text().trim();
|
||||
|
||||
console.log("ACTIVITY SELECTED:", activity);
|
||||
|
||||
$('#activity_gudcef_metric').val('0');
|
||||
$('#activity_asthakind_metric').val('0');
|
||||
|
||||
if (activity === 'GUDCEF MONDAY') {
|
||||
|
||||
$('#activity_gudcef_metric').val('1');
|
||||
|
||||
} else if (activity === 'ASTHAKIND - BEMISAAL BUDHWAAR / WINNING WEDNESDAY') {
|
||||
|
||||
$('#activity_asthakind_metric').val('1');
|
||||
}
|
||||
|
||||
console.log(
|
||||
"GUDCEF =", $('#activity_gudcef_metric').val()
|
||||
);
|
||||
|
||||
console.log(
|
||||
"ASTHAKIND =", $('#activity_asthakind_metric').val()
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue