@djb25/digit-ui-module-vendor 1.0.12 → 1.0.13

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.
@@ -1,7 +1,7 @@
1
- import { Header, SearchForm, SearchField, Dropdown as Dropdown$2, MobileNumber, CardLabelError, DatePicker as DatePicker$3, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, HomeIcon, PropertyHouse, EmployeeModuleCard, Stepper, FormComposer, TickMark, FormStep, CardLabel, TextInput, LabelFieldPair, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, Label, LinkLabel, ToggleSwitch, CardSectionHeader, StatusTable, Row, EditIcon, DeleteIcon, Modal, InfoIcon, CardHeader, LinkButton, Banner } from '@djb25/digit-ui-react-components';
2
- import React, { useEffect, useMemo, useCallback, useState, Fragment } from 'react';
1
+ import React, { useEffect, useMemo, useCallback, useState, Fragment as Fragment$1 } from 'react';
3
2
  import { useTranslation } from 'react-i18next';
4
3
  import { useParams, useLocation, Switch, Link, useHistory, useRouteMatch, Route, Redirect } from 'react-router-dom';
4
+ import { Header, SearchForm, SearchField, Dropdown as Dropdown$2, MobileNumber, CardLabelError, DatePicker as DatePicker$3, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, HomeIcon, PropertyHouse, EmployeeModuleCard, Stepper, FormComposer, TickMark, FormStep, CardLabel, TextInput, LabelFieldPair, UploadFile, CardSubHeader, CardText, RadioOrSelect, ShippingTruck, CheckBox, RadioButtons, CloseSvg, Localities, RemoveableTag, ActionBar, ApplyFilterBar, AddIcon, Menu, Label, LinkLabel, ToggleSwitch, CardSectionHeader, StatusTable, Row, EditIcon, DeleteIcon, Modal, InfoIcon, CardHeader, LinkButton, Banner } from '@djb25/digit-ui-react-components';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { useQueryClient } from 'react-query';
7
7
 
@@ -381,54 +381,59 @@ const EmployeeApp = ({
381
381
  }), "Back"),
382
382
  onLeftClick: () => window.history.back(),
383
383
  breadcrumbs: getDynamicBreadcrumbs()
