@djb25/digit-ui-module-vendor 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -224,7 +224,7 @@ const AddSurveyor = _ref => {
224
224
  showSuccessToast: true,
225
225
  message: {
226
226
  key: "success",
227
- action: "ES_VENDOR_ADD_SURVEYOR_SUCCESS"
227
+ action: t("ES_VENDOR_ADD_SURVEYOR_SUCCESS")
228
228
  }
229
229
  }
230
230
  });
@@ -915,8 +915,8 @@ const getSelectedSupervisorOption = function (row, supervisorsList) {
915
915
  const supervisorId = (_row27 = row) === null || _row27 === void 0 ? void 0 : _row27.supervisorId;
916
916
  if (!supervisorId) return null;
917
917
  return supervisorsList.find(s => {
918
- var _s$owner;
919
- return s.id === supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === supervisorId;
918
+ var _s$owner, _s$owner2;
919
+ return s.id === supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === supervisorId || s.name === supervisorId || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.name) === supervisorId;
920
920
  }) || null;
921
921
  };
922
922
  const getVendorFillingPoints = function (vendor) {
@@ -1185,9 +1185,10 @@ const VendorInbox = props => {
1185
1185
  const onVendorUpdate = row => {
1186
1186
  var _formDetails$owner, _formDetails$owner2, _formDetails$owner3, _formDetails$owner4;
1187
1187
  let formDetails = row.original.dsoDetails;
1188
+ const isDisable = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE";
1188
1189
  const formData = {
1189
1190
  vendor: _extends({}, formDetails, {
1190
- status: (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE",
1191
+ status: isDisable ? "DISABLED" : "ACTIVE",
1191
1192
  owner: _extends({}, formDetails.owner, {
1192
1193
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner = formDetails.owner) === null || _formDetails$owner === void 0 ? void 0 : _formDetails$owner.gender) || "OTHER",
1193
1194
  dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner2 = formDetails.owner) === null || _formDetails$owner2 === void 0 ? void 0 : _formDetails$owner2.dob) || new Date("1/1/1970").getTime(),
@@ -1200,48 +1201,72 @@ const VendorInbox = props => {
1200
1201
  onError: (error, variables) => {
1201
1202
  setShowToast({
1202
1203
  key: "error",
1203
- action: error
1204
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1204
1205
  });
1205
1206
  },
1206
1207
  onSuccess: (data, variables) => {
1207
- setShowToast({
1208
- key: "success",
1209
- action: "VENDOR"
1210
- });
1211
- queryClient.invalidateQueries("DSO_SEARCH");
1212
- props.refetchData();
1208
+ var _data$Errors, _data$data, _data$data$Errors;
1209
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors = data.Errors) === null || _data$Errors === void 0 ? void 0 : _data$Errors.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : (_data$data$Errors = _data$data.Errors) === null || _data$data$Errors === void 0 ? void 0 : _data$data$Errors.length) > 0;
1210
+ if (isError) {
1211
+ var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
1212
+ setShowToast({
1213
+ key: "error",
1214
+ action: (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : (_data$data2$Errors = _data$data2.Errors) === null || _data$data2$Errors === void 0 ? void 0 : (_data$data2$Errors$ = _data$data2$Errors[0]) === null || _data$data2$Errors$ === void 0 ? void 0 : _data$data2$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors2 = data.Errors) === null || _data$Errors2 === void 0 ? void 0 : (_data$Errors2$ = _data$Errors2[0]) === null || _data$Errors2$ === void 0 ? void 0 : _data$Errors2$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1215
+ });
1216
+ } else {
1217
+ setShowToast({
1218
+ key: "success",
1219
+ action: "VENDOR",
1220
+ isDisable
1221
+ });
1222
+ queryClient.invalidateQueries("DSO_SEARCH");
1223
+ props.refetchData();
1224
+ }
1213
1225
  }
1214
1226
  });
1215
1227
  };
1216
1228
  const onVehicleUpdate = row => {
1217
1229
  var _row$original;
1230
+ const isDisable = ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.status) === "ACTIVE";
1218
1231
  const formData = getVehicleUpdatePayload(row.original, {
1219
- status: ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.status) === "ACTIVE" ? "DISABLED" : "ACTIVE"
1232
+ status: isDisable ? "DISABLED" : "ACTIVE"
1220
1233
  });
