@mseva/upyog-ui-module-ads 1.0.82 → 1.0.83

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.
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { useHistory, Link, useParams, useRouteMatch, Switch, useLocation, Route, Redirect } from 'react-router-dom';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { useQueryClient } from 'react-query';
7
- import { useSelector, useDispatch } from 'react-redux';
7
+ import { useDispatch, useSelector } from 'react-redux';
8
8
  import { combineReducers } from 'redux';
9
9
 
10
10
  const shouldHideBackButton = (config = []) => {
@@ -34,6 +34,137 @@ const pdfDownloadLink = (documents = {}, fileStoreId = "", format = "") => {
34
34
  });
35
35
  return fileURL;
36
36
  };
37
+ function normalizeDate(d) {
38
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate());
39
+ }
40
+ const validateSchedule = ({
41
+ startDate,
42
+ endDate,
43
+ startTime,
44
+ endTime,
45
+ scheduleType
46
+ }) => {
47
+ if (!startDate || !endDate || !startTime || !endTime) {
48
+ return "Start and end date/time are required.";
49
+ }
50
+ const start = normalizeDate(new Date(startDate));
51
+ const end = normalizeDate(new Date(endDate));
52
+ const selYear = start.getFullYear();
53
+ const selMonth = start.getMonth();
54
+ const daysInSelMonth = new Date(selYear, selMonth + 1, 0).getDate();
55
+ switch (scheduleType) {
56
+ case "Monthly":
57
+ {
58
+ const monthStart = normalizeDate(new Date(selYear, selMonth, 1));
59
+ const monthEnd = normalizeDate(new Date(selYear, selMonth, daysInSelMonth));
60
+ const today = normalizeDate(new Date());
61
+ if (monthEnd < today) {
62
+ return `This Monthly block (${monthStart.toDateString()} – ${monthEnd.toDateString()}) is already in the past. Please select a future month.`;
63
+ }
64
+ if (start.getTime() !== monthStart.getTime() || end.getTime() !== monthEnd.getTime()) {
65
+ return `For Monthly, you must select ${monthStart.toDateString()} to ${monthEnd.toDateString()}`;
66
+ }
67
+ break;
68
+ }
69
+ case "Weekly":
70
+ {
71
+ const day = start.getDate();
72
+ let blockStart, blockEnd;
73
+ if (day >= 1 && day <= 7) {
74
+ blockStart = 1;
75
+ blockEnd = 7;
76
+ } else if (day >= 8 && day <= 15) {
77
+ blockStart = 8;
78
+ blockEnd = 15;
79
+ } else if (day >= 16 && day <= 23) {
80
+ blockStart = 16;
81
+ blockEnd = 23;
82
+ } else {
83
+ blockStart = 24;
84
+ blockEnd = daysInSelMonth;
85
+ }
86
+ const blockStartDate = normalizeDate(new Date(selYear, selMonth, blockStart));
87
+ const blockEndDate = normalizeDate(new Date(selYear, selMonth, blockEnd));
88
+ const today = normalizeDate(new Date());
89
+ if (blockEndDate < today) {
90
+ return `This weekly block (${blockStart}-${blockEnd} ${start.toLocaleString("default", {
91
+ month: "long"
92
+ })}) is already in the past. Please select a future block.`;
93
+ }
94
+ if (start.getTime() !== blockStartDate.getTime() || end.getTime() !== blockEndDate.getTime()) {
95
+ return `For Weekly, you must select ${blockStart}-${blockEnd} of ${start.toLocaleString("default", {
96
+ month: "long"
97
+ })}`;
98
+ }
99
+ break;
100
+ }
101
+ case "FortNight":
102
+ {
103
+ const firstHalfStart = normalizeDate(new Date(selYear, selMonth, 1));
104
+ const firstHalfEnd = normalizeDate(new Date(selYear, selMonth, 15));
105
+ const secondHalfStart = normalizeDate(new Date(selYear, selMonth, 16));
106
+ const secondHalfEnd = normalizeDate(new Date(selYear, selMonth, daysInSelMonth));
107
+ const today = normalizeDate(new Date());
108
+ if (start.getTime() === firstHalfStart.getTime() && firstHalfEnd < today || start.getTime() === secondHalfStart.getTime() && secondHalfEnd < today) {
109
+ return `This FortNight block is already in the past. Please select a future block.`;
110
+ }
111
+ if (!(start.getTime() === firstHalfStart.getTime() && end.getTime() === firstHalfEnd.getTime() || start.getTime() === secondHalfStart.getTime() && end.getTime() === secondHalfEnd.getTime())) {
112
+ return `For FortNight, you must select 1–15 or 16–${daysInSelMonth} of ${start.toLocaleString("default", {
113
+ month: "long"
114
+ })}`;
115
+ }
116
+ break;
117
+ }
118
+ case "Yearly":
119
+ {
120
+ let fyStart, fyEnd;
121
+ if (selMonth < 3) {
122
+ fyStart = normalizeDate(new Date(selYear - 1, 3, 1));
123
+ fyEnd = normalizeDate(new Date(selYear, 2, 31));
124
+ } else {
125
+ fyStart = normalizeDate(new Date(selYear, 3, 1));
126
+ fyEnd = normalizeDate(new Date(selYear + 1, 2, 31));
127
+ }
128
+ if (start.getTime() !== fyStart.getTime() || end.getTime() !== fyEnd.getTime()) {
129
+ return `For Yearly, you must select ${fyStart.toDateString()} to ${fyEnd.toDateString()} (Financial Year)`;
130
+ }
131
+ break;
132
+ }
133
+ default:
134
+ return "Invalid schedule type.";
135
+ }
136
+ return null;
137
+ };
138
+ function getScheduleMessage(scheduleType, t) {
139
+ switch (scheduleType) {
140
+ case "Monthly":
141
+ return t("ADS_GUIDE_MONTHLY");
142
+ case "Weekly":
143
+ return t("ADS_GUIDE_WEEKLY");
144
+ case "FortNight":
145
+ return t("ADS_GUIDE_FORTNIGHT");
146
+ case "Yearly":
147
+ return t("ADS_GUIDE_YEARLY");
148
+ default:
149
+ return "";
150
+ }
151
+ }
152
+ function getMinDateForType(scheduleType) {
153
+ const today = new Date();
154
+ const year = today.getFullYear();
155
+ const month = today.getMonth();
156
+ if (scheduleType === "Monthly" || scheduleType === "Weekly" || scheduleType === "FortNight") {
157
+ return new Date(year, month, 1).toISOString().split("T")[0];
158
+ }
159
+ if (type === "Yearly") {
160
+ if (month < 3) {
161
+ return new Date(year - 1, 3, 1).toISOString().split("T")[0];
162
+ } else {
163
+ return new Date(year, 3, 1).toISOString().split("T")[0];
164
+ }
165
+ }
166
+ return today.toISOString().split("T")[0];
167
+ }
37
168
 
38
169
  const Heading = props => {
39
170
  return /*#__PURE__*/React.createElement("h1", {
@@ -19202,12 +19333,63 @@ const EmployeeApp = ({
19202
19333
  })))));
19203
19334
  };
19204
19335
 
19336
+ const ReservationTimer = ({
19337
+ t,
19338
+ createTime,
19339
+ onExpire
19340
+ }) => {
19341
+ const expiry = createTime ? new Date(createTime).getTime() + 30 * 60 * 1000 : null;
19342
+ const [remaining, setRemaining] = useState(null);
19343
+ useEffect(() => {
19344
+ if (!expiry) return;
19345
+ const update = () => {
19346
+ const diff = expiry - Date.now();
19347
+ setRemaining(diff);
19348
+ if (diff <= 0 && typeof onExpire === "function") {
19349
+ onExpire(true);
19350
+ }
19351
+ };
19352
+ update();
19353
+ const interval = setInterval(update, 1000);
19354
+ return () => clearInterval(interval);
19355
+ }, [expiry, onExpire]);
19356
+ if (!expiry) return null;
19357
+ if (remaining !== null && remaining <= 0) {
19358
+ return /*#__PURE__*/React.createElement("span", {
19359
+ style: {
19360
+ fontSize: "16px",
19361
+ color: "red",
19362
+ fontWeight: 800
19363
+ }
19364
+ }, t("ADS_SLOTS_EXPIRED"));
19365
+ }
19366
+ if (remaining === null) return null;
19367
+ const minutes = Math === null || Math === void 0 ? void 0 : Math.floor(remaining / 60000);
19368
+ const seconds = Math === null || Math === void 0 ? void 0 : Math.floor(remaining % 60000 / 1000).toString().padStart(2, "0");
19369
+ const isCritical = remaining <= 60 * 1000;
19370
+ return /*#__PURE__*/React.createElement("span", {
19371
+ style: {
19372
+ color: isCritical ? "red" : "#2947a3",
19373
+ fontWeight: 600,
19374
+ fontSize: "14px",
19375
+ marginLeft: "8px"
19376
+ }
19377
+ }, t("ADS_PAYMENT_TIMER"), /*#__PURE__*/React.createElement("span", {
19378
+ style: {
19379
+ fontSize: "16px",
19380
+ fontWeight: 900,
19381
+ color: "red",
19382
+ marginLeft: "4px"
19383
+ }
19384
+ }, minutes, ":", seconds));
19385
+ };
19386
+
19205
19387
  const AdsApplication = ({
19206
19388
  application,
19207
19389
  tenantId,
19208
19390
  buttonLabel
19209
19391
  }) => {
19210
- var _application$applican;
19392
+ var _application$auditDet, _application$auditDet2, _application$applican;
19211
19393
  const {
19212
19394
  t
19213
19395
  } = useTranslation();
@@ -19225,7 +19407,17 @@ const AdsApplication = ({
19225
19407
  }
19226
19408
  }, [showToast]);