384
- }), /*#__PURE__*/React.createElement("div", {
385
- className: "employee-form"
386
- }, /*#__PURE__*/React.createElement(PrivateRoute, {
387
- path: `${path}/registry/new-vendor`,
388
- component: () => /*#__PURE__*/React.createElement(AddVendor, {
389
- parentRoute: path
390
- })
391
384
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
392
385
  path: `${path}/search-vendor`,
393
- component: () => /*#__PURE__*/React.createElement(SearchVendor, {
386
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(SearchVendor, Object.assign({}, props, {
394
387
  parentRoute: path
395
- })
388
+ })), layouts.normal)
396
389
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
397
390
  path: `${path}/registry/new-driver`,
398
- component: () => /*#__PURE__*/React.createElement(AddDriver, {
391
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddDriver, Object.assign({}, props, {
399
392
  parentRoute: path
400
- })
393
+ })), layouts.normal)
401
394
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
402
- path: `${path}/registry/vendor-details/:id`,
403
- component: () => /*#__PURE__*/React.createElement(EditVendorDetails, {
395
+ path: `${path}/registry/new-vehicle`,
396
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddVehicle, Object.assign({}, props, {
404
397
  parentRoute: path
405
- })
398
+ })), layouts.normal)
406
399
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
407
- path: `${path}/registry/vehicle-details/:id`,
408
- component: () => /*#__PURE__*/React.createElement(VehicleDetails, {
400
+ path: `${path}/registry/additionaldetails`,
401
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(VendorCreate, Object.assign({}, props, {
409
402
  parentRoute: path
410
- })
403
+ })), layouts.normal)
411
404
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
412
- path: `${path}/registry/new-vehicle`,
413
- component: () => /*#__PURE__*/React.createElement(AddVehicle, {
405
+ path: `${path}/registry/driver-details/:id`,
406
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(DriverDetails, Object.assign({}, props, {
414
407
  parentRoute: path
415
- })
408
+ })), layouts.action)
416
409
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
417
- path: `${path}/registry/additionaldetails`,
418
- component: () => /*#__PURE__*/React.createElement(VendorCreate, {
410
+ path: `${path}/common-search/:id`,
411
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
419
412
  parentRoute: path
420
- })
413
+ })), layouts.normal)
421
414
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
422
- path: `${path}/registry/driver-details`,
423
- component: () => /*#__PURE__*/React.createElement(DriverDetails, {
415
+ path: `${path}/registry/new-vendor`,
416
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(AddVendor, Object.assign({}, props, {
424
417
  parentRoute: path
425
- })
418
+ })), layouts.action)
426
419
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
427
- path: `${path}/common-search/:id`,
428
- component: props => /*#__PURE__*/React.createElement(SearchApp, Object.assign({}, props, {
420
+ path: `${path}/registry/vendor-details/:id`,
421
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(EditVendorDetails, Object.assign({}, props, {
429
422
  parentRoute: path
430
- }))
431
- }))))));
423
+ })), layouts.action)
424
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
425
+ path: `${path}/registry/vehicle-details/:id`,
426
+ component: renderWithLayout(props => /*#__PURE__*/React.createElement(VehicleDetails, Object.assign({}, props, {
427
+ parentRoute: path
428
+ })), layouts.action)
429
+ })))));
430
+ };
431
+ const renderWithLayout = (Component, layoutClass) => routeProps => /*#__PURE__*/React.createElement("div", {
432
+ className: layoutClass
433
+ }, /*#__PURE__*/React.createElement(Component, routeProps));
434
+ const layouts = {
435
+ normal: "employee-form",
436
+ action: "employee-form employee-form-content-with-action-bar"
432
437
  };
433
438
 
434
439
  const VENDORCard = () => {
@@ -1736,9 +1741,7 @@ const VendorSelectAddress = ({
1736
1741
  });
1737
1742
  }
1738
1743
  if (userType === "employee") {
1739
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardLabel, {
1740
- className: "card-label-smaller"
1741
- }, t("MYCITY_CODE_LABEL"), config.isMandatory ? " * " : null), /*#__PURE__*/React.createElement(Dropdown$2, {
1744
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("MYCITY_CODE_LABEL"), config.isMandatory ? " * " : null), /*#__PURE__*/React.createElement(Dropdown$2, {
1742
1745
  className: "",
1743
1746
  isMandatory: true,
1744
1747
  selected: (cities === null || cities === void 0 ? void 0 : cities.length) === 1 ? cities[0] : selectedCity,
@@ -1747,9 +1750,7 @@ const VendorSelectAddress = ({
1747
1750
  select: selectCity,
1748
1751
  optionKey: "code",
1749
1752
  t: t
1750
- }), /*#__PURE__*/React.createElement(CardLabel, {
1751
- className: "card-label-smaller"
1752
- }, t("ES_NEW_APPLICATION_LOCATION_MOHALLA"), config.isMandatory ? " * " : null), /*#__PURE__*/React.createElement(Dropdown$2, {
1753
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("ES_NEW_APPLICATION_LOCATION_MOHALLA"), config.isMandatory ? " * " : null), /*#__PURE__*/React.createElement(Dropdown$2, {
1753
1754
  className: "",
1754
1755
  isMandatory: true,
1755
1756
  selected: selectedLocality,
@@ -1757,7 +1758,7 @@ const VendorSelectAddress = ({
1757
1758
  select: selectLocality,
1758
1759
  optionKey: "name",
1759
1760
  t: t
1760
- }));
1761
+ })));
1761
1762
  }
1762
1763
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
1763
1764
  config: config,
