@mseva/upyog-ui-module-chb 1.1.5 → 1.1.6

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.
@@ -45272,1198 +45272,1355 @@ const NewADSStepperForm = () => {
45272
45272
  }));
45273
45273
  };
45274
45274
 
45275
- var tabbable_1 = createCommonjsModule(function (module, exports) {
45276
-
45277
- Object.defineProperty(exports, "__esModule", {
45278
- value: true
45279
- });
45280
- exports.default = findTabbableDescendants;
45281
- var DISPLAY_NONE = "none";
45282
- var DISPLAY_CONTENTS = "contents";
45283
- var tabbableNode = /^(input|select|textarea|button|object|iframe)$/;
45284
- function isNotOverflowing(element, style) {
45285
- return style.getPropertyValue("overflow") !== "visible" || element.scrollWidth <= 0 && element.scrollHeight <= 0;
45286
- }
45287
- function hidesContents(element) {
45288
- var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
45289
- if (zeroSize && !element.innerHTML) return true;
45290
- try {
45291
- var style = window.getComputedStyle(element);
45292
- var displayValue = style.getPropertyValue("display");
45293
- return zeroSize ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) : displayValue === DISPLAY_NONE;
45294
- } catch (exception) {
45295
- console.warn("Failed to inspect element style");
45296
- return false;
45297
- }
45298
- }
45299
- function visible(element) {
45300
- var parentElement = element;
45301
- var rootNode = element.getRootNode && element.getRootNode();
45302
- while (parentElement) {
45303
- if (parentElement === document.body) break;
45304
- if (rootNode && parentElement === rootNode) parentElement = rootNode.host.parentNode;
45305
- if (hidesContents(parentElement)) return false;
45306
- parentElement = parentElement.parentNode;
45275
+ const CHBCitizenSecond = ({
45276
+ onGoBack,
45277
+ goNext,
45278
+ currentStepData,
45279
+ t
45280
+ }) => {
45281
+ const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
45282
+ const isCitizen = window.location.href.includes("citizen");
45283
+ const [getHallDetails, setHallDetails] = useState([]);
45284
+ const [getHallCodes, setHallCodes] = useState([]);
45285
+ const [getSlots, setSlots] = useState([]);
45286
+ const [loader, setLoader] = useState(false);
45287
+ const [showInfo, setShowInfo] = useState(false);
45288
+ const [error, setError] = useState(null);
45289
+ const {
45290
+ control,
45291
+ handleSubmit,
45292
+ setValue,
45293
+ reset,
45294
+ formState: {
45295
+ errors
45296
+ },
45297
+ getValues,
45298
+ watch
45299
+ } = useForm({
45300
+ defaultValues: {
45301
+ shouldUnregister: false,
45302
+ halls: [{
45303
+ startDate: "",
45304
+ endDate: "",
45305
+ startTime: "",
45306
+ endTime: ""
45307
+ }]
45307
45308
  }
45308
- return true;
45309
- }
45310
- function focusable(element, isTabIndexNotNaN) {
45311
- var nodeName = element.nodeName.toLowerCase();
45312
- var res = tabbableNode.test(nodeName) && !element.disabled || (nodeName === "a" ? element.href || isTabIndexNotNaN : isTabIndexNotNaN);
45313
- return res && visible(element);
45314
- }
45315
- function tabbable(element) {
45316
- var tabIndex = element.getAttribute("tabindex");
45317
- if (tabIndex === null) tabIndex = undefined;
45318
- var isTabIndexNaN = isNaN(tabIndex);
45319
- return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);
45320
- }
45321
- function findTabbableDescendants(element) {
45322
- var descendants = [].slice.call(element.querySelectorAll("*"), 0).reduce(function (finished, el) {
45323
- return finished.concat(!el.shadowRoot ? [el] : findTabbableDescendants(el.shadowRoot));
45324
- }, []);
45325
- return descendants.filter(tabbable);
45326
- }
45327
- module.exports = exports["default"];
45328
- });
45329
- unwrapExports(tabbable_1);
45330
-
45331
- var focusManager = createCommonjsModule(function (module, exports) {
45332
-
45333
- Object.defineProperty(exports, "__esModule", {
45334
- value: true
45335
45309
  });
45336
- exports.resetState = resetState;
45337
- exports.log = log;
45338
- exports.handleBlur = handleBlur;
45339
- exports.handleFocus = handleFocus;
45340
- exports.markForFocusLater = markForFocusLater;
45341
- exports.returnFocus = returnFocus;
45342
- exports.popWithoutFocus = popWithoutFocus;
45343
- exports.setupScopedFocus = setupScopedFocus;
45344
- exports.teardownScopedFocus = teardownScopedFocus;
45345
- var _tabbable2 = _interopRequireDefault(tabbable_1);
45346
- function _interopRequireDefault(obj) {
45347
- return obj && obj.__esModule ? obj : {
45348
- default: obj
45310
+ const {
45311
+ data: CHBLocations = [],
45312
+ isLoading: CHBLocationLoading
45313
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45314
+ name: "Location"
45315
+ }]);
45316
+ const {
45317
+ data: CHBDetails = [],
45318
+ isLoading: CHBLoading
45319
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45320
+ name: "CommunityHalls"
45321
+ }]);
45322
+ const {
45323
+ data: CHBPurpose = [],
45324
+ isLoading: CHBPurposeLoading
45325
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45326
+ name: "Purpose"
45327
+ }]);
45328
+ const {
45329
+ data: SpecialCategory = [],
45330
+ isLoading: CHBSpecialCategoryLoading
45331
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45332
+ name: "SpecialCategory"
45333
+ }]);
45334
+ const {
45335
+ data: CHBHallCode = [],
45336
+ isLoading: CHBHallCodeLoading
45337
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45338
+ name: "HallCode"
45339
+ }]);
45340
+ const {
45341
+ data: CHBReason = [],
45342
+ isLoading: CHBReasonLoading
45343
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45344
+ name: "DiscountReason"
45345
+ }]);
45346
+ const {
45347
+ data: CHBCalculationType = [],
45348
+ isLoading: CHBCalcLoading
45349
+ } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
45350
+ name: "CalculationType"
45351
+ }]);
45352
+ const fiterHalls = selected => {
45353
+ var _CHBDetails$CHB, _CHBDetails$CHB$Commu, _CHBHallCode$CHB;
45354
+ const filteredHalls = (CHBDetails === null || CHBDetails === void 0 ? void 0 : (_CHBDetails$CHB = CHBDetails.CHB) === null || _CHBDetails$CHB === void 0 ? void 0 : (_CHBDetails$CHB$Commu = _CHBDetails$CHB.CommunityHalls) === null || _CHBDetails$CHB$Commu === void 0 ? void 0 : _CHBDetails$CHB$Commu.filter(hall => hall.locationCode === (selected === null || selected === void 0 ? void 0 : selected.code))) || [];
45355
+ setHallDetails(filteredHalls);
45356
+ const hallInfo = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB = CHBHallCode.CHB) === null || _CHBHallCode$CHB === void 0 ? void 0 : _CHBHallCode$CHB.HallCode;
45357
+ const getHallCodesData = hallInfo === null || hallInfo === void 0 ? void 0 : hallInfo.filter(item => (item === null || item === void 0 ? void 0 : item.communityHallId) == (selected === null || selected === void 0 ? void 0 : selected.communityHallId));
45358
+ setHallCodes(getHallCodesData);
45359
+ };
45360
+ const slotsSearch = async data => {
45361
+ var _getValues, _getValues2;
45362
+ setLoader(true);
45363
+ const payload = {
45364
+ tenantId: tenantId,
45365
+ communityHallCode: data.communityHallId,
45366
+ hallCode: data === null || data === void 0 ? void 0 : data.HallCode,
45367
+ bookingStartDate: (_getValues = getValues()) === null || _getValues === void 0 ? void 0 : _getValues.startDate,
45368
+ bookingEndDate: (_getValues2 = getValues()) === null || _getValues2 === void 0 ? void 0 : _getValues2.endDate,
45369
+ isTimerRequired: false
45349
45370
  };
45350
- }
45351
- var focusLaterElements = [];
45352
- var modalElement = null;
45353
- var needToFocus = false;
45354
- function resetState() {
45355
- focusLaterElements = [];
45356
- }
45357
- function log() {
45358
- if (process.env.NODE_ENV !== "production") {
45359
- console.log("focusManager ----------");
45360
- focusLaterElements.forEach(function (f) {
45361
- var check = f || {};
45362
- console.log(check.nodeName, check.className, check.id);
45371
+ try {
45372
+ const response = await Digit.CHBServices.slot_search({
45373
+ filters: payload
45363
45374
  });
45364
- console.log("end focusManager ----------");
45375
+ setLoader(false);
45376
+ setSlots(response === null || response === void 0 ? void 0 : response.hallSlotAvailabiltityDetails);
45377
+ return response;
45378
+ } catch (error) {
45379
+ setLoader(false);
45365
45380
  }
45366
- }
45367
- function handleBlur() {
45368
- needToFocus = true;
45369
- }
45370
- function handleFocus() {
45371
- if (needToFocus) {
45372
- needToFocus = false;
45373
- if (!modalElement) {
45374
- return;
45375
- }
45376
- setTimeout(function () {
45377
- if (modalElement.contains(document.activeElement)) {
45378
- return;
45381
+ };
45382
+ const onSubmit = data => {
45383
+ var _Digit$UserService$ge, _data$reason, _data$slots, _CHBCalculationType$C, _match$getHallDetails, _match$getHallDetails2, _getHallDetails$2, _getHallDetails$3, _data$siteId, _data$purpose, _data$specialCategory;
45384
+ const userInfo = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
45385
+ const now = Date.now();
45386
+ const additionalDetails = {
45387
+ ...((data === null || data === void 0 ? void 0 : (_data$reason = data.reason) === null || _data$reason === void 0 ? void 0 : _data$reason.reasonName) && {
45388
+ reason: data.reason.reasonName
45389
+ }),
45390
+ ...((data === null || data === void 0 ? void 0 : data.discountAmount) && {
45391
+ discountAmount: data.discountAmount
45392
+ })
45393
+ };
45394
+ const bookingSlotDetails = data === null || data === void 0 ? void 0 : (_data$slots = data.slots) === null || _data$slots === void 0 ? void 0 : _data$slots.map(slot => {
45395
+ var _CHBHallCode$CHB2, _CHBHallCode$CHB2$Hal;
45396
+ const hallInfo = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB2 = CHBHallCode.CHB) === null || _CHBHallCode$CHB2 === void 0 ? void 0 : (_CHBHallCode$CHB2$Hal = _CHBHallCode$CHB2.HallCode) === null || _CHBHallCode$CHB2$Hal === void 0 ? void 0 : _CHBHallCode$CHB2$Hal.find(h => h.HallCode === slot.hallCode);
45397
+ const formattedDate = slot !== null && slot !== void 0 && slot.bookingDate ? format(parse(slot.bookingDate, "dd-MM-yyyy", new Date()), "yyyy-MM-dd") : null;
45398
+ return {
45399
+ bookingDate: formattedDate,
45400
+ bookingEndDate: formattedDate,
45401
+ bookingFromTime: (slot === null || slot === void 0 ? void 0 : slot.fromTime) || "00:00",
45402
+ bookingToTime: (slot === null || slot === void 0 ? void 0 : slot.toTime) || "23:59",
45403
+ hallCode: slot === null || slot === void 0 ? void 0 : slot.hallCode,
45404
+ status: "INITIATE",
45405
+ capacity: (hallInfo === null || hallInfo === void 0 ? void 0 : hallInfo.capacity) || null
45406
+ };
45407
+ });
45408
+ const match = (_CHBCalculationType$C = CHBCalculationType.CHB.CalculationType) === null || _CHBCalculationType$C === void 0 ? void 0 : _CHBCalculationType$C.find(item => {
45409
+ var _getHallDetails$;
45410
+ return Object.keys(item).includes(getHallDetails === null || getHallDetails === void 0 ? void 0 : (_getHallDetails$ = getHallDetails[0]) === null || _getHallDetails$ === void 0 ? void 0 : _getHallDetails$.communityHallId);
45411
+ });
45412
+ const amount = (match === null || match === void 0 ? void 0 : (_match$getHallDetails = match[getHallDetails === null || getHallDetails === void 0 ? void 0 : (_getHallDetails$2 = getHallDetails[0]) === null || _getHallDetails$2 === void 0 ? void 0 : _getHallDetails$2.communityHallId]) === null || _match$getHallDetails === void 0 ? void 0 : (_match$getHallDetails2 = _match$getHallDetails[0]) === null || _match$getHallDetails2 === void 0 ? void 0 : _match$getHallDetails2.amount) || null;
45413
+ const slotCount = Array.isArray(bookingSlotDetails) ? bookingSlotDetails.length : 0;
45414
+ const numericAmount = Number(amount) || 0;
45415
+ const finalAmount = numericAmount * slotCount;
45416
+ const payload = {
45417
+ hallsBookingApplication: {
45418
+ tenantId,
45419
+ ...(additionalDetails && {
45420
+ additionalDetails
45421
+ }),
45422
+ bookingStatus: "INITIATED",
45423
+ applicationDate: now,
45424
+ communityHallCode: (getHallDetails === null || getHallDetails === void 0 ? void 0 : (_getHallDetails$3 = getHallDetails[0]) === null || _getHallDetails$3 === void 0 ? void 0 : _getHallDetails$3.communityHallId) || "",
45425
+ communityHallName: data === null || data === void 0 ? void 0 : (_data$siteId = data.siteId) === null || _data$siteId === void 0 ? void 0 : _data$siteId.name,
45426
+ purpose: {
45427
+ purpose: data === null || data === void 0 ? void 0 : (_data$purpose = data.purpose) === null || _data$purpose === void 0 ? void 0 : _data$purpose.code
45428
+ },
45429
+ amount: finalAmount,
45430
+ specialCategory: {
45431
+ category: data === null || data === void 0 ? void 0 : (_data$specialCategory = data.specialCategory) === null || _data$specialCategory === void 0 ? void 0 : _data$specialCategory.code
45432
+ },
45433
+ purposeDescription: data === null || data === void 0 ? void 0 : data.purposeDescription,
45434
+ bookingSlotDetails,
45435
+ owners: [{
45436
+ name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
45437
+ mobileNumber: userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber,
45438
+ emailId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.emailId,
45439
+ type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type
45440
+ }],
45441
+ workflow: {
45442
+ action: "INITIATE",
45443
+ businessService: "CommunityHallBooking",
45444
+ moduleName: "CommunityHallModule"
45379
45445
  }
45380
- var el = (0, _tabbable2.default)(modalElement)[0] || modalElement;
45381
- el.focus();
45382
- }, 0);
45383
- }
45384
- }
45385
- function markForFocusLater() {
45386
- focusLaterElements.push(document.activeElement);
45387
- }
45388
- function returnFocus() {
45389
- var preventScroll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
45390
- var toFocus = null;
45391
- try {
45392
- if (focusLaterElements.length !== 0) {
45393
- toFocus = focusLaterElements.pop();
45394
- toFocus.focus({
45395
- preventScroll: preventScroll
45396
- });
45397
45446
  }
45398
- return;
45399
- } catch (e) {
45400
- console.warn(["You tried to return focus to", toFocus, "but it is not in the DOM anymore"].join(" "));
45447
+ };
45448
+ console.log("finalpayload", payload);
45449
+ goNext(payload);
45450
+ };
45451
+ useEffect(() => {
45452
+ var _currentStepData$owne;
45453
+ const formattedData = currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.hallsBookingApplication;
45454
+ if (formattedData) {
45455
+ var _CHBHallCode$CHB3, _CHBReason$CHB, _formattedData$bookin3, _formattedData$bookin4, _formattedData$bookin5, _formattedData$additi2;
45456
+ const communityHallsOptions = CHBLocations.CHB.CommunityHalls || [];
45457
+ const purposeOptions = CHBPurpose.CHB.Purpose || [];
45458
+ const specialCategoryOptions = SpecialCategory.CHB.SpecialCategory || [];
45459
+ const hallCodeOptions = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB3 = CHBHallCode.CHB) === null || _CHBHallCode$CHB3 === void 0 ? void 0 : _CHBHallCode$CHB3.HallCode;
45460
+ const discReasonOptions = CHBReason === null || CHBReason === void 0 ? void 0 : (_CHBReason$CHB = CHBReason.CHB) === null || _CHBReason$CHB === void 0 ? void 0 : _CHBReason$CHB.DiscountReason;
45461
+ const selectedCommHall = communityHallsOptions === null || communityHallsOptions === void 0 ? void 0 : communityHallsOptions.find(item => (item === null || item === void 0 ? void 0 : item.communityHallId) == (formattedData === null || formattedData === void 0 ? void 0 : formattedData.communityHallCode));
45462
+ const selectedPurpose = purposeOptions === null || purposeOptions === void 0 ? void 0 : purposeOptions.find(item => {
45463
+ var _formattedData$purpos;
45464
+ return (item === null || item === void 0 ? void 0 : item.code) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$purpos = formattedData.purpose) === null || _formattedData$purpos === void 0 ? void 0 : _formattedData$purpos.purpose);
45465
+ });
45466
+ const selectedSpecialCat = specialCategoryOptions === null || specialCategoryOptions === void 0 ? void 0 : specialCategoryOptions.find(item => {
45467
+ var _formattedData$specia;
45468
+ return (item === null || item === void 0 ? void 0 : item.code) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$specia = formattedData.specialCategory) === null || _formattedData$specia === void 0 ? void 0 : _formattedData$specia.category);
45469
+ });
45470
+ const selectHallCode = hallCodeOptions === null || hallCodeOptions === void 0 ? void 0 : hallCodeOptions.find(item => {
45471
+ var _formattedData$bookin, _formattedData$bookin2;
45472
+ return (item === null || item === void 0 ? void 0 : item.HallCode) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin = formattedData.bookingSlotDetails) === null || _formattedData$bookin === void 0 ? void 0 : (_formattedData$bookin2 = _formattedData$bookin[0]) === null || _formattedData$bookin2 === void 0 ? void 0 : _formattedData$bookin2.hallCode);
45473
+ });
45474
+ const selectReason = discReasonOptions === null || discReasonOptions === void 0 ? void 0 : discReasonOptions.find(item => {
45475
+ var _formattedData$additi;
45476
+ return (item === null || item === void 0 ? void 0 : item.reasonName) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$additi = formattedData.additionalDetails) === null || _formattedData$additi === void 0 ? void 0 : _formattedData$additi.reason);
45477
+ });
45478
+ setValue("siteId", selectedCommHall || null);
45479
+ setValue("hallCode", selectHallCode || null);
45480
+ setValue("startDate", formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin3 = formattedData.bookingSlotDetails) === null || _formattedData$bookin3 === void 0 ? void 0 : (_formattedData$bookin4 = _formattedData$bookin3[0]) === null || _formattedData$bookin4 === void 0 ? void 0 : _formattedData$bookin4.bookingDate);
45481
+ setValue("endDate", formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin5 = formattedData.bookingSlotDetails.at(-1)) === null || _formattedData$bookin5 === void 0 ? void 0 : _formattedData$bookin5.bookingEndDate);
45482
+ setShowInfo(true);
45483
+ fiterHalls(selectedCommHall);
45484
+ slotsSearch(selectHallCode).then(response => {
45485
+ const slotsData = (response === null || response === void 0 ? void 0 : response.hallSlotAvailabiltityDetails) || [];
45486
+ setSlots(slotsData);
45487
+ setValue("slots", slotsData);
45488
+ });
45489
+ setValue("purpose", selectedPurpose || null);
45490
+ setValue("specialCategory", selectedSpecialCat || null);
45491
+ setValue("purposeDescription", formattedData.purposeDescription || "");
45492
+ setValue("discountAmount", (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$additi2 = formattedData.additionalDetails) === null || _formattedData$additi2 === void 0 ? void 0 : _formattedData$additi2.discountAmount) || "");
45493
+ setValue("reason", selectReason || null);
45401
45494
  }
45402
- }
45403
- function popWithoutFocus() {
45404
- focusLaterElements.length > 0 && focusLaterElements.pop();
45405
- }
45406
- function setupScopedFocus(element) {
45407
- modalElement = element;
45408
- if (window.addEventListener) {
45409
- window.addEventListener("blur", handleBlur, false);
45410
- document.addEventListener("focus", handleFocus, true);
45411
- } else {
45412
- window.attachEvent("onBlur", handleBlur);
45413
- document.attachEvent("onFocus", handleFocus);
45495
+ }, [currentStepData, setValue]);
45496
+ const startDate = watch("startDate");
45497
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
45498
+ onSubmit: handleSubmit(onSubmit)
45499
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_HALL_NAME"), " ", /*#__PURE__*/React.createElement("span", {
45500
+ style: {
45501
+ color: "red"
45414
45502
  }