19227
19409
  const appDate = new Date(application === null || application === void 0 ? void 0 : application.applicationDate).toLocaleDateString();
19228
- return /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(KeyNote, {
19410
+ const [expired, setExpired] = useState(false);
19411
+ return /*#__PURE__*/React.createElement(Card$1, null, application.bookingStatus === "PENDING_FOR_PAYMENT" && (application === null || application === void 0 ? void 0 : (_application$auditDet = application.auditDetails) === null || _application$auditDet === void 0 ? void 0 : _application$auditDet.createdTime) && /*#__PURE__*/React.createElement("div", {
19412
+ style: {
19413
+ display: "flex",
19414
+ justifyContent: "flex-end"
19415
+ }
19416
+ }, /*#__PURE__*/React.createElement(ReservationTimer, {
19417
+ t: t,
19418
+ createTime: application === null || application === void 0 ? void 0 : (_application$auditDet2 = application.auditDetails) === null || _application$auditDet2 === void 0 ? void 0 : _application$auditDet2.createdTime,
19419
+ onExpire: val => setExpired(val)
19420
+ })), /*#__PURE__*/React.createElement(KeyNote, {
19229
19421
  keyValue: t("ADS_BOOKING_NO"),
19230
19422
  note: application === null || application === void 0 ? void 0 : application.bookingNo
19231
19423
  }), /*#__PURE__*/React.createElement(KeyNote, {
@@ -19246,7 +19438,8 @@ const AdsApplication = ({
19246
19438
  onSubmit: handleMakePayment,
19247
19439
  style: {
19248
19440
  margin: "20px"
19249
- }
19441
+ },
19442
+ disabled: expired
19250
19443
  })), showToast && /*#__PURE__*/React.createElement(Toast, {
19251
19444
  error: showToast.error,
19252
19445
  warning: showToast.warning,
@@ -20389,7 +20582,7 @@ if (_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag || _Ma
20389
20582
  }
20390
20583
 
20391
20584
  const ApplicationDetails = () => {
20392
- var _applicationDetails$b, _Digit$Hooks$ads, _Digit$Hooks$ads$useA, _displayData$applican, _displayData$applican2, _workflowDetails$data, _workflowDetails$data2, _reciept_data$Payment, _displayData$AdsDetai, _application$document, _displayData$applican4, _workflowDetails$data4, _workflowDetails$data5;
20585
+ var _applicationDetails$b, _Digit$Hooks$ads, _Digit$Hooks$ads$useA, _displayData$applican, _displayData$applican2, _workflowDetails$data, _workflowDetails$data2, _reciept_data$Payment, _displayData$applican4, _displayData$applican5, _displayData$applican6, _displayData$applican7, _displayData$applican8, _displayData$AdsDetai, _application$document, _displayData$applican9, _workflowDetails$data4, _workflowDetails$data5;
20393
20586
  const {
20394
20587
  id
20395
20588
  } = useParams();
@@ -20533,7 +20726,8 @@ const ApplicationDetails = () => {
20533
20726
  pincode: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$address2 = adsObject.address) === null || _adsObject$address2 === void 0 ? void 0 : _adsObject$address2.pincode,
20534
20727
  bookingStatus: adsObject === null || adsObject === void 0 ? void 0 : adsObject.bookingStatus,
20535
20728
  paymentDate: adsObject !== null && adsObject !== void 0 && adsObject.paymentDate ? new Date(adsObject.paymentDate).toLocaleDateString() : "",
20536
- receiptNo: adsObject === null || adsObject === void 0 ? void 0 : adsObject.receiptNo
20729
+ receiptNo: adsObject === null || adsObject === void 0 ? void 0 : adsObject.receiptNo,
20730
+ auditDetails: adsObject === null || adsObject === void 0 ? void 0 : adsObject.auditDetails
20537
20731
  };
20538
20732
  const Documents = removeDuplicatesByUUID((adsObject === null || adsObject === void 0 ? void 0 : adsObject.documents) || []);
20539
20733
  const AdsDetails = (adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$cartDetail = adsObject.cartDetails) === null || _adsObject$cartDetail === void 0 ? void 0 : _adsObject$cartDetail.map(item => ({
@@ -20768,6 +20962,7 @@ const ApplicationDetails = () => {
20768
20962
  }
20769
20963
  });
20770
20964
  }
20965
+ const [expired, setExpired] = useState(false);
20771
20966
  if (isLoading || isDetailsLoading) {
20772
20967
  return /*#__PURE__*/React.createElement(Loader$1, null);
20773
20968
  }
@@ -20805,7 +21000,16 @@ const ApplicationDetails = () => {
20805
21000
  options: downloadOptions,
20806
21001
  downloadBtnClassName: "employee-download-btn-className",
20807
21002
  optionsClassName: "employee-options-btn-className"
20808
- }))))), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("ADS_APPLICATION_DETAILS_OVERVIEW")), /*#__PURE__*/React.createElement(StatusTable, null, (displayData === null || displayData === void 0 ? void 0 : displayData.applicantData) && Object.entries(displayData.applicantData).filter(([_, value]) => {
21003
+ }))))), /*#__PURE__*/React.createElement(Card$1, null, (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican4 = displayData.applicantData) === null || _displayData$applican4 === void 0 ? void 0 : (_displayData$applican5 = _displayData$applican4.auditDetails) === null || _displayData$applican5 === void 0 ? void 0 : _displayData$applican5.createdTime) && (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican6 = displayData.applicantData) === null || _displayData$applican6 === void 0 ? void 0 : _displayData$applican6.bookingStatus) === "PENDING_FOR_PAYMENT" && /*#__PURE__*/React.createElement("div", {
21004
+ style: {
21005
+ display: "flex",
21006
+ justifyContent: "flex-end"
21007
+ }
21008
+ }, /*#__PURE__*/React.createElement(ReservationTimer, {
21009
+ t: t,
21010
+ createTime: displayData === null || displayData === void 0 ? void 0 : (_displayData$applican7 = displayData.applicantData) === null || _displayData$applican7 === void 0 ? void 0 : (_displayData$applican8 = _displayData$applican7.auditDetails) === null || _displayData$applican8 === void 0 ? void 0 : _displayData$applican8.createdTime,
21011
+ onExpire: val => setExpired(val)
21012
+ })), /*#__PURE__*/React.createElement(CardSubHeader, null, t("ADS_APPLICATION_DETAILS_OVERVIEW")), /*#__PURE__*/React.createElement(StatusTable, null, (displayData === null || displayData === void 0 ? void 0 : displayData.applicantData) && Object.entries(displayData.applicantData).filter(([_, value]) => {
20809
21013
  if (value === null || value === undefined) return false;
20810
21014
  if (typeof value === "string" && value.trim() === "") return false;
20811
21015
  if (Array.isArray(value) && value.length === 0) return false;
@@ -20859,7 +21063,7 @@ const ApplicationDetails = () => {
20859
21063
  }
20860
21064
  }, t("TL_NO_DOCUMENTS_MSG"))), /*#__PURE__*/React.createElement(ADSWFApplicationTimeline, {
20861
21065
  application: application,
20862
- id: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican4 = displayData.applicantData) === null || _displayData$applican4 === void 0 ? void 0 : _displayData$applican4.applicationNo) || id,
21066
+ id: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican9 = displayData.applicantData) === null || _displayData$applican9 === void 0 ? void 0 : _displayData$applican9.applicationNo) || id,
20863
21067
  userType: "employee"
20864
21068
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
20865
21069
  error: showToast.key === "error",