1221
1234
  mutateVehicle(formData, {
1222
1235
  onError: (error, variables) => {
1223
1236
  setShowToast({
1224
1237
  key: "error",
1225
- action: error
1238
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1226
1239
  });
1227
1240
  },
1228
1241
  onSuccess: (data, variables) => {
1229
- setShowToast({
1230
- key: "success",
1231
- action: "VEHICLE"
1232
- });
1233
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1234
- props.refetchVendor();
1235
- props.refetchData();
1242
+ var _data$Errors3, _data$data3, _data$data3$Errors;
1243
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors3 = data.Errors) === null || _data$Errors3 === void 0 ? void 0 : _data$Errors3.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data3 = data.data) === null || _data$data3 === void 0 ? void 0 : (_data$data3$Errors = _data$data3.Errors) === null || _data$data3$Errors === void 0 ? void 0 : _data$data3$Errors.length) > 0;
1244
+ if (isError) {
1245
+ var _data$data4, _data$data4$Errors, _data$data4$Errors$, _data$Errors4, _data$Errors4$;
1246
+ setShowToast({
1247
+ key: "error",
1248
+ action: (data === null || data === void 0 ? void 0 : (_data$data4 = data.data) === null || _data$data4 === void 0 ? void 0 : (_data$data4$Errors = _data$data4.Errors) === null || _data$data4$Errors === void 0 ? void 0 : (_data$data4$Errors$ = _data$data4$Errors[0]) === null || _data$data4$Errors$ === void 0 ? void 0 : _data$data4$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors4 = data.Errors) === null || _data$Errors4 === void 0 ? void 0 : (_data$Errors4$ = _data$Errors4[0]) === null || _data$Errors4$ === void 0 ? void 0 : _data$Errors4$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1249
+ });
1250
+ } else {
1251
+ setShowToast({
1252
+ key: "success",
1253
+ action: "VEHICLE",
1254
+ isDisable
1255
+ });
1256
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1257
+ props.refetchVendor();
1258
+ props.refetchData();
1259
+ }
1236
1260
  }
1237
1261
  });
1238
1262
  };
1239
1263
  const onDriverUpdate = row => {
1240
1264
  var _formDetails$owner5, _formDetails$owner6, _formDetails$owner7, _formDetails$owner8;
1241
1265
  let formDetails = row.original;
1266
+ const isDisable = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE";
1242
1267
  const formData = {
1243
1268
  driver: _extends({}, formDetails, {
1244
- status: (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE",
1269
+ status: isDisable ? "DISABLED" : "ACTIVE",
1245
1270
  owner: _extends({}, formDetails.owner, {
1246
1271
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner5 = formDetails.owner) === null || _formDetails$owner5 === void 0 ? void 0 : _formDetails$owner5.gender) || "OTHER",
1247
1272
  dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner6 = formDetails.owner) === null || _formDetails$owner6 === void 0 ? void 0 : _formDetails$owner6.dob) || new Date("1/1/1970").getTime(),
@@ -1254,17 +1279,28 @@ const VendorInbox = props => {
1254
1279
  onError: (error, variables) => {
1255
1280
  setShowToast({
1256
1281
  key: "error",
1257
- action: error
1282
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1258
1283
  });
1259
1284
  },
1260
1285
  onSuccess: (data, variables) => {
1261
- setShowToast({
1262
- key: "success",
1263
- action: "DRIVER"
1264
- });
1265
- queryClient.invalidateQueries("FSM_DRIVER_SEARCH");
1266
- props.refetchVendor();
1267
- props.refetchData();
1286
+ var _data$Errors5, _data$data5, _data$data5$Errors;
1287
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors5 = data.Errors) === null || _data$Errors5 === void 0 ? void 0 : _data$Errors5.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data5 = data.data) === null || _data$data5 === void 0 ? void 0 : (_data$data5$Errors = _data$data5.Errors) === null || _data$data5$Errors === void 0 ? void 0 : _data$data5$Errors.length) > 0;
1288
+ if (isError) {
1289
+ var _data$data6, _data$data6$Errors, _data$data6$Errors$, _data$Errors6, _data$Errors6$;
1290
+ setShowToast({
1291
+ key: "error",
1292
+ action: (data === null || data === void 0 ? void 0 : (_data$data6 = data.data) === null || _data$data6 === void 0 ? void 0 : (_data$data6$Errors = _data$data6.Errors) === null || _data$data6$Errors === void 0 ? void 0 : (_data$data6$Errors$ = _data$data6$Errors[0]) === null || _data$data6$Errors$ === void 0 ? void 0 : _data$data6$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors6 = data.Errors) === null || _data$Errors6 === void 0 ? void 0 : (_data$Errors6$ = _data$Errors6[0]) === null || _data$Errors6$ === void 0 ? void 0 : _data$Errors6$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1293
+ });
1294
+ } else {
1295
+ setShowToast({
1296
+ key: "success",
1297
+ action: "DRIVER",
1298
+ isDisable
1299
+ });
1300
+ queryClient.invalidateQueries("FSM_DRIVER_SEARCH");
1301
+ props.refetchVendor();
1302
+ props.refetchData();
1303
+ }
1268
1304
  }
1269
1305
  });
