@mseva/upyog-ui-module-ads 1.0.80 → 1.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1220 -1860
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -2,9 +2,9 @@ import { Modal, Card as Card$1, CheckBox, Header, SearchForm, SearchField, TextI
|
|
|
2
2
|
import React, { useState, useEffect, useMemo, useCallback, useRef, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useHistory, Link, useParams, useRouteMatch, Switch, useLocation, Route, Redirect } from 'react-router-dom';
|
|
5
|
-
import { useForm, Controller
|
|
5
|
+
import { useForm, Controller } from 'react-hook-form';
|
|
6
6
|
import { useQueryClient } from 'react-query';
|
|
7
|
-
import {
|
|
7
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
8
8
|
import { combineReducers } from 'redux';
|
|
9
9
|
|
|
10
10
|
const shouldHideBackButton = (config = []) => {
|
|
@@ -131,7 +131,6 @@ const ADSSearchApplication = ({
|
|
|
131
131
|
status: ""
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
console.log("data :>> ", data);
|
|
135
134
|
useEffect(() => {
|
|
136
135
|
register("offset", 0);
|
|
137
136
|
register("limit", 10);
|
|
@@ -564,7 +563,6 @@ const Status = ({
|
|
|
564
563
|
} = Digit.Hooks.useApplicationStatusGeneral({
|
|
565
564
|
businessServices
|
|
566
565
|
}, {});
|
|
567
|
-
console.log("statusData :>> ", statusData);
|
|
568
566
|
const {
|
|
569
567
|
userRoleStates
|
|
570
568
|
} = statusData || {};
|
|
@@ -6470,7 +6468,6 @@ const Filter = ({
|
|
|
6470
6468
|
const [_searchParams, setSearchParams] = useState(() => ({
|
|
6471
6469
|
services: (searchParams === null || searchParams === void 0 ? void 0 : searchParams.services) || ["ADV"]
|
|
6472
6470
|
}));
|
|
6473
|
-
console.log("_searchParams", _searchParams);
|
|
6474
6471
|
const assignedToOptions = useMemo(() => [{
|
|
6475
6472
|
code: "ASSIGNED_TO_ME",
|
|
6476
6473
|
name: t("ASSIGNED_TO_ME")
|
|
@@ -6500,7 +6497,6 @@ const Filter = ({
|
|
|
6500
6497
|
uuid: value
|
|
6501
6498
|
});
|
|
6502
6499
|
};
|
|
6503
|
-
console.log("statusMap", statusMap);
|
|
6504
6500
|
const localParamChange = filterParam => {
|
|
6505
6501
|
let keys_to_delete = filterParam.delete;
|
|
6506
6502
|
let _new = {
|
|
@@ -6528,7 +6524,6 @@ const Filter = ({
|
|
|
6528
6524
|
...defaultSearchParams
|
|
6529
6525
|
});
|
|
6530
6526
|
};
|
|
6531
|
-
console.log("hhh");
|
|
6532
6527
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
6533
6528
|
className: "filter"
|
|
6534
6529
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -6591,8 +6586,6 @@ const Filter = ({
|
|
|
6591
6586
|
statusMap: statusMap || client.getQueryData(`INBOX_STATUS_MAP_${moduleCode}`),
|
|
6592
6587
|
moduleCode: moduleCode,
|
|
6593
6588
|
onAssignmentChange: (e, status) => {
|
|
6594
|
-
console.log("status is 222", status);
|
|
6595
|
-
console.log("e", e);
|
|
6596
6589
|
if (e.target.checked) {
|
|
6597
6590
|
localParamChange({
|
|
6598
6591
|
applicationStatus: [...(_searchParams.applicationStatus || []), status]
|
|
@@ -6623,7 +6616,6 @@ const TableConfig = t => ({
|
|
|
6623
6616
|
row
|
|
6624
6617
|
}) => {
|
|
6625
6618
|
var _row$original, _row$original$searchD, _row$original2, _row$original2$search;
|
|
6626
|
-
console.log("row is :>> ", row);
|
|
6627
6619
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
6628
6620
|
className: "link"
|
|
6629
6621
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
@@ -13370,7 +13362,6 @@ const ADSCreate = ({
|
|
|
13370
13362
|
const ADSResponseCitizen = props => {
|
|
13371
13363
|
var _history$location;
|
|
13372
13364
|
const isCitizen = window.location.href.includes("citizen");
|
|
13373
|
-
console.log("props", props);
|
|
13374
13365
|
const {
|
|
13375
13366
|
state
|
|
13376
13367
|
} = props.location;
|
|
@@ -13379,8 +13370,6 @@ const ADSResponseCitizen = props => {
|
|
|
13379
13370
|
} = useTranslation();
|
|
13380
13371
|
const history = useHistory();
|
|
13381
13372
|
const applicationData = state === null || state === void 0 ? void 0 : state.applicationData;
|
|
13382
|
-
console.log("state", state);
|
|
13383
|
-
console.log("applicationData", applicationData);
|
|
13384
13373
|
const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
|
|
13385
13374
|
const pathname = (history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname) || "";
|
|
13386
13375
|
const ptrCode = pathname.split("/").pop();
|
|
@@ -13675,7 +13664,6 @@ class Loader {
|
|
|
13675
13664
|
const google = typeof window !== "undefined" && window.google ? window.google : null;
|
|
13676
13665
|
const LocationSearch = props => {
|
|
13677
13666
|
let defaultBounds = {};
|
|
13678
|
-
console.log("setCode=======", props);
|
|
13679
13667
|
const updateDefaultBounds = center => {
|
|
13680
13668
|
if (!center.lat || !center.lng) {
|
|
13681
13669
|
return;
|
|
@@ -13710,7 +13698,6 @@ const LocationSearch = props => {
|
|
|
13710
13698
|
const loadGoogleMaps = callback => {
|
|
13711
13699
|
var _window$globalConfigs;
|
|
13712
13700
|
const key = (_window$globalConfigs = window.globalConfigs) === null || _window$globalConfigs === void 0 ? void 0 : _window$globalConfigs.getConfig("GMAPS_API_KEY");
|
|
13713
|
-
console.log("GMAPS_API_KEY: ", key);
|
|
13714
13701
|
const loader = new Loader({
|
|
13715
13702
|
apiKey: key,
|
|
13716
13703
|
version: "weekly",
|
|
@@ -13859,7 +13846,6 @@ const LocationSearch = props => {
|
|
|
13859
13846
|
lat: currLat,
|
|
13860
13847
|
lng: currLang
|
|
13861
13848
|
};
|
|
13862
|
-
console.log("Lat & Long", location);
|
|
13863
13849
|
onChange("000000", {
|
|
13864
13850
|
longitude: location.lng,
|
|
13865
13851
|
latitude: location.lat
|
|
@@ -13905,15 +13891,12 @@ const LocationSearch = props => {
|
|
|
13905
13891
|
})];
|
|
13906
13892
|
if (isPlaceRequired) setLocationText(position, onChange, true);else setLocationText(position, onChange);
|
|
13907
13893
|
markers[0].addListener("dragend", marker => onMarkerDragged(marker, onChange, isPlaceRequired));
|
|
13908
|
-
console.log("In initAutoComplete, searbox: ", searchBox);
|
|
13909
13894
|
searchBox.addListener("place_changed", () => {
|
|
13910
13895
|
const place = searchBox.getPlace();
|
|
13911
|
-
console.log("Place: ", place);
|
|
13912
13896
|
if (!place) {
|
|
13913
13897
|
return;
|
|
13914
13898
|
}
|
|
13915
13899
|
let pincode = GetPinCode(place);
|
|
13916
|
-
console.log("Pincode: ", pincode);
|
|
13917
13900
|
if (pincode) {
|
|
13918
13901
|
const {
|
|
13919
13902
|
geometry
|
|
@@ -15833,7 +15816,6 @@ const ADSSearch = ({
|
|
|
15833
15816
|
};
|
|
15834
15817
|
onSelect(config.key, ownerStep, false, index);
|
|
15835
15818
|
}
|
|
15836
|
-
console.log("ownerStep", ownerStep);
|
|
15837
15819
|
};
|
|
15838
15820
|
const ABmenu = [{
|
|
15839
15821
|
i18nKey: "Yes",
|
|
@@ -17062,7 +17044,7 @@ const ADSCitizenDetails = ({
|
|
|
17062
17044
|
addType: slot.addTypeCode,
|
|
17063
17045
|
faceArea: slot.faceAreaCode,
|
|
17064
17046
|
location: slot.locationCode,
|
|
17065
|
-
nightLight: slot.
|
|
17047
|
+
nightLight: slot.light,
|
|
17066
17048
|
bookingDate: slot.bookingDate,
|
|
17067
17049
|
bookingFromTime: "06:00",
|
|
17068
17050
|
bookingToTime: "05:59",
|
|
@@ -18260,27 +18242,8 @@ const ADSAddressField = ({
|
|
|
18260
18242
|
onChange: () => {},
|
|
18261
18243
|
onBlur: onBlur,
|
|
18262
18244
|
disabled: true,
|
|
18263
|
-
placeholder: t
|
|
18264
|
-
}),
|
|
18265
|
-
type: "button",
|
|
18266
|
-
onClick: () => setIsOpen(true),
|
|
18267
|
-
style: {
|
|
18268
|
-
padding: "8px 10px",
|
|
18269
|
-
background: "#0b74de",
|
|
18270
|
-
color: "#fff",
|
|
18271
|
-
border: "none",
|
|
18272
|
-
borderRadius: 6,
|
|
18273
|
-
cursor: "pointer",
|
|
18274
|
-
fontWeight: 700,
|
|
18275
|
-
fontSize: 10
|
|
18276
|
-
}
|
|
18277
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
18278
|
-
style: {
|
|
18279
|
-
display: "inline-block",
|
|
18280
|
-
color: "#fff",
|
|
18281
|
-
textTransform: "none"
|
|
18282
|
-
}
|
|
18283
|
-
}, t && (t("VIEW_LOCATION_ON_MAP") || "View location on map") || "View location on map")))), isOpen && /*#__PURE__*/React.createElement(GIS, {
|
|
18245
|
+
placeholder: t("ADS_LOCATION")
|
|
18246
|
+
})), isOpen && /*#__PURE__*/React.createElement(GIS, {
|
|
18284
18247
|
t: t,
|
|
18285
18248
|
formData: {
|
|
18286
18249
|
address: {
|
|
@@ -18629,10 +18592,8 @@ const ADSDesktopInbox = ({
|
|
|
18629
18592
|
const com = (_Digit$ComponentRegis2 = Digit.ComponentRegistryService) === null || _Digit$ComponentRegis2 === void 0 ? void 0 : _Digit$ComponentRegis2.getComponent(props.EmptyResultInboxComp);
|
|
18630
18593
|
return com;
|
|
18631
18594
|
});
|
|
18632
|
-
console.log("props :>> ", props);
|
|
18633
18595
|
const [clearSearchCalled, setClearSearchCalled] = useState(false);
|
|
18634
18596
|
const columns = React.useMemo(() => props.isSearch ? tableConfig.searchColumns(props) : tableConfig.inboxColumns(props) || [], []);
|
|
18635
|
-
console.log("data is :>> ", data);
|
|
18636
18597
|
let result;
|
|
18637
18598
|
if (props.isLoading) {
|
|
18638
18599
|
result = /*#__PURE__*/React.createElement(Loader$1, null);
|
|
@@ -19004,7 +18965,6 @@ const Inbox = ({
|
|
|
19004
18965
|
}) => {
|
|
19005
18966
|
var _sortParams$, _sortParams$2, _sortParams$3, _sortParams$4, _rest$data;
|
|
19006
18967
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
19007
|
-
console.log("here");
|
|
19008
18968
|
const {
|
|
19009
18969
|
t
|
|
19010
18970
|
} = useTranslation();
|
|
@@ -19248,39 +19208,11 @@ const AdsApplication = ({
|
|
|
19248
19208
|
buttonLabel
|
|
19249
19209
|
}) => {
|
|
19250
19210
|
var _application$applican;
|
|
19251
|
-
console.log("application :>> ", application);
|
|
19252
19211
|
const {
|
|
19253
19212
|
t
|
|
19254
19213
|
} = useTranslation();
|
|
19255
19214
|
const history = useHistory();
|
|
19256
19215
|
const [showToast, setShowToast] = useState(null);
|
|
19257
|
-
const slotSearchData = Digit.Hooks.ads.useADSSlotSearch();
|
|
19258
|
-
let formdata = {
|
|
19259
|
-
advertisementSlotSearchCriteria: application === null || application === void 0 ? void 0 : application.cartDetails.map(item => ({
|
|
19260
|
-
bookingId: application === null || application === void 0 ? void 0 : application.bookingId,
|
|
19261
|
-
addType: item === null || item === void 0 ? void 0 : item.addType,
|
|
19262
|
-
bookingStartDate: item === null || item === void 0 ? void 0 : item.bookingDate,
|
|
19263
|
-
bookingEndDate: item === null || item === void 0 ? void 0 : item.bookingDate,
|
|
19264
|
-
faceArea: item === null || item === void 0 ? void 0 : item.faceArea,
|
|
19265
|
-
tenantId: tenantId,
|
|
19266
|
-
location: item === null || item === void 0 ? void 0 : item.location,
|
|
19267
|
-
nightLight: item === null || item === void 0 ? void 0 : item.nightLight,
|
|
19268
|
-
isTimerRequired: true
|
|
19269
|
-
}))
|
|
19270
|
-
};
|
|
19271
|
-
const getBookingDateRange = bookingSlotDetails => {
|
|
19272
|
-
var _bookingSlotDetails$, _bookingSlotDetails;
|
|
19273
|
-
if (!bookingSlotDetails || bookingSlotDetails.length === 0) {
|
|
19274
|
-
return t("CS_NA");
|
|
19275
|
-
}
|
|
19276
|
-
const startDate = (_bookingSlotDetails$ = bookingSlotDetails[0]) === null || _bookingSlotDetails$ === void 0 ? void 0 : _bookingSlotDetails$.bookingDate;
|
|
19277
|
-
const endDate = (_bookingSlotDetails = bookingSlotDetails[bookingSlotDetails.length - 1]) === null || _bookingSlotDetails === void 0 ? void 0 : _bookingSlotDetails.bookingDate;
|
|
19278
|
-
if (startDate === endDate) {
|
|
19279
|
-
return startDate;
|
|
19280
|
-
} else {
|
|
19281
|
-
return startDate && endDate ? `${startDate} - ${endDate}` : t("CS_NA");
|
|
19282
|
-
}
|
|
19283
|
-
};
|
|
19284
19216
|
const handleMakePayment = () => {
|
|
19285
19217
|
history.push(`/digit-ui/citizen/payment/collect/adv-services/${application === null || application === void 0 ? void 0 : application.bookingNo}/${tenantId}?tenantId=${tenantId}`);
|
|
19286
19218
|
};
|
|
@@ -19292,7 +19224,7 @@ const AdsApplication = ({
|
|
|
19292
19224
|
return () => clearTimeout(timer);
|
|
19293
19225
|
}
|
|
19294
19226
|
}, [showToast]);
|
|
19295
|
-
|
|
19227
|
+
const appDate = new Date(application === null || application === void 0 ? void 0 : application.applicationDate).toLocaleDateString();
|
|
19296
19228
|
return /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(KeyNote, {
|
|
19297
19229
|
keyValue: t("ADS_BOOKING_NO"),
|
|
19298
19230
|
note: application === null || application === void 0 ? void 0 : application.bookingNo
|
|
@@ -19300,8 +19232,8 @@ const AdsApplication = ({
|
|
|
19300
19232
|
keyValue: t("ADS_APPLICANT_NAME"),
|
|
19301
19233
|
note: application === null || application === void 0 ? void 0 : (_application$applican = application.applicantDetail) === null || _application$applican === void 0 ? void 0 : _application$applican.applicantName
|
|
19302
19234
|
}), /*#__PURE__*/React.createElement(KeyNote, {
|
|
19303
|
-
keyValue: t("
|
|
19304
|
-
note:
|
|
19235
|
+
keyValue: t("CS_APPLICATION_DETAILS_APPLICATION_DATE"),
|
|
19236
|
+
note: appDate
|
|
19305
19237
|
}), /*#__PURE__*/React.createElement(KeyNote, {
|
|
19306
19238
|
keyValue: t("PT_COMMON_TABLE_COL_STATUS_LABEL"),
|
|
19307
19239
|
note: t(`${application === null || application === void 0 ? void 0 : application.bookingStatus}`)
|
|
@@ -19363,7 +19295,6 @@ const ADSMyApplications = () => {
|
|
|
19363
19295
|
} = Digit.Hooks.ads.useADSSearch({
|
|
19364
19296
|
filters
|
|
19365
19297
|
});
|
|
19366
|
-
console.log("data being returned:>> ", data);
|
|
19367
19298
|
if (isLoading) return /*#__PURE__*/React.createElement(Loader$1, null);
|
|
19368
19299
|
const applications = (data === null || data === void 0 ? void 0 : data.bookingApplication) || [];
|
|
19369
19300
|
return /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(Header, null, `${t("ADS_MY_BOOKINGS_HEADER")} ${applications ? `(${applications.length})` : ""}`), /*#__PURE__*/React.createElement("div", null, (applications === null || applications === void 0 ? void 0 : applications.length) > 0 && applications.map((application, index) => /*#__PURE__*/React.createElement("div", {
|
|
@@ -20170,21 +20101,17 @@ const ADSApplicationDetails = () => {
|
|
|
20170
20101
|
}
|
|
20171
20102
|
});
|
|
20172
20103
|
const mutation = Digit.Hooks.ads.useADSCreateAPI(tenantId, false);
|
|
20173
|
-
const [billData, setBillData] = useState(null);
|
|
20174
20104
|
const BookingApplication = get_1(adsData, "bookingApplication", []);
|
|
20175
20105
|
const adsId = get_1(adsData, "bookingApplication[0].bookingNo", []);
|
|
20176
|
-
console.log("adsData", adsData);
|
|
20177
20106
|
let ads_details = BookingApplication && BookingApplication.length > 0 && BookingApplication[0] || {};
|
|
20178
20107
|
const application = ads_details;
|
|
20179
20108
|
sessionStorage.setItem("ads", JSON.stringify(application));
|
|
20180
|
-
const [loading, setLoading] = useState(false);
|
|
20181
20109
|
const businessServicMINE = "advandhoarding";
|
|
20182
20110
|
const workflowDetails = Digit.Hooks.useWorkflowDetails({
|
|
20183
20111
|
tenantId,
|
|
20184
20112
|
id: acknowledgementIds,
|
|
20185
20113
|
moduleCode: businessServicMINE
|
|
20186
20114
|
});
|
|
20187
|
-
console.log("workflowDetails :>> ", workflowDetails);
|
|
20188
20115
|
const wfActions = (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data = workflowDetails.data) === null || _workflowDetails$data === void 0 ? void 0 : (_workflowDetails$data2 = _workflowDetails$data.nextActions) === null || _workflowDetails$data2 === void 0 ? void 0 : _workflowDetails$data2.map(a => ({
|
|
20189
20116
|
...a,
|
|
20190
20117
|
action: a === null || a === void 0 ? void 0 : a.action,
|
|
@@ -20235,7 +20162,7 @@ const ADSApplicationDetails = () => {
|
|
|
20235
20162
|
Header: `${t("ADS_NIGHT_LIGHT")}`,
|
|
20236
20163
|
accessor: "nightLight"
|
|
20237
20164
|
}, {
|
|
20238
|
-
Header: `${t("
|
|
20165
|
+
Header: `${t("CHB_BOOKING_DATE")}`,
|
|
20239
20166
|
accessor: "bookingDate"
|
|
20240
20167
|
}, {
|
|
20241
20168
|
Header: `${t("PT_COMMON_TABLE_COL_STATUS_LABEL")}`,
|
|
@@ -20244,7 +20171,7 @@ const ADSApplicationDetails = () => {
|
|
|
20244
20171
|
const adslistRows = (ads_details === null || ads_details === void 0 ? void 0 : (_ads_details$cartDeta = ads_details.cartDetails) === null || _ads_details$cartDeta === void 0 ? void 0 : _ads_details$cartDeta.map(slot => ({
|
|
20245
20172
|
addType: `${t(slot.addType)}`,
|
|
20246
20173
|
faceArea: `${t(slot.faceArea)}`,
|
|
20247
|
-
nightLight: `${t(slot.nightLight
|
|
20174
|
+
nightLight: `${t(slot.nightLight ? "Yes" : "No")}`,
|
|
20248
20175
|
bookingDate: `${t(slot.bookingDate)}`,
|
|
20249
20176
|
bookingStatus: `${t(slot.status)}`
|
|
20250
20177
|
}))) || [];
|
|
@@ -20286,7 +20213,7 @@ const ADSApplicationDetails = () => {
|
|
|
20286
20213
|
}), /*#__PURE__*/React.createElement(Row, {
|
|
20287
20214
|
className: "border-none",
|
|
20288
20215
|
label: t("PTR_ADDRESS"),
|
|
20289
|
-
text: (ads_details === null || ads_details === void 0 ? void 0 : (_ads_details$address = ads_details.address) === null || _ads_details$address === void 0 ? void 0 : _ads_details$address.
|
|
20216
|
+
text: (ads_details === null || ads_details === void 0 ? void 0 : (_ads_details$address = ads_details.address) === null || _ads_details$address === void 0 ? void 0 : _ads_details$address.addressLine1) || t("CS_NA")
|
|
20290
20217
|
}), /*#__PURE__*/React.createElement(Row, {
|
|
20291
20218
|
className: "border-none",
|
|
20292
20219
|
label: t("ADS_ADDRESS_PINCODE"),
|
|
@@ -20462,9 +20389,9 @@ if (_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag || _Ma
|
|
|
20462
20389
|
}
|
|
20463
20390
|
|
|
20464
20391
|
const ApplicationDetails = () => {
|
|
20465
|
-
var _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;
|
|
20466
20393
|
const {
|
|
20467
|
-
|
|
20394
|
+
id
|
|
20468
20395
|
} = useParams();
|
|
20469
20396
|
const {
|
|
20470
20397
|
t
|
|
@@ -20506,7 +20433,7 @@ const ApplicationDetails = () => {
|
|
|
20506
20433
|
if (d !== null && d !== void 0 && (_d$file = d.file) !== null && _d$file !== void 0 && _d$file.fileStoreId) return d.file.fileStoreId;
|
|
20507
20434
|
return null;
|
|
20508
20435
|
}).filter(Boolean);
|
|
20509
|
-
if (!filesArray.length) {
|
|
20436
|
+
if (!(filesArray !== null && filesArray !== void 0 && filesArray.length)) {
|
|
20510
20437
|
setPdfFiles({});
|
|
20511
20438
|
setFilesLoading(false);
|
|
20512
20439
|
return;
|
|
@@ -20537,11 +20464,15 @@ const ApplicationDetails = () => {
|
|
|
20537
20464
|
}, [JSON.stringify(docs)]);
|
|
20538
20465
|
const {
|
|
20539
20466
|
isLoading,
|
|
20540
|
-
data: applicationDetails
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20467
|
+
data: applicationDetails,
|
|
20468
|
+
refetch
|
|
20469
|
+
} = Digit.Hooks.ads.useADSSearch({
|
|
20470
|
+
tenantId,
|
|
20471
|
+
filters: {
|
|
20472
|
+
bookingNo: id
|
|
20473
|
+
}
|
|
20474
|
+
});
|
|
20475
|
+
const normalizedAppObject = (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$b = applicationDetails.bookingApplication) === null || _applicationDetails$b === void 0 ? void 0 : _applicationDetails$b[0]) ?? [];
|
|
20545
20476
|
const bookingObj = normalizedAppObject;
|
|
20546
20477
|
const application = bookingObj || normalizedAppObject || appDetails || null;
|
|
20547
20478
|
const menuRef = useRef();
|
|
@@ -20556,10 +20487,10 @@ const ApplicationDetails = () => {
|
|
|
20556
20487
|
} = Digit.Hooks.useRecieptSearch({
|
|
20557
20488
|
tenantId: tenantId,
|
|
20558
20489
|
businessService: "ADV",
|
|
20559
|
-
consumerCodes: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican = displayData.applicantData) === null || _displayData$applican === void 0 ? void 0 : _displayData$applican.applicationNo) ||
|
|
20490
|
+
consumerCodes: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican = displayData.applicantData) === null || _displayData$applican === void 0 ? void 0 : _displayData$applican.applicationNo) || id,
|
|
20560
20491
|
isEmployee: false
|
|
20561
20492
|
}, {
|
|
20562
|
-
enabled: !!(displayData !== null && displayData !== void 0 && (_displayData$applican2 = displayData.applicantData) !== null && _displayData$applican2 !== void 0 && _displayData$applican2.applicationNo ||
|
|
20493
|
+
enabled: !!(displayData !== null && displayData !== void 0 && (_displayData$applican2 = displayData.applicantData) !== null && _displayData$applican2 !== void 0 && _displayData$applican2.applicationNo || id)
|
|
20563
20494
|
});
|
|
20564
20495
|
const closeMenu = () => {
|
|
20565
20496
|
setDisplayMenu(false);
|
|
@@ -20592,15 +20523,15 @@ const ApplicationDetails = () => {
|
|
|
20592
20523
|
useEffect(() => {
|
|
20593
20524
|
const adsObject = bookingObj;
|
|
20594
20525
|
if (adsObject) {
|
|
20595
|
-
var _adsObject$
|
|
20526
|
+
var _adsObject$applicantD, _adsObject$applicantD2, _adsObject$applicantD3, _adsObject$address, _adsObject$address2, _adsObject$cartDetail;
|
|
20596
20527
|
const applicantData = {
|
|
20597
|
-
address: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$address = adsObject.address) === null || _adsObject$address === void 0 ? void 0 : _adsObject$address.addressId,
|
|
20598
|
-
email: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD = adsObject.applicantDetail) === null || _adsObject$applicantD === void 0 ? void 0 : _adsObject$applicantD.applicantEmailId,
|
|
20599
|
-
mobile: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD2 = adsObject.applicantDetail) === null || _adsObject$applicantD2 === void 0 ? void 0 : _adsObject$applicantD2.applicantMobileNo,
|
|
20600
|
-
name: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD3 = adsObject.applicantDetail) === null || _adsObject$applicantD3 === void 0 ? void 0 : _adsObject$applicantD3.applicantName,
|
|
20601
20528
|
applicationNo: adsObject === null || adsObject === void 0 ? void 0 : adsObject.bookingNo,
|
|
20602
|
-
|
|
20529
|
+
name: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD = adsObject.applicantDetail) === null || _adsObject$applicantD === void 0 ? void 0 : _adsObject$applicantD.applicantName,
|
|
20530
|
+
email: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD2 = adsObject.applicantDetail) === null || _adsObject$applicantD2 === void 0 ? void 0 : _adsObject$applicantD2.applicantEmailId,
|
|
20531
|
+
mobile: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$applicantD3 = adsObject.applicantDetail) === null || _adsObject$applicantD3 === void 0 ? void 0 : _adsObject$applicantD3.applicantMobileNo,
|
|
20532
|
+
address: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$address = adsObject.address) === null || _adsObject$address === void 0 ? void 0 : _adsObject$address.addressLine1,
|
|
20603
20533
|
pincode: adsObject === null || adsObject === void 0 ? void 0 : (_adsObject$address2 = adsObject.address) === null || _adsObject$address2 === void 0 ? void 0 : _adsObject$address2.pincode,
|
|
20534
|
+
bookingStatus: adsObject === null || adsObject === void 0 ? void 0 : adsObject.bookingStatus,
|
|
20604
20535
|
paymentDate: adsObject !== null && adsObject !== void 0 && adsObject.paymentDate ? new Date(adsObject.paymentDate).toLocaleDateString() : "",
|
|
20605
20536
|
receiptNo: adsObject === null || adsObject === void 0 ? void 0 : adsObject.receiptNo
|
|
20606
20537
|
};
|
|
@@ -20641,7 +20572,7 @@ const ApplicationDetails = () => {
|
|
|
20641
20572
|
if (!wfAction) return;
|
|
20642
20573
|
if (wfAction.action === "PAY") {
|
|
20643
20574
|
var _displayData$applican3;
|
|
20644
|
-
const appNo = (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican3 = displayData.applicantData) === null || _displayData$applican3 === void 0 ? void 0 : _displayData$applican3.applicationNo) ||
|
|
20575
|
+
const appNo = (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican3 = displayData.applicantData) === null || _displayData$applican3 === void 0 ? void 0 : _displayData$applican3.applicationNo) || id;
|
|
20645
20576
|
return history.push(`/digit-ui/employee/payment/collect/adv-services/${appNo}/${tenantId}?tenantId=${tenantId}`);
|
|
20646
20577
|
}
|
|
20647
20578
|
if (wfAction.action === "SUBMIT" || wfAction.action === "INITIATE") {
|
|
@@ -20660,8 +20591,8 @@ const ApplicationDetails = () => {
|
|
|
20660
20591
|
setShowModal(true);
|
|
20661
20592
|
}
|
|
20662
20593
|
const submitAction = async dataPayload => {
|
|
20663
|
-
var _applicationDetails$A, _applicationDetails$
|
|
20664
|
-
const payloadSource = (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A = applicationDetails.Applications) === null || _applicationDetails$A === void 0 ? void 0 : _applicationDetails$A[0]) ?? (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$
|
|
20594
|
+
var _applicationDetails$A, _applicationDetails$d, _dataPayload$Licenses, _workflowDetails$data3;
|
|
20595
|
+
const payloadSource = (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A = applicationDetails.Applications) === null || _applicationDetails$A === void 0 ? void 0 : _applicationDetails$A[0]) ?? (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$d = applicationDetails.data) === null || _applicationDetails$d === void 0 ? void 0 : _applicationDetails$d[0]) ?? (applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails[0]) ?? bookingObj;
|
|
20665
20596
|
if (!payloadSource) {
|
|
20666
20597
|
setShowToast({
|
|
20667
20598
|
key: "error",
|
|
@@ -20862,7 +20793,7 @@ const ApplicationDetails = () => {
|
|
|
20862
20793
|
alignItems: "center",
|
|
20863
20794
|
gap: "12px"
|
|
20864
20795
|
}
|
|
20865
|
-
}, downloadOptions && downloadOptions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
20796
|
+
}, downloadOptions && (downloadOptions === null || downloadOptions === void 0 ? void 0 : downloadOptions.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
20866
20797
|
style: {
|
|
20867
20798
|
position: "relative",
|
|
20868
20799
|
zIndex: 10
|
|
@@ -20874,11 +20805,17 @@ const ApplicationDetails = () => {
|
|
|
20874
20805
|
options: downloadOptions,
|
|
20875
20806
|
downloadBtnClassName: "employee-download-btn-className",
|
|
20876
20807
|
optionsClassName: "employee-options-btn-className"
|
|
20877
|
-
}))))), /*#__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) &&
|
|
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]) => {
|
|
20809
|
+
if (value === null || value === undefined) return false;
|
|
20810
|
+
if (typeof value === "string" && value.trim() === "") return false;
|
|
20811
|
+
if (Array.isArray(value) && value.length === 0) return false;
|
|
20812
|
+
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) return false;
|
|
20813
|
+
return true;
|
|
20814
|
+
}).map(([key, value]) => /*#__PURE__*/React.createElement(Row, {
|
|
20878
20815
|
key: key,
|
|
20879
|
-
label: t(
|
|
20816
|
+
label: t(key === null || key === void 0 ? void 0 : key.toUpperCase()),
|
|
20880
20817
|
text: Array.isArray(value) ? value.map(item => typeof item === "object" ? t((item === null || item === void 0 ? void 0 : item.code) || "N/A") : t(item || "N/A")).join(", ") : typeof value === "object" ? t((value === null || value === void 0 ? void 0 : value.code) || "N/A") : t(value || "N/A")
|
|
20881
|
-
}))))
|
|
20818
|
+
})))), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("ADS_APPLICATION_ADS_DETAILS_OVERVIEW")), displayData === null || displayData === void 0 ? void 0 : (_displayData$AdsDetai = displayData.AdsDetails) === null || _displayData$AdsDetai === void 0 ? void 0 : _displayData$AdsDetai.map((detail, index) => /*#__PURE__*/React.createElement("div", {
|
|
20882
20819
|
key: index,
|
|
20883
20820
|
style: {
|
|
20884
20821
|
marginBottom: "30px",
|
|
@@ -20896,18 +20833,15 @@ const ApplicationDetails = () => {
|
|
|
20896
20833
|
label: t("ADS_FACE_AREA"),
|
|
20897
20834
|
text: detail.faceArea || "N/A"
|
|
20898
20835
|
}), /*#__PURE__*/React.createElement(Row, {
|
|
20899
|
-
label: t("
|
|
20836
|
+
label: t("CHB_BOOKING_DATE"),
|
|
20900
20837
|
text: detail.bookingDate || "N/A"
|
|
20901
|
-
}), /*#__PURE__*/React.createElement(Row, {
|
|
20902
|
-
label: t("ADS_BOOKING_TIME"),
|
|
20903
|
-
text: detail.bookingTime || "N/A"
|
|
20904
20838
|
}), /*#__PURE__*/React.createElement(Row, {
|
|
20905
20839
|
label: t("ADS_NIGHT_LIGHT"),
|
|
20906
|
-
text: detail.nightLight
|
|
20840
|
+
text: detail.nightLight ? "Yes" : "No"
|
|
20907
20841
|
}), /*#__PURE__*/React.createElement(Row, {
|
|
20908
20842
|
label: t("ADS_STATUS"),
|
|
20909
20843
|
text: t(detail.status) || detail.status
|
|
20910
|
-
}))))), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("ADS_APPLICATION_DOCUMENTS_OVERVIEW")), /*#__PURE__*/React.createElement(Fragment$1, null, (application === null || application === void 0 ? void 0 : application.documents.length) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
20844
|
+
}))))), /*#__PURE__*/React.createElement(Card$1, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("ADS_APPLICATION_DOCUMENTS_OVERVIEW")), /*#__PURE__*/React.createElement(Fragment$1, null, (application === null || application === void 0 ? void 0 : (_application$document = application.documents) === null || _application$document === void 0 ? void 0 : _application$document.length) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
20911
20845
|
style: {
|
|
20912
20846
|
display: "flex",
|
|
20913
20847
|
flexWrap: "wrap",
|
|
@@ -20925,7 +20859,7 @@ const ApplicationDetails = () => {
|
|
|
20925
20859
|
}
|
|
20926
20860
|
}, t("TL_NO_DOCUMENTS_MSG"))), /*#__PURE__*/React.createElement(ADSWFApplicationTimeline, {
|
|
20927
20861
|
application: application,
|
|
20928
|
-
id: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican4 = displayData.applicantData) === null || _displayData$applican4 === void 0 ? void 0 : _displayData$applican4.applicationNo) ||
|
|
20862
|
+
id: (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican4 = displayData.applicantData) === null || _displayData$applican4 === void 0 ? void 0 : _displayData$applican4.applicationNo) || id,
|
|
20929
20863
|
userType: "employee"
|
|
20930
20864
|
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
20931
20865
|
error: showToast.key === "error",
|
|
@@ -20936,7 +20870,7 @@ const ApplicationDetails = () => {
|
|
|
20936
20870
|
onClose: () => {
|
|
20937
20871
|
setShowToast(null);
|
|
20938
20872
|
}
|
|
20939
|
-
})), !(workflowDetails !== null && workflowDetails !== void 0 && workflowDetails.isLoading) && Array.isArray(wfActions) && wfActions.length > 0 && /*#__PURE__*/React.createElement(ActionBar, null, displayMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
20873
|
+
})), !(workflowDetails !== null && workflowDetails !== void 0 && workflowDetails.isLoading) && Array.isArray(wfActions) && (wfActions === null || wfActions === void 0 ? void 0 : wfActions.length) > 0 && /*#__PURE__*/React.createElement(ActionBar, null, displayMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
20940
20874
|
localeKeyPrefix: `WF_EMPLOYEE_${"ADS"}`,
|
|
20941
20875
|
options: wfActions,
|
|
20942
20876
|
optionKey: "buttonLabel",
|
|
@@ -20954,7 +20888,7 @@ const ApplicationDetails = () => {
|
|
|
20954
20888
|
action: selectedAction,
|
|
20955
20889
|
tenantId: tenantId,
|
|
20956
20890
|
state: state,
|
|
20957
|
-
bookingNo:
|
|
20891
|
+
bookingNo: id,
|
|
20958
20892
|
applicationDetails: applicationDetails,
|
|
20959
20893
|
applicationData: applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData,
|
|
20960
20894
|
closeModal: closeModal,
|
|
@@ -21321,6 +21255,48 @@ const RESET_ADS_NEW_APPLICATION_FORM = () => ({
|
|
|
21321
21255
|
type: RESET_ADS_NEW_APPLICATION_FORMType
|
|
21322
21256
|
});
|
|
21323
21257
|
|
|
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
|
+
|
|
21324
21300
|
const isEmployee = window.location.href.includes("employee");
|
|
21325
21301
|
const createEmployeeConfig = [{
|
|
21326
21302
|
head: "PET DETAILS",
|
|
@@ -21329,14 +21305,14 @@ const createEmployeeConfig = [{
|
|
|
21329
21305
|
isStepEnabled: true,
|
|
21330
21306
|
type: "component",
|
|
21331
21307
|
component: "NewADSStepFormTwo",
|
|
21332
|
-
key: "
|
|
21308
|
+
key: "ads",
|
|
21333
21309
|
withoutLabel: true,
|
|
21334
21310
|
texts: {
|
|
21335
21311
|
submitBarLabel: "CS_COMMON_NEXT"
|
|
21336
21312
|
}
|
|
21337
21313
|
}, {
|
|
21338
21314
|
head: "OWNER DETAILS",
|
|
21339
|
-
stepLabel: "
|
|
21315
|
+
stepLabel: "ES_APPLICANT_DETAILA",
|
|
21340
21316
|
stepNumber: 2,
|
|
21341
21317
|
isStepEnabled: true,
|
|
21342
21318
|
type: "component",
|
|
@@ -21378,7 +21354,7 @@ const createCitizenConfig = [{
|
|
|
21378
21354
|
isStepEnabled: true,
|
|
21379
21355
|
type: "component",
|
|
21380
21356
|
component: "NewADSStepFormTwo",
|
|
21381
|
-
key: "
|
|
21357
|
+
key: "ads",
|
|
21382
21358
|
withoutLabel: true,
|
|
21383
21359
|
texts: {
|
|
21384
21360
|
submitBarLabel: "CS_COMMON_NEXT"
|
|
@@ -21445,19 +21421,19 @@ const NewADSStepperForm = ({
|
|
|
21445
21421
|
useEffect(() => {
|
|
21446
21422
|
dispatch(RESET_ADS_NEW_APPLICATION_FORM());
|
|
21447
21423
|
}, []);
|
|
21448
|
-
const handleSubmit = dataGet => {
|
|
21449
|
-
console.log("dataGet===", dataGet);
|
|
21450
|
-
};
|
|
21424
|
+
const handleSubmit = dataGet => {};
|
|
21451
21425
|
return /*#__PURE__*/React.createElement("div", {
|
|
21452
21426
|
className: "pageCard"
|
|
21453
21427
|
}, /*#__PURE__*/React.createElement(CardHeader$1, {
|
|
21454
21428
|
styles: {
|
|
21455
21429
|
fontSize: "28px",
|
|
21456
|
-
fontWeight: "
|
|
21430
|
+
fontWeight: "500",
|
|
21457
21431
|
color: "#1C1D1F"
|
|
21458
21432
|
},
|
|
21459
21433
|
divider: true
|
|
21460
|
-
}, t("ADS_REGISTRATION_APPLICATION")
|
|
21434
|
+
}, t("ADS_REGISTRATION_APPLICATION"), /*#__PURE__*/React.createElement(ReservationTimer, {
|
|
21435
|
+
t: t
|
|
21436
|
+
})), /*#__PURE__*/React.createElement(Stepper, {
|
|
21461
21437
|
stepsList: updatedConfig,
|
|
21462
21438
|
onSubmit: handleSubmit,
|
|
21463
21439
|
step: step,
|
|
@@ -21481,16 +21457,17 @@ const ADSCitizenDetailsNew = ({
|
|
|
21481
21457
|
onChange: _onChange = () => {}
|
|
21482
21458
|
}) => {
|
|
21483
21459
|
var _window$location, _window$location$path, _errors$address, _errors$pincode;
|
|
21460
|
+
const dispatch = useDispatch();
|
|
21484
21461
|
const isEmployee = typeof window !== "undefined" && ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : (_window$location$path = _window$location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.includes("/employee"));
|
|
21485
21462
|
const formStorageKey = `ads_form_${isEmployee ? "employee" : "citizen"}`;
|
|
21486
|
-
const dispatch = useDispatch();
|
|
21487
21463
|
const userInfo = Digit.UserService.getUser();
|
|
21464
|
+
const isCitizen = window.location.href.includes("citizen");
|
|
21465
|
+
const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
|
|
21488
21466
|
const {
|
|
21489
21467
|
mobileNumber,
|
|
21490
21468
|
emailId,
|
|
21491
21469
|
name
|
|
21492
21470
|
} = userInfo === null || userInfo === void 0 ? void 0 : userInfo.info;
|
|
21493
|
-
const isCitizen = window.location.href.includes("citizen");
|
|
21494
21471
|
const [firstName, lastName] = [(name || "").trim().split(" ").slice(0, -1).join(" "), (name || "").trim().split(" ").slice(-1).join(" ")];
|
|
21495
21472
|
const [showToast, setShowToast] = useState(null);
|
|
21496
21473
|
const {
|
|
@@ -21498,7 +21475,6 @@ const ADSCitizenDetailsNew = ({
|
|
|
21498
21475
|
handleSubmit,
|
|
21499
21476
|
setValue,
|
|
21500
21477
|
reset,
|
|
21501
|
-
getValues,
|
|
21502
21478
|
formState: {
|
|
21503
21479
|
errors
|
|
21504
21480
|
},
|
|
@@ -21515,19 +21491,23 @@ const ADSCitizenDetailsNew = ({
|
|
|
21515
21491
|
}
|
|
21516
21492
|
});
|
|
21517
21493
|
if (typeof window !== "undefined") window.__ADS_FORM_DRAFT = window.__ADS_FORM_DRAFT || {};
|
|
21494
|
+
console.log('currentStepData', currentStepData);
|
|
21518
21495
|
useEffect(() => {
|
|
21519
|
-
|
|
21520
|
-
|
|
21521
|
-
|
|
21522
|
-
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21526
|
-
|
|
21527
|
-
|
|
21528
|
-
|
|
21496
|
+
if (currentStepData !== null && currentStepData !== void 0 && currentStepData.CreatedResponse) {
|
|
21497
|
+
const created = currentStepData.CreatedResponse;
|
|
21498
|
+
if (created !== null && created !== void 0 && created.address) {
|
|
21499
|
+
setValue("address", created.address.addressLine1 || "");
|
|
21500
|
+
setValue("pincode", created.address.pincode || "");
|
|
21501
|
+
}
|
|
21502
|
+
if (created !== null && created !== void 0 && created.applicantDetail) {
|
|
21503
|
+
var _created$applicantDet, _created$applicantDet2;
|
|
21504
|
+
setValue("firstName", ((_created$applicantDet = created.applicantDetail.applicantName) === null || _created$applicantDet === void 0 ? void 0 : _created$applicantDet.split(" ")[0]) || "");
|
|
21505
|
+
setValue("lastName", ((_created$applicantDet2 = created.applicantDetail.applicantName) === null || _created$applicantDet2 === void 0 ? void 0 : _created$applicantDet2.split(" ")[1]) || "");
|
|
21506
|
+
setValue("emailId", created.applicantDetail.applicantEmailId || "");
|
|
21507
|
+
setValue("mobileNumber", created.applicantDetail.applicantMobileNo || "");
|
|
21508
|
+
}
|
|
21529
21509
|
}
|
|
21530
|
-
}, [currentStepData, setValue
|
|
21510
|
+
}, [currentStepData, setValue]);
|
|
21531
21511
|
useEffect(() => {
|
|
21532
21512
|
try {
|
|
21533
21513
|
var _window$__ADS_FORM_DR;
|
|
@@ -21542,17 +21522,16 @@ const ADSCitizenDetailsNew = ({
|
|
|
21542
21522
|
}
|
|
21543
21523
|
}, []);
|
|
21544
21524
|
const onSubmit = async data => {
|
|
21545
|
-
var _currentStepData$
|
|
21525
|
+
var _currentStepData$ads, _currentStepData$Crea;
|
|
21546
21526
|
try {
|
|
21547
21527
|
if (window.__ADS_FORM_DRAFT) delete window.__ADS_FORM_DRAFT[formStorageKey];
|
|
21548
21528
|
} catch (e) {}
|
|
21549
|
-
const cartDetailsFromState = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$pets = currentStepData.pets) === null || _currentStepData$pets === void 0 ? void 0 : _currentStepData$pets.cartDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.cartDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$site = currentStepData.siteDetails) === null || _currentStepData$site === void 0 ? void 0 : _currentStepData$site.cartDetails) || (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.siteDetails) || [];
|
|
21550
|
-
const bookingFromTimeFromState = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$pets2 = currentStepData.pets) === null || _currentStepData$pets2 === void 0 ? void 0 : _currentStepData$pets2.bookingFromTime) ?? (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.bookingFromTime) ?? "";
|
|
21551
|
-
const bookingToTimeFromState = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$pets3 = currentStepData.pets) === null || _currentStepData$pets3 === void 0 ? void 0 : _currentStepData$pets3.bookingToTime) ?? (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.bookingToTime) ?? "";
|
|
21552
|
-
const cartAddressFromState = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$pets4 = currentStepData.pets) === null || _currentStepData$pets4 === void 0 ? void 0 : _currentStepData$pets4.cartAddress) ?? (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.cartAddress) ?? "";
|
|
21553
|
-
const isCitizen = typeof window !== "undefined" && ((_window$location2 = window.location) === null || _window$location2 === void 0 ? void 0 : (_window$location2$hre = _window$location2.href) === null || _window$location2$hre === void 0 ? void 0 : _window$location2$hre.includes("citizen"));
|
|
21554
|
-
const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
|
|
21555
21529
|
const applicationDate = Date.now();
|
|
21530
|
+
const cartDetails = currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$ads = currentStepData.ads) === null || _currentStepData$ads === void 0 ? void 0 : _currentStepData$ads.flatMap(item => item.slots.map(slot => ({
|
|
21531
|
+
...slot,
|
|
21532
|
+
advertisementId: item.ad.id,
|
|
21533
|
+
status: "BOOKED"
|
|
21534
|
+
})));
|
|
21556
21535
|
const formData = {
|
|
21557
21536
|
tenantId,
|
|
21558
21537
|
applicationDate,
|
|
@@ -21560,7 +21539,7 @@ const ADSCitizenDetailsNew = ({
|
|
|
21560
21539
|
businessService: "ADV",
|
|
21561
21540
|
address: {
|
|
21562
21541
|
pincode: data.pincode || "",
|
|
21563
|
-
|
|
21542
|
+
addressLine1: data.address || ""
|
|
21564
21543
|
},
|
|
21565
21544
|
applicantDetail: {
|
|
21566
21545
|
applicantName: `${data.firstName || ""} ${data.lastName || ""}`.trim(),
|
|
@@ -21569,16 +21548,12 @@ const ADSCitizenDetailsNew = ({
|
|
|
21569
21548
|
applicantDetailId: ""
|
|
21570
21549
|
},
|
|
21571
21550
|
owners: [{
|
|
21572
|
-
name: `${firstName} ${lastName}
|
|
21551
|
+
name: `${data.firstName || ""} ${data.lastName || ""}`.trim(),
|
|
21573
21552
|
mobileNumber: data.mobileNumber || "",
|
|
21574
21553
|
tenantId,
|
|
21575
21554
|
type: "CITIZEN"
|
|
21576
21555
|
}],
|
|
21577
|
-
|
|
21578
|
-
cartDetails: Array.isArray(cartDetailsFromState) ? cartDetailsFromState : [],
|
|
21579
|
-
bookingFromTime: bookingFromTimeFromState,
|
|
21580
|
-
bookingToTime: bookingToTimeFromState,
|
|
21581
|
-
cartAddress: cartAddressFromState,
|
|
21556
|
+
cartDetails,
|
|
21582
21557
|
documents: [],
|
|
21583
21558
|
workflow: {
|
|
21584
21559
|
action: "INITIATE",
|
|
@@ -21587,6 +21562,11 @@ const ADSCitizenDetailsNew = ({
|
|
|
21587
21562
|
nextState: ""
|
|
21588
21563
|
}
|
|
21589
21564
|
};
|
|
21565
|
+
const existingBookingNo = currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$Crea = currentStepData.CreatedResponse) === null || _currentStepData$Crea === void 0 ? void 0 : _currentStepData$Crea.bookingNo;
|
|
21566
|
+
if (existingBookingNo) {
|
|
21567
|
+
goNext(formData);
|
|
21568
|
+
return;
|
|
21569
|
+
}
|
|
21590
21570
|
try {
|
|
21591
21571
|
var _response$ResponseInf;
|
|
21592
21572
|
const payload = {
|
|
@@ -21600,55 +21580,39 @@ const ADSCitizenDetailsNew = ({
|
|
|
21600
21580
|
dispatch(UPDATE_ADSNewApplication_FORM("CreatedResponse", appData || response));
|
|
21601
21581
|
goNext(formData);
|
|
21602
21582
|
} else {
|
|
21603
|
-
console.error("ADS create failed (ADSCitizenDetailsNew) - saving draft", response);
|
|
21604
21583
|
dispatch(UPDATE_ADSNewApplication_FORM("CreatedResponse", {
|
|
21605
21584
|
draft: true,
|
|
21606
21585
|
bookingApplication: formData
|
|
21607
21586
|
}));
|
|
21608
21587
|
setShowToast({
|
|
21609
21588
|
key: true,
|
|
21610
|
-
label: "
|
|
21589
|
+
label: t("CORE_SOMETHING_WENT_WRONG")
|
|
21611
21590
|
});
|
|
21612
21591
|
}
|
|
21613
21592
|
} catch (err) {
|
|
21614
|
-
dispatch(UPDATE_ADSNewApplication_FORM("CreatedResponse", {
|
|
21615
|
-
draft: true,
|
|
21616
|
-
bookingApplication: formData
|
|
21617
|
-
}));
|
|
21618
21593
|
setShowToast({
|
|
21619
21594
|
key: true,
|
|
21620
|
-
label: "
|
|
21595
|
+
label: t("CORE_SOMETHING_WENT_WRONG")
|
|
21621
21596
|
});
|
|
21622
21597
|
}
|
|
21623
21598
|
};
|
|
21624
|
-
const watchedAll = useWatch({
|
|
21625
|
-
control
|
|
21626
|
-
});
|
|
21627
21599
|
useEffect(() => {
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
|
|
21631
|
-
|
|
21632
|
-
|
|
21633
|
-
} else {
|
|
21634
|
-
console.warn("[ADS] draft too large, skipping in-memory persist");
|
|
21635
|
-
}
|
|
21636
|
-
} catch (e) {
|
|
21637
|
-
console.warn("[ADS] failed to persist form to in-memory", e);
|
|
21638
|
-
}
|
|
21639
|
-
}, 250);
|
|
21640
|
-
return () => clearTimeout(id);
|
|
21641
|
-
}, [watchedAll, formStorageKey]);
|
|
21600
|
+
if (showToast) {
|
|
21601
|
+
const timer = setTimeout(() => setShowToast(null), 2000);
|
|
21602
|
+
return () => clearTimeout(timer);
|
|
21603
|
+
}
|
|
21604
|
+
}, [showToast]);
|
|
21642
21605
|
const errorStyle = {
|
|
21643
21606
|
marginTop: "-18px",
|
|
21644
21607
|
color: "red"
|
|
21645
21608
|
};
|
|
21609
|
+
const mandatoryStyle = {
|
|
21610
|
+
color: "red"
|
|
21611
|
+
};
|
|
21646
21612
|
return /*#__PURE__*/React.createElement("form", {
|
|
21647
21613
|
onSubmit: handleSubmit(onSubmit)
|
|
21648
21614
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("NDC_FIRST_NAME"), /*#__PURE__*/React.createElement("span", {
|
|
21649
|
-
style:
|
|
21650
|
-
color: "red"
|
|
21651
|
-
}
|
|
21615
|
+
style: mandatoryStyle
|
|
21652
21616
|
}, "*"), " "), /*#__PURE__*/React.createElement(Controller, {
|
|
21653
21617
|
control: control,
|
|
21654
21618
|
name: "firstName",
|
|
@@ -21680,9 +21644,7 @@ const ADSCitizenDetailsNew = ({
|
|
|
21680
21644
|
}), errors.firstName && /*#__PURE__*/React.createElement(CardLabelError$1, {
|
|
21681
21645
|
style: errorStyle
|
|
21682
21646
|
}, errors.firstName.message), /*#__PURE__*/React.createElement(CardLabel, null, t("NDC_LAST_NAME"), /*#__PURE__*/React.createElement("span", {
|
|
21683
|
-
style:
|
|
21684
|
-
color: "red"
|
|
21685
|
-
}
|
|
21647
|
+
style: mandatoryStyle
|
|
21686
21648
|
}, "*")), /*#__PURE__*/React.createElement(Controller, {
|
|
21687
21649
|
control: control,
|
|
21688
21650
|
name: "lastName",
|
|
@@ -21714,9 +21676,7 @@ const ADSCitizenDetailsNew = ({
|
|
|
21714
21676
|
}), errors.lastName && /*#__PURE__*/React.createElement(CardLabelError$1, {
|
|
21715
21677
|
style: errorStyle
|
|
21716
21678
|
}, errors.lastName.message), /*#__PURE__*/React.createElement(CardLabel, null, t("NOC_APPLICANT_EMAIL_LABEL"), /*#__PURE__*/React.createElement("span", {
|
|
21717
|
-
style:
|
|
21718
|
-
color: "red"
|
|
21719
|
-
}
|
|
21679
|
+
style: mandatoryStyle
|
|
21720
21680
|
}, "*")), /*#__PURE__*/React.createElement(Controller, {
|
|
21721
21681
|
control: control,
|
|
21722
21682
|
name: "emailId",
|
|
@@ -21740,9 +21700,7 @@ const ADSCitizenDetailsNew = ({
|
|
|
21740
21700
|
}), errors.emailId && /*#__PURE__*/React.createElement(CardLabelError$1, {
|
|
21741
21701
|
style: errorStyle
|
|
21742
21702
|
}, errors.emailId.message), /*#__PURE__*/React.createElement(CardLabel, null, t("NOC_APPLICANT_MOBILE_NO_LABEL"), /*#__PURE__*/React.createElement("span", {
|
|
21743
|
-
style:
|
|
21744
|
-
color: "red"
|
|
21745
|
-
}
|
|
21703
|
+
style: mandatoryStyle
|
|
21746
21704
|
}, "*")), /*#__PURE__*/React.createElement(Controller, {
|
|
21747
21705
|
control: control,
|
|
21748
21706
|
name: "mobileNumber",
|
|
@@ -21771,7 +21729,9 @@ const ADSCitizenDetailsNew = ({
|
|
|
21771
21729
|
style: errorStyle
|
|
21772
21730
|
}, errors.mobileNumber.message), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
21773
21731
|
className: "card-label-smaller"
|
|
21774
|
-
}, `${t("PT_COMMON_COL_ADDRESS")}`,
|
|
21732
|
+
}, `${t("PT_COMMON_COL_ADDRESS")}`, /*#__PURE__*/React.createElement("span", {
|
|
21733
|
+
style: mandatoryStyle
|
|
21734
|
+
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
21775
21735
|
className: "field"
|
|
21776
21736
|
}, /*#__PURE__*/React.createElement(Controller, {
|
|
21777
21737
|
control: control,
|
|
@@ -21808,7 +21768,9 @@ const ADSCitizenDetailsNew = ({
|
|
|
21808
21768
|
style: errorStyle
|
|
21809
21769
|
}, errors === null || errors === void 0 ? void 0 : (_errors$address = errors.address) === null || _errors$address === void 0 ? void 0 : _errors$address.message), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
|
|
21810
21770
|
className: "card-label-smaller"
|
|
21811
|
-
}, `${t("CORE_COMMON_PINCODE")}`,
|
|
21771
|
+
}, `${t("CORE_COMMON_PINCODE")}`, /*#__PURE__*/React.createElement("span", {
|
|
21772
|
+
style: mandatoryStyle
|
|
21773
|
+
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
21812
21774
|
className: "field"
|
|
21813
21775
|
}, /*#__PURE__*/React.createElement(Controller, {
|
|
21814
21776
|
control: control,
|
|
@@ -21882,8 +21844,6 @@ const NewADSStepFormOne = ({
|
|
|
21882
21844
|
});
|
|
21883
21845
|
function goNext(data) {
|
|
21884
21846
|
dispatch(UPDATE_ADSNewApplication_FORM(config.key, data));
|
|
21885
|
-
console.log("conifg keyeeee", config.key);
|
|
21886
|
-
console.log("dataaaaa", data);
|
|
21887
21847
|
onGoNext();
|
|
21888
21848
|
}
|
|
21889
21849
|
function onGoBack(data) {
|
|
@@ -21906,1674 +21866,1025 @@ const NewADSStepFormOne = ({
|
|
|
21906
21866
|
}), " ");
|
|
21907
21867
|
};
|
|
21908
21868
|
|
|
21909
|
-
const
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21869
|
+
const AvailabilityModal = ({
|
|
21870
|
+
ad,
|
|
21871
|
+
tenantId,
|
|
21872
|
+
onClose,
|
|
21873
|
+
onSelectSlot,
|
|
21874
|
+
dateRange,
|
|
21875
|
+
t,
|
|
21876
|
+
cartSlots
|
|
21914
21877
|
}) => {
|
|
21915
|
-
var
|
|
21916
|
-
const
|
|
21917
|
-
const {
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21878
|
+
var _cartSlots$find;
|
|
21879
|
+
const [selectedSlots, setSelectedSlots] = useState([]);
|
|
21880
|
+
const slotPayload = useMemo(() => ({
|
|
21881
|
+
advertisementSlotSearchCriteria: [{
|
|
21882
|
+
advertisementId: ad === null || ad === void 0 ? void 0 : ad.id,
|
|
21883
|
+
bookingId: "",
|
|
21884
|
+
addType: ad.adType,
|
|
21885
|
+
bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
|
|
21886
|
+
bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
|
|
21887
|
+
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
|
+
tenantId,
|
|
21889
|
+
location: ad.locationCode,
|
|
21890
|
+
nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light" ? "true" : "false",
|
|
21891
|
+
isTimerRequired: false
|
|
21892
|
+
}]
|
|
21893
|
+
}), [ad, tenantId, dateRange]);
|
|
21921
21894
|
const {
|
|
21922
|
-
data:
|
|
21923
|
-
isLoading
|
|
21924
|
-
} = Digit.Hooks.ads.
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
const
|
|
21930
|
-
const
|
|
21931
|
-
const
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
const [globalScheduleEnabled, setGlobalScheduleEnabled] = useState(false);
|
|
21940
|
-
const adsScheduleBackupRef = useRef(null);
|
|
21941
|
-
const skipPersistRef = useRef(false);
|
|
21942
|
-
const normalizeLocationToGeo = loc => {
|
|
21943
|
-
if (!loc || !loc.geo_tag || !loc.geo_tag.latitude || !loc.geo_tag.longitude) return null;
|
|
21944
|
-
return {
|
|
21945
|
-
formattedAddress: loc.name || loc.label || "",
|
|
21946
|
-
latitude: loc.geo_tag.latitude,
|
|
21947
|
-
longitude: loc.geo_tag.longitude,
|
|
21948
|
-
lat: loc.geo_tag.latitude,
|
|
21949
|
-
lng: loc.geo_tag.longitude,
|
|
21950
|
-
placeId: loc.locationCode || loc.code || "",
|
|
21951
|
-
raw: loc
|
|
21952
|
-
};
|
|
21953
|
-
};
|
|
21954
|
-
const formatDisplay = dt => {
|
|
21955
|
-
if (!dt) return "";
|
|
21956
|
-
const [datePart, timePart] = String(dt).split("T");
|
|
21957
|
-
if (!datePart) return "";
|
|
21958
|
-
const [y, m, d] = datePart.split("-");
|
|
21959
|
-
return `${m}/${d}/${y}${timePart ? " " + timePart : ""}`;
|
|
21960
|
-
};
|
|
21961
|
-
const validateScheduleForAdd = (startDt, endDt) => {
|
|
21962
|
-
if (!startDt || !endDt) return "Please choose both start and end date/time.";
|
|
21963
|
-
const [sDate, sTime = ""] = startDt.split("T");
|
|
21964
|
-
const [eDate, eTime = ""] = endDt.split("T");
|
|
21965
|
-
if (sDate < tomorrowStr || eDate < tomorrowStr) return `Dates must be ${tomorrowStr} (tomorrow) or later.`;
|
|
21966
|
-
if (sDate === eDate && eTime <= sTime) return "End time must be later than start time when same day.";
|
|
21967
|
-
return null;
|
|
21968
|
-
};
|
|
21969
|
-
const showMore = () => setVisibleCount(v => v + 6);
|
|
21970
|
-
useEffect(() => setVisibleCount(6), [adsForLocation]);
|
|
21971
|
-
const locationOptions = Array.from(new Map(mdmsAds.filter(a => a.locationCode).map(a => [a.locationCode, {
|
|
21972
|
-
code: a.locationCode,
|
|
21973
|
-
label: a.locationCode
|
|
21974
|
-
}])).values());
|
|
21975
|
-
const now = new Date();
|
|
21976
|
-
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
|
|
21977
|
-
const nowHM = now.toISOString().slice(11, 16);
|
|
21978
|
-
const isCitizen = window.location.href.includes("citizen");
|
|
21979
|
-
const [siteIdKey, setSiteIdKey] = useState(0);
|
|
21980
|
-
const PERSIST_KEY_PREFIX = "ADS:site:";
|
|
21981
|
-
const saveForSite = (siteId, payload) => {
|
|
21982
|
-
if (!siteId) return;
|
|
21983
|
-
try {
|
|
21984
|
-
localStorage.setItem(`${PERSIST_KEY_PREFIX}${siteId}`, JSON.stringify({
|
|
21985
|
-
...payload,
|
|
21986
|
-
savedAt: Date.now()
|
|
21987
|
-
}));
|
|
21988
|
-
} catch (e) {
|
|
21989
|
-
console.warn("ADS persistence failed", e);
|
|
21895
|
+
data: slotResults = {},
|
|
21896
|
+
isLoading
|
|
21897
|
+
} = Digit.Hooks.ads.useADSSlotSearch({
|
|
21898
|
+
tenantId,
|
|
21899
|
+
type: true,
|
|
21900
|
+
data: slotPayload
|
|
21901
|
+
});
|
|
21902
|
+
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) => {
|
|
21905
|
+
if (checked) {
|
|
21906
|
+
setSelectedSlots(prev => [...prev.filter(s => s.bookingDate !== slot.bookingDate), slot]);
|
|
21907
|
+
} else {
|
|
21908
|
+
setSelectedSlots(prev => [...prev.filter(s => s.bookingDate !== slot.bookingDate), {
|
|
21909
|
+
...slot,
|
|
21910
|
+
_remove: true
|
|
21911
|
+
}]);
|
|
21990
21912
|
}
|
|
21991
21913
|
};
|
|
21992
|
-
const
|
|
21993
|
-
if (
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
|
|
21997
|
-
|
|
21998
|
-
|
|
21999
|
-
|
|
21914
|
+
const handleAddToCart = () => {
|
|
21915
|
+
if (selectedSlots.length > 0) {
|
|
21916
|
+
onSelectSlot(selectedSlots, {
|
|
21917
|
+
...ad,
|
|
21918
|
+
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}`,
|
|
21919
|
+
location: ad === null || ad === void 0 ? void 0 : ad.name,
|
|
21920
|
+
addType: ad === null || ad === void 0 ? void 0 : ad.adType,
|
|
21921
|
+
bookingDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
|
|
21922
|
+
nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light" ? true : false,
|
|
21923
|
+
bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
|
|
21924
|
+
bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
|
|
21925
|
+
});
|
|
21926
|
+
setSelectedSlots([]);
|
|
21927
|
+
onClose();
|
|
22000
21928
|
}
|
|
22001
21929
|
};
|
|
22002
|
-
const
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22010
|
-
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
21930
|
+
const columns = [{
|
|
21931
|
+
Header: t("ADS_SELECT"),
|
|
21932
|
+
accessor: "select",
|
|
21933
|
+
Cell: ({
|
|
21934
|
+
row
|
|
21935
|
+
}) => {
|
|
21936
|
+
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);
|
|
21939
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
21940
|
+
type: "checkbox",
|
|
21941
|
+
checked: isChecked,
|
|
21942
|
+
disabled: slot.slotStaus !== "AVAILABLE",
|
|
21943
|
+
onChange: e => handleCheckboxChange(slot, e.target.checked),
|
|
21944
|
+
style: {
|
|
21945
|
+
cursor: slot.slotStaus === "AVAILABLE" ? "pointer" : "not-allowed",
|
|
21946
|
+
width: "18px",
|
|
21947
|
+
height: "18px",
|
|
21948
|
+
accentColor: "#0b74de"
|
|
21949
|
+
}
|
|
22016
21950
|
});
|
|
22017
|
-
return true;
|
|
22018
21951
|
}
|
|
22019
|
-
|
|
22020
|
-
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
21952
|
+
}, {
|
|
21953
|
+
Header: t("ADS_DATE"),
|
|
21954
|
+
accessor: "bookingDate"
|
|
21955
|
+
}, {
|
|
21956
|
+
Header: t("ADS_LOCATION"),
|
|
21957
|
+
accessor: "location"
|
|
21958
|
+
}, {
|
|
21959
|
+
Header: t("ADS_FACE_AREA"),
|
|
21960
|
+
accessor: "faceArea"
|
|
21961
|
+
}, {
|
|
21962
|
+
Header: t("ADS_TYPE"),
|
|
21963
|
+
accessor: "addType"
|
|
21964
|
+
}, {
|
|
21965
|
+
Header: t("ADS_NIGHT_LIGHT"),
|
|
21966
|
+
accessor: row => row.nightLight ? t("ADS_YES") : t("ADS_NO")
|
|
21967
|
+
}, {
|
|
21968
|
+
Header: t("ADS_STATUS"),
|
|
21969
|
+
accessor: "slotStaus",
|
|
21970
|
+
Cell: ({
|
|
21971
|
+
row
|
|
21972
|
+
}) => {
|
|
21973
|
+
const status = row.original.slotStaus;
|
|
21974
|
+
const isAvailable = status === "AVAILABLE";
|
|
21975
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
21976
|
+
style: {
|
|
21977
|
+
display: "inline-block",
|
|
21978
|
+
padding: "5px 14px",
|
|
21979
|
+
borderRadius: "20px",
|
|
21980
|
+
fontSize: "12px",
|
|
21981
|
+
fontWeight: 600,
|
|
21982
|
+
color: isAvailable ? "#155724" : "#721c24",
|
|
21983
|
+
backgroundColor: isAvailable ? "#d4edda" : "#f8d7da",
|
|
21984
|
+
border: `1px solid ${isAvailable ? "#c3e6cb" : "#f5c6cb"}`,
|
|
21985
|
+
textTransform: "capitalize"
|
|
21986
|
+
}
|
|
21987
|
+
}, status);
|
|
22025
21988
|
}
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22033
|
-
|
|
21989
|
+
}];
|
|
21990
|
+
const allBooked = slots.length > 0 && slots.every(s => s.slotStaus !== "AVAILABLE");
|
|
21991
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21992
|
+
style: {
|
|
21993
|
+
position: "fixed",
|
|
21994
|
+
top: "70px",
|
|
21995
|
+
left: 0,
|
|
21996
|
+
width: "100vw",
|
|
21997
|
+
height: "calc(100vh - 70px)",
|
|
21998
|
+
background: "rgba(0,0,0,0.5)",
|
|
21999
|
+
display: "flex",
|
|
22000
|
+
justifyContent: "center",
|
|
22001
|
+
alignItems: "center",
|
|
22002
|
+
zIndex: 2000
|
|
22034
22003
|
}
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
|
|
22044
|
-
|
|
22045
|
-
|
|
22046
|
-
const out = [];
|
|
22047
|
-
try {
|
|
22048
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
22049
|
-
const key = localStorage.key(i);
|
|
22050
|
-
if (!key || !key.startsWith(PERSIST_KEY_PREFIX)) continue;
|
|
22051
|
-
const siteId = key.slice(PERSIST_KEY_PREFIX.length);
|
|
22052
|
-
const raw = localStorage.getItem(key);
|
|
22053
|
-
if (!raw) continue;
|
|
22054
|
-
try {
|
|
22055
|
-
const parsed = JSON.parse(raw);
|
|
22056
|
-
out.push({
|
|
22057
|
-
siteId,
|
|
22058
|
-
...parsed
|
|
22059
|
-
});
|
|
22060
|
-
} catch (e) {
|
|
22061
|
-
console.warn("ADS: parse saved site failed for", key, e);
|
|
22062
|
-
}
|
|
22063
|
-
}
|
|
22064
|
-
} catch (e) {
|
|
22065
|
-
console.warn("ADS: loadAllSavedSites failed", e);
|
|
22004
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22005
|
+
style: {
|
|
22006
|
+
width: "90%",
|
|
22007
|
+
maxWidth: "1100px",
|
|
22008
|
+
height: "70vh",
|
|
22009
|
+
background: "#fff",
|
|
22010
|
+
borderRadius: "12px",
|
|
22011
|
+
padding: "20px",
|
|
22012
|
+
display: "flex",
|
|
22013
|
+
flexDirection: "column",
|
|
22014
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)"
|
|
22066
22015
|
}
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
const toSave = {
|
|
22076
|
-
mdmsCards: Array.isArray(site.mdmsCards) ? site.mdmsCards : site.mdmsCards || [],
|
|
22077
|
-
adsList: Array.isArray(site.adsList) ? site.adsList : site.adsList || [],
|
|
22078
|
-
adsScheduleMap: site.adsScheduleMap ? {
|
|
22079
|
-
...site.adsScheduleMap
|
|
22080
|
-
} : {},
|
|
22081
|
-
placeNameState: site.placeNameState || "",
|
|
22082
|
-
globalScheduleEnabled: !!enable,
|
|
22083
|
-
startDate: site.startDate || "",
|
|
22084
|
-
endDate: site.endDate || "",
|
|
22085
|
-
bookingFromTime: site.bookingFromTime || "",
|
|
22086
|
-
bookingToTime: site.bookingToTime || ""
|
|
22087
|
-
};
|
|
22088
|
-
if (enable) {
|
|
22089
|
-
const {
|
|
22090
|
-
startDate: sd = "",
|
|
22091
|
-
startTime: st = "",
|
|
22092
|
-
endDate: ed = "",
|
|
22093
|
-
endTime: et = ""
|
|
22094
|
-
} = globalTimes;
|
|
22095
|
-
(toSave.mdmsCards || []).forEach(c => {
|
|
22096
|
-
const key = c.mdmsId ?? c.id;
|
|
22097
|
-
if (!key) return;
|
|
22098
|
-
toSave.adsScheduleMap[key] = {
|
|
22099
|
-
startDate: sd,
|
|
22100
|
-
startTime: st,
|
|
22101
|
-
endDate: ed,
|
|
22102
|
-
endTime: et
|
|
22103
|
-
};
|
|
22104
|
-
});
|
|
22105
|
-
} else {
|
|
22106
|
-
const {
|
|
22107
|
-
startDate: sd = "",
|
|
22108
|
-
startTime: st = "",
|
|
22109
|
-
endDate: ed = "",
|
|
22110
|
-
endTime: et = ""
|
|
22111
|
-
} = globalTimes;
|
|
22112
|
-
Object.keys(toSave.adsScheduleMap || {}).forEach(k => {
|
|
22113
|
-
const e = toSave.adsScheduleMap[k] || {};
|
|
22114
|
-
if (sd && st && ed && et) {
|
|
22115
|
-
if (e.startDate === sd && e.startTime === st && e.endDate === ed && e.endTime === et) {
|
|
22116
|
-
delete toSave.adsScheduleMap[k];
|
|
22117
|
-
}
|
|
22118
|
-
} else {
|
|
22119
|
-
if (!e.startDate && !e.startTime && !e.endDate && !e.endTime) delete toSave.adsScheduleMap[k];
|
|
22120
|
-
}
|
|
22121
|
-
});
|
|
22122
|
-
}
|
|
22123
|
-
try {
|
|
22124
|
-
localStorage.setItem(`${PERSIST_KEY_PREFIX}${siteKey}`, JSON.stringify({
|
|
22125
|
-
...toSave,
|
|
22126
|
-
savedAt: Date.now()
|
|
22127
|
-
}));
|
|
22128
|
-
} catch (err) {
|
|
22129
|
-
try {
|
|
22130
|
-
sessionStorage.setItem(`ADS:session:${siteKey}`, JSON.stringify({
|
|
22131
|
-
...toSave,
|
|
22132
|
-
savedAt: Date.now()
|
|
22133
|
-
}));
|
|
22134
|
-
} catch (e) {
|
|
22135
|
-
console.warn("updateAllSavedSitesForGlobal persist failed for", siteKey, e);
|
|
22136
|
-
}
|
|
22137
|
-
}
|
|
22138
|
-
});
|
|
22139
|
-
} catch (e) {
|
|
22140
|
-
console.warn("updateAllSavedSitesForGlobal failed", e);
|
|
22016
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22017
|
+
style: {
|
|
22018
|
+
display: "flex",
|
|
22019
|
+
justifyContent: "space-between",
|
|
22020
|
+
alignItems: "center",
|
|
22021
|
+
marginBottom: "16px",
|
|
22022
|
+
borderBottom: "1px solid #eee",
|
|
22023
|
+
paddingBottom: "8px"
|
|
22141
22024
|
}
|
|
22142
|
-
}
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
} = saved;
|
|
22149
|
-
const mdmsConverted = mdmsCards.flatMap(c => (c.schedules || []).map(s => {
|
|
22150
|
-
var _c$mdmsId, _c$mdmsId2;
|
|
22151
|
-
const [sDate, sTime = nowHM] = (s.startDatetime || "").split("T");
|
|
22152
|
-
const [eDate, eTime = nowHM] = (s.endDatetime || "").split("T");
|
|
22153
|
-
return {
|
|
22154
|
-
addType: c.adType || "",
|
|
22155
|
-
bookingDate: sDate || "",
|
|
22156
|
-
endDate: eDate || "",
|
|
22157
|
-
bookingFromTime: sTime || nowHM,
|
|
22158
|
-
bookingToTime: eTime || nowHM,
|
|
22159
|
-
advertisementId: ((_c$mdmsId = c.mdmsId) === null || _c$mdmsId === void 0 ? void 0 : _c$mdmsId.toString()) || "",
|
|
22160
|
-
cartId: ((_c$mdmsId2 = c.mdmsId) === null || _c$mdmsId2 === void 0 ? void 0 : _c$mdmsId2.toString()) || "",
|
|
22161
|
-
cartAddress: c.name || "",
|
|
22162
|
-
geoLocation: c.geoLocation || c.geoLocation || "",
|
|
22163
|
-
faceArea: `${c.width || ""}x${c.height || ""}`,
|
|
22164
|
-
location: c.locationCode || "",
|
|
22165
|
-
status: "BOOKING_CREATED",
|
|
22166
|
-
availabilityStatus: c.available === false ? "UNAVAILABLE" : "AVAILABLE",
|
|
22167
|
-
amount: c.amount || ""
|
|
22168
|
-
};
|
|
22169
|
-
}));
|
|
22170
|
-
const manualConverted = (adsList || []).map(d => {
|
|
22171
|
-
var _d$advertisementType, _d$mdmsId, _d$mdmsId2, _d$geoLocation, _d$size, _d$siteName;
|
|
22172
|
-
return {
|
|
22173
|
-
addType: ((_d$advertisementType = d.advertisementType) === null || _d$advertisementType === void 0 ? void 0 : _d$advertisementType.code) || d.advertisementType || d.addType || "",
|
|
22174
|
-
bookingDate: d.bookingDate || d.startDate || "",
|
|
22175
|
-
endDate: d.endDate || d.endDate || "",
|
|
22176
|
-
bookingFromTime: d.bookingFromTime || "",
|
|
22177
|
-
bookingToTime: d.bookingToTime || "",
|
|
22178
|
-
advertisementId: d.advertisementId || d.siteId || ((_d$mdmsId = d.mdmsId) === null || _d$mdmsId === void 0 ? void 0 : _d$mdmsId.toString()) || "",
|
|
22179
|
-
cartId: d.cartId || d.siteId || ((_d$mdmsId2 = d.mdmsId) === null || _d$mdmsId2 === void 0 ? void 0 : _d$mdmsId2.toString()) || "",
|
|
22180
|
-
cartAddress: d.cartAddress || d.name || "",
|
|
22181
|
-
geoLocation: d.geoLocation || ((_d$geoLocation = d.geoLocation) !== null && _d$geoLocation !== void 0 && _d$geoLocation.code ? d.geoLocation.code : "") || "",
|
|
22182
|
-
faceArea: d.faceArea || ((_d$size = d.size) !== null && _d$size !== void 0 && _d$size.code ? d.size.code : "") || "",
|
|
22183
|
-
location: d.location || d.locationCode || d.siteId || ((_d$siteName = d.siteName) !== null && _d$siteName !== void 0 && _d$siteName.code ? d.siteName.code : "") || "",
|
|
22184
|
-
status: "BOOKING_CREATED",
|
|
22185
|
-
availabilityStatus: d.availabilityStatus || (d.available === false ? "UNAVAILABLE" : "AVAILABLE") || "",
|
|
22186
|
-
rate: d.amount || ""
|
|
22187
|
-
};
|
|
22188
|
-
});
|
|
22189
|
-
return [...manualConverted, ...mdmsConverted];
|
|
22190
|
-
};
|
|
22191
|
-
const PERSIST_GLOBAL_KEY = "ADS:global";
|
|
22192
|
-
const saveGlobal = payload => {
|
|
22193
|
-
try {
|
|
22194
|
-
const out = {
|
|
22195
|
-
...(payload || {}),
|
|
22196
|
-
savedAt: Date.now()
|
|
22197
|
-
};
|
|
22198
|
-
localStorage.setItem(PERSIST_GLOBAL_KEY, JSON.stringify(out));
|
|
22199
|
-
} catch (e) {
|
|
22200
|
-
console.warn("saveGlobal failed", e);
|
|
22025
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
22026
|
+
style: {
|
|
22027
|
+
margin: 0,
|
|
22028
|
+
fontSize: "20px",
|
|
22029
|
+
fontWeight: 700,
|
|
22030
|
+
color: "#333"
|
|
22201
22031
|
}
|
|
22202
|
-
}
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
} catch (e) {
|
|
22208
|
-
return null;
|
|
22032
|
+
}, t("ADS_AVAILIBILITY_FOR"), " ", ad === null || ad === void 0 ? void 0 : ad.name, " ", allBooked && /*#__PURE__*/React.createElement("span", {
|
|
22033
|
+
style: {
|
|
22034
|
+
color: "#c62828",
|
|
22035
|
+
fontSize: "14px",
|
|
22036
|
+
marginLeft: "8px"
|
|
22209
22037
|
}
|
|
22210
|
-
}
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
};
|
|
22219
|
-
(adsForLocation || []).forEach(ad => {
|
|
22220
|
-
newMap[ad.id] = {
|
|
22221
|
-
...(newMap[ad.id] || {}),
|
|
22222
|
-
startDate: sd,
|
|
22223
|
-
startTime: st,
|
|
22224
|
-
endDate: ed,
|
|
22225
|
-
endTime: et
|
|
22226
|
-
};
|
|
22227
|
-
});
|
|
22228
|
-
setAdsScheduleMap(newMap);
|
|
22229
|
-
};
|
|
22230
|
-
const initialFormDefaults = {
|
|
22231
|
-
siteId: "",
|
|
22232
|
-
geoLocation: null,
|
|
22233
|
-
cartAddress: "",
|
|
22234
|
-
size: "",
|
|
22235
|
-
advertisementType: "",
|
|
22236
|
-
startDate: "",
|
|
22237
|
-
endDate: "",
|
|
22238
|
-
bookingFromTime: nowHM,
|
|
22239
|
-
bookingToTime: nowHM,
|
|
22240
|
-
availabilityStatus: "",
|
|
22241
|
-
amount: ""
|
|
22242
|
-
};
|
|
22243
|
-
const {
|
|
22244
|
-
control,
|
|
22245
|
-
handleSubmit,
|
|
22246
|
-
setValue,
|
|
22247
|
-
watch,
|
|
22248
|
-
reset,
|
|
22249
|
-
formState: {
|
|
22250
|
-
errors
|
|
22251
|
-
},
|
|
22252
|
-
getValues,
|
|
22253
|
-
trigger,
|
|
22254
|
-
setError,
|
|
22255
|
-
clearErrors
|
|
22256
|
-
} = useForm({
|
|
22257
|
-
defaultValues: initialFormDefaults
|
|
22258
|
-
});
|
|
22259
|
-
const setGlobalSchedule = useCallback(enable => {
|
|
22260
|
-
const sd = getValues("startDate") || "";
|
|
22261
|
-
const ed = getValues("endDate") || sd || "";
|
|
22262
|
-
const st = getValues("bookingFromTime") || nowHM || "";
|
|
22263
|
-
const et = getValues("bookingToTime") || nowHM || "";
|
|
22264
|
-
if (enable) {
|
|
22265
|
-
adsScheduleBackupRef.current = adsScheduleMap || {};
|
|
22266
|
-
setAdsScheduleMap(prev => {
|
|
22267
|
-
const newMap = {
|
|
22268
|
-
...(prev || {})
|
|
22269
|
-
};
|
|
22270
|
-
(adsForLocation || []).forEach(ad => {
|
|
22271
|
-
const key = ad.mdmsId ?? ad.id;
|
|
22272
|
-
newMap[key] = {
|
|
22273
|
-
startDate: sd,
|
|
22274
|
-
startTime: st,
|
|
22275
|
-
endDate: ed,
|
|
22276
|
-
endTime: et
|
|
22277
|
-
};
|
|
22278
|
-
});
|
|
22279
|
-
return newMap;
|
|
22280
|
-
});
|
|
22281
|
-
setGlobalScheduleEnabled(true);
|
|
22282
|
-
saveGlobal({
|
|
22283
|
-
globalScheduleEnabled: true,
|
|
22284
|
-
startDate: sd,
|
|
22285
|
-
endDate: ed,
|
|
22286
|
-
bookingFromTime: st,
|
|
22287
|
-
bookingToTime: et
|
|
22288
|
-
});
|
|
22289
|
-
updateAllSavedSitesForGlobal(true, {
|
|
22290
|
-
startDate: sd,
|
|
22291
|
-
startTime: st,
|
|
22292
|
-
endDate: ed,
|
|
22293
|
-
endTime: et
|
|
22294
|
-
});
|
|
22295
|
-
} else {
|
|
22296
|
-
setGlobalScheduleEnabled(false);
|
|
22297
|
-
setAdsScheduleMap(adsScheduleBackupRef.current || {});
|
|
22298
|
-
adsScheduleBackupRef.current = null;
|
|
22299
|
-
const curGlobal = loadGlobal() || {};
|
|
22300
|
-
saveGlobal({
|
|
22301
|
-
...curGlobal,
|
|
22302
|
-
globalScheduleEnabled: false
|
|
22303
|
-
});
|
|
22304
|
-
updateAllSavedSitesForGlobal(false, {
|
|
22305
|
-
startDate: sd,
|
|
22306
|
-
startTime: st,
|
|
22307
|
-
endDate: ed,
|
|
22308
|
-
endTime: et
|
|
22309
|
-
});
|
|
22310
|
-
}
|
|
22311
|
-
try {
|
|
22312
|
-
dispatch(UPDATE_ADSNewApplication_FORM("savedUI", {
|
|
22313
|
-
mdmsCards,
|
|
22314
|
-
adsList,
|
|
22315
|
-
adsScheduleMap: enable ? (() => {
|
|
22316
|
-
const optimisticMap = {
|
|
22317
|
-
...(adsScheduleMap || {})
|
|
22318
|
-
};
|
|
22319
|
-
(adsForLocation || []).forEach(ad => {
|
|
22320
|
-
const key = ad.mdmsId ?? ad.id;
|
|
22321
|
-
optimisticMap[key] = {
|
|
22322
|
-
startDate: sd,
|
|
22323
|
-
startTime: st,
|
|
22324
|
-
endDate: ed,
|
|
22325
|
-
endTime: et
|
|
22326
|
-
};
|
|
22327
|
-
});
|
|
22328
|
-
return optimisticMap;
|
|
22329
|
-
})() : adsScheduleBackupRef.current || adsScheduleMap || {},
|
|
22330
|
-
placeNameState,
|
|
22331
|
-
globalScheduleEnabled: !!enable,
|
|
22332
|
-
startDate: sd,
|
|
22333
|
-
endDate: ed,
|
|
22334
|
-
bookingFromTime: st,
|
|
22335
|
-
bookingToTime: et,
|
|
22336
|
-
siteId: getValues("siteId"),
|
|
22337
|
-
geolocation: getValues("geoLocation")
|
|
22338
|
-
}));
|
|
22339
|
-
} catch (e) {
|
|
22340
|
-
console.warn("dispatch update on setGlobalSchedule failed", e);
|
|
22341
|
-
}
|
|
22342
|
-
}, [adsForLocation, adsScheduleMap, mdmsCards, adsList, placeNameState, dispatch, getValues]);
|
|
22343
|
-
useEffect(() => {
|
|
22344
|
-
const parentUI = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.savedUI;
|
|
22345
|
-
if (parentUI) {
|
|
22346
|
-
if (Array.isArray(parentUI.mdmsCards)) setMdmsCards(parentUI.mdmsCards);
|
|
22347
|
-
if (Array.isArray(parentUI.adsList)) setAdsList(parentUI.adsList);
|
|
22348
|
-
if (parentUI.adsScheduleMap) setAdsScheduleMap(parentUI.adsScheduleMap);
|
|
22349
|
-
if (typeof parentUI.placeNameState === "string") setPlaceNameState(parentUI.placeNameState || "");
|
|
22350
|
-
if (typeof parentUI.globalScheduleEnabled !== "undefined") {
|
|
22351
|
-
setGlobalScheduleEnabled(!!parentUI.globalScheduleEnabled);
|
|
22352
|
-
if (parentUI.startDate) setValue("startDate", parentUI.startDate, {
|
|
22353
|
-
shouldValidate: false
|
|
22354
|
-
});
|
|
22355
|
-
if (parentUI.endDate) setValue("endDate", parentUI.endDate, {
|
|
22356
|
-
shouldValidate: false
|
|
22357
|
-
});
|
|
22358
|
-
if (parentUI.bookingFromTime) setValue("bookingFromTime", parentUI.bookingFromTime, {
|
|
22359
|
-
shouldValidate: false
|
|
22360
|
-
});
|
|
22361
|
-
if (parentUI.bookingToTime) setValue("bookingToTime", parentUI.bookingToTime, {
|
|
22362
|
-
shouldValidate: false
|
|
22363
|
-
});
|
|
22364
|
-
if (parentUI.globalScheduleEnabled) applyGlobalToAll();
|
|
22365
|
-
}
|
|
22366
|
-
if (parentUI.siteId) {
|
|
22367
|
-
setValue("siteId", parentUI.siteId, {
|
|
22368
|
-
shouldValidate: false,
|
|
22369
|
-
shouldDirty: true
|
|
22370
|
-
});
|
|
22371
|
-
setAdsForLocation(mdmsAds.filter(a => String(a.locationCode) === String(parentUI.siteId)));
|
|
22372
|
-
}
|
|
22373
|
-
if (parentUI.geoLocation) {
|
|
22374
|
-
var _parentUI$geoLocation;
|
|
22375
|
-
setValue("geoLocation", parentUI.geoLocation, {
|
|
22376
|
-
shouldValidate: false,
|
|
22377
|
-
shouldDirty: true
|
|
22378
|
-
});
|
|
22379
|
-
setPlaceNameState(((_parentUI$geoLocation = parentUI.geoLocation) === null || _parentUI$geoLocation === void 0 ? void 0 : _parentUI$geoLocation.formattedAddress) || "");
|
|
22380
|
-
}
|
|
22381
|
-
return;
|
|
22382
|
-
}
|
|
22383
|
-
const global = loadGlobal();
|
|
22384
|
-
if (global && global.globalScheduleEnabled) {
|
|
22385
|
-
setGlobalScheduleEnabled(true);
|
|
22386
|
-
if (global.startDate) setValue("startDate", global.startDate, {
|
|
22387
|
-
shouldValidate: false
|
|
22388
|
-
});
|
|
22389
|
-
if (global.endDate) setValue("endDate", global.endDate, {
|
|
22390
|
-
shouldValidate: false
|
|
22391
|
-
});
|
|
22392
|
-
if (global.bookingFromTime) setValue("bookingFromTime", global.bookingFromTime, {
|
|
22393
|
-
shouldValidate: false
|
|
22394
|
-
});
|
|
22395
|
-
if (global.bookingToTime) setValue("bookingToTime", global.bookingToTime, {
|
|
22396
|
-
shouldValidate: false
|
|
22397
|
-
});
|
|
22398
|
-
applyGlobalToAll();
|
|
22399
|
-
return;
|
|
22038
|
+
}, t("ADS_ALL_SLOTS_BOOKED"))), /*#__PURE__*/React.createElement("button", {
|
|
22039
|
+
onClick: onClose,
|
|
22040
|
+
style: {
|
|
22041
|
+
border: "none",
|
|
22042
|
+
background: "transparent",
|
|
22043
|
+
fontSize: "22px",
|
|
22044
|
+
cursor: "pointer",
|
|
22045
|
+
color: "#666"
|
|
22400
22046
|
}
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
setValue("siteId", chosenSiteId, {
|
|
22408
|
-
shouldValidate: false,
|
|
22409
|
-
shouldDirty: true
|
|
22410
|
-
});
|
|
22411
|
-
setSiteIdKey(k => k + 1);
|
|
22412
|
-
setAdsForLocation(mdmsAds.filter(a => String(a.locationCode) === chosenSiteId));
|
|
22413
|
-
setMdmsCards(Array.isArray(chosen.mdmsCards) ? chosen.mdmsCards : []);
|
|
22414
|
-
setAdsList(Array.isArray(chosen.adsList) ? chosen.adsList : []);
|
|
22415
|
-
setAdsScheduleMap(chosen.adsScheduleMap || {});
|
|
22416
|
-
setPlaceNameState(chosen.placeNameState || "");
|
|
22417
|
-
if (chosen.geoLocation) setValue("geoLocation", chosen.geoLocation, {
|
|
22418
|
-
shouldValidate: false,
|
|
22419
|
-
shouldDirty: true
|
|
22420
|
-
});
|
|
22421
|
-
}
|
|
22047
|
+
}, "\u2716")), /*#__PURE__*/React.createElement("div", {
|
|
22048
|
+
style: {
|
|
22049
|
+
flex: 1,
|
|
22050
|
+
overflowY: "auto",
|
|
22051
|
+
border: "1px solid #ddd",
|
|
22052
|
+
borderRadius: "8px"
|
|
22422
22053
|
}
|
|
22423
|
-
},
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
reset(initialFormDefaults);
|
|
22429
|
-
} catch (e) {
|
|
22430
|
-
console.warn("form reset failed", e);
|
|
22054
|
+
}, isLoading ? /*#__PURE__*/React.createElement("div", {
|
|
22055
|
+
style: {
|
|
22056
|
+
fontSize: "24px",
|
|
22057
|
+
color: "#555",
|
|
22058
|
+
textAlign: "center"
|
|
22431
22059
|
}
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
setGlobalScheduleEnabled(false);
|
|
22438
|
-
adsScheduleBackupRef.current = null;
|
|
22439
|
-
setSiteIdKey(k => k + 1);
|
|
22440
|
-
} catch (e) {
|
|
22441
|
-
console.warn("local state clear failed", e);
|
|
22060
|
+
}, t("ADS_LOADING_SLOTS")) : slots.length === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
22061
|
+
style: {
|
|
22062
|
+
fontSize: "24px",
|
|
22063
|
+
color: "#555",
|
|
22064
|
+
textAlign: "center"
|
|
22442
22065
|
}
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22066
|
+
}, t("ADS_NO_SLOTS_AVAILABLE")) : /*#__PURE__*/React.createElement(Table, {
|
|
22067
|
+
t: t,
|
|
22068
|
+
data: slots,
|
|
22069
|
+
columns: columns,
|
|
22070
|
+
disableSort: true,
|
|
22071
|
+
isPaginationRequired: false,
|
|
22072
|
+
getCellProps: cell => ({
|
|
22073
|
+
style: {
|
|
22074
|
+
padding: "12px 14px",
|
|
22075
|
+
fontSize: "14px",
|
|
22076
|
+
borderBottom: "1px solid #f0f0f0",
|
|
22077
|
+
textAlign: "left",
|
|
22078
|
+
backgroundColor: cell.row.index % 2 === 0 ? "#fafafa" : "#fff"
|
|
22448
22079
|
}
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
} catch (err) {}
|
|
22457
|
-
try {
|
|
22458
|
-
localStorage.removeItem(PERSIST_GLOBAL_KEY);
|
|
22459
|
-
} catch (err) {}
|
|
22460
|
-
} catch (e) {
|
|
22461
|
-
console.warn("persistence clear failed", e);
|
|
22080
|
+
})
|
|
22081
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
22082
|
+
style: {
|
|
22083
|
+
marginTop: "12px",
|
|
22084
|
+
display: "flex",
|
|
22085
|
+
justifyContent: "flex-end",
|
|
22086
|
+
gap: "10px"
|
|
22462
22087
|
}
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
endDate: "",
|
|
22472
|
-
bookingFromTime: "",
|
|
22473
|
-
bookingToTime: "",
|
|
22474
|
-
siteId: "",
|
|
22475
|
-
geoLocation: null
|
|
22476
|
-
}));
|
|
22477
|
-
} catch (e) {
|
|
22478
|
-
console.warn("redux notify failed", e);
|
|
22088
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
22089
|
+
onClick: onClose,
|
|
22090
|
+
style: {
|
|
22091
|
+
padding: "10px 18px",
|
|
22092
|
+
borderRadius: "6px",
|
|
22093
|
+
border: "1px solid #ccc",
|
|
22094
|
+
background: "#f5f5f5",
|
|
22095
|
+
cursor: "pointer"
|
|
22479
22096
|
}
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
}
|
|
22493
|
-
}
|
|
22494
|
-
} catch (err) {
|
|
22495
|
-
console.warn("clear ADS localStorage failed", err);
|
|
22496
|
-
}
|
|
22497
|
-
try {
|
|
22498
|
-
for (let i = sessionStorage.length - 1; i >= 0; i--) {
|
|
22499
|
-
const k = sessionStorage.key(i);
|
|
22500
|
-
if (k && String(k).startsWith("ADS:session:")) {
|
|
22501
|
-
sessionStorage.removeItem(k);
|
|
22502
|
-
}
|
|
22503
|
-
}
|
|
22504
|
-
sessionStorage.removeItem("ADS:session:last");
|
|
22505
|
-
} catch (err) {
|
|
22506
|
-
console.warn("clear ADS sessionStorage failed", err);
|
|
22507
|
-
}
|
|
22508
|
-
try {
|
|
22509
|
-
dispatch(RESET_ADS_NEW_APPLICATION_FORM());
|
|
22510
|
-
} catch (err) {
|
|
22511
|
-
console.warn("dispatch reset failed", err);
|
|
22512
|
-
}
|
|
22513
|
-
try {
|
|
22514
|
-
globalReset();
|
|
22515
|
-
} catch (err) {
|
|
22516
|
-
console.warn("globalReset threw", err);
|
|
22517
|
-
}
|
|
22518
|
-
};
|
|
22519
|
-
const keyHandler = e => {
|
|
22520
|
-
if ((e.ctrlKey || e.metaKey) && (e.key === "r" || e.key === "R" || e.code === "KeyR") || e.code === "F5") {
|
|
22521
|
-
e.preventDefault();
|
|
22522
|
-
clearADSData();
|
|
22523
|
-
setTimeout(() => {
|
|
22524
|
-
skipPersistRef.current = false;
|
|
22525
|
-
window.location.reload();
|
|
22526
|
-
}, 60);
|
|
22527
|
-
}
|
|
22528
|
-
};
|
|
22529
|
-
const beforeUnloadHandler = () => {
|
|
22530
|
-
clearADSData();
|
|
22531
|
-
};
|
|
22532
|
-
window.addEventListener("keydown", keyHandler, true);
|
|
22533
|
-
window.addEventListener("beforeunload", beforeUnloadHandler);
|
|
22534
|
-
return () => {
|
|
22535
|
-
window.removeEventListener("keydown", keyHandler, true);
|
|
22536
|
-
window.removeEventListener("beforeunload", beforeUnloadHandler);
|
|
22537
|
-
};
|
|
22538
|
-
}, [dispatch, globalReset]);
|
|
22539
|
-
useEffect(() => {
|
|
22540
|
-
const site = siteIdValue;
|
|
22541
|
-
if (!site) return;
|
|
22542
|
-
setAdsForLocation(mdmsAds.filter(a => String(a.locationCode) === String(site)));
|
|
22543
|
-
const global = loadGlobal();
|
|
22544
|
-
const isGlobalActive = global && global.globalScheduleEnabled;
|
|
22545
|
-
if (isGlobalActive) {
|
|
22546
|
-
setGlobalScheduleEnabled(true);
|
|
22547
|
-
if (global.startDate) setValue("startDate", global.startDate, {
|
|
22548
|
-
shouldValidate: false
|
|
22549
|
-
});
|
|
22550
|
-
if (global.endDate) setValue("endDate", global.endDate, {
|
|
22551
|
-
shouldValidate: false
|
|
22552
|
-
});
|
|
22553
|
-
if (global.bookingFromTime) setValue("bookingFromTime", global.bookingFromTime, {
|
|
22554
|
-
shouldValidate: false
|
|
22555
|
-
});
|
|
22556
|
-
if (global.bookingToTime) setValue("bookingToTime", global.bookingToTime, {
|
|
22557
|
-
shouldValidate: false
|
|
22558
|
-
});
|
|
22559
|
-
applyGlobalToAll();
|
|
22097
|
+
}, t ? t("Cancel") : "Cancel"), /*#__PURE__*/React.createElement("button", {
|
|
22098
|
+
onClick: handleAddToCart,
|
|
22099
|
+
disabled: selectedSlots.length === 0,
|
|
22100
|
+
style: {
|
|
22101
|
+
padding: "10px 18px",
|
|
22102
|
+
borderRadius: "6px",
|
|
22103
|
+
border: "none",
|
|
22104
|
+
background: selectedSlots.length > 0 ? "#2947a3" : "#ccc",
|
|
22105
|
+
color: "#fff",
|
|
22106
|
+
fontWeight: 600,
|
|
22107
|
+
cursor: selectedSlots.length > 0 ? "pointer" : "not-allowed",
|
|
22108
|
+
transition: "background 0.2s"
|
|
22560
22109
|
}
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22110
|
+
}, "\uD83D\uDED2 ", (existingForAd === null || existingForAd === void 0 ? void 0 : existingForAd.length) > 0 ? t("Update Cart") : t("Add To Cart")))));
|
|
22111
|
+
};
|
|
22112
|
+
|
|
22113
|
+
const CartModal = ({
|
|
22114
|
+
cartSlots,
|
|
22115
|
+
onClose,
|
|
22116
|
+
onRemoveSlot,
|
|
22117
|
+
t
|
|
22118
|
+
}) => {
|
|
22119
|
+
const [expanded, setExpanded] = useState(() => cartSlots.map(item => item.ad.id));
|
|
22120
|
+
const toggleExpand = adId => {
|
|
22121
|
+
setExpanded(prev => prev.includes(adId) ? prev.filter(id => id !== adId) : [...prev, adId]);
|
|
22122
|
+
};
|
|
22123
|
+
const makeColumns = ad => [{
|
|
22124
|
+
Header: t("ADS_DATE"),
|
|
22125
|
+
accessor: "bookingDate"
|
|
22126
|
+
}, {
|
|
22127
|
+
Header: t("ADS_LOCATION"),
|
|
22128
|
+
accessor: "location"
|
|
22129
|
+
}, {
|
|
22130
|
+
Header: t("ADS_FACE_AREA"),
|
|
22131
|
+
accessor: "faceArea"
|
|
22132
|
+
}, {
|
|
22133
|
+
Header: t("ADS_TYPE"),
|
|
22134
|
+
accessor: "addType"
|
|
22135
|
+
}, {
|
|
22136
|
+
Header: t("ADS_NIGHT_LIGHT"),
|
|
22137
|
+
accessor: row => row.nightLight ? t("ADS_YES") : t("ADS_NO")
|
|
22138
|
+
}, {
|
|
22139
|
+
Header: t("ADS_STATUS"),
|
|
22140
|
+
accessor: "slotStaus",
|
|
22141
|
+
Cell: ({
|
|
22142
|
+
row
|
|
22143
|
+
}) => {
|
|
22144
|
+
const status = row.original.slotStaus;
|
|
22145
|
+
const isAvailable = status === "AVAILABLE";
|
|
22146
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
22147
|
+
style: {
|
|
22148
|
+
display: "inline-block",
|
|
22149
|
+
padding: "5px 14px",
|
|
22150
|
+
borderRadius: "20px",
|
|
22151
|
+
fontSize: "12px",
|
|
22152
|
+
fontWeight: 600,
|
|
22153
|
+
color: isAvailable ? "#155724" : "#721c24",
|
|
22154
|
+
backgroundColor: isAvailable ? "#d4edda" : "#f8d7da",
|
|
22155
|
+
border: `1px solid ${isAvailable ? "#c3e6cb" : "#f5c6cb"}`,
|
|
22156
|
+
textTransform: "capitalize"
|
|
22157
|
+
}
|
|
22158
|
+
}, status);
|
|
22570
22159
|
}
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22579
|
-
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
|
|
22587
|
-
|
|
22588
|
-
endDatetime
|
|
22589
|
-
}]
|
|
22590
|
-
};
|
|
22591
|
-
});
|
|
22592
|
-
const newMap = {
|
|
22593
|
-
...(adsScheduleMap || {})
|
|
22594
|
-
};
|
|
22595
|
-
(mdmsToSet || []).forEach(c => {
|
|
22596
|
-
const key = c.mdmsId ?? c.id;
|
|
22597
|
-
newMap[key] = {
|
|
22598
|
-
startDate: sd,
|
|
22599
|
-
startTime: st,
|
|
22600
|
-
endDate: ed,
|
|
22601
|
-
endTime: et
|
|
22602
|
-
};
|
|
22603
|
-
});
|
|
22604
|
-
setAdsScheduleMap(prev => ({
|
|
22605
|
-
...(prev || {}),
|
|
22606
|
-
...(newMap || {})
|
|
22607
|
-
}));
|
|
22608
|
-
} else {
|
|
22609
|
-
if (effectiveSaved.adsScheduleMap) setAdsScheduleMap(effectiveSaved.adsScheduleMap || {});
|
|
22610
|
-
}
|
|
22611
|
-
setMdmsCards(mdmsToSet);
|
|
22612
|
-
setAdsList(adsListFromSaved);
|
|
22613
|
-
setPlaceNameState(effectiveSaved.placeNameState || "");
|
|
22614
|
-
if (effectiveSaved.startDate) setValue("startDate", effectiveSaved.startDate, {
|
|
22615
|
-
shouldValidate: false
|
|
22616
|
-
});
|
|
22617
|
-
if (effectiveSaved.endDate) setValue("endDate", effectiveSaved.endDate, {
|
|
22618
|
-
shouldValidate: false
|
|
22619
|
-
});
|
|
22620
|
-
if (effectiveSaved.bookingFromTime) setValue("bookingFromTime", effectiveSaved.bookingFromTime, {
|
|
22621
|
-
shouldValidate: false
|
|
22622
|
-
});
|
|
22623
|
-
if (effectiveSaved.bookingToTime) setValue("bookingToTime", effectiveSaved.bookingToTime, {
|
|
22624
|
-
shouldValidate: false
|
|
22625
|
-
});
|
|
22626
|
-
if (typeof effectiveSaved.globalScheduleEnabled !== "undefined") {
|
|
22627
|
-
if (!isGlobalActive) {
|
|
22628
|
-
setGlobalScheduleEnabled(!!effectiveSaved.globalScheduleEnabled);
|
|
22629
|
-
if (effectiveSaved.globalScheduleEnabled) {
|
|
22630
|
-
applyGlobalToAll();
|
|
22631
|
-
}
|
|
22632
|
-
} else {
|
|
22633
|
-
if (global.startDate) setValue("startDate", global.startDate, {
|
|
22634
|
-
shouldValidate: false
|
|
22635
|
-
});
|
|
22636
|
-
if (global.endDate) setValue("endDate", global.endDate, {
|
|
22637
|
-
shouldValidate: false
|
|
22638
|
-
});
|
|
22639
|
-
if (global.bookingFromTime) setValue("bookingFromTime", global.bookingFromTime, {
|
|
22640
|
-
shouldValidate: false
|
|
22641
|
-
});
|
|
22642
|
-
if (global.bookingToTime) setValue("bookingToTime", global.bookingToTime, {
|
|
22643
|
-
shouldValidate: false
|
|
22644
|
-
});
|
|
22645
|
-
setGlobalScheduleEnabled(true);
|
|
22646
|
-
applyGlobalToAll();
|
|
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"
|
|
22647
22177
|
}
|
|
22648
|
-
}
|
|
22649
|
-
} else {
|
|
22650
|
-
setMdmsCards([]);
|
|
22651
|
-
setAdsList([]);
|
|
22652
|
-
setAdsScheduleMap({});
|
|
22653
|
-
setPlaceNameState("");
|
|
22178
|
+
}, t("ADS_DELETE"));
|
|
22654
22179
|
}
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
|
|
22666
|
-
|
|
22667
|
-
|
|
22668
|
-
setPlaceNameState("");
|
|
22180
|
+
}];
|
|
22181
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22182
|
+
style: {
|
|
22183
|
+
position: "fixed",
|
|
22184
|
+
top: "70px",
|
|
22185
|
+
left: 0,
|
|
22186
|
+
width: "100vw",
|
|
22187
|
+
height: "calc(100vh - 70px)",
|
|
22188
|
+
background: "rgba(0,0,0,0.5)",
|
|
22189
|
+
display: "flex",
|
|
22190
|
+
justifyContent: "center",
|
|
22191
|
+
alignItems: "center",
|
|
22192
|
+
zIndex: 2000
|
|
22669
22193
|
}
|
|
22670
|
-
},
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
startDate: getValues("startDate") || "",
|
|
22682
|
-
endDate: getValues("endDate") || "",
|
|
22683
|
-
bookingFromTime: getValues("bookingFromTime") || "",
|
|
22684
|
-
bookingToTime: getValues("bookingToTime") || "",
|
|
22685
|
-
siteId: getValues("siteId") || "",
|
|
22686
|
-
geoLocation: getValues("geoLocation") || null
|
|
22687
|
-
};
|
|
22688
|
-
dispatch(UPDATE_ADSNewApplication_FORM("savedUI", savedUI));
|
|
22689
|
-
try {
|
|
22690
|
-
sessionStorage.setItem(`ADS:session:${getValues("siteId") || "last"}`, JSON.stringify(savedUI));
|
|
22691
|
-
} catch (e) {}
|
|
22692
|
-
} catch (e) {
|
|
22693
|
-
console.warn("sync savedUI failed", e);
|
|
22694
|
-
}
|
|
22695
|
-
};
|
|
22696
|
-
timer = setTimeout(snapshot, 120);
|
|
22697
|
-
return () => {
|
|
22698
|
-
if (timer) clearTimeout(timer);
|
|
22699
|
-
};
|
|
22700
|
-
}, [mdmsCards, adsList, adsScheduleMap, placeNameState, globalScheduleEnabled, dispatch, getValues]);
|
|
22701
|
-
useEffect(() => {
|
|
22702
|
-
return () => {
|
|
22703
|
-
try {
|
|
22704
|
-
const savedUI = {
|
|
22705
|
-
mdmsCards,
|
|
22706
|
-
adsList,
|
|
22707
|
-
adsScheduleMap,
|
|
22708
|
-
placeNameState,
|
|
22709
|
-
globalScheduleEnabled: !!globalScheduleEnabled,
|
|
22710
|
-
startDate: getValues("startDate") || "",
|
|
22711
|
-
endDate: getValues("endDate") || "",
|
|
22712
|
-
bookingFromTime: getValues("bookingFromTime") || "",
|
|
22713
|
-
bookingToTime: getValues("bookingToTime") || "",
|
|
22714
|
-
siteId: getValues("siteId") || "",
|
|
22715
|
-
geoLocation: getValues("geoLocation") || null
|
|
22716
|
-
};
|
|
22717
|
-
dispatch(UPDATE_ADSNewApplication_FORM("savedUI", savedUI));
|
|
22718
|
-
try {
|
|
22719
|
-
sessionStorage.setItem(`ADS:session:${getValues("siteId") || "last"}`, JSON.stringify(savedUI));
|
|
22720
|
-
} catch (e) {}
|
|
22721
|
-
} catch (e) {}
|
|
22722
|
-
};
|
|
22723
|
-
}, []);
|
|
22724
|
-
const startDateValue = watch("startDate");
|
|
22725
|
-
const endDateValue = watch("endDate");
|
|
22726
|
-
const fromTimeValue = watch("bookingFromTime");
|
|
22727
|
-
const toTimeValue = watch("bookingToTime");
|
|
22728
|
-
const currentlySelectedSiteId = watch("siteId");
|
|
22729
|
-
useEffect(() => {
|
|
22730
|
-
if (skipPersistRef.current) {
|
|
22731
|
-
return;
|
|
22194
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22195
|
+
style: {
|
|
22196
|
+
width: "90%",
|
|
22197
|
+
maxWidth: "1100px",
|
|
22198
|
+
height: "70vh",
|
|
22199
|
+
background: "#fff",
|
|
22200
|
+
borderRadius: "12px",
|
|
22201
|
+
padding: "20px",
|
|
22202
|
+
display: "flex",
|
|
22203
|
+
flexDirection: "column",
|
|
22204
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)"
|
|
22732
22205
|
}
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
endDate: endDateValue || "",
|
|
22742
|
-
bookingFromTime: fromTimeValue || "",
|
|
22743
|
-
bookingToTime: toTimeValue || ""
|
|
22744
|
-
});
|
|
22206
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22207
|
+
style: {
|
|
22208
|
+
display: "flex",
|
|
22209
|
+
justifyContent: "space-between",
|
|
22210
|
+
alignItems: "center",
|
|
22211
|
+
marginBottom: "16px",
|
|
22212
|
+
borderBottom: "1px solid #eee",
|
|
22213
|
+
paddingBottom: "8px"
|
|
22745
22214
|
}
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
bookingToTime: toTimeValue || ""
|
|
22753
|
-
});
|
|
22215
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
22216
|
+
style: {
|
|
22217
|
+
margin: 0,
|
|
22218
|
+
fontSize: "20px",
|
|
22219
|
+
fontWeight: 700,
|
|
22220
|
+
color: "#333"
|
|
22754
22221
|
}
|
|
22755
|
-
},
|
|
22756
|
-
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
d.setDate(d.getDate() + 1);
|
|
22764
|
-
return d.toISOString().slice(0, 10);
|
|
22765
|
-
};
|
|
22766
|
-
const tomorrowStr = getLocalTodayStr();
|
|
22767
|
-
let endDateMin;
|
|
22768
|
-
if (startDateValue) {
|
|
22769
|
-
const d = new Date(startDateValue);
|
|
22770
|
-
d.setDate(d.getDate());
|
|
22771
|
-
endDateMin = d.toISOString().slice(0, 10);
|
|
22772
|
-
}
|
|
22773
|
-
const addAdvertisement = handleSubmit(data => {
|
|
22774
|
-
if (editingIndex !== null && editingIndex >= 0) {
|
|
22775
|
-
setAdsList(prev => prev.map((it, i) => i === editingIndex ? data : it));
|
|
22776
|
-
setEditingIndex(null);
|
|
22777
|
-
} else {
|
|
22778
|
-
setAdsList(prev => [...prev, data]);
|
|
22222
|
+
}, t("ADS_YOUR_CART")), /*#__PURE__*/React.createElement("button", {
|
|
22223
|
+
onClick: onClose,
|
|
22224
|
+
style: {
|
|
22225
|
+
border: "none",
|
|
22226
|
+
background: "transparent",
|
|
22227
|
+
fontSize: "22px",
|
|
22228
|
+
cursor: "pointer",
|
|
22229
|
+
color: "#666"
|
|
22779
22230
|
}
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
});
|
|
22785
|
-
setPlaceNameState("");
|
|
22786
|
-
});
|
|
22787
|
-
const onSubmit = handleSubmit(data => {
|
|
22788
|
-
if (Object.keys(adsScheduleErrors).length > 0) {
|
|
22789
|
-
setShowToast({
|
|
22790
|
-
key: true,
|
|
22791
|
-
label: "Please fix all schedule errors before proceeding."
|
|
22792
|
-
});
|
|
22793
|
-
return;
|
|
22231
|
+
}, "\u2716")), /*#__PURE__*/React.createElement("div", {
|
|
22232
|
+
style: {
|
|
22233
|
+
flex: 1,
|
|
22234
|
+
overflowY: "auto"
|
|
22794
22235
|
}
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
});
|
|
22800
|
-
return;
|
|
22236
|
+
}, cartSlots.length === 0 ? /*#__PURE__*/React.createElement("p", {
|
|
22237
|
+
style: {
|
|
22238
|
+
padding: "12px",
|
|
22239
|
+
color: "#666"
|
|
22801
22240
|
}
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
advertisementId: ((_c$mdmsId3 = c.mdmsId) === null || _c$mdmsId3 === void 0 ? void 0 : _c$mdmsId3.toString()) || "",
|
|
22813
|
-
cartId: ((_c$mdmsId4 = c.mdmsId) === null || _c$mdmsId4 === void 0 ? void 0 : _c$mdmsId4.toString()) || "",
|
|
22814
|
-
cartAddress: c.name || "",
|
|
22815
|
-
geoLocation: c.geoLocation || normalizeLocationToGeo(findLocationByCode(c.locationCode)) || "",
|
|
22816
|
-
faceArea: `${c.width || ""}x${c.height || ""}`,
|
|
22817
|
-
location: c.locationCode || "",
|
|
22818
|
-
status: "BOOKING_CREATED",
|
|
22819
|
-
availabilityStatus: c.available === false ? "UNAVAILABLE" : "AVAILABLE",
|
|
22820
|
-
amount: c.amount || "",
|
|
22821
|
-
nightLight: c.light
|
|
22822
|
-
};
|
|
22823
|
-
}));
|
|
22824
|
-
const adsToSubmit = [...adsList, ...mdmsCartDetails];
|
|
22825
|
-
console.log("adsToSubmit", adsToSubmit);
|
|
22826
|
-
const cartDetails = adsToSubmit.map(d => {
|
|
22827
|
-
var _d$advertisementType2, _d$mdmsId3, _d$mdmsId4, _d$geoLocation2, _d$size2, _d$siteName2;
|
|
22828
|
-
return {
|
|
22829
|
-
addType: ((_d$advertisementType2 = d.advertisementType) === null || _d$advertisementType2 === void 0 ? void 0 : _d$advertisementType2.code) || d.advertisementType || d.addType || "",
|
|
22830
|
-
bookingDate: d.bookingDate || d.startDate || "",
|
|
22831
|
-
endDate: d.endDate || d.endDate || "",
|
|
22832
|
-
bookingFromTime: d.bookingFromTime || "",
|
|
22833
|
-
bookingToTime: d.bookingToTime || "",
|
|
22834
|
-
advertisementId: d.advertisementId || d.siteId || ((_d$mdmsId3 = d.mdmsId) === null || _d$mdmsId3 === void 0 ? void 0 : _d$mdmsId3.toString()) || "",
|
|
22835
|
-
cartId: d.cartId || d.cartId || d.siteId || ((_d$mdmsId4 = d.mdmsId) === null || _d$mdmsId4 === void 0 ? void 0 : _d$mdmsId4.toString()) || "",
|
|
22836
|
-
cartAddress: d.cartAddress || d.name || "",
|
|
22837
|
-
geoLocation: d.geoLocation || ((_d$geoLocation2 = d.geoLocation) !== null && _d$geoLocation2 !== void 0 && _d$geoLocation2.code ? d.geoLocation.code : "") || "",
|
|
22838
|
-
faceArea: d.faceArea || ((_d$size2 = d.size) !== null && _d$size2 !== void 0 && _d$size2.code ? d.size.code : "") || "",
|
|
22839
|
-
location: d.location || d.locationCode || d.siteId || ((_d$siteName2 = d.siteName) !== null && _d$siteName2 !== void 0 && _d$siteName2.code ? d.siteName.code : "") || "",
|
|
22840
|
-
status: "BOOKING_CREATED",
|
|
22841
|
-
availabilityStatus: d.availabilityStatus || (d.available === false ? "UNAVAILABLE" : "AVAILABLE") || "",
|
|
22842
|
-
rate: d.amount || "",
|
|
22843
|
-
light: d.light
|
|
22844
|
-
};
|
|
22845
|
-
});
|
|
22846
|
-
const allSaved = loadAllSavedSites();
|
|
22847
|
-
let otherCartDetails = [];
|
|
22848
|
-
const currentSite = watch("siteId") || getValues("siteId");
|
|
22849
|
-
allSaved.forEach(s => {
|
|
22850
|
-
if (!s || !s.siteId) return;
|
|
22851
|
-
if (String(s.siteId) === String(currentSite)) return;
|
|
22852
|
-
otherCartDetails = otherCartDetails.concat(convertSavedToCartDetails(s));
|
|
22853
|
-
});
|
|
22854
|
-
const dedupeMap = new Map();
|
|
22855
|
-
const pushDeduped = entry => {
|
|
22856
|
-
const key = `${entry.advertisementId || ""}::${entry.cartId || ""}::${entry.bookingDate || ""}`;
|
|
22857
|
-
if (!dedupeMap.has(key)) {
|
|
22858
|
-
dedupeMap.set(key, true);
|
|
22859
|
-
return true;
|
|
22860
|
-
}
|
|
22861
|
-
return false;
|
|
22862
|
-
};
|
|
22863
|
-
const finalCartDetails = [];
|
|
22864
|
-
cartDetails.forEach(c => {
|
|
22865
|
-
if (pushDeduped(c)) finalCartDetails.push(c);
|
|
22866
|
-
});
|
|
22867
|
-
otherCartDetails.forEach(c => {
|
|
22868
|
-
if (pushDeduped(c)) finalCartDetails.push(c);
|
|
22869
|
-
});
|
|
22870
|
-
const payload = {
|
|
22871
|
-
cartDetails: finalCartDetails,
|
|
22872
|
-
cartAddress: data.cartAddress,
|
|
22873
|
-
savedUI: {
|
|
22874
|
-
mdmsCards,
|
|
22875
|
-
adsList,
|
|
22876
|
-
adsScheduleMap,
|
|
22877
|
-
placeNameState,
|
|
22878
|
-
globalScheduleEnabled,
|
|
22879
|
-
startDate: getValues("startDate") || "",
|
|
22880
|
-
endDate: getValues("endDate") || "",
|
|
22881
|
-
bookingFromTime: getValues("bookingFromTime") || "",
|
|
22882
|
-
bookingToTime: getValues("bookingToTime") || "",
|
|
22883
|
-
siteId: getValues("siteId") || "",
|
|
22884
|
-
geoLocation: getValues("geoLocation") || null
|
|
22241
|
+
}, t("ADS_NO_ITEMS_IN_CART")) : cartSlots.map((item, idx) => {
|
|
22242
|
+
var _item$slots;
|
|
22243
|
+
const isOpen = expanded.includes(item.ad.id);
|
|
22244
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22245
|
+
key: idx,
|
|
22246
|
+
style: {
|
|
22247
|
+
marginBottom: "16px",
|
|
22248
|
+
border: "1px solid #ddd",
|
|
22249
|
+
borderRadius: "8px",
|
|
22250
|
+
overflow: "hidden"
|
|
22885
22251
|
}
|
|
22886
|
-
}
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
geoLocation: getValues("geoLocation")
|
|
22899
|
-
});
|
|
22900
|
-
}
|
|
22901
|
-
dispatch(UPDATE_ADSNewApplication_FORM("savedUI", payload.savedUI));
|
|
22902
|
-
goNext(payload);
|
|
22903
|
-
});
|
|
22904
|
-
useEffect(() => {
|
|
22905
|
-
if (!adsScheduleMap || mdmsCards.length === 0) return;
|
|
22906
|
-
setMdmsCards(prev => prev.map(card => {
|
|
22907
|
-
var _card$schedules, _card$schedules$, _card$schedules2, _card$schedules2$, _card$schedules3, _card$schedules3$, _card$schedules4, _card$schedules4$;
|
|
22908
|
-
const key = card.mdmsId ?? card.id;
|
|
22909
|
-
const entry = adsScheduleMap[key] || adsScheduleMap[String(key)];
|
|
22910
|
-
if (!entry) return card;
|
|
22911
|
-
const start = entry.startDate && entry.startTime ? `${entry.startDate}T${entry.startTime}` : ((_card$schedules = card.schedules) === null || _card$schedules === void 0 ? void 0 : (_card$schedules$ = _card$schedules[0]) === null || _card$schedules$ === void 0 ? void 0 : _card$schedules$.startDatetime) || "";
|
|
22912
|
-
const end = entry.endDate && entry.endTime ? `${entry.endDate}T${entry.endTime}` : ((_card$schedules2 = card.schedules) === null || _card$schedules2 === void 0 ? void 0 : (_card$schedules2$ = _card$schedules2[0]) === null || _card$schedules2$ === void 0 ? void 0 : _card$schedules2$.endDatetime) || "";
|
|
22913
|
-
const prevStart = ((_card$schedules3 = card.schedules) === null || _card$schedules3 === void 0 ? void 0 : (_card$schedules3$ = _card$schedules3[0]) === null || _card$schedules3$ === void 0 ? void 0 : _card$schedules3$.startDatetime) || "";
|
|
22914
|
-
const prevEnd = ((_card$schedules4 = card.schedules) === null || _card$schedules4 === void 0 ? void 0 : (_card$schedules4$ = _card$schedules4[0]) === null || _card$schedules4$ === void 0 ? void 0 : _card$schedules4$.endDatetime) || "";
|
|
22915
|
-
if (prevStart === start && prevEnd === end) return card;
|
|
22916
|
-
return {
|
|
22917
|
-
...card,
|
|
22918
|
-
schedules: [{
|
|
22919
|
-
startDatetime: start,
|
|
22920
|
-
endDatetime: end
|
|
22921
|
-
}]
|
|
22922
|
-
};
|
|
22923
|
-
}));
|
|
22924
|
-
}, [adsScheduleMap]);
|
|
22925
|
-
console.log("errors", errors);
|
|
22926
|
-
useEffect(() => {
|
|
22927
|
-
if (((mdmsCards === null || mdmsCards === void 0 ? void 0 : mdmsCards.length) || 0) > 0 || ((adsList === null || adsList === void 0 ? void 0 : adsList.length) || 0) > 0) {
|
|
22928
|
-
clearErrors("siteSelection");
|
|
22929
|
-
}
|
|
22930
|
-
}, [mdmsCards, adsList, clearErrors]);
|
|
22931
|
-
useEffect(() => {
|
|
22932
|
-
reset(initialFormDefaults);
|
|
22933
|
-
setMdmsCards([]);
|
|
22934
|
-
setAdsList([]);
|
|
22935
|
-
setAdsScheduleMap({});
|
|
22936
|
-
setPlaceNameState("");
|
|
22937
|
-
setGlobalScheduleEnabled(false);
|
|
22938
|
-
setAdsForLocation([]);
|
|
22939
|
-
dispatch(RESET_ADS_NEW_APPLICATION_FORM());
|
|
22940
|
-
localStorage.removeItem("ADS:global");
|
|
22941
|
-
for (let i = localStorage.length - 1; i >= 0; i--) {
|
|
22942
|
-
const key = localStorage.key(i);
|
|
22943
|
-
if (key && key.startsWith("ADS:site:")) {
|
|
22944
|
-
localStorage.removeItem(key);
|
|
22252
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22253
|
+
onClick: () => toggleExpand(item.ad.id),
|
|
22254
|
+
style: {
|
|
22255
|
+
background: "#f9f9f9",
|
|
22256
|
+
padding: "10px 14px",
|
|
22257
|
+
fontWeight: 600,
|
|
22258
|
+
fontSize: "14px",
|
|
22259
|
+
borderBottom: "1px solid #ddd",
|
|
22260
|
+
cursor: "pointer",
|
|
22261
|
+
display: "flex",
|
|
22262
|
+
justifyContent: "space-between",
|
|
22263
|
+
alignItems: "center"
|
|
22945
22264
|
}
|
|
22946
|
-
}
|
|
22947
|
-
|
|
22948
|
-
|
|
22949
|
-
}, []);
|
|
22950
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
|
|
22951
|
-
onSubmit: handleSubmit(onSubmit)
|
|
22952
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Search By site id ", /*#__PURE__*/React.createElement("span", {
|
|
22953
|
-
style: {
|
|
22954
|
-
color: "red"
|
|
22955
|
-
}
|
|
22956
|
-
}, "*")), /*#__PURE__*/React.createElement(Controller, {
|
|
22957
|
-
control: control,
|
|
22958
|
-
name: "siteId",
|
|
22959
|
-
rules: {
|
|
22960
|
-
validate: val => {
|
|
22961
|
-
if (((mdmsCards === null || mdmsCards === void 0 ? void 0 : mdmsCards.length) || 0) === 0 && ((adsList === null || adsList === void 0 ? void 0 : adsList.length) || 0) === 0) {
|
|
22962
|
-
if (!val || String(val).trim() === "") return "This field is required";
|
|
22963
|
-
}
|
|
22964
|
-
if (val && String(val).length > 100) return "Maximum 100 characters";
|
|
22965
|
-
return true;
|
|
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", {
|
|
22266
|
+
style: {
|
|
22267
|
+
fontSize: "18px"
|
|
22966
22268
|
}
|
|
22967
|
-
},
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
return /*#__PURE__*/React.createElement(TextInput, {
|
|
22971
|
-
value: props.value,
|
|
22972
|
-
onChange: e => props.onChange(e.target.value),
|
|
22973
|
-
onBlur: props.onBlur
|
|
22974
|
-
});
|
|
22269
|
+
}, isOpen ? "▾" : "▸")), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
22270
|
+
style: {
|
|
22271
|
+
overflowX: "auto"
|
|
22975
22272
|
}
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
const chosenSite = String(val.code || "");
|
|
22990
|
-
props.onChange(chosenSite);
|
|
22991
|
-
const filtered = mdmsAds.filter(a => String(a.locationCode) === String(val.code));
|
|
22992
|
-
setAdsForLocation(filtered || []);
|
|
22993
|
-
const saved = loadForSite(chosenSite);
|
|
22994
|
-
const global = loadGlobal();
|
|
22995
|
-
const isGlobalActive = global && global.globalScheduleEnabled;
|
|
22996
|
-
if (saved) {
|
|
22997
|
-
setMdmsCards(Array.isArray(saved.mdmsCards) ? saved.mdmsCards : []);
|
|
22998
|
-
setAdsList(Array.isArray(saved.adsList) ? saved.adsList : []);
|
|
22999
|
-
setAdsScheduleMap(saved.adsScheduleMap || {});
|
|
23000
|
-
if (saved && typeof saved.globalScheduleEnabled !== "undefined") {
|
|
23001
|
-
if (!isGlobalActive) {
|
|
23002
|
-
setGlobalScheduleEnabled(!!saved.globalScheduleEnabled);
|
|
23003
|
-
if (saved.startDate) setValue("startDate", saved.startDate, {
|
|
23004
|
-
shouldValidate: false
|
|
23005
|
-
});
|
|
23006
|
-
if (saved.endDate) setValue("endDate", saved.endDate, {
|
|
23007
|
-
shouldValidate: false
|
|
23008
|
-
});
|
|
23009
|
-
if (saved.bookingFromTime) setValue("bookingFromTime", saved.bookingFromTime, {
|
|
23010
|
-
shouldValidate: false
|
|
23011
|
-
});
|
|
23012
|
-
if (saved.bookingToTime) setValue("bookingToTime", saved.bookingToTime, {
|
|
23013
|
-
shouldValidate: false
|
|
23014
|
-
});
|
|
23015
|
-
if (saved.globalScheduleEnabled) {
|
|
23016
|
-
applyGlobalToAll();
|
|
23017
|
-
}
|
|
23018
|
-
} else {
|
|
23019
|
-
if (global.startDate) setValue("startDate", global.startDate, {
|
|
23020
|
-
shouldValidate: false
|
|
23021
|
-
});
|
|
23022
|
-
if (global.endDate) setValue("endDate", global.endDate, {
|
|
23023
|
-
shouldValidate: false
|
|
23024
|
-
});
|
|
23025
|
-
if (global.bookingFromTime) setValue("bookingFromTime", global.bookingFromTime, {
|
|
23026
|
-
shouldValidate: false
|
|
23027
|
-
});
|
|
23028
|
-
if (global.bookingToTime) setValue("bookingToTime", global.bookingToTime, {
|
|
23029
|
-
shouldValidate: false
|
|
23030
|
-
});
|
|
23031
|
-
setGlobalScheduleEnabled(true);
|
|
23032
|
-
applyGlobalToAll();
|
|
23033
|
-
}
|
|
23034
|
-
}
|
|
23035
|
-
} else {
|
|
23036
|
-
setMdmsCards([]);
|
|
23037
|
-
setAdsList([]);
|
|
23038
|
-
setAdsScheduleMap({});
|
|
23039
|
-
}
|
|
23040
|
-
const locObj = findLocationByCode(val.code);
|
|
23041
|
-
const normalized = normalizeLocationToGeo(locObj);
|
|
23042
|
-
if (normalized) {
|
|
23043
|
-
setValue("geoLocation", normalized, {
|
|
23044
|
-
shouldValidate: true,
|
|
23045
|
-
shouldDirty: true
|
|
23046
|
-
});
|
|
23047
|
-
setPlaceNameState(normalized.formattedAddress);
|
|
23048
|
-
if (!watch("cartAddress")) setValue("cartAddress", normalized.formattedAddress);
|
|
23049
|
-
} else {
|
|
23050
|
-
setValue("geoLocation", null, {
|
|
23051
|
-
shouldValidate: false
|
|
23052
|
-
});
|
|
23053
|
-
setPlaceNameState("");
|
|
23054
|
-
}
|
|
22273
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
22274
|
+
t: t,
|
|
22275
|
+
data: item.slots,
|
|
22276
|
+
columns: makeColumns(item.ad),
|
|
22277
|
+
disableSort: true,
|
|
22278
|
+
isPaginationRequired: false,
|
|
22279
|
+
getCellProps: cell => ({
|
|
22280
|
+
style: {
|
|
22281
|
+
padding: "12px 14px",
|
|
22282
|
+
fontSize: "14px",
|
|
22283
|
+
borderBottom: "1px solid #f0f0f0",
|
|
22284
|
+
textAlign: "left",
|
|
22285
|
+
whiteSpace: "nowrap"
|
|
23055
22286
|
}
|
|
23056
|
-
})
|
|
22287
|
+
})
|
|
22288
|
+
})));
|
|
22289
|
+
}))));
|
|
22290
|
+
};
|
|
22291
|
+
|
|
22292
|
+
const AdCard = ({
|
|
22293
|
+
ad,
|
|
22294
|
+
idx,
|
|
22295
|
+
control,
|
|
22296
|
+
watch,
|
|
22297
|
+
t,
|
|
22298
|
+
onViewAvailability: _onViewAvailability = () => {},
|
|
22299
|
+
cartSlots: _cartSlots = [],
|
|
22300
|
+
openCart
|
|
22301
|
+
}) => {
|
|
22302
|
+
const todayISO = new Date().toISOString().split("T")[0];
|
|
22303
|
+
const startDateVal = watch(`ads.${idx}.startDate`) || "";
|
|
22304
|
+
const isAdded = _cartSlots.some(item => item.ad.id === ad.id && item.slots.length > 0);
|
|
22305
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22306
|
+
style: {
|
|
22307
|
+
width: 280,
|
|
22308
|
+
borderRadius: 8,
|
|
22309
|
+
padding: 9,
|
|
22310
|
+
background: "#fff",
|
|
22311
|
+
boxShadow: "0 4px 10px rgba(0,0,0,0.08)",
|
|
22312
|
+
display: "flex",
|
|
22313
|
+
flexDirection: "column",
|
|
22314
|
+
gap: 8
|
|
23057
22315
|
}
|
|
23058
|
-
}
|
|
22316
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23059
22317
|
style: {
|
|
23060
|
-
|
|
23061
|
-
|
|
22318
|
+
width: "100%",
|
|
22319
|
+
height: 120,
|
|
22320
|
+
borderRadius: 8,
|
|
22321
|
+
overflow: "hidden",
|
|
22322
|
+
background: "#f5f5f5"
|
|
22323
|
+
}
|
|
22324
|
+
}, ad.imageSrc || ad.photoURL ? /*#__PURE__*/React.createElement("img", {
|
|
22325
|
+
src: ad.imageSrc || ad.photoURL,
|
|
22326
|
+
alt: ad.name || `Ad ${ad.id}`,
|
|
22327
|
+
loading: "lazy",
|
|
22328
|
+
style: {
|
|
22329
|
+
width: "100%",
|
|
22330
|
+
height: "100%",
|
|
22331
|
+
objectFit: "cover"
|
|
23062
22332
|
}
|
|
23063
|
-
}
|
|
22333
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
23064
22334
|
style: {
|
|
23065
|
-
|
|
23066
|
-
|
|
22335
|
+
width: "100%",
|
|
22336
|
+
height: "100%",
|
|
22337
|
+
display: "flex",
|
|
22338
|
+
alignItems: "center",
|
|
22339
|
+
justifyContent: "center",
|
|
22340
|
+
color: "#aaa"
|
|
23067
22341
|
}
|
|
23068
|
-
},
|
|
22342
|
+
}, t("ADS_NO_IMAGE"))), /*#__PURE__*/React.createElement("div", {
|
|
23069
22343
|
style: {
|
|
23070
|
-
|
|
23071
|
-
|
|
23072
|
-
|
|
23073
|
-
|
|
22344
|
+
display: "flex",
|
|
22345
|
+
flexDirection: "column",
|
|
22346
|
+
gap: 6,
|
|
22347
|
+
fontSize: 13,
|
|
22348
|
+
color: "#444"
|
|
23074
22349
|
}
|
|
23075
22350
|
}, /*#__PURE__*/React.createElement("div", {
|
|
23076
22351
|
style: {
|
|
23077
22352
|
display: "flex",
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
marginBottom: 8
|
|
22353
|
+
justifyContent: "space-between",
|
|
22354
|
+
fontWeight: 600
|
|
23081
22355
|
}
|
|
23082
|
-
}, /*#__PURE__*/React.createElement("
|
|
22356
|
+
}, /*#__PURE__*/React.createElement("span", null, ad.name), /*#__PURE__*/React.createElement("span", {
|
|
23083
22357
|
style: {
|
|
23084
|
-
|
|
23085
|
-
marginRight: 8
|
|
22358
|
+
color: "#222"
|
|
23086
22359
|
}
|
|
23087
|
-
}, /*#__PURE__*/React.createElement("
|
|
23088
|
-
type: "checkbox",
|
|
23089
|
-
checked: globalScheduleEnabled,
|
|
23090
|
-
onChange: e => setGlobalSchedule(e.target.checked)
|
|
23091
|
-
}), " ", t ? t("USE_SAME_BOOKING_DATETIME_FOR_ALL_ADS") : "Use same booking date/time for all ads"), globalScheduleEnabled && /*#__PURE__*/React.createElement("div", {
|
|
22360
|
+
}, "\u20B9", ad.amount)), /*#__PURE__*/React.createElement("div", {
|
|
23092
22361
|
style: {
|
|
23093
|
-
|
|
23094
|
-
|
|
22362
|
+
display: "flex",
|
|
22363
|
+
justifyContent: "space-between"
|
|
23095
22364
|
}
|
|
23096
|
-
}, "
|
|
23097
|
-
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
required: globalScheduleEnabled ? "This field is required" : false
|
|
23101
|
-
},
|
|
23102
|
-
render: props => {
|
|
23103
|
-
const timeVal = watch("bookingFromTime") || nowHM;
|
|
23104
|
-
const datetimeVal = props.value ? `${props.value}T${timeVal}` : "";
|
|
23105
|
-
const placeholderVal = formatDisplay("");
|
|
23106
|
-
return /*#__PURE__*/React.createElement("input", {
|
|
23107
|
-
type: "datetime-local",
|
|
23108
|
-
min: `${tomorrowStr}T00:00`,
|
|
23109
|
-
value: datetimeVal,
|
|
23110
|
-
placeholder: placeholderVal,
|
|
23111
|
-
onChange: e => {
|
|
23112
|
-
const v = e.target.value;
|
|
23113
|
-
if (!v) {
|
|
23114
|
-
props.onChange("");
|
|
23115
|
-
setValue("bookingFromTime", "");
|
|
23116
|
-
return;
|
|
23117
|
-
}
|
|
23118
|
-
const [datePart, timePart] = v.split("T");
|
|
23119
|
-
props.onChange(datePart);
|
|
23120
|
-
setValue("bookingFromTime", timePart);
|
|
23121
|
-
if (globalScheduleEnabled) applyGlobalToAll();
|
|
23122
|
-
},
|
|
23123
|
-
onBlur: e => props.onBlur(e)
|
|
23124
|
-
});
|
|
22365
|
+
}, /*#__PURE__*/React.createElement("span", null, ad.locationCode), /*#__PURE__*/React.createElement("span", null, "Pole ", ad.poleNo)), /*#__PURE__*/React.createElement("div", {
|
|
22366
|
+
style: {
|
|
22367
|
+
display: "flex",
|
|
22368
|
+
justifyContent: "space-between"
|
|
23125
22369
|
}
|
|
23126
|
-
}
|
|
22370
|
+
}, /*#__PURE__*/React.createElement("span", null, ad.adType), /*#__PURE__*/React.createElement("span", {
|
|
23127
22371
|
style: {
|
|
23128
|
-
color: "red"
|
|
22372
|
+
color: "red",
|
|
22373
|
+
fontWeight: 500
|
|
23129
22374
|
}
|
|
23130
|
-
},
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
},
|
|
23136
|
-
render: props => {
|
|
23137
|
-
const timeVal = watch("bookingToTime") || nowHM;
|
|
23138
|
-
const minDate = watch("startDate") || tomorrowStr;
|
|
23139
|
-
const datetimeVal = props.value ? `${props.value}T${timeVal}` : "";
|
|
23140
|
-
const placeholderVal = formatDisplay("");
|
|
23141
|
-
return /*#__PURE__*/React.createElement("input", {
|
|
23142
|
-
type: "datetime-local",
|
|
23143
|
-
min: `${minDate}T00:00`,
|
|
23144
|
-
value: datetimeVal,
|
|
23145
|
-
placeholder: placeholderVal,
|
|
23146
|
-
onChange: e => {
|
|
23147
|
-
const v = e.target.value;
|
|
23148
|
-
if (!v) {
|
|
23149
|
-
props.onChange("");
|
|
23150
|
-
setValue("bookingToTime", "");
|
|
23151
|
-
return;
|
|
23152
|
-
}
|
|
23153
|
-
const [datePart, timePart] = v.split("T");
|
|
23154
|
-
props.onChange(datePart);
|
|
23155
|
-
setValue("bookingToTime", timePart);
|
|
23156
|
-
if (globalScheduleEnabled) applyGlobalToAll();
|
|
23157
|
-
},
|
|
23158
|
-
onBlur: e => props.onBlur(e)
|
|
23159
|
-
});
|
|
22375
|
+
}, ad.light))), /*#__PURE__*/React.createElement("div", {
|
|
22376
|
+
style: {
|
|
22377
|
+
fontSize: 12,
|
|
22378
|
+
color: "#666",
|
|
22379
|
+
marginTop: 6
|
|
23160
22380
|
}
|
|
23161
|
-
}),
|
|
22381
|
+
}, t("ADS_START_DATE_TIME")), /*#__PURE__*/React.createElement("div", {
|
|
23162
22382
|
style: {
|
|
23163
|
-
|
|
22383
|
+
display: "flex",
|
|
22384
|
+
gap: 8
|
|
23164
22385
|
}
|
|
23165
|
-
},
|
|
22386
|
+
}, /*#__PURE__*/React.createElement(Controller, {
|
|
23166
22387
|
control: control,
|
|
23167
|
-
name:
|
|
23168
|
-
rules: {
|
|
23169
|
-
required: globalScheduleEnabled ? "Start time is required" : false
|
|
23170
|
-
},
|
|
22388
|
+
name: `ads.${idx}.startDate`,
|
|
23171
22389
|
render: props => /*#__PURE__*/React.createElement("input", {
|
|
23172
|
-
type: "
|
|
22390
|
+
type: "date",
|
|
22391
|
+
min: todayISO,
|
|
23173
22392
|
value: props.value || "",
|
|
23174
22393
|
onChange: e => props.onChange(e.target.value),
|
|
23175
|
-
|
|
22394
|
+
style: {
|
|
22395
|
+
flex: 1,
|
|
22396
|
+
padding: "6px 8px",
|
|
22397
|
+
fontSize: 13,
|
|
22398
|
+
borderRadius: 6,
|
|
22399
|
+
border: "1px solid #ccc"
|
|
22400
|
+
}
|
|
23176
22401
|
})
|
|
23177
22402
|
}), /*#__PURE__*/React.createElement(Controller, {
|
|
23178
22403
|
control: control,
|
|
23179
|
-
name:
|
|
23180
|
-
rules: {
|
|
23181
|
-
required: globalScheduleEnabled ? "End time is required" : false,
|
|
23182
|
-
validate: toTime => {
|
|
23183
|
-
if (!globalScheduleEnabled) return true;
|
|
23184
|
-
const fromDate = getValues("startDate") || "";
|
|
23185
|
-
const toDate = getValues("endDate") || "";
|
|
23186
|
-
const fromTime = getValues("bookingFromTime") || "";
|
|
23187
|
-
const bookingFrom = fromDate && fromTime ? `${fromDate}T${fromTime}` : "";
|
|
23188
|
-
const bookingTo = toDate && toTime ? `${toDate}T${toTime}` : "";
|
|
23189
|
-
const err = validateScheduleForAdd(bookingFrom, bookingTo);
|
|
23190
|
-
return err ? err : true;
|
|
23191
|
-
}
|
|
23192
|
-
},
|
|
22404
|
+
name: `ads.${idx}.startTime`,
|
|
23193
22405
|
render: props => /*#__PURE__*/React.createElement("input", {
|
|
23194
|
-
type: "
|
|
22406
|
+
type: "time",
|
|
23195
22407
|
value: props.value || "",
|
|
23196
22408
|
onChange: e => props.onChange(e.target.value),
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
22409
|
+
style: {
|
|
22410
|
+
width: 110,
|
|
22411
|
+
padding: "6px 8px",
|
|
22412
|
+
fontSize: 13,
|
|
22413
|
+
borderRadius: 6,
|
|
22414
|
+
border: "1px solid #ccc"
|
|
23200
22415
|
}
|
|
23201
22416
|
})
|
|
23202
|
-
})),
|
|
23203
|
-
style: {
|
|
23204
|
-
margin: "12px 0"
|
|
23205
|
-
}
|
|
23206
|
-
}, errors.bookingToTime && /*#__PURE__*/React.createElement("p", {
|
|
23207
|
-
style: {
|
|
23208
|
-
color: "red"
|
|
23209
|
-
}
|
|
23210
|
-
}, errors.bookingToTime.message), errors.scheduleValidation && /*#__PURE__*/React.createElement("p", {
|
|
23211
|
-
style: {
|
|
23212
|
-
color: "red",
|
|
23213
|
-
marginTop: "4px"
|
|
23214
|
-
}
|
|
23215
|
-
}, errors.scheduleValidation.message), /*#__PURE__*/React.createElement("div", {
|
|
22417
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
23216
22418
|
style: {
|
|
23217
|
-
|
|
23218
|
-
|
|
22419
|
+
fontSize: 12,
|
|
22420
|
+
color: "#666",
|
|
22421
|
+
marginTop: 6
|
|
23219
22422
|
}
|
|
23220
|
-
}, t
|
|
22423
|
+
}, t("ADS_END_DATE_TIME")), /*#__PURE__*/React.createElement("div", {
|
|
23221
22424
|
style: {
|
|
23222
22425
|
display: "flex",
|
|
23223
|
-
|
|
23224
|
-
gap: 12
|
|
22426
|
+
gap: 8
|
|
23225
22427
|
}
|
|
23226
|
-
},
|
|
23227
|
-
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
style: {
|
|
23231
|
-
width: 280,
|
|
23232
|
-
border: "1px solid #eee",
|
|
23233
|
-
borderRadius: 8,
|
|
23234
|
-
padding: 8,
|
|
23235
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.04)",
|
|
23236
|
-
background: "#fff",
|
|
23237
|
-
display: "flex",
|
|
23238
|
-
flexDirection: "column",
|
|
23239
|
-
gap: 8
|
|
23240
|
-
}
|
|
23241
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23242
|
-
style: {
|
|
23243
|
-
width: "100%",
|
|
23244
|
-
display: "flex",
|
|
23245
|
-
justifyContent: "center"
|
|
23246
|
-
}
|
|
23247
|
-
}, ad.imageSrc ? /*#__PURE__*/React.createElement("img", {
|
|
23248
|
-
src: ad.imageSrc,
|
|
23249
|
-
alt: ad.name,
|
|
23250
|
-
loading: "lazy",
|
|
23251
|
-
style: {
|
|
23252
|
-
width: "100%",
|
|
23253
|
-
height: 140,
|
|
23254
|
-
objectFit: "cover",
|
|
23255
|
-
borderRadius: 6
|
|
23256
|
-
}
|
|
23257
|
-
}) : /*#__PURE__*/React.createElement("div", {
|
|
23258
|
-
style: {
|
|
23259
|
-
width: "100%",
|
|
23260
|
-
height: 140,
|
|
23261
|
-
background: "#f5f5f5",
|
|
23262
|
-
borderRadius: 6
|
|
23263
|
-
}
|
|
23264
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
23265
|
-
style: {
|
|
23266
|
-
paddingTop: 4
|
|
23267
|
-
}
|
|
23268
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23269
|
-
style: {
|
|
23270
|
-
fontSize: 14,
|
|
23271
|
-
fontWeight: 700,
|
|
23272
|
-
lineHeight: "1.1"
|
|
23273
|
-
}
|
|
23274
|
-
}, ad.name || `Ad ${ad.id}`), /*#__PURE__*/React.createElement("div", {
|
|
23275
|
-
style: {
|
|
23276
|
-
marginTop: 6,
|
|
23277
|
-
fontSize: 12,
|
|
23278
|
-
color: "#666",
|
|
23279
|
-
display: "grid",
|
|
23280
|
-
gridTemplateColumns: "auto 1fr",
|
|
23281
|
-
gap: "4px 8px"
|
|
23282
|
-
}
|
|
23283
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23284
|
-
style: {
|
|
23285
|
-
fontWeight: 600
|
|
23286
|
-
}
|
|
23287
|
-
}, "ID:"), /*#__PURE__*/React.createElement("div", null, ad.id), /*#__PURE__*/React.createElement("div", {
|
|
23288
|
-
style: {
|
|
23289
|
-
fontWeight: 600
|
|
23290
|
-
}
|
|
23291
|
-
}, "Pole No:"), /*#__PURE__*/React.createElement("div", null, ad.poleNo), /*#__PURE__*/React.createElement("div", {
|
|
23292
|
-
style: {
|
|
23293
|
-
fontWeight: 600
|
|
23294
|
-
}
|
|
23295
|
-
}, "Type:"), /*#__PURE__*/React.createElement("div", null, ad.adType), /*#__PURE__*/React.createElement("div", {
|
|
23296
|
-
style: {
|
|
23297
|
-
fontWeight: 600
|
|
23298
|
-
}
|
|
23299
|
-
}, "Size:"), /*#__PURE__*/React.createElement("div", null, ad.width, " x ", ad.height), /*#__PURE__*/React.createElement("div", {
|
|
23300
|
-
style: {
|
|
23301
|
-
fontWeight: 600
|
|
23302
|
-
}
|
|
23303
|
-
}, "Amount:"), /*#__PURE__*/React.createElement("div", null, "\u20B9", ad.amount), /*#__PURE__*/React.createElement("div", {
|
|
23304
|
-
style: {
|
|
23305
|
-
fontWeight: 600
|
|
23306
|
-
}
|
|
23307
|
-
}, "Available:"), /*#__PURE__*/React.createElement("div", null, String(ad.available)))), /*#__PURE__*/React.createElement("div", {
|
|
23308
|
-
style: {
|
|
23309
|
-
display: "flex",
|
|
23310
|
-
flexDirection: "column",
|
|
23311
|
-
gap: 6
|
|
23312
|
-
}
|
|
23313
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23314
|
-
style: {
|
|
23315
|
-
fontSize: 11,
|
|
23316
|
-
color: "#666"
|
|
23317
|
-
}
|
|
23318
|
-
}, "Start"), /*#__PURE__*/React.createElement("div", {
|
|
23319
|
-
style: {
|
|
23320
|
-
display: "flex",
|
|
23321
|
-
gap: 6
|
|
23322
|
-
}
|
|
23323
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
23324
|
-
type: "date",
|
|
23325
|
-
min: tomorrowStr,
|
|
23326
|
-
value: ((_adsScheduleMap$ad$id = adsScheduleMap[ad.id]) === null || _adsScheduleMap$ad$id === void 0 ? void 0 : _adsScheduleMap$ad$id.startDate) || (globalScheduleEnabled ? getValues("startDate") || "" : ""),
|
|
23327
|
-
onChange: e => {
|
|
23328
|
-
if (globalScheduleEnabled) return;
|
|
23329
|
-
const newStart = e.target.value;
|
|
23330
|
-
const prevEntry = adsScheduleMap[ad.id] || {};
|
|
23331
|
-
const prevEndDate = prevEntry.endDate;
|
|
23332
|
-
const adjustedEndDate = prevEndDate && prevEndDate < newStart ? newStart : prevEndDate;
|
|
23333
|
-
const newEntry = {
|
|
23334
|
-
...(prevEntry || {}),
|
|
23335
|
-
startDate: newStart,
|
|
23336
|
-
endDate: adjustedEndDate
|
|
23337
|
-
};
|
|
23338
|
-
setAdsScheduleMap(prev => ({
|
|
23339
|
-
...prev,
|
|
23340
|
-
[ad.id]: newEntry
|
|
23341
|
-
}));
|
|
23342
|
-
validateAdSchedule(ad.id, newEntry);
|
|
23343
|
-
},
|
|
23344
|
-
disabled: globalScheduleEnabled,
|
|
23345
|
-
style: {
|
|
23346
|
-
flex: 1,
|
|
23347
|
-
padding: "6px 8px",
|
|
23348
|
-
fontSize: 12,
|
|
23349
|
-
borderRadius: 4,
|
|
23350
|
-
border: "1px solid #ddd"
|
|
23351
|
-
}
|
|
23352
|
-
}), /*#__PURE__*/React.createElement("input", {
|
|
23353
|
-
type: "time",
|
|
23354
|
-
value: ((_adsScheduleMap$ad$id2 = adsScheduleMap[ad.id]) === null || _adsScheduleMap$ad$id2 === void 0 ? void 0 : _adsScheduleMap$ad$id2.startTime) || (globalScheduleEnabled ? getValues("bookingFromTime") || "" : ""),
|
|
23355
|
-
onChange: e => {
|
|
23356
|
-
if (globalScheduleEnabled) return;
|
|
23357
|
-
const newStartTime = e.target.value;
|
|
23358
|
-
const prevEntry = adsScheduleMap[ad.id] || {};
|
|
23359
|
-
const newEntry = {
|
|
23360
|
-
...(prevEntry || {}),
|
|
23361
|
-
startTime: newStartTime
|
|
23362
|
-
};
|
|
23363
|
-
setAdsScheduleMap(prev => ({
|
|
23364
|
-
...prev,
|
|
23365
|
-
[ad.id]: newEntry
|
|
23366
|
-
}));
|
|
23367
|
-
validateAdSchedule(ad.id, newEntry);
|
|
23368
|
-
},
|
|
23369
|
-
disabled: globalScheduleEnabled,
|
|
23370
|
-
style: {
|
|
23371
|
-
width: 100,
|
|
23372
|
-
padding: "6px 8px",
|
|
23373
|
-
fontSize: 12,
|
|
23374
|
-
borderRadius: 4,
|
|
23375
|
-
border: "1px solid #ddd"
|
|
23376
|
-
}
|
|
23377
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
23378
|
-
style: {
|
|
23379
|
-
height: 8
|
|
23380
|
-
}
|
|
23381
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
23382
|
-
style: {
|
|
23383
|
-
fontSize: 11,
|
|
23384
|
-
color: "#666"
|
|
23385
|
-
}
|
|
23386
|
-
}, "End"), /*#__PURE__*/React.createElement("div", {
|
|
23387
|
-
style: {
|
|
23388
|
-
display: "flex",
|
|
23389
|
-
gap: 6
|
|
23390
|
-
}
|
|
23391
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
22428
|
+
}, /*#__PURE__*/React.createElement(Controller, {
|
|
22429
|
+
control: control,
|
|
22430
|
+
name: `ads.${idx}.endDate`,
|
|
22431
|
+
render: props => /*#__PURE__*/React.createElement("input", {
|
|
23392
22432
|
type: "date",
|
|
23393
|
-
min:
|
|
23394
|
-
value:
|
|
23395
|
-
onChange: e =>
|
|
23396
|
-
if (globalScheduleEnabled) return;
|
|
23397
|
-
const newEnd = e.target.value;
|
|
23398
|
-
const prevEntry = adsScheduleMap[ad.id] || {};
|
|
23399
|
-
const safeEnd = prevEntry.startDate && newEnd < prevEntry.startDate ? prevEntry.startDate : newEnd;
|
|
23400
|
-
const newEntry = {
|
|
23401
|
-
...(prevEntry || {}),
|
|
23402
|
-
endDate: safeEnd
|
|
23403
|
-
};
|
|
23404
|
-
setAdsScheduleMap(prev => ({
|
|
23405
|
-
...prev,
|
|
23406
|
-
[ad.id]: newEntry
|
|
23407
|
-
}));
|
|
23408
|
-
validateAdSchedule(ad.id, newEntry);
|
|
23409
|
-
},
|
|
23410
|
-
disabled: globalScheduleEnabled,
|
|
22433
|
+
min: startDateVal || todayISO,
|
|
22434
|
+
value: props.value || "",
|
|
22435
|
+
onChange: e => props.onChange(e.target.value),
|
|
23411
22436
|
style: {
|
|
23412
22437
|
flex: 1,
|
|
23413
22438
|
padding: "6px 8px",
|
|
23414
|
-
fontSize:
|
|
23415
|
-
borderRadius:
|
|
23416
|
-
border: "1px solid #
|
|
22439
|
+
fontSize: 13,
|
|
22440
|
+
borderRadius: 6,
|
|
22441
|
+
border: "1px solid #ccc"
|
|
23417
22442
|
}
|
|
23418
|
-
})
|
|
22443
|
+
})
|
|
22444
|
+
}), /*#__PURE__*/React.createElement(Controller, {
|
|
22445
|
+
control: control,
|
|
22446
|
+
name: `ads.${idx}.endTime`,
|
|
22447
|
+
render: props => /*#__PURE__*/React.createElement("input", {
|
|
23419
22448
|
type: "time",
|
|
23420
|
-
value:
|
|
23421
|
-
onChange: e =>
|
|
23422
|
-
if (globalScheduleEnabled) return;
|
|
23423
|
-
const newEndTime = e.target.value;
|
|
23424
|
-
const prevEntry = adsScheduleMap[ad.id] || {};
|
|
23425
|
-
const newEntry = {
|
|
23426
|
-
...(prevEntry || {}),
|
|
23427
|
-
endTime: newEndTime
|
|
23428
|
-
};
|
|
23429
|
-
setAdsScheduleMap(prev => ({
|
|
23430
|
-
...prev,
|
|
23431
|
-
[ad.id]: newEntry
|
|
23432
|
-
}));
|
|
23433
|
-
validateAdSchedule(ad.id, newEntry);
|
|
23434
|
-
},
|
|
23435
|
-
disabled: globalScheduleEnabled,
|
|
22449
|
+
value: props.value || "",
|
|
22450
|
+
onChange: e => props.onChange(e.target.value),
|
|
23436
22451
|
style: {
|
|
23437
|
-
width:
|
|
22452
|
+
width: 110,
|
|
23438
22453
|
padding: "6px 8px",
|
|
23439
|
-
fontSize:
|
|
23440
|
-
borderRadius:
|
|
23441
|
-
border: "1px solid #
|
|
23442
|
-
}
|
|
23443
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
23444
|
-
style: {
|
|
23445
|
-
fontSize: 11,
|
|
23446
|
-
color: "#666",
|
|
23447
|
-
marginTop: 4
|
|
22454
|
+
fontSize: 13,
|
|
22455
|
+
borderRadius: 6,
|
|
22456
|
+
border: "1px solid #ccc"
|
|
23448
22457
|
}
|
|
23449
|
-
}
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
22458
|
+
})
|
|
22459
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
22460
|
+
style: {
|
|
22461
|
+
display: "flex",
|
|
22462
|
+
gap: 8,
|
|
22463
|
+
marginTop: 6
|
|
22464
|
+
}
|
|
22465
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
22466
|
+
type: "button",
|
|
22467
|
+
onClick: () => _onViewAvailability(ad, {
|
|
22468
|
+
startDate: watch(`ads.${idx}.startDate`),
|
|
22469
|
+
endDate: watch(`ads.${idx}.endDate`),
|
|
22470
|
+
startTime: watch(`ads.${idx}.startTime`),
|
|
22471
|
+
endTime: watch(`ads.${idx}.endTime`)
|
|
22472
|
+
}),
|
|
22473
|
+
style: {
|
|
22474
|
+
flex: 1,
|
|
22475
|
+
padding: "6px 12px",
|
|
22476
|
+
borderRadius: 6,
|
|
22477
|
+
background: "#2947a3",
|
|
22478
|
+
color: "#fff",
|
|
22479
|
+
border: "none",
|
|
22480
|
+
cursor: "pointer",
|
|
22481
|
+
fontSize: 14
|
|
22482
|
+
}
|
|
22483
|
+
}, t("ADS_VIEW_AVAILABIITY"), "\uD83D\uDC41\uFE0F"), isAdded && /*#__PURE__*/React.createElement("button", {
|
|
22484
|
+
type: "button",
|
|
22485
|
+
onClick: openCart,
|
|
22486
|
+
style: {
|
|
22487
|
+
width: 110,
|
|
22488
|
+
padding: "6px 12px",
|
|
22489
|
+
borderRadius: 6,
|
|
22490
|
+
background: "#28a745",
|
|
22491
|
+
color: "#fff",
|
|
22492
|
+
fontSize: 14,
|
|
22493
|
+
fontWeight: 600,
|
|
22494
|
+
display: "flex",
|
|
22495
|
+
alignItems: "center",
|
|
22496
|
+
justifyContent: "center",
|
|
22497
|
+
cursor: "pointer"
|
|
22498
|
+
}
|
|
22499
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
22500
|
+
style: {
|
|
22501
|
+
color: "black"
|
|
22502
|
+
}
|
|
22503
|
+
}, "\uD83D\uDED2"), t("ADS_IN_CART"))));
|
|
22504
|
+
};
|
|
22505
|
+
|
|
22506
|
+
const ADSCitizenSecond = ({
|
|
22507
|
+
onGoBack,
|
|
22508
|
+
goNext,
|
|
22509
|
+
currentStepData,
|
|
22510
|
+
t
|
|
22511
|
+
}) => {
|
|
22512
|
+
var _window$location, _window$location$href;
|
|
22513
|
+
const stateId = Digit.ULBService.getStateId();
|
|
22514
|
+
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
|
+
const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
|
|
22516
|
+
const [adsForLocation, setAdsForLocation] = useState([]);
|
|
22517
|
+
const [showToast, setShowToast] = useState(null);
|
|
22518
|
+
const [visibleCount, setVisibleCount] = useState(6);
|
|
22519
|
+
const [showModal, setShowModal] = useState(false);
|
|
22520
|
+
const [showCart, setShowCart] = useState(false);
|
|
22521
|
+
const [selectedAd, setSelectedAd] = useState(null);
|
|
22522
|
+
const [dateRange, setDateRange] = useState({
|
|
22523
|
+
startDate: "",
|
|
22524
|
+
endDate: ""
|
|
22525
|
+
});
|
|
22526
|
+
const {
|
|
22527
|
+
data: mdmsAds = []
|
|
22528
|
+
} = Digit.Hooks.ads.useADSAllMDMS(stateId);
|
|
22529
|
+
const {
|
|
22530
|
+
data: location = []
|
|
22531
|
+
} = Digit.Hooks.ads.useADSLocationMDMS(stateId);
|
|
22532
|
+
const [cartSlots, setCartSlots] = useState([]);
|
|
22533
|
+
const dispatch = useDispatch();
|
|
22534
|
+
const {
|
|
22535
|
+
control,
|
|
22536
|
+
handleSubmit,
|
|
22537
|
+
setValue,
|
|
22538
|
+
watch,
|
|
22539
|
+
formState: {
|
|
22540
|
+
errors
|
|
22541
|
+
}
|
|
22542
|
+
} = useForm({
|
|
22543
|
+
defaultValues: {
|
|
22544
|
+
siteId: null,
|
|
22545
|
+
geoLocation: null,
|
|
22546
|
+
ads: []
|
|
22547
|
+
}
|
|
22548
|
+
});
|
|
22549
|
+
const locationOptions = useMemo(() => {
|
|
22550
|
+
if (!mdmsAds || !location) return [];
|
|
22551
|
+
const locationMap = new Map();
|
|
22552
|
+
location.forEach(loc => {
|
|
22553
|
+
if (loc !== null && loc !== void 0 && loc.code) {
|
|
22554
|
+
locationMap.set(loc.code, loc);
|
|
23454
22555
|
}
|
|
23455
|
-
}
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
22556
|
+
});
|
|
22557
|
+
const uniqueCodes = new Set(mdmsAds.map(a => a.locationCode).filter(Boolean));
|
|
22558
|
+
return Array.from(uniqueCodes).map(code => locationMap.get(code)).filter(Boolean);
|
|
22559
|
+
}, [mdmsAds, location]);
|
|
22560
|
+
useEffect(() => {
|
|
22561
|
+
setVisibleCount(6);
|
|
22562
|
+
}, [adsForLocation.length]);
|
|
22563
|
+
const filterAds = selected => {
|
|
22564
|
+
var _locObj$geo_tag, _locObj$geo_tag2;
|
|
22565
|
+
const filtered = mdmsAds.filter(ad => String(ad.locationCode) === String(selected.code));
|
|
22566
|
+
setAdsForLocation(filtered);
|
|
22567
|
+
setValue("ads", []);
|
|
22568
|
+
const locObj = Array.isArray(location) && location.find(l => String(l.code) === String(selected.code)) || null;
|
|
22569
|
+
if (locObj !== null && locObj !== void 0 && (_locObj$geo_tag = locObj.geo_tag) !== null && _locObj$geo_tag !== void 0 && _locObj$geo_tag.latitude && locObj !== null && locObj !== void 0 && (_locObj$geo_tag2 = locObj.geo_tag) !== null && _locObj$geo_tag2 !== void 0 && _locObj$geo_tag2.longitude) {
|
|
22570
|
+
setValue("geoLocation", {
|
|
22571
|
+
formattedAddress: locObj.name || selected.code,
|
|
22572
|
+
latitude: locObj.geo_tag.latitude,
|
|
22573
|
+
longitude: locObj.geo_tag.longitude,
|
|
22574
|
+
lat: locObj.geo_tag.latitude,
|
|
22575
|
+
lng: locObj.geo_tag.longitude,
|
|
22576
|
+
placeId: locObj.locationCode
|
|
22577
|
+
});
|
|
22578
|
+
}
|
|
22579
|
+
};
|
|
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
|
+
const areCartSlotsEqual = (a = [], b = []) => {
|
|
22602
|
+
if (a.length !== b.length) return false;
|
|
22603
|
+
const sortByAd = arr => [...arr].sort((x, y) => String(x.ad.id).localeCompare(String(y.ad.id)));
|
|
22604
|
+
const sortedA = sortByAd(a);
|
|
22605
|
+
const sortedB = sortByAd(b);
|
|
22606
|
+
return sortedA.every((item, idx) => {
|
|
22607
|
+
const other = sortedB[idx];
|
|
22608
|
+
if (String(item.ad.id) !== String(other.ad.id)) return false;
|
|
22609
|
+
const slotsA = item.slots.map(s => s.bookingDate).sort();
|
|
22610
|
+
const slotsB = other.slots.map(s => s.bookingDate).sort();
|
|
22611
|
+
if (slotsA.length !== slotsB.length) return false;
|
|
22612
|
+
return slotsA.every((date, i) => date === slotsB[i]);
|
|
22613
|
+
});
|
|
22614
|
+
};
|
|
22615
|
+
const onSubmit = async data => {
|
|
22616
|
+
var _currentStepData$ads;
|
|
22617
|
+
if (cartSlots.length === 0) {
|
|
22618
|
+
setShowToast({
|
|
22619
|
+
label: t("ADS_ONE_AD_ATLEAST"),
|
|
22620
|
+
error: true
|
|
22621
|
+
});
|
|
22622
|
+
return;
|
|
22623
|
+
}
|
|
22624
|
+
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);
|
|
22626
|
+
if (unchanged) {
|
|
22627
|
+
goNext(cartSlots);
|
|
22628
|
+
return;
|
|
23461
22629
|
}
|
|
23462
|
-
}
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
22630
|
+
}
|
|
22631
|
+
const enrichedSlots = (cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.flatMap(item => item.slots.map(slot => ({
|
|
22632
|
+
...slot,
|
|
22633
|
+
isTimerRequired: true
|
|
22634
|
+
})))) ?? [];
|
|
22635
|
+
const payload = {
|
|
22636
|
+
advertisementSlotSearchCriteria: enrichedSlots
|
|
22637
|
+
};
|
|
22638
|
+
try {
|
|
22639
|
+
const response = await Digit.ADSServices.slot_search(payload, tenantId);
|
|
22640
|
+
if (response) {
|
|
22641
|
+
const expiry = Date.now() + 30 * 60 * 1000;
|
|
22642
|
+
dispatch(UPDATE_ADSNewApplication_FORM("reservationExpiry", expiry));
|
|
22643
|
+
goNext(cartSlots);
|
|
22644
|
+
} else {
|
|
22645
|
+
setShowToast({
|
|
22646
|
+
label: t("COMMON_SOMETHING_WENT_WRONG_LABEL"),
|
|
22647
|
+
error: true
|
|
22648
|
+
});
|
|
23471
22649
|
}
|
|
23472
|
-
}
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
|
|
22650
|
+
} catch (error) {
|
|
22651
|
+
setShowToast({
|
|
22652
|
+
label: t("COMMON_SOMETHING_WENT_WRONG_LABEL"),
|
|
22653
|
+
error: true
|
|
22654
|
+
});
|
|
22655
|
+
}
|
|
22656
|
+
};
|
|
22657
|
+
useEffect(() => {
|
|
22658
|
+
const seeded = adsForLocation.map(() => ({
|
|
22659
|
+
startDate: "",
|
|
22660
|
+
startTime: "",
|
|
22661
|
+
endDate: "",
|
|
22662
|
+
endTime: ""
|
|
22663
|
+
}));
|
|
22664
|
+
setValue("ads", seeded, {
|
|
22665
|
+
shouldValidate: false,
|
|
22666
|
+
shouldDirty: false
|
|
22667
|
+
});
|
|
22668
|
+
}, [adsForLocation, setValue]);
|
|
22669
|
+
useEffect(() => {
|
|
22670
|
+
if (showToast) {
|
|
22671
|
+
const timer = setTimeout(() => setShowToast(null), 2000);
|
|
22672
|
+
return () => clearTimeout(timer);
|
|
22673
|
+
}
|
|
22674
|
+
}, [showToast]);
|
|
22675
|
+
const handleViewAvailability = (ad, {
|
|
22676
|
+
startDate,
|
|
22677
|
+
endDate,
|
|
22678
|
+
startTime,
|
|
22679
|
+
endTime
|
|
22680
|
+
}) => {
|
|
22681
|
+
const err = validateSchedule({
|
|
22682
|
+
startDate,
|
|
22683
|
+
endDate,
|
|
22684
|
+
startTime,
|
|
22685
|
+
endTime
|
|
22686
|
+
});
|
|
22687
|
+
if (err) {
|
|
22688
|
+
setShowToast({
|
|
22689
|
+
label: err,
|
|
22690
|
+
error: true
|
|
22691
|
+
});
|
|
22692
|
+
return;
|
|
22693
|
+
}
|
|
22694
|
+
const locationName = location.find(loc => loc.code === (ad === null || ad === void 0 ? void 0 : ad.locationCode));
|
|
22695
|
+
setSelectedAd({
|
|
22696
|
+
...ad,
|
|
22697
|
+
locationName,
|
|
22698
|
+
startDate,
|
|
22699
|
+
endDate
|
|
22700
|
+
});
|
|
22701
|
+
setDateRange({
|
|
22702
|
+
startDate,
|
|
22703
|
+
endDate,
|
|
22704
|
+
startTime,
|
|
22705
|
+
endTime
|
|
22706
|
+
});
|
|
22707
|
+
setShowModal(true);
|
|
22708
|
+
};
|
|
22709
|
+
const handleAddToCart = (slots, ad) => {
|
|
22710
|
+
setCartSlots(prev => {
|
|
22711
|
+
const existing = prev.find(item => item.ad.id === ad.id);
|
|
22712
|
+
let updated;
|
|
22713
|
+
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
|
+
updated = prev.map(item => item.ad.id === ad.id ? {
|
|
22738
|
+
...item,
|
|
22739
|
+
slots: updatedSlots
|
|
22740
|
+
} : item);
|
|
22741
|
+
} 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) {
|
|
23507
22750
|
setShowToast({
|
|
23508
|
-
|
|
23509
|
-
|
|
22751
|
+
label: `Added ${addSlots.length} slot(s) to ${ad.name}`,
|
|
22752
|
+
error: false
|
|
23510
22753
|
});
|
|
23511
|
-
|
|
22754
|
+
updated = [...prev, {
|
|
22755
|
+
ad,
|
|
22756
|
+
slots: addSlots
|
|
22757
|
+
}];
|
|
22758
|
+
} else {
|
|
22759
|
+
updated = prev;
|
|
23512
22760
|
}
|
|
23513
|
-
clearErrors("scheduleValidation");
|
|
23514
|
-
const locForAd = findLocationByCode ? findLocationByCode(ad.locationCode) : null;
|
|
23515
|
-
const normalizedGeoForAd = typeof normalizeLocationToGeo === "function" && locForAd ? normalizeLocationToGeo(locForAd) : ad.locationCode;
|
|
23516
|
-
const card = {
|
|
23517
|
-
mdmsId: ad.id,
|
|
23518
|
-
poleNo: ad.poleNo,
|
|
23519
|
-
name: ad.name,
|
|
23520
|
-
adType: ad.adType,
|
|
23521
|
-
width: ad.width,
|
|
23522
|
-
height: ad.height,
|
|
23523
|
-
amount: ad.amount,
|
|
23524
|
-
light: ad === null || ad === void 0 ? void 0 : ad.light,
|
|
23525
|
-
available: ad.available,
|
|
23526
|
-
locationCode: ad.locationCode,
|
|
23527
|
-
geoLocation: normalizedGeoForAd,
|
|
23528
|
-
schedules: [{
|
|
23529
|
-
startDatetime: start,
|
|
23530
|
-
endDatetime: end
|
|
23531
|
-
}],
|
|
23532
|
-
addedByUser: true
|
|
23533
|
-
};
|
|
23534
|
-
setMdmsCards(prev => [...prev, card]);
|
|
23535
|
-
},
|
|
23536
|
-
disabled: !!adsScheduleErrors[ad.id],
|
|
23537
|
-
style: {
|
|
23538
|
-
padding: "6px 10px",
|
|
23539
|
-
borderRadius: 6,
|
|
23540
|
-
border: "none",
|
|
23541
|
-
background: !!adsScheduleErrors[ad.id] ? "#ccc" : "#0b74de",
|
|
23542
|
-
color: "#fff",
|
|
23543
|
-
cursor: !!adsScheduleErrors[ad.id] ? "not-allowed" : "pointer"
|
|
23544
|
-
}
|
|
23545
|
-
}, t ? t("Add") : "Add")), /*#__PURE__*/React.createElement("div", null, mdmsCards.find(p => String(p.mdmsId) === String(ad.id)) && /*#__PURE__*/React.createElement("span", {
|
|
23546
|
-
style: {
|
|
23547
|
-
display: "inline-flex",
|
|
23548
|
-
alignItems: "center",
|
|
23549
|
-
gap: 6,
|
|
23550
|
-
color: "green",
|
|
23551
|
-
fontWeight: 700
|
|
23552
|
-
}
|
|
23553
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
23554
|
-
style: {
|
|
23555
|
-
fontSize: 14
|
|
23556
22761
|
}
|
|
23557
|
-
|
|
23558
|
-
|
|
23559
|
-
|
|
23560
|
-
|
|
23561
|
-
|
|
22762
|
+
return updated;
|
|
22763
|
+
});
|
|
22764
|
+
};
|
|
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
|
+
useEffect(() => {
|
|
22776
|
+
var _currentStepData$ads2;
|
|
22777
|
+
if ((currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$ads2 = currentStepData.ads) === null || _currentStepData$ads2 === void 0 ? void 0 : _currentStepData$ads2.length) > 0) {
|
|
22778
|
+
var _currentStepData$ads$, _currentStepData$ads$2, _matchedOption$geo_ta, _matchedOption$geo_ta2;
|
|
22779
|
+
setCartSlots(currentStepData.ads);
|
|
22780
|
+
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);
|
|
22782
|
+
if (matchedOption) {
|
|
22783
|
+
setValue("siteId", matchedOption);
|
|
22784
|
+
filterAds(matchedOption);
|
|
22785
|
+
}
|
|
22786
|
+
if (matchedOption !== null && matchedOption !== void 0 && (_matchedOption$geo_ta = matchedOption.geo_tag) !== null && _matchedOption$geo_ta !== void 0 && _matchedOption$geo_ta.latitude && matchedOption !== null && matchedOption !== void 0 && (_matchedOption$geo_ta2 = matchedOption.geo_tag) !== null && _matchedOption$geo_ta2 !== void 0 && _matchedOption$geo_ta2.longitude) {
|
|
22787
|
+
setValue("geoLocation", {
|
|
22788
|
+
formattedAddress: matchedOption.name,
|
|
22789
|
+
latitude: matchedOption.geo_tag.latitude,
|
|
22790
|
+
longitude: matchedOption.geo_tag.longitude,
|
|
22791
|
+
lat: matchedOption.geo_tag.latitude,
|
|
22792
|
+
lng: matchedOption.geo_tag.longitude,
|
|
22793
|
+
placeId: matchedOption.code
|
|
22794
|
+
});
|
|
23562
22795
|
}
|
|
23563
|
-
}
|
|
23564
|
-
|
|
23565
|
-
|
|
23566
|
-
|
|
22796
|
+
}
|
|
22797
|
+
}, [currentStepData, locationOptions]);
|
|
22798
|
+
const errorStyle = {
|
|
22799
|
+
marginTop: "-18px",
|
|
22800
|
+
color: "red"
|
|
22801
|
+
};
|
|
22802
|
+
const mandatoryStyle = {
|
|
22803
|
+
color: "red"
|
|
22804
|
+
};
|
|
22805
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
22806
|
+
style: {
|
|
22807
|
+
display: "flex",
|
|
22808
|
+
justifyContent: "end"
|
|
22809
|
+
}
|
|
22810
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
22811
|
+
style: {
|
|
22812
|
+
marginLeft: "12px",
|
|
22813
|
+
padding: "8px 16px",
|
|
22814
|
+
background: "#2947a3",
|
|
22815
|
+
color: "#fff",
|
|
22816
|
+
border: "none",
|
|
22817
|
+
borderRadius: "6px",
|
|
22818
|
+
cursor: "pointer"
|
|
22819
|
+
},
|
|
22820
|
+
onClick: () => setShowCart(true)
|
|
22821
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
22822
|
+
style: {
|
|
22823
|
+
marginRight: 6
|
|
22824
|
+
}
|
|
22825
|
+
}, "\uD83D\uDED2"), t("ADS_VIEW_CART"), " (", cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.length, ")")), /*#__PURE__*/React.createElement("form", {
|
|
22826
|
+
onSubmit: handleSubmit(onSubmit)
|
|
22827
|
+
}, /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("ADS_SITE_NAME_LABEL"), " ", /*#__PURE__*/React.createElement("span", {
|
|
22828
|
+
style: mandatoryStyle
|
|
22829
|
+
}, "*")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("style", null, `
|
|
22830
|
+
.select-wrap{
|
|
22831
|
+
width:100% !important;
|
|
22832
|
+
}
|
|
22833
|
+
.select {
|
|
22834
|
+
border: 1px solid #b4b4b4 !important;
|
|
22835
|
+
border-radius: 8px !important;
|
|
22836
|
+
height: 2.9rem !important;
|
|
22837
|
+
}
|
|
22838
|
+
.select-active {
|
|
22839
|
+
border: 1px solid #2947a3 !important;
|
|
22840
|
+
border-radius: 8px !important;
|
|
22841
|
+
}
|
|
22842
|
+
|
|
22843
|
+
`), /*#__PURE__*/React.createElement(Controller, {
|
|
22844
|
+
control: control,
|
|
22845
|
+
name: "siteId",
|
|
22846
|
+
rules: {
|
|
22847
|
+
required: t("ADS_SITE_NAME_REQUIRED")
|
|
22848
|
+
},
|
|
22849
|
+
render: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
22850
|
+
className: "form-field",
|
|
22851
|
+
option: locationOptions,
|
|
22852
|
+
optionKey: "name",
|
|
22853
|
+
selected: props.value,
|
|
22854
|
+
select: e => {
|
|
22855
|
+
props.onChange(e);
|
|
22856
|
+
filterAds(e);
|
|
23567
22857
|
}
|
|
23568
|
-
}
|
|
22858
|
+
})
|
|
22859
|
+
}))), errors.siteId && /*#__PURE__*/React.createElement(CardLabelError$1, {
|
|
22860
|
+
style: errorStyle
|
|
22861
|
+
}, errors.siteId.message), (adsForLocation === null || adsForLocation === void 0 ? void 0 : adsForLocation.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
22862
|
+
style: {
|
|
22863
|
+
display: "flex",
|
|
22864
|
+
flexWrap: "wrap",
|
|
22865
|
+
gap: 12,
|
|
22866
|
+
margin: "12px"
|
|
22867
|
+
}
|
|
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
|
+
});
|
|
23569
22880
|
})), visibleCount < adsForLocation.length && /*#__PURE__*/React.createElement("div", {
|
|
23570
22881
|
style: {
|
|
23571
22882
|
marginTop: 12,
|
|
23572
22883
|
textAlign: "center"
|
|
23573
22884
|
}
|
|
23574
22885
|
}, /*#__PURE__*/React.createElement("button", {
|
|
23575
|
-
onClick: showMore,
|
|
23576
22886
|
type: "button",
|
|
22887
|
+
onClick: showMore,
|
|
23577
22888
|
style: {
|
|
23578
22889
|
padding: "8px 12px",
|
|
23579
22890
|
borderRadius: 6,
|
|
@@ -23581,43 +22892,34 @@ const ADSCitizenSecond = ({
|
|
|
23581
22892
|
background: "#fff",
|
|
23582
22893
|
cursor: "pointer"
|
|
23583
22894
|
}
|
|
23584
|
-
}, t
|
|
23585
|
-
style: {
|
|
23586
|
-
color: "red"
|
|
23587
|
-
}
|
|
23588
|
-
}, "*")), /*#__PURE__*/React.createElement(Controller, {
|
|
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, {
|
|
23589
22896
|
control: control,
|
|
23590
22897
|
name: "geoLocation",
|
|
23591
|
-
rules: {
|
|
23592
|
-
required: "This field is required",
|
|
23593
|
-
validate: val => val && (val.latitude || val.lat) && (val.longitude || val.lng) || "Please pick a location"
|
|
23594
|
-
},
|
|
23595
22898
|
render: props => /*#__PURE__*/React.createElement(ADSAddressField, {
|
|
23596
22899
|
value: props.value,
|
|
23597
|
-
onChange:
|
|
23598
|
-
props.onChange(normalized);
|
|
23599
|
-
setPlaceNameState((normalized === null || normalized === void 0 ? void 0 : normalized.formattedAddress) || "");
|
|
23600
|
-
},
|
|
23601
|
-
onBlur: props.onBlur,
|
|
22900
|
+
onChange: props.onChange,
|
|
23602
22901
|
t: t
|
|
23603
22902
|
})
|
|
23604
|
-
}),
|
|
23605
|
-
style: {
|
|
23606
|
-
color: "red",
|
|
23607
|
-
marginTop: "-18px"
|
|
23608
|
-
}
|
|
23609
|
-
}, errors.geoLocation.message)), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
22903
|
+
})), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
23610
22904
|
label: "Next",
|
|
23611
22905
|
submit: "submit"
|
|
23612
|
-
})),
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
23620
|
-
|
|
22906
|
+
})), showModal && /*#__PURE__*/React.createElement(AvailabilityModal, {
|
|
22907
|
+
ad: selectedAd,
|
|
22908
|
+
tenantId: tenantId,
|
|
22909
|
+
onClose: () => setShowModal(false),
|
|
22910
|
+
onSelectSlot: handleAddToCart,
|
|
22911
|
+
cartSlots: cartSlots,
|
|
22912
|
+
t: t,
|
|
22913
|
+
dateRange: dateRange
|
|
22914
|
+
}), showCart && /*#__PURE__*/React.createElement(CartModal, {
|
|
22915
|
+
cartSlots: cartSlots,
|
|
22916
|
+
onClose: () => setShowCart(false),
|
|
22917
|
+
onRemoveSlot: handleRemoveFromCart,
|
|
22918
|
+
t: t
|
|
22919
|
+
}), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
22920
|
+
error: showToast.error,
|
|
22921
|
+
label: t ? t(showToast.label) : showToast.label,
|
|
22922
|
+
onClose: () => setShowToast(null),
|
|
23621
22923
|
isDleteBtn: true
|
|
23622
22924
|
})));
|
|
23623
22925
|
};
|
|
@@ -23678,9 +22980,7 @@ const NewADSStepFormThree = ({
|
|
|
23678
22980
|
return state.ads.ADSNewApplicationFormReducer.formData && state.ads.ADSNewApplicationFormReducer.formData[config === null || config === void 0 ? void 0 : config.key] ? state.ads.ADSNewApplicationFormReducer.formData[config === null || config === void 0 ? void 0 : config.key] : {};
|
|
23679
22981
|
});
|
|
23680
22982
|
function goNext(finaldata) {
|
|
23681
|
-
console.log(`Data in step ${config.currStepNumber} is: \n`, finaldata);
|
|
23682
22983
|
const missingFields = validation(finaldata);
|
|
23683
|
-
console.log("missingFields", missingFields);
|
|
23684
22984
|
if (missingFields.length > 0) {
|
|
23685
22985
|
setError(`You haven't uploaded: ${missingFields[0].replace(".", "_").toUpperCase()}`);
|
|
23686
22986
|
setShowToast(true);
|
|
@@ -23692,7 +22992,6 @@ const NewADSStepFormThree = ({
|
|
|
23692
22992
|
onGoNext();
|
|
23693
22993
|
}
|
|
23694
22994
|
function validation(documents) {
|
|
23695
|
-
console.log("documents", documents);
|
|
23696
22995
|
if (!isLoading) {
|
|
23697
22996
|
var _documents$documents;
|
|
23698
22997
|
const ndcDocumentsType = mdmsData || [];
|
|
@@ -23707,15 +23006,20 @@ const NewADSStepFormThree = ({
|
|
|
23707
23006
|
onBackClick(config.key, data);
|
|
23708
23007
|
}
|
|
23709
23008
|
const onFormValueChange = (setValue = true, data) => {
|
|
23710
|
-
console.log("onFormValueChange data in AdministrativeDetails: ", data, "\n Bool: ", !lodash.isEqual(data, currentStepData));
|
|
23711
23009
|
if (!lodash.isEqual(data, currentStepData)) {
|
|
23712
|
-
dispatch(UPDATE_ADSNewApplication_FORM(config.key, data));
|
|
23010
|
+
dispatch(UPDATE_ADSNewApplication_FORM(config === null || config === void 0 ? void 0 : config.key, data));
|
|
23713
23011
|
}
|
|
23714
23012
|
};
|
|
23715
23013
|
const closeToast = () => {
|
|
23716
23014
|
setShowToast(false);
|
|
23717
23015
|
setError("");
|
|
23718
23016
|
};
|
|
23017
|
+
useEffect(() => {
|
|
23018
|
+
if (showToast) {
|
|
23019
|
+
const timer = setTimeout(() => setShowToast(null), 2000);
|
|
23020
|
+
return () => clearTimeout(timer);
|
|
23021
|
+
}
|
|
23022
|
+
}, [showToast]);
|
|
23719
23023
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
|
|
23720
23024
|
defaultValues: currentStepData,
|
|
23721
23025
|
config: config.currStepConfig,
|
|
@@ -23857,9 +23161,9 @@ const NewADSStepFormFour = ({
|
|
|
23857
23161
|
currentStepData,
|
|
23858
23162
|
isLoading
|
|
23859
23163
|
} = useSelector(state => {
|
|
23860
|
-
var _state$ads$ADSNewAppl, _state$ads$ADSNewAppl2, _state$ads$ADSNewAppl3;
|
|
23164
|
+
var _state$ads, _state$ads$ADSNewAppl, _state$ads$ADSNewAppl2, _state$ads$ADSNewAppl3;
|
|
23861
23165
|
return {
|
|
23862
|
-
currentStepData: (_state$ads
|
|
23166
|
+
currentStepData: state === null || state === void 0 ? void 0 : (_state$ads = state.ads) === null || _state$ads === void 0 ? void 0 : (_state$ads$ADSNewAppl = _state$ads.ADSNewApplicationFormReducer) === null || _state$ads$ADSNewAppl === void 0 ? void 0 : _state$ads$ADSNewAppl.formData,
|
|
23863
23167
|
isLoading: ((_state$ads$ADSNewAppl2 = state.ads.ADSNewApplicationFormReducer) === null || _state$ads$ADSNewAppl2 === void 0 ? void 0 : _state$ads$ADSNewAppl2.isLoading) || !((_state$ads$ADSNewAppl3 = state.ads.ADSNewApplicationFormReducer) !== null && _state$ads$ADSNewAppl3 !== void 0 && _state$ads$ADSNewAppl3.formData)
|
|
23864
23168
|
};
|
|
23865
23169
|
});
|
|
@@ -23868,7 +23172,7 @@ const NewADSStepFormFour = ({
|
|
|
23868
23172
|
...currentStepData,
|
|
23869
23173
|
penalty: penaltyData
|
|
23870
23174
|
};
|
|
23871
|
-
dispatch(UPDATE_ADSNewApplication_FORM(config.key, updatedData));
|
|
23175
|
+
dispatch(UPDATE_ADSNewApplication_FORM(config === null || config === void 0 ? void 0 : config.key, updatedData));
|
|
23872
23176
|
onGoNext();
|
|
23873
23177
|
};
|
|
23874
23178
|
const goBack = penaltyData => {
|
|
@@ -23936,18 +23240,16 @@ function NewADSStepFormFive(props) {
|
|
|
23936
23240
|
currentStepDataRef.current = currentStepData;
|
|
23937
23241
|
}, [currentStepData]);
|
|
23938
23242
|
const globalBookingNo = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.bookingNo) || (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$Crea = currentStepData.CreatedResponse) === null || _currentStepData$Crea === void 0 ? void 0 : _currentStepData$Crea.bookingNo) || "";
|
|
23939
|
-
console.log("globalBookingNo", globalBookingNo);
|
|
23940
23243
|
const businessServicMINE = "advandhoarding-services";
|
|
23941
23244
|
const workflowDetails = Digit.Hooks.useWorkflowDetails({
|
|
23942
23245
|
tenantId,
|
|
23943
23246
|
id: globalBookingNo,
|
|
23944
23247
|
moduleCode: businessServicMINE
|
|
23945
23248
|
});
|
|
23946
|
-
console.log("
|
|
23249
|
+
console.log("workflowDetails", workflowDetails);
|
|
23947
23250
|
useEffect(() => {
|
|
23948
23251
|
var _logged$info, _logged$info$roles;
|
|
23949
23252
|
const wd = workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.data;
|
|
23950
|
-
console.log("wd :>> ", wd);
|
|
23951
23253
|
if (!wd) {
|
|
23952
23254
|
setWfActions(prev => prev && prev.length ? [] : prev);
|
|
23953
23255
|
return;
|
|
@@ -23976,24 +23278,21 @@ function NewADSStepFormFive(props) {
|
|
|
23976
23278
|
if (!a.roles || a.roles.length === 0) return true;
|
|
23977
23279
|
return userRolesNow.some(ur => a.roles.includes(ur));
|
|
23978
23280
|
});
|
|
23281
|
+
const submitOnly = filteredByRole.filter(a => a.action === "SUBMIT");
|
|
23979
23282
|
setWfActions(prev => {
|
|
23980
|
-
if (lodash.isEqual(prev,
|
|
23981
|
-
|
|
23982
|
-
return filteredByRole;
|
|
23283
|
+
if (lodash.isEqual(prev, submitOnly)) return prev;
|
|
23284
|
+
return submitOnly;
|
|
23983
23285
|
});
|
|
23984
23286
|
}, [workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data = workflowDetails.data) === null || _workflowDetails$data === void 0 ? void 0 : _workflowDetails$data.applicationBusinessService, workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data2 = workflowDetails.data) === null || _workflowDetails$data2 === void 0 ? void 0 : (_workflowDetails$data3 = _workflowDetails$data2.processInstances) === null || _workflowDetails$data3 === void 0 ? void 0 : _workflowDetails$data3.length]);
|
|
23985
23287
|
var ignoredInitialChangeRef = useRef(true);
|
|
23986
23288
|
var lastDispatchedRef = useRef(null);
|
|
23987
23289
|
var debounceTimerRef = useRef(null);
|
|
23988
|
-
|
|
23290
|
+
const goNext = useCallback(async function onSubmit(data = undefined) {
|
|
23989
23291
|
var _data$Licenses, _wd$data, _wd$data$processInsta, _wd$data$processInsta2, _payloadState$Created, _payloadState$documen, _payloadState$documen2, _workflowDetails$data4;
|
|
23990
23292
|
const wd = workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.data;
|
|
23991
|
-
console.log("goNext called with:", data);
|
|
23992
23293
|
const payloadState = lodash.merge(lodash.cloneDeep(currentStepDataRef.current), data || {});
|
|
23993
|
-
console.log("payloadState issss6666 :>> ", payloadState);
|
|
23994
23294
|
const filtData = data !== null && data !== void 0 && data.action ? data : (data === null || data === void 0 ? void 0 : (_data$Licenses = data.Licenses) === null || _data$Licenses === void 0 ? void 0 : _data$Licenses[0]) || null;
|
|
23995
23295
|
const matchingState = filtData.nextState || filtData.nextStateUuid || filtData.status || "";
|
|
23996
|
-
console.log("filtData :>> ", filtData);
|
|
23997
23296
|
const normalizedAssignee = normalizeAssignees((filtData === null || filtData === void 0 ? void 0 : filtData.assignee) || (filtData === null || filtData === void 0 ? void 0 : filtData.assignees) || (filtData === null || filtData === void 0 ? void 0 : filtData.assigneeUuid));
|
|
23998
23297
|
if (!filtData || !filtData.action) {
|
|
23999
23298
|
dispatch(UPDATE_ADSNewApplication_FORM("finalSubmission", payloadState));
|
|
@@ -24028,7 +23327,6 @@ function NewADSStepFormFive(props) {
|
|
|
24028
23327
|
try {
|
|
24029
23328
|
var _response$ResponseInf;
|
|
24030
23329
|
const response = await Digit.ADSServices.update(requestBody, tenantId);
|
|
24031
|
-
console.log("ADS Update response:", response);
|
|
24032
23330
|
if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) === "SUCCESSFUL" || (response === null || response === void 0 ? void 0 : response.status) === "SUCCESSFUL") {
|
|
24033
23331
|
var _Digit, _Digit$Store, _Digit$Store$getState, _Digit$Store$getState2, _Digit$Store$getState3, _Digit$Store$getState4, _currentStepDataRef$c, _currentStepDataRef$c2, _currentStepDataRef$c3, _currentStepDataRef$c4, _currentStepDataRef$c5;
|
|
24034
23332
|
const prev = ((_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$Store = _Digit.Store) === null || _Digit$Store === void 0 ? void 0 : (_Digit$Store$getState = _Digit$Store.getState) === null || _Digit$Store$getState === void 0 ? void 0 : (_Digit$Store$getState2 = _Digit$Store$getState.call(_Digit$Store)) === null || _Digit$Store$getState2 === void 0 ? void 0 : (_Digit$Store$getState3 = _Digit$Store$getState2.ads) === null || _Digit$Store$getState3 === void 0 ? void 0 : (_Digit$Store$getState4 = _Digit$Store$getState3.ADSNewApplicationFormReducer) === null || _Digit$Store$getState4 === void 0 ? void 0 : _Digit$Store$getState4.formData) || currentStepDataRef.current || {};
|
|
@@ -24066,7 +23364,6 @@ function NewADSStepFormFive(props) {
|
|
|
24066
23364
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
24067
23365
|
debounceTimerRef.current = setTimeout(function () {
|
|
24068
23366
|
const cleanStep = lodash.omitBy(lodash.cloneDeep(data), v => v === undefined);
|
|
24069
|
-
console.log("cleanStep keys", Object.keys(cleanStep));
|
|
24070
23367
|
if ((config === null || config === void 0 ? void 0 : config.key) === "summary" && Object.keys(cleanStep).length === 1 && cleanStep.summary === "") {
|
|
24071
23368
|
return;
|
|
24072
23369
|
}
|
|
@@ -24086,7 +23383,6 @@ function NewADSStepFormFive(props) {
|
|
|
24086
23383
|
setShowToast(false);
|
|
24087
23384
|
setError("");
|
|
24088
23385
|
};
|
|
24089
|
-
console.log("defaultValues keys:", Object.keys(currentStepData || {}));
|
|
24090
23386
|
const safeDefaults = React.useMemo(() => {
|
|
24091
23387
|
const dv = currentStepData || {};
|
|
24092
23388
|
return dv.summary === undefined ? {
|
|
@@ -24208,9 +23504,7 @@ const NewSiteMasterStepperForm = ({
|
|
|
24208
23504
|
useEffect(() => {
|
|
24209
23505
|
dispatch(RESET_ADS_NEW_APPLICATION_FORM());
|
|
24210
23506
|
}, []);
|
|
24211
|
-
const handleSubmit = dataGet => {
|
|
24212
|
-
console.log("dataGet===", dataGet);
|
|
24213
|
-
};
|
|
23507
|
+
const handleSubmit = dataGet => {};
|
|
24214
23508
|
return /*#__PURE__*/React.createElement("div", {
|
|
24215
23509
|
className: "pageCard"
|
|
24216
23510
|
}, /*#__PURE__*/React.createElement(CardHeader$1, {
|
|
@@ -24252,15 +23546,12 @@ const ADSSiteMaster = ({
|
|
|
24252
23546
|
}) => {
|
|
24253
23547
|
const stateId = Digit.ULBService.getStateId();
|
|
24254
23548
|
const {
|
|
24255
|
-
data: mdmsdata = []
|
|
24256
|
-
isLoading: isMdmsLoading
|
|
23549
|
+
data: mdmsdata = []
|
|
24257
23550
|
} = Digit.Hooks.ads.useADSAllMDMS(stateId);
|
|
24258
|
-
console.log("mdmsdata is :>> ", mdmsdata);
|
|
24259
23551
|
const now = new Date();
|
|
24260
23552
|
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
|
|
24261
23553
|
const nowHM = now.toISOString().slice(11, 16);
|
|
24262
23554
|
const isCitizen = window.location.href.includes("citizen");
|
|
24263
|
-
console.log("isCitizen", isCitizen);
|
|
24264
23555
|
const initialFormDefaults = {
|
|
24265
23556
|
siteId: "",
|
|
24266
23557
|
siteName: "",
|
|
@@ -24389,7 +23680,6 @@ const ADSSiteMaster = ({
|
|
|
24389
23680
|
nextState: ""
|
|
24390
23681
|
}
|
|
24391
23682
|
};
|
|
24392
|
-
console.log("formData", formData);
|
|
24393
23683
|
dispatch(UPDATE_ADSNewApplication_FORM("applicantDetail", formData.applicantDetail));
|
|
24394
23684
|
dispatch(UPDATE_ADSNewApplication_FORM("cartDetails", formData.cartDetails));
|
|
24395
23685
|
dispatch(UPDATE_ADSNewApplication_FORM("cartAddress", data.cartAddress));
|
|
@@ -24402,21 +23692,15 @@ const ADSSiteMaster = ({
|
|
|
24402
23692
|
draft: true,
|
|
24403
23693
|
bookingApplication: formData
|
|
24404
23694
|
};
|
|
24405
|
-
console.log("ADS Create payload:", {
|
|
24406
|
-
bookingApplication: formData
|
|
24407
|
-
});
|
|
24408
23695
|
try {
|
|
24409
23696
|
var _response$ResponseInf;
|
|
24410
23697
|
const payload = {
|
|
24411
23698
|
bookingApplication: formData
|
|
24412
23699
|
};
|
|
24413
|
-
console.log("Sending payload:", JSON.stringify(payload, null, 2));
|
|
24414
23700
|
const response = await Digit.ADSServices.create(payload, tenantId);
|
|
24415
|
-
console.log("Received response:", JSON.stringify(response, null, 2));
|
|
24416
23701
|
const status = response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status;
|
|
24417
23702
|
const isSuccess = typeof status === "string" && status.toLowerCase() === "successful";
|
|
24418
23703
|
if (isSuccess) {
|
|
24419
|
-
console.log("ADS create successfull");
|
|
24420
23704
|
const appData = Array.isArray(response === null || response === void 0 ? void 0 : response.bookingApplication) ? response.bookingApplication[0] : response === null || response === void 0 ? void 0 : response.bookingApplication;
|
|
24421
23705
|
dispatch(UPDATE_ADSNewApplication_FORM("CreatedResponse", appData || response));
|
|
24422
23706
|
setAdsList([]);
|
|
@@ -24451,10 +23735,8 @@ const ADSSiteMaster = ({
|
|
|
24451
23735
|
}
|
|
24452
23736
|
};
|
|
24453
23737
|
useEffect(() => {
|
|
24454
|
-
console.log("currentStepData", currentStepData);
|
|
24455
23738
|
const formattedData = (currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.siteDetails) || currentStepData;
|
|
24456
23739
|
if (formattedData) {
|
|
24457
|
-
console.log("coming here", formattedData);
|
|
24458
23740
|
Object.entries(formattedData).forEach(([key, value]) => {
|
|
24459
23741
|
setValue(key, value);
|
|
24460
23742
|
});
|
|
@@ -24983,9 +24265,7 @@ const NewSiteInspectionStepperFormOne = ({
|
|
|
24983
24265
|
useEffect(() => {
|
|
24984
24266
|
dispatch(RESET_ADS_NEW_APPLICATION_FORM());
|
|
24985
24267
|
}, []);
|
|
24986
|
-
const handleSubmit = dataGet => {
|
|
24987
|
-
console.log("dataGet===", dataGet);
|
|
24988
|
-
};
|
|
24268
|
+
const handleSubmit = dataGet => {};
|
|
24989
24269
|
return /*#__PURE__*/React.createElement("div", {
|
|
24990
24270
|
className: "pageCard"
|
|
24991
24271
|
}, /*#__PURE__*/React.createElement(CardHeader$1, {
|
|
@@ -25048,7 +24328,6 @@ const NewSiteInspectionStepperFormOne$1 = ({
|
|
|
25048
24328
|
};
|
|
25049
24329
|
function goNext(data) {
|
|
25050
24330
|
var _currentStepData$docu;
|
|
25051
|
-
console.log("goNext data in NewADSStepFormThree: ", data);
|
|
25052
24331
|
const validator = makeDocumentsValidator(mdmsData);
|
|
25053
24332
|
const docsArray = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$docu = currentStepData.documents) === null || _currentStepData$docu === void 0 ? void 0 : _currentStepData$docu.documents) || [];
|
|
25054
24333
|
const docErrors = validator(docsArray);
|
|
@@ -25063,7 +24342,6 @@ const NewSiteInspectionStepperFormOne$1 = ({
|
|
|
25063
24342
|
onBackClick(config.key, data);
|
|
25064
24343
|
}
|
|
25065
24344
|
const onFormValueChange = (setValue = true, data) => {
|
|
25066
|
-
console.log("onFormValueChange data in AdministrativeDetails: ", data, "\n Bool: ", !lodash.isEqual(data, currentStepData));
|
|
25067
24345
|
if (!lodash.isEqual(data, currentStepData)) {
|
|
25068
24346
|
dispatch(UPDATE_ADSNewApplication_FORM(config.key, data));
|
|
25069
24347
|
}
|
|
@@ -25375,7 +24653,6 @@ const ADSSelectProofIdentity = ({
|
|
|
25375
24653
|
const stateId = Digit.ULBService.getStateId();
|
|
25376
24654
|
const [formErrors, setFormErrors] = useState({});
|
|
25377
24655
|
const [toastError, setToastError] = useState(null);
|
|
25378
|
-
const [submitted, setSubmitted] = useState(false);
|
|
25379
24656
|
const FILE_POLICY = {
|
|
25380
24657
|
maxBytes: 5 * 1024 * 1024,
|
|
25381
24658
|
allowedExtensions: [".pdf", ".jpeg", ".jpg", ".png"]
|
|
@@ -25446,7 +24723,6 @@ const ADSSelectProofIdentity = ({
|
|
|
25446
24723
|
}
|
|
25447
24724
|
}, [documents, config.key]);
|
|
25448
24725
|
const handleSubmit = () => {
|
|
25449
|
-
setSubmitted(true);
|
|
25450
24726
|
if (Object.keys(formErrors).length > 0) {
|
|
25451
24727
|
setToastError(t(formErrors.missingRequired || "PTR_VALIDATION_ERROR"));
|
|
25452
24728
|
onSelect(config.key, {
|
|
@@ -25469,7 +24745,7 @@ const ADSSelectProofIdentity = ({
|
|
|
25469
24745
|
isDisabled: Object.keys(formErrors).length > 0
|
|
25470
24746
|
}, Array.isArray(mdmsDocsData) && mdmsDocsData.map((mdmsDoc, index) => {
|
|
25471
24747
|
const existing = documents.find(d => d.documentType === mdmsDoc.code);
|
|
25472
|
-
return /*#__PURE__*/React.createElement(
|
|
24748
|
+
return /*#__PURE__*/React.createElement(ADSSelectDocument$1, {
|
|
25473
24749
|
key: index,
|
|
25474
24750
|
document: {
|
|
25475
24751
|
...mdmsDoc,
|
|
@@ -25491,7 +24767,7 @@ const ADSSelectProofIdentity = ({
|
|
|
25491
24767
|
error: true
|
|
25492
24768
|
})) : /*#__PURE__*/React.createElement(Loader$1, null));
|
|
25493
24769
|
};
|
|
25494
|
-
function
|
|
24770
|
+
function ADSSelectDocument$1({
|
|
25495
24771
|
t,
|
|
25496
24772
|
document: doc,
|
|
25497
24773
|
setDocuments,
|
|
@@ -25562,6 +24838,7 @@ function PTRSelectDocument$1({
|
|
|
25562
24838
|
marginTop: "4px",
|
|
25563
24839
|
marginBottom: "10px"
|
|
25564
24840
|
};
|
|
24841
|
+
console.log("doc", doc);
|
|
25565
24842
|
return /*#__PURE__*/React.createElement("div", {
|
|
25566
24843
|
style: {
|
|
25567
24844
|
marginBottom: "24px"
|
|
@@ -25594,19 +24871,104 @@ function PTRSelectDocument$1({
|
|
|
25594
24871
|
}, fieldError))));
|
|
25595
24872
|
}
|
|
25596
24873
|
|
|
24874
|
+
const ADSCartDetails$1 = ({
|
|
24875
|
+
cartDetails,
|
|
24876
|
+
t
|
|
24877
|
+
}) => {
|
|
24878
|
+
const [expanded, setExpanded] = useState(() => cartDetails.map(item => item.ad.id));
|
|
24879
|
+
const toggleExpand = adId => {
|
|
24880
|
+
setExpanded(prev => prev.includes(adId) ? prev.filter(id => id !== adId) : [...prev, adId]);
|
|
24881
|
+
};
|
|
24882
|
+
const makeColumns = () => [{
|
|
24883
|
+
Header: t("ADS_DATE"),
|
|
24884
|
+
accessor: "bookingDate"
|
|
24885
|
+
}, {
|
|
24886
|
+
Header: t("ADS_LOCATION"),
|
|
24887
|
+
accessor: "location"
|
|
24888
|
+
}, {
|
|
24889
|
+
Header: t("ADS_FACE_AREA"),
|
|
24890
|
+
accessor: "faceArea"
|
|
24891
|
+
}, {
|
|
24892
|
+
Header: t("ADS_TYPE"),
|
|
24893
|
+
accessor: "addType"
|
|
24894
|
+
}, {
|
|
24895
|
+
Header: t("ADS_NIGHT_LIGHT"),
|
|
24896
|
+
accessor: row => row.nightLight ? t("ADS_YES") : t("ADS_NO")
|
|
24897
|
+
}];
|
|
24898
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24899
|
+
style: {
|
|
24900
|
+
marginTop: "1rem"
|
|
24901
|
+
}
|
|
24902
|
+
}, cartDetails.length === 0 ? /*#__PURE__*/React.createElement("p", {
|
|
24903
|
+
style: {
|
|
24904
|
+
padding: "12px",
|
|
24905
|
+
color: "#666"
|
|
24906
|
+
}
|
|
24907
|
+
}, t("ADS_NO_ADVERTISMENT_DETAILS")) : cartDetails.map((item, idx) => {
|
|
24908
|
+
var _item$slots;
|
|
24909
|
+
const isOpen = expanded.includes(item.ad.id);
|
|
24910
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24911
|
+
key: idx,
|
|
24912
|
+
style: {
|
|
24913
|
+
marginBottom: "16px",
|
|
24914
|
+
border: "1px solid #ddd",
|
|
24915
|
+
borderRadius: "8px",
|
|
24916
|
+
overflow: "hidden"
|
|
24917
|
+
}
|
|
24918
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24919
|
+
onClick: () => toggleExpand(item.ad.id),
|
|
24920
|
+
style: {
|
|
24921
|
+
background: "#f9f9f9",
|
|
24922
|
+
padding: "10px 14px",
|
|
24923
|
+
fontWeight: 600,
|
|
24924
|
+
fontSize: "14px",
|
|
24925
|
+
borderBottom: "1px solid #ddd",
|
|
24926
|
+
cursor: "pointer",
|
|
24927
|
+
display: "flex",
|
|
24928
|
+
justifyContent: "space-between",
|
|
24929
|
+
alignItems: "center"
|
|
24930
|
+
}
|
|
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", {
|
|
24932
|
+
style: {
|
|
24933
|
+
fontSize: "18px"
|
|
24934
|
+
}
|
|
24935
|
+
}, isOpen ? "▾" : "▸")), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
24936
|
+
style: {
|
|
24937
|
+
overflowX: "auto"
|
|
24938
|
+
}
|
|
24939
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
24940
|
+
t: t,
|
|
24941
|
+
data: item.slots,
|
|
24942
|
+
columns: makeColumns(),
|
|
24943
|
+
disableSort: true,
|
|
24944
|
+
isPaginationRequired: false,
|
|
24945
|
+
getCellProps: cell => ({
|
|
24946
|
+
style: {
|
|
24947
|
+
padding: "12px 14px",
|
|
24948
|
+
fontSize: "14px",
|
|
24949
|
+
borderBottom: "1px solid #f0f0f0",
|
|
24950
|
+
textAlign: "left",
|
|
24951
|
+
whiteSpace: "nowrap"
|
|
24952
|
+
}
|
|
24953
|
+
})
|
|
24954
|
+
})));
|
|
24955
|
+
}));
|
|
24956
|
+
};
|
|
24957
|
+
|
|
25597
24958
|
function ADSSummary({
|
|
25598
24959
|
t
|
|
25599
24960
|
}) {
|
|
25600
|
-
var _formData$CreatedResp, _formData$ownerDetail, _formData$CreatedResp2, _formData$
|
|
24961
|
+
var _formData$CreatedResp, _formData$ownerDetail, _formData$CreatedResp2, _formData$documents, _formData$documents$d, _formData$documents2;
|
|
25601
24962
|
const dispatch = useDispatch();
|
|
25602
24963
|
const TT = key => t ? t(key) : key;
|
|
25603
|
-
const rawFormData = useSelector(state =>
|
|
24964
|
+
const rawFormData = useSelector(state => {
|
|
24965
|
+
var _state$ads, _state$ads$ADSNewAppl;
|
|
24966
|
+
return state === null || state === void 0 ? void 0 : (_state$ads = state.ads) === null || _state$ads === void 0 ? void 0 : (_state$ads$ADSNewAppl = _state$ads.ADSNewApplicationFormReducer) === null || _state$ads$ADSNewAppl === void 0 ? void 0 : _state$ads$ADSNewAppl.formData;
|
|
24967
|
+
});
|
|
25604
24968
|
const formData = React.useMemo(() => rawFormData || {}, [rawFormData]);
|
|
25605
|
-
|
|
25606
|
-
const
|
|
25607
|
-
const
|
|
25608
|
-
const cartArray = Array.isArray((_formData$CreatedResp3 = formData.CreatedResponse) === null || _formData$CreatedResp3 === void 0 ? void 0 : _formData$CreatedResp3.cartDetails) ? (_formData$CreatedResp4 = formData.CreatedResponse) === null || _formData$CreatedResp4 === void 0 ? void 0 : _formData$CreatedResp4.cartDetails : [];
|
|
25609
|
-
const docs = Array.isArray((_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 : [];
|
|
24969
|
+
const applicant = (formData === null || formData === void 0 ? void 0 : (_formData$CreatedResp = formData.CreatedResponse) === null || _formData$CreatedResp === void 0 ? void 0 : _formData$CreatedResp.applicantDetail) || {};
|
|
24970
|
+
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 : [];
|
|
25610
24972
|
const sectionStyle = {
|
|
25611
24973
|
backgroundColor: "#ffffff",
|
|
25612
24974
|
padding: "1rem 0",
|
|
@@ -25621,6 +24983,12 @@ function ADSSummary({
|
|
|
25621
24983
|
marginBottom: "0.75rem",
|
|
25622
24984
|
padding: "0 1.5rem"
|
|
25623
24985
|
};
|
|
24986
|
+
const headerRow1 = {
|
|
24987
|
+
display: "flex",
|
|
24988
|
+
justifyContent: "space-between",
|
|
24989
|
+
alignItems: "center",
|
|
24990
|
+
marginBottom: "0.75rem"
|
|
24991
|
+
};
|
|
25624
24992
|
const headingStyle = {
|
|
25625
24993
|
fontSize: "1.25rem",
|
|
25626
24994
|
color: "#0d43a7",
|
|
@@ -25659,16 +25027,7 @@ function ADSSummary({
|
|
|
25659
25027
|
fontWeight: "500",
|
|
25660
25028
|
color: "#333"
|
|
25661
25029
|
};
|
|
25662
|
-
const
|
|
25663
|
-
if (!geo) return "NA";
|
|
25664
|
-
if (typeof geo === "string") return geo;
|
|
25665
|
-
try {
|
|
25666
|
-
const s = JSON.stringify(geo);
|
|
25667
|
-
return s.length > 120 ? s.slice(0, 117) + "..." : s;
|
|
25668
|
-
} catch (e) {
|
|
25669
|
-
return "NA";
|
|
25670
|
-
}
|
|
25671
|
-
};
|
|
25030
|
+
const cartDetails = formData === null || formData === void 0 ? void 0 : formData.ads;
|
|
25672
25031
|
const renderRow = (label, value) => /*#__PURE__*/React.createElement("div", {
|
|
25673
25032
|
style: labelFieldPairStyle
|
|
25674
25033
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -25695,23 +25054,24 @@ function ADSSummary({
|
|
|
25695
25054
|
style: headerRow
|
|
25696
25055
|
}, /*#__PURE__*/React.createElement("h3", {
|
|
25697
25056
|
style: headingStyle
|
|
25698
|
-
}, TT("
|
|
25057
|
+
}, TT("ADS_APPLICANT_DETAILS")), /*#__PURE__*/React.createElement("span", {
|
|
25699
25058
|
style: editLabelStyle,
|
|
25700
25059
|
onClick: () => dispatch(SET_ADSNewApplication_STEP(2))
|
|
25701
|
-
}, TT("
|
|
25060
|
+
}, TT("TL_SUMMARY_EDIT"))), renderRow(TT("ES_NEW_APPLICATION_APPLICANT_NAME"), applicant === null || applicant === void 0 ? void 0 : applicant.applicantName), renderRow(TT("MOBILE"), applicant === null || applicant === void 0 ? void 0 : applicant.applicantMobileNo), renderRow(TT("ADS_EMAIL_ID"), applicant === null || applicant === void 0 ? void 0 : applicant.applicantEmailId), renderRow(TT("CORE_COMMON_PINCODE"), address === null || address === void 0 ? void 0 : address.pincode), renderRow(TT("ES_CREATECOMPLAINT_ADDRESS"), address === null || address === void 0 ? void 0 : address.addressLine1))), /*#__PURE__*/React.createElement(Card$1, {
|
|
25702
25061
|
className: "summary-section"
|
|
25703
25062
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25704
25063
|
style: sectionStyle
|
|
25705
25064
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25706
|
-
style:
|
|
25065
|
+
style: headerRow1
|
|
25707
25066
|
}, /*#__PURE__*/React.createElement("h3", {
|
|
25708
25067
|
style: headingStyle
|
|
25709
|
-
}, TT("
|
|
25068
|
+
}, TT("ADS_DETAILS")), /*#__PURE__*/React.createElement("span", {
|
|
25710
25069
|
style: editLabelStyle,
|
|
25711
25070
|
onClick: () => dispatch(SET_ADSNewApplication_STEP(1))
|
|
25712
|
-
}, TT("
|
|
25713
|
-
|
|
25714
|
-
|
|
25071
|
+
}, TT("TL_SUMMARY_EDIT"))), /*#__PURE__*/React.createElement(ADSCartDetails$1, {
|
|
25072
|
+
cartDetails: cartDetails,
|
|
25073
|
+
t: t
|
|
25074
|
+
}))), /*#__PURE__*/React.createElement(Card$1, {
|
|
25715
25075
|
className: "summary-section"
|
|
25716
25076
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25717
25077
|
style: sectionStyle
|
|
@@ -25722,7 +25082,7 @@ function ADSSummary({
|
|
|
25722
25082
|
}, TT("ADS_DOCUMENTS_DETAILS")), /*#__PURE__*/React.createElement("span", {
|
|
25723
25083
|
style: editLabelStyle,
|
|
25724
25084
|
onClick: () => dispatch(SET_ADSNewApplication_STEP(3))
|
|
25725
|
-
}, TT("
|
|
25085
|
+
}, TT("TL_SUMMARY_EDIT"))), docs.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
25726
25086
|
style: documentsContainerStyle
|
|
25727
25087
|
}, docs.map((doc, idx) => /*#__PURE__*/React.createElement("div", {
|
|
25728
25088
|
key: idx,
|