45415
- }
45416
- function teardownScopedFocus() {
45417
- modalElement = null;
45418
- if (window.addEventListener) {
45419
- window.removeEventListener("blur", handleBlur);
45420
- document.removeEventListener("focus", handleFocus);
45421
- } else {
45422
- window.detachEvent("onBlur", handleBlur);
45423
- document.detachEvent("onFocus", handleFocus);
45503
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45504
+ control: control,
45505
+ name: "siteId",
45506
+ rules: {
45507
+ required: t("HALL_NAME_REQ")
45508
+ },
45509
+ render: props => {
45510
+ var _CHBLocations$CHB;
45511
+ return /*#__PURE__*/React.createElement(Dropdown, {
45512
+ style: {
45513
+ marginBottom: 0
45514
+ },
45515
+ className: "form-field",
45516
+ select: e => {
45517
+ props.onChange(e);
45518
+ fiterHalls(e);
45519
+ setValue("hallCode", null);
45520
+ setValue("startDate", "");
45521
+ setValue("endDate", "");
45522
+ setSlots([]);
45523
+ setShowInfo(false);
45524
+ },
45525
+ selected: props.value,
45526
+ option: CHBLocations === null || CHBLocations === void 0 ? void 0 : (_CHBLocations$CHB = CHBLocations.CHB) === null || _CHBLocations$CHB === void 0 ? void 0 : _CHBLocations$CHB.CommunityHalls,
45527
+ optionKey: "name"
45528
+ });
45424
45529
  }
45425
- }
45426
- });
45427
- unwrapExports(focusManager);
45428
-
45429
- var scopeTab_1 = createCommonjsModule(function (module, exports) {
45430
-
45431
- Object.defineProperty(exports, "__esModule", {
45432
- value: true
45433
- });
45434
- exports.default = scopeTab;
45435
- var _tabbable2 = _interopRequireDefault(tabbable_1);
45436
- function _interopRequireDefault(obj) {
45437
- return obj && obj.__esModule ? obj : {
45438
- default: obj
45439
- };
45440
- }
45441
- function getActiveElement() {
45442
- var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
45443
- return el.activeElement.shadowRoot ? getActiveElement(el.activeElement.shadowRoot) : el.activeElement;
45444
- }
45445
- function scopeTab(node, event) {
45446
- var tabbable = (0, _tabbable2.default)(node);
45447
- if (!tabbable.length) {
45448
- event.preventDefault();
45449
- return;
45530
+ }), errors.siteId && /*#__PURE__*/React.createElement("p", {
45531
+ style: {
45532
+ color: "red"
45450
45533
  }
45451
- var target = void 0;
45452
- var shiftKey = event.shiftKey;
45453
- var head = tabbable[0];
45454
- var tail = tabbable[tabbable.length - 1];
45455
- var activeElement = getActiveElement();
45456
- if (node === activeElement) {
45457
- if (!shiftKey) return;
45458
- target = tail;
45534
+ }, errors.siteId.message)), /*#__PURE__*/React.createElement(LabelFieldPair, {
45535
+ style: {
45536
+ marginTop: "20px"
45459
45537
  }
45460
- if (tail === activeElement && !shiftKey) {
45461
- target = head;
45538
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_DATE"), " ", /*#__PURE__*/React.createElement("span", {
45539
+ style: {
45540
+ color: "red"
45462
45541
  }
45463
- if (head === activeElement && shiftKey) {
45464
- target = tail;
45542
+ }, "*")), /*#__PURE__*/React.createElement("div", {
45543
+ style: {
45544
+ width: "50%"
45545
+ },
45546
+ className: "field"
45547
+ }, /*#__PURE__*/React.createElement(Controller, {
45548
+ control: control,
45549
+ name: "startDate",
45550
+ rules: {
45551
+ required: t("START_DATE_REQ")
45552
+ },
45553
+ render: props => /*#__PURE__*/React.createElement(TextInput, {
45554
+ style: {
45555
+ marginBottom: 0
45556
+ },
45557
+ type: "date",
45558
+ className: "form-field",
45559
+ value: props.value,
45560
+ min: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString().split("T")[0],
45561
+ onChange: e => {
45562
+ props.onChange(e.target.value);
45563
+ },
45564
+ onBlur: e => {
45565
+ props.onBlur(e);
45566
+ }
45567
+ })
45568
+ }), errors.startDate && /*#__PURE__*/React.createElement("p", {
45569
+ style: {
45570
+ color: "red"
45465
45571
  }
45466
- if (target) {
45467
- event.preventDefault();
45468
- target.focus();
45469
- return;
45572
+ }, errors.startDate.message))), /*#__PURE__*/React.createElement(LabelFieldPair, {
45573
+ style: {
45574
+ marginTop: "20px"
45470
45575
  }
45471
- var checkSafari = /(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);
45472
- var isSafariDesktop = checkSafari != null && checkSafari[1] != "Chrome" && /\biPod\b|\biPad\b/g.exec(navigator.userAgent) == null;
45473
- if (!isSafariDesktop) return;
45474
- var x = tabbable.indexOf(activeElement);
45475
- if (x > -1) {
45476
- x += shiftKey ? -1 : 1;
45576
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_END_DATE"), " ", /*#__PURE__*/React.createElement("span", {
45577
+ style: {
45578
+ color: "red"
45477
45579
  }
45478
- target = tabbable[x];
45479
- if (typeof target === "undefined") {
45480
- event.preventDefault();
45481
- target = shiftKey ? tail : head;
45482
- target.focus();
45483
- return;
45580
+ }, "*")), /*#__PURE__*/React.createElement("div", {
45581
+ style: {
45582
+ width: "50%"
45583
+ },
45584
+ className: "field"
45585
+ }, /*#__PURE__*/React.createElement(Controller, {
45586
+ control: control,
45587
+ name: "endDate",
45588
+ render: props => /*#__PURE__*/React.createElement(TextInput, {
45589
+ style: {
45590
+ marginBottom: 0
45591
+ },
45592
+ type: "date",
45593
+ className: "form-field",
45594
+ value: props.value,
45595
+ min: startDate ? new Date(new Date(startDate).getTime() + 24 * 60 * 60 * 1000).toISOString().split("T")[0] : new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString().split("T")[0],
45596
+ max: startDate ? new Date(new Date(startDate).getTime() + 6 * 24 * 60 * 60 * 1000).toISOString().split("T")[0] : null,
45597
+ onChange: e => {
45598
+ props.onChange(e.target.value);
45599
+ },
45600
+ onBlur: e => {
45601
+ props.onBlur(e);
45602
+ },
45603
+ disabled: !startDate
45604
+ })
45605
+ }))), /*#__PURE__*/React.createElement("div", {
45606
+ style: {
45607
+ marginTop: "20px"
45484
45608
  }
45485
- event.preventDefault();
45486
- target.focus();
45487
- }
45488
- module.exports = exports["default"];
45489
- });
45490
- unwrapExports(scopeTab_1);
45491
-
45492
- var __DEV__ = process.env.NODE_ENV !== 'production';
45493
- var warning = function () {};
45494
- if (__DEV__) {
45495
- var printWarning$2 = function printWarning(format, args) {
45496
- var len = arguments.length;
45497
- args = new Array(len > 1 ? len - 1 : 0);
45498
- for (var key = 1; key < len; key++) {
45499
- args[key - 1] = arguments[key];
45609
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("HALL_CODE"), " ", /*#__PURE__*/React.createElement("span", {
45610
+ style: {
45611
+ color: "red"
45500
45612
  }
45501
- var argIndex = 0;
45502
- var message = 'Warning: ' + format.replace(/%s/g, function () {
45503
- return args[argIndex++];
45504
- });
45505
- if (typeof console !== 'undefined') {
45506
- console.error(message);
45507
- }
45508
- try {
45509
- throw new Error(message);
45510
- } catch (x) {}
45511
- };
45512
- warning = function (condition, format, args) {
45513
- var len = arguments.length;
45514
- args = new Array(len > 2 ? len - 2 : 0);
45515
- for (var key = 2; key < len; key++) {
45516
- args[key - 2] = arguments[key];
45517
- }
45518
- if (format === undefined) {
45519
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
45613
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45614
+ control: control,
45615
+ name: "hallCode",
45616
+ rules: {
45617
+ required: t("HALL_CODE_REQ")
45618
+ },
45619
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
45620
+ style: {
45621
+ marginBottom: 0
45622
+ },
45623
+ className: "form-field",
45624
+ select: e => {
45625
+ props.onChange(e);
45626
+ slotsSearch(e);
45627
+ setShowInfo(true);
45628
+ },
45629
+ selected: props.value,
45630
+ option: getHallCodes,
45631
+ optionKey: "HallCode"
45632
+ })
45633
+ }), errors.hallCode && /*#__PURE__*/React.createElement("p", {
45634
+ style: {
45635
+ color: "red"
45520
45636
  }
45521
- if (!condition) {
45522
- printWarning$2.apply(null, [format].concat(args));
45637
+ }, errors.hallCode.message)), (getSlots === null || getSlots === void 0 ? void 0 : getSlots.length) > 0 && /*#__PURE__*/React.createElement("div", {
45638
+ style: {
45639
+ marginTop: "20px",
45640
+ marginBottom: "20px"
45523
45641
  }
45524
- };
45525
- }
45526
- var warning_1 = warning;
45527
-
45528
- var exenv = createCommonjsModule(function (module) {
45529
- (function () {
45530
-
45531
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
45532
- var ExecutionEnvironment = {
45533
- canUseDOM: canUseDOM,
45534
- canUseWorkers: typeof Worker !== 'undefined',
45535
- canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
45536
- canUseViewport: canUseDOM && !!window.screen
45537
- };
45538
- if ( module.exports) {
45539
- module.exports = ExecutionEnvironment;
45540
- } else {
45541
- window.ExecutionEnvironment = ExecutionEnvironment;
45642
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("AVAILABLE_SLOTS"), " ", /*#__PURE__*/React.createElement("span", {
45643
+ style: {
45644
+ color: "red"
45542
45645
  }
45543
- })();
45544
- });
45545
-
45546
- var safeHTMLElement = createCommonjsModule(function (module, exports) {
45547
-
45548
- Object.defineProperty(exports, "__esModule", {
45549
- value: true
45550
- });
45551
- exports.canUseDOM = exports.SafeNodeList = exports.SafeHTMLCollection = undefined;
45552
- var _exenv2 = _interopRequireDefault(exenv);
45553
- function _interopRequireDefault(obj) {
45554
- return obj && obj.__esModule ? obj : {
45555
- default: obj
45556
- };
45557
- }
45558
- var EE = _exenv2.default;
45559
- var SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};
45560
- var SafeHTMLCollection = exports.SafeHTMLCollection = EE.canUseDOM ? window.HTMLCollection : {};
45561
- var SafeNodeList = exports.SafeNodeList = EE.canUseDOM ? window.NodeList : {};
45562
- var canUseDOM = exports.canUseDOM = EE.canUseDOM;
45563
- exports.default = SafeHTMLElement;
45564
- });
45565
- unwrapExports(safeHTMLElement);
45566
-
45567
- var ariaAppHider = createCommonjsModule(function (module, exports) {
45568
-
45569
- Object.defineProperty(exports, "__esModule", {
45570
- value: true
45571
- });
45572
- exports.resetState = resetState;
45573
- exports.log = log;
45574
- exports.assertNodeList = assertNodeList;
45575
- exports.setElement = setElement;
45576
- exports.validateElement = validateElement;
45577
- exports.hide = hide;
45578
- exports.show = show;
45579
- exports.documentNotReadyOrSSRTesting = documentNotReadyOrSSRTesting;
45580
- var _warning2 = _interopRequireDefault(warning_1);
45581
- function _interopRequireDefault(obj) {
45582
- return obj && obj.__esModule ? obj : {
45583
- default: obj
45584
- };
45585
- }
45586
- var globalElement = null;
45587
- function resetState() {
45588
- if (globalElement) {
45589
- if (globalElement.removeAttribute) {
45590
- globalElement.removeAttribute("aria-hidden");
45591
- } else if (globalElement.length != null) {
45592
- globalElement.forEach(function (element) {
45593
- return element.removeAttribute("aria-hidden");
45594
- });
45595
- } else {
45596
- document.querySelectorAll(globalElement).forEach(function (element) {
45597
- return element.removeAttribute("aria-hidden");
45598
- });
45646
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45647
+ control: control,
45648
+ name: "slots",
45649
+ rules: {
45650
+ validate: value => {
45651
+ if (!value || value.length === 0) {
45652
+ return t("PLEASE_SELECT_AT_LEAST_ONE_SLOT");
45653
+ }
45654
+ return true;
45599
45655
  }
45600
- }
45601
- globalElement = null;
45602
- }
45603
- function log() {
45604
- if (process.env.NODE_ENV !== "production") {
45605
- var check = globalElement || {};
45606
- console.log("ariaAppHider ----------");
45607
- console.log(check.nodeName, check.className, check.id);
45608
- console.log("end ariaAppHider ----------");
45609
- }
45610
- }
45611
- function assertNodeList(nodeList, selector) {
45612
- if (!nodeList || !nodeList.length) {
45613
- throw new Error("react-modal: No elements were found for selector " + selector + ".");
45614
- }
45615
- }
45616
- function setElement(element) {
45617
- var useElement = element;
45618
- if (typeof useElement === "string" && safeHTMLElement.canUseDOM) {
45619
- var el = document.querySelectorAll(useElement);
45620
- assertNodeList(el, useElement);
45621
- useElement = el;
45622
- }
45623
- globalElement = useElement || globalElement;
45624
- return globalElement;
45625
- }
45626
- function validateElement(appElement) {
45627
- var el = appElement || globalElement;
45628
- if (el) {
45629
- return Array.isArray(el) || el instanceof HTMLCollection || el instanceof NodeList ? el : [el];
45630
- } else {
45631
- (0, _warning2.default)(false, ["react-modal: App element is not defined.", "Please use `Modal.setAppElement(el)` or set `appElement={el}`.", "This is needed so screen readers don't see main content", "when modal is opened. It is not recommended, but you can opt-out", "by setting `ariaHideApp={false}`."].join(" "));
45632
- return [];
45633
- }
45634
- }
45635
- function hide(appElement) {
45636
- var _iteratorNormalCompletion = true;
45637
- var _didIteratorError = false;
45638
- var _iteratorError = undefined;
45639
- try {
45640
- for (var _iterator = validateElement(appElement)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
45641
- var el = _step.value;
45642
- el.setAttribute("aria-hidden", "true");
45656
+ },
45657
+ render: field => /*#__PURE__*/React.createElement("div", {
45658
+ style: {
45659
+ display: "grid",
45660
+ gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
45661
+ gap: "16px",
45662
+ marginTop: "20px",
45663
+ width: "50%"
45643
45664
  }
45644
- } catch (err) {
45645
- _didIteratorError = true;
45646
- _iteratorError = err;
45647
- } finally {
45648
- try {
45649
- if (!_iteratorNormalCompletion && _iterator.return) {
45650
- _iterator.return();
45665
+ }, getSlots === null || getSlots === void 0 ? void 0 : getSlots.map((slot, idx) => {
45666
+ var _field$value, _slot$slotStaus;
45667
+ const slotKey = `${slot.hallCode}-${slot.bookingDate}-${slot.fromTime || ""}-${slot.toTime || ""}`;
45668
+ const isChecked = (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.some(s => s.hallCode === slot.hallCode && s.bookingDate === slot.bookingDate && s.fromTime === slot.fromTime && s.toTime === slot.toTime);
45669
+ const isAvailable = ((_slot$slotStaus = slot.slotStaus) === null || _slot$slotStaus === void 0 ? void 0 : _slot$slotStaus.toLowerCase()) === "available";
45670
+ return /*#__PURE__*/React.createElement("label", {
45671
+ key: slotKey,
45672
+ style: {
45673
+ border: "1px solid #ccc",
45674
+ borderRadius: "8px",
45675
+ padding: "12px",
45676
+ backgroundColor: isAvailable ? "#e6ffed" : "#ffe6e6",
45677
+ cursor: isAvailable ? "pointer" : "not-allowed",
45678
+ opacity: isAvailable ? 1 : 0.6,
45679
+ flexDirection: "column",
45680
+ gap: "6px"
45651
45681
  }
45652
- } finally {
45653
- if (_didIteratorError) {
45654
- throw _iteratorError;
45682
+ }, /*#__PURE__*/React.createElement("input", {
45683
+ type: "checkbox",
45684
+ checked: isChecked,
45685
+ disabled: !isAvailable,
45686
+ onChange: e => {
45687
+ if (!isAvailable) return;
45688
+ let updatedSlots = [...(field.value || [])];
45689
+ if (e.target.checked) {
45690
+ updatedSlots.push(slot);
45691
+ const sortedSlots = [...getSlots].sort((a, b) => new Date(a.bookingDate) - new Date(b.bookingDate) || (a.fromTime || "00:00").localeCompare(b.fromTime || "00:00"));
45692
+ const allSelectedKeys = updatedSlots.map(s => `${s.hallCode}-${s.bookingDate}-${s.fromTime}-${s.toTime}`);
45693
+ const firstIndex = sortedSlots.findIndex(s => `${s.hallCode}-${s.bookingDate}-${s.fromTime}-${s.toTime}` === allSelectedKeys[0]);
45694
+ const lastIndex = sortedSlots.findIndex(s => `${s.hallCode}-${s.bookingDate}-${s.fromTime}-${s.toTime}` === allSelectedKeys[allSelectedKeys.length - 1]);
45695
+ const minIndex = Math.min(firstIndex, lastIndex);
45696
+ const maxIndex = Math.max(firstIndex, lastIndex);
45697
+ const continuousSlots = sortedSlots.slice(minIndex, maxIndex + 1).filter(s => {
45698
+ var _s$slotStaus;
45699
+ return ((_s$slotStaus = s.slotStaus) === null || _s$slotStaus === void 0 ? void 0 : _s$slotStaus.toLowerCase()) === "available";
45700
+ });
45701
+ field.onChange(continuousSlots);
45702
+ } else {
45703
+ updatedSlots = updatedSlots.filter(s => !(s.hallCode === slot.hallCode && s.bookingDate === slot.bookingDate && s.fromTime === slot.fromTime && s.toTime === slot.toTime));
45704
+ field.onChange(updatedSlots);
45705
+ }
45655
45706
  }
45656
- }
45657
- }
45658
- }
45659
- function show(appElement) {
45660
- var _iteratorNormalCompletion2 = true;
45661
- var _didIteratorError2 = false;
45662
- var _iteratorError2 = undefined;
45663
- try {
45664
- for (var _iterator2 = validateElement(appElement)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
45665
- var el = _step2.value;
45666
- el.removeAttribute("aria-hidden");
45667
- }
45668
- } catch (err) {
45669
- _didIteratorError2 = true;
45670
- _iteratorError2 = err;
45671
- } finally {
45672
- try {
45673
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
45674
- _iterator2.return();
45707
+ }), /*#__PURE__*/React.createElement("span", {
45708
+ style: {
45709
+ marginLeft: "10px"
45675
45710
  }
45676
- } finally {
45677
- if (_didIteratorError2) {
45678
- throw _iteratorError2;
45711
+ }, slot.bookingDate, " (", slot.hallCode, ") \u2013", " ", /*#__PURE__*/React.createElement("span", {
45712
+ style: {
45713
+ color: slot.slotStaus === "AVAILABLE" ? "green" : "red",
45714
+ fontWeight: "bold"
45679
45715
  }
45680
- }
45716
+ }, slot.slotStaus ? slot.slotStaus.charAt(0).toUpperCase() + slot.slotStaus.slice(1).toLowerCase() : "")));
45717
+ }))
45718
+ }), errors.slots && /*#__PURE__*/React.createElement("p", {
45719
+ style: {
45720
+ color: "red"
45681
45721
  }
45722
+ }, errors.slots.message)), /*#__PURE__*/React.createElement("div", {
45723
+ style: {
45724
+ display: showInfo ? "block" : "none"
45725
+ }
45726
+ }, /*#__PURE__*/React.createElement("div", {
45727
+ style: {
45728
+ marginTop: "20px",
45729
+ marginBottom: "20px"
45730
+ }
45731
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_PURPOSE"), " ", /*#__PURE__*/React.createElement("span", {
45732
+ style: {
45733
+ color: "red"
45734
+ }
45735
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45736
+ control: control,
45737
+ name: "purpose",
45738
+ defaultValue: null,
45739
+ rules: {
45740
+ required: t("CHB_PURPOSE_REQUIRED")
45741
+ },
45742
+ render: props => {
45743
+ var _CHBPurpose$CHB;
45744
+ return /*#__PURE__*/React.createElement(Dropdown, {
45745
+ style: {
45746
+ marginBottom: 0
45747
+ },
45748
+ className: "form-field",
45749
+ select: props.onChange,
45750
+ selected: props.value,
45751
+ option: CHBPurpose === null || CHBPurpose === void 0 ? void 0 : (_CHBPurpose$CHB = CHBPurpose.CHB) === null || _CHBPurpose$CHB === void 0 ? void 0 : _CHBPurpose$CHB.Purpose,
45752
+ optionKey: "name"
45753
+ });
45754
+ }
45755
+ }), errors.purpose && /*#__PURE__*/React.createElement("p", {
45756
+ style: {
45757
+ color: "red"
45758
+ }
45759
+ }, errors.purpose.message)), /*#__PURE__*/React.createElement("div", {
45760
+ style: {
45761
+ marginBottom: "20px"
45762
+ }
45763
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_SPECIAL_CATEGORY"), " ", /*#__PURE__*/React.createElement("span", {
45764
+ style: {
45765
+ color: "red"
45766
+ }
45767
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45768
+ control: control,
45769
+ name: "specialCategory",
45770
+ defaultValue: null,
45771
+ rules: {
45772
+ required: t("CHB_SPECIAL_CATEGORY_REQUIRED")
45773
+ },
45774
+ render: props => {
45775
+ var _SpecialCategory$CHB;
45776
+ return /*#__PURE__*/React.createElement(Dropdown, {
45777
+ style: {
45778
+ marginBottom: 0
45779
+ },
45780
+ className: "form-field",
45781
+ select: props.onChange,
45782
+ selected: props.value,
45783
+ option: SpecialCategory === null || SpecialCategory === void 0 ? void 0 : (_SpecialCategory$CHB = SpecialCategory.CHB) === null || _SpecialCategory$CHB === void 0 ? void 0 : _SpecialCategory$CHB.SpecialCategory,
45784
+ optionKey: "name"
45785
+ });
45786
+ }
45787
+ }), errors.specialCategory && /*#__PURE__*/React.createElement("p", {
45788
+ style: {
45789
+ color: "red"
45790
+ }
45791
+ }, errors.specialCategory.message)), /*#__PURE__*/React.createElement(LabelFieldPair, {
45792
+ style: {
45793
+ marginBottom: "20px"
45794
+ }
45795
+ }, /*#__PURE__*/React.createElement(CardLabel, {
45796
+ className: "card-label-smaller"
45797
+ }, t("CHB_PURPOSE_DESCRIPTION"), " ", /*#__PURE__*/React.createElement("span", {
45798
+ style: {
45799
+ color: "red"
45800
+ }
45801
+ }, "*")), /*#__PURE__*/React.createElement("div", {
45802
+ className: "field",
45803
+ style: {
45804
+ width: "50%"
45805
+ }
45806
+ }, /*#__PURE__*/React.createElement(Controller, {
45807
+ control: control,
45808
+ name: "purposeDescription",
45809
+ defaultValue: "",
45810
+ rules: {
45811
+ required: t("CHB_PURPOSE_DESCRIPTION_REQUIRED"),
45812
+ minLength: {
45813
+ value: 5,
45814
+ message: t("CHB_PURPOSE_DESCRIPTION_REQUIRED_MIN")
45815
+ }
45816
+ },
45817
+ render: props => /*#__PURE__*/React.createElement(TextArea, {
45818
+ style: {
45819
+ marginBottom: 0,
45820
+ marginTop: 0
45821
+ },
45822
+ type: "textarea",
45823
+ value: props.value,
45824
+ onChange: e => {
45825
+ props.onChange(e.target.value);
45826
+ },
45827
+ onBlur: e => {
45828
+ props.onBlur(e);
45829
+ }
45830
+ })
45831
+ }), errors.purposeDescription && /*#__PURE__*/React.createElement("p", {
45832
+ style: {
45833
+ color: "red"
45834
+ }
45835
+ }, errors.purposeDescription.message))), !isCitizen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
45836
+ style: {
45837
+ marginBottom: "20px",
45838
+ width: "50%"
45839
+ }
45840
+ }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CHB_DISCOUNT_AMOUNT")}`), /*#__PURE__*/React.createElement(Controller, {
45841
+ control: control,
45842
+ name: "discountAmount",
45843
+ render: props => {
45844
+ var _errors$name;
45845
+ return /*#__PURE__*/React.createElement(TextInput, {
45846
+ type: "number",
45847
+ style: {
45848
+ marginBottom: 0,
45849
+ width: "100%"
45850
+ },
45851
+ value: props.value,
45852
+ error: errors === null || errors === void 0 ? void 0 : (_errors$name = errors.name) === null || _errors$name === void 0 ? void 0 : _errors$name.message,
45853
+ onChange: e => {
45854
+ props.onChange(e.target.value);
45855
+ },
45856
+ onBlur: e => {
45857
+ props.onBlur(e);
45858
+ },
45859
+ t: t
45860
+ });
45861
+ }
45862
+ })), /*#__PURE__*/React.createElement("div", {
45863
+ style: {
45864
+ marginBottom: "20px"
45865
+ }
45866
+ }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_DISCOUNT_REASON"), " ", /*#__PURE__*/React.createElement("span", {
45867
+ style: {
45868
+ color: "red"
45869
+ }
45870
+ }, "*")), /*#__PURE__*/React.createElement(Controller, {
45871
+ control: control,
45872
+ name: "reason",
45873
+ defaultValue: null,
45874
+ render: props => {
45875
+ var _CHBReason$CHB2;
45876
+ return /*#__PURE__*/React.createElement(Dropdown, {
45877
+ style: {
45878
+ marginBottom: 0
45879
+ },
45880
+ className: "form-field",
45881
+ select: props.onChange,
45882
+ selected: props.value,
45883
+ option: CHBReason === null || CHBReason === void 0 ? void 0 : (_CHBReason$CHB2 = CHBReason.CHB) === null || _CHBReason$CHB2 === void 0 ? void 0 : _CHBReason$CHB2.DiscountReason,
45884
+ optionKey: "reasonName"
45885
+ });
45886
+ }
45887
+ }))))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
45888
+ label: "Next",
45889
+ submit: "submit"
45890
+ }))), (CHBCalcLoading || CHBReasonLoading || CHBLocationLoading || CHBLoading || CHBPurposeLoading || CHBSpecialCategoryLoading || CHBHallCodeLoading || loader) && /*#__PURE__*/React.createElement(Loader, {
45891
+ page: true
45892
+ }));
45893
+ };
45894
+
45895
+ const NewADSStepFormOne = ({
45896
+ config,
45897
+ onGoNext,
45898
+ onBackClick
45899
+ }) => {
45900
+ const dispatch = useDispatch();
45901
+ const {
45902
+ t
45903
+ } = useTranslation();
45904
+ const [showToast, setShowToast] = useState(false);
45905
+ const [error, setError] = useState("");
45906
+ const currentStepData = useSelector(function (state) {
45907
+ return state.chb.CHBApplicationFormReducer.formData;
45908
+ });
45909
+ function goNext(data) {
45910
+ console.log("data aa rea", data);
45911
+ dispatch(UPDATE_CHBApplication_FORM(config.key, data));
45912
+ onGoNext();
45682
45913
  }
45683
- function documentNotReadyOrSSRTesting() {
45684
- globalElement = null;
45914
+ function onGoBack(data) {
45915
+ onBackClick(config.key, data);
45685
45916
  }
45686
- });
45687
- unwrapExports(ariaAppHider);
45917
+ const closeToast = () => {
45918
+ setShowToast(false);
45919
+ setError("");
45920
+ };
45921
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CHBCitizenSecond, {
45922
+ onGoBack: onGoBack,
45923
+ goNext: goNext,
45924
+ currentStepData: currentStepData,
45925
+ t: t
45926
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
45927
+ isDleteBtn: true,
45928
+ error: true,
45929
+ label: error,
45930
+ onClose: closeToast
45931
+ }));
45932
+ };
45688
45933
 