1270
1306
  };
@@ -1333,10 +1369,20 @@ const VendorInbox = props => {
1333
1369
  onError: error => {
1334
1370
  setShowToast({
1335
1371
  key: "error",
1336
- action: error
1372
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1337
1373
  });
1338
1374
  },
1339
- onSuccess: () => {
1375
+ onSuccess: data => {
1376
+ var _data$Errors7, _data$data7, _data$data7$Errors;
1377
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors7 = data.Errors) === null || _data$Errors7 === void 0 ? void 0 : _data$Errors7.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data7 = data.data) === null || _data$data7 === void 0 ? void 0 : (_data$data7$Errors = _data$data7.Errors) === null || _data$data7$Errors === void 0 ? void 0 : _data$data7$Errors.length) > 0;
1378
+ if (isError) {
1379
+ var _data$data8, _data$data8$Errors, _data$data8$Errors$, _data$Errors8, _data$Errors8$;
1380
+ setShowToast({
1381
+ key: "error",
1382
+ action: (data === null || data === void 0 ? void 0 : (_data$data8 = data.data) === null || _data$data8 === void 0 ? void 0 : (_data$data8$Errors = _data$data8.Errors) === null || _data$data8$Errors === void 0 ? void 0 : (_data$data8$Errors$ = _data$data8$Errors[0]) === null || _data$data8$Errors$ === void 0 ? void 0 : _data$data8$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors8 = data.Errors) === null || _data$Errors8 === void 0 ? void 0 : (_data$Errors8$ = _data$Errors8[0]) === null || _data$Errors8$ === void 0 ? void 0 : _data$Errors8$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1383
+ });
1384
+ return;
1385
+ }
1340
1386
  updateVehicleRowState(currentVehicle === null || currentVehicle === void 0 ? void 0 : currentVehicle.id, {
1341
1387
  vendor: updatedSelectedVendor,
1342
1388
  fillingPoint: null,
@@ -1345,7 +1391,8 @@ const VendorInbox = props => {
1345
1391
  });
1346
1392
  setShowToast({
1347
1393
  key: "success",
1348
- action: "VEHICLE"
1394
+ action: "VEHICLE",
1395
+ isDisable: false
1349
1396
  });
1350
1397
  queryClient.invalidateQueries("DSO_SEARCH");
1351
1398
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
@@ -1362,10 +1409,22 @@ const VendorInbox = props => {
1362
1409
  onError: error => {
1363
1410
  setShowToast({
1364
1411
  key: "error",
1365
- action: error
1412
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1366
1413
  });
1367
1414
  },
1368
- onSuccess: addVehicleToSelectedVendor
1415
+ onSuccess: data => {
1416
+ var _data$Errors9, _data$data9, _data$data9$Errors;
1417
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors9 = data.Errors) === null || _data$Errors9 === void 0 ? void 0 : _data$Errors9.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data9 = data.data) === null || _data$data9 === void 0 ? void 0 : (_data$data9$Errors = _data$data9.Errors) === null || _data$data9$Errors === void 0 ? void 0 : _data$data9$Errors.length) > 0;
1418
+ if (isError) {
1419
+ var _data$data0, _data$data0$Errors, _data$data0$Errors$, _data$Errors0, _data$Errors0$;
1420
+ setShowToast({
1421
+ key: "error",
1422
+ action: (data === null || data === void 0 ? void 0 : (_data$data0 = data.data) === null || _data$data0 === void 0 ? void 0 : (_data$data0$Errors = _data$data0.Errors) === null || _data$data0$Errors === void 0 ? void 0 : (_data$data0$Errors$ = _data$data0$Errors[0]) === null || _data$data0$Errors$ === void 0 ? void 0 : _data$data0$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors0 = data.Errors) === null || _data$Errors0 === void 0 ? void 0 : (_data$Errors0$ = _data$Errors0[0]) === null || _data$Errors0$ === void 0 ? void 0 : _data$Errors0$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1423
+ });
1424
+ return;
1425
+ }
1426
+ addVehicleToSelectedVendor();
1427
+ }
1369
1428
  });
