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
|
@endif
|
||||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
<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="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
|
@csrf
|
||||||
@if($id)
|
@if($id)
|
||||||
<input type="hidden" name="id" value="{{$id}}">
|
<input type="hidden" name="id" value="{{$id}}">
|
||||||
|
|
@ -237,34 +246,77 @@
|
||||||
console.log(hierarchy)
|
console.log(hierarchy)
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event){
|
$('#report-form').on('submit', function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$("#pageloader").fadeIn();
|
|
||||||
$.ajax({
|
// Get selected activity
|
||||||
type: "POST",
|
var activity = $('#field-activity_name option:selected').text().trim();
|
||||||
url: '/form/ajaxsubmit',
|
|
||||||
data: new FormData($('#report-form')[0]),
|
// Create FormData
|
||||||
processData: false,
|
var formData = new FormData(this);
|
||||||
contentType: false,
|
|
||||||
success: function( data ) {
|
// Reset both metric values
|
||||||
$("#pageloader").fadeOut();
|
formData.set('ACTUAL_GUDCEF_METRIC_CODE', '0');
|
||||||
if(data.status == 'success') {
|
formData.set('ACTUAL_ASTHAKIND_METRIC_CODE', '0');
|
||||||
Swal.fire({
|
|
||||||
title: 'Great!',
|
// Set selected activity metric to 1
|
||||||
text: 'Your data is successfully submitted!',
|
if (activity === 'GUDCEF MONDAY') {
|
||||||
icon: 'success'
|
|
||||||
})
|
formData.set('ACTUAL_GUDCEF_METRIC_CODE', '1');
|
||||||
$('#report-form').trigger("reset");
|
|
||||||
} else {
|
} else if (
|
||||||
Swal.fire({
|
activity === 'ASTHAKIND - BEMISAAL BUDHWAAR / WINNING WEDNESDAY'
|
||||||
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!'
|
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 today = new Date();
|
||||||
var dd = String(today.getDate()).padStart(2, '0');
|
var dd = String(today.getDate()).padStart(2, '0');
|
||||||
|
|
@ -327,6 +379,12 @@
|
||||||
|
|
||||||
function hideActivityFields() {
|
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')
|
$('#field-number_of_gudcef_monday_input_distributed_to_doctors')
|
||||||
.closest('.col-md-12')
|
.closest('.col-md-12')
|
||||||
.hide()
|
.hide()
|
||||||
|
|
@ -392,6 +450,12 @@ $('#field-activity_name').on('change', function () {
|
||||||
// GUDCEF MONDAY
|
// GUDCEF MONDAY
|
||||||
if (activity === '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')
|
$('#field-number_of_gudcef_monday_input_distributed_to_doctors')
|
||||||
.closest('.col-md-12')
|
.closest('.col-md-12')
|
||||||
.show()
|
.show()
|
||||||
|
|
@ -448,6 +512,34 @@ $('#field-activity_name').on('change', function () {
|
||||||
.prop('required', true);
|
.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>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue