-
+
-
+
@@ -784,8 +869,8 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
-
+ console.log(pair[0] + ':', pair[1]);
+ }
+
+ $.ajax({
+ url: '/gcc/api/streetvendor/updateDetails',
+ type: 'POST',
+ data: formData,
+ enctype: 'multipart/form-data',
+ processData: false,
+ contentType: false,
+ success: function (response) {
+ $('#pageLoader').hide();
+ if (response.status) {
+ Swal.fire({
+ icon: 'success',
+ title: 'Success',
+ text: response.description,
+ allowOutsideClick: false,
+ allowEscapeKey: false,
+ allowEnterKey: false,
+ showConfirmButton: true
+ }).then((result) => {
+ if (result.isConfirmed) {
+ location.reload();
+ }
+ });
+ } else {
+ $('#pageLoader').hide();
+ Swal.fire({
+ icon: 'error',
+ title: 'Update Failed',
+ text: response.description || 'Something went wrong!'
+ });
+ }
+ $('#submitBtn').prop('disabled', false).text('Update');
+ },
+ error: function () {
+ $('#pageLoader').hide();
+ Swal.fire({
+ icon: 'error',
+ title: 'Submission Error',
+ text: 'Something went wrong while updating the form.'
+ });
+ $('#submitBtn').prop('disabled', false).text('Update');
+ }
+ });
+
+ });
+
+
+ function formatDateForInput(dateStr) {
+
+ if (!dateStr) return "";
+
+ // Already yyyy-MM-dd
+ if (/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
+ return dateStr;
+ }
+
+ // dd-MM-yyyy -> yyyy-MM-dd
+ if (/^\d{2}-\d{2}-\d{4}$/.test(dateStr)) {
+ const [day, month, year] = dateStr.split("-");
+ return `${year}-${month}-${day}`;
+ }
+
+ return "";
+ }
+ function formatDateForDisplay(dateStr) {
+
+ if (!dateStr) return "-";
+
+ // Already dd-MM-yyyy
+ if (/^\d{2}-\d{2}-\d{4}$/.test(dateStr)) {
+ return dateStr;
+ }
+
+ // yyyy-MM-dd -> dd-MM-yyyy
+ if (/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
+ const [year, month, day] = dateStr.split("-");
+ return `${day}-${month}-${year}`;
+ }
+
+ return dateStr;
+ }
+
+