1370
1429
  return;
1371
1430
  }
@@ -1379,17 +1438,27 @@ const VendorInbox = props => {
1379
1438
  onError: (error, variables) => {
1380
1439
  setShowToast({
1381
1440
  key: "error",
1382
- action: error
1441
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1383
1442
  });
1384
1443
  },
1385
1444
  onSuccess: (data, variables) => {
1386
- var _row$original2;
1445
+ var _data$Errors1, _data$data1, _data$data1$Errors, _row$original2;
1446
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors1 = data.Errors) === null || _data$Errors1 === void 0 ? void 0 : _data$Errors1.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data1 = data.data) === null || _data$data1 === void 0 ? void 0 : (_data$data1$Errors = _data$data1.Errors) === null || _data$data1$Errors === void 0 ? void 0 : _data$data1$Errors.length) > 0;
1447
+ if (isError) {
1448
+ var _data$data10, _data$data10$Errors, _data$data10$Errors$, _data$Errors10, _data$Errors10$;
1449
+ setShowToast({
1450
+ key: "error",
1451
+ action: (data === null || data === void 0 ? void 0 : (_data$data10 = data.data) === null || _data$data10 === void 0 ? void 0 : (_data$data10$Errors = _data$data10.Errors) === null || _data$data10$Errors === void 0 ? void 0 : (_data$data10$Errors$ = _data$data10$Errors[0]) === null || _data$data10$Errors$ === void 0 ? void 0 : _data$data10$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors10 = data.Errors) === null || _data$Errors10 === void 0 ? void 0 : (_data$Errors10$ = _data$Errors10[0]) === null || _data$Errors10$ === void 0 ? void 0 : _data$Errors10$.message) || (data === null || data === void 0 ? void 0 : data.message) || "UPDATE_FAILED"
1452
+ });
1453
+ return;
1454
+ }
1387
1455
  updateVehicleRowState((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.id, {
1388
1456
  driverData: selectedOption
1389
1457
  });
1390
1458
  setShowToast({
1391
1459
  key: "success",
1392
- action: "VEHICLE"
1460
+ action: "VEHICLE",
1461
+ isDisable: false
1393
1462
  });
1394
1463
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1395
1464
  queryClient.invalidateQueries("DSO_SEARCH");
@@ -1410,8 +1479,17 @@ const VendorInbox = props => {
1410
1479
  label: (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "Failed to map filling point"
1411
1480
  });
1412
1481
  },
1413
- onSuccess: () => {
1414
- var _row$original3;
1482
+ onSuccess: data => {
1483
+ var _data$Errors11, _data$data11, _data$data11$Errors, _row$original3;
1484
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors11 = data.Errors) === null || _data$Errors11 === void 0 ? void 0 : _data$Errors11.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data11 = data.data) === null || _data$data11 === void 0 ? void 0 : (_data$data11$Errors = _data$data11.Errors) === null || _data$data11$Errors === void 0 ? void 0 : _data$data11$Errors.length) > 0;
1485
+ if (isError) {
1486
+ var _data$data12, _data$data12$Errors, _data$data12$Errors$, _data$Errors12, _data$Errors12$;
1487
+ setShowToast({
1488
+ key: "error",
1489
+ label: (data === null || data === void 0 ? void 0 : (_data$data12 = data.data) === null || _data$data12 === void 0 ? void 0 : (_data$data12$Errors = _data$data12.Errors) === null || _data$data12$Errors === void 0 ? void 0 : (_data$data12$Errors$ = _data$data12$Errors[0]) === null || _data$data12$Errors$ === void 0 ? void 0 : _data$data12$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors12 = data.Errors) === null || _data$Errors12 === void 0 ? void 0 : (_data$Errors12$ = _data$Errors12[0]) === null || _data$Errors12$ === void 0 ? void 0 : _data$Errors12$.message) || (data === null || data === void 0 ? void 0 : data.message) || "Failed to map filling point"
1490
+ });
1491
+ return;
1492
+ }
1415
1493
  const mappedVendor = getSelectedVendorOption(row.original, vendors);