45689
- var classList = createCommonjsModule(function (module, exports) {
45934
+ var tabbable_1 = createCommonjsModule(function (module, exports) {
45690
45935
 
45691
45936
  Object.defineProperty(exports, "__esModule", {
45692
45937
  value: true
45693
45938
  });
45694
- exports.resetState = resetState;
45695
- exports.log = log;
45696
- var htmlClassList = {};
45697
- var docBodyClassList = {};
45698
- function removeClass(at, cls) {
45699
- at.classList.remove(cls);
45939
+ exports.default = findTabbableDescendants;
45940
+ var DISPLAY_NONE = "none";
45941
+ var DISPLAY_CONTENTS = "contents";
45942
+ var tabbableNode = /^(input|select|textarea|button|object|iframe)$/;
45943
+ function isNotOverflowing(element, style) {
45944
+ return style.getPropertyValue("overflow") !== "visible" || element.scrollWidth <= 0 && element.scrollHeight <= 0;
45700
45945
  }
45701
- function resetState() {
45702
- var htmlElement = document.getElementsByTagName("html")[0];
45703
- for (var cls in htmlClassList) {
45704
- removeClass(htmlElement, htmlClassList[cls]);
45946
+ function hidesContents(element) {
45947
+ var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
45948
+ if (zeroSize && !element.innerHTML) return true;
45949
+ try {
45950
+ var style = window.getComputedStyle(element);
45951
+ var displayValue = style.getPropertyValue("display");
45952
+ return zeroSize ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) : displayValue === DISPLAY_NONE;
45953
+ } catch (exception) {
45954
+ console.warn("Failed to inspect element style");
45955
+ return false;
45705
45956
  }
45706
- var body = document.body;
45707
- for (var _cls in docBodyClassList) {
45708
- removeClass(body, docBodyClassList[_cls]);
45957
+ }
45958
+ function visible(element) {
45959
+ var parentElement = element;
45960
+ var rootNode = element.getRootNode && element.getRootNode();
45961
+ while (parentElement) {
45962
+ if (parentElement === document.body) break;
45963
+ if (rootNode && parentElement === rootNode) parentElement = rootNode.host.parentNode;
45964
+ if (hidesContents(parentElement)) return false;
45965
+ parentElement = parentElement.parentNode;
45709
45966
  }
45710
- htmlClassList = {};
45711
- docBodyClassList = {};
45967
+ return true;
45712
45968
  }
45713
- function log() {
45714
- if (process.env.NODE_ENV !== "production") {
45715
- var classes = document.getElementsByTagName("html")[0].className;
45716
- var buffer = "Show tracked classes:\n\n";
45717
- buffer += "<html /> (" + classes + "):\n ";
45718
- for (var x in htmlClassList) {
45719
- buffer += " " + x + " " + htmlClassList[x] + "\n ";
45720
- }
45721
- classes = document.body.className;
45722
- buffer += "\n\ndoc.body (" + classes + "):\n ";
45723
- for (var _x in docBodyClassList) {
45724
- buffer += " " + _x + " " + docBodyClassList[_x] + "\n ";
45725
- }
45726
- buffer += "\n";
45727
- console.log(buffer);
45728
- }
45729
- }
45730
- var incrementReference = function incrementReference(poll, className) {
45731
- if (!poll[className]) {
45732
- poll[className] = 0;
45733
- }
45734
- poll[className] += 1;
45735
- return className;
45736
- };
45737
- var decrementReference = function decrementReference(poll, className) {
45738
- if (poll[className]) {
45739
- poll[className] -= 1;
45740
- }
45741
- return className;
45742
- };
45743
- var trackClass = function trackClass(classListRef, poll, classes) {
45744
- classes.forEach(function (className) {
45745
- incrementReference(poll, className);
45746
- classListRef.add(className);
45747
- });
45748
- };
45749
- var untrackClass = function untrackClass(classListRef, poll, classes) {
45750
- classes.forEach(function (className) {
45751
- decrementReference(poll, className);
45752
- poll[className] === 0 && classListRef.remove(className);
45753
- });
45754
- };
45755
- var add = exports.add = function add(element, classString) {
45756
- return trackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
45757
- };
45758
- var remove = exports.remove = function remove(element, classString) {
45759
- return untrackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
45760
- };
45761
- });
45762
- unwrapExports(classList);
45763
-
45764
- var portalOpenInstances_1 = createCommonjsModule(function (module, exports) {
45765
-
45766
- Object.defineProperty(exports, "__esModule", {
45767
- value: true
45768
- });
45769
- exports.log = log;
45770
- exports.resetState = resetState;
45771
- function _classCallCheck(instance, Constructor) {
45772
- if (!(instance instanceof Constructor)) {
45773
- throw new TypeError("Cannot call a class as a function");
45774
- }
45969
+ function focusable(element, isTabIndexNotNaN) {
45970
+ var nodeName = element.nodeName.toLowerCase();
45971
+ var res = tabbableNode.test(nodeName) && !element.disabled || (nodeName === "a" ? element.href || isTabIndexNotNaN : isTabIndexNotNaN);
45972
+ return res && visible(element);
45775
45973
  }
45776
- var PortalOpenInstances = function PortalOpenInstances() {
45777
- var _this = this;
45778
- _classCallCheck(this, PortalOpenInstances);
45779
- this.register = function (openInstance) {
45780
- if (_this.openInstances.indexOf(openInstance) !== -1) {
45781
- if (process.env.NODE_ENV !== "production") {
45782
- console.warn("React-Modal: Cannot register modal instance that's already open");
45783
- }
45784
- return;
45785
- }
45786
- _this.openInstances.push(openInstance);
45787
- _this.emit("register");
45788
- };
45789
- this.deregister = function (openInstance) {
45790
- var index = _this.openInstances.indexOf(openInstance);
45791
- if (index === -1) {
45792
- if (process.env.NODE_ENV !== "production") {
45793
- console.warn("React-Modal: Unable to deregister " + openInstance + " as " + "it was never registered");
45794
- }
45795
- return;
45796
- }
45797
- _this.openInstances.splice(index, 1);
45798
- _this.emit("deregister");
45799
- };
45800
- this.subscribe = function (callback) {
45801
- _this.subscribers.push(callback);
45802
- };
45803
- this.emit = function (eventType) {
45804
- _this.subscribers.forEach(function (subscriber) {
45805
- return subscriber(eventType, _this.openInstances.slice());
45806
- });
45807
- };
45808
- this.openInstances = [];
45809
- this.subscribers = [];
45810
- };
45811
- var portalOpenInstances = new PortalOpenInstances();
45812
- function log() {
45813
- console.log("portalOpenInstances ----------");
45814
- console.log(portalOpenInstances.openInstances.length);
45815
- portalOpenInstances.openInstances.forEach(function (p) {
45816
- return console.log(p);
45817
- });
45818
- console.log("end portalOpenInstances ----------");
45974
+ function tabbable(element) {
45975
+ var tabIndex = element.getAttribute("tabindex");
45976
+ if (tabIndex === null) tabIndex = undefined;
45977
+ var isTabIndexNaN = isNaN(tabIndex);
45978
+ return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);
45819
45979
  }
45820
- function resetState() {
45821
- portalOpenInstances = new PortalOpenInstances();
45980
+ function findTabbableDescendants(element) {
45981
+ var descendants = [].slice.call(element.querySelectorAll("*"), 0).reduce(function (finished, el) {
45982
+ return finished.concat(!el.shadowRoot ? [el] : findTabbableDescendants(el.shadowRoot));
45983
+ }, []);
45984
+ return descendants.filter(tabbable);
45822
45985
  }
45823
- exports.default = portalOpenInstances;
45986
+ module.exports = exports["default"];
45824
45987
  });
45825
- unwrapExports(portalOpenInstances_1);
45988
+ unwrapExports(tabbable_1);
45826
45989
 
45827
- var bodyTrap_1 = createCommonjsModule(function (module, exports) {
45990
+ var focusManager = createCommonjsModule(function (module, exports) {
45828
45991
 
45829
45992
  Object.defineProperty(exports, "__esModule", {
45830
45993
  value: true
45831
45994
  });
45832
45995
  exports.resetState = resetState;
45833
45996
  exports.log = log;
45834
- var _portalOpenInstances2 = _interopRequireDefault(portalOpenInstances_1);
45997
+ exports.handleBlur = handleBlur;
45998
+ exports.handleFocus = handleFocus;
45999
+ exports.markForFocusLater = markForFocusLater;
46000
+ exports.returnFocus = returnFocus;
46001
+ exports.popWithoutFocus = popWithoutFocus;
46002
+ exports.setupScopedFocus = setupScopedFocus;
46003
+ exports.teardownScopedFocus = teardownScopedFocus;
46004
+ var _tabbable2 = _interopRequireDefault(tabbable_1);
45835
46005
  function _interopRequireDefault(obj) {
45836
46006
  return obj && obj.__esModule ? obj : {
45837
46007
  default: obj
45838
46008
  };
45839
46009
  }
45840
- var before = void 0,
45841
- after = void 0,
45842
- instances = [];
46010
+ var focusLaterElements = [];
46011
+ var modalElement = null;
46012
+ var needToFocus = false;
45843
46013
  function resetState() {
45844
- var _arr = [before, after];
45845
- for (var _i = 0; _i < _arr.length; _i++) {
45846
- var item = _arr[_i];
45847
- if (!item) continue;
45848
- item.parentNode && item.parentNode.removeChild(item);
45849
- }
45850
- before = after = null;
45851
- instances = [];
46014
+ focusLaterElements = [];
45852
46015
  }
45853
46016
  function log() {
45854
- console.log("bodyTrap ----------");
45855
- console.log(instances.length);
45856
- var _arr2 = [before, after];
45857
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
45858
- var item = _arr2[_i2];
45859
- var check = item || {};
45860
- console.log(check.nodeName, check.className, check.id);
46017
+ if (process.env.NODE_ENV !== "production") {
46018
+ console.log("focusManager ----------");
46019
+ focusLaterElements.forEach(function (f) {
46020
+ var check = f || {};
46021
+ console.log(check.nodeName, check.className, check.id);
46022
+ });
46023
+ console.log("end focusManager ----------");
45861
46024
  }
45862
- console.log("edn bodyTrap ----------");
45863
46025
  }
45864
- function focusContent() {
45865
- if (instances.length === 0) {
45866
- if (process.env.NODE_ENV !== "production") {
45867
- console.warn("React-Modal: Open instances > 0 expected");
46026
+ function handleBlur() {
46027
+ needToFocus = true;
46028
+ }
46029
+ function handleFocus() {
46030
+ if (needToFocus) {
46031
+ needToFocus = false;
46032
+ if (!modalElement) {
46033
+ return;
46034
+ }
46035
+ setTimeout(function () {
46036
+ if (modalElement.contains(document.activeElement)) {
46037
+ return;
46038
+ }
46039
+ var el = (0, _tabbable2.default)(modalElement)[0] || modalElement;
46040
+ el.focus();
46041
+ }, 0);
46042
+ }
46043
+ }
46044
+ function markForFocusLater() {
46045
+ focusLaterElements.push(document.activeElement);
46046
+ }
46047
+ function returnFocus() {
46048
+ var preventScroll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
46049
+ var toFocus = null;
46050
+ try {
46051
+ if (focusLaterElements.length !== 0) {
46052
+ toFocus = focusLaterElements.pop();
46053
+ toFocus.focus({
46054
+ preventScroll: preventScroll
46055
+ });
45868
46056
  }
45869
46057
  return;
46058
+ } catch (e) {
46059
+ console.warn(["You tried to return focus to", toFocus, "but it is not in the DOM anymore"].join(" "));
45870
46060
  }
45871
- instances[instances.length - 1].focusContent();
45872
46061
  }
45873
- function bodyTrap(eventType, openInstances) {
45874
- if (!before && !after) {
45875
- before = document.createElement("div");
45876
- before.setAttribute("data-react-modal-body-trap", "");
45877
- before.style.position = "absolute";
45878
- before.style.opacity = "0";
45879
- before.setAttribute("tabindex", "0");
45880
- before.addEventListener("focus", focusContent);
45881
- after = before.cloneNode();
45882
- after.addEventListener("focus", focusContent);
46062
+ function popWithoutFocus() {
46063
+ focusLaterElements.length > 0 && focusLaterElements.pop();
46064
+ }
46065
+ function setupScopedFocus(element) {
46066
+ modalElement = element;
46067
+ if (window.addEventListener) {
46068
+ window.addEventListener("blur", handleBlur, false);
46069
+ document.addEventListener("focus", handleFocus, true);
46070
+ } else {
46071
+ window.attachEvent("onBlur", handleBlur);
46072
+ document.attachEvent("onFocus", handleFocus);
45883
46073
  }
45884
- instances = openInstances;
45885
- if (instances.length > 0) {
45886
- if (document.body.firstChild !== before) {
45887
- document.body.insertBefore(before, document.body.firstChild);
45888
- }
45889
- if (document.body.lastChild !== after) {
45890
- document.body.appendChild(after);
45891
- }
46074
+ }
46075
+ function teardownScopedFocus() {
46076
+ modalElement = null;
46077
+ if (window.addEventListener) {
46078
+ window.removeEventListener("blur", handleBlur);
46079
+ document.removeEventListener("focus", handleFocus);
45892
46080
  } else {
45893
- if (before.parentElement) {
45894
- before.parentElement.removeChild(before);
45895
- }
45896
- if (after.parentElement) {
45897
- after.parentElement.removeChild(after);
45898
- }
46081
+ window.detachEvent("onBlur", handleBlur);
46082
+ document.detachEvent("onFocus", handleFocus);
45899
46083
  }
45900
46084
  }
45901
- _portalOpenInstances2.default.subscribe(bodyTrap);
45902
46085
  });
45903
- unwrapExports(bodyTrap_1);
46086
+ unwrapExports(focusManager);
45904
46087
 
45905
- var ModalPortal_1 = createCommonjsModule(function (module, exports) {
46088
+ var scopeTab_1 = createCommonjsModule(function (module, exports) {
45906
46089
 
45907
46090
  Object.defineProperty(exports, "__esModule", {
45908
46091
  value: true
45909
46092
  });
45910
- var _extends = Object.assign || function (target) {
45911
- for (var i = 1; i < arguments.length; i++) {
45912
- var source = arguments[i];
45913
- for (var key in source) {
45914
- if (Object.prototype.hasOwnProperty.call(source, key)) {
45915
- target[key] = source[key];
45916
- }
45917
- }
46093
+ exports.default = scopeTab;
46094
+ var _tabbable2 = _interopRequireDefault(tabbable_1);
46095
+ function _interopRequireDefault(obj) {
46096
+ return obj && obj.__esModule ? obj : {
46097
+ default: obj
46098
+ };
46099
+ }
46100
+ function getActiveElement() {
46101
+ var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
46102
+ return el.activeElement.shadowRoot ? getActiveElement(el.activeElement.shadowRoot) : el.activeElement;
46103
+ }
46104
+ function scopeTab(node, event) {
46105
+ var tabbable = (0, _tabbable2.default)(node);
46106
+ if (!tabbable.length) {
46107
+ event.preventDefault();
46108
+ return;
45918
46109
  }
45919
- return target;
45920
- };
45921
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
45922
- return typeof obj;
45923
- } : function (obj) {
45924
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46110
+ var target = void 0;
46111
+ var shiftKey = event.shiftKey;
46112
+ var head = tabbable[0];
46113
+ var tail = tabbable[tabbable.length - 1];
46114
+ var activeElement = getActiveElement();
46115
+ if (node === activeElement) {
46116
+ if (!shiftKey) return;
46117
+ target = tail;
46118
+ }
46119
+ if (tail === activeElement && !shiftKey) {
46120
+ target = head;
46121
+ }
46122
+ if (head === activeElement && shiftKey) {
46123
+ target = tail;
46124
+ }
46125
+ if (target) {
46126
+ event.preventDefault();
46127
+ target.focus();
46128
+ return;
46129
+ }
46130
+ var checkSafari = /(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);
46131
+ var isSafariDesktop = checkSafari != null && checkSafari[1] != "Chrome" && /\biPod\b|\biPad\b/g.exec(navigator.userAgent) == null;
46132
+ if (!isSafariDesktop) return;
46133
+ var x = tabbable.indexOf(activeElement);
46134
+ if (x > -1) {
46135
+ x += shiftKey ? -1 : 1;
46136
+ }
46137
+ target = tabbable[x];
46138
+ if (typeof target === "undefined") {
46139
+ event.preventDefault();
46140
+ target = shiftKey ? tail : head;
46141
+ target.focus();
46142
+ return;
46143
+ }
46144
+ event.preventDefault();
46145
+ target.focus();
46146
+ }
46147
+ module.exports = exports["default"];
46148
+ });
46149
+ unwrapExports(scopeTab_1);
46150
+
46151
+ var __DEV__ = process.env.NODE_ENV !== 'production';
46152
+ var warning = function () {};
46153
+ if (__DEV__) {
46154
+ var printWarning$2 = function printWarning(format, args) {
46155
+ var len = arguments.length;
46156
+ args = new Array(len > 1 ? len - 1 : 0);
46157
+ for (var key = 1; key < len; key++) {
46158
+ args[key - 1] = arguments[key];
46159
+ }
46160
+ var argIndex = 0;
46161
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
46162
+ return args[argIndex++];
46163
+ });
46164
+ if (typeof console !== 'undefined') {
46165
+ console.error(message);
46166
+ }
46167
+ try {
46168
+ throw new Error(message);
46169
+ } catch (x) {}
45925
46170
  };
45926
- var _createClass = function () {
45927
- function defineProperties(target, props) {
45928
- for (var i = 0; i < props.length; i++) {
45929
- var descriptor = props[i];
45930
- descriptor.enumerable = descriptor.enumerable || false;
45931
- descriptor.configurable = true;
45932
- if ("value" in descriptor) descriptor.writable = true;
45933
- Object.defineProperty(target, descriptor.key, descriptor);
45934
- }
46171
+ warning = function (condition, format, args) {
46172
+ var len = arguments.length;
46173
+ args = new Array(len > 2 ? len - 2 : 0);
46174
+ for (var key = 2; key < len; key++) {
46175
+ args[key - 2] = arguments[key];
45935
46176
  }
45936
- return function (Constructor, protoProps, staticProps) {
45937
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
45938
- if (staticProps) defineProperties(Constructor, staticProps);
45939
- return Constructor;
46177
+ if (format === undefined) {
46178
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
46179
+ }
46180
+ if (!condition) {
46181
+ printWarning$2.apply(null, [format].concat(args));
46182
+ }
46183
+ };
46184
+ }
46185
+ var warning_1 = warning;
46186
+
46187
+ var exenv = createCommonjsModule(function (module) {
46188
+ (function () {
46189
+
46190
+ var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
46191
+ var ExecutionEnvironment = {
46192
+ canUseDOM: canUseDOM,
46193
+ canUseWorkers: typeof Worker !== 'undefined',
46194
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
46195
+ canUseViewport: canUseDOM && !!window.screen
45940
46196
  };
45941
- }();
45942
- var _propTypes2 = _interopRequireDefault(propTypes);
45943
- var focusManager$1 = _interopRequireWildcard(focusManager);
45944
- var _scopeTab2 = _interopRequireDefault(scopeTab_1);
45945
- var ariaAppHider$1 = _interopRequireWildcard(ariaAppHider);
45946
- var classList$1 = _interopRequireWildcard(classList);
45947
- var _safeHTMLElement2 = _interopRequireDefault(safeHTMLElement);
45948
- var _portalOpenInstances2 = _interopRequireDefault(portalOpenInstances_1);
45949
- function _interopRequireWildcard(obj) {
45950
- if (obj && obj.__esModule) {
45951
- return obj;
46197
+ if ( module.exports) {
46198
+ module.exports = ExecutionEnvironment;
45952
46199
  } else {
45953
- var newObj = {};
45954
- if (obj != null) {
45955
- for (var key in obj) {
45956
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
45957
- }
45958
- }
45959
- newObj.default = obj;
45960
- return newObj;
46200
+ window.ExecutionEnvironment = ExecutionEnvironment;
45961
46201
  }
46202
+ })();
46203
+ });
46204
+
46205
+ var safeHTMLElement = createCommonjsModule(function (module, exports) {
46206
+
46207
+ Object.defineProperty(exports, "__esModule", {
46208
+ value: true
46209
+ });
46210
+ exports.canUseDOM = exports.SafeNodeList = exports.SafeHTMLCollection = undefined;
46211
+ var _exenv2 = _interopRequireDefault(exenv);
46212
+ function _interopRequireDefault(obj) {
46213
+ return obj && obj.__esModule ? obj : {
46214
+ default: obj
46215
+ };
45962
46216
  }
46217
+ var EE = _exenv2.default;
46218
+ var SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};
46219
+ var SafeHTMLCollection = exports.SafeHTMLCollection = EE.canUseDOM ? window.HTMLCollection : {};
46220
+ var SafeNodeList = exports.SafeNodeList = EE.canUseDOM ? window.NodeList : {};
46221
+ var canUseDOM = exports.canUseDOM = EE.canUseDOM;
46222
+ exports.default = SafeHTMLElement;
46223
+ });
46224
+ unwrapExports(safeHTMLElement);
46225
+
46226
+ var ariaAppHider = createCommonjsModule(function (module, exports) {
46227
+
46228
+ Object.defineProperty(exports, "__esModule", {
46229
+ value: true
46230
+ });
46231
+ exports.resetState = resetState;
46232
+ exports.log = log;
46233
+ exports.assertNodeList = assertNodeList;
46234
+ exports.setElement = setElement;
46235
+ exports.validateElement = validateElement;
46236
+ exports.hide = hide;
46237
+ exports.show = show;
46238
+ exports.documentNotReadyOrSSRTesting = documentNotReadyOrSSRTesting;
46239
+ var _warning2 = _interopRequireDefault(warning_1);
45963
46240
  function _interopRequireDefault(obj) {
45964
46241
  return obj && obj.__esModule ? obj : {
45965
46242
  default: obj
45966
46243
  };
45967
46244
  }
45968
- function _classCallCheck(instance, Constructor) {
45969
- if (!(instance instanceof Constructor)) {
45970
- throw new TypeError("Cannot call a class as a function");
46245
+ var globalElement = null;
46246
+ function resetState() {
46247
+ if (globalElement) {
46248
+ if (globalElement.removeAttribute) {
46249
+ globalElement.removeAttribute("aria-hidden");
46250
+ } else if (globalElement.length != null) {
46251
+ globalElement.forEach(function (element) {
46252
+ return element.removeAttribute("aria-hidden");
46253
+ });
46254
+ } else {
46255
+ document.querySelectorAll(globalElement).forEach(function (element) {
46256
+ return element.removeAttribute("aria-hidden");
46257
+ });
46258
+ }
45971
46259
  }
46260
+ globalElement = null;
45972
46261
  }
45973
- function _possibleConstructorReturn(self, call) {
45974
- if (!self) {
45975
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
46262
+ function log() {
46263
+ if (process.env.NODE_ENV !== "production") {
46264
+ var check = globalElement || {};
46265
+ console.log("ariaAppHider ----------");
46266
+ console.log(check.nodeName, check.className, check.id);
46267
+ console.log("end ariaAppHider ----------");
45976
46268
  }
45977
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
45978
46269
  }
45979
- function _inherits(subClass, superClass) {
45980
- if (typeof superClass !== "function" && superClass !== null) {
45981
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
46270
+ function assertNodeList(nodeList, selector) {
46271
+ if (!nodeList || !nodeList.length) {
46272
+ throw new Error("react-modal: No elements were found for selector " + selector + ".");
45982
46273
  }
45983
- subClass.prototype = Object.create(superClass && superClass.prototype, {
45984
- constructor: {
45985
- value: subClass,
45986
- enumerable: false,
45987
- writable: true,
45988
- configurable: true
45989
- }
45990
- });
45991
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
45992
46274
  }
45993
- var CLASS_NAMES = {
45994
- overlay: "ReactModal__Overlay",
45995
- content: "ReactModal__Content"
45996
- };
45997
- var isTabKey = function isTabKey(event) {
45998
- return event.code === "Tab" || event.keyCode === 9;
45999
- };
46000
- var isEscKey = function isEscKey(event) {
46001
- return event.code === "Escape" || event.keyCode === 27;
46002
- };
46003
- var ariaHiddenInstances = 0;
46004
- var ModalPortal = function (_Component) {
46005
- _inherits(ModalPortal, _Component);
46006
- function ModalPortal(props) {
46007
- _classCallCheck(this, ModalPortal);
46008
- var _this = _possibleConstructorReturn(this, (ModalPortal.__proto__ || Object.getPrototypeOf(ModalPortal)).call(this, props));
46009
- _this.setOverlayRef = function (overlay) {
46010
- _this.overlay = overlay;
46011
- _this.props.overlayRef && _this.props.overlayRef(overlay);
46012
- };
46013
- _this.setContentRef = function (content) {
46014
- _this.content = content;
46015
- _this.props.contentRef && _this.props.contentRef(content);
46016
- };
46017
- _this.afterClose = function () {
46018
- var _this$props = _this.props,
46019
- appElement = _this$props.appElement,
46020
- ariaHideApp = _this$props.ariaHideApp,
46021
- htmlOpenClassName = _this$props.htmlOpenClassName,
46022
- bodyOpenClassName = _this$props.bodyOpenClassName,
46023
- parentSelector = _this$props.parentSelector;
46024
- var parentDocument = parentSelector && parentSelector().ownerDocument || document;
46025
- bodyOpenClassName && classList$1.remove(parentDocument.body, bodyOpenClassName);
46026
- htmlOpenClassName && classList$1.remove(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
46027
- if (ariaHideApp && ariaHiddenInstances > 0) {
46028
- ariaHiddenInstances -= 1;
46029
- if (ariaHiddenInstances === 0) {
46030
- ariaAppHider$1.show(appElement);
46031
- }
46032
- }
46033
- if (_this.props.shouldFocusAfterRender) {
46034
- if (_this.props.shouldReturnFocusAfterClose) {
46035
- focusManager$1.returnFocus(_this.props.preventScroll);
46036
- focusManager$1.teardownScopedFocus();
46037
- } else {
46038
- focusManager$1.popWithoutFocus();
46039
- }
46040
- }
46041
- if (_this.props.onAfterClose) {
46042
- _this.props.onAfterClose();
46043
- }
46044
- _portalOpenInstances2.default.deregister(_this);
46045
- };
46046
- _this.open = function () {
46047
- _this.beforeOpen();
46048
- if (_this.state.afterOpen && _this.state.beforeClose) {
46049
- clearTimeout(_this.closeTimer);
46050
- _this.setState({
46051
- beforeClose: false
46052
- });
46053
- } else {
46054
- if (_this.props.shouldFocusAfterRender) {
46055
- focusManager$1.setupScopedFocus(_this.node);
46056
- focusManager$1.markForFocusLater();
46057
- }
46058
- _this.setState({
46059
- isOpen: true
46060
- }, function () {
46061
- _this.openAnimationFrame = requestAnimationFrame(function () {
46062
- _this.setState({
46063
- afterOpen: true
46064
- });
46065
- if (_this.props.isOpen && _this.props.onAfterOpen) {
46066
- _this.props.onAfterOpen({
46067
- overlayEl: _this.overlay,
46068
- contentEl: _this.content
46069
- });
46070
- }
46071
- });
46072
- });
46073
- }
46074
- };
46075
- _this.close = function () {
46076
- if (_this.props.closeTimeoutMS > 0) {
46077
- _this.closeWithTimeout();
46078
- } else {
46079
- _this.closeWithoutTimeout();
46080
- }
46081
- };
46082
- _this.focusContent = function () {
46083
- return _this.content && !_this.contentHasFocus() && _this.content.focus({
46084
- preventScroll: true
46085
- });
46086
- };
46087
- _this.closeWithTimeout = function () {
46088
- var closesAt = Date.now() + _this.props.closeTimeoutMS;
46089
- _this.setState({
46090
- beforeClose: true,
46091
- closesAt: closesAt
46092
- }, function () {
46093
- _this.closeTimer = setTimeout(_this.closeWithoutTimeout, _this.state.closesAt - Date.now());
46094
- });
46095
- };
46096
- _this.closeWithoutTimeout = function () {
46097
- _this.setState({
46098
- beforeClose: false,
46099
- isOpen: false,
46100
- afterOpen: false,
46101
- closesAt: null
46102
- }, _this.afterClose);
46103
- };
46104
- _this.handleKeyDown = function (event) {
46105
- if (isTabKey(event)) {
46106
- (0, _scopeTab2.default)(_this.content, event);
46107
- }
46108
- if (_this.props.shouldCloseOnEsc && isEscKey(event)) {
46109
- event.stopPropagation();
46110
- _this.requestClose(event);
46111
- }
46112
- };
46113
- _this.handleOverlayOnClick = function (event) {
46114
- if (_this.shouldClose === null) {
46115
- _this.shouldClose = true;
46116
- }
46117
- if (_this.shouldClose && _this.props.shouldCloseOnOverlayClick) {
46118
- if (_this.ownerHandlesClose()) {
46119
- _this.requestClose(event);
46120
- } else {
46121
- _this.focusContent();
46122
- }
46123
- }
46124
- _this.shouldClose = null;
46125
- };
46126
- _this.handleContentOnMouseUp = function () {
46127
- _this.shouldClose = false;
46128
- };
46129
- _this.handleOverlayOnMouseDown = function (event) {
46130
- if (!_this.props.shouldCloseOnOverlayClick && event.target == _this.overlay) {
46131
- event.preventDefault();
46132
- }
46133
- };
46134
- _this.handleContentOnClick = function () {
46135
- _this.shouldClose = false;
46136
- };
46137
- _this.handleContentOnMouseDown = function () {
46138
- _this.shouldClose = false;
46139
- };
46140
- _this.requestClose = function (event) {
46141
- return _this.ownerHandlesClose() && _this.props.onRequestClose(event);
46142
- };
46143
- _this.ownerHandlesClose = function () {
46144
- return _this.props.onRequestClose;
46145
- };
46146
- _this.shouldBeClosed = function () {
46147
- return !_this.state.isOpen && !_this.state.beforeClose;
46148
- };
46149
- _this.contentHasFocus = function () {
46150
- return document.activeElement === _this.content || _this.content.contains(document.activeElement);
46151
- };
46152
- _this.buildClassName = function (which, additional) {
46153
- var classNames = (typeof additional === "undefined" ? "undefined" : _typeof(additional)) === "object" ? additional : {
46154
- base: CLASS_NAMES[which],
46155
- afterOpen: CLASS_NAMES[which] + "--after-open",
46156
- beforeClose: CLASS_NAMES[which] + "--before-close"
46157
- };
46158
- var className = classNames.base;
46159
- if (_this.state.afterOpen) {
46160
- className = className + " " + classNames.afterOpen;
46161
- }
46162
- if (_this.state.beforeClose) {
46163
- className = className + " " + classNames.beforeClose;
46164
- }
46165
- return typeof additional === "string" && additional ? className + " " + additional : className;
46166
- };
46167
- _this.attributesFromObject = function (prefix, items) {
46168
- return Object.keys(items).reduce(function (acc, name) {
46169
- acc[prefix + "-" + name] = items[name];
46170
- return acc;
46171
- }, {});
46172
- };
46173
- _this.state = {
46174
- afterOpen: false,
46175
- beforeClose: false
46176
- };
46177
- _this.shouldClose = null;
46178
- _this.moveFromContentToOverlay = null;
46179
- return _this;
46275
+ function setElement(element) {
46276
+ var useElement = element;
46277
+ if (typeof useElement === "string" && safeHTMLElement.canUseDOM) {
46278
+ var el = document.querySelectorAll(useElement);
46279
+ assertNodeList(el, useElement);
46280
+ useElement = el;
46180
46281
  }
46181
- _createClass(ModalPortal, [{
46182
- key: "componentDidMount",
46183
- value: function componentDidMount() {
46184
- if (this.props.isOpen) {
46185
- this.open();
46186
- }
46282
+ globalElement = useElement || globalElement;
46283
+ return globalElement;
46284
+ }
46285
+ function validateElement(appElement) {
46286
+ var el = appElement || globalElement;
46287
+ if (el) {
46288
+ return Array.isArray(el) || el instanceof HTMLCollection || el instanceof NodeList ? el : [el];
46289
+ } else {
46290
+ (0, _warning2.default)(false, ["react-modal: App element is not defined.", "Please use `Modal.setAppElement(el)` or set `appElement={el}`.", "This is needed so screen readers don't see main content", "when modal is opened. It is not recommended, but you can opt-out", "by setting `ariaHideApp={false}`."].join(" "));
46291
+ return [];
46292
+ }
46293
+ }
46294
+ function hide(appElement) {
46295
+ var _iteratorNormalCompletion = true;
46296
+ var _didIteratorError = false;
46297
+ var _iteratorError = undefined;
46298
+ try {
46299
+ for (var _iterator = validateElement(appElement)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
46300
+ var el = _step.value;
46301
+ el.setAttribute("aria-hidden", "true");
46187
46302
  }
46188
- }, {
46189
- key: "componentDidUpdate",
46190
- value: function componentDidUpdate(prevProps, prevState) {
46191
- if (process.env.NODE_ENV !== "production") {
46192
- if (prevProps.bodyOpenClassName !== this.props.bodyOpenClassName) {
46193
- console.warn('React-Modal: "bodyOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
46194
- }
46195
- if (prevProps.htmlOpenClassName !== this.props.htmlOpenClassName) {
46196
- console.warn('React-Modal: "htmlOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
46197
- }
46198
- }
46199
- if (this.props.isOpen && !prevProps.isOpen) {
46200
- this.open();
46201
- } else if (!this.props.isOpen && prevProps.isOpen) {
46202
- this.close();
46303
+ } catch (err) {
46304
+ _didIteratorError = true;
46305
+ _iteratorError = err;
46306
+ } finally {
46307
+ try {
46308
+ if (!_iteratorNormalCompletion && _iterator.return) {
46309
+ _iterator.return();
46203
46310
  }
46204
- if (this.props.shouldFocusAfterRender && this.state.isOpen && !prevState.isOpen) {
46205
- this.focusContent();
46311
+ } finally {
46312
+ if (_didIteratorError) {
46313
+ throw _iteratorError;
46206
46314
  }
46207
46315
  }
46208
- }, {
46209
- key: "componentWillUnmount",
46210
- value: function componentWillUnmount() {
46211
- if (this.state.isOpen) {
46212
- this.afterClose();
46213
- }
46214
- clearTimeout(this.closeTimer);
46215
- cancelAnimationFrame(this.openAnimationFrame);
46316
+ }
46317
+ }
46318
+ function show(appElement) {
46319
+ var _iteratorNormalCompletion2 = true;
46320
+ var _didIteratorError2 = false;
46321
+ var _iteratorError2 = undefined;
46322
+ try {
46323
+ for (var _iterator2 = validateElement(appElement)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
46324
+ var el = _step2.value;
46325
+ el.removeAttribute("aria-hidden");
46216
46326
  }
46217
- }, {
46218
- key: "beforeOpen",
46219
- value: function beforeOpen() {
46220
- var _props = this.props,
46221
- appElement = _props.appElement,
46222
- ariaHideApp = _props.ariaHideApp,
46223
- htmlOpenClassName = _props.htmlOpenClassName,
46224
- bodyOpenClassName = _props.bodyOpenClassName,
46225
- parentSelector = _props.parentSelector;
46226
- var parentDocument = parentSelector && parentSelector().ownerDocument || document;
46227
- bodyOpenClassName && classList$1.add(parentDocument.body, bodyOpenClassName);
46228
- htmlOpenClassName && classList$1.add(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
46229
- if (ariaHideApp) {
46230
- ariaHiddenInstances += 1;
46231
- ariaAppHider$1.hide(appElement);
46327
+ } catch (err) {
46328
+ _didIteratorError2 = true;
46329
+ _iteratorError2 = err;
46330
+ } finally {
46331
+ try {
46332
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
46333
+ _iterator2.return();
46232
46334
  }
46233
- _portalOpenInstances2.default.register(this);
46234
- }
46235
- }, {
46236
- key: "render",
46237
- value: function render() {
46238
- var _props2 = this.props,
46239
- id = _props2.id,
46240
- className = _props2.className,
46241
- overlayClassName = _props2.overlayClassName,
46242
- defaultStyles = _props2.defaultStyles,
46243
- children = _props2.children;
46244
- var contentStyles = className ? {} : defaultStyles.content;
46245
- var overlayStyles = overlayClassName ? {} : defaultStyles.overlay;
46246
- if (this.shouldBeClosed()) {
46247
- return null;
46335
+ } finally {
46336
+ if (_didIteratorError2) {
46337
+ throw _iteratorError2;
46248
46338
  }
46249
- var overlayProps = {
46250
- ref: this.setOverlayRef,
46251
- className: this.buildClassName("overlay", overlayClassName),
46252
- style: _extends({}, overlayStyles, this.props.style.overlay),
46253
- onClick: this.handleOverlayOnClick,
46254
- onMouseDown: this.handleOverlayOnMouseDown
46255
- };
46256
- var contentProps = _extends({
46257
- id: id,
46258
- ref: this.setContentRef,
46259
- style: _extends({}, contentStyles, this.props.style.content),
46260
- className: this.buildClassName("content", className),
46261
- tabIndex: "-1",
46262
- onKeyDown: this.handleKeyDown,
46263
- onMouseDown: this.handleContentOnMouseDown,
46264
- onMouseUp: this.handleContentOnMouseUp,
46265
- onClick: this.handleContentOnClick,
46266
- role: this.props.role,
46267
- "aria-label": this.props.contentLabel
46268
- }, this.attributesFromObject("aria", _extends({
46269
- modal: true
46270
- }, this.props.aria)), this.attributesFromObject("data", this.props.data || {}), {
46271
- "data-testid": this.props.testId
46272
- });
46273
- var contentElement = this.props.contentElement(contentProps, children);
46274
- return this.props.overlayElement(overlayProps, contentElement);
46275
46339
  }
46276
- }]);
46277
- return ModalPortal;
46278
- }(React.Component);
46279
- ModalPortal.defaultProps = {
46280
- style: {
46281
- overlay: {},
46282
- content: {}
46283
- },
46284
- defaultStyles: {}
46285
- };
46286
- ModalPortal.propTypes = {
46287
- isOpen: _propTypes2.default.bool.isRequired,
46288
- defaultStyles: _propTypes2.default.shape({
46289
- content: _propTypes2.default.object,
46290
- overlay: _propTypes2.default.object
46291
- }),
46292
- style: _propTypes2.default.shape({
46293
- content: _propTypes2.default.object,
46294
- overlay: _propTypes2.default.object
46295
- }),
46296
- className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
46297
- overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
46298
- parentSelector: _propTypes2.default.func,
46299
- bodyOpenClassName: _propTypes2.default.string,
46300
- htmlOpenClassName: _propTypes2.default.string,
46301
- ariaHideApp: _propTypes2.default.bool,
46302
- appElement: _propTypes2.default.oneOfType([_propTypes2.default.instanceOf(_safeHTMLElement2.default), _propTypes2.default.instanceOf(safeHTMLElement.SafeHTMLCollection), _propTypes2.default.instanceOf(safeHTMLElement.SafeNodeList), _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_safeHTMLElement2.default))]),
46303
- onAfterOpen: _propTypes2.default.func,
46304
- onAfterClose: _propTypes2.default.func,
46305
- onRequestClose: _propTypes2.default.func,
46306
- closeTimeoutMS: _propTypes2.default.number,
46307
- shouldFocusAfterRender: _propTypes2.default.bool,
46308
- shouldCloseOnOverlayClick: _propTypes2.default.bool,
46309
- shouldReturnFocusAfterClose: _propTypes2.default.bool,
46310
- preventScroll: _propTypes2.default.bool,
46311
- role: _propTypes2.default.string,
46312
- contentLabel: _propTypes2.default.string,
46313
- aria: _propTypes2.default.object,
46314
- data: _propTypes2.default.object,
46315
- children: _propTypes2.default.node,
46316
- shouldCloseOnEsc: _propTypes2.default.bool,
46317
- overlayRef: _propTypes2.default.func,
46318
- contentRef: _propTypes2.default.func,
46319
- id: _propTypes2.default.string,
46320
- overlayElement: _propTypes2.default.func,
46321
- contentElement: _propTypes2.default.func,
46322
- testId: _propTypes2.default.string
46323
- };
46324
- exports.default = ModalPortal;
46325
- module.exports = exports["default"];
46326
- });
46327
- unwrapExports(ModalPortal_1);
46328
-
46329
- function componentWillMount() {
46330
- var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
46331
- if (state !== null && state !== undefined) {
46332
- this.setState(state);
46333
- }
46334
- }
46335
- function componentWillReceiveProps(nextProps) {
46336
- function updater(prevState) {
46337
- var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
46338
- return state !== null && state !== undefined ? state : null;
46339
- }
46340
- this.setState(updater.bind(this));
46341
- }
46342
- function componentWillUpdate(nextProps, nextState) {
46343
- try {
46344
- var prevProps = this.props;
46345
- var prevState = this.state;
46346
- this.props = nextProps;
46347
- this.state = nextState;
46348
- this.__reactInternalSnapshotFlag = true;
46349
- this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState);
46350
- } finally {
46351
- this.props = prevProps;
46352
- this.state = prevState;
46353
- }
46354
- }
46355
- componentWillMount.__suppressDeprecationWarning = true;
46356
- componentWillReceiveProps.__suppressDeprecationWarning = true;
46357
- componentWillUpdate.__suppressDeprecationWarning = true;
46358
- function polyfill(Component) {
46359
- var prototype = Component.prototype;
46360
- if (!prototype || !prototype.isReactComponent) {
46361
- throw new Error('Can only polyfill class components');
46362
- }
46363
- if (typeof Component.getDerivedStateFromProps !== 'function' && typeof prototype.getSnapshotBeforeUpdate !== 'function') {
46364
- return Component;
46365
- }
46366
- var foundWillMountName = null;
46367
- var foundWillReceivePropsName = null;
46368
- var foundWillUpdateName = null;
46369
- if (typeof prototype.componentWillMount === 'function') {
46370
- foundWillMountName = 'componentWillMount';
46371
- } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
46372
- foundWillMountName = 'UNSAFE_componentWillMount';
46373
- }
46374
- if (typeof prototype.componentWillReceiveProps === 'function') {
46375
- foundWillReceivePropsName = 'componentWillReceiveProps';
46376
- } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
46377
- foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
46378
- }
46379
- if (typeof prototype.componentWillUpdate === 'function') {
46380
- foundWillUpdateName = 'componentWillUpdate';
46381
- } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
46382
- foundWillUpdateName = 'UNSAFE_componentWillUpdate';
46383
- }
46384
- if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
46385
- var componentName = Component.displayName || Component.name;
46386
- var newApiName = typeof Component.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
46387
- throw Error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + componentName + ' uses ' + newApiName + ' but also contains the following legacy lifecycles:' + (foundWillMountName !== null ? '\n ' + foundWillMountName : '') + (foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '') + (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') + '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks');
46388
- }
46389
- if (typeof Component.getDerivedStateFromProps === 'function') {
46390
- prototype.componentWillMount = componentWillMount;
46391
- prototype.componentWillReceiveProps = componentWillReceiveProps;
46392
- }
46393
- if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
46394
- if (typeof prototype.componentDidUpdate !== 'function') {
46395
- throw new Error('Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype');
46396
46340
  }
46397
- prototype.componentWillUpdate = componentWillUpdate;
46398
- var componentDidUpdate = prototype.componentDidUpdate;
46399
- prototype.componentDidUpdate = function componentDidUpdatePolyfill(prevProps, prevState, maybeSnapshot) {
46400
- var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
46401
- componentDidUpdate.call(this, prevProps, prevState, snapshot);
46402
- };
46403
46341
  }
46404
- return Component;
46405
- }
46406
-
46407
- var reactLifecyclesCompat_es = {
46408
- __proto__: null,
46409
- polyfill: polyfill
46410
- };
46342
+ function documentNotReadyOrSSRTesting() {
46343
+ globalElement = null;
46344
+ }
46345
+ });
46346
+ unwrapExports(ariaAppHider);
46411
46347
 
46412
- var Modal_1 = createCommonjsModule(function (module, exports) {
46348
+ var classList = createCommonjsModule(function (module, exports) {
46413
46349
 
46414
46350
  Object.defineProperty(exports, "__esModule", {
46415
46351
  value: true
46416
46352
  });
46417
- exports.bodyOpenClassName = exports.portalClassName = undefined;
46418
- var _extends = Object.assign || function (target) {
46419
- for (var i = 1; i < arguments.length; i++) {
46420
- var source = arguments[i];
46421
- for (var key in source) {
46422
- if (Object.prototype.hasOwnProperty.call(source, key)) {
46423
- target[key] = source[key];
46424
- }
46425
- }
46353
+ exports.resetState = resetState;
46354
+ exports.log = log;
46355
+ var htmlClassList = {};
46356
+ var docBodyClassList = {};
46357
+ function removeClass(at, cls) {
46358
+ at.classList.remove(cls);
46359
+ }
46360
+ function resetState() {
46361
+ var htmlElement = document.getElementsByTagName("html")[0];
46362
+ for (var cls in htmlClassList) {
46363
+ removeClass(htmlElement, htmlClassList[cls]);
46426
46364
  }
46427
- return target;
46428
- };
46429
- var _createClass = function () {
46430
- function defineProperties(target, props) {
46431
- for (var i = 0; i < props.length; i++) {
46432
- var descriptor = props[i];
46433
- descriptor.enumerable = descriptor.enumerable || false;
46434
- descriptor.configurable = true;
46435
- if ("value" in descriptor) descriptor.writable = true;
46436
- Object.defineProperty(target, descriptor.key, descriptor);
46437
- }
46365
+ var body = document.body;
46366
+ for (var _cls in docBodyClassList) {
46367
+ removeClass(body, docBodyClassList[_cls]);
46438
46368
  }
46439
- return function (Constructor, protoProps, staticProps) {
46440
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
46441
- if (staticProps) defineProperties(Constructor, staticProps);
46442
- return Constructor;
46443
- };
46444
- }();
46445
- var _react2 = _interopRequireDefault(React);
46446
- var _reactDom2 = _interopRequireDefault(reactDom);
46447
- var _propTypes2 = _interopRequireDefault(propTypes);
46448
- var _ModalPortal2 = _interopRequireDefault(ModalPortal_1);
46449
- var ariaAppHider$1 = _interopRequireWildcard(ariaAppHider);
46450
- var _safeHTMLElement2 = _interopRequireDefault(safeHTMLElement);
46451
- function _interopRequireWildcard(obj) {
46452
- if (obj && obj.__esModule) {
46453
- return obj;
46454
- } else {
46455
- var newObj = {};
46456
- if (obj != null) {
46457
- for (var key in obj) {
46458
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
46459
- }
46369
+ htmlClassList = {};
46370
+ docBodyClassList = {};
46371
+ }
46372
+ function log() {
46373
+ if (process.env.NODE_ENV !== "production") {
46374
+ var classes = document.getElementsByTagName("html")[0].className;
46375
+ var buffer = "Show tracked classes:\n\n";
46376
+ buffer += "<html /> (" + classes + "):\n ";
46377
+ for (var x in htmlClassList) {
46378
+ buffer += " " + x + " " + htmlClassList[x] + "\n ";
46460
46379
  }
46461
- newObj.default = obj;
46462
- return newObj;
46380
+ classes = document.body.className;
46381
+ buffer += "\n\ndoc.body (" + classes + "):\n ";
46382
+ for (var _x in docBodyClassList) {
46383
+ buffer += " " + _x + " " + docBodyClassList[_x] + "\n ";
46384
+ }
46385
+ buffer += "\n";
46386
+ console.log(buffer);
46463
46387
  }
46464
46388
  }
46465
- function _interopRequireDefault(obj) {
46466
- return obj && obj.__esModule ? obj : {
46389
+ var incrementReference = function incrementReference(poll, className) {
46390
+ if (!poll[className]) {
46391
+ poll[className] = 0;
46392
+ }
46393
+ poll[className] += 1;
46394
+ return className;
46395
+ };
46396
+ var decrementReference = function decrementReference(poll, className) {
46397
+ if (poll[className]) {
46398
+ poll[className] -= 1;
46399
+ }
46400
+ return className;
46401
+ };
46402
+ var trackClass = function trackClass(classListRef, poll, classes) {
46403
+ classes.forEach(function (className) {
46404
+ incrementReference(poll, className);
46405
+ classListRef.add(className);
46406
+ });
46407
+ };
46408
+ var untrackClass = function untrackClass(classListRef, poll, classes) {
46409
+ classes.forEach(function (className) {
46410
+ decrementReference(poll, className);
46411
+ poll[className] === 0 && classListRef.remove(className);
46412
+ });
46413
+ };
46414
+ var add = exports.add = function add(element, classString) {
46415
+ return trackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
46416
+ };
46417
+ var remove = exports.remove = function remove(element, classString) {
46418
+ return untrackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
46419
+ };
46420
+ });
46421
+ unwrapExports(classList);
46422
+
46423
+ var portalOpenInstances_1 = createCommonjsModule(function (module, exports) {
46424
+
46425
+ Object.defineProperty(exports, "__esModule", {
46426
+ value: true
46427
+ });
46428
+ exports.log = log;
46429
+ exports.resetState = resetState;
46430
+ function _classCallCheck(instance, Constructor) {
46431
+ if (!(instance instanceof Constructor)) {
46432
+ throw new TypeError("Cannot call a class as a function");
46433
+ }
46434
+ }
46435
+ var PortalOpenInstances = function PortalOpenInstances() {
46436
+ var _this = this;
46437
+ _classCallCheck(this, PortalOpenInstances);
46438
+ this.register = function (openInstance) {
46439
+ if (_this.openInstances.indexOf(openInstance) !== -1) {
46440
+ if (process.env.NODE_ENV !== "production") {
46441
+ console.warn("React-Modal: Cannot register modal instance that's already open");
46442
+ }
46443
+ return;
46444
+ }
46445
+ _this.openInstances.push(openInstance);
46446
+ _this.emit("register");
46447
+ };
46448
+ this.deregister = function (openInstance) {
46449
+ var index = _this.openInstances.indexOf(openInstance);
46450
+ if (index === -1) {
46451
+ if (process.env.NODE_ENV !== "production") {
46452
+ console.warn("React-Modal: Unable to deregister " + openInstance + " as " + "it was never registered");
46453
+ }
46454
+ return;
46455
+ }
46456
+ _this.openInstances.splice(index, 1);
46457
+ _this.emit("deregister");
46458
+ };
46459
+ this.subscribe = function (callback) {
46460
+ _this.subscribers.push(callback);
46461
+ };
46462
+ this.emit = function (eventType) {
46463
+ _this.subscribers.forEach(function (subscriber) {
46464
+ return subscriber(eventType, _this.openInstances.slice());
46465
+ });
46466
+ };
46467
+ this.openInstances = [];
46468
+ this.subscribers = [];
46469
+ };
46470
+ var portalOpenInstances = new PortalOpenInstances();
46471
+ function log() {
46472
+ console.log("portalOpenInstances ----------");
46473
+ console.log(portalOpenInstances.openInstances.length);
46474
+ portalOpenInstances.openInstances.forEach(function (p) {
46475
+ return console.log(p);
46476
+ });
46477
+ console.log("end portalOpenInstances ----------");
46478
+ }
46479
+ function resetState() {
46480
+ portalOpenInstances = new PortalOpenInstances();
46481
+ }
46482
+ exports.default = portalOpenInstances;
46483
+ });
46484
+ unwrapExports(portalOpenInstances_1);
46485
+
46486
+ var bodyTrap_1 = createCommonjsModule(function (module, exports) {
46487
+
46488
+ Object.defineProperty(exports, "__esModule", {
46489
+ value: true
46490
+ });
46491
+ exports.resetState = resetState;
46492
+ exports.log = log;
46493
+ var _portalOpenInstances2 = _interopRequireDefault(portalOpenInstances_1);
46494
+ function _interopRequireDefault(obj) {
46495
+ return obj && obj.__esModule ? obj : {
46496
+ default: obj
46497
+ };
46498
+ }
46499
+ var before = void 0,
46500
+ after = void 0,
46501
+ instances = [];
46502
+ function resetState() {
46503
+ var _arr = [before, after];
46504
+ for (var _i = 0; _i < _arr.length; _i++) {
46505
+ var item = _arr[_i];
46506
+ if (!item) continue;
46507
+ item.parentNode && item.parentNode.removeChild(item);
46508
+ }
46509
+ before = after = null;
46510
+ instances = [];
46511
+ }
46512
+ function log() {
46513
+ console.log("bodyTrap ----------");
46514
+ console.log(instances.length);
46515
+ var _arr2 = [before, after];
46516
+ for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
46517
+ var item = _arr2[_i2];
46518
+ var check = item || {};
46519
+ console.log(check.nodeName, check.className, check.id);
46520
+ }
46521
+ console.log("edn bodyTrap ----------");
46522
+ }
46523
+ function focusContent() {
46524
+ if (instances.length === 0) {
46525
+ if (process.env.NODE_ENV !== "production") {
46526
+ console.warn("React-Modal: Open instances > 0 expected");
46527
+ }
46528
+ return;
46529
+ }
46530
+ instances[instances.length - 1].focusContent();
46531
+ }
46532
+ function bodyTrap(eventType, openInstances) {
46533
+ if (!before && !after) {
46534
+ before = document.createElement("div");
46535
+ before.setAttribute("data-react-modal-body-trap", "");
46536
+ before.style.position = "absolute";
46537
+ before.style.opacity = "0";
46538
+ before.setAttribute("tabindex", "0");
46539
+ before.addEventListener("focus", focusContent);
46540
+ after = before.cloneNode();
46541
+ after.addEventListener("focus", focusContent);
46542
+ }
46543
+ instances = openInstances;
46544
+ if (instances.length > 0) {
46545
+ if (document.body.firstChild !== before) {
46546
+ document.body.insertBefore(before, document.body.firstChild);
46547
+ }
46548
+ if (document.body.lastChild !== after) {
46549
+ document.body.appendChild(after);
46550
+ }
46551
+ } else {
46552
+ if (before.parentElement) {
46553
+ before.parentElement.removeChild(before);
46554
+ }
46555
+ if (after.parentElement) {
46556
+ after.parentElement.removeChild(after);
46557
+ }
46558
+ }
46559
+ }
46560
+ _portalOpenInstances2.default.subscribe(bodyTrap);
46561
+ });
46562
+ unwrapExports(bodyTrap_1);
46563
+
46564
+ var ModalPortal_1 = createCommonjsModule(function (module, exports) {
46565
+
46566
+ Object.defineProperty(exports, "__esModule", {
46567
+ value: true
46568
+ });
46569
+ var _extends = Object.assign || function (target) {
46570
+ for (var i = 1; i < arguments.length; i++) {
46571
+ var source = arguments[i];
46572
+ for (var key in source) {
46573
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
46574
+ target[key] = source[key];
46575
+ }
46576
+ }
46577
+ }
46578
+ return target;
46579
+ };
46580
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
46581
+ return typeof obj;
46582
+ } : function (obj) {
46583
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46584
+ };
46585
+ var _createClass = function () {
46586
+ function defineProperties(target, props) {
46587
+ for (var i = 0; i < props.length; i++) {
46588
+ var descriptor = props[i];
46589
+ descriptor.enumerable = descriptor.enumerable || false;
46590
+ descriptor.configurable = true;
46591
+ if ("value" in descriptor) descriptor.writable = true;
46592
+ Object.defineProperty(target, descriptor.key, descriptor);
46593
+ }
46594
+ }
46595
+ return function (Constructor, protoProps, staticProps) {
46596
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
46597
+ if (staticProps) defineProperties(Constructor, staticProps);
46598
+ return Constructor;
46599
+ };
46600
+ }();
46601
+ var _propTypes2 = _interopRequireDefault(propTypes);
46602
+ var focusManager$1 = _interopRequireWildcard(focusManager);
46603
+ var _scopeTab2 = _interopRequireDefault(scopeTab_1);
46604
+ var ariaAppHider$1 = _interopRequireWildcard(ariaAppHider);
46605
+ var classList$1 = _interopRequireWildcard(classList);
46606
+ var _safeHTMLElement2 = _interopRequireDefault(safeHTMLElement);
46607
+ var _portalOpenInstances2 = _interopRequireDefault(portalOpenInstances_1);
46608
+ function _interopRequireWildcard(obj) {
46609
+ if (obj && obj.__esModule) {
46610
+ return obj;
46611
+ } else {
46612
+ var newObj = {};
46613
+ if (obj != null) {
46614
+ for (var key in obj) {
46615
+ if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
46616
+ }
46617
+ }
46618
+ newObj.default = obj;
46619
+ return newObj;
46620
+ }
46621
+ }
46622
+ function _interopRequireDefault(obj) {
46623
+ return obj && obj.__esModule ? obj : {
46467
46624
  default: obj
46468
46625
  };
46469
46626
  }
@@ -46492,1168 +46649,952 @@ var Modal_1 = createCommonjsModule(function (module, exports) {
46492
46649
  });
46493
46650
  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
46494
46651
  }
46495
- var portalClassName = exports.portalClassName = "ReactModalPortal";
46496
- var bodyOpenClassName = exports.bodyOpenClassName = "ReactModal__Body--open";
46497
- var isReact16 = safeHTMLElement.canUseDOM && _reactDom2.default.createPortal !== undefined;
46498
- var createHTMLElement = function createHTMLElement(name) {
46499
- return document.createElement(name);
46652
+ var CLASS_NAMES = {
46653
+ overlay: "ReactModal__Overlay",
46654
+ content: "ReactModal__Content"
46500
46655
  };
46501
- var getCreatePortal = function getCreatePortal() {
46502
- return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
46656
+ var isTabKey = function isTabKey(event) {
46657
+ return event.code === "Tab" || event.keyCode === 9;
46503
46658
  };
46504
- function getParentElement(parentSelector) {
46505
- return parentSelector();
46506
- }
46507
- var Modal = function (_Component) {
46508
- _inherits(Modal, _Component);
46509
- function Modal() {
46510
- var _ref;
46511
- var _temp, _this, _ret;
46512
- _classCallCheck(this, Modal);
46513
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
46514
- args[_key] = arguments[_key];
46515
- }
46516
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.removePortal = function () {
46517
- !isReact16 && _reactDom2.default.unmountComponentAtNode(_this.node);
46518
- var parent = getParentElement(_this.props.parentSelector);
46519
- if (parent && parent.contains(_this.node)) {
46520
- parent.removeChild(_this.node);
46659
+ var isEscKey = function isEscKey(event) {
46660
+ return event.code === "Escape" || event.keyCode === 27;
46661
+ };
46662
+ var ariaHiddenInstances = 0;
46663
+ var ModalPortal = function (_Component) {
46664
+ _inherits(ModalPortal, _Component);
46665
+ function ModalPortal(props) {
46666
+ _classCallCheck(this, ModalPortal);
46667
+ var _this = _possibleConstructorReturn(this, (ModalPortal.__proto__ || Object.getPrototypeOf(ModalPortal)).call(this, props));
46668
+ _this.setOverlayRef = function (overlay) {
46669
+ _this.overlay = overlay;
46670
+ _this.props.overlayRef && _this.props.overlayRef(overlay);
46671
+ };
46672
+ _this.setContentRef = function (content) {
46673
+ _this.content = content;
46674
+ _this.props.contentRef && _this.props.contentRef(content);
46675
+ };
46676
+ _this.afterClose = function () {
46677
+ var _this$props = _this.props,
46678
+ appElement = _this$props.appElement,
46679
+ ariaHideApp = _this$props.ariaHideApp,
46680
+ htmlOpenClassName = _this$props.htmlOpenClassName,
46681
+ bodyOpenClassName = _this$props.bodyOpenClassName,
46682
+ parentSelector = _this$props.parentSelector;
46683
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
46684
+ bodyOpenClassName && classList$1.remove(parentDocument.body, bodyOpenClassName);
46685
+ htmlOpenClassName && classList$1.remove(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
46686
+ if (ariaHideApp && ariaHiddenInstances > 0) {
46687
+ ariaHiddenInstances -= 1;
46688
+ if (ariaHiddenInstances === 0) {
46689
+ ariaAppHider$1.show(appElement);
46690
+ }
46691
+ }
46692
+ if (_this.props.shouldFocusAfterRender) {
46693
+ if (_this.props.shouldReturnFocusAfterClose) {
46694
+ focusManager$1.returnFocus(_this.props.preventScroll);
46695
+ focusManager$1.teardownScopedFocus();
46696
+ } else {
46697
+ focusManager$1.popWithoutFocus();
46698
+ }
46699
+ }
46700
+ if (_this.props.onAfterClose) {
46701
+ _this.props.onAfterClose();
46702
+ }
46703
+ _portalOpenInstances2.default.deregister(_this);
46704
+ };
46705
+ _this.open = function () {
46706
+ _this.beforeOpen();
46707
+ if (_this.state.afterOpen && _this.state.beforeClose) {
46708
+ clearTimeout(_this.closeTimer);
46709
+ _this.setState({
46710
+ beforeClose: false
46711
+ });
46521
46712
  } else {
46522
- console.warn('React-Modal: "parentSelector" prop did not returned any DOM ' + "element. Make sure that the parent element is unmounted to " + "avoid any memory leaks.");
46713
+ if (_this.props.shouldFocusAfterRender) {
46714
+ focusManager$1.setupScopedFocus(_this.node);
46715
+ focusManager$1.markForFocusLater();
46716
+ }
46717
+ _this.setState({
46718
+ isOpen: true
46719
+ }, function () {
46720
+ _this.openAnimationFrame = requestAnimationFrame(function () {
46721
+ _this.setState({
46722
+ afterOpen: true
46723
+ });
46724
+ if (_this.props.isOpen && _this.props.onAfterOpen) {
46725
+ _this.props.onAfterOpen({
46726
+ overlayEl: _this.overlay,
46727
+ contentEl: _this.content
46728
+ });
46729
+ }
46730
+ });
46731
+ });
46523
46732
  }
46524
- }, _this.portalRef = function (ref) {
46525
- _this.portal = ref;
46526
- }, _this.renderPortal = function (props) {
46527
- var createPortal = getCreatePortal();
46528
- var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({
46529
- defaultStyles: Modal.defaultStyles
46530
- }, props)), _this.node);
46531
- _this.portalRef(portal);
46532
- }, _temp), _possibleConstructorReturn(_this, _ret);
46733
+ };
46734
+ _this.close = function () {
46735
+ if (_this.props.closeTimeoutMS > 0) {
46736
+ _this.closeWithTimeout();
46737
+ } else {
46738
+ _this.closeWithoutTimeout();
46739
+ }
46740
+ };
46741
+ _this.focusContent = function () {
46742
+ return _this.content && !_this.contentHasFocus() && _this.content.focus({
46743
+ preventScroll: true
46744
+ });
46745
+ };
46746
+ _this.closeWithTimeout = function () {
46747
+ var closesAt = Date.now() + _this.props.closeTimeoutMS;
46748
+ _this.setState({
46749
+ beforeClose: true,
46750
+ closesAt: closesAt
46751
+ }, function () {
46752
+ _this.closeTimer = setTimeout(_this.closeWithoutTimeout, _this.state.closesAt - Date.now());
46753
+ });
46754
+ };
46755
+ _this.closeWithoutTimeout = function () {
46756
+ _this.setState({
46757
+ beforeClose: false,
46758
+ isOpen: false,
46759
+ afterOpen: false,
46760
+ closesAt: null
46761
+ }, _this.afterClose);
46762
+ };
46763
+ _this.handleKeyDown = function (event) {
46764
+ if (isTabKey(event)) {
46765
+ (0, _scopeTab2.default)(_this.content, event);
46766
+ }
46767
+ if (_this.props.shouldCloseOnEsc && isEscKey(event)) {
46768
+ event.stopPropagation();
46769
+ _this.requestClose(event);
46770
+ }
46771
+ };
46772
+ _this.handleOverlayOnClick = function (event) {
46773
+ if (_this.shouldClose === null) {
46774
+ _this.shouldClose = true;
46775
+ }
46776
+ if (_this.shouldClose && _this.props.shouldCloseOnOverlayClick) {
46777
+ if (_this.ownerHandlesClose()) {
46778
+ _this.requestClose(event);
46779
+ } else {
46780
+ _this.focusContent();
46781
+ }
46782
+ }
46783
+ _this.shouldClose = null;
46784
+ };
46785
+ _this.handleContentOnMouseUp = function () {
46786
+ _this.shouldClose = false;
46787
+ };
46788
+ _this.handleOverlayOnMouseDown = function (event) {
46789
+ if (!_this.props.shouldCloseOnOverlayClick && event.target == _this.overlay) {
46790
+ event.preventDefault();
46791
+ }
46792
+ };
46793
+ _this.handleContentOnClick = function () {
46794
+ _this.shouldClose = false;
46795
+ };
46796
+ _this.handleContentOnMouseDown = function () {
46797
+ _this.shouldClose = false;
46798
+ };
46799
+ _this.requestClose = function (event) {
46800
+ return _this.ownerHandlesClose() && _this.props.onRequestClose(event);
46801
+ };
46802
+ _this.ownerHandlesClose = function () {
46803
+ return _this.props.onRequestClose;
46804
+ };
46805
+ _this.shouldBeClosed = function () {
46806
+ return !_this.state.isOpen && !_this.state.beforeClose;
46807
+ };
46808
+ _this.contentHasFocus = function () {
46809
+ return document.activeElement === _this.content || _this.content.contains(document.activeElement);
46810
+ };
46811
+ _this.buildClassName = function (which, additional) {
46812
+ var classNames = (typeof additional === "undefined" ? "undefined" : _typeof(additional)) === "object" ? additional : {
46813
+ base: CLASS_NAMES[which],
46814
+ afterOpen: CLASS_NAMES[which] + "--after-open",
46815
+ beforeClose: CLASS_NAMES[which] + "--before-close"
46816
+ };
46817
+ var className = classNames.base;
46818
+ if (_this.state.afterOpen) {
46819
+ className = className + " " + classNames.afterOpen;
46820
+ }
46821
+ if (_this.state.beforeClose) {
46822
+ className = className + " " + classNames.beforeClose;
46823
+ }
46824
+ return typeof additional === "string" && additional ? className + " " + additional : className;
46825
+ };
46826
+ _this.attributesFromObject = function (prefix, items) {
46827
+ return Object.keys(items).reduce(function (acc, name) {
46828
+ acc[prefix + "-" + name] = items[name];
46829
+ return acc;
46830
+ }, {});
46831
+ };
46832
+ _this.state = {
46833
+ afterOpen: false,
46834
+ beforeClose: false
46835
+ };
46836
+ _this.shouldClose = null;
46837
+ _this.moveFromContentToOverlay = null;
46838
+ return _this;
46533
46839
  }
46534
- _createClass(Modal, [{
46840
+ _createClass(ModalPortal, [{
46535
46841
  key: "componentDidMount",
46536
46842
  value: function componentDidMount() {
46537
- if (!safeHTMLElement.canUseDOM) return;
46538
- if (!isReact16) {
46539
- this.node = createHTMLElement("div");
46843
+ if (this.props.isOpen) {
46844
+ this.open();
46540
46845
  }
46541
- this.node.className = this.props.portalClassName;
46542
- var parent = getParentElement(this.props.parentSelector);
46543
- parent.appendChild(this.node);
46544
- !isReact16 && this.renderPortal(this.props);
46545
- }
46546
- }, {
46547
- key: "getSnapshotBeforeUpdate",
46548
- value: function getSnapshotBeforeUpdate(prevProps) {
46549
- var prevParent = getParentElement(prevProps.parentSelector);
46550
- var nextParent = getParentElement(this.props.parentSelector);
46551
- return {
46552
- prevParent: prevParent,
46553
- nextParent: nextParent
46554
- };
46555
46846
  }
46556
46847
  }, {
46557
46848
  key: "componentDidUpdate",
46558
- value: function componentDidUpdate(prevProps, _, snapshot) {
46559
- if (!safeHTMLElement.canUseDOM) return;
46560
- var _props = this.props,
46561
- isOpen = _props.isOpen,
46562
- portalClassName = _props.portalClassName;
46563
- if (prevProps.portalClassName !== portalClassName) {
46564
- this.node.className = portalClassName;
46849
+ value: function componentDidUpdate(prevProps, prevState) {
46850
+ if (process.env.NODE_ENV !== "production") {
46851
+ if (prevProps.bodyOpenClassName !== this.props.bodyOpenClassName) {
46852
+ console.warn('React-Modal: "bodyOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
46853
+ }
46854
+ if (prevProps.htmlOpenClassName !== this.props.htmlOpenClassName) {
46855
+ console.warn('React-Modal: "htmlOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
46856
+ }
46565
46857
  }
46566
- var prevParent = snapshot.prevParent,
46567
- nextParent = snapshot.nextParent;
46568
- if (nextParent !== prevParent) {
46569
- prevParent.removeChild(this.node);
46570
- nextParent.appendChild(this.node);
46858
+ if (this.props.isOpen && !prevProps.isOpen) {
46859
+ this.open();
46860
+ } else if (!this.props.isOpen && prevProps.isOpen) {
46861
+ this.close();
46862
+ }
46863
+ if (this.props.shouldFocusAfterRender && this.state.isOpen && !prevState.isOpen) {
46864
+ this.focusContent();
46571
46865
  }
46572
- if (!prevProps.isOpen && !isOpen) return;
46573
- !isReact16 && this.renderPortal(this.props);
46574
46866
  }
46575
46867
  }, {
46576
46868
  key: "componentWillUnmount",
46577
46869
  value: function componentWillUnmount() {
46578
- if (!safeHTMLElement.canUseDOM || !this.node || !this.portal) return;
46579
- var state = this.portal.state;
46580
- var now = Date.now();
46581
- var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS);
46582
- if (closesAt) {
46583
- if (!state.beforeClose) {
46584
- this.portal.closeWithTimeout();
46585
- }
46586
- setTimeout(this.removePortal, closesAt - now);
46587
- } else {
46588
- this.removePortal();
46870
+ if (this.state.isOpen) {
46871
+ this.afterClose();
46872
+ }
46873
+ clearTimeout(this.closeTimer);
46874
+ cancelAnimationFrame(this.openAnimationFrame);
46875
+ }
46876
+ }, {
46877
+ key: "beforeOpen",
46878
+ value: function beforeOpen() {
46879
+ var _props = this.props,
46880
+ appElement = _props.appElement,
46881
+ ariaHideApp = _props.ariaHideApp,
46882
+ htmlOpenClassName = _props.htmlOpenClassName,
46883
+ bodyOpenClassName = _props.bodyOpenClassName,
46884
+ parentSelector = _props.parentSelector;
46885
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
46886
+ bodyOpenClassName && classList$1.add(parentDocument.body, bodyOpenClassName);
46887
+ htmlOpenClassName && classList$1.add(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
46888
+ if (ariaHideApp) {
46889
+ ariaHiddenInstances += 1;
46890
+ ariaAppHider$1.hide(appElement);
46589
46891
  }
46892
+ _portalOpenInstances2.default.register(this);
46590
46893
  }
46591
46894
  }, {
46592
46895
  key: "render",
46593
46896
  value: function render() {
46594
- if (!safeHTMLElement.canUseDOM || !isReact16) {
46897
+ var _props2 = this.props,
46898
+ id = _props2.id,
46899
+ className = _props2.className,
46900
+ overlayClassName = _props2.overlayClassName,
46901
+ defaultStyles = _props2.defaultStyles,
46902
+ children = _props2.children;
46903
+ var contentStyles = className ? {} : defaultStyles.content;
46904
+ var overlayStyles = overlayClassName ? {} : defaultStyles.overlay;
46905
+ if (this.shouldBeClosed()) {
46595
46906
  return null;
46596
46907
  }
46597
- if (!this.node && isReact16) {
46598
- this.node = createHTMLElement("div");
46599
- }
46600
- var createPortal = getCreatePortal();
46601
- return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({
46602
- ref: this.portalRef,
46603
- defaultStyles: Modal.defaultStyles
46604
- }, this.props)), this.node);
46605
- }
46606
- }], [{
46607
- key: "setAppElement",
46608
- value: function setAppElement(element) {
46609
- ariaAppHider$1.setElement(element);
46908
+ var overlayProps = {
46909
+ ref: this.setOverlayRef,
46910
+ className: this.buildClassName("overlay", overlayClassName),
46911
+ style: _extends({}, overlayStyles, this.props.style.overlay),
46912
+ onClick: this.handleOverlayOnClick,
46913
+ onMouseDown: this.handleOverlayOnMouseDown
46914
+ };
46915
+ var contentProps = _extends({
46916
+ id: id,
46917
+ ref: this.setContentRef,
46918
+ style: _extends({}, contentStyles, this.props.style.content),
46919
+ className: this.buildClassName("content", className),
46920
+ tabIndex: "-1",
46921
+ onKeyDown: this.handleKeyDown,
46922
+ onMouseDown: this.handleContentOnMouseDown,
46923
+ onMouseUp: this.handleContentOnMouseUp,
46924
+ onClick: this.handleContentOnClick,
46925
+ role: this.props.role,
46926
+ "aria-label": this.props.contentLabel
46927
+ }, this.attributesFromObject("aria", _extends({
46928
+ modal: true
46929
+ }, this.props.aria)), this.attributesFromObject("data", this.props.data || {}), {
46930
+ "data-testid": this.props.testId
46931
+ });
46932
+ var contentElement = this.props.contentElement(contentProps, children);
46933
+ return this.props.overlayElement(overlayProps, contentElement);
46610
46934
  }
46611
46935
  }]);
46612
- return Modal;
46936
+ return ModalPortal;
46613
46937
  }(React.Component);
46614
- Modal.propTypes = {
46938
+ ModalPortal.defaultProps = {
46939
+ style: {
46940
+ overlay: {},
46941
+ content: {}
46942
+ },
46943
+ defaultStyles: {}
46944
+ };
46945
+ ModalPortal.propTypes = {
46615
46946
  isOpen: _propTypes2.default.bool.isRequired,
46947
+ defaultStyles: _propTypes2.default.shape({
46948
+ content: _propTypes2.default.object,
46949
+ overlay: _propTypes2.default.object
46950
+ }),
46616
46951
  style: _propTypes2.default.shape({
46617
46952
  content: _propTypes2.default.object,
46618
46953
  overlay: _propTypes2.default.object
46619
46954
  }),
46620
- portalClassName: _propTypes2.default.string,
46955
+ className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
46956
+ overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
46957
+ parentSelector: _propTypes2.default.func,
46621
46958
  bodyOpenClassName: _propTypes2.default.string,
46622
46959
  htmlOpenClassName: _propTypes2.default.string,
46623
- className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
46624
- base: _propTypes2.default.string.isRequired,
46625
- afterOpen: _propTypes2.default.string.isRequired,
46626
- beforeClose: _propTypes2.default.string.isRequired
46627
- })]),
46628
- overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
46629
- base: _propTypes2.default.string.isRequired,
46630
- afterOpen: _propTypes2.default.string.isRequired,
46631
- beforeClose: _propTypes2.default.string.isRequired
46632
- })]),
46960
+ ariaHideApp: _propTypes2.default.bool,
46633
46961
  appElement: _propTypes2.default.oneOfType([_propTypes2.default.instanceOf(_safeHTMLElement2.default), _propTypes2.default.instanceOf(safeHTMLElement.SafeHTMLCollection), _propTypes2.default.instanceOf(safeHTMLElement.SafeNodeList), _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_safeHTMLElement2.default))]),
46634
46962
  onAfterOpen: _propTypes2.default.func,
46963
+ onAfterClose: _propTypes2.default.func,
46635
46964
  onRequestClose: _propTypes2.default.func,
46636
46965
  closeTimeoutMS: _propTypes2.default.number,
46637
- ariaHideApp: _propTypes2.default.bool,
46638
46966
  shouldFocusAfterRender: _propTypes2.default.bool,
46639
46967
  shouldCloseOnOverlayClick: _propTypes2.default.bool,
46640
46968
  shouldReturnFocusAfterClose: _propTypes2.default.bool,
46641
46969
  preventScroll: _propTypes2.default.bool,
46642
- parentSelector: _propTypes2.default.func,
46643
- aria: _propTypes2.default.object,
46644
- data: _propTypes2.default.object,
46645
46970
  role: _propTypes2.default.string,
46646
46971
  contentLabel: _propTypes2.default.string,
46972
+ aria: _propTypes2.default.object,
46973
+ data: _propTypes2.default.object,
46974
+ children: _propTypes2.default.node,
46647
46975
  shouldCloseOnEsc: _propTypes2.default.bool,
46648
46976
  overlayRef: _propTypes2.default.func,
46649
46977
  contentRef: _propTypes2.default.func,
46650
46978
  id: _propTypes2.default.string,
46651
46979
  overlayElement: _propTypes2.default.func,
46652
- contentElement: _propTypes2.default.func
46653
- };
46654
- Modal.defaultProps = {
46655
- isOpen: false,
46656
- portalClassName: portalClassName,
46657
- bodyOpenClassName: bodyOpenClassName,
46658
- role: "dialog",
46659
- ariaHideApp: true,
46660
- closeTimeoutMS: 0,
46661
- shouldFocusAfterRender: true,
46662
- shouldCloseOnEsc: true,
46663
- shouldCloseOnOverlayClick: true,
46664
- shouldReturnFocusAfterClose: true,
46665
- preventScroll: false,
46666
- parentSelector: function parentSelector() {
46667
- return document.body;
46668
- },
46669
- overlayElement: function overlayElement(props, contentEl) {
46670
- return _react2.default.createElement("div", props, contentEl);
46671
- },
46672
- contentElement: function contentElement(props, children) {
46673
- return _react2.default.createElement("div", props, children);
46674
- }
46980
+ contentElement: _propTypes2.default.func,
46981
+ testId: _propTypes2.default.string
46675
46982
  };
46676
- Modal.defaultStyles = {
46677
- overlay: {
46678
- position: "fixed",
46679
- top: 0,
46680
- left: 0,
46681
- right: 0,
46682
- bottom: 0,
46683
- backgroundColor: "rgba(255, 255, 255, 0.75)"
46684
- },
46685
- content: {
46686
- position: "absolute",
46687
- top: "40px",
46688
- left: "40px",
46689
- right: "40px",
46690
- bottom: "40px",
46691
- border: "1px solid #ccc",
46692
- background: "#fff",
46693
- overflow: "auto",
46694
- WebkitOverflowScrolling: "touch",
46695
- borderRadius: "4px",
46696
- outline: "none",
46697
- padding: "20px"
46983
+ exports.default = ModalPortal;
46984
+ module.exports = exports["default"];
46985
+ });
46986
+ unwrapExports(ModalPortal_1);
46987
+
46988
+ function componentWillMount() {
46989
+ var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
46990
+ if (state !== null && state !== undefined) {
46991
+ this.setState(state);
46992
+ }
46993
+ }
46994
+ function componentWillReceiveProps(nextProps) {
46995
+ function updater(prevState) {
46996
+ var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
46997
+ return state !== null && state !== undefined ? state : null;
46998
+ }
46999
+ this.setState(updater.bind(this));
47000
+ }
47001
+ function componentWillUpdate(nextProps, nextState) {
47002
+ try {
47003
+ var prevProps = this.props;
47004
+ var prevState = this.state;
47005
+ this.props = nextProps;
47006
+ this.state = nextState;
47007
+ this.__reactInternalSnapshotFlag = true;
47008
+ this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState);
47009
+ } finally {
47010
+ this.props = prevProps;
47011
+ this.state = prevState;
47012
+ }
47013
+ }
47014
+ componentWillMount.__suppressDeprecationWarning = true;
47015
+ componentWillReceiveProps.__suppressDeprecationWarning = true;
47016
+ componentWillUpdate.__suppressDeprecationWarning = true;
47017
+ function polyfill(Component) {
47018
+ var prototype = Component.prototype;
47019
+ if (!prototype || !prototype.isReactComponent) {
47020
+ throw new Error('Can only polyfill class components');
47021
+ }
47022
+ if (typeof Component.getDerivedStateFromProps !== 'function' && typeof prototype.getSnapshotBeforeUpdate !== 'function') {
47023
+ return Component;
47024
+ }
47025
+ var foundWillMountName = null;
47026
+ var foundWillReceivePropsName = null;
47027
+ var foundWillUpdateName = null;
47028
+ if (typeof prototype.componentWillMount === 'function') {
47029
+ foundWillMountName = 'componentWillMount';
47030
+ } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
47031
+ foundWillMountName = 'UNSAFE_componentWillMount';
47032
+ }
47033
+ if (typeof prototype.componentWillReceiveProps === 'function') {
47034
+ foundWillReceivePropsName = 'componentWillReceiveProps';
47035
+ } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
47036
+ foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
47037
+ }
47038
+ if (typeof prototype.componentWillUpdate === 'function') {
47039
+ foundWillUpdateName = 'componentWillUpdate';
47040
+ } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
47041
+ foundWillUpdateName = 'UNSAFE_componentWillUpdate';
47042
+ }
47043
+ if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
47044
+ var componentName = Component.displayName || Component.name;
47045
+ var newApiName = typeof Component.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
47046
+ throw Error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + componentName + ' uses ' + newApiName + ' but also contains the following legacy lifecycles:' + (foundWillMountName !== null ? '\n ' + foundWillMountName : '') + (foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '') + (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') + '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks');
47047
+ }
47048
+ if (typeof Component.getDerivedStateFromProps === 'function') {
47049
+ prototype.componentWillMount = componentWillMount;
47050
+ prototype.componentWillReceiveProps = componentWillReceiveProps;
47051
+ }
47052
+ if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
47053
+ if (typeof prototype.componentDidUpdate !== 'function') {
47054
+ throw new Error('Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype');
46698
47055
  }
46699
- };
46700
- (0, reactLifecyclesCompat_es.polyfill)(Modal);
46701
- if (process.env.NODE_ENV !== "production") {
46702
- Modal.setCreateHTMLElement = function (fn) {
46703
- return createHTMLElement = fn;
47056
+ prototype.componentWillUpdate = componentWillUpdate;
47057
+ var componentDidUpdate = prototype.componentDidUpdate;
47058
+ prototype.componentDidUpdate = function componentDidUpdatePolyfill(prevProps, prevState, maybeSnapshot) {
47059
+ var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
47060
+ componentDidUpdate.call(this, prevProps, prevState, snapshot);
46704
47061
  };
46705
47062
  }
46706
- exports.default = Modal;
46707
- });
46708
- unwrapExports(Modal_1);
47063
+ return Component;
47064
+ }
46709
47065
 
46710
- var lib = createCommonjsModule(function (module, exports) {
47066
+ var reactLifecyclesCompat_es = {
47067
+ __proto__: null,
47068
+ polyfill: polyfill
47069
+ };
47070
+
47071
+ var Modal_1 = createCommonjsModule(function (module, exports) {
46711
47072
 
46712
47073
  Object.defineProperty(exports, "__esModule", {
46713
47074
  value: true
46714
47075
  });
46715
- var _Modal2 = _interopRequireDefault(Modal_1);
46716
- function _interopRequireDefault(obj) {
46717
- return obj && obj.__esModule ? obj : {
46718
- default: obj
46719
- };
46720
- }
46721
- exports.default = _Modal2.default;
46722
- module.exports = exports["default"];
46723
- });
46724
- var Modal = unwrapExports(lib);
46725
-
46726
- const CitizenConsent = ({
46727
- showTermsPopupOwner,
46728
- setShowTermsPopupOwner,
46729
- otpVerifiedTimestamp
46730
- }) => {
46731
- var _user$info, _user$info2;
46732
- const {
46733
- t
46734
- } = useTranslation();
46735
- const user = Digit.UserService.getUser();
46736
- const ownername = user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name;
46737
- const ownermobileNumber = user === null || user === void 0 ? void 0 : user.info.mobileNumber;
46738
- const ownerEmail = user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.emailId;
46739
- const {
46740
- id
46741
- } = useParams();
46742
- const tenantId = localStorage.getItem("CITIZEN.CITY");
46743
- const [loader, setLoader] = useState(false);
46744
- const {
46745
- data,
46746
- isLoading
46747
- } = Digit.Hooks.obps.useBPADetailsPage(tenantId, {
46748
- applicationNo: id
46749
- });
46750
- const [isUploading, setIsUploading] = useState(false);
46751
- const [isFileUploaded, setIsFileUploaded] = useState(false);
46752
- const isCitizenDeclared = sessionStorage.getItem("CitizenConsentdocFilestoreidCHB");
46753
- const DateOnly = new Date();
46754
- const selfdeclarationform = `
46755
- <div style="font-family:'Times New Roman', Times, serif; color:#000; font-size:16px; line-height:1.18; margin-top:-100px; padding:0;">
46756
-
46757
- <h2 style="text-align:center; font-size:20px; margin:0 0 6px 0; font-weight:700; text-transform:uppercase;">
46758
- OWNER'S DECLARATION
46759
- </h2>
46760
-
46761
- <div style="margin-top:-52px;">
46762
- <p style="margin-bottom:-32px;"><strong>To,</strong></p>
46763
- <p style="margin-bottom:-32px;"><strong>Local Urban Bodies</strong></p>
46764
- </div>
46765
-
46766
- <p style="margin-top:-20px;"><strong>Dear Sir/Madam,</strong></p>
46767
-
46768
- <p style="margin-top:-52px;margin-bottom:-32px; text-align:justify;">
46769
- I/We further declare that I am/We are aware of all the actions taken have been authorized by me/us.
46770
- </p>
46771
-
46772
- <ol style="margin-top:-52px;margin-bottom:-32px; padding:0;">
46773
- <li style="margin-top:-5px;margin-bottom:-25px;">1. That I am/We are sole owner(s) of the site.</li>
46774
- <li style="margin-top:-5px;margin-bottom:-25px;">2. That there is no dispute regarding the site and if any dispute arises, then I/We shall be solely responsible for the same.</li>
46775
- <li style="margin-top:-5px;margin-bottom:-25px;">3. That construction of the building will be undertaken as per the approved building plans and structural design given by the Structural Engineer.</li>
46776
- <li style="margin-top:-5px;margin-bottom:-25px;">4. That above stated facts are true and the requisite documents have been uploaded with this building plan and nothing has been concealed thereof.</li>
46777
- </ol>
46778
-
46779
- <!-- Signature / details table -->
46780
- <table style="width:100%; border-collapse:collapse; margin-top:6px; font-size:14px;">
46781
- <tr>
46782
- <td style="width:48%; vertical-align:top; padding:6px; border:1px dotted #000;">
46783
- <div style="font-weight:700; margin-bottom:4px;">Date:</div>
46784
- <div style="min-height:60px;">${DateOnly || "<Date of Sign>"}</div>
46785
- </td>
46786
-
46787
- <td style="width:52%; vertical-align:top; border:1px dotted #000;">
46788
- <table style="width:100%; border-collapse:collapse;">
46789
- <tr>
46790
- <td style="padding:6px; border-bottom:1px dotted #000; width:40%; font-weight:700;">Name of Owner:</td>
46791
- <td style="padding:6px; border-bottom:1px dotted #000;">${ownername}</td>
46792
- </tr>
46793
- <tr>
46794
- <td style="padding:6px; border-bottom:1px dotted #000; font-weight:700;">e-Mail:</td>
46795
- <td style="padding:6px; border-bottom:1px dotted #000;">${ownerEmail}</td>
46796
- </tr>
46797
- <tr>
46798
- <td style="padding:6px; border-bottom:1px dotted #000; font-weight:700;">Mobile:</td>
46799
- <td style="padding:6px; border-bottom:1px dotted #000;">${ownermobileNumber}</td>
46800
- </tr>
46801
- <tr>
46802
- <td style="padding:6px; font-weight:700;">Signature:</td>
46803
- <td style="padding:6px;">Verified through OTP</b></td>
46804
- </tr>
46805
- </table>
46806
- </td>
46807
- </tr>
46808
- </table>
46809
- </div>
46810
- `;
46811
- const closeModal = () => {
46812
- setShowTermsPopupOwner(false);
46813
- };
46814
- const uploadSelfDeclaration = async () => {
46815
- setLoader(true);
46816
- const Chb = [{
46817
- applicationNo: "CHB-0001",
46818
- tenantId: "pb.amritsar",
46819
- approvalDate: "2025-10-28",
46820
- TimeStamp: "2025-10-28T12:30:00Z"
46821
- }];
46822
- try {
46823
- var _result$filestoreIds$;
46824
- setIsUploading(true);
46825
- let result = await Digit.PaymentService.generatePdf(Digit.ULBService.getStateId(), {
46826
- Chb: Chb
46827
- }, "communityhallowner");
46828
- console.log(result, "RESULT");
46829
- setLoader(false);
46830
- if ((result === null || result === void 0 ? void 0 : (_result$filestoreIds$ = result.filestoreIds[0]) === null || _result$filestoreIds$ === void 0 ? void 0 : _result$filestoreIds$.length) > 0) {
46831
- alert("File Uploaded Successfully");
46832
- sessionStorage.setItem("CitizenConsentdocFilestoreidCHB", result === null || result === void 0 ? void 0 : result.filestoreIds[0]);
46833
- setIsFileUploaded(true);
46834
- } else {
46835
- alert("File Upload Failed");
47076
+ exports.bodyOpenClassName = exports.portalClassName = undefined;
47077
+ var _extends = Object.assign || function (target) {
47078
+ for (var i = 1; i < arguments.length; i++) {
47079
+ var source = arguments[i];
47080
+ for (var key in source) {
47081
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
47082
+ target[key] = source[key];
47083
+ }
46836
47084
  }
46837
- } catch (error) {
46838
- alert("Error Uploading PDF:", error);
46839
- setLoader(false);
46840
- } finally {
46841
- setLoader(false);
46842
- setIsUploading(false);
46843
- }
46844
- };
46845
- const modalStyles = {
46846
- modal: {
46847
- width: "100%",
46848
- height: "100%",
46849
- top: "0",
46850
- position: "relative",
46851
- backgroundColor: "rgba(0, 0, 0, 0.7)",
46852
- display: "flex",
46853
- justifyContent: "center",
46854
- alignItems: "center"
46855
- },
46856
- modalOverlay: {
46857
- position: "fixed",
46858
- top: "0",
46859
- left: "0",
46860
- width: "100%",
46861
- height: "100%",
46862
- backgroundColor: "rgba(0, 0, 0, 0.7)"
46863
- },
46864
- modalContent: {
46865
- backgroundColor: "#FFFFFF",
46866
- padding: "2rem",
46867
- borderRadius: "0.5rem",
46868
- maxWidth: "800px",
46869
- margin: "auto",
46870
- fontFamily: "Roboto, serif",
46871
- overflowX: "hidden",
46872
- textAlign: "justify",
46873
- boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)",
46874
- maxHeight: "80vh",
46875
- overflowY: "auto",
46876
- lineHeight: "2"
46877
- },
46878
- heading: {
46879
- textAlign: "center",
46880
- fontWeight: "bold",
46881
- marginBottom: "10px"
46882
- },
46883
- subheading: {
46884
- textAlign: "center",
46885
- fontWeight: "bold",
46886
- marginBottom: "20px"
46887
- },
46888
- rightAlignedText: {
46889
- textAlign: "right",
46890
- whiteSpace: "pre-wrap",
46891
- wordWrap: "break-word",
46892
- fontFamily: "Roboto, serif",
46893
- lineHeight: "2"
46894
47085
  }
47086
+ return target;
46895
47087
  };
46896
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Modal, {
46897
- isOpen: showTermsPopupOwner,
46898
- onRequestClose: closeModal,
46899
- contentLabel: "Self-Declaration",
46900
- style: {
46901
- modal: modalStyles.modal,
46902
- overlay: modalStyles.modalOverlay,
46903
- content: modalStyles.modalContent
47088
+ var _createClass = function () {
47089
+ function defineProperties(target, props) {
47090
+ for (var i = 0; i < props.length; i++) {
47091
+ var descriptor = props[i];
47092
+ descriptor.enumerable = descriptor.enumerable || false;
47093
+ descriptor.configurable = true;
47094
+ if ("value" in descriptor) descriptor.writable = true;
47095
+ Object.defineProperty(target, descriptor.key, descriptor);
47096
+ }
46904
47097
  }
46905
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
46906
- style: {
46907
- whiteSpace: "pre-wrap",
46908
- wordWrap: "break-word",
46909
- textAlign: "justify",
46910
- fontFamily: "Roboto, serif"
47098
+ return function (Constructor, protoProps, staticProps) {
47099
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
47100
+ if (staticProps) defineProperties(Constructor, staticProps);
47101
+ return Constructor;
47102
+ };
47103
+ }();
47104
+ var _react2 = _interopRequireDefault(React);
47105
+ var _reactDom2 = _interopRequireDefault(reactDom);
47106
+ var _propTypes2 = _interopRequireDefault(propTypes);
47107
+ var _ModalPortal2 = _interopRequireDefault(ModalPortal_1);
47108
+ var ariaAppHider$1 = _interopRequireWildcard(ariaAppHider);
47109
+ var _safeHTMLElement2 = _interopRequireDefault(safeHTMLElement);
47110
+ function _interopRequireWildcard(obj) {
47111
+ if (obj && obj.__esModule) {
47112
+ return obj;
47113
+ } else {
47114
+ var newObj = {};
47115
+ if (obj != null) {
47116
+ for (var key in obj) {
47117
+ if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
47118
+ }
47119
+ }
47120
+ newObj.default = obj;
47121
+ return newObj;
46911
47122
  }
46912
- }, /*#__PURE__*/React.createElement("div", {
46913
- dangerouslySetInnerHTML: {
46914
- __html: selfdeclarationform
47123
+ }
47124
+ function _interopRequireDefault(obj) {
47125
+ return obj && obj.__esModule ? obj : {
47126
+ default: obj
47127
+ };
47128
+ }
47129
+ function _classCallCheck(instance, Constructor) {
47130
+ if (!(instance instanceof Constructor)) {
47131
+ throw new TypeError("Cannot call a class as a function");
46915
47132
  }
46916
- })), /*#__PURE__*/React.createElement("div", {
46917
- style: {
46918
- display: "flex",
46919
- justifyContent: "flex-end"
47133
+ }
47134
+ function _possibleConstructorReturn(self, call) {
47135
+ if (!self) {
47136
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
46920
47137
  }
46921
- }, /*#__PURE__*/React.createElement(SubmitBar, {
46922
- label: t("BPA_CLOSE"),
46923
- onSubmit: closeModal
46924
- })), /*#__PURE__*/React.createElement("br", null), !isCitizenDeclared && /*#__PURE__*/React.createElement("div", {
46925
- style: {
46926
- display: "flex",
46927
- justifyContent: "flex-end"
47138
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
47139
+ }
47140
+ function _inherits(subClass, superClass) {
47141
+ if (typeof superClass !== "function" && superClass !== null) {
47142
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
46928
47143
  }
46929
- }, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(SubmitBar, {
46930
- label: t("BPA_UPLOAD"),
46931
- onSubmit: uploadSelfDeclaration,
46932
- disabled: isUploading || isFileUploaded
46933
- })))), loader && /*#__PURE__*/React.createElement(Loader, {
46934
- page: true
46935
- }));
46936
- };
46937
-
46938
- const CHBCitizenSecond = ({
46939
- onGoBack,
46940
- goNext,
46941
- currentStepData,
46942
- t
46943
- }) => {
46944
- const tenantId = window.location.href.includes("employee") ? Digit.ULBService.getCurrentPermanentCity() : localStorage.getItem("CITIZEN.CITY");
46945
- const isCitizen = window.location.href.includes("citizen");
46946
- const [getHallDetails, setHallDetails] = useState([]);
46947
- const [getHallCodes, setHallCodes] = useState([]);
46948
- const [getSlots, setSlots] = useState([]);
46949
- const [loader, setLoader] = useState(false);
46950
- const [showInfo, setShowInfo] = useState(false);
46951
- const [uploadedFile, setUploadedFile] = useState(null);
46952
- const [file, setFile] = useState(null);
46953
- const [error, setError] = useState(null);
46954
- const [showTermsPopup, setShowTermsPopup] = useState(false);
46955
- const {
46956
- control,
46957
- handleSubmit,
46958
- setValue,
46959
- reset,
46960
- formState: {
46961
- errors
46962
- },
46963
- getValues,
46964
- watch
46965
- } = useForm({
46966
- defaultValues: {
46967
- shouldUnregister: false,
46968
- halls: [{
46969
- startDate: "",
46970
- endDate: "",
46971
- startTime: "",
46972
- endTime: ""
46973
- }]
46974
- }
46975
- });
46976
- const {
46977
- data: CHBLocations = [],
46978
- isLoading: CHBLocationLoading
46979
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
46980
- name: "Location"
46981
- }]);
46982
- const {
46983
- data: CHBDetails = [],
46984
- isLoading: CHBLoading
46985
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
46986
- name: "CommunityHalls"
46987
- }]);
46988
- const {
46989
- data: CHBPurpose = [],
46990
- isLoading: CHBPurposeLoading
46991
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
46992
- name: "Purpose"
46993
- }]);
46994
- const {
46995
- data: SpecialCategory = [],
46996
- isLoading: CHBSpecialCategoryLoading
46997
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
46998
- name: "SpecialCategory"
46999
- }]);
47000
- const {
47001
- data: CHBHallCode = [],
47002
- isLoading: CHBHallCodeLoading
47003
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
47004
- name: "HallCode"
47005
- }]);
47006
- const {
47007
- data: CHBReason = [],
47008
- isLoading: CHBReasonLoading
47009
- } = Digit.Hooks.useCustomMDMS(tenantId, "CHB", [{
47010
- name: "DiscountReason"
47011
- }]);
47012
- const fiterHalls = selected => {
47013
- var _CHBDetails$CHB, _CHBDetails$CHB$Commu, _CHBHallCode$CHB;
47014
- const filteredHalls = (CHBDetails === null || CHBDetails === void 0 ? void 0 : (_CHBDetails$CHB = CHBDetails.CHB) === null || _CHBDetails$CHB === void 0 ? void 0 : (_CHBDetails$CHB$Commu = _CHBDetails$CHB.CommunityHalls) === null || _CHBDetails$CHB$Commu === void 0 ? void 0 : _CHBDetails$CHB$Commu.filter(hall => hall.locationCode === (selected === null || selected === void 0 ? void 0 : selected.code))) || [];
47015
- setHallDetails(filteredHalls);
47016
- const hallInfo = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB = CHBHallCode.CHB) === null || _CHBHallCode$CHB === void 0 ? void 0 : _CHBHallCode$CHB.HallCode;
47017
- const getHallCodesData = hallInfo === null || hallInfo === void 0 ? void 0 : hallInfo.filter(item => (item === null || item === void 0 ? void 0 : item.communityHallId) == (selected === null || selected === void 0 ? void 0 : selected.communityHallId));
47018
- setHallCodes(getHallCodesData);
47144
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
47145
+ constructor: {
47146
+ value: subClass,
47147
+ enumerable: false,
47148
+ writable: true,
47149
+ configurable: true
47150
+ }
47151
+ });
47152
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
47153
+ }
47154
+ var portalClassName = exports.portalClassName = "ReactModalPortal";
47155
+ var bodyOpenClassName = exports.bodyOpenClassName = "ReactModal__Body--open";
47156
+ var isReact16 = safeHTMLElement.canUseDOM && _reactDom2.default.createPortal !== undefined;
47157
+ var createHTMLElement = function createHTMLElement(name) {
47158
+ return document.createElement(name);
47019
47159
  };
47020
- const slotsSearch = async data => {
47021
- var _getValues, _getValues2;
47022
- setLoader(true);
47023
- console.log("data", data);
47024
- console.log("getValues", getValues());
47025
- const payload = {
47026
- tenantId: tenantId,
47027
- communityHallCode: data.communityHallId,
47028
- hallCode: data === null || data === void 0 ? void 0 : data.HallCode,
47029
- bookingStartDate: (_getValues = getValues()) === null || _getValues === void 0 ? void 0 : _getValues.startDate,
47030
- bookingEndDate: (_getValues2 = getValues()) === null || _getValues2 === void 0 ? void 0 : _getValues2.endDate,
47031
- isTimerRequired: false
47032
- };
47033
- try {
47034
- const response = await Digit.CHBServices.slot_search({
47035
- filters: payload
47036
- });
47037
- setLoader(false);
47038
- setSlots(response === null || response === void 0 ? void 0 : response.hallSlotAvailabiltityDetails);
47039
- return response;
47040
- } catch (error) {
47041
- setLoader(false);
47042
- }
47160
+ var getCreatePortal = function getCreatePortal() {
47161
+ return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
47043
47162
  };
47044
- const onSubmit = data => {
47045
- var _Digit$UserService$ge, _data$reason, _data$slots, _getHallDetails$, _data$siteId, _data$purpose, _data$specialCategory;
47046
- console.log("data==??", data);
47047
- console.log("uploadedFile==??", uploadedFile);
47048
- const userInfo = ((_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info) || {};
47049
- const now = Date.now();
47050
- const isCitizenDeclared = sessionStorage.getItem("CitizenConsentdocFilestoreidCHB");
47051
- if (!isCitizenDeclared) {
47052
- alert("Please upload Self Certificate");
47053
- return;
47163
+ function getParentElement(parentSelector) {
47164
+ return parentSelector();
47165
+ }
47166
+ var Modal = function (_Component) {
47167
+ _inherits(Modal, _Component);
47168
+ function Modal() {
47169
+ var _ref;
47170
+ var _temp, _this, _ret;
47171
+ _classCallCheck(this, Modal);
47172
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
47173
+ args[_key] = arguments[_key];
47174
+ }
47175
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.removePortal = function () {
47176
+ !isReact16 && _reactDom2.default.unmountComponentAtNode(_this.node);
47177
+ var parent = getParentElement(_this.props.parentSelector);
47178
+ if (parent && parent.contains(_this.node)) {
47179
+ parent.removeChild(_this.node);
47180
+ } else {
47181
+ console.warn('React-Modal: "parentSelector" prop did not returned any DOM ' + "element. Make sure that the parent element is unmounted to " + "avoid any memory leaks.");
47182
+ }
47183
+ }, _this.portalRef = function (ref) {
47184
+ _this.portal = ref;
47185
+ }, _this.renderPortal = function (props) {
47186
+ var createPortal = getCreatePortal();
47187
+ var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({
47188
+ defaultStyles: Modal.defaultStyles
47189
+ }, props)), _this.node);
47190
+ _this.portalRef(portal);
47191
+ }, _temp), _possibleConstructorReturn(_this, _ret);
47054
47192
  }
47055
- const additionalDetails = {
47056
- disImage: isCitizenDeclared,
47057
- ...((data === null || data === void 0 ? void 0 : (_data$reason = data.reason) === null || _data$reason === void 0 ? void 0 : _data$reason.reasonName) && {
47058
- reason: data.reason.reasonName
47059
- }),
47060
- ...((data === null || data === void 0 ? void 0 : data.discountAmount) && {
47061
- discountAmount: data.discountAmount
47062
- })
47063
- };
47064
- const bookingSlotDetails = data === null || data === void 0 ? void 0 : (_data$slots = data.slots) === null || _data$slots === void 0 ? void 0 : _data$slots.map(slot => {
47065
- var _CHBHallCode$CHB2, _CHBHallCode$CHB2$Hal;
47066
- const hallInfo = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB2 = CHBHallCode.CHB) === null || _CHBHallCode$CHB2 === void 0 ? void 0 : (_CHBHallCode$CHB2$Hal = _CHBHallCode$CHB2.HallCode) === null || _CHBHallCode$CHB2$Hal === void 0 ? void 0 : _CHBHallCode$CHB2$Hal.find(h => h.HallCode === slot.hallCode);
47067
- const formattedDate = slot !== null && slot !== void 0 && slot.bookingDate ? format(parse(slot.bookingDate, "dd-MM-yyyy", new Date()), "yyyy-MM-dd") : null;
47068
- return {
47069
- bookingDate: formattedDate,
47070
- bookingEndDate: formattedDate,
47071
- bookingFromTime: (slot === null || slot === void 0 ? void 0 : slot.fromTime) || "00:00",
47072
- bookingToTime: (slot === null || slot === void 0 ? void 0 : slot.toTime) || "23:59",
47073
- hallCode: slot === null || slot === void 0 ? void 0 : slot.hallCode,
47074
- status: "INITIATE",
47075
- capacity: (hallInfo === null || hallInfo === void 0 ? void 0 : hallInfo.capacity) || null
47076
- };
47077
- });
47078
- const payload = {
47079
- hallsBookingApplication: {
47080
- tenantId,
47081
- ...(additionalDetails && {
47082
- additionalDetails
47083
- }),
47084
- bookingStatus: "INITIATED",
47085
- applicationDate: now,
47086
- communityHallCode: (getHallDetails === null || getHallDetails === void 0 ? void 0 : (_getHallDetails$ = getHallDetails[0]) === null || _getHallDetails$ === void 0 ? void 0 : _getHallDetails$.communityHallId) || "",
47087
- communityHallName: data === null || data === void 0 ? void 0 : (_data$siteId = data.siteId) === null || _data$siteId === void 0 ? void 0 : _data$siteId.name,
47088
- purpose: {
47089
- purpose: data === null || data === void 0 ? void 0 : (_data$purpose = data.purpose) === null || _data$purpose === void 0 ? void 0 : _data$purpose.code
47090
- },
47091
- specialCategory: {
47092
- category: data === null || data === void 0 ? void 0 : (_data$specialCategory = data.specialCategory) === null || _data$specialCategory === void 0 ? void 0 : _data$specialCategory.code
47093
- },
47094
- purposeDescription: data === null || data === void 0 ? void 0 : data.purposeDescription,
47095
- bookingSlotDetails,
47096
- owners: [{
47097
- name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
47098
- mobileNumber: userInfo === null || userInfo === void 0 ? void 0 : userInfo.mobileNumber,
47099
- emailId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.emailId,
47100
- type: userInfo === null || userInfo === void 0 ? void 0 : userInfo.type
47101
- }],
47102
- workflow: {
47103
- action: "INITIATE",
47104
- businessService: "CommunityHallBooking",
47105
- moduleName: "CommunityHallModule"
47193
+ _createClass(Modal, [{
47194
+ key: "componentDidMount",
47195
+ value: function componentDidMount() {
47196
+ if (!safeHTMLElement.canUseDOM) return;
47197
+ if (!isReact16) {
47198
+ this.node = createHTMLElement("div");
47106
47199
  }
47200
+ this.node.className = this.props.portalClassName;
47201
+ var parent = getParentElement(this.props.parentSelector);
47202
+ parent.appendChild(this.node);
47203
+ !isReact16 && this.renderPortal(this.props);
47107
47204
  }
47108
- };
47109
- goNext(payload);
47110
- };
47111
- useEffect(() => {
47112
- var _currentStepData$owne;
47113
- const formattedData = currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.hallsBookingApplication;
47114
- if (formattedData) {
47115
- var _CHBHallCode$CHB3, _CHBReason$CHB, _formattedData$bookin3, _formattedData$bookin4, _formattedData$bookin5, _formattedData$additi2;
47116
- const communityHallsOptions = CHBLocations.CHB.CommunityHalls || [];
47117
- const purposeOptions = CHBPurpose.CHB.Purpose || [];
47118
- const specialCategoryOptions = SpecialCategory.CHB.SpecialCategory || [];
47119
- const hallCodeOptions = CHBHallCode === null || CHBHallCode === void 0 ? void 0 : (_CHBHallCode$CHB3 = CHBHallCode.CHB) === null || _CHBHallCode$CHB3 === void 0 ? void 0 : _CHBHallCode$CHB3.HallCode;
47120
- const discReasonOptions = CHBReason === null || CHBReason === void 0 ? void 0 : (_CHBReason$CHB = CHBReason.CHB) === null || _CHBReason$CHB === void 0 ? void 0 : _CHBReason$CHB.DiscountReason;
47121
- console.log("discReasonOptions", discReasonOptions);
47122
- const selectedCommHall = communityHallsOptions === null || communityHallsOptions === void 0 ? void 0 : communityHallsOptions.find(item => (item === null || item === void 0 ? void 0 : item.communityHallId) == (formattedData === null || formattedData === void 0 ? void 0 : formattedData.communityHallCode));
47123
- const selectedPurpose = purposeOptions === null || purposeOptions === void 0 ? void 0 : purposeOptions.find(item => {
47124
- var _formattedData$purpos;
47125
- return (item === null || item === void 0 ? void 0 : item.code) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$purpos = formattedData.purpose) === null || _formattedData$purpos === void 0 ? void 0 : _formattedData$purpos.purpose);
47126
- });
47127
- const selectedSpecialCat = specialCategoryOptions === null || specialCategoryOptions === void 0 ? void 0 : specialCategoryOptions.find(item => {
47128
- var _formattedData$specia;
47129
- return (item === null || item === void 0 ? void 0 : item.code) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$specia = formattedData.specialCategory) === null || _formattedData$specia === void 0 ? void 0 : _formattedData$specia.category);
47130
- });
47131
- const selectHallCode = hallCodeOptions === null || hallCodeOptions === void 0 ? void 0 : hallCodeOptions.find(item => {
47132
- var _formattedData$bookin, _formattedData$bookin2;
47133
- return (item === null || item === void 0 ? void 0 : item.HallCode) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin = formattedData.bookingSlotDetails) === null || _formattedData$bookin === void 0 ? void 0 : (_formattedData$bookin2 = _formattedData$bookin[0]) === null || _formattedData$bookin2 === void 0 ? void 0 : _formattedData$bookin2.hallCode);
47134
- });
47135
- const selectReason = discReasonOptions === null || discReasonOptions === void 0 ? void 0 : discReasonOptions.find(item => {
47136
- var _formattedData$additi;
47137
- return (item === null || item === void 0 ? void 0 : item.reasonName) == (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$additi = formattedData.additionalDetails) === null || _formattedData$additi === void 0 ? void 0 : _formattedData$additi.reason);
47138
- });
47139
- console.log("formattedData", formattedData);
47140
- setValue("siteId", selectedCommHall || null);
47141
- setValue("hallCode", selectHallCode || null);
47142
- setValue("startDate", formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin3 = formattedData.bookingSlotDetails) === null || _formattedData$bookin3 === void 0 ? void 0 : (_formattedData$bookin4 = _formattedData$bookin3[0]) === null || _formattedData$bookin4 === void 0 ? void 0 : _formattedData$bookin4.bookingDate);
47143
- setValue("endDate", formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$bookin5 = formattedData.bookingSlotDetails.at(-1)) === null || _formattedData$bookin5 === void 0 ? void 0 : _formattedData$bookin5.bookingEndDate);
47144
- setShowInfo(true);
47145
- fiterHalls(selectedCommHall);
47146
- slotsSearch(selectHallCode).then(response => {
47147
- console.log("response", response);
47148
- const slotsData = (response === null || response === void 0 ? void 0 : response.hallSlotAvailabiltityDetails) || [];
47149
- setSlots(slotsData);
47150
- setValue("slots", slotsData);
47151
- });
47152
- setValue("purpose", selectedPurpose || null);
47153
- setValue("specialCategory", selectedSpecialCat || null);
47154
- setValue("purposeDescription", formattedData.purposeDescription || "");
47155
- setValue("discountAmount", (formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$additi2 = formattedData.additionalDetails) === null || _formattedData$additi2 === void 0 ? void 0 : _formattedData$additi2.discountAmount) || "");
47156
- setValue("reason", selectReason || null);
47157
- }
47158
- }, [currentStepData, setValue]);
47159
- useEffect(() => {
47160
- console.log("getSlots", getSlots);
47161
- }, [getSlots]);
47162
- useEffect(() => {
47163
- (async () => {
47164
- setError(null);
47165
- if (file) {
47166
- if (file.size >= 5242880) {
47167
- setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
47168
- } else {
47169
- setLoader(true);
47170
- try {
47171
- var _response$data, _response$data$files;
47172
- setUploadedFile(null);
47173
- const response = await Digit.UploadServices.Filestorage("CHB", file, Digit.ULBService.getStateId());
47174
- if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
47175
- var _response$data2, _response$data2$files;
47176
- setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
47177
- } else {
47178
- setError(t("CS_FILE_UPLOAD_ERROR"));
47179
- }
47180
- setLoader(false);
47181
- } catch (err) {
47182
- setLoader(false);
47183
- setError(t("CS_FILE_UPLOAD_ERROR"));
47205
+ }, {
47206
+ key: "getSnapshotBeforeUpdate",
47207
+ value: function getSnapshotBeforeUpdate(prevProps) {
47208
+ var prevParent = getParentElement(prevProps.parentSelector);
47209
+ var nextParent = getParentElement(this.props.parentSelector);
47210
+ return {
47211
+ prevParent: prevParent,
47212
+ nextParent: nextParent
47213
+ };
47214
+ }
47215
+ }, {
47216
+ key: "componentDidUpdate",
47217
+ value: function componentDidUpdate(prevProps, _, snapshot) {
47218
+ if (!safeHTMLElement.canUseDOM) return;
47219
+ var _props = this.props,
47220
+ isOpen = _props.isOpen,
47221
+ portalClassName = _props.portalClassName;
47222
+ if (prevProps.portalClassName !== portalClassName) {
47223
+ this.node.className = portalClassName;
47224
+ }
47225
+ var prevParent = snapshot.prevParent,
47226
+ nextParent = snapshot.nextParent;
47227
+ if (nextParent !== prevParent) {
47228
+ prevParent.removeChild(this.node);
47229
+ nextParent.appendChild(this.node);
47230
+ }
47231
+ if (!prevProps.isOpen && !isOpen) return;
47232
+ !isReact16 && this.renderPortal(this.props);
47233
+ }
47234
+ }, {
47235
+ key: "componentWillUnmount",
47236
+ value: function componentWillUnmount() {
47237
+ if (!safeHTMLElement.canUseDOM || !this.node || !this.portal) return;
47238
+ var state = this.portal.state;
47239
+ var now = Date.now();
47240
+ var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS);
47241
+ if (closesAt) {
47242
+ if (!state.beforeClose) {
47243
+ this.portal.closeWithTimeout();
47184
47244
  }
47245
+ setTimeout(this.removePortal, closesAt - now);
47246
+ } else {
47247
+ this.removePortal();
47185
47248
  }
47186
47249
  }
47187
- })();
47188
- }, [file]);
47189
- const startDate = watch("startDate");
47190
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
47191
- onSubmit: handleSubmit(onSubmit)
47192
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_HALL_NAME"), " ", /*#__PURE__*/React.createElement("span", {
47193
- style: {
47194
- color: "red"
47195
- }
47196
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47197
- control: control,
47198
- name: "siteId",
47199
- rules: {
47200
- required: t("HALL_NAME_REQ")
47250
+ }, {
47251
+ key: "render",
47252
+ value: function render() {
47253
+ if (!safeHTMLElement.canUseDOM || !isReact16) {
47254
+ return null;
47255
+ }
47256
+ if (!this.node && isReact16) {
47257
+ this.node = createHTMLElement("div");
47258
+ }
47259
+ var createPortal = getCreatePortal();
47260
+ return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({
47261
+ ref: this.portalRef,
47262
+ defaultStyles: Modal.defaultStyles
47263
+ }, this.props)), this.node);
47264
+ }
47265
+ }], [{
47266
+ key: "setAppElement",
47267
+ value: function setAppElement(element) {
47268
+ ariaAppHider$1.setElement(element);
47269
+ }
47270
+ }]);
47271
+ return Modal;
47272
+ }(React.Component);
47273
+ Modal.propTypes = {
47274
+ isOpen: _propTypes2.default.bool.isRequired,
47275
+ style: _propTypes2.default.shape({
47276
+ content: _propTypes2.default.object,
47277
+ overlay: _propTypes2.default.object
47278
+ }),
47279
+ portalClassName: _propTypes2.default.string,
47280
+ bodyOpenClassName: _propTypes2.default.string,
47281
+ htmlOpenClassName: _propTypes2.default.string,
47282
+ className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
47283
+ base: _propTypes2.default.string.isRequired,
47284
+ afterOpen: _propTypes2.default.string.isRequired,
47285
+ beforeClose: _propTypes2.default.string.isRequired
47286
+ })]),
47287
+ overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
47288
+ base: _propTypes2.default.string.isRequired,
47289
+ afterOpen: _propTypes2.default.string.isRequired,
47290
+ beforeClose: _propTypes2.default.string.isRequired
47291
+ })]),
47292
+ appElement: _propTypes2.default.oneOfType([_propTypes2.default.instanceOf(_safeHTMLElement2.default), _propTypes2.default.instanceOf(safeHTMLElement.SafeHTMLCollection), _propTypes2.default.instanceOf(safeHTMLElement.SafeNodeList), _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_safeHTMLElement2.default))]),
47293
+ onAfterOpen: _propTypes2.default.func,
47294
+ onRequestClose: _propTypes2.default.func,
47295
+ closeTimeoutMS: _propTypes2.default.number,
47296
+ ariaHideApp: _propTypes2.default.bool,
47297
+ shouldFocusAfterRender: _propTypes2.default.bool,
47298
+ shouldCloseOnOverlayClick: _propTypes2.default.bool,
47299
+ shouldReturnFocusAfterClose: _propTypes2.default.bool,
47300
+ preventScroll: _propTypes2.default.bool,
47301
+ parentSelector: _propTypes2.default.func,
47302
+ aria: _propTypes2.default.object,
47303
+ data: _propTypes2.default.object,
47304
+ role: _propTypes2.default.string,
47305
+ contentLabel: _propTypes2.default.string,
47306
+ shouldCloseOnEsc: _propTypes2.default.bool,
47307
+ overlayRef: _propTypes2.default.func,
47308
+ contentRef: _propTypes2.default.func,
47309
+ id: _propTypes2.default.string,
47310
+ overlayElement: _propTypes2.default.func,
47311
+ contentElement: _propTypes2.default.func
47312
+ };
47313
+ Modal.defaultProps = {
47314
+ isOpen: false,
47315
+ portalClassName: portalClassName,
47316
+ bodyOpenClassName: bodyOpenClassName,
47317
+ role: "dialog",
47318
+ ariaHideApp: true,
47319
+ closeTimeoutMS: 0,
47320
+ shouldFocusAfterRender: true,
47321
+ shouldCloseOnEsc: true,
47322
+ shouldCloseOnOverlayClick: true,
47323
+ shouldReturnFocusAfterClose: true,
47324
+ preventScroll: false,
47325
+ parentSelector: function parentSelector() {
47326
+ return document.body;
47201
47327
  },
47202
- render: props => {
47203
- var _CHBLocations$CHB;
47204
- return /*#__PURE__*/React.createElement(Dropdown, {
47205
- style: {
47206
- marginBottom: 0
47207
- },
47208
- className: "form-field",
47209
- select: e => {
47210
- props.onChange(e);
47211
- fiterHalls(e);
47212
- setValue("hallCode", null);
47213
- setValue("startDate", "");
47214
- setSlots([]);
47215
- setShowInfo(false);
47216
- },
47217
- selected: props.value,
47218
- option: CHBLocations === null || CHBLocations === void 0 ? void 0 : (_CHBLocations$CHB = CHBLocations.CHB) === null || _CHBLocations$CHB === void 0 ? void 0 : _CHBLocations$CHB.CommunityHalls,
47219
- optionKey: "name"
47220
- });
47221
- }
47222
- }), errors.siteId && /*#__PURE__*/React.createElement("p", {
47223
- style: {
47224
- color: "red"
47225
- }
47226
- }, errors.siteId.message)), /*#__PURE__*/React.createElement(LabelFieldPair, {
47227
- style: {
47228
- marginTop: "20px"
47229
- }
47230
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_DATE"), " ", /*#__PURE__*/React.createElement("span", {
47231
- style: {
47232
- color: "red"
47233
- }
47234
- }, "*")), /*#__PURE__*/React.createElement("div", {
47235
- style: {
47236
- width: "50%"
47328
+ overlayElement: function overlayElement(props, contentEl) {
47329
+ return _react2.default.createElement("div", props, contentEl);
47237
47330
  },
47238
- className: "field"
47239
- }, /*#__PURE__*/React.createElement(Controller, {
47240
- control: control,
47241
- name: "startDate",
47242
- rules: {
47243
- required: t("START_DATE_REQ")
47331
+ contentElement: function contentElement(props, children) {
47332
+ return _react2.default.createElement("div", props, children);
47333
+ }
47334
+ };
47335
+ Modal.defaultStyles = {
47336
+ overlay: {
47337
+ position: "fixed",
47338
+ top: 0,
47339
+ left: 0,
47340
+ right: 0,
47341
+ bottom: 0,
47342
+ backgroundColor: "rgba(255, 255, 255, 0.75)"
47244
47343
  },
47245
- render: props => /*#__PURE__*/React.createElement(TextInput, {
47246
- style: {
47247
- marginBottom: 0
47248
- },
47249
- type: "date",
47250
- className: "form-field",
47251
- value: props.value,
47252
- min: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString().split("T")[0],
47253
- onChange: e => {
47254
- props.onChange(e.target.value);
47255
- },
47256
- onBlur: e => {
47257
- props.onBlur(e);
47344
+ content: {
47345
+ position: "absolute",
47346
+ top: "40px",
47347
+ left: "40px",
47348
+ right: "40px",
47349
+ bottom: "40px",
47350
+ border: "1px solid #ccc",
47351
+ background: "#fff",
47352
+ overflow: "auto",
47353
+ WebkitOverflowScrolling: "touch",
47354
+ borderRadius: "4px",
47355
+ outline: "none",
47356
+ padding: "20px"
47357
+ }
47358
+ };
47359
+ (0, reactLifecyclesCompat_es.polyfill)(Modal);
47360
+ if (process.env.NODE_ENV !== "production") {
47361
+ Modal.setCreateHTMLElement = function (fn) {
47362
+ return createHTMLElement = fn;
47363
+ };
47364
+ }
47365
+ exports.default = Modal;
47366
+ });
47367
+ unwrapExports(Modal_1);
47368
+
47369
+ var lib = createCommonjsModule(function (module, exports) {
47370
+
47371
+ Object.defineProperty(exports, "__esModule", {
47372
+ value: true
47373
+ });
47374
+ var _Modal2 = _interopRequireDefault(Modal_1);
47375
+ function _interopRequireDefault(obj) {
47376
+ return obj && obj.__esModule ? obj : {
47377
+ default: obj
47378
+ };
47379
+ }
47380
+ exports.default = _Modal2.default;
47381
+ module.exports = exports["default"];
47382
+ });
47383
+ var Modal = unwrapExports(lib);
47384
+
47385
+ const CitizenConsent = ({
47386
+ showTermsPopupOwner,
47387
+ setShowTermsPopupOwner,
47388
+ otpVerifiedTimestamp,
47389
+ getModalData
47390
+ }) => {
47391
+ var _user$info, _user$info2;
47392
+ const {
47393
+ t
47394
+ } = useTranslation();
47395
+ const user = Digit.UserService.getUser();
47396
+ const ownername = user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name;
47397
+ const ownermobileNumber = user === null || user === void 0 ? void 0 : user.info.mobileNumber;
47398
+ const ownerEmail = user === null || user === void 0 ? void 0 : (_user$info2 = user.info) === null || _user$info2 === void 0 ? void 0 : _user$info2.emailId;
47399
+ const {
47400
+ id
47401
+ } = useParams();
47402
+ const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
47403
+ const [loader, setLoader] = useState(false);
47404
+ console.log("getModalData", getModalData);
47405
+ const {
47406
+ data,
47407
+ isLoading
47408
+ } = Digit.Hooks.obps.useBPADetailsPage(tenantId, {
47409
+ applicationNo: id
47410
+ });
47411
+ const [isUploading, setIsUploading] = useState(false);
47412
+ const [isFileUploaded, setIsFileUploaded] = useState(false);
47413
+ const isCitizenDeclared = sessionStorage.getItem("CitizenConsentdocFilestoreidCHB");
47414
+ const DateOnly = new Date();
47415
+ const selfdeclarationform = `
47416
+ <div style="font-family:'Times New Roman', Times, serif; color:#000; font-size:16px; line-height:1.18; margin-top:-100px; padding:0;">
47417
+
47418
+ <h2 style="text-align:center; font-size:20px; margin:0 0 6px 0; font-weight:700; text-transform:uppercase;">
47419
+ OWNER'S DECLARATION
47420
+ </h2>
47421
+
47422
+ <div style="margin-top:-52px;">
47423
+ <p style="margin-bottom:-32px;"><strong>To,</strong></p>
47424
+ <p style="margin-bottom:-32px;"><strong>Local Urban Bodies</strong></p>
47425
+ </div>
47426
+
47427
+ <p style="margin-top:-20px;"><strong>Dear Sir/Madam,</strong></p>
47428
+
47429
+ <p style="margin-top:-52px;margin-bottom:-32px; text-align:justify;">
47430
+ I/We further declare that I am/We are aware of all the actions taken have been authorized by me/us.
47431
+ </p>
47432
+
47433
+ <ol style="margin-top:-52px;margin-bottom:-32px; padding:0;">
47434
+ <li style="margin-top:-5px;margin-bottom:-25px;">1. That I am/We are sole owner(s) of the site.</li>
47435
+ <li style="margin-top:-5px;margin-bottom:-25px;">2. That there is no dispute regarding the site and if any dispute arises, then I/We shall be solely responsible for the same.</li>
47436
+ <li style="margin-top:-5px;margin-bottom:-25px;">3. That construction of the building will be undertaken as per the approved building plans and structural design given by the Structural Engineer.</li>
47437
+ <li style="margin-top:-5px;margin-bottom:-25px;">4. That above stated facts are true and the requisite documents have been uploaded with this building plan and nothing has been concealed thereof.</li>
47438
+ </ol>
47439
+
47440
+ <!-- Signature / details table -->
47441
+ <table style="width:100%; border-collapse:collapse; margin-top:6px; font-size:14px;">
47442
+ <tr>
47443
+ <td style="width:48%; vertical-align:top; padding:6px; border:1px dotted #000;">
47444
+ <div style="font-weight:700; margin-bottom:4px;">Date:</div>
47445
+ <div style="min-height:60px;">${DateOnly || "<Date of Sign>"}</div>
47446
+ </td>
47447
+
47448
+ <td style="width:52%; vertical-align:top; border:1px dotted #000;">
47449
+ <table style="width:100%; border-collapse:collapse;">
47450
+ <tr>
47451
+ <td style="padding:6px; border-bottom:1px dotted #000; width:40%; font-weight:700;">Name of Owner:</td>
47452
+ <td style="padding:6px; border-bottom:1px dotted #000;">${ownername}</td>
47453
+ </tr>
47454
+ <tr>
47455
+ <td style="padding:6px; border-bottom:1px dotted #000; font-weight:700;">e-Mail:</td>
47456
+ <td style="padding:6px; border-bottom:1px dotted #000;">${ownerEmail}</td>
47457
+ </tr>
47458
+ <tr>
47459
+ <td style="padding:6px; border-bottom:1px dotted #000; font-weight:700;">Mobile:</td>
47460
+ <td style="padding:6px; border-bottom:1px dotted #000;">${ownermobileNumber}</td>
47461
+ </tr>
47462
+ <tr>
47463
+ <td style="padding:6px; font-weight:700;">Signature:</td>
47464
+ <td style="padding:6px;">Verified through OTP</b></td>
47465
+ </tr>
47466
+ </table>
47467
+ </td>
47468
+ </tr>
47469
+ </table>
47470
+ </div>
47471
+ `;
47472
+ const closeModal = () => {
47473
+ setShowTermsPopupOwner(false);
47474
+ };
47475
+ const uploadSelfDeclaration = async () => {
47476
+ setLoader(true);
47477
+ const Chb = [{
47478
+ ...getModalData,
47479
+ applicationNo: "CHB-0001",
47480
+ tenantId: tenantId
47481
+ }];
47482
+ try {
47483
+ var _result$filestoreIds$;
47484
+ setIsUploading(true);
47485
+ let result = await Digit.PaymentService.generatePdf(Digit.ULBService.getStateId(), {
47486
+ Chb: Chb
47487
+ }, "communityhallowner");
47488
+ console.log(result, "RESULT");
47489
+ setLoader(false);
47490
+ if ((result === null || result === void 0 ? void 0 : (_result$filestoreIds$ = result.filestoreIds[0]) === null || _result$filestoreIds$ === void 0 ? void 0 : _result$filestoreIds$.length) > 0) {
47491
+ alert("File Uploaded Successfully");
47492
+ sessionStorage.setItem("CitizenConsentdocFilestoreidCHB", result === null || result === void 0 ? void 0 : result.filestoreIds[0]);
47493
+ setIsFileUploaded(true);
47494
+ } else {
47495
+ alert("File Upload Failed");
47258
47496
  }
47259
- })
47260
- }), errors.startDate && /*#__PURE__*/React.createElement("p", {
47261
- style: {
47262
- color: "red"
47263
- }
47264
- }, errors.startDate.message))), /*#__PURE__*/React.createElement(LabelFieldPair, {
47265
- style: {
47266
- marginTop: "20px"
47267
- }
47268
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("SELECT_END_DATE"), " ", /*#__PURE__*/React.createElement("span", {
47269
- style: {
47270
- color: "red"
47271
- }
47272
- }, "*")), /*#__PURE__*/React.createElement("div", {
47273
- style: {
47274
- width: "50%"
47275
- },
47276
- className: "field"
47277
- }, /*#__PURE__*/React.createElement(Controller, {
47278
- control: control,
47279
- name: "endDate",
47280
- render: props => /*#__PURE__*/React.createElement(TextInput, {
47281
- style: {
47282
- marginBottom: 0
47283
- },
47284
- type: "date",
47285
- className: "form-field",
47286
- value: props.value,
47287
- min: startDate ? new Date(new Date(startDate).getTime() + 24 * 60 * 60 * 1000).toISOString().split("T")[0] : new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString().split("T")[0],
47288
- onChange: e => {
47289
- props.onChange(e.target.value);
47290
- },
47291
- onBlur: e => {
47292
- props.onBlur(e);
47293
- },
47294
- disabled: !startDate
47295
- })
47296
- }))), /*#__PURE__*/React.createElement("div", {
47297
- style: {
47298
- marginTop: "20px"
47299
- }
47300
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("HALL_CODE"), " ", /*#__PURE__*/React.createElement("span", {
47301
- style: {
47302
- color: "red"
47497
+ } catch (error) {
47498
+ alert("Error Uploading PDF:", error);
47499
+ setLoader(false);
47500
+ } finally {
47501
+ setLoader(false);
47502
+ setIsUploading(false);
47303
47503
  }
47304
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47305
- control: control,
47306
- name: "hallCode",
47307
- rules: {
47308
- required: t("HALL_CODE_REQ")
47504
+ };
47505
+ const modalStyles = {
47506
+ modal: {
47507
+ width: "100%",
47508
+ height: "100%",
47509
+ top: "0",
47510
+ position: "relative",
47511
+ backgroundColor: "rgba(0, 0, 0, 0.7)",
47512
+ display: "flex",
47513
+ justifyContent: "center",
47514
+ alignItems: "center"
47309
47515
  },
47310
- render: props => /*#__PURE__*/React.createElement(Dropdown, {
47311
- style: {
47312
- marginBottom: 0
47313
- },
47314
- className: "form-field",
47315
- select: e => {
47316
- console.log("e", e);
47317
- props.onChange(e);
47318
- slotsSearch(e);
47319
- setShowInfo(true);
47320
- },
47321
- selected: props.value,
47322
- option: getHallCodes,
47323
- optionKey: "HallCode"
47324
- })
47325
- }), errors.hallCode && /*#__PURE__*/React.createElement("p", {
47326
- style: {
47327
- color: "red"
47328
- }
47329
- }, errors.hallCode.message)), (getSlots === null || getSlots === void 0 ? void 0 : getSlots.length) > 0 && /*#__PURE__*/React.createElement("div", {
47330
- style: {
47331
- marginTop: "20px",
47332
- marginBottom: "20px"
47333
- }
47334
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("AVAILABLE_SLOTS"), " ", /*#__PURE__*/React.createElement("span", {
47335
- style: {
47336
- color: "red"
47337
- }
47338
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47339
- control: control,
47340
- name: "slots",
47341
- rules: {
47342
- validate: value => {
47343
- if (!value || value.length === 0) {
47344
- return t("PLEASE_SELECT_AT_LEAST_ONE_SLOT");
47345
- }
47346
- return true;
47347
- }
47516
+ modalOverlay: {
47517
+ position: "fixed",
47518
+ top: "0",
47519
+ left: "0",
47520
+ width: "100%",
47521
+ height: "100%",
47522
+ backgroundColor: "rgba(0, 0, 0, 0.7)"
47348
47523
  },
47349
- render: field => /*#__PURE__*/React.createElement("div", {
47350
- style: {
47351
- display: "grid",
47352
- gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
47353
- gap: "16px",
47354
- marginTop: "20px",
47355
- width: "50%"
47356
- }
47357
- }, getSlots === null || getSlots === void 0 ? void 0 : getSlots.map((slot, idx) => {
47358
- var _field$value, _slot$slotStaus;
47359
- const slotKey = `${slot.hallCode}-${slot.bookingDate}-${slot.fromTime || ""}-${slot.toTime || ""}`;
47360
- const isChecked = (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.some(s => s.hallCode === slot.hallCode && s.bookingDate === slot.bookingDate && s.fromTime === slot.fromTime && s.toTime === slot.toTime);
47361
- const isAvailable = ((_slot$slotStaus = slot.slotStaus) === null || _slot$slotStaus === void 0 ? void 0 : _slot$slotStaus.toLowerCase()) === "available";
47362
- return /*#__PURE__*/React.createElement("label", {
47363
- key: slotKey,
47364
- style: {
47365
- border: "1px solid #ccc",
47366
- borderRadius: "8px",
47367
- padding: "12px",
47368
- backgroundColor: isAvailable ? "#e6ffed" : "#ffe6e6",
47369
- cursor: isAvailable ? "pointer" : "not-allowed",
47370
- opacity: isAvailable ? 1 : 0.6,
47371
- flexDirection: "column",
47372
- gap: "6px"
47373
- }
47374
- }, /*#__PURE__*/React.createElement("input", {
47375
- type: "checkbox",
47376
- checked: isChecked,
47377
- disabled: !isAvailable,
47378
- onChange: e => {
47379
- if (!isAvailable) return;
47380
- if (e.target.checked) {
47381
- field.onChange([...(field.value || []), slot]);
47382
- } else {
47383
- field.onChange((field.value || []).filter(s => !(s.hallCode === slot.hallCode && s.bookingDate === slot.bookingDate && s.fromTime === slot.fromTime && s.toTime === slot.toTime)));
47384
- }
47385
- }
47386
- }), /*#__PURE__*/React.createElement("span", {
47387
- style: {
47388
- marginLeft: "10px"
47389
- }
47390
- }, slot.bookingDate, " (", slot.hallCode, ") \u2013", " ", /*#__PURE__*/React.createElement("span", {
47391
- style: {
47392
- color: slot.slotStaus === "AVAILABLE" ? "green" : "red",
47393
- fontWeight: "bold"
47394
- }
47395
- }, slot.slotStaus ? slot.slotStaus.charAt(0).toUpperCase() + slot.slotStaus.slice(1).toLowerCase() : "")));
47396
- }))
47397
- }), errors.slots && /*#__PURE__*/React.createElement("p", {
47398
- style: {
47399
- color: "red"
47400
- }
47401
- }, errors.slots.message)), /*#__PURE__*/React.createElement("div", {
47402
- style: {
47403
- display: showInfo ? "block" : "none"
47404
- }
47405
- }, /*#__PURE__*/React.createElement("div", {
47406
- style: {
47407
- marginTop: "20px",
47408
- marginBottom: "20px"
47409
- }
47410
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_PURPOSE"), " ", /*#__PURE__*/React.createElement("span", {
47411
- style: {
47412
- color: "red"
47413
- }
47414
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47415
- control: control,
47416
- name: "purpose",
47417
- defaultValue: null,
47418
- rules: {
47419
- required: t("CHB_PURPOSE_REQUIRED")
47524
+ modalContent: {
47525
+ backgroundColor: "#FFFFFF",
47526
+ padding: "2rem",
47527
+ borderRadius: "0.5rem",
47528
+ maxWidth: "800px",
47529
+ margin: "auto",
47530
+ fontFamily: "Roboto, serif",
47531
+ overflowX: "hidden",
47532
+ textAlign: "justify",
47533
+ boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)",
47534
+ maxHeight: "80vh",
47535
+ overflowY: "auto",
47536
+ lineHeight: "2"
47420
47537
  },
47421
- render: props => {
47422
- var _CHBPurpose$CHB;
47423
- return /*#__PURE__*/React.createElement(Dropdown, {
47424
- style: {
47425
- marginBottom: 0
47426
- },
47427
- className: "form-field",
47428
- select: props.onChange,
47429
- selected: props.value,
47430
- option: CHBPurpose === null || CHBPurpose === void 0 ? void 0 : (_CHBPurpose$CHB = CHBPurpose.CHB) === null || _CHBPurpose$CHB === void 0 ? void 0 : _CHBPurpose$CHB.Purpose,
47431
- optionKey: "name"
47432
- });
47433
- }
47434
- }), errors.purpose && /*#__PURE__*/React.createElement("p", {
47435
- style: {
47436
- color: "red"
47437
- }
47438
- }, errors.purpose.message)), /*#__PURE__*/React.createElement("div", {
47439
- style: {
47440
- marginBottom: "20px"
47441
- }
47442
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_SPECIAL_CATEGORY"), " ", /*#__PURE__*/React.createElement("span", {
47443
- style: {
47444
- color: "red"
47445
- }
47446
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47447
- control: control,
47448
- name: "specialCategory",
47449
- defaultValue: null,
47450
- rules: {
47451
- required: t("CHB_SPECIAL_CATEGORY_REQUIRED")
47538
+ heading: {
47539
+ textAlign: "center",
47540
+ fontWeight: "bold",
47541
+ marginBottom: "10px"
47452
47542
  },
47453
- render: props => {
47454
- var _SpecialCategory$CHB;
47455
- return /*#__PURE__*/React.createElement(Dropdown, {
47456
- style: {
47457
- marginBottom: 0
47458
- },
47459
- className: "form-field",
47460
- select: props.onChange,
47461
- selected: props.value,
47462
- option: SpecialCategory === null || SpecialCategory === void 0 ? void 0 : (_SpecialCategory$CHB = SpecialCategory.CHB) === null || _SpecialCategory$CHB === void 0 ? void 0 : _SpecialCategory$CHB.SpecialCategory,
47463
- optionKey: "name"
47464
- });
47465
- }
47466
- }), errors.specialCategory && /*#__PURE__*/React.createElement("p", {
47467
- style: {
47468
- color: "red"
47469
- }
47470
- }, errors.specialCategory.message)), /*#__PURE__*/React.createElement(LabelFieldPair, {
47471
- style: {
47543
+ subheading: {
47544
+ textAlign: "center",
47545
+ fontWeight: "bold",
47472
47546
  marginBottom: "20px"
47473
- }
47474
- }, /*#__PURE__*/React.createElement(CardLabel, {
47475
- className: "card-label-smaller"
47476
- }, t("CHB_PURPOSE_DESCRIPTION"), " ", /*#__PURE__*/React.createElement("span", {
47477
- style: {
47478
- color: "red"
47479
- }
47480
- }, "*")), /*#__PURE__*/React.createElement("div", {
47481
- className: "field",
47482
- style: {
47483
- width: "50%"
47484
- }
47485
- }, /*#__PURE__*/React.createElement(Controller, {
47486
- control: control,
47487
- name: "purposeDescription",
47488
- defaultValue: "",
47489
- rules: {
47490
- required: t("CHB_PURPOSE_DESCRIPTION_REQUIRED"),
47491
- minLength: {
47492
- value: 5,
47493
- message: t("CHB_PURPOSE_DESCRIPTION_REQUIRED_MIN")
47494
- }
47495
47547
  },
47496
- render: props => /*#__PURE__*/React.createElement(TextArea, {
47497
- style: {
47498
- marginBottom: 0,
47499
- marginTop: 0
47500
- },
47501
- type: "textarea",
47502
- value: props.value,
47503
- onChange: e => {
47504
- props.onChange(e.target.value);
47505
- },
47506
- onBlur: e => {
47507
- props.onBlur(e);
47508
- }
47509
- })
47510
- }), errors.purposeDescription && /*#__PURE__*/React.createElement("p", {
47511
- style: {
47512
- color: "red"
47513
- }
47514
- }, errors.purposeDescription.message))), !isCitizen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
47515
- style: {
47516
- marginBottom: "20px",
47517
- width: "50%"
47518
- }
47519
- }, /*#__PURE__*/React.createElement(CardLabel, null, `${t("CHB_DISCOUNT_AMOUNT")}`), /*#__PURE__*/React.createElement(Controller, {
47520
- control: control,
47521
- name: "discountAmount",
47522
- render: props => {
47523
- var _errors$name;
47524
- return /*#__PURE__*/React.createElement(TextInput, {
47525
- type: "number",
47526
- style: {
47527
- marginBottom: 0,
47528
- width: "100%"
47529
- },
47530
- value: props.value,
47531
- error: errors === null || errors === void 0 ? void 0 : (_errors$name = errors.name) === null || _errors$name === void 0 ? void 0 : _errors$name.message,
47532
- onChange: e => {
47533
- props.onChange(e.target.value);
47534
- },
47535
- onBlur: e => {
47536
- props.onBlur(e);
47537
- },
47538
- t: t
47539
- });
47548
+ rightAlignedText: {
47549
+ textAlign: "right",
47550
+ whiteSpace: "pre-wrap",
47551
+ wordWrap: "break-word",
47552
+ fontFamily: "Roboto, serif",
47553
+ lineHeight: "2"
47540
47554
  }
47541
- })), /*#__PURE__*/React.createElement("div", {
47555
+ };
47556
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Modal, {
47557
+ isOpen: showTermsPopupOwner,
47558
+ onRequestClose: closeModal,
47559
+ contentLabel: "Self-Declaration",
47542
47560
  style: {
47543
- marginBottom: "20px"
47561
+ modal: modalStyles.modal,
47562
+ overlay: modalStyles.modalOverlay,
47563
+ content: modalStyles.modalContent
47544
47564
  }
47545
- }, /*#__PURE__*/React.createElement(CardLabel, null, t("CHB_DISCOUNT_REASON"), " ", /*#__PURE__*/React.createElement("span", {
47565
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
47546
47566
  style: {
47547
- color: "red"
47567
+ whiteSpace: "pre-wrap",
47568
+ wordWrap: "break-word",
47569
+ textAlign: "justify",
47570
+ fontFamily: "Roboto, serif"
47548
47571
  }
47549
- }, "*")), /*#__PURE__*/React.createElement(Controller, {
47550
- control: control,
47551
- name: "reason",
47552
- defaultValue: null,
47553
- render: props => {
47554
- var _CHBReason$CHB2;
47555
- return /*#__PURE__*/React.createElement(Dropdown, {
47556
- style: {
47557
- marginBottom: 0
47558
- },
47559
- className: "form-field",
47560
- select: props.onChange,
47561
- selected: props.value,
47562
- option: CHBReason === null || CHBReason === void 0 ? void 0 : (_CHBReason$CHB2 = CHBReason.CHB) === null || _CHBReason$CHB2 === void 0 ? void 0 : _CHBReason$CHB2.DiscountReason,
47563
- optionKey: "reasonName"
47564
- });
47572
+ }, /*#__PURE__*/React.createElement("div", {
47573
+ dangerouslySetInnerHTML: {
47574
+ __html: selfdeclarationform
47565
47575
  }
47566
- }))), /*#__PURE__*/React.createElement("div", {
47576
+ })), /*#__PURE__*/React.createElement("div", {
47567
47577
  style: {
47568
47578
  display: "flex",
47569
- alignItems: "center",
47570
- gap: "10px",
47571
- cursor: "pointer"
47572
- }
47573
- }, /*#__PURE__*/React.createElement(Controller, {
47574
- control: control,
47575
- name: "termsAccepted",
47576
- rules: {
47577
- required: t("PLEASE_ACCEPT_TERMS_CONDITIONS")
47578
- },
47579
- render: props => /*#__PURE__*/React.createElement("input", {
47580
- id: "termsAccepted",
47581
- type: "checkbox",
47582
- checked: props.value || false,
47583
- onChange: e => {
47584
- props.onChange(e.target.checked);
47585
- console.log("cal", e.target.checked);
47586
- if (e.target.checked) setShowTermsPopup(true);
47587
- },
47588
- style: {
47589
- width: "18px",
47590
- height: "18px",
47591
- cursor: "pointer"
47592
- }
47593
- })
47594
- }), /*#__PURE__*/React.createElement("label", {
47595
- htmlFor: "termsAccepted",
47596
- style: {
47597
- cursor: "pointer",
47598
- color: "#007bff",
47599
- textDecoration: "underline",
47600
- margin: 0
47579
+ justifyContent: "flex-end"
47601
47580
  }
47602
- }, t("CHB_SELF_LABEL"))), errors.termsAccepted && /*#__PURE__*/React.createElement("p", {
47581
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
47582
+ label: t("BPA_CLOSE"),
47583
+ onSubmit: closeModal
47584
+ })), /*#__PURE__*/React.createElement("br", null), !isCitizenDeclared && /*#__PURE__*/React.createElement("div", {
47603
47585
  style: {
47604
- color: "red"
47586
+ display: "flex",
47587
+ justifyContent: "flex-end"
47605
47588
  }
47606
- }, errors.termsAccepted.message))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
47607
- label: "Next",
47608
- submit: "submit"
47609
- }))), showTermsPopup && /*#__PURE__*/React.createElement(CitizenConsent, {
47610
- showTermsPopupOwner: showTermsPopup,
47611
- setShowTermsPopupOwner: setShowTermsPopup,
47612
- tenantId: tenantId
47613
- }), (CHBReasonLoading || CHBLocationLoading || CHBLoading || CHBPurposeLoading || CHBSpecialCategoryLoading || CHBHallCodeLoading || loader) && /*#__PURE__*/React.createElement(Loader, {
47589
+ }, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(SubmitBar, {
47590
+ label: t("BPA_UPLOAD"),
47591
+ onSubmit: uploadSelfDeclaration,
47592
+ disabled: isUploading || isFileUploaded
47593
+ })))), loader && /*#__PURE__*/React.createElement(Loader, {
47614
47594
  page: true
47615
47595
  }));
47616
47596
  };
