diff --git a/resources/views/form/rapport-team3/1780548606-6544d930-7144-4b75-b769-560752809662.blade.php b/resources/views/form/rapport-team3/1780548606-6544d930-7144-4b75-b769-560752809662.blade.php
index 9f455616..4cfc577e 100644
--- a/resources/views/form/rapport-team3/1780548606-6544d930-7144-4b75-b769-560752809662.blade.php
+++ b/resources/views/form/rapport-team3/1780548606-6544d930-7144-4b75-b769-560752809662.blade.php
@@ -54,8 +54,11 @@
@endforeach
+
@endif
+
+
@foreach($questions as $question)
@@ -278,6 +281,34 @@
});
+
+
+// Input Name - Safari Trolley Bag / Savlon Kit
+$('#field-input_name').on('change', function () {
+
+ var selectedInput = $(this).val();
+
+ // Reset both metrics to 0
+ $('input[name="SAFARI_TROLLEY_BAG_METRIC"]').val('0');
+ $('input[name="SAVLON_KIT_METRIC"]').val('0');
+
+ // Selected option = 1
+ if (selectedInput === 'Safari Trolley Bag') {
+
+ $('input[name="SAFARI_TROLLEY_BAG_METRIC"]').val('1');
+
+ } else if (selectedInput === 'Savlon Kit') {
+
+ $('input[name="SAVLON_KIT_METRIC"]').val('1');
+ }
+
+ console.log(
+ 'Input Name:', selectedInput,
+ 'Safari:', $('input[name="SAFARI_TROLLEY_BAG_METRIC"]').val(),
+ 'Savlon:', $('input[name="SAVLON_KIT_METRIC"]').val()
+ );
+});
+
// bag_distribution_photo_jpgjpegpng_max_upto_10_mb
$('#field-bag_distribution_photo_jpgjpegpng_max_upto_10_mb').on('change', function () {
@@ -374,32 +405,60 @@
}
-
+ var selectedInput = $('#field-input_name').val();
+
+ var formData = new FormData($('#report-form')[0]);
+
+ // Always reset both
+ formData.set('SAFARI_TROLLEY_BAG_METRIC', '0');
+ formData.set('SAVLON_KIT_METRIC', '0');
+
+ // Selected one = 1
+ if (selectedInput === 'Safari Trolley Bag') {
+
+ formData.set('SAFARI_TROLLEY_BAG_METRIC', '1');
+
+ } else if (selectedInput === 'Savlon Kit') {
+
+ formData.set('SAVLON_KIT_METRIC', '1');
+ }
+
+
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
- data: new FormData($('#report-form')[0]),
+ 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!'
- })
- }
- },
+ success: function(data) {
+
+ console.log("SERVER RESPONSE:", 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!'
+ });
+ }
+},
});
});