1416
1494
  const vendorDrivers = getVendorDriversForFillingPoint(mappedVendor, selectedOption);
1417
1495
  const selectedDriver = getSelectedDriverOption(row.original, vendorDrivers);
@@ -1435,11 +1513,12 @@ const VendorInbox = props => {
1435
1513
  });
1436
1514
  };
1437
1515
  const onSurveyorSupervisorSelect = (row, selectedSupervisor) => {
1438
- var _selectedSupervisor$o, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1516
+ var _selectedSupervisor$o, _selectedSupervisor$o2, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1439
1517
  let formDetails = row.original;
1440
1518
  const formData = {
1441
1519
  surveyor: _extends({}, formDetails, {
1442
- supervisorId: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.id) || (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : (_selectedSupervisor$o = selectedSupervisor.owner) === null || _selectedSupervisor$o === void 0 ? void 0 : _selectedSupervisor$o.uuid) || null,
1520
+ supervisorId: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.name) || (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : (_selectedSupervisor$o = selectedSupervisor.owner) === null || _selectedSupervisor$o === void 0 ? void 0 : _selectedSupervisor$o.name) || null,
1521
+ supervisorName: (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : selectedSupervisor.name) || (selectedSupervisor === null || selectedSupervisor === void 0 ? void 0 : (_selectedSupervisor$o2 = selectedSupervisor.owner) === null || _selectedSupervisor$o2 === void 0 ? void 0 : _selectedSupervisor$o2.name) || null,
1443
1522
  owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1444
1523
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1445
1524
  dob: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner0 = formDetails.owner) === null || _formDetails$owner0 === void 0 ? void 0 : _formDetails$owner0.dob) || new Date("1/1/1970").getTime(),
@@ -1455,7 +1534,17 @@ const VendorInbox = props => {
1455
1534
  label: (error === null || error === void 0 ? void 0 : error.message) || error || t("ES_FSM_REGISTRY_INBOX_FAILED_TO_UPDATE_SUPERVISOR")
1456
1535
  });
1457
1536
  },