47617
47597
 
47618
- const NewADSStepFormOne = ({
47619
- config,
47620
- onGoNext,
47621
- onBackClick
47622
- }) => {
47623
- const dispatch = useDispatch();
47624
- const {
47625
- t
47626
- } = useTranslation();
47627
- const [showToast, setShowToast] = useState(false);
47628
- const [error, setError] = useState("");
47629
- const currentStepData = useSelector(function (state) {
47630
- return state.chb.CHBApplicationFormReducer.formData;
47631
- });
47632
- function goNext(data) {
47633
- console.log("data aa rea", data);
47634
- dispatch(UPDATE_CHBApplication_FORM(config.key, data));
47635
- onGoNext();
47636
- }
47637
- function onGoBack(data) {
47638
- onBackClick(config.key, data);
47639
- }
47640
- const closeToast = () => {
47641
- setShowToast(false);
47642
- setError("");
47643
- };
47644
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CHBCitizenSecond, {
47645
- onGoBack: onGoBack,
47646
- goNext: goNext,
47647
- currentStepData: currentStepData,
47648
- t: t
47649
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
47650
- isDleteBtn: true,
47651
- error: true,
47652
- label: error,
47653
- onClose: closeToast
47654
- }));
47655
- };
47656
-
47657
47598
  const CHBCitizenDetailsNew = ({
47658
47599
  t,
47659
47600
  goNext,
@@ -47666,13 +47607,16 @@ const CHBCitizenDetailsNew = ({
47666
47607
  const stateId = Digit.ULBService.getStateId();
47667
47608
  const user = Digit.UserService.getUser();
47668
47609
  const [loader, setLoader] = useState(false);
47610
+ const [showTermsPopup, setShowTermsPopup] = useState(false);
47611
+ const [getModalData, setModalData] = useState();
47669
47612
  const {
47670
47613
  control,
47671
47614
  handleSubmit,
47672
47615
  setValue,
47673
47616
  formState: {
47674
47617
  errors
47675
- }
47618
+ },
47619
+ getValues
47676
47620
  } = useForm({
47677
47621
  defaultValues: {
47678
47622
  name: isCitizen && (user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : _user$info.name) || "",
@@ -47683,12 +47627,16 @@ const CHBCitizenDetailsNew = ({
47683
47627
  });
47684
47628
  const onSubmit = async data => {
47685
47629
  var _currentStepData$venu, _currentStepData$venu2;
47686
- setLoader(true);
47630
+ const isCitizenDeclared = sessionStorage.getItem("CitizenConsentdocFilestoreidCHB");
47687
47631
  if (currentStepData !== null && currentStepData !== void 0 && (_currentStepData$venu = currentStepData.venueDetails) !== null && _currentStepData$venu !== void 0 && (_currentStepData$venu2 = _currentStepData$venu[0]) !== null && _currentStepData$venu2 !== void 0 && _currentStepData$venu2.bookingNo) {
47688
47632
  goNext(currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.venueDetails);
47689
47633
  } else {
47690
47634
  var _currentStepData$owne, _user$info4;
47691
47635
  const baseApplication = (currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne = currentStepData.ownerDetails) === null || _currentStepData$owne === void 0 ? void 0 : _currentStepData$owne.hallsBookingApplication) || {};
47636
+ if (!isCitizenDeclared) {
47637
+ alert("Please upload Self Certificate");
47638
+ return;
47639
+ }
47692
47640
  const applicantDetail = {
47693
47641
  tenantId: tenantId,
47694
47642
  applicantName: data === null || data === void 0 ? void 0 : data.name,
@@ -47696,6 +47644,10 @@ const CHBCitizenDetailsNew = ({
47696
47644
  applicantEmailId: data === null || data === void 0 ? void 0 : data.emailId,
47697
47645
  type: user === null || user === void 0 ? void 0 : (_user$info4 = user.info) === null || _user$info4 === void 0 ? void 0 : _user$info4.type
47698
47646
  };
47647
+ const additionalDetails = {
47648
+ ...(baseApplication === null || baseApplication === void 0 ? void 0 : baseApplication.additionalDetails),
47649
+ disImage: isCitizenDeclared
47650
+ };
47699
47651
  const owners = [{
47700
47652
  name: data === null || data === void 0 ? void 0 : data.name,
47701
47653
  mobileNumber: data === null || data === void 0 ? void 0 : data.mobileNumber,
@@ -47710,9 +47662,12 @@ const CHBCitizenDetailsNew = ({
47710
47662
  ...baseApplication,
47711
47663
  applicantDetail,
47712
47664
  address,
47713
- owners
47665
+ owners,
47666
+ additionalDetails
47714
47667
  }
47715
47668
  };
47669
+ console.log("checkpayload", payload);
47670
+ setLoader(true);
47716
47671
  try {
47717
47672
  const response = await Digit.CHBServices.create(payload);
47718
47673
  setLoader(false);
@@ -47733,6 +47688,29 @@ const CHBCitizenDetailsNew = ({
47733
47688
  setValue("name", formattedData === null || formattedData === void 0 ? void 0 : (_formattedData$applic3 = formattedData.applicantDetail) === null || _formattedData$applic3 === void 0 ? void 0 : _formattedData$applic3.applicantName);
47734
47689
  }
47735
47690
  }, [currentStepData, setValue]);
47691
+ const handleModalData = e => {
47692
+ var _currentStepData$owne2, _getValues, _getValues2, _getValues3, _getValues4, _mapData$purpose, _mapData$bookingSlotD, _mapData$bookingSlotD2, _mapData$bookingSlotD3, _mapData$bookingSlotD4, _mapData$bookingSlotD5;
47693
+ console.log("currentStepData", currentStepData);
47694
+ console.log("getvalues", getValues());
47695
+ const mapData = currentStepData === null || currentStepData === void 0 ? void 0 : (_currentStepData$owne2 = currentStepData.ownerDetails) === null || _currentStepData$owne2 === void 0 ? void 0 : _currentStepData$owne2.hallsBookingApplication;
47696
+ const payload = {
47697
+ address: (_getValues = getValues()) === null || _getValues === void 0 ? void 0 : _getValues.address,
47698
+ emailId: (_getValues2 = getValues()) === null || _getValues2 === void 0 ? void 0 : _getValues2.emailId,
47699
+ mobileNumber: (_getValues3 = getValues()) === null || _getValues3 === void 0 ? void 0 : _getValues3.mobileNumber,
47700
+ name: (_getValues4 = getValues()) === null || _getValues4 === void 0 ? void 0 : _getValues4.name,
47701
+ communityHallName: mapData === null || mapData === void 0 ? void 0 : mapData.communityHallName,
47702
+ purpose: mapData === null || mapData === void 0 ? void 0 : (_mapData$purpose = mapData.purpose) === null || _mapData$purpose === void 0 ? void 0 : _mapData$purpose.purpose,
47703
+ days: mapData === null || mapData === void 0 ? void 0 : (_mapData$bookingSlotD = mapData.bookingSlotDetails) === null || _mapData$bookingSlotD === void 0 ? void 0 : _mapData$bookingSlotD.length,
47704
+ bookingDate: mapData === null || mapData === void 0 ? void 0 : (_mapData$bookingSlotD2 = mapData.bookingSlotDetails) === null || _mapData$bookingSlotD2 === void 0 ? void 0 : (_mapData$bookingSlotD3 = _mapData$bookingSlotD2[0]) === null || _mapData$bookingSlotD3 === void 0 ? void 0 : _mapData$bookingSlotD3.bookingDate,
47705
+ bookingEndDate: mapData === null || mapData === void 0 ? void 0 : (_mapData$bookingSlotD4 = mapData.bookingSlotDetails) === null || _mapData$bookingSlotD4 === void 0 ? void 0 : (_mapData$bookingSlotD5 = _mapData$bookingSlotD4.at(-1)) === null || _mapData$bookingSlotD5 === void 0 ? void 0 : _mapData$bookingSlotD5.bookingEndDate,
47706
+ ulbName: mapData === null || mapData === void 0 ? void 0 : mapData.tenantId,
47707
+ security: 5000,
47708
+ rent: mapData === null || mapData === void 0 ? void 0 : mapData.amount
47709
+ };
47710
+ console.log("payload", payload);
47711
+ setModalData(payload);
47712
+ if (e.target.checked) setShowTermsPopup(true);
47713
+ };
47736
47714
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
47737
47715
  onSubmit: handleSubmit(onSubmit)
47738
47716
  }, /*#__PURE__*/React.createElement("div", {
@@ -47880,7 +47858,46 @@ const CHBCitizenDetailsNew = ({
47880
47858
  style: {
47881
47859
  color: "red"
47882
47860
  }
47883
- }, errors.address.message))), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
47861
+ }, errors.address.message)), /*#__PURE__*/React.createElement("div", {
47862
+ style: {
47863
+ display: "flex",
47864
+ alignItems: "center",
47865
+ gap: "10px",
47866
+ cursor: "pointer"
47867
+ }
47868
+ }, /*#__PURE__*/React.createElement(Controller, {
47869
+ control: control,
47870
+ name: "termsAccepted",
47871
+ rules: {
47872
+ required: t("PLEASE_ACCEPT_TERMS_CONDITIONS")
47873
+ },
47874
+ render: props => /*#__PURE__*/React.createElement("input", {
47875
+ id: "termsAccepted",
47876
+ type: "checkbox",
47877
+ checked: props.value || false,
47878
+ onChange: e => {
47879
+ props.onChange(e.target.checked);
47880
+ handleModalData(e);
47881
+ },
47882
+ style: {
47883
+ width: "18px",
47884
+ height: "18px",
47885
+ cursor: "pointer"
47886
+ }
47887
+ })
47888
+ }), /*#__PURE__*/React.createElement("label", {
47889
+ htmlFor: "termsAccepted",
47890
+ style: {
47891
+ cursor: "pointer",
47892
+ color: "#007bff",
47893
+ textDecoration: "underline",
47894
+ margin: 0
47895
+ }
47896
+ }, t("CHB_SELF_LABEL"))), errors.termsAccepted && /*#__PURE__*/React.createElement("p", {
47897
+ style: {
47898
+ color: "red"
47899
+ }
47900
+ }, errors.termsAccepted.message)), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
47884
47901
  style: {
47885
47902
  background: " white",
47886
47903
  color: "black",
@@ -47892,7 +47909,12 @@ const CHBCitizenDetailsNew = ({
47892
47909
  }), /*#__PURE__*/React.createElement(SubmitBar, {
47893
47910
  label: "Next",
47894
47911
  submit: "submit"
47895
- }))), loader && /*#__PURE__*/React.createElement(Loader, {
47912
+ }))), showTermsPopup && /*#__PURE__*/React.createElement(CitizenConsent, {
47913
+ showTermsPopupOwner: showTermsPopup,
47914
+ setShowTermsPopupOwner: setShowTermsPopup,
47915
+ getModalData: getModalData,
47916
+ tenantId: tenantId
47917
+ }), loader && /*#__PURE__*/React.createElement(Loader, {
47896
47918
  page: true
47897
47919
  }));
47898
47920
  };