@mseva/digit-ui-module-rentandlease 1.0.9 → 1.0.10

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.
@@ -6219,6 +6219,90 @@ const pdfDownloadLink = (documents = {}, fileStoreId = "", format = "") => {
6219
6219
  });
6220
6220
  return fileURL;
6221
6221
  };
6222
+ const capitalize = text => text.substr(0, 1).toUpperCase() + text.substr(1);
6223
+ const ulbCamel = ulb => ulb.toLowerCase().split(" ").map(capitalize).join(" ");
6224
+ const getAcknowledgementData = async (application, tenantInfo, t) => {
6225
+ var _application$OwnerInf, _application$addition, _application$addition2, _application$addition3, _application$addition4, _application$addition5, _application$addition6, _application$addition7, _application$addition8, _application$addition9, _application$Document, _application$addition0, _tenantInfo$city;
6226
+ console.log("application in getAcknowledgement", application);
6227
+ const details = [];
6228
+ application === null || application === void 0 ? void 0 : (_application$OwnerInf = application.OwnerInfo) === null || _application$OwnerInf === void 0 ? void 0 : _application$OwnerInf.forEach((owner, index) => {
6229
+ var _owner$permanentAddre, _owner$permanentAddre2, _owner$correspondence, _owner$correspondence2;
6230
+ details.push({
6231
+ title: `Owner ${index + 1} Details`,
6232
+ values: [{
6233
+ title: t("CORE_COMMON_NAME"),
6234
+ value: (owner === null || owner === void 0 ? void 0 : owner.name) || t("CS_NA")
6235
+ }, {
6236
+ title: t("CORE_COMMON_PROFILE_MOBILE_NUMBER"),
6237
+ value: (owner === null || owner === void 0 ? void 0 : owner.mobileNo) || t("CS_NA")
6238
+ }, {
6239
+ title: t("CORE_EMAIL_ID"),
6240
+ value: (owner === null || owner === void 0 ? void 0 : owner.emailId) || t("CS_NA")
6241
+ }, {
6242
+ title: t("Permanent Address"),
6243
+ value: `${(owner === null || owner === void 0 ? void 0 : (_owner$permanentAddre = owner.permanentAddress) === null || _owner$permanentAddre === void 0 ? void 0 : _owner$permanentAddre.addressId) || t("CS_NA")} , ${(owner === null || owner === void 0 ? void 0 : (_owner$permanentAddre2 = owner.permanentAddress) === null || _owner$permanentAddre2 === void 0 ? void 0 : _owner$permanentAddre2.pincode) || t("CS_NA")}`
6244
+ }, {
6245
+ title: t("Corresspondence Address"),
6246
+ value: `${(owner === null || owner === void 0 ? void 0 : (_owner$correspondence = owner.correspondenceAddress) === null || _owner$correspondence === void 0 ? void 0 : _owner$correspondence.addressId) || t("CS_NA")} , ${(owner === null || owner === void 0 ? void 0 : (_owner$correspondence2 = owner.correspondenceAddress) === null || _owner$correspondence2 === void 0 ? void 0 : _owner$correspondence2.pincode) || t("CS_NA")}`
6247
+ }]
6248
+ });
6249
+ });
6250
+ details.push({
6251
+ title: t("PT_PROPERTY_DETAILS"),
6252
+ values: [{
6253
+ title: t("PROPERTY_ID"),
6254
+ value: t(application === null || application === void 0 ? void 0 : (_application$addition = application.additionalDetails) === null || _application$addition === void 0 ? void 0 : _application$addition.propertyId) || "NA"
6255
+ }, {
6256
+ title: t("PT_ACK_LOCALIZATION_PROPERTY_ADDRESS"),
6257
+ value: (application === null || application === void 0 ? void 0 : (_application$addition2 = application.additionalDetails) === null || _application$addition2 === void 0 ? void 0 : _application$addition2.address) || "NA"
6258
+ }, {
6259
+ title: t("Allotment Type"),
6260
+ value: (application === null || application === void 0 ? void 0 : (_application$addition3 = application.additionalDetails) === null || _application$addition3 === void 0 ? void 0 : _application$addition3.allotmentType) || "NA"
6261
+ }, {
6262
+ title: t("Property Name"),
6263
+ value: (application === null || application === void 0 ? void 0 : (_application$addition4 = application.additionalDetails) === null || _application$addition4 === void 0 ? void 0 : _application$addition4.propertyName) || "NA"
6264
+ }, {
6265
+ title: t("Property Area"),
6266
+ value: `${(application === null || application === void 0 ? void 0 : (_application$addition5 = application.additionalDetails) === null || _application$addition5 === void 0 ? void 0 : _application$addition5.propertySizeOrArea) || "NA"} sq. meters`
6267
+ }, {
6268
+ title: t("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_PROPERTY_TYPE"),
6269
+ value: (application === null || application === void 0 ? void 0 : (_application$addition6 = application.additionalDetails) === null || _application$addition6 === void 0 ? void 0 : _application$addition6.propertyType) || "NA"
6270
+ }, {
6271
+ title: t("Location Type"),
6272
+ value: (application === null || application === void 0 ? void 0 : (_application$addition7 = application.additionalDetails) === null || _application$addition7 === void 0 ? void 0 : _application$addition7.locationType) || "NA"
6273
+ }, {
6274
+ title: t("Security Deposit"),
6275
+ value: `Rs. ${(application === null || application === void 0 ? void 0 : (_application$addition8 = application.additionalDetails) === null || _application$addition8 === void 0 ? void 0 : _application$addition8.securityDeposit) || "NA"}`
6276
+ }, {
6277
+ title: t("Base Rent"),
6278
+ value: `Rs. ${(application === null || application === void 0 ? void 0 : (_application$addition9 = application.additionalDetails) === null || _application$addition9 === void 0 ? void 0 : _application$addition9.baseRent) || "NA"}`
6279
+ }]
6280
+ });
6281
+ const docDetails = application === null || application === void 0 ? void 0 : (_application$Document = application.Document) === null || _application$Document === void 0 ? void 0 : _application$Document.map((doc, index) => ({
6282
+ title: t(`${doc.documentType}`) || "NA",
6283
+ value: " ",
6284
+ link: doc.fileStoreId ? Digit.Utils.getFileUrl(doc.fileStoreId) : ""
6285
+ }));
6286
+ details.push({
6287
+ title: t("BPA_APPLICATION_DOCUMENTS"),
6288
+ values: docDetails !== null && docDetails !== void 0 && docDetails.length ? docDetails : [{
6289
+ title: t("CS_NO_DOCUMENTS_UPLOADED"),
6290
+ value: "NA"
6291
+ }]
6292
+ });
6293
+ const imageURL = application === null || application === void 0 ? void 0 : (_application$addition0 = application.additionalDetails) === null || _application$addition0 === void 0 ? void 0 : _application$addition0.propertyImage;
6294
+ return {
6295
+ t: t,
6296
+ tenantId: tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.code,
6297
+ name: `${t(tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.i18nKey)} ${ulbCamel(t(`ULBGRADE_${tenantInfo === null || tenantInfo === void 0 ? void 0 : (_tenantInfo$city = tenantInfo.city) === null || _tenantInfo$city === void 0 ? void 0 : _tenantInfo$city.ulbGrade.toUpperCase().replace(" ", "_").replace(".", "_")}`))}`,
6298
+ email: tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.emailId,
6299
+ phoneNumber: tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.contactNumber,
6300
+ heading: t("Acknowledgment letter for Rent and Lease Services"),
6301
+ applicationNumber: (application === null || application === void 0 ? void 0 : application.applicationNumber) || "NA",
6302
+ details,
6303
+ imageURL
6304
+ };
6305
+ };
6222
6306
 