1458
- onSuccess: () => {
1537
+ onSuccess: data => {
1538
+ var _data$Errors13, _data$data13, _data$data13$Errors;
1539
+ const isError = (data === null || data === void 0 ? void 0 : data.error) === true || (data === null || data === void 0 ? void 0 : (_data$Errors13 = data.Errors) === null || _data$Errors13 === void 0 ? void 0 : _data$Errors13.length) > 0 || (data === null || data === void 0 ? void 0 : (_data$data13 = data.data) === null || _data$data13 === void 0 ? void 0 : (_data$data13$Errors = _data$data13.Errors) === null || _data$data13$Errors === void 0 ? void 0 : _data$data13$Errors.length) > 0;
1540
+ if (isError) {
1541
+ var _data$data14, _data$data14$Errors, _data$data14$Errors$, _data$Errors14, _data$Errors14$;
1542
+ setShowToast({
1543
+ key: "error",
1544
+ label: (data === null || data === void 0 ? void 0 : (_data$data14 = data.data) === null || _data$data14 === void 0 ? void 0 : (_data$data14$Errors = _data$data14.Errors) === null || _data$data14$Errors === void 0 ? void 0 : (_data$data14$Errors$ = _data$data14$Errors[0]) === null || _data$data14$Errors$ === void 0 ? void 0 : _data$data14$Errors$.message) || (data === null || data === void 0 ? void 0 : (_data$Errors14 = data.Errors) === null || _data$Errors14 === void 0 ? void 0 : (_data$Errors14$ = _data$Errors14[0]) === null || _data$Errors14$ === void 0 ? void 0 : _data$Errors14$.message) || (data === null || data === void 0 ? void 0 : data.message) || t("ES_FSM_REGISTRY_INBOX_FAILED_TO_UPDATE_SUPERVISOR")
1545
+ });
1546
+ return;
1547
+ }
1459
1548
  setShowToast({
1460
1549
  key: "success",
1461
1550
  label: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_MAPPED_SUCCESSFULLY")
@@ -1518,9 +1607,9 @@ const VendorInbox = props => {
1518
1607
  const supervisors = React.useMemo(() => {
1519
1608
  const list = (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisors) || (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisor) || [];
1520
1609
  return list.map(s => {
1521
- var _s$owner2, _s$owner3;
1610
+ var _s$owner3, _s$owner4;
1522
1611
  return _extends({}, s, {
1523
- displayName: (s.name || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : _s$owner2.name) || "N/A") + " (" + (((_s$owner3 = s.owner) === null || _s$owner3 === void 0 ? void 0 : _s$owner3.mobileNumber) || s.mobileNo || "N/A") + ")"
1612
+ displayName: (s.name || ((_s$owner3 = s.owner) === null || _s$owner3 === void 0 ? void 0 : _s$owner3.name) || "N/A") + " (" + (((_s$owner4 = s.owner) === null || _s$owner4 === void 0 ? void 0 : _s$owner4.mobileNumber) || s.mobileNo || "N/A") + ")"
1524
1613
  });
1525
1614
  });
1526
1615
  }, [supervisorSearchResponse]);
@@ -2061,9 +2150,9 @@ const VendorInbox = props => {
2061
2150
  }, {
2062
2151
  Header: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME"),
2063
2152
  exportAccessor: row => {
2064
- var _selectedSupervisor$o2, _row$reportingManager2;
2153
+ var _selectedSupervisor$o3, _row$reportingManager2;
2065
2154
  const selectedSupervisor = getSelectedSupervisorOption(row, supervisors);
2066
- return selectedSupervisor ? selectedSupervisor.name || ((_selectedSupervisor$o2 = selectedSupervisor.owner) === null || _selectedSupervisor$o2 === void 0 ? void 0 : _selectedSupervisor$o2.name) : (row === null || row === void 0 ? void 0 : row.supervisorName) || (row === null || row === void 0 ? void 0 : (_row$reportingManager2 = row.reportingManager) === null || _row$reportingManager2 === void 0 ? void 0 : _row$reportingManager2.name) || "NA";
2155
+ return selectedSupervisor ? selectedSupervisor.name || ((_selectedSupervisor$o3 = selectedSupervisor.owner) === null || _selectedSupervisor$o3 === void 0 ? void 0 : _selectedSupervisor$o3.name) : (row === null || row === void 0 ? void 0 : row.supervisorName) || (row === null || row === void 0 ? void 0 : (_row$reportingManager2 = row.reportingManager) === null || _row$reportingManager2 === void 0 ? void 0 : _row$reportingManager2.name) || "NA";
2067
2156
  }
2068
2157
  }, {
2069
2158
  Header: t("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),
@@ -2246,7 +2335,7 @@ const VendorInbox = props => {
2246
2335
  }
2247
2336
  }, result)), showToast && /*#__PURE__*/React.createElement(Toast, {
2248
2337
  error: showToast.key === "error" ? true : false,
2249
- label: showToast.label ? t(showToast.label) : t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_DISABLE_SUCCESS" : showToast.action),
2338
+ label: showToast.label ? t(showToast.label) : showToast.key === "success" ? t("ES_FSM_REGISTRY_" + showToast.action + "_" + (showToast.isDisable ? "DISABLE" : "ENABLE") + "_SUCCESS") : t(showToast.action),
2250
2339
  onClose: closeToast
2251
2340
  }), showWorkOrderModal && /*#__PURE__*/React.createElement(Modal, {
2252
2341
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
@@ -2878,7 +2967,7 @@ const SupervisorDetails = props => {
2878
2967
  showSuccessToast: true,
2879
2968
  message: {
2880
2969
  key: "success",
2881
- action: "DELETE_SUPERVISOR"
2970
+ action: t("ES_VENDOR_DELETE_SUPERVISOR_SUCCESS")
2882
2971
  }
2883
2972
  }
2884
2973
  });
@@ -3078,7 +3167,7 @@ const SupervisorDetails = props => {
3078
3167
  title: "ES_VENDOR_SUPERVISOR_DELETE_TEXT"
3079
3168
  }))), showToast && /*#__PURE__*/React.createElement(Toast, {
3080
3169
  error: showToast.key === "error",
3081
- label: t(showToast.key === "success" ? "ES_VENDOR_" + showToast.action + "_SUCCESS" : showToast.action),
3170
+ label: showToast.key === "success" ? t("ES_VENDOR_" + showToast.action + "_SUCCESS", showToast.action === "UPDATE_SUPERVISOR" ? "Supervisor updated successfully" : undefined) : t(showToast.action),
3082
3171
  onClose: () => setShowToast(null),
3083
3172
  duration: 5000
3084
3173
  }), /*#__PURE__*/React.createElement(ActionBar, {
@@ -3225,7 +3314,7 @@ const AddSupervisor = _ref => {
3225
3314
  canSubmit = _useState2[0],
3226
3315
  setCanSubmit = _useState2[1];
3227
3316
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorCreate(tenantId),
3228
- mutateAsync = _Digit$Hooks$fsm$useS.mutate;
3317
+ mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
3229
3318
  const history = useHistory();
3230
3319
  const Config = SupervisorConfig(t);
3231
3320
  const defaultValues = {
@@ -3308,7 +3397,7 @@ const AddSupervisor = _ref => {
3308
3397
  showSuccessToast: true,
3309
3398
  message: {
3310
3399
  key: "success",
3311
- action: "ES_VENDOR_ADD_SURVEYOR_SUCCESS"
3400
+ action: t("ES_VENDOR_ADD_SUPERVISOR_SUCCESS")
3312
3401
  }
3313
3402
  }
3314
3403
  });
@@ -3519,7 +3608,7 @@ const SurveyorDetails = props => {
3519
3608
  showSuccessToast: true,
3520
3609
  message: {
3521
3610
  key: "success",
3522
- action: "ES_VENDOR_DELETE_SURVEYOR_SUCCESS"
3611
+ action: t("ES_VENDOR_DELETE_SURVEYOR_SUCCESS")
3523
3612
  }
3524
3613
  }
3525
3614
  });
