@djb25/digit-ui-module-wt 1.0.5 → 1.0.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.
@@ -182,7 +182,7 @@ const VerticalTimeline = ({
182
182
  };
183
183
 
184
184
  const WTCreate = () => {
185
- var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi, _Digit3, _Digit3$ComponentRegi, _Digit4, _Digit4$ComponentRegi;
185
+ var _Digit, _Digit$ComponentRegis, _Digit2, _Digit2$ComponentRegi, _Digit3, _Digit3$ComponentRegi, _Digit4, _Digit4$ComponentRegi, _params$serviceType2, _params$serviceType2$, _Digit5, _Digit5$ComponentRegi, _Digit6, _Digit6$ComponentRegi, _Digit7, _Digit7$ComponentRegi, _Digit8, _Digit8$ComponentRegi, _Digit9, _Digit9$ComponentRegi;
186
186
  const queryClient = useQueryClient();
187
187
  const match = useRouteMatch();
188
188
  const {
@@ -196,7 +196,6 @@ const WTCreate = () => {
196
196
  const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage("WT_Create", {});
197
197
  if ((!params.serviceType || Object.keys(params.serviceType).length === 0) && pathname.includes("employee")) {
198
198
  if (pathname.includes("mt")) {
199
- console.log("MT Create");
200
199
  setParams({
201
200
  "serviceType": {
202
201
  "serviceType": {
@@ -228,101 +227,35 @@ const WTCreate = () => {
228
227
  });
229
228
  }
230
229
  }
231
- const goNext = (skipStep, index, isAddMultiple, key) => {
232
- let currentPath = pathname.split("/").pop(),
233
- lastchar = currentPath.charAt(currentPath.length - 1),
234
- isMultiple = false,
235
- nextPage;
236
- if (Number(parseInt(currentPath)) || currentPath == "0" || currentPath == "-1") {
237
- if (currentPath == "-1" || currentPath == "-2") {
238
- currentPath = pathname.slice(0, -3);
239
- currentPath = currentPath.split("/").pop();
240
- isMultiple = true;
241
- } else {
242
- currentPath = pathname.slice(0, -2);
243
- currentPath = currentPath.split("/").pop();
244
- isMultiple = true;
245
- }
246
- } else {
247
- isMultiple = false;
248
- }
249
- if (!isNaN(lastchar)) {
250
- isMultiple = true;
251
- }
252
- let {
253
- nextStep = {}
254
- } = config.find(routeObj => routeObj.route === currentPath);
255
- let redirectWithHistory = history.push;
256
- if (skipStep) {
257
- redirectWithHistory = history.replace;
258
- }
259
- if (isAddMultiple) {
260
- nextStep = key;
261
- }
262
- if (nextStep === "request-details") {
263
- var _params$serviceType, _params$serviceType$s;
264
- const code = params === null || params === void 0 ? void 0 : (_params$serviceType = params.serviceType) === null || _params$serviceType === void 0 ? void 0 : (_params$serviceType$s = _params$serviceType.serviceType) === null || _params$serviceType$s === void 0 ? void 0 : _params$serviceType$s.code;
265
- if (code === "MobileToilet") {
266
- nextStep = "toiletRequest-details";
267
- } else if (code === "TREE_PRUNING") {
268
- nextStep = "treePruningRequest-details";
269
- }
270
- }
271
- if (nextStep === null) {
272
- return redirectWithHistory(`${match.path}/check`);
273
- }
274
- if (!isNaN(nextStep.split("/").pop())) {
275
- nextPage = `${match.path}/${nextStep}`;
276
- } else {
277
- nextPage = isMultiple && nextStep !== "map" ? `${match.path}/${nextStep}/${index}` : `${match.path}/${nextStep}`;
278
- }
279
- redirectWithHistory(nextPage);
280
- };
230
+ if (pathname.includes("employee") && pathname.endsWith("/info")) {
231
+ history.replace(`${match.path}/form`);
232
+ }
281
233
  if (params && Object.keys(params).length > 0 && window.location.href.includes("/service-type") && sessionStorage.getItem("docReqScreenByBack") !== "true") {
282
234
  clearParams();
283
235
  queryClient.invalidateQueries("WT_Create");
284
236
  }
285
237
  const wt_create = async () => {
286
- var _params$serviceType2, _params$serviceType2$, _params$serviceType3, _params$serviceType3$, _params$serviceType4, _params$serviceType4$;
287
- if ((params === null || params === void 0 ? void 0 : (_params$serviceType2 = params.serviceType) === null || _params$serviceType2 === void 0 ? void 0 : (_params$serviceType2$ = _params$serviceType2.serviceType) === null || _params$serviceType2$ === void 0 ? void 0 : _params$serviceType2$.code) === "WT") {
288
- history.push(`${match.path}/wt-acknowledgement`);
289
- }
290
- if ((params === null || params === void 0 ? void 0 : (_params$serviceType3 = params.serviceType) === null || _params$serviceType3 === void 0 ? void 0 : (_params$serviceType3$ = _params$serviceType3.serviceType) === null || _params$serviceType3$ === void 0 ? void 0 : _params$serviceType3$.code) === "MobileToilet") {
291
- history.push(`${match.path}/mt-acknowledgement`);
292
- }
293
- if ((params === null || params === void 0 ? void 0 : (_params$serviceType4 = params.serviceType) === null || _params$serviceType4 === void 0 ? void 0 : (_params$serviceType4$ = _params$serviceType4.serviceType) === null || _params$serviceType4$ === void 0 ? void 0 : _params$serviceType4$.code) === "TREE_PRUNING") {
294
- history.push(`${match.path}/tp-acknowledgement`);
295
- }
238
+ var _params$serviceType, _params$serviceType$s;
239
+ const code = params === null || params === void 0 ? void 0 : (_params$serviceType = params.serviceType) === null || _params$serviceType === void 0 ? void 0 : (_params$serviceType$s = _params$serviceType.serviceType) === null || _params$serviceType$s === void 0 ? void 0 : _params$serviceType$s.code;
240
+ if (code === "WT") history.push(`${match.path}/wt-acknowledgement`);
241
+ if (code === "MobileToilet") history.push(`${match.path}/mt-acknowledgement`);
242
+ if (code === "TREE_PRUNING") history.push(`${match.path}/tp-acknowledgement`);
296
243
  };
297
- function handleSelect(key, data, skipStep, index, isAddMultiple = false) {
298
- if (key === "owners") {
299
- let owners = params.owners || [];
300
- owners[index] = data;
301
- setParams({
302
- ...params,
303
- ...{
304
- [key]: [...owners]
305
- }
306
- });
307
- } else if (key === "units") {
308
- let units = params.units || [];
309
- units = data;
244
+ function handleSelect(key, data) {
245
+ if (key === "owners") ; else if (key === "units") {
310
246
  setParams({
311
247
  ...params,
312
- units
248
+ units: data
313
249
  });
314
250
  } else {
315
251
  setParams({
316
252
  ...params,
317
- ...{
318
- [key]: {
319
- ...params[key],
320
- ...data
321
- }
253
+ [key]: {
254
+ ...params[key],
255
+ ...data
322
256
  }
323
257
  });
324
258
  }
325
- goNext(skipStep, index, isAddMultiple, key);
326
259
  }
327
260
  const onSuccess = () => {
328
261
  clearParams();
@@ -332,11 +265,115 @@ const WTCreate = () => {
332
265
  commonFields.forEach(obj => {
333
266
  config = config.concat(obj.body.filter(a => !a.hideInCitizen));
334
267
  });
335
- config.indexRoute = pathname.includes("citizen") ? "service-type" : "info";
268
+ config.indexRoute = pathname.includes("citizen") ? "service-type" : "form";
336
269
  const CheckPage = (_Digit = Digit) === null || _Digit === void 0 ? void 0 : (_Digit$ComponentRegis = _Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent("WTCheckPage");
337
270
  const WTAcknowledgement = (_Digit2 = Digit) === null || _Digit2 === void 0 ? void 0 : (_Digit2$ComponentRegi = _Digit2.ComponentRegistryService) === null || _Digit2$ComponentRegi === void 0 ? void 0 : _Digit2$ComponentRegi.getComponent("WTAcknowledgement");
338
271
  const MTAcknowledgement = (_Digit3 = Digit) === null || _Digit3 === void 0 ? void 0 : (_Digit3$ComponentRegi = _Digit3.ComponentRegistryService) === null || _Digit3$ComponentRegi === void 0 ? void 0 : _Digit3$ComponentRegi.getComponent("MTAcknowledgement");
339
272
  const TPAcknowledgement = (_Digit4 = Digit) === null || _Digit4 === void 0 ? void 0 : (_Digit4$ComponentRegi = _Digit4.ComponentRegistryService) === null || _Digit4$ComponentRegi === void 0 ? void 0 : _Digit4$ComponentRegi.getComponent("TPAcknowledgement");
273
+ const serviceCode = params === null || params === void 0 ? void 0 : (_params$serviceType2 = params.serviceType) === null || _params$serviceType2 === void 0 ? void 0 : (_params$serviceType2$ = _params$serviceType2.serviceType) === null || _params$serviceType2$ === void 0 ? void 0 : _params$serviceType2$.code;
274
+ const ApplicantDetails = (_Digit5 = Digit) === null || _Digit5 === void 0 ? void 0 : (_Digit5$ComponentRegi = _Digit5.ComponentRegistryService) === null || _Digit5$ComponentRegi === void 0 ? void 0 : _Digit5$ComponentRegi.getComponent("ApplicantDetails");
275
+ const AddressDetails = (_Digit6 = Digit) === null || _Digit6 === void 0 ? void 0 : (_Digit6$ComponentRegi = _Digit6.ComponentRegistryService) === null || _Digit6$ComponentRegi === void 0 ? void 0 : _Digit6$ComponentRegi.getComponent("AddressDetails");
276
+ const RequestDetails = (_Digit7 = Digit) === null || _Digit7 === void 0 ? void 0 : (_Digit7$ComponentRegi = _Digit7.ComponentRegistryService) === null || _Digit7$ComponentRegi === void 0 ? void 0 : _Digit7$ComponentRegi.getComponent("RequestDetails");
277
+ const ToiletRequestDetails = (_Digit8 = Digit) === null || _Digit8 === void 0 ? void 0 : (_Digit8$ComponentRegi = _Digit8.ComponentRegistryService) === null || _Digit8$ComponentRegi === void 0 ? void 0 : _Digit8$ComponentRegi.getComponent("ToiletRequestDetails");
278
+ const TreePruningRequestDetails = (_Digit9 = Digit) === null || _Digit9 === void 0 ? void 0 : (_Digit9$ComponentRegi = _Digit9.ComponentRegistryService) === null || _Digit9$ComponentRegi === void 0 ? void 0 : _Digit9$ComponentRegi.getComponent("TreePruningRequestDetails");
279
+ const SinglePageForm = () => {
280
+ return /*#__PURE__*/React.createElement("div", {
281
+ style: {
282
+ display: "flex",
283
+ flexDirection: "column",
284
+ gap: "24px"
285
+ }
286
+ }, /*#__PURE__*/React.createElement("div", {
287
+ style: sectionStyle
288
+ }, /*#__PURE__*/React.createElement("div", {
289
+ style: sectionHeaderStyle
290
+ }, t("ES_APPLICANT_DETAILS")), /*#__PURE__*/React.createElement(ApplicantDetails, {
291
+ config: {
292
+ texts: {
293
+ submitBarLabel: "COMMON_SAVE_NEXT",
294
+ header: "ES_APPLICANT_DETAILS"
295
+ },
296
+ key: "owner"
297
+ },
298
+ onSelect: (key, data) => handleSelect(key, data),
299
+ t: t,
300
+ formData: params,
301
+ hideSubmitBar: true
302
+ })), /*#__PURE__*/React.createElement("div", {
303
+ style: sectionStyle
304
+ }, /*#__PURE__*/React.createElement("div", {
305
+ style: sectionHeaderStyle
306
+ }, t("ES_ADDRESS_DETAILS")), /*#__PURE__*/React.createElement(AddressDetails, {
307
+ config: {
308
+ texts: {
309
+ submitBarLabel: "COMMON_SAVE_NEXT",
310
+ header: "ES_ADDRESS_DETAILS"
311
+ },
312
+ key: "address"
313
+ },
314
+ onSelect: (key, data) => handleSelect(key, data),
315
+ t: t,
316
+ formData: params,
317
+ hideSubmitBar: true
318
+ })), (!serviceCode || serviceCode === "WT") && /*#__PURE__*/React.createElement("div", {
319
+ style: sectionStyle
320
+ }, /*#__PURE__*/React.createElement("div", {
321
+ style: sectionHeaderStyle
322
+ }, t("WT_REQUEST_DETAILS")), /*#__PURE__*/React.createElement(RequestDetails, {
323
+ config: {
324
+ texts: {
325
+ submitBarLabel: "COMMON_SAVE_NEXT",
326
+ header: "WT_REQUEST_DETAILS"
327
+ },
328
+ key: "requestDetails"
329
+ },
330
+ onSelect: (key, data) => handleSelect(key, data),
331
+ t: t,
332
+ formData: params,
333
+ hideSubmitBar: true
334
+ })), serviceCode === "MobileToilet" && /*#__PURE__*/React.createElement("div", {
335
+ style: sectionStyle
336
+ }, /*#__PURE__*/React.createElement("div", {
337
+ style: sectionHeaderStyle
338
+ }, t("MT_REQUEST_DETAILS")), /*#__PURE__*/React.createElement(ToiletRequestDetails, {
339
+ config: {
340
+ texts: {
341
+ submitBarLabel: "COMMON_SAVE_NEXT",
342
+ header: "MT_REQUEST_DETAILS"
343
+ },
344
+ key: "toiletRequestDetails"
345
+ },
346
+ onSelect: (key, data) => handleSelect(key, data),
347
+ t: t,
348
+ formData: params,
349
+ hideSubmitBar: true
350
+ })), serviceCode === "TREE_PRUNING" && /*#__PURE__*/React.createElement("div", {
351
+ style: sectionStyle
352
+ }, /*#__PURE__*/React.createElement("div", {
353
+ style: sectionHeaderStyle
354
+ }, t("TP_REQUEST_DETAILS")), /*#__PURE__*/React.createElement(TreePruningRequestDetails, {
355
+ config: {
356
+ texts: {
357
+ submitBarLabel: "COMMON_SAVE_NEXT",
358
+ header: "TP_REQUEST_DETAILS"
359
+ },
360
+ key: "treePruningRequestDetails"
361
+ },
362
+ onSelect: (key, data) => handleSelect(key, data),
363
+ t: t,
364
+ formData: params,
365
+ hideSubmitBar: true
366
+ })), /*#__PURE__*/React.createElement("div", {
367
+ style: {
368
+ display: "flex",
369
+ justifyContent: "flex-end",
370
+ padding: "16px 0"
371
+ }
372
+ }, /*#__PURE__*/React.createElement("button", {
373
+ style: submitButtonStyle,
374
+ onClick: () => history.push(`${match.path}/check`)
375
+ }, t("COMMON_SAVE_NEXT"))));
376
+ };
340
377
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
341
378
  style: {
342
379
  display: "flex",
@@ -358,30 +395,48 @@ const WTCreate = () => {
358
395
  flex: "1",
359
396
  overflowY: "auto"
360
397
  }
361
- }, /*#__PURE__*/React.createElement(Switch, null, config.map((routeObj, index) => {
362
- const {
363
- component,
364
- texts,
365
- inputs,
366
- key,
367
- additionaFields
368
- } = routeObj;
369
- const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
370
- return /*#__PURE__*/React.createElement(Route, {
371
- path: `${match.path}/${routeObj.route}`,
372
- key: index
373
- }, /*#__PURE__*/React.createElement(Component, {
398
+ }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
399
+ path: `${match.path}/service-type`
400
+ }, (() => {
401
+ const routeObj = config.find(r => r.route === "service-type");
402
+ if (!routeObj) return null;
403
+ const Component = typeof routeObj.component === "string" ? Digit.ComponentRegistryService.getComponent(routeObj.component) : routeObj.component;
404
+ return /*#__PURE__*/React.createElement(Component, {
374
405
  config: {
375
- texts,
376
- inputs,
377
- key,
378
- additionaFields
406
+ texts: routeObj.texts,
407
+ inputs: routeObj.inputs,
408
+ key: routeObj.key,
409
+ additionaFields: routeObj.additionaFields
410
+ },
411
+ onSelect: (k, data) => {
412
+ handleSelect(k, data);
413
+ history.push(`${match.path}/info`);
379
414
  },
380
- onSelect: handleSelect,
381
415
  t: t,
382
416
  formData: params
383
- }));
384
- }), /*#__PURE__*/React.createElement(Route, {
417
+ });
418
+ })()), /*#__PURE__*/React.createElement(Route, {
419
+ path: `${match.path}/info`
420
+ }, (() => {
421
+ const routeObj = config.find(r => r.route === "info");
422
+ if (!routeObj) return null;
423
+ const Component = typeof routeObj.component === "string" ? Digit.ComponentRegistryService.getComponent(routeObj.component) : routeObj.component;
424
+ return /*#__PURE__*/React.createElement(Component, {
425
+ config: {
426
+ texts: routeObj.texts,
427
+ inputs: routeObj.inputs,
428
+ key: routeObj.key,
429
+ additionaFields: routeObj.additionaFields
430
+ },
431
+ onSelect: () => {
432
+ history.push(`${match.path}/form`);
433
+ },
434
+ t: t,
435
+ formData: params
436
+ });
437
+ })()), /*#__PURE__*/React.createElement(Route, {
438
+ path: `${match.path}/form`
439
+ }, /*#__PURE__*/React.createElement(SinglePageForm, null)), /*#__PURE__*/React.createElement(Route, {
385
440
  path: `${match.path}/check`
386
441
  }, /*#__PURE__*/React.createElement(CheckPage, {
387
442
  onSubmit: wt_create,
@@ -405,6 +460,31 @@ const WTCreate = () => {
405
460
  to: `${match.path}/${config.indexRoute}`
406
461
  }))))));
407
462
  };
463
+ const sectionStyle = {
464
+ background: "#fff",
465
+ borderRadius: "4px",
466
+ boxShadow: "0 2px 4px rgba(0,0,0,0.08)",
467
+ padding: "24px",
468
+ border: "1px solid #E0E0E0"
469
+ };
470
+ const sectionHeaderStyle = {
471
+ fontSize: "18px",
472
+ fontWeight: "700",
473
+ color: "#0B0C0C",
474
+ marginBottom: "20px",
475
+ paddingBottom: "12px",
476
+ borderBottom: "2px solid #F47738"
477
+ };
478
+ const submitButtonStyle = {
479
+ background: "#F47738",
480
+ color: "#fff",
481
+ border: "none",
482
+ borderRadius: "4px",
483
+ padding: "12px 32px",
484
+ fontSize: "16px",
485
+ fontWeight: "600",
486
+ cursor: "pointer"
487
+ };
408
488
 
409
489
  const checkForNotNull = (value = "") => {
410
490
  return value && value != null && value != undefined && value != "" ? true : false;
@@ -1886,11 +1966,7 @@ const WTCheckPage = ({
1886
1966
  }))), /*#__PURE__*/React.createElement(CheckBox, {
1887
1967
  label: t("FINAL_DECLARATION_MESSAGE"),
1888
1968
  onChange: setdeclarationhandler,
1889
- styles: {
1890
- height: "auto",
1891
- marginBottom: "30px",
1892
- marginTop: "10px"
1893
- }
1969
+ checked: agree
1894
1970
  })), /*#__PURE__*/React.createElement(SubmitBar, {
1895
1971
  label: t("COMMON_BUTTON_SUBMIT"),
1896
1972
  onSubmit: onSubmit,
@@ -14070,13 +14146,15 @@ const ActionModal$b = ({
14070
14146
  }
14071
14147
  });
14072
14148
  let vendorDescription = [];
14073
- dsoData === null || dsoData === void 0 ? void 0 : (_dsoData$vendor = dsoData.vendor) === null || _dsoData$vendor === void 0 ? void 0 : _dsoData$vendor.map(item => {
14149
+ dsoData === null || dsoData === void 0 ? void 0 : (_dsoData$vendor = dsoData.vendor) === null || _dsoData$vendor === void 0 ? void 0 : _dsoData$vendor.forEach(item => {
14074
14150
  var _item$additionalDetai, _item$additionalDetai2;
14075
14151
  if ((item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.description) === "WT" || (item === null || item === void 0 ? void 0 : (_item$additionalDetai2 = item.additionalDetails) === null || _item$additionalDetai2 === void 0 ? void 0 : _item$additionalDetai2.serviceType) === "WT") {
14152
+ var _item$owner;
14153
+ const displayLabel = `${item === null || item === void 0 ? void 0 : item.name} (${item === null || item === void 0 ? void 0 : (_item$owner = item.owner) === null || _item$owner === void 0 ? void 0 : _item$owner.mobileNumber})`;
14076
14154
  vendorDescription.push({
14077
14155
  code: item === null || item === void 0 ? void 0 : item.name,
14078
- name: item === null || item === void 0 ? void 0 : item.name,
14079
- i18nKey: item === null || item === void 0 ? void 0 : item.name,
14156
+ name: displayLabel,
14157
+ i18nKey: displayLabel,
14080
14158
  vendorId: item === null || item === void 0 ? void 0 : item.id
14081
14159
  });
14082
14160
  }