@djb25/digit-ui-module-wt 1.0.30 → 1.0.32

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,4 +1,4 @@
1
- import { TickMark, ArrowDown, MobileNumber, CardLabelError, TextInput, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, HomeIcon, KeyNote, Modal, CardHeader, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, CHBIcon, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, CollapsibleCardPage as CollapsibleCardPage$1, LabelFieldPair, AddIcon, Menu, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, Localities, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ViewsIcon, ButtonSelector, LocationIcon, CitizenHomeCard, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
1
+ import { TickMark, ArrowDown, MobileNumber, CardLabelError, TextInput, Dropdown, DatePicker, SubmitBar, Card, Table, Loader, Toast, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, HomeIcon, KeyNote, Modal, CardHeader, FormStep, CardLabel, RadioButtons, UploadFile, TextArea, CheckBox, CardSubHeader, StatusTable, Row, GenericFileIcon, LinkButton, EditIcon, Banner, CHBIcon, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, CustomNameDropdown, MultiSelectDropdown, CollapsibleCardPage as CollapsibleCardPage$1, LabelFieldPair, AddIcon, Menu, LayoutWrapper, Header, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, MultiLink, Localities, RemoveableTag, FormComposer, PDFSvg, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, ViewsIcon, ButtonSelector, LocationIcon, CitizenHomeCard, PTIcon, ApplicantDetails, AddressDetails } from '@djb25/digit-ui-react-components';
2
2
  import React, { useRef, useEffect, useState, useMemo, useCallback, Fragment } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -7841,6 +7841,254 @@ const VendorAssign = ({
7841
7841
  }));
7842
7842
  };
7843
7843
 