@@ -3624,7 +3713,7 @@ const SurveyorDetails = props => {
3624
3713
  }
3625
3714
  }, renderModalContent())), showToast && /*#__PURE__*/React.createElement(Toast, {
3626
3715
  error: showToast.key === "error",
3627
- label: t(showToast.key === "success" ? "ES_VENDOR_" + showToast.action + "_SUCCESS" : showToast.action),
3716
+ label: showToast.key === "success" ? t("ES_VENDOR_" + showToast.action + "_SUCCESS", showToast.action === "UPDATE_SURVEYOR" ? "Surveyor updated successfully" : undefined) : t(showToast.action),
3628
3717
  onClose: closeToast
3629
3718
  }), /*#__PURE__*/React.createElement(ActionBar, {
3630
3719
  style: {
@@ -3764,7 +3853,10 @@ const VendorDetails = () => {
3764
3853
  case "EDIT":
3765
3854
  return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vendor/" + (dsoId || vendorId));
3766
3855
  case "HOME":
3767
- return history.push("/digit-ui/" + userType + "/vendor/registry?selectedTabs=VENDOR");
3856
+ if (userType === "citizen") {
3857
+ return history.push("/digit-ui/citizen/vendor");
3858
+ }
3859
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VENDOR");
3768
3860
  }
3769
3861
  }, [selectedAction]);
3770
3862
  useEffect(() => {
@@ -7929,7 +8021,7 @@ const CloseBtn$1 = props => {
7929
8021
  }, /*#__PURE__*/React.createElement(CloseSvg, null));
7930
8022
  };
7931
8023
  const DriverDetails = () => {
7932
- var _driverData$5, _driverData$5$employe;
8024
+ var _Digit$UserService$ge, _userInfo$type, _driverData$5, _driverData$5$employe;
7933
8025
  const tenantId = Digit.ULBService.getCurrentTenantId();
7934
8026
  const _useTranslation = useTranslation(),
7935
8027
  t = _useTranslation.t;
@@ -7937,6 +8029,8 @@ const DriverDetails = () => {
7937
8029
  const queryClient = useQueryClient();
7938
8030
  const _useParams = useParams(),
7939
8031
  dsoId = _useParams.id;
8032
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
8033
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$type = userInfo.type) === null || _userInfo$type === void 0 ? void 0 : _userInfo$type.toLowerCase();
7940
8034
  const _useState = useState(false),
7941
8035
  displayMenu = _useState[0],
7942
8036
  setDisplayMenu = _useState[1];
@@ -7994,9 +8088,12 @@ const DriverDetails = () => {
7994
8088
  case "DELETE_VENDOR":
7995
8089
  return setShowModal(true);
7996
8090
  case "EDIT":
7997
- return history.push("/digit-ui/employee/fsm/registry/modify-driver/" + dsoId);
8091
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-driver/" + dsoId);
7998
8092
  case "HOME":
7999
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER");
8093
+ if (userType === "citizen") {
8094
+ return history.push("/digit-ui/citizen/vendor");
8095
+ }
8096
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=DRIVER");
8000
8097
  }
8001
8098
  }, [selectedAction]);