@@ -9105,7 +9106,7 @@ const SelectServiceType = ({
9105
9106
  return /*#__PURE__*/React.createElement(Loader, null);
9106
9107
  }
9107
9108
  if (userType === "employee") {
9108
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Dropdown$2, {
9109
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, config.label), /*#__PURE__*/React.createElement(Dropdown$2, {
9109
9110
  className: "payment-form-text-input-correction",
9110
9111
  isMandatory: config.isMandatory,
9111
9112
  selected: serviceTypes,
@@ -10703,18 +10704,16 @@ const CloseBtn$1 = props => {
10703
10704
  const DriverDetails = props => {
10704
10705
  var _driverData$5, _driverData$5$employe;
10705
10706
  const tenantId = Digit.ULBService.getCurrentTenantId();
10706
- const state = Digit.ULBService.getStateId();
10707
10707
  const {
10708
10708
  t
10709
10709
  } = useTranslation();
10710
10710
  const history = useHistory();
10711
10711
  const queryClient = useQueryClient();
10712
- let {
10712
+ const {
10713
10713
  id: dsoId
10714
10714
  } = useParams();
10715
10715
  const [displayMenu, setDisplayMenu] = useState(false);
10716
10716
  const [selectedAction, setSelectedAction] = useState(null);
10717
- const [config, setCurrentConfig] = useState({});
10718
10717
  const [showModal, setShowModal] = useState(false);
10719
10718
  const [showToast, setShowToast] = useState(null);
10720
10719
  const [vendors, setVendors] = useState([]);
@@ -10987,14 +10986,8 @@ const DriverDetails = props => {
10987
10986
  if (isLoading) {
10988
10987
  return /*#__PURE__*/React.createElement(Loader, null);
10989
10988
  }
10990
- return /*#__PURE__*/React.createElement(React.Fragment, null, !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
10991
- style: {
10992
- marginBottom: "16px"
10993
- }
10994
- }, t("ES_FSM_REGISTRY_DRIVER_DETAILS")), /*#__PURE__*/React.createElement("div", {
10995
- style: !isMobile ? {
10996
- marginLeft: "-15px"
10997
- } : {}
10989
+ return !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
10990
+ className: "employee-form-content"
10998
10991
  }, /*#__PURE__*/React.createElement(Card, {
10999
10992
  style: {
11000
10993
  position: "relative"
@@ -11010,7 +11003,9 @@ const DriverDetails = props => {
11010
11003
  }
11011
11004
  }, t(detail.title)), /*#__PURE__*/React.createElement(StatusTable, null, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
11012
11005
  var _detail$values2, _detail$values3;
11013
- return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
11006
+ return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(React.Fragment, {
11007
+ key: index
11008
+ }, /*#__PURE__*/React.createElement("div", {
11014
11009
  className: `${index === (detail === null || detail === void 0 ? void 0 : (_detail$values2 = detail.values) === null || _detail$values2 === void 0 ? void 0 : _detail$values2.length) - 1 ? "row last" : "row"} border-none`
11015
11010
  }, /*#__PURE__*/React.createElement("h2", null, t(value.title)), /*#__PURE__*/React.createElement("div", {
11016
11011
  className: "value",
@@ -11085,7 +11080,7 @@ const DriverDetails = props => {
11085
11080
  }) : null, /*#__PURE__*/React.createElement(SubmitBar, {
11086
11081
  label: t("ES_COMMON_TAKE_ACTION"),
11087
11082
  onSubmit: () => setDisplayMenu(!displayMenu)
11088
- }))) : /*#__PURE__*/React.createElement(Loader, null));
11083
+ }))) : /*#__PURE__*/React.createElement(Loader, null);
11089
11084
  };
11090
11085
 
11091
11086
  const Heading$2 = props => {
@@ -11367,7 +11362,7 @@ const VehicleDetails = props => {
11367
11362
  });
11368
11363
  }
11369
11364
  if (selectedAction === "ADD_VENDOR") {
11370
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11365
+ return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11371
11366
  t: t,
11372
11367
  option: vendors,
11373
11368
  value: selectedOption,
@@ -11377,7 +11372,7 @@ const VehicleDetails = props => {
11377
11372
  }));
11378
11373
  }
11379
11374
  if (selectedAction === "EDIT_VENDOR") {
11380
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11375
+ return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(CardText, null, t(`ES_FSM_REGISTRY_SELECT_VENODOR`)), /*#__PURE__*/React.createElement(Dropdown$2, {
11381
11376
  t: t,
11382
11377
  option: vendors,
11383
11378
  value: selectedOption,
@@ -11387,7 +11382,6 @@ const VehicleDetails = props => {
11387
11382
  }));
11388
11383
  }
11389
11384
  };
11390
- const isMobile = window.Digit.Utils.browser.isMobile();
11391
11385
  const modalHeading = () => {
11392
11386
  switch (selectedAction) {
11393
11387
  case "DELETE":
@@ -11402,15 +11396,8 @@ const VehicleDetails = props => {
11402
11396
  if (isLoading) {
11403
11397
  return /*#__PURE__*/React.createElement(Loader, null);
11404
11398
  }
11405
- return /*#__PURE__*/React.createElement(React.Fragment, null, !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
11406
- style: {
11407
- marginBottom: "16px"
11408
- }
11409
- }, t("ES_FSM_REGISTRY_VEHICLE_DETAILS")), /*#__PURE__*/React.createElement("div", {
11410
- style: !isMobile ? {
11411
- marginLeft: "-15px"
11412
- } : {}
11413
- }, /*#__PURE__*/React.createElement(Card, {
11399
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, {
11400
+ className: "vehicle-details-card",
11414
11401
  style: {
11415
11402
  position: "relative"
11416
11403
  }
@@ -11425,7 +11412,7 @@ const VehicleDetails = props => {
11425
11412
  }
11426
11413
  }, t(detail.title)), /*#__PURE__*/React.createElement(StatusTable, null, detail === null || detail === void 0 ? void 0 : (_detail$values = detail.values) === null || _detail$values === void 0 ? void 0 : _detail$values.map((value, index) => {
11427
11414
  var _detail$values2, _detail$values3;
11428
- return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
11415
+ return (value === null || value === void 0 ? void 0 : value.type) === "custom" ? /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement("div", {
11429
11416
  className: `${index === (detail === null || detail === void 0 ? void 0 : (_detail$values2 = detail.values) === null || _detail$values2 === void 0 ? void 0 : _detail$values2.length) - 1 ? "row last" : "row"} border-none`
11430
11417
  }, /*#__PURE__*/React.createElement("h2", null, t(value.title)), /*#__PURE__*/React.createElement("div", {
11431
11418
  className: "value",
@@ -11471,7 +11458,7 @@ const VehicleDetails = props => {
11471
11458
  } : {}
11472
11459
  });
11473
11460
  })));
11474
- }))), showModal && /*#__PURE__*/React.createElement(Modal, {
11461
+ })), showModal && /*#__PURE__*/React.createElement(Modal, {
11475
11462
  headerBarMain: /*#__PURE__*/React.createElement(Heading$2, {
11476
11463
  label: t(modalHeading())
11477
11464
  }),
@@ -11519,7 +11506,6 @@ const SelectVehicleType = ({
11519
11506
  data: vehicleData,
11520
11507
  isLoading: vehicleLoading
11521
11508
  } = Digit.Hooks.wt.useWTMDMS(stateId, "Vehicle", "VehicleMakeModel");
11522
- console.log("vehicleData", vehicleData);
11523
11509
  const {
11524
11510
  data: serviceTypeData,
11525
11511
  isLoading: serviceLoading
@@ -11597,7 +11583,7 @@ const SelectVehicleType = ({
11597
11583
  if (!vehicleData || !serviceTypeData) {
11598
11584
  return /*#__PURE__*/React.createElement("div", null, t("ERROR_FETCHING_DATA"));
11599
11585
  }
11600
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
11586
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
11601
11587
  className: "card-label-smaller"
11602
11588
  }, t("ES_FSM_REGISTRY_VEHICLE_MODEL")), /*#__PURE__*/React.createElement(Dropdown$2, {
11603
11589
  className: "form-field",