6223
6307
  const configMCollectRejectApplication = ({
6224
6308
  t,
@@ -9238,6 +9322,14 @@ const RALApplicationDetails = () => {
9238
9322
  } = useParams();
9239
9323
  const [loader, setLoader] = useState(false);
9240
9324
  const [applicationData, setApplicationData] = useState();
9325
+ const [showOptions, setShowOptions] = useState(false);
9326
+ const {
9327
+ data: storeData
9328
+ } = Digit.Hooks.useStore.getInitData();
9329
+ const {
9330
+ tenants
9331
+ } = storeData || {};
9332
+ console.log("applicationData", applicationData);
9241
9333
  const fetchApplications = async filters => {
9242
9334
  setLoader(true);
9243
9335
  try {
@@ -9251,6 +9343,81 @@ const RALApplicationDetails = () => {
9251
9343
  setLoader(false);
9252
9344
  }
9253
9345
  };
9346
+ const {
9347
+ data: reciept_data,
9348
+ isLoading: recieptDataLoading
9349
+ } = Digit.Hooks.useRecieptSearch({
9350
+ tenantId: tenantId,
9351
+ businessService: "rl-services",
9352
+ consumerCodes: acknowledgementIds,
9353
+ isEmployee: false
9354
+ }, {
9355
+ enabled: acknowledgementIds ? true : false
9356
+ });
9357
+ const getAcknowledgement = async () => {
9358
+ setLoader(true);
9359
+ try {
9360
+ const applications = applicationData;
9361
+ const tenantInfo = tenants.find(tenant => tenant.code === tenantId);
9362
+ const acknowldgementDataAPI = await getAcknowledgementData({
9363
+ ...applications
9364
+ }, tenantInfo, t);
9365
+ setTimeout(() => {
9366
+ Digit.Utils.pdf.generateFormatted(acknowldgementDataAPI);
9367
+ setLoader(false);
9368
+ }, 0);
9369
+ } catch (error) {
9370
+ console.error("Error generating acknowledgement:", error);
9371
+ setLoader(false);
9372
+ }
9373
+ };
9374
+ const dowloadOptions = [];
9375
+ dowloadOptions.push({
9376
+ label: t("CHB_DOWNLOAD_ACK_FORM"),
9377
+ onClick: () => getAcknowledgement()
9378
+ });
9379
+ async function getRecieptSearch({
9380
+ tenantId,
9381
+ payments,
9382
+ ...params
9383
+ }) {
9384
+ setLoader(true);
9385
+ try {
9386
+ var _response;
9387
+ let response = null;
9388
+ if (payments !== null && payments !== void 0 && payments.fileStoreId) {
9389
+ response = {
9390
+ filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
9391
+ };
9392
+ } else {
9393
+ response = await Digit.PaymentService.generatePdf(tenantId, {
9394
+ Payments: [{
9395
+ ...payments
9396
+ }]
9397
+ }, "rentandlease-receipt");
9398
+ }
9399
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
9400
+ fileStoreIds: response.filestoreIds[0]
9401
+ });
9402
+ window.open(fileStore[(_response = response) === null || _response === void 0 ? void 0 : _response.filestoreIds[0]], "_blank");
9403
+ setLoader(false);
9404
+ } catch (error) {
9405
+ console.error(error);
9406
+ setLoader(false);
9407
+ }
9408
+ }
9409
+ if (reciept_data && (reciept_data === null || reciept_data === void 0 ? void 0 : reciept_data.Payments.length) > 0 && !recieptDataLoading) {
9410
+ dowloadOptions.push({
9411
+ label: t("PTR_FEE_RECIEPT"),
9412
+ onClick: () => {
9413
+ var _reciept_data$Payment;
9414
+ return getRecieptSearch({
9415
+ tenantId: reciept_data === null || reciept_data === void 0 ? void 0 : (_reciept_data$Payment = reciept_data.Payments[0]) === null || _reciept_data$Payment === void 0 ? void 0 : _reciept_data$Payment.tenantId,
9416
+ payments: reciept_data === null || reciept_data === void 0 ? void 0 : reciept_data.Payments[0]
9417
+ });
9418
+ }
9419
+ });
9420
+ }
9254
9421
  useEffect(() => {
9255
9422
  if (acknowledgementIds) {
9256
9423
  const filters = {
@@ -9276,7 +9443,12 @@ const RALApplicationDetails = () => {
9276
9443
  styles: {
9277
9444
  fontSize: "32px"
9278
9445
  }
9279
- }, t("RENT_LEASE_APPLICATION_DETAILS"))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardSubHeader, {
9446
+ }, t("RENT_LEASE_APPLICATION_DETAILS")), dowloadOptions && dowloadOptions.length > 0 && /*#__PURE__*/React.createElement(MultiLink, {
9447
+ className: "multilinkWrapper",
9448
+ onHeadClick: () => setShowOptions(!showOptions),
9449
+ displayOptions: showOptions,
9450
+ options: dowloadOptions
9451
+ })), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardSubHeader, {
9280
9452
  style: {
9281
9453
  fontSize: "24px"
9282
9454
  }