8002
8099
  const closeToast = () => {
@@ -8785,7 +8882,7 @@ const CloseBtn$2 = props => {
8785
8882
  }, /*#__PURE__*/React.createElement(CloseSvg, null));
8786
8883
  };
8787
8884
  const VehicleDetails = props => {
8788
- var _vehicleData$6, _vehicleData$6$employ;
8885
+ var _Digit$UserService$ge, _userInfo$type, _vehicleData$6, _vehicleData$6$employ;
8789
8886
  const tenantId = Digit.ULBService.getCurrentTenantId();
8790
8887
  const _useTranslation = useTranslation(),
8791
8888
  t = _useTranslation.t;
@@ -8793,6 +8890,8 @@ const VehicleDetails = props => {
8793
8890
  const queryClient = useQueryClient();
8794
8891
  let _useParams = useParams(),
8795
8892
  vehicleNumber = _useParams.id;
8893
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
8894
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$type = userInfo.type) === null || _userInfo$type === void 0 ? void 0 : _userInfo$type.toLowerCase();
8796
8895
  const _useState = useState(false),
8797
8896
  displayMenu = _useState[0],
8798
8897
  setDisplayMenu = _useState[1];
@@ -8859,9 +8958,12 @@ const VehicleDetails = props => {
8859
8958
  case "DELETE_VENDOR":
8860
8959
  return setShowModal(true);
8861
8960
  case "EDIT":
8862
- return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
8961
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vehicle/" + vehicleNumber);
8863
8962
  case "HOME":
8864
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
8963
+ if (userType === "citizen") {
8964
+ return history.push("/digit-ui/citizen/vendor");
8965
+ }
8966
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8865
8967
  }
8866
8968
  }, [selectedAction]);
8867
8969
  const closeToast = () => {
@@ -9205,18 +9307,36 @@ const SelectEkycZones = _ref => {
9205
9307
  }
9206
9308
  }, [boundaryData]);
9207
9309
  useEffect(() => {
9208
- if (!zones.length || !Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds)) return;
9209
- if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9210
- setSelectedZones(formData.zoneIds);
9211
- return;
9212
- }
9213
- const selected = zones.filter(zone => formData.zoneIds.includes(zone.name));
9214
- setSelectedZones(selected);
9215
- if (!initialized.current) {
9216
- initialized.current = true;
9217
- onSelect(config.key, selected);
9310
+ if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
9311
+ if (isMultiSelect) {
9312
+ if (!Array.isArray(formData.zoneIds)) return;
9313
+ if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9314
+ setSelectedZones(formData.zoneIds);
9315
+ return;
9316
+ }
9317
+ const selected = zones.filter(zone => formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code));
9318
+ setSelectedZones(selected);
9319
+ if (!initialized.current) {
9320
+ initialized.current = true;
9321
+ onSelect(config.key, selected);
9322
+ }
9323
+ } else {
9324
+ let selectedVal = formData.zoneIds;
9325
+ if (Array.isArray(selectedVal)) {
9326
+ var _selectedVal$, _selectedVal$2;
9327
+ selectedVal = ((_selectedVal$ = selectedVal[0]) === null || _selectedVal$ === void 0 ? void 0 : _selectedVal$.name) || ((_selectedVal$2 = selectedVal[0]) === null || _selectedVal$2 === void 0 ? void 0 : _selectedVal$2.code) || selectedVal[0] || "";
9328
+ }
9329
+ if (typeof selectedVal === "object") {
9330
+ selectedVal = selectedVal.name || selectedVal.code || "";
9331
+ }
9332
+ const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
9333
+ setSelectedZones(selected ? [selected] : []);
9334
+ if (!initialized.current && selected) {
9335
+ initialized.current = true;
9336
+ onSelect(config.key, selected.name || "");
9337
+ }
9218
9338
  }
9219
- }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
9339
+ }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect, isMultiSelect]);
9220
9340
  const handleSelect = value => {
9221
9341
  if (isMultiSelect) {
9222
9342
  const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
@@ -9225,7 +9345,7 @@ const SelectEkycZones = _ref => {
9225
9345
  } else {
9226
9346
  const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9227
9347
  setSelectedZones(selectedZone ? [selectedZone] : []);
9228
- onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.code) || "");
9348
+ onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
9229
9349
  }
9230
9350
  };
9231
9351
  if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);