@@ -20882,7 +21086,8 @@ const ApplicationDetails = () => {
20882
21086
  }), /*#__PURE__*/React.createElement(SubmitBar, {
20883
21087
  ref: menuRef,
20884
21088
  label: t("WF_TAKE_ACTION"),
20885
- onSubmit: () => setDisplayMenu(!displayMenu)
21089
+ onSubmit: () => setDisplayMenu(!displayMenu),
21090
+ disabled: expired
20886
21091
  })), showModal ? /*#__PURE__*/React.createElement(ADSModal, {
20887
21092
  t: t,
20888
21093
  action: selectedAction,
@@ -21255,48 +21460,6 @@ const RESET_ADS_NEW_APPLICATION_FORM = () => ({
21255
21460
  type: RESET_ADS_NEW_APPLICATION_FORMType
21256
21461
  });
21257
21462
 
21258
- const ReservationTimer = ({
21259
- t
21260
- }) => {
21261
- const expiry = useSelector(state => state.ads.ADSNewApplicationFormReducer.formData.reservationExpiry);
21262
- const [remaining, setRemaining] = useState(expiry ? expiry - Date.now() : 0);
21263
- useEffect(() => {
21264
- if (!expiry) return;
21265
- const interval = setInterval(() => {
21266
- setRemaining(expiry - Date.now());
21267
- }, 1000);
21268
- return () => clearInterval(interval);
21269
- }, [expiry]);
21270
- if (!expiry) return null;
21271
- if (remaining <= 0) {
21272
- return /*#__PURE__*/React.createElement("span", {
21273
- style: {
21274
- fontSize: "16px",
21275
- color: "red",
21276
- fontWeight: 800
21277
- }
21278
- }, t("ADS_SLOTS_EXPIRED"));
21279
- }
21280
- const minutes = Math.floor(remaining / 60000);
21281
- const seconds = Math.floor(remaining % 60000 / 1000).toString().padStart(2, "0");
21282
- const isCritical = remaining <= 60 * 1000;
21283
- return /*#__PURE__*/React.createElement("span", {
21284
- style: {
21285
- color: isCritical ? "red" : "#2947a3",
21286
- fontWeight: 600,
21287
- fontSize: "14px",
21288
- marginLeft: "8px"
21289
- }
21290
- }, t("ADS_PAYMENT_TIMER"), /*#__PURE__*/React.createElement("span", {
21291
- style: {
21292
- fontSize: "16px",
21293
- fontWeight: 900,
21294
- color: "red",
21295
- marginLeft: "4px"
21296
- }
21297
- }, minutes, ":", seconds));
21298
- };
21299
-
21300
21463
  const isEmployee = window.location.href.includes("employee");
21301
21464
  const createEmployeeConfig = [{
21302
21465
  head: "PET DETAILS",
@@ -21413,6 +21576,7 @@ const NewADSStepperForm = ({
21413
21576
  const dispatch = useDispatch();
21414
21577
  const [showToast, setShowToast] = useState(null);
21415
21578
  const formState = useSelector(state => state.ads.ADSNewApplicationFormReducer);
21579
+ const formData = formState.formData;
21416
21580
  const step = formState.step;
21417
21581
  const tenantId = Digit.ULBService.getCurrentTenantId();
21418
21582
  const setStep = updatedStepNumber => {
@@ -21422,6 +21586,7 @@ const NewADSStepperForm = ({
21422
21586
  dispatch(RESET_ADS_NEW_APPLICATION_FORM());
21423
21587
  }, []);
21424
21588
  const handleSubmit = dataGet => {};
21589
+ const createTime = formData === null || formData === void 0 ? void 0 : formData.reservationExpiry;
21425
21590
  return /*#__PURE__*/React.createElement("div", {
21426
21591
  className: "pageCard"
21427
21592
  }, /*#__PURE__*/React.createElement(CardHeader$1, {
@@ -21431,8 +21596,9 @@ const NewADSStepperForm = ({
21431
21596
  color: "#1C1D1F"
21432
21597
  },
21433
21598
  divider: true
21434
- }, t("ADS_REGISTRATION_APPLICATION"), /*#__PURE__*/React.createElement(ReservationTimer, {
21435
- t: t
21599
+ }, t("ADS_REGISTRATION_APPLICATION"), createTime && /*#__PURE__*/React.createElement(ReservationTimer, {
21600
+ t: t,
21601
+ createTime: createTime
21436
21602
  })), /*#__PURE__*/React.createElement(Stepper, {
21437
21603
  stepsList: updatedConfig,
21438
21604
  onSubmit: handleSubmit,
@@ -21491,10 +21657,10 @@ const ADSCitizenDetailsNew = ({
21491
21657
  }
21492
21658
  });
21493
21659
  if (typeof window !== "undefined") window.__ADS_FORM_DRAFT = window.__ADS_FORM_DRAFT || {};
21494
- console.log('currentStepData', currentStepData);
21660
+ console.log("currentStepData", currentStepData);
21495
21661
  useEffect(() => {
21496
21662
  if (currentStepData !== null && currentStepData !== void 0 && currentStepData.CreatedResponse) {
21497
- const created = currentStepData.CreatedResponse;
21663
+ const created = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.CreatedResponse;
21498
21664
  if (created !== null && created !== void 0 && created.address) {
21499
21665
  setValue("address", created.address.addressLine1 || "");
21500
21666
  setValue("pincode", created.address.pincode || "");
@@ -21683,7 +21849,7 @@ const ADSCitizenDetailsNew = ({
21683
21849
  rules: {
21684
21850
  required: t("PTR_EMAIL_REQUIRED"),
21685
21851
  pattern: {
21686
- value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
21852
+ value: /^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/,
21687
21853
  message: "Enter a valid email"
21688
21854
  }
21689
21855
  },
@@ -21877,16 +22043,17 @@ const AvailabilityModal = ({
21877
22043
  }) => {
21878
22044
  var _cartSlots$find;
21879
22045
  const [selectedSlots, setSelectedSlots] = useState([]);
22046
+ const [selectAll, setSelectAll] = useState(false);
21880
22047
  const slotPayload = useMemo(() => ({
21881
22048
  advertisementSlotSearchCriteria: [{
21882
22049
  advertisementId: ad === null || ad === void 0 ? void 0 : ad.id,
21883
22050
  bookingId: "",
21884
- addType: ad.adType,
22051
+ addType: ad === null || ad === void 0 ? void 0 : ad.adType,
21885
22052
  bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
21886
22053
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
21887
22054
  faceArea: `${ad === null || ad === void 0 ? void 0 : ad.adType}_${ad === null || ad === void 0 ? void 0 : ad.width}_X_${ad === null || ad === void 0 ? void 0 : ad.height}`,
21888
22055
  tenantId,
21889
- location: ad.locationCode,
22056
+ location: ad === null || ad === void 0 ? void 0 : ad.locationCode,
21890
22057
  nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light" ? "true" : "false",
21891
22058
  isTimerRequired: false
21892
22059
  }]
@@ -21900,19 +22067,21 @@ const AvailabilityModal = ({
21900
22067
  data: slotPayload
21901
22068
  });
21902
22069
  const slots = (slotResults === null || slotResults === void 0 ? void 0 : slotResults.advertisementSlotAvailabiltityDetails) || [];
21903
- const existingForAd = ((_cartSlots$find = cartSlots.find(item => item.ad.id === ad.id)) === null || _cartSlots$find === void 0 ? void 0 : _cartSlots$find.slots) || [];
21904
- const handleCheckboxChange = (slot, checked) => {
22070
+ const existingForAd = (cartSlots === null || cartSlots === void 0 ? void 0 : (_cartSlots$find = cartSlots.find(item => item.ad.id === ad.id)) === null || _cartSlots$find === void 0 ? void 0 : _cartSlots$find.slots) || [];
22071
+ const allBooked = (slots === null || slots === void 0 ? void 0 : slots.length) > 0 && (slots === null || slots === void 0 ? void 0 : slots.every(s => (s === null || s === void 0 ? void 0 : s.slotStaus) !== "AVAILABLE"));
22072
+ const allAvailableSlots = slots.filter(s => s.slotStaus === "AVAILABLE");
22073
+ const allInCart = allAvailableSlots.length > 0 && allAvailableSlots.every(slot => existingForAd.some(s => s.bookingDate === slot.bookingDate));
22074
+ const handleSelectAll = checked => {
22075
+ setSelectAll(checked);
21905
22076
  if (checked) {
21906
- setSelectedSlots(prev => [...prev.filter(s => s.bookingDate !== slot.bookingDate), slot]);
22077
+ const allAvailable = slots.filter(s => s.slotStaus === "AVAILABLE");
22078
+ setSelectedSlots(allAvailable);
21907
22079
  } else {
21908
- setSelectedSlots(prev => [...prev.filter(s => s.bookingDate !== slot.bookingDate), {
21909
- ...slot,
21910
- _remove: true
21911
- }]);
22080
+ setSelectedSlots([]);
21912
22081
  }
21913
22082
  };
21914
22083
  const handleAddToCart = () => {
21915
- if (selectedSlots.length > 0) {
22084
+ if ((selectedSlots === null || selectedSlots === void 0 ? void 0 : selectedSlots.length) > 0) {
21916
22085
  onSelectSlot(selectedSlots, {
21917
22086
  ...ad,
21918
22087
  faceArea: `${ad === null || ad === void 0 ? void 0 : ad.adType}_${ad === null || ad === void 0 ? void 0 : ad.width}_X_${ad === null || ad === void 0 ? void 0 : ad.height}`,
@@ -21924,25 +22093,34 @@ const AvailabilityModal = ({
21924
22093
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
21925
22094
  });
21926
22095
  setSelectedSlots([]);
22096
+ setSelectAll(false);
21927
22097
  onClose();
21928
22098
  }
21929
22099
  };
21930
22100
  const columns = [{
21931
- Header: t("ADS_SELECT"),
22101
+ Header: () => /*#__PURE__*/React.createElement("input", {
22102
+ type: "checkbox",
22103
+ checked: allInCart || selectAll,
22104
+ onChange: e => handleSelectAll(e.target.checked),
22105
+ style: {
22106
+ cursor: "pointer",
22107
+ width: "18px",
22108
+ height: "18px",
22109
+ accentColor: "#0b74de"
22110
+ }
22111
+ }),
21932
22112
  accessor: "select",
21933
22113
  Cell: ({
21934
22114
  row
21935
22115
  }) => {
21936
22116
  const slot = row.original;
21937
- const isInCart = existingForAd.some(s => s.bookingDate === slot.bookingDate);
21938
- const isChecked = isInCart && !selectedSlots.some(s => s.bookingDate === slot.bookingDate && s._remove) || selectedSlots.some(s => s.bookingDate === slot.bookingDate && !s._remove);
22117
+ const isChecked = allInCart || selectAll && (slot === null || slot === void 0 ? void 0 : slot.slotStaus) === "AVAILABLE";
21939
22118
  return /*#__PURE__*/React.createElement("input", {
21940
22119
  type: "checkbox",
21941
22120
  checked: isChecked,
21942
- disabled: slot.slotStaus !== "AVAILABLE",
21943
- onChange: e => handleCheckboxChange(slot, e.target.checked),
22121
+ disabled: true,
21944
22122
  style: {
21945
- cursor: slot.slotStaus === "AVAILABLE" ? "pointer" : "not-allowed",
22123
+ cursor: "not-allowed",
21946
22124
  width: "18px",
21947
22125
  height: "18px",
21948
22126
  accentColor: "#0b74de"
@@ -21970,7 +22148,8 @@ const AvailabilityModal = ({
21970
22148
  Cell: ({
21971
22149
  row
21972
22150
  }) => {
21973
- const status = row.original.slotStaus;
22151
+ var _row$original;
22152
+ const status = row === null || row === void 0 ? void 0 : (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slotStaus;
21974
22153
  const isAvailable = status === "AVAILABLE";
21975
22154
  return /*#__PURE__*/React.createElement("span", {
21976
22155
  style: {
@@ -21987,7 +22166,6 @@ const AvailabilityModal = ({
21987
22166
  }, status);
21988
22167
  }
21989
22168
  }];
21990
- const allBooked = slots.length > 0 && slots.every(s => s.slotStaus !== "AVAILABLE");
21991
22169
  return /*#__PURE__*/React.createElement("div", {
21992
22170
  style: {
21993
22171
  position: "fixed",
@@ -22057,7 +22235,7 @@ const AvailabilityModal = ({
22057
22235
  color: "#555",
22058
22236
  textAlign: "center"
22059
22237
  }
22060
- }, t("ADS_LOADING_SLOTS")) : slots.length === 0 ? /*#__PURE__*/React.createElement("div", {
22238
+ }, t("ADS_LOADING_SLOTS")) : (slots === null || slots === void 0 ? void 0 : slots.length) === 0 ? /*#__PURE__*/React.createElement("div", {
22061
22239
  style: {
22062
22240
  fontSize: "24px",
22063
22241
  color: "#555",
@@ -22096,15 +22274,15 @@ const AvailabilityModal = ({
22096
22274
  }
22097
22275
  }, t ? t("Cancel") : "Cancel"), /*#__PURE__*/React.createElement("button", {
22098
22276
  onClick: handleAddToCart,
22099
- disabled: selectedSlots.length === 0,
22277
+ disabled: (selectedSlots === null || selectedSlots === void 0 ? void 0 : selectedSlots.length) === 0,
22100
22278
  style: {
22101
22279
  padding: "10px 18px",
22102
22280
  borderRadius: "6px",
22103
22281
  border: "none",
22104
- background: selectedSlots.length > 0 ? "#2947a3" : "#ccc",
22282
+ background: (selectedSlots === null || selectedSlots === void 0 ? void 0 : selectedSlots.length) > 0 ? "#2947a3" : "#ccc",
22105
22283
  color: "#fff",
22106
22284
  fontWeight: 600,
22107
- cursor: selectedSlots.length > 0 ? "pointer" : "not-allowed",
22285
+ cursor: (selectedSlots === null || selectedSlots === void 0 ? void 0 : selectedSlots.length) > 0 ? "pointer" : "not-allowed",
22108
22286
  transition: "background 0.2s"
22109
22287
  }
22110
22288
  }, "\uD83D\uDED2 ", (existingForAd === null || existingForAd === void 0 ? void 0 : existingForAd.length) > 0 ? t("Update Cart") : t("Add To Cart")))));
@@ -22116,9 +22294,12 @@ const CartModal = ({
22116
22294
  onRemoveSlot,
22117
22295
  t
22118
22296
  }) => {
22119
- const [expanded, setExpanded] = useState(() => cartSlots.map(item => item.ad.id));
22297
+ const [expanded, setExpanded] = useState(() => cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map(item => {
22298
+ var _item$ad;
22299
+ return item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id;
22300
+ }));
22120
22301
  const toggleExpand = adId => {
22121
- setExpanded(prev => prev.includes(adId) ? prev.filter(id => id !== adId) : [...prev, adId]);
22302
+ setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
22122
22303
  };
22123
22304
  const makeColumns = ad => [{
22124
22305
  Header: t("ADS_DATE"),
@@ -22134,14 +22315,15 @@ const CartModal = ({
22134
22315
  accessor: "addType"
22135
22316
  }, {
22136
22317
  Header: t("ADS_NIGHT_LIGHT"),
22137
- accessor: row => row.nightLight ? t("ADS_YES") : t("ADS_NO")
22318
+ accessor: row => row !== null && row !== void 0 && row.nightLight ? t("ADS_YES") : t("ADS_NO")
22138
22319
  }, {
22139
22320
  Header: t("ADS_STATUS"),
22140
22321
  accessor: "slotStaus",
22141
22322
  Cell: ({
22142
22323
  row
22143
22324
  }) => {
22144
- const status = row.original.slotStaus;
22325
+ var _row$original;
22326
+ const status = row === null || row === void 0 ? void 0 : (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slotStaus;
22145
22327
  const isAvailable = status === "AVAILABLE";
22146
22328
  return /*#__PURE__*/React.createElement("span", {
22147
22329
  style: {
@@ -22157,26 +22339,6 @@ const CartModal = ({
22157
22339
  }
22158
22340
  }, status);
22159
22341
  }
22160
- }, {
22161
- Header: t("ADS_REMOVE"),
22162
- accessor: "remove",
22163
- Cell: ({
22164
- row
22165
- }) => {
22166
- const slot = row.original;
22167
- return /*#__PURE__*/React.createElement("button", {
22168
- onClick: () => onRemoveSlot(ad, slot),
22169
- style: {
22170
- padding: "4px 10px",
22171
- borderRadius: "6px",
22172
- border: "none",
22173
- background: "#dc3545",
22174
- color: "#fff",
22175
- cursor: "pointer",
22176
- fontSize: "12px"
22177
- }
22178
- }, t("ADS_DELETE"));
22179
- }
22180
22342
  }];
22181
22343
  return /*#__PURE__*/React.createElement("div", {
22182
22344
  style: {
@@ -22233,14 +22395,14 @@ const CartModal = ({
22233
22395
  flex: 1,
22234
22396
  overflowY: "auto"
22235
22397
  }
22236
- }, cartSlots.length === 0 ? /*#__PURE__*/React.createElement("p", {
22398
+ }, (cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.length) === 0 ? /*#__PURE__*/React.createElement("p", {
22237
22399
  style: {
22238
22400
  padding: "12px",
22239
22401
  color: "#666"
22240
22402
  }
22241
22403
  }, t("ADS_NO_ITEMS_IN_CART")) : cartSlots.map((item, idx) => {
22242
- var _item$slots;
22243
- const isOpen = expanded.includes(item.ad.id);
22404
+ var _item$ad3, _item$ad4, _item$slots;
22405
+ const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(item.ad.id);
22244
22406
  return /*#__PURE__*/React.createElement("div", {
22245
22407
  key: idx,
22246
22408
  style: {
@@ -22250,30 +22412,50 @@ const CartModal = ({
22250
22412
  overflow: "hidden"
22251
22413
  }
22252
22414
  }, /*#__PURE__*/React.createElement("div", {
22253
- onClick: () => toggleExpand(item.ad.id),
22254
22415
  style: {
22255
22416
  background: "#f9f9f9",
22256
22417
  padding: "10px 14px",
22257
22418
  fontWeight: 600,
22258
22419
  fontSize: "14px",
22259
22420
  borderBottom: "1px solid #ddd",
22260
- cursor: "pointer",
22261
22421
  display: "flex",
22262
22422
  justifyContent: "space-between",
22263
22423
  alignItems: "center"
22264
22424
  }
22265
- }, /*#__PURE__*/React.createElement("span", null, item.ad.name, " \u2014 \u20B9", item.ad.amount * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)), /*#__PURE__*/React.createElement("span", {
22425
+ }, /*#__PURE__*/React.createElement("div", {
22426
+ onClick: () => {
22427
+ var _item$ad2;
22428
+ return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.id);
22429
+ },
22266
22430
  style: {
22267
- fontSize: "18px"
22431
+ cursor: "pointer",
22432
+ flex: 1
22268
22433
  }
22269
- }, isOpen ? "" : "▸")), isOpen && /*#__PURE__*/React.createElement("div", {
22434
+ }, item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.name, " \u2014 \u20B9", (item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.amount) * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length), /*#__PURE__*/React.createElement("span", {
22435
+ style: {
22436
+ fontSize: "18px",
22437
+ marginLeft: "8px"
22438
+ }
22439
+ }, isOpen ? "▾" : "▸")), /*#__PURE__*/React.createElement("button", {
22440
+ onClick: () => onRemoveSlot(item.ad),
22441
+ style: {
22442
+ padding: "6px 12px",
22443
+ borderRadius: "6px",
22444
+ border: "none",
22445
+ background: "#dc3545",
22446
+ color: "#fff",
22447
+ cursor: "pointer",
22448
+ fontSize: "12px",
22449
+ marginLeft: "10px"
22450
+ }
22451
+ }, t("ADS_REMOVE"))), isOpen && /*#__PURE__*/React.createElement("div", {
22270
22452
  style: {
22271
22453
  overflowX: "auto"
22272
22454
  }
22273
22455
  }, /*#__PURE__*/React.createElement(Table, {
22274
22456
  t: t,
22275
22457
  data: item.slots,
22276
- columns: makeColumns(item.ad),
22458
+ columns: makeColumns(),
22277
22459
  disableSort: true,
22278
22460
  isPaginationRequired: false,
22279
22461
  getCellProps: cell => ({
@@ -22297,11 +22479,15 @@ const AdCard = ({
22297
22479
  t,
22298
22480
  onViewAvailability: _onViewAvailability = () => {},
22299
22481
  cartSlots: _cartSlots = [],
22300
- openCart
22482
+ openCart,
22483
+ scheduleType
22301
22484
  }) => {
22302
- const todayISO = new Date().toISOString().split("T")[0];
22303
22485
  const startDateVal = watch(`ads.${idx}.startDate`) || "";
22304
- const isAdded = _cartSlots.some(item => item.ad.id === ad.id && item.slots.length > 0);
22486
+ const minDate = getMinDateForType(scheduleType);
22487
+ const isAdded = _cartSlots === null || _cartSlots === void 0 ? void 0 : _cartSlots.some(item => {
22488
+ var _item$ad, _item$slots;
22489
+ return (item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length) > 0;
22490
+ });
22305
22491
  return /*#__PURE__*/React.createElement("div", {
22306
22492
  style: {
22307
22493
  width: 280,
@@ -22322,8 +22508,8 @@ const AdCard = ({
22322
22508
  background: "#f5f5f5"
22323
22509
  }
22324
22510
  }, ad.imageSrc || ad.photoURL ? /*#__PURE__*/React.createElement("img", {
22325
- src: ad.imageSrc || ad.photoURL,
22326
- alt: ad.name || `Ad ${ad.id}`,
22511
+ src: (ad === null || ad === void 0 ? void 0 : ad.imageSrc) || (ad === null || ad === void 0 ? void 0 : ad.photoURL),
22512
+ alt: (ad === null || ad === void 0 ? void 0 : ad.name) || `Ad ${ad === null || ad === void 0 ? void 0 : ad.id}`,
22327
22513
  loading: "lazy",
22328
22514
  style: {
22329
22515
  width: "100%",
@@ -22357,22 +22543,22 @@ const AdCard = ({
22357
22543
  style: {
22358
22544
  color: "#222"
22359
22545
  }
22360
- }, "\u20B9", ad.amount)), /*#__PURE__*/React.createElement("div", {
22546
+ }, "\u20B9", ad === null || ad === void 0 ? void 0 : ad.amount)), /*#__PURE__*/React.createElement("div", {
22361
22547
  style: {
22362
22548
  display: "flex",
22363
22549
  justifyContent: "space-between"
22364
22550
  }
22365
- }, /*#__PURE__*/React.createElement("span", null, ad.locationCode), /*#__PURE__*/React.createElement("span", null, "Pole ", ad.poleNo)), /*#__PURE__*/React.createElement("div", {
22551
+ }, /*#__PURE__*/React.createElement("span", null, ad === null || ad === void 0 ? void 0 : ad.locationCode), /*#__PURE__*/React.createElement("span", null, "Pole ", ad.poleNo)), /*#__PURE__*/React.createElement("div", {
22366
22552
  style: {
22367
22553
  display: "flex",
22368
22554
  justifyContent: "space-between"
22369
22555
  }
22370
- }, /*#__PURE__*/React.createElement("span", null, ad.adType), /*#__PURE__*/React.createElement("span", {
22556
+ }, /*#__PURE__*/React.createElement("span", null, ad === null || ad === void 0 ? void 0 : ad.adType), /*#__PURE__*/React.createElement("span", {
22371
22557
  style: {
22372
- color: "red",
22373
- fontWeight: 500
22558
+ color: "green",
22559
+ fontWeight: 600
22374
22560
  }
22375
- }, ad.light))), /*#__PURE__*/React.createElement("div", {
22561
+ }, ad === null || ad === void 0 ? void 0 : ad.light))), /*#__PURE__*/React.createElement("div", {
22376
22562
  style: {
22377
22563
  fontSize: 12,
22378
22564
  color: "#666",
@@ -22388,7 +22574,7 @@ const AdCard = ({
22388
22574
  name: `ads.${idx}.startDate`,
22389
22575
  render: props => /*#__PURE__*/React.createElement("input", {
22390
22576
  type: "date",
22391
- min: todayISO,
22577
+ min: minDate,
22392
22578
  value: props.value || "",
22393
22579
  onChange: e => props.onChange(e.target.value),
22394
22580
  style: {
@@ -22430,7 +22616,7 @@ const AdCard = ({
22430
22616
  name: `ads.${idx}.endDate`,
22431
22617
  render: props => /*#__PURE__*/React.createElement("input", {
22432
22618
  type: "date",
22433
- min: startDateVal || todayISO,
22619
+ min: startDateVal || minDate,
22434
22620
  value: props.value || "",
22435
22621
  onChange: e => props.onChange(e.target.value),
22436
22622
  style: {
@@ -22510,7 +22696,6 @@ const ADSCitizenSecond = ({
22510
22696
  t
22511
22697
  }) => {
22512
22698
  var _window$location, _window$location$href;
22513
- const stateId = Digit.ULBService.getStateId();
22514
22699
  const isCitizen = typeof window !== "undefined" && ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : (_window$location$href = _window$location.href) === null || _window$location$href === void 0 ? void 0 : _window$location$href.includes("citizen"));
22515
22700
  const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
22516
22701
  const [adsForLocation, setAdsForLocation] = useState([]);
@@ -22525,10 +22710,13 @@ const ADSCitizenSecond = ({
22525
22710
  });
22526
22711
  const {
22527
22712
  data: mdmsAds = []
22528
- } = Digit.Hooks.ads.useADSAllMDMS(stateId);
22713
+ } = Digit.Hooks.ads.useADSAllMDMS(tenantId);
22529
22714
  const {
22530
22715
  data: location = []
22531
- } = Digit.Hooks.ads.useADSLocationMDMS(stateId);
22716
+ } = Digit.Hooks.ads.useADSLocationMDMS(tenantId);
22717
+ const {
22718
+ data: scheduleType = []
22719
+ } = Digit.Hooks.ads.useADSScheduleTypeMDMS(tenantId);
22532
22720
  const [cartSlots, setCartSlots] = useState([]);
22533
22721
  const dispatch = useDispatch();
22534
22722
  const {
@@ -22577,27 +22765,6 @@ const ADSCitizenSecond = ({
22577
22765
  });
22578
22766
  }
22579
22767
  };
22580
- const validateSchedule = ({
22581
- startDate,
22582
- startTime,
22583
- endDate,
22584
- endTime
22585
- }) => {
22586
- if (!startDate || !startTime || !endDate || !endTime) {
22587
- return "Start and end date/time are required.";
22588
- }
22589
- const now = new Date();
22590
- const s = new Date(`${startDate}T${startTime}`);
22591
- const e = new Date(`${endDate}T${endTime}`);
22592
- if (s < now) {
22593
- return "Start date/time cannot be in the past.";
22594
- }
22595
- if (e <= s) {
22596
- return "End date/time must be later than start date/time.";
22597
- }
22598
- return null;
22599
- };
22600
- const showMore = () => setVisibleCount(v => v + 6);
22601
22768
  const areCartSlotsEqual = (a = [], b = []) => {
22602
22769
  if (a.length !== b.length) return false;
22603
22770
  const sortByAd = arr => [...arr].sort((x, y) => String(x.ad.id).localeCompare(String(y.ad.id)));
@@ -22614,7 +22781,7 @@ const ADSCitizenSecond = ({
22614
22781
  };
22615
22782
  const onSubmit = async data => {
22616
22783
  var _currentStepData$ads;
22617
- if (cartSlots.length === 0) {
22784
+ if ((cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.length) === 0) {
22618
22785
  setShowToast({
22619
22786
  label: t("ADS_ONE_AD_ATLEAST"),
22620
22787
  error: true
@@ -22622,7 +22789,7 @@ const ADSCitizenSecond = ({
22622
22789
  return;
22623
22790
  }
22624
22791
  if ((currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$ads = currentStepData.ads) === null || _currentStepData$ads === void 0 ? void 0 : _currentStepData$ads.length) > 0) {
22625
- const unchanged = areCartSlotsEqual(cartSlots, currentStepData.ads);
22792
+ const unchanged = areCartSlotsEqual(cartSlots, currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.ads);
22626
22793
  if (unchanged) {
22627
22794
  goNext(cartSlots);
22628
22795
  return;
@@ -22638,8 +22805,8 @@ const ADSCitizenSecond = ({
22638
22805
  try {
22639
22806
  const response = await Digit.ADSServices.slot_search(payload, tenantId);
22640
22807
  if (response) {
22641
- const expiry = Date.now() + 30 * 60 * 1000;
22642
- dispatch(UPDATE_ADSNewApplication_FORM("reservationExpiry", expiry));
22808
+ const createTime = Date.now();
22809
+ dispatch(UPDATE_ADSNewApplication_FORM("reservationExpiry", createTime));
22643
22810
  goNext(cartSlots);
22644
22811
  } else {
22645
22812
  setShowToast({
@@ -22682,7 +22849,8 @@ const ADSCitizenSecond = ({
22682
22849
  startDate,
22683
22850
  endDate,
22684
22851
  startTime,
22685
- endTime
22852
+ endTime,
22853
+ scheduleType
22686
22854
  });
22687
22855
  if (err) {
22688
22856
  setShowToast({
@@ -22706,79 +22874,53 @@ const ADSCitizenSecond = ({
22706
22874
  });
22707
22875
  setShowModal(true);
22708
22876
  };
22877
+ const handleRemoveFromCart = ad => {
22878
+ setCartSlots(prev => prev.filter(item => item.ad.id !== ad.id));
22879
+ setShowToast({
22880
+ label: `Removed all slots for ${ad.name}`,
22881
+ error: true
22882
+ });
22883
+ };
22709
22884
  const handleAddToCart = (slots, ad) => {
22710
22885
  setCartSlots(prev => {
22886
+ const enrichedSlots = slots.map(s => ({
22887
+ ...s,
22888
+ bookingStartDate: s === null || s === void 0 ? void 0 : s.bookingDate,
22889
+ bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
22890
+ bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
22891
+ bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
22892
+ }));
22711
22893
  const existing = prev.find(item => item.ad.id === ad.id);
22712
22894
  let updated;
22713
22895
  if (existing) {
22714
- let updatedSlots = existing.slots;
22715
- slots.forEach(slot => {
22716
- if (slot._remove) {
22717
- updatedSlots = updatedSlots.filter(s => s.bookingDate !== slot.bookingDate);
22718
- setShowToast({
22719
- label: `Removed slot ${slot.bookingDate} from ${ad.name}`,
22720
- error: true
22721
- });
22722
- } else if (!updatedSlots.some(s => s.bookingDate === slot.bookingDate)) {
22723
- const enrichedSlot = {
22724
- ...slot,
22725
- bookingStartDate: slot === null || slot === void 0 ? void 0 : slot.bookingDate,
22726
- bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
22727
- bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
22728
- bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
22729
- };
22730
- updatedSlots = [...updatedSlots, enrichedSlot];
22731
- setShowToast({
22732
- label: `Added slot ${slot.bookingDate} to ${ad.name}`,
22733
- error: false
22734
- });
22735
- }
22736
- });
22737
22896
  updated = prev.map(item => item.ad.id === ad.id ? {
22738
22897
  ...item,
22739
- slots: updatedSlots
22898
+ slots: enrichedSlots
22740
22899
  } : item);
22900
+ setShowToast({
22901
+ label: `Updated ${enrichedSlots.length} slot(s) for ${ad.name}`,
22902
+ error: false
22903
+ });
22741
22904
  } else {
22742
- const addSlots = slots.filter(s => !s._remove).map(s => ({
22743
- ...s,
22744
- bookingStartDate: s === null || s === void 0 ? void 0 : s.bookingDate,
22745
- bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
22746
- bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
22747
- bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
22748
- }));
22749
- if (addSlots.length > 0) {
22750
- setShowToast({
22751
- label: `Added ${addSlots.length} slot(s) to ${ad.name}`,
22752
- error: false
22753
- });
22754
- updated = [...prev, {
22755
- ad,
22756
- slots: addSlots
22757
- }];
22758
- } else {
22759
- updated = prev;
22760
- }
22905
+ updated = [...prev, {
22906
+ ad,
22907
+ slots: enrichedSlots
22908
+ }];
22909
+ setShowToast({
22910
+ label: `Added ${enrichedSlots.length} slot(s) to ${ad.name}`,
22911
+ error: false
22912
+ });
22761
22913
  }
22762
22914
  return updated;
22763
22915
  });
22764
22916
  };
22765
- const handleRemoveFromCart = (ad, slotToRemove) => {
22766
- setCartSlots(prev => prev.map(item => item.ad.id === ad.id ? {
22767
- ...item,
22768
- slots: item.slots.filter(s => s.bookingDate !== slotToRemove.bookingDate)
22769
- } : item).filter(item => item.slots.length > 0));
22770
- setShowToast({
22771
- label: `Removed slot ${slotToRemove.bookingDate} from ${ad.name}`,
22772
- error: true
22773
- });
22774
- };
22775
22917
  useEffect(() => {
22776
22918
  var _currentStepData$ads2;
22777
22919
  if ((currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$ads2 = currentStepData.ads) === null || _currentStepData$ads2 === void 0 ? void 0 : _currentStepData$ads2.length) > 0) {
22778
22920
  var _currentStepData$ads$, _currentStepData$ads$2, _matchedOption$geo_ta, _matchedOption$geo_ta2;
22779
22921
  setCartSlots(currentStepData.ads);
22780
22922
  const locationCode = (_currentStepData$ads$ = currentStepData.ads[0]) === null || _currentStepData$ads$ === void 0 ? void 0 : (_currentStepData$ads$2 = _currentStepData$ads$.ad) === null || _currentStepData$ads$2 === void 0 ? void 0 : _currentStepData$ads$2.locationCode;
22781
- const matchedOption = locationOptions.find(opt => opt.code === locationCode);
22923
+ const matchedOption = locationOptions === null || locationOptions === void 0 ? void 0 : locationOptions.find(opt => opt.code === locationCode);
22782
22924
  if (matchedOption) {
22783
22925
  setValue("siteId", matchedOption);
22784
22926
  filterAds(matchedOption);
@@ -22802,6 +22944,7 @@ const ADSCitizenSecond = ({
22802
22944
  const mandatoryStyle = {
22803
22945
  color: "red"
22804
22946
  };
22947
+ const guidance = getScheduleMessage(scheduleType, t);
22805
22948
  return /*#__PURE__*/React.createElement(React.Fragment, null, (cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.length) > 0 && /*#__PURE__*/React.createElement("div", {
22806
22949
  style: {
22807
22950
  display: "flex",
@@ -22858,41 +23001,62 @@ const ADSCitizenSecond = ({
22858
23001
  })
22859
23002
  }))), errors.siteId && /*#__PURE__*/React.createElement(CardLabelError$1, {
22860
23003
  style: errorStyle
22861
- }, errors.siteId.message), (adsForLocation === null || adsForLocation === void 0 ? void 0 : adsForLocation.length) > 0 && /*#__PURE__*/React.createElement("div", {
23004
+ }, errors.siteId.message), guidance && (adsForLocation === null || adsForLocation === void 0 ? void 0 : adsForLocation.length) > 0 && /*#__PURE__*/React.createElement("div", {
23005
+ style: {
23006
+ background: "#fff3cd",
23007
+ border: "1px solid #ffeeba",
23008
+ color: "#856404",
23009
+ padding: "6px 10px",
23010
+ borderRadius: "6px",
23011
+ fontSize: "14px",
23012
+ marginBottom: "8px",
23013
+ width: "100%",
23014
+ maxWidth: "545px"
23015
+ }
23016
+ }, "\u26A0\uFE0F ", guidance), /*#__PURE__*/React.createElement("div", {
22862
23017
  style: {
22863
23018
  display: "flex",
22864
23019
  flexWrap: "wrap",
22865
23020
  gap: 12,
22866
23021
  margin: "12px"
22867
23022
  }
22868
- }, adsForLocation.slice(0, visibleCount).map((ad, idx) => {
22869
- return /*#__PURE__*/React.createElement(AdCard, {
22870
- key: ad.id ?? idx,
22871
- ad: ad,
22872
- idx: idx,
22873
- control: control,
22874
- watch: watch,
22875
- cartSlots: cartSlots,
22876
- onViewAvailability: handleViewAvailability,
22877
- openCart: () => setShowCart(true),
22878
- t: t
22879
- });
22880
- })), visibleCount < adsForLocation.length && /*#__PURE__*/React.createElement("div", {
23023
+ }, adsForLocation.slice(0, visibleCount).map((ad, idx) => /*#__PURE__*/React.createElement(AdCard, {
23024
+ key: ad.id || idx,
23025
+ ad: ad,
23026
+ idx: idx,
23027
+ control: control,
23028
+ watch: watch,
23029
+ cartSlots: cartSlots,
23030
+ onViewAvailability: handleViewAvailability,
23031
+ openCart: () => setShowCart(true),
23032
+ t: t,
23033
+ scheduleType: scheduleType
23034
+ }))), adsForLocation.length > 6 && /*#__PURE__*/React.createElement("div", {
22881
23035
  style: {
22882
- marginTop: 12,
22883
- textAlign: "center"
23036
+ textAlign: "center",
23037
+ marginTop: "1rem"
22884
23038
  }
22885
- }, /*#__PURE__*/React.createElement("button", {
23039
+ }, visibleCount < adsForLocation.length ? /*#__PURE__*/React.createElement("button", {
22886
23040
  type: "button",
22887
- onClick: showMore,
22888
23041
  style: {
22889
23042
  padding: "8px 12px",
22890
23043
  borderRadius: 6,
22891
23044
  border: "1px solid #ccc",
22892
23045
  background: "#fff",
22893
23046
  cursor: "pointer"
22894
- }
22895
- }, t("ADS_SHOW_MORE"))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("CS_COMPLAINT_DETAILS_GEO_LOCATION")), /*#__PURE__*/React.createElement(Controller, {
23047
+ },
23048
+ onClick: () => setVisibleCount(v => v + 6)
23049
+ }, t("ADS_SHOW_MORE")) : /*#__PURE__*/React.createElement("button", {
23050
+ type: "button",
23051
+ style: {
23052
+ padding: "8px 12px",
23053
+ borderRadius: 6,
23054
+ border: "1px solid #ccc",
23055
+ background: "#fff",
23056
+ cursor: "pointer"
23057
+ },
23058
+ onClick: () => setVisibleCount(6)
23059
+ }, t("SHOW_LESS"))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("CS_COMPLAINT_DETAILS_GEO_LOCATION")), /*#__PURE__*/React.createElement(Controller, {
22896
23060
  control: control,
22897
23061
  name: "geoLocation",
22898
23062
  render: props => /*#__PURE__*/React.createElement(ADSAddressField, {
@@ -24658,7 +24822,7 @@ const ADSSelectProofIdentity = ({
24658
24822
  allowedExtensions: [".pdf", ".jpeg", ".jpg", ".png"]
24659
24823
  };
24660
24824
  const validateFile = (file, docCode) => {
24661
- var _file$name, _file$name$toLowerCas;
24825
+ var _file$name, _file$name$toLowerCas, _allowedExtensions;
24662
24826
  if (!file) return null;
24663
24827
  const maxBytes = FILE_POLICY.maxBytes;
24664
24828
  let allowedExtensions = [...FILE_POLICY.allowedExtensions];
@@ -24666,28 +24830,29 @@ const ADSSelectProofIdentity = ({
24666
24830
  allowedExtensions = [".jpeg", ".jpg", ".png"];
24667
24831
  }
24668
24832
  const nameLower = (file === null || file === void 0 ? void 0 : (_file$name = file.name) === null || _file$name === void 0 ? void 0 : (_file$name$toLowerCas = _file$name.toLowerCase) === null || _file$name$toLowerCas === void 0 ? void 0 : _file$name$toLowerCas.call(_file$name)) || "";
24669
- const okType = allowedExtensions.some(ext => nameLower.endsWith(ext));
24833
+ const okType = (_allowedExtensions = allowedExtensions) === null || _allowedExtensions === void 0 ? void 0 : _allowedExtensions.some(ext => nameLower === null || nameLower === void 0 ? void 0 : nameLower.endsWith(ext));
24670
24834
  if (!okType) return "CS_FILE_INVALID_TYPE";
24671
- if (file.size > maxBytes) return "CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED";
24835
+ if ((file === null || file === void 0 ? void 0 : file.size) > maxBytes) return "CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED";
24672
24836
  return null;
24673
24837
  };
24674
24838
  const makeDocumentsValidator = mdms => {
24675
- const requiredDocs = (mdms || []).filter(d => d === null || d === void 0 ? void 0 : d.required);
24839
+ var _ref;
24840
+ const requiredDocs = (_ref = mdms || []) === null || _ref === void 0 ? void 0 : _ref.filter(d => d === null || d === void 0 ? void 0 : d.required);
24676
24841
  return (documents = []) => {
24677
24842
  const errors = {};
24678
24843
  const missingDocs = [];
24679
24844
  const docsArray = Array.isArray(documents) ? documents : [];
24680
- if (!requiredDocs.length) return errors;
24845
+ if (!(requiredDocs !== null && requiredDocs !== void 0 && requiredDocs.length)) return errors;
24681
24846
  for (const doc of requiredDocs) {
24682
- const satisfied = docsArray.some(d => {
24847
+ const satisfied = docsArray === null || docsArray === void 0 ? void 0 : docsArray.some(d => {
24683
24848
  var _d$documentType;
24684
- return ((_d$documentType = d.documentType) === null || _d$documentType === void 0 ? void 0 : _d$documentType.includes(doc.code)) && (d.filestoreId || d.fileStoreId);
24849
+ return ((_d$documentType = d.documentType) === null || _d$documentType === void 0 ? void 0 : _d$documentType.includes(doc === null || doc === void 0 ? void 0 : doc.code)) && ((d === null || d === void 0 ? void 0 : d.filestoreId) || d.fileStoreId);
24685
24850
  });
24686
24851
  if (!satisfied) {
24687
24852
  missingDocs.push(t(doc === null || doc === void 0 ? void 0 : doc.code.replaceAll(".", "_")));
24688
24853
  }
24689
24854
  }
24690
- if (missingDocs.length > 0) {
24855
+ if ((missingDocs === null || missingDocs === void 0 ? void 0 : missingDocs.length) > 0) {
24691
24856
  errors.missingRequired = "PTR_MISSING_REQUIRED_DOCUMENTS";
24692
24857
  errors.missingDocs = missingDocs;
24693
24858
  }
@@ -24723,10 +24888,11 @@ const ADSSelectProofIdentity = ({
24723
24888
  }
24724
24889
  }, [documents, config.key]);
24725
24890
  const handleSubmit = () => {
24726
- if (Object.keys(formErrors).length > 0) {
24727
- setToastError(t(formErrors.missingRequired || "PTR_VALIDATION_ERROR"));
24891
+ var _Object$keys;
24892
+ if (((_Object$keys = Object.keys(formErrors)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
24893
+ setToastError(t((formErrors === null || formErrors === void 0 ? void 0 : formErrors.missingRequired) || "PTR_VALIDATION_ERROR"));
24728
24894
  onSelect(config.key, {
24729
- missingDocs: formErrors.missingDocs || []
24895
+ missingDocs: (formErrors === null || formErrors === void 0 ? void 0 : formErrors.missingDocs) || []
24730
24896
  });
24731
24897
  return;
24732
24898
  }
@@ -24743,8 +24909,8 @@ const ADSSelectProofIdentity = ({
24743
24909
  onSelect: handleSubmit,
24744
24910
  onSkip: onSkip,
24745
24911
  isDisabled: Object.keys(formErrors).length > 0
24746
- }, Array.isArray(mdmsDocsData) && mdmsDocsData.map((mdmsDoc, index) => {
24747
- const existing = documents.find(d => d.documentType === mdmsDoc.code);
24912
+ }, Array.isArray(mdmsDocsData) && (mdmsDocsData === null || mdmsDocsData === void 0 ? void 0 : mdmsDocsData.map((mdmsDoc, index) => {
24913
+ const existing = documents === null || documents === void 0 ? void 0 : documents.find(d => (d === null || d === void 0 ? void 0 : d.documentType) === (mdmsDoc === null || mdmsDoc === void 0 ? void 0 : mdmsDoc.code));
24748
24914
  return /*#__PURE__*/React.createElement(ADSSelectDocument$1, {
24749
24915
  key: index,
24750
24916
  document: {
@@ -24760,7 +24926,7 @@ const ADSSelectProofIdentity = ({
24760
24926
  setFormErrors: setFormErrors,
24761
24927
  formErrors: formErrors
24762
24928
  });
24763
- }), toastError && /*#__PURE__*/React.createElement(Toast, {
24929
+ })), toastError && /*#__PURE__*/React.createElement(Toast, {
24764
24930
  isDleteBtn: true,
24765
24931
  label: toastError,
24766
24932
  onClose: () => setToastError(null),
@@ -24821,7 +24987,7 @@ function ADSSelectDocument$1({
24821
24987
  }
24822
24988
  }, [file]);
24823
24989
  const updateParentDocs = fileId => {
24824
- const updatedDocs = [...documents.filter(d => d.documentType !== (doc === null || doc === void 0 ? void 0 : doc.code)), ...(fileId ? [{
24990
+ const updatedDocs = [...(documents === null || documents === void 0 ? void 0 : documents.filter(d => (d === null || d === void 0 ? void 0 : d.documentType) !== (doc === null || doc === void 0 ? void 0 : doc.code))), ...(fileId ? [{
24825
24991
  documentType: doc === null || doc === void 0 ? void 0 : doc.code,
24826
24992
  fileStoreId: fileId,
24827
24993
  documentUid: fileId
@@ -24875,9 +25041,12 @@ const ADSCartDetails$1 = ({
24875
25041
  cartDetails,
24876
25042
  t
24877
25043
  }) => {
24878
- const [expanded, setExpanded] = useState(() => cartDetails.map(item => item.ad.id));
25044
+ const [expanded, setExpanded] = useState(() => cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map(item => {
25045
+ var _item$ad;
25046
+ return item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id;
25047
+ }));
24879
25048
  const toggleExpand = adId => {
24880
- setExpanded(prev => prev.includes(adId) ? prev.filter(id => id !== adId) : [...prev, adId]);
25049
+ setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
24881
25050
  };
24882
25051
  const makeColumns = () => [{
24883
25052
  Header: t("ADS_DATE"),
@@ -24899,14 +25068,14 @@ const ADSCartDetails$1 = ({
24899
25068
  style: {
24900
25069
  marginTop: "1rem"
24901
25070
  }
24902
- }, cartDetails.length === 0 ? /*#__PURE__*/React.createElement("p", {
25071
+ }, (cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.length) === 0 ? /*#__PURE__*/React.createElement("p", {
24903
25072
  style: {
24904
25073
  padding: "12px",
24905
25074
  color: "#666"
24906
25075
  }
24907
25076
  }, t("ADS_NO_ADVERTISMENT_DETAILS")) : cartDetails.map((item, idx) => {
24908
- var _item$slots;
24909
- const isOpen = expanded.includes(item.ad.id);
25077
+ var _item$ad3, _item$ad4, _item$slots;
25078
+ const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(item.ad.id);
24910
25079
  return /*#__PURE__*/React.createElement("div", {
24911
25080
  key: idx,
24912
25081
  style: {
@@ -24916,7 +25085,10 @@ const ADSCartDetails$1 = ({
24916
25085
  overflow: "hidden"
24917
25086
  }
24918
25087
  }, /*#__PURE__*/React.createElement("div", {
24919
- onClick: () => toggleExpand(item.ad.id),
25088
+ onClick: () => {
25089
+ var _item$ad2;
25090
+ return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.id);
25091
+ },
24920
25092
  style: {
24921
25093
  background: "#f9f9f9",
24922
25094
  padding: "10px 14px",
@@ -24928,7 +25100,7 @@ const ADSCartDetails$1 = ({
24928
25100
  justifyContent: "space-between",
24929
25101
  alignItems: "center"
24930
25102
  }
24931
- }, /*#__PURE__*/React.createElement("span", null, item.ad.name, " \u2014 \u20B9", item.ad.amount * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)), /*#__PURE__*/React.createElement("span", {
25103
+ }, /*#__PURE__*/React.createElement("span", null, item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.name, " \u2014 \u20B9", (item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.amount) * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)), /*#__PURE__*/React.createElement("span", {
24932
25104
  style: {
24933
25105
  fontSize: "18px"
24934
25106
  }
@@ -24958,7 +25130,7 @@ const ADSCartDetails$1 = ({
24958
25130
  function ADSSummary({
24959
25131
  t
24960
25132
  }) {
24961
- var _formData$CreatedResp, _formData$ownerDetail, _formData$CreatedResp2, _formData$documents, _formData$documents$d, _formData$documents2;
25133
+ var _formData$CreatedResp, _formData$ownerDetail, _formData$CreatedResp2, _formData$documents, _formData$documents$d, _formData$documents2, _formData$documents2$, _formData$documents3;
24962
25134
  const dispatch = useDispatch();
24963
25135
  const TT = key => t ? t(key) : key;
24964
25136
  const rawFormData = useSelector(state => {
@@ -24968,7 +25140,7 @@ function ADSSummary({
24968
25140
  const formData = React.useMemo(() => rawFormData || {}, [rawFormData]);
24969
25141
  const applicant = (formData === null || formData === void 0 ? void 0 : (_formData$CreatedResp = formData.CreatedResponse) === null || _formData$CreatedResp === void 0 ? void 0 : _formData$CreatedResp.applicantDetail) || {};
24970
25142
  const address = (formData === null || formData === void 0 ? void 0 : (_formData$ownerDetail = formData.ownerDetails) === null || _formData$ownerDetail === void 0 ? void 0 : _formData$ownerDetail.address) || (formData === null || formData === void 0 ? void 0 : (_formData$CreatedResp2 = formData.CreatedResponse) === null || _formData$CreatedResp2 === void 0 ? void 0 : _formData$CreatedResp2.address) || {};
24971
- const docs = Array.isArray(formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : (_formData$documents$d = _formData$documents.documents) === null || _formData$documents$d === void 0 ? void 0 : _formData$documents$d.documents) ? formData.documents.documents.documents : Array.isArray((_formData$documents2 = formData.documents) === null || _formData$documents2 === void 0 ? void 0 : _formData$documents2.documents) ? formData.documents.documents : Array.isArray(formData.documents) ? formData.documents : [];
25143
+ const docs = Array.isArray(formData === null || formData === void 0 ? void 0 : (_formData$documents = formData.documents) === null || _formData$documents === void 0 ? void 0 : (_formData$documents$d = _formData$documents.documents) === null || _formData$documents$d === void 0 ? void 0 : _formData$documents$d.documents) ? formData === null || formData === void 0 ? void 0 : (_formData$documents2 = formData.documents) === null || _formData$documents2 === void 0 ? void 0 : (_formData$documents2$ = _formData$documents2.documents) === null || _formData$documents2$ === void 0 ? void 0 : _formData$documents2$.documents : Array.isArray((_formData$documents3 = formData.documents) === null || _formData$documents3 === void 0 ? void 0 : _formData$documents3.documents) ? formData.documents.documents : Array.isArray(formData.documents) ? formData.documents : [];
24972
25144
  const sectionStyle = {
24973
25145
  backgroundColor: "#ffffff",
24974
25146
  padding: "1rem 0",