7844
+ const Reports = ({
7845
+ isLoading: _isLoading = false,
7846
+ t,
7847
+ onSubmit: _onSubmit = () => {},
7848
+ data: _data = null,
7849
+ count: _count = 0,
7850
+ setShowToast: _setShowToast = false
7851
+ }) => {
7852
+ const isMobile = window.Digit.Utils.browser.isMobile();
7853
+ const user = Digit.UserService.getUser().info;
7854
+ const defaultValues = {
7855
+ offset: 0,
7856
+ limit: 10,
7857
+ sortBy: "commencementDate",
7858
+ sortOrder: "DESC",
7859
+ bookingNo: "",
7860
+ mobileNumber: "",
7861
+ applicantName: "",
7862
+ status: "",
7863
+ fromDate: "",
7864
+ toDate: ""
7865
+ };
7866
+ const {
7867
+ register,
7868
+ control,
7869
+ handleSubmit,
7870
+ setValue,
7871
+ getValues,
7872
+ reset,
7873
+ formState,
7874
+ watch
7875
+ } = useForm({
7876
+ defaultValues
7877
+ });
7878
+ const fromDateValue = watch("fromDate");
7879
+ const GetCell = value => /*#__PURE__*/React.createElement("span", {
7880
+ className: "cell-text"
7881
+ }, value);
7882
+ const columns = useMemo(() => [{
7883
+ Header: t("WT_BOOKING_NO"),
7884
+ accessor: "bookingNo",
7885
+ disableSortBy: true,
7886
+ Cell: ({
7887
+ row
7888
+ }) => {
7889
+ const bookingNo = row.original["bookingNo"];
7890
+ const userTypePath = user.type === "EMPLOYEE" ? "employee" : "citizen";
7891
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
7892
+ className: "link"
7893
+ }, /*#__PURE__*/React.createElement(Link, {
7894
+ to: `${APPLICATION_PATH}/${userTypePath}/wt/bookingsearch/booking-details/${bookingNo}`
7895
+ }, bookingNo)));
7896
+ }
7897
+ }, {
7898
+ Header: t("WT_APPLICANT_NAME"),
7899
+ disableSortBy: true,
7900
+ Cell: ({
7901
+ row
7902
+ }) => {
7903
+ var _row$original, _row$original$applica;
7904
+ return GetCell((_row$original = row.original) === null || _row$original === void 0 ? void 0 : (_row$original$applica = _row$original.applicantDetail) === null || _row$original$applica === void 0 ? void 0 : _row$original$applica["name"]);
7905
+ }
7906
+ }, {
7907
+ Header: t("WT_MOBILE_NUMBER"),
7908
+ disableSortBy: true,
7909
+ Cell: ({
7910
+ row
7911
+ }) => {
7912
+ var _row$original2, _row$original2$applic;
7913
+ return GetCell((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : (_row$original2$applic = _row$original2.applicantDetail) === null || _row$original2$applic === void 0 ? void 0 : _row$original2$applic["mobileNumber"]);
7914
+ }
7915
+ }, {
7916
+ Header: t("PT_COMMON_TABLE_COL_STATUS_LABEL"),
7917
+ disableSortBy: true,
7918
+ Cell: ({
7919
+ row
7920
+ }) => GetCell(t(row.original["bookingStatus"]))
7921
+ }], [t, user.type]);
7922
+ const onSort = useCallback(args => {
7923
+ if (args.length === 0) return;
7924
+ setValue("sortBy", args.id);
7925
+ setValue("sortOrder", args.desc ? "DESC" : "ASC");
7926
+ }, [setValue]);
7927
+ const onPageSizeChange = e => {
7928
+ setValue("limit", Number(e.target.value));
7929
+ handleSubmit(_onSubmit)();
7930
+ };
7931
+ const nextPage = () => {
7932
+ setValue("offset", getValues("offset") + getValues("limit"));
7933
+ handleSubmit(_onSubmit)();
7934
+ };
7935
+ const previousPage = () => {
7936
+ const currentOffset = getValues("offset");
7937
+ const limit = getValues("limit");
7938
+ if (currentOffset - limit >= 0) {
7939
+ setValue("offset", currentOffset - limit);
7940
+ handleSubmit(_onSubmit)();
7941
+ }
7942
+ };
7943
+ const handleClearSearch = () => {
7944
+ reset(defaultValues);
7945
+ _setShowToast(null);
7946
+ handleSubmit(_onSubmit)();
7947
+ };
7948
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
7949
+ className: (user === null || user === void 0 ? void 0 : user.type) === "CITIZEN" ? "citizen-wrapper" : "employee-wrapper"
7950
+ }, /*#__PURE__*/React.createElement(CollapsibleCardPage, {
7951
+ title: t("WT_SEARCH_FILTERS_LABEL") || "Search Filters",
7952
+ defaultOpen: true,
7953
+ tabs: [t("WT_SMART_SEARCH"), t("WT_ADVANCED_SEARCH")],
7954
+ defaultTab: t("WT_SMART_SEARCH")
7955
+ }, activeTab => {
7956
+ var _formState$errors, _formState$errors$mob, _formState$errors2, _formState$errors2$mo;
7957
+ return /*#__PURE__*/React.createElement("form", {
7958
+ onSubmit: handleSubmit(_onSubmit)
7959
+ }, activeTab === t("WT_SMART_SEARCH") && /*#__PURE__*/React.createElement("div", {
7960
+ className: "wt-search-grid",
7961
+ style: {
7962
+ display: "grid",
7963
+ gridTemplateColumns: isMobile ? "1fr" : "1fr 1fr",
7964
+ gap: "24px"
7965
+ }
7966
+ }, /*#__PURE__*/React.createElement("div", {
7967
+ className: "search-field-wrapper"
7968
+ }, /*#__PURE__*/React.createElement("label", null, t("WT_MOBILE_NUMBER")), /*#__PURE__*/React.createElement(MobileNumber, {
7969
+ name: "mobileNumber",
7970
+ inputRef: register({
7971
+ minLength: {
7972
+ value: 10,
7973
+ message: t("CORE_COMMON_MOBILE_ERROR")
7974
+ },
7975
+ maxLength: {
7976
+ value: 10,
7977
+ message: t("CORE_COMMON_MOBILE_ERROR")
7978
+ },
7979
+ pattern: {
7980
+ value: /[6789][0-9]{9}/,
7981
+ message: t("CORE_COMMON_MOBILE_ERROR")
7982
+ }
7983
+ }),
7984
+ type: "number",
7985
+ maxlength: 10
7986
+ }), /*#__PURE__*/React.createElement(CardLabelError, null, formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : (_formState$errors$mob = _formState$errors["mobileNumber"]) === null || _formState$errors$mob === void 0 ? void 0 : _formState$errors$mob.message))), activeTab === t("WT_ADVANCED_SEARCH") && /*#__PURE__*/React.createElement("div", {
7987
+ className: "formcomposer-section-grid"
7988
+ }, /*#__PURE__*/React.createElement("div", {
7989
+ className: "search-field-wrapper"
7990
+ }, /*#__PURE__*/React.createElement("label", null, t("WT_BOOKING_NO")), /*#__PURE__*/React.createElement(TextInput, {
7991
+ name: "bookingNo",
7992
+ inputRef: register({})
7993
+ })), /*#__PURE__*/React.createElement("div", {
7994
+ className: "search-field-wrapper"
7995
+ }, /*#__PURE__*/React.createElement("label", null, t("WT_APPLICANT_NAME")), /*#__PURE__*/React.createElement(TextInput, {
7996
+ name: "applicantName",
7997
+ inputRef: register({})
7998
+ })), /*#__PURE__*/React.createElement("div", {
7999
+ className: "search-field-wrapper"
8000
+ }, /*#__PURE__*/React.createElement("label", null, t("WT_MOBILE_NUMBER")), /*#__PURE__*/React.createElement(MobileNumber, {
8001
+ name: "mobileNumber",
8002
+ inputRef: register({
8003
+ minLength: {
8004
+ value: 10,
8005
+ message: t("CORE_COMMON_MOBILE_ERROR")
8006
+ },
8007
+ maxLength: {
8008
+ value: 10,
8009
+ message: t("CORE_COMMON_MOBILE_ERROR")
8010
+ },
8011
+ pattern: {
8012
+ value: /[6789][0-9]{9}/,
8013
+ message: t("CORE_COMMON_MOBILE_ERROR")
8014
+ }
8015
+ }),
8016
+ type: "number",
8017
+ maxlength: 10
8018
+ }), /*#__PURE__*/React.createElement(CardLabelError, null, formState === null || formState === void 0 ? void 0 : (_formState$errors2 = formState.errors) === null || _formState$errors2 === void 0 ? void 0 : (_formState$errors2$mo = _formState$errors2["mobileNumber"]) === null || _formState$errors2$mo === void 0 ? void 0 : _formState$errors2$mo.message)), /*#__PURE__*/React.createElement("div", {
8019
+ className: "search-field-wrapper"
8020
+ }, /*#__PURE__*/React.createElement("label", null, t("FROM_DATE")), /*#__PURE__*/React.createElement(Controller, {
8021
+ render: props => /*#__PURE__*/React.createElement(DatePicker, {
8022
+ date: props.value,
8023
+ onChange: props.onChange,
8024
+ max: new Date().toISOString().split("T")[0]
8025
+ }),
8026
+ name: "fromDate",
8027
+ control: control
8028
+ })), /*#__PURE__*/React.createElement("div", {
8029
+ className: "search-field-wrapper"
8030
+ }, /*#__PURE__*/React.createElement("label", null, t("TO_DATE")), /*#__PURE__*/React.createElement(Controller, {
8031
+ render: props => /*#__PURE__*/React.createElement(DatePicker, {
8032
+ date: props.value,
8033
+ onChange: props.onChange,
8034
+ min: fromDateValue
8035
+ }),
8036
+ name: "toDate",
8037
+ control: control
8038
+ }))), /*#__PURE__*/React.createElement("div", {
8039
+ className: "wt-search-actions",
8040
+ style: {
8041
+ display: "flex",
8042
+ justifyContent: isMobile ? "center" : "flex-end",
8043
+ flexDirection: isMobile ? "column-reverse" : "row",
8044
+ gap: "24px",
8045
+ marginTop: "16px"
8046
+ }
8047
+ }, /*#__PURE__*/React.createElement("span", {
8048
+ className: "generic-button clear-search",
8049
+ onClick: handleClearSearch,
8050
+ style: {
8051
+ cursor: "pointer",
8052
+ alignSelf: "center"
8053
+ }
8054
+ }, t("ES_COMMON_CLEAR_ALL")), /*#__PURE__*/React.createElement("div", {
8055
+ style: {
8056
+ minWidth: isMobile ? "100%" : "160px"
8057
+ }
8058
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
8059
+ label: t("ES_COMMON_SEARCH"),
8060
+ submit: true
8061
+ }))));
8062
+ }), _isLoading && /*#__PURE__*/React.createElement(Loader, null), _data === "" ? /*#__PURE__*/React.createElement("p", {
8063
+ style: {
8064
+ textAlign: "center"
8065
+ }
8066
+ }, "No data found") : _data ? /*#__PURE__*/React.createElement(Table, {
8067
+ t: t,
8068
+ data: _data,
8069
+ totalRecords: _count,
8070
+ columns: columns,
8071
+ getCellProps: cellInfo => ({
8072
+ style: {
8073
+ minWidth: cellInfo.column.Header === t("WT_INBOX_APPLICATION_NO") ? "240px" : "",
8074
+ padding: "20px 18px",
8075
+ fontSize: "16px"
8076
+ }
8077
+ }),
8078
+ onPageSizeChange: onPageSizeChange,
8079
+ currentPage: getValues("offset") / getValues("limit"),
8080
+ onNextPage: nextPage,
8081
+ onPrevPage: previousPage,
8082
+ pageSizeLimit: getValues("limit"),
8083
+ onSort: onSort,
8084
+ disableSort: false,
8085
+ sortParams: [{
8086
+ id: getValues("sortBy"),
8087
+ desc: getValues("sortOrder") === "DESC"
8088
+ }]
8089
+ }) : null));
8090
+ };
8091
+
7844
8092
  const EmployeeApp = ({
7845
8093
  path
7846
8094
  }) => {
@@ -8106,6 +8354,16 @@ const EmployeeApp = ({
8106
8354
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
8107
8355
  path: `${path}/vendor-assignment`,
8108
8356
  component: VendorAssign
8357
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
8358
+ path: `${path}/reports`,
8359
+ component: props => /*#__PURE__*/React.createElement(LayoutWrapper, {
8360
+ layoutClass: "normal"
8361
+ }, /*#__PURE__*/React.createElement(Reports, Object.assign({
8362
+ t: t
8363
+ }, props, {
8364
+ parentRoute: path,
8365
+ moduleCode: "WT"
8366
+ })))
8109
8367
  }))))));
8110
8368
  };
8111
8369
 
@@ -15450,7 +15708,8 @@ const Filter = ({
15450
15708
  onClick: clearAll,
15451
15709
  style: {
15452
15710
  border: "1px solid #e0e0e0",
15453
- padding: "6px"
15711
+ padding: "6px",
15712
+ minWidth: "fit-content"
15454
15713
  }
15455
15714
  }, /*#__PURE__*/React.createElement("svg", {
15456
15715
  width: "17",