@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.
package/dist/index.js CHANGED
@@ -227,7 +227,7 @@ const AddSurveyor = _ref => {
227
227
  showSuccessToast: true,
228
228
  message: {
229
229
  key: "success",
230
- action: "ES_VENDOR_ADD_SURVEYOR_SUCCESS"
230
+ action: t("ES_VENDOR_ADD_SURVEYOR_SUCCESS")
231
231
  }
232
232
  }
233
233
  });
@@ -918,8 +918,8 @@ const getSelectedSupervisorOption = function (row, supervisorsList) {
918
918
  const supervisorId = (_row27 = row) === null || _row27 === void 0 ? void 0 : _row27.supervisorId;
919
919
  if (!supervisorId) return null;
920
920
  return supervisorsList.find(s => {
921
- var _s$owner;
922
- return s.id === supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === supervisorId;
921
+ var _s$owner, _s$owner2;
922
+ 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;
923
923
  }) || null;
924
924
  };
925
925
  const getVendorFillingPoints = function (vendor) {
@@ -1188,9 +1188,10 @@ const VendorInbox = props => {
1188
1188
  const onVendorUpdate = row => {
1189
1189
  var _formDetails$owner, _formDetails$owner2, _formDetails$owner3, _formDetails$owner4;
1190
1190
  let formDetails = row.original.dsoDetails;
1191
+ const isDisable = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE";
1191
1192
  const formData = {
1192
1193
  vendor: _extends({}, formDetails, {
1193
- status: (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE",
1194
+ status: isDisable ? "DISABLED" : "ACTIVE",
1194
1195
  owner: _extends({}, formDetails.owner, {
1195
1196
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner = formDetails.owner) === null || _formDetails$owner === void 0 ? void 0 : _formDetails$owner.gender) || "OTHER",
1196
1197
  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(),
@@ -1203,48 +1204,72 @@ const VendorInbox = props => {
1203
1204
  onError: (error, variables) => {
1204
1205
  setShowToast({
1205
1206
  key: "error",
1206
- action: error
1207
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1207
1208
  });
1208
1209
  },
1209
1210
  onSuccess: (data, variables) => {
1210
- setShowToast({
1211
- key: "success",
1212
- action: "VENDOR"
1213
- });
1214
- queryClient.invalidateQueries("DSO_SEARCH");
1215
- props.refetchData();
1211
+ var _data$Errors, _data$data, _data$data$Errors;
1212
+ 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;
1213
+ if (isError) {
1214
+ var _data$data2, _data$data2$Errors, _data$data2$Errors$, _data$Errors2, _data$Errors2$;
1215
+ setShowToast({
1216
+ key: "error",
1217
+ 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"
1218
+ });
1219
+ } else {
1220
+ setShowToast({
1221
+ key: "success",
1222
+ action: "VENDOR",
1223
+ isDisable
1224
+ });
1225
+ queryClient.invalidateQueries("DSO_SEARCH");
1226
+ props.refetchData();
1227
+ }
1216
1228
  }
1217
1229
  });
1218
1230
  };
1219
1231
  const onVehicleUpdate = row => {
1220
1232
  var _row$original;
1233
+ const isDisable = ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.status) === "ACTIVE";
1221
1234
  const formData = getVehicleUpdatePayload(row.original, {
1222
- status: ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.status) === "ACTIVE" ? "DISABLED" : "ACTIVE"
1235
+ status: isDisable ? "DISABLED" : "ACTIVE"
1223
1236
  });
1224
1237
  mutateVehicle(formData, {
1225
1238
  onError: (error, variables) => {
1226
1239
  setShowToast({
1227
1240
  key: "error",
1228
- action: error
1241
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1229
1242
  });
1230
1243
  },
1231
1244
  onSuccess: (data, variables) => {
1232
- setShowToast({
1233
- key: "success",
1234
- action: "VEHICLE"
1235
- });
1236
- queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1237
- props.refetchVendor();
1238
- props.refetchData();
1245
+ var _data$Errors3, _data$data3, _data$data3$Errors;
1246
+ 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;
1247
+ if (isError) {
1248
+ var _data$data4, _data$data4$Errors, _data$data4$Errors$, _data$Errors4, _data$Errors4$;
1249
+ setShowToast({
1250
+ key: "error",
1251
+ 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"
1252
+ });
1253
+ } else {
1254
+ setShowToast({
1255
+ key: "success",
1256
+ action: "VEHICLE",
1257
+ isDisable
1258
+ });
1259
+ queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1260
+ props.refetchVendor();
1261
+ props.refetchData();
1262
+ }
1239
1263
  }
1240
1264
  });
1241
1265
  };
1242
1266
  const onDriverUpdate = row => {
1243
1267
  var _formDetails$owner5, _formDetails$owner6, _formDetails$owner7, _formDetails$owner8;
1244
1268
  let formDetails = row.original;
1269
+ const isDisable = (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE";
1245
1270
  const formData = {
1246
1271
  driver: _extends({}, formDetails, {
1247
- status: (formDetails === null || formDetails === void 0 ? void 0 : formDetails.status) === "ACTIVE" ? "DISABLED" : "ACTIVE",
1272
+ status: isDisable ? "DISABLED" : "ACTIVE",
1248
1273
  owner: _extends({}, formDetails.owner, {
1249
1274
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner5 = formDetails.owner) === null || _formDetails$owner5 === void 0 ? void 0 : _formDetails$owner5.gender) || "OTHER",
1250
1275
  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(),
@@ -1257,17 +1282,28 @@ const VendorInbox = props => {
1257
1282
  onError: (error, variables) => {
1258
1283
  setShowToast({
1259
1284
  key: "error",
1260
- action: error
1285
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1261
1286
  });
1262
1287
  },
1263
1288
  onSuccess: (data, variables) => {
1264
- setShowToast({
1265
- key: "success",
1266
- action: "DRIVER"
1267
- });
1268
- queryClient.invalidateQueries("FSM_DRIVER_SEARCH");
1269
- props.refetchVendor();
1270
- props.refetchData();
1289
+ var _data$Errors5, _data$data5, _data$data5$Errors;
1290
+ 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;
1291
+ if (isError) {
1292
+ var _data$data6, _data$data6$Errors, _data$data6$Errors$, _data$Errors6, _data$Errors6$;
1293
+ setShowToast({
1294
+ key: "error",
1295
+ 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"
1296
+ });
1297
+ } else {
1298
+ setShowToast({
1299
+ key: "success",
1300
+ action: "DRIVER",
1301
+ isDisable
1302
+ });
1303
+ queryClient.invalidateQueries("FSM_DRIVER_SEARCH");
1304
+ props.refetchVendor();
1305
+ props.refetchData();
1306
+ }
1271
1307
  }
1272
1308
  });
1273
1309
  };
@@ -1336,10 +1372,20 @@ const VendorInbox = props => {
1336
1372
  onError: error => {
1337
1373
  setShowToast({
1338
1374
  key: "error",
1339
- action: error
1375
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1340
1376
  });
1341
1377
  },
1342
- onSuccess: () => {
1378
+ onSuccess: data => {
1379
+ var _data$Errors7, _data$data7, _data$data7$Errors;
1380
+ 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;
1381
+ if (isError) {
1382
+ var _data$data8, _data$data8$Errors, _data$data8$Errors$, _data$Errors8, _data$Errors8$;
1383
+ setShowToast({
1384
+ key: "error",
1385
+ 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"
1386
+ });
1387
+ return;
1388
+ }
1343
1389
  updateVehicleRowState(currentVehicle === null || currentVehicle === void 0 ? void 0 : currentVehicle.id, {
1344
1390
  vendor: updatedSelectedVendor,
1345
1391
  fillingPoint: null,
@@ -1348,7 +1394,8 @@ const VendorInbox = props => {
1348
1394
  });
1349
1395
  setShowToast({
1350
1396
  key: "success",
1351
- action: "VEHICLE"
1397
+ action: "VEHICLE",
1398
+ isDisable: false
1352
1399
  });
1353
1400
  queryClient.invalidateQueries("DSO_SEARCH");
1354
1401
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
@@ -1365,10 +1412,22 @@ const VendorInbox = props => {
1365
1412
  onError: error => {
1366
1413
  setShowToast({
1367
1414
  key: "error",
1368
- action: error
1415
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1369
1416
  });
1370
1417
  },
1371
- onSuccess: addVehicleToSelectedVendor
1418
+ onSuccess: data => {
1419
+ var _data$Errors9, _data$data9, _data$data9$Errors;
1420
+ 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;
1421
+ if (isError) {
1422
+ var _data$data0, _data$data0$Errors, _data$data0$Errors$, _data$Errors0, _data$Errors0$;
1423
+ setShowToast({
1424
+ key: "error",
1425
+ 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"
1426
+ });
1427
+ return;
1428
+ }
1429
+ addVehicleToSelectedVendor();
1430
+ }
1372
1431
  });
1373
1432
  return;
1374
1433
  }
@@ -1382,17 +1441,27 @@ const VendorInbox = props => {
1382
1441
  onError: (error, variables) => {
1383
1442
  setShowToast({
1384
1443
  key: "error",
1385
- action: error
1444
+ action: (error === null || error === void 0 ? void 0 : error.message) || "UPDATE_FAILED"
1386
1445
  });
1387
1446
  },
1388
1447
  onSuccess: (data, variables) => {
1389
- var _row$original2;
1448
+ var _data$Errors1, _data$data1, _data$data1$Errors, _row$original2;
1449
+ 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;
1450
+ if (isError) {
1451
+ var _data$data10, _data$data10$Errors, _data$data10$Errors$, _data$Errors10, _data$Errors10$;
1452
+ setShowToast({
1453
+ key: "error",
1454
+ 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"
1455
+ });
1456
+ return;
1457
+ }
1390
1458
  updateVehicleRowState((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.id, {
1391
1459
  driverData: selectedOption
1392
1460
  });
1393
1461
  setShowToast({
1394
1462
  key: "success",
1395
- action: "VEHICLE"
1463
+ action: "VEHICLE",
1464
+ isDisable: false
1396
1465
  });
1397
1466
  queryClient.invalidateQueries("FSM_VEICLES_SEARCH");
1398
1467
  queryClient.invalidateQueries("DSO_SEARCH");
@@ -1413,8 +1482,17 @@ const VendorInbox = props => {
1413
1482
  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"
1414
1483
  });
1415
1484
  },
1416
- onSuccess: () => {
1417
- var _row$original3;
1485
+ onSuccess: data => {
1486
+ var _data$Errors11, _data$data11, _data$data11$Errors, _row$original3;
1487
+ 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;
1488
+ if (isError) {
1489
+ var _data$data12, _data$data12$Errors, _data$data12$Errors$, _data$Errors12, _data$Errors12$;
1490
+ setShowToast({
1491
+ key: "error",
1492
+ 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"
1493
+ });
1494
+ return;
1495
+ }
1418
1496
  const mappedVendor = getSelectedVendorOption(row.original, vendors);
1419
1497
  const vendorDrivers = getVendorDriversForFillingPoint(mappedVendor, selectedOption);
1420
1498
  const selectedDriver = getSelectedDriverOption(row.original, vendorDrivers);
@@ -1438,11 +1516,12 @@ const VendorInbox = props => {
1438
1516
  });
1439
1517
  };
1440
1518
  const onSurveyorSupervisorSelect = (row, selectedSupervisor) => {
1441
- var _selectedSupervisor$o, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1519
+ var _selectedSupervisor$o, _selectedSupervisor$o2, _formDetails$owner9, _formDetails$owner0, _formDetails$owner1, _formDetails$owner10;
1442
1520
  let formDetails = row.original;
1443
1521
  const formData = {
1444
1522
  surveyor: _extends({}, formDetails, {
1445
- 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,
1523
+ 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,
1524
+ 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,
1446
1525
  owner: _extends({}, formDetails === null || formDetails === void 0 ? void 0 : formDetails.owner, {
1447
1526
  gender: (formDetails === null || formDetails === void 0 ? void 0 : (_formDetails$owner9 = formDetails.owner) === null || _formDetails$owner9 === void 0 ? void 0 : _formDetails$owner9.gender) || "OTHERS",
1448
1527
  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(),
@@ -1458,7 +1537,17 @@ const VendorInbox = props => {
1458
1537
  label: (error === null || error === void 0 ? void 0 : error.message) || error || t("ES_FSM_REGISTRY_INBOX_FAILED_TO_UPDATE_SUPERVISOR")
1459
1538
  });
1460
1539
  },
1461
- onSuccess: () => {
1540
+ onSuccess: data => {
1541
+ var _data$Errors13, _data$data13, _data$data13$Errors;
1542
+ 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;
1543
+ if (isError) {
1544
+ var _data$data14, _data$data14$Errors, _data$data14$Errors$, _data$Errors14, _data$Errors14$;
1545
+ setShowToast({
1546
+ key: "error",
1547
+ 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")
1548
+ });
1549
+ return;
1550
+ }
1462
1551
  setShowToast({
1463
1552
  key: "success",
1464
1553
  label: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_MAPPED_SUCCESSFULLY")
@@ -1521,9 +1610,9 @@ const VendorInbox = props => {
1521
1610
  const supervisors = React__default.useMemo(() => {
1522
1611
  const list = (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisors) || (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : supervisorSearchResponse.supervisor) || [];
1523
1612
  return list.map(s => {
1524
- var _s$owner2, _s$owner3;
1613
+ var _s$owner3, _s$owner4;
1525
1614
  return _extends({}, s, {
1526
- 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") + ")"
1615
+ 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") + ")"
1527
1616
  });
1528
1617
  });
1529
1618
  }, [supervisorSearchResponse]);
@@ -2064,9 +2153,9 @@ const VendorInbox = props => {
2064
2153
  }, {
2065
2154
  Header: t("ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME"),
2066
2155
  exportAccessor: row => {
2067
- var _selectedSupervisor$o2, _row$reportingManager2;
2156
+ var _selectedSupervisor$o3, _row$reportingManager2;
2068
2157
  const selectedSupervisor = getSelectedSupervisorOption(row, supervisors);
2069
- 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";
2158
+ 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";
2070
2159
  }
2071
2160
  }, {
2072
2161
  Header: t("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),
@@ -2249,7 +2338,7 @@ const VendorInbox = props => {
2249
2338
  }
2250
2339
  }, result)), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
2251
2340
  error: showToast.key === "error" ? true : false,
2252
- label: showToast.label ? t(showToast.label) : t(showToast.key === "success" ? "ES_FSM_REGISTRY_" + showToast.action + "_DISABLE_SUCCESS" : showToast.action),
2341
+ label: showToast.label ? t(showToast.label) : showToast.key === "success" ? t("ES_FSM_REGISTRY_" + showToast.action + "_" + (showToast.isDisable ? "DISABLE" : "ENABLE") + "_SUCCESS") : t(showToast.action),
2253
2342
  onClose: closeToast
2254
2343
  }), showWorkOrderModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
2255
2344
  headerBarMain: /*#__PURE__*/React__default.createElement("h1", {
@@ -2881,7 +2970,7 @@ const SupervisorDetails = props => {
2881
2970
  showSuccessToast: true,
2882
2971
  message: {
2883
2972
  key: "success",
2884
- action: "DELETE_SUPERVISOR"
2973
+ action: t("ES_VENDOR_DELETE_SUPERVISOR_SUCCESS")
2885
2974
  }
2886
2975
  }
2887
2976
  });
@@ -3081,7 +3170,7 @@ const SupervisorDetails = props => {
3081
3170
  title: "ES_VENDOR_SUPERVISOR_DELETE_TEXT"
3082
3171
  }))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
3083
3172
  error: showToast.key === "error",
3084
- label: t(showToast.key === "success" ? "ES_VENDOR_" + showToast.action + "_SUCCESS" : showToast.action),
3173
+ label: showToast.key === "success" ? t("ES_VENDOR_" + showToast.action + "_SUCCESS", showToast.action === "UPDATE_SUPERVISOR" ? "Supervisor updated successfully" : undefined) : t(showToast.action),
3085
3174
  onClose: () => setShowToast(null),
3086
3175
  duration: 5000
3087
3176
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, {
@@ -3228,7 +3317,7 @@ const AddSupervisor = _ref => {
3228
3317
  canSubmit = _useState2[0],
3229
3318
  setCanSubmit = _useState2[1];
3230
3319
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorCreate(tenantId),
3231
- mutateAsync = _Digit$Hooks$fsm$useS.mutate;
3320
+ mutateAsync = _Digit$Hooks$fsm$useS.mutateAsync;
3232
3321
  const history = reactRouterDom.useHistory();
3233
3322
  const Config = SupervisorConfig(t);
3234
3323
  const defaultValues = {
@@ -3311,7 +3400,7 @@ const AddSupervisor = _ref => {
3311
3400
  showSuccessToast: true,
3312
3401
  message: {
3313
3402
  key: "success",
3314
- action: "ES_VENDOR_ADD_SURVEYOR_SUCCESS"
3403
+ action: t("ES_VENDOR_ADD_SUPERVISOR_SUCCESS")
3315
3404
  }
3316
3405
  }
3317
3406
  });
@@ -3522,7 +3611,7 @@ const SurveyorDetails = props => {
3522
3611
  showSuccessToast: true,
3523
3612
  message: {
3524
3613
  key: "success",
3525
- action: "ES_VENDOR_DELETE_SURVEYOR_SUCCESS"
3614
+ action: t("ES_VENDOR_DELETE_SURVEYOR_SUCCESS")
3526
3615
  }
3527
3616
  }
3528
3617
  });
@@ -3627,7 +3716,7 @@ const SurveyorDetails = props => {
3627
3716
  }
3628
3717
  }, renderModalContent())), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
3629
3718
  error: showToast.key === "error",
3630
- label: t(showToast.key === "success" ? "ES_VENDOR_" + showToast.action + "_SUCCESS" : showToast.action),
3719
+ label: showToast.key === "success" ? t("ES_VENDOR_" + showToast.action + "_SUCCESS", showToast.action === "UPDATE_SURVEYOR" ? "Surveyor updated successfully" : undefined) : t(showToast.action),
3631
3720
  onClose: closeToast
3632
3721
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, {
3633
3722
  style: {
@@ -3767,7 +3856,10 @@ const VendorDetails = () => {
3767
3856
  case "EDIT":
3768
3857
  return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vendor/" + (dsoId || vendorId));
3769
3858
  case "HOME":
3770
- return history.push("/digit-ui/" + userType + "/vendor/registry?selectedTabs=VENDOR");
3859
+ if (userType === "citizen") {
3860
+ return history.push("/digit-ui/citizen/vendor");
3861
+ }
3862
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VENDOR");
3771
3863
  }
3772
3864
  }, [selectedAction]);
3773
3865
  React.useEffect(() => {
@@ -7932,7 +8024,7 @@ const CloseBtn$1 = props => {
7932
8024
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
7933
8025
  };
7934
8026
  const DriverDetails = () => {
7935
- var _driverData$5, _driverData$5$employe;
8027
+ var _Digit$UserService$ge, _userInfo$type, _driverData$5, _driverData$5$employe;
7936
8028
  const tenantId = Digit.ULBService.getCurrentTenantId();
7937
8029
  const _useTranslation = reactI18next.useTranslation(),
7938
8030
  t = _useTranslation.t;
@@ -7940,6 +8032,8 @@ const DriverDetails = () => {
7940
8032
  const queryClient = reactQuery.useQueryClient();
7941
8033
  const _useParams = reactRouterDom.useParams(),
7942
8034
  dsoId = _useParams.id;
8035
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
8036
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$type = userInfo.type) === null || _userInfo$type === void 0 ? void 0 : _userInfo$type.toLowerCase();
7943
8037
  const _useState = React.useState(false),
7944
8038
  displayMenu = _useState[0],
7945
8039
  setDisplayMenu = _useState[1];
@@ -7997,9 +8091,12 @@ const DriverDetails = () => {
7997
8091
  case "DELETE_VENDOR":
7998
8092
  return setShowModal(true);
7999
8093
  case "EDIT":
8000
- return history.push("/digit-ui/employee/fsm/registry/modify-driver/" + dsoId);
8094
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-driver/" + dsoId);
8001
8095
  case "HOME":
8002
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER");
8096
+ if (userType === "citizen") {
8097
+ return history.push("/digit-ui/citizen/vendor");
8098
+ }
8099
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=DRIVER");
8003
8100
  }
8004
8101
  }, [selectedAction]);
8005
8102
  const closeToast = () => {
@@ -8788,7 +8885,7 @@ const CloseBtn$2 = props => {
8788
8885
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CloseSvg, null));
8789
8886
  };
8790
8887
  const VehicleDetails = props => {
8791
- var _vehicleData$6, _vehicleData$6$employ;
8888
+ var _Digit$UserService$ge, _userInfo$type, _vehicleData$6, _vehicleData$6$employ;
8792
8889
  const tenantId = Digit.ULBService.getCurrentTenantId();
8793
8890
  const _useTranslation = reactI18next.useTranslation(),
8794
8891
  t = _useTranslation.t;
@@ -8796,6 +8893,8 @@ const VehicleDetails = props => {
8796
8893
  const queryClient = reactQuery.useQueryClient();
8797
8894
  let _useParams = reactRouterDom.useParams(),
8798
8895
  vehicleNumber = _useParams.id;
8896
+ const userInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
8897
+ const userType = userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$type = userInfo.type) === null || _userInfo$type === void 0 ? void 0 : _userInfo$type.toLowerCase();
8799
8898
  const _useState = React.useState(false),
8800
8899
  displayMenu = _useState[0],
8801
8900
  setDisplayMenu = _useState[1];
@@ -8862,9 +8961,12 @@ const VehicleDetails = props => {
8862
8961
  case "DELETE_VENDOR":
8863
8962
  return setShowModal(true);
8864
8963
  case "EDIT":
8865
- return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber);
8964
+ return history.push("/digit-ui/" + userType + "/vendor/registry/modify-vehicle/" + vehicleNumber);
8866
8965
  case "HOME":
8867
- return history.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE");
8966
+ if (userType === "citizen") {
8967
+ return history.push("/digit-ui/citizen/vendor");
8968
+ }
8969
+ return history.push("/digit-ui/" + userType + "/vendor/search-vendor?selectedTabs=VEHICLE");
8868
8970
  }
8869
8971
  }, [selectedAction]);
8870
8972
  const closeToast = () => {
@@ -9208,18 +9310,36 @@ const SelectEkycZones = _ref => {
9208
9310
  }
9209
9311
  }, [boundaryData]);
9210
9312
  React.useEffect(() => {
9211
- if (!zones.length || !Array.isArray(formData === null || formData === void 0 ? void 0 : formData.zoneIds)) return;
9212
- if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9213
- setSelectedZones(formData.zoneIds);
9214
- return;
9215
- }
9216
- const selected = zones.filter(zone => formData.zoneIds.includes(zone.name));
9217
- setSelectedZones(selected);
9218
- if (!initialized.current) {
9219
- initialized.current = true;
9220
- onSelect(config.key, selected);
9313
+ if (!zones.length || !(formData !== null && formData !== void 0 && formData.zoneIds)) return;
9314
+ if (isMultiSelect) {
9315
+ if (!Array.isArray(formData.zoneIds)) return;
9316
+ if (formData.zoneIds.length && typeof formData.zoneIds[0] === "object") {
9317
+ setSelectedZones(formData.zoneIds);
9318
+ return;
9319
+ }
9320
+ const selected = zones.filter(zone => formData.zoneIds.includes(zone.name) || formData.zoneIds.includes(zone.code));
9321
+ setSelectedZones(selected);
9322
+ if (!initialized.current) {
9323
+ initialized.current = true;
9324
+ onSelect(config.key, selected);
9325
+ }
9326
+ } else {
9327
+ let selectedVal = formData.zoneIds;
9328
+ if (Array.isArray(selectedVal)) {
9329
+ var _selectedVal$, _selectedVal$2;
9330
+ 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] || "";
9331
+ }
9332
+ if (typeof selectedVal === "object") {
9333
+ selectedVal = selectedVal.name || selectedVal.code || "";
9334
+ }
9335
+ const selected = zones.find(zone => zone.name === selectedVal || zone.code === selectedVal);
9336
+ setSelectedZones(selected ? [selected] : []);
9337
+ if (!initialized.current && selected) {
9338
+ initialized.current = true;
9339
+ onSelect(config.key, selected.name || "");
9340
+ }
9221
9341
  }
9222
- }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect]);
9342
+ }, [zones, formData === null || formData === void 0 ? void 0 : formData.zoneIds, config.key, onSelect, isMultiSelect]);
9223
9343
  const handleSelect = value => {
9224
9344
  if (isMultiSelect) {
9225
9345
  const selected = Array.isArray(value) ? value.map(v => Array.isArray(v) ? v[1] : v).filter(Boolean) : [];
@@ -9228,7 +9348,7 @@ const SelectEkycZones = _ref => {
9228
9348
  } else {
9229
9349
  const selectedZone = Array.isArray(value) ? Array.isArray(value[0]) ? value[0][1] : value[0] : value;
9230
9350
  setSelectedZones(selectedZone ? [selectedZone] : []);
9231
- onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.code) || "");
9351
+ onSelect(config.key, (selectedZone === null || selectedZone === void 0 ? void 0 : selectedZone.name) || "");
9232
9352
  }
9233
9353
  };
9234
9354
  if (isLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);