@djb25/digit-ui-module-vendor 1.0.8 → 1.0.9

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,5 +1,5 @@
1
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, useRef, Fragment } from 'react';
2
+ import React, { useEffect, useMemo, useCallback, useState, Fragment } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useParams, useLocation, Switch, Link, useHistory, useRouteMatch, Route, Redirect } from 'react-router-dom';
5
5
  import { useForm, Controller } from 'react-hook-form';
@@ -613,6 +613,22 @@ const VendorConfig = (t, disabled = false) => {
613
613
  defaultValue: "",
614
614
  className: "payment-form-text-input-correction"
615
615
  }
616
+ }, {
617
+ label: "ES_VENDOR_REGISTRY_SERVICE_TYPE",
618
+ isMandatory: true,
619
+ type: "component",
620
+ route: "select-gender",
621
+ hideInEmployee: false,
622
+ key: "serviceType",
623
+ component: "SelectServiceType",
624
+ disable: disabled,
625
+ texts: {
626
+ headerCaption: "",
627
+ header: "CS_COMMON_CHOOSE_GENDER",
628
+ cardText: "CS_COMMON_SELECT_GENDER",
629
+ submitBarLabel: "CS_COMMON_NEXT",
630
+ skipText: "CORE_COMMON_SKIP_CONTINUE"
631
+ }
616
632
  }]
617
633
  }, {
618
634
  head: "ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS",
@@ -710,12 +726,12 @@ const AddVendor = ({
710
726
  const [currentStep, setCurrentStep] = useState(1);
711
727
  const [showToast, setShowToast] = useState(null);
712
728
  const [canSubmit, setCanSubmit] = useState(false);
713
- const step1DataRef = useRef({});
729
+ const [step1Data, setStep1Data] = useState({});
714
730
  const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED", false);
715
731
  const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("FSM_ERROR_DATA", false);
716
732
  const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA", false);
717
733
  const {
718
- isLoading: isLoading,
734
+ isLoading,
719
735
  isError: vendorCreateError,
720
736
  data: updateResponse,
721
737
  error: updateError,
@@ -755,12 +771,12 @@ const AddVendor = ({
755
771
  const onSubmit = data => {
756
772
  var _mergedData$street, _mergedData$doorNo, _mergedData$plotNo, _mergedData$landmark, _mergedData$address, _mergedData$address$c, _mergedData$address2, _mergedData$address2$, _mergedData$address3, _mergedData$address3$, _mergedData$address4, _mergedData$address4$, _mergedData$buildingN, _mergedData$address5, _mergedData$address5$, _mergedData$address6, _mergedData$address6$, _mergedData$address7, _mergedData$address7$, _mergedData$selectGen, _mergedData$serviceTy, _mergedData$address8, _mergedData$address9;
757
773
  if (currentStep === 1) {
758
- step1DataRef.current = data;
774
+ setStep1Data(data);
759
775
  setCurrentStep(2);
760
776
  return;
761
777
  }
762
778
  const mergedData = {
763
- ...step1DataRef.current,
779
+ ...step1Data,
764
780
  ...data
765
781
  };
766
782
  const name = mergedData === null || mergedData === void 0 ? void 0 : mergedData.vendorName;
@@ -831,7 +847,7 @@ const AddVendor = ({
831
847
  }
832
848
  };
833
849
  mutate(formData, {
834
- onError: (error, variables) => {
850
+ onError: error => {
835
851
  setShowToast({
836
852
  key: "error",
837
853
  action: error
@@ -850,28 +866,27 @@ const AddVendor = ({
850
866
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stepper, {
851
867
  steps: steps,
852
868
  currentStep: currentStep - 1,
853
- onStepClick: step => setCurrentStep(step + 1),
869
+ onStepClick: () => {},
854
870
  t: t
855
871
  }), /*#__PURE__*/React.createElement("div", {
856
872
  style: {
857
873
  flex: "1",
858
874
  overflowY: "auto"
859
875
  }
860
- }, currentStep === 1 &&
861
- /*#__PURE__*/
862
- React.createElement(FormComposer, {
876
+ }, currentStep === 1 && /*#__PURE__*/React.createElement(FormComposer, {
863
877
  label: t("CS_COMMON_NEXT"),
864
878
  config: vendorStepConfig.filter(i => !i.hideInEmployee).map(config => ({
865
879
  ...config,
866
880
  body: config.body.filter(a => !a.hideInEmployee)
867
881
  })),
868
882
  onSubmit: onSubmit,
869
- defaultValues: defaultValues,
883
+ defaultValues: {
884
+ ...defaultValues,
885
+ ...step1Data
886
+ },
870
887
  onFormValueChange: onFormValueChange,
871
888
  noBreakLine: true
872
- }), currentStep === 2 &&
873
- /*#__PURE__*/
874
- React.createElement(FormComposer, {
889
+ }), currentStep === 2 && /*#__PURE__*/React.createElement(FormComposer, {
875
890
  label: t("ES_COMMON_APPLICATION_SUBMIT"),
876
891
  config: addressStepConfig.filter(i => !i.hideInEmployee).map(config => ({
877
892
  ...config,
@@ -8587,6 +8602,19 @@ const VendorInbox = props => {
8587
8602
  }];
8588
8603
  case "DRIVER":
8589
8604
  return [{
8605
+ Header: t("ES_FSM_REGISTRY_INBOX_USERNAME"),
8606
+ disableSortBy: true,
8607
+ Cell: ({
8608
+ row
8609
+ }) => {
8610
+ var _row$original$owner;
8611
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
8612
+ className: "link"
8613
+ }, /*#__PURE__*/React.createElement(Link, {
8614
+ to: "/digit-ui/employee/vendor/registry/driver-details/" + row.original["id"]
8615
+ }, /*#__PURE__*/React.createElement("div", null, ((_row$original$owner = row.original.owner) === null || _row$original$owner === void 0 ? void 0 : _row$original$owner.userName) || "NA", /*#__PURE__*/React.createElement("br", null)))));
8616
+ }
8617
+ }, {
8590
8618
  Header: t("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),
8591
8619
  disableSortBy: true,
8592
8620
  accessor: "tripDetails",