Skip to content

Commit

Permalink
Merge pull request #737 from odisha-muktasoft/UCEM-843-5-UAT
Browse files Browse the repository at this point in the history
Ucem 843 5 uat
  • Loading branch information
Tulika-eGov authored Oct 22, 2024
2 parents a6ef155 + 3c7c22b commit 2e97ec6
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@egovernments/digit-ui-module-estimate": "0.4.21",
"@egovernments/digit-ui-module-masters": "0.4.20",
"@egovernments/digit-ui-module-project": "0.4.16",
"@egovernments/digit-ui-module-expenditure": "0.4.18",
"@egovernments/digit-ui-module-expenditure": "0.4.19",
"@egovernments/digit-ui-customisation-mukta": "0.2.13",
"@egovernments/digit-ui-module-rate-analysis": "0.4.16",
"http-proxy-middleware": "^1.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2882,22 +2882,100 @@ export const UICustomizations = {
},
ViewScheduledJobsConfig: {
preProcess: (data) => {
const scheduledFrom = Digit.Utils.pt.convertDateToEpoch(data?.body?.SearchCriteria?.scheduledFrom);
const scheduledTo = Digit.Utils.pt.convertDateToEpoch(data.body.SearchCriteria?.scheduledTo);
const scheduledFrom = Digit.Utils.pt.convertDateToEpoch(data?.body?.SearchCriteria?.scheduleFrom);
const scheduledTo = Digit.Utils.pt.convertDateToEpoch(data.body.SearchCriteria?.scheduleTo);
const status = data.body.SearchCriteria?.status?.code;
data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId(), includeAncestors: true };
data.body.SearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
data.body.SearchCriteria = {
...data.body.SearchCriteria,
tenantId: Digit.ULBService.getCurrentTenantId(),
status,
scheduleFrom:scheduledFrom,
scheduleTo:scheduledTo,
};
return data;
},
customValidationCheck: (data) => {
//checking both to and from date are present
const { scheduledFrom, scheduledTo } = data;
if (scheduledTo !== "" && scheduledFrom === "") return { type:"warning", label: "ES_COMMON_ENTER_DATE_RANGE" };
else if (scheduledTo === "" && scheduledFrom !== "") return { type:"warning", label: "ES_COMMON_ENTER_DATE_RANGE" };

return false;
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
//here we can add multiple conditions
//like if a cell is link then we return link
//first we can identify which column it belongs to then we can return relevant result
switch (key) {
case "RA_JOB_ID":
return value;

case "RA_SCHEDULED_ON":
return Digit.DateUtils.ConvertEpochToDate(value);

case "RA_RATE_EFFECTIVE_FROM": {
return Digit.DateUtils.ConvertEpochToDate(value);
}

case "RA_NO_OF_SOR_SCHEDULED":
return { value };

case "RA_SUCCESSFUL": {
let successfulCount = 0;
row.sorDetails.forEach((detail) => {
if (detail.status === "SUCCESSFUL") {
successfulCount++;
}
});
return successfulCount;
}
case "RA_FAILED": {
let failedCount = 0;
value.forEach((detail) => {
if (detail.status === "FAILED") {
failedCount++;
}
});
return failedCount;
}

case "RA_STATUS":
return (
<div style={{ color: value === "FAILED" ? "#D4351C" : value === "COMPLETED" ? "#27AE60" : "#F47738" }}>
{value === "FAILED" ? "Failed" : value === "COMPLETED" ? "Completed" : value === "IN_PROGRESS" ? "In Progress" : "Scheduled"}
</div>
);

default:
return t("ES_COMMON_NA");
}
},
additionalValidations: (type, data, keys) => {
if (type === "date") {
return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true;
}
},
},
ViewScheduledJobsExcelConfig: {
preProcess: (data) => {
const scheduledFrom = Digit.Utils.pt.convertDateToEpoch(data?.body?.reportSearchCriteria?.scheduledFrom);
const scheduledTo = Digit.Utils.pt.convertDateToEpoch(data.body.reportSearchCriteria?.scheduledTo);
const status = data.body.reportSearchCriteria?.status?.code;
data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId(), includeAncestors: true };
data.body.reportSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
data.body.reportSearchCriteria = {
...data.body.reportSearchCriteria,
tenantId: Digit.ULBService.getCurrentTenantId(),
status,
scheduledFrom:scheduledFrom,
scheduledTo:scheduledTo,
};

data.body.pagination = {
"limit": 10,
"offSet": 0,
"limit": data.body.pagination?.limit,
"offSet": data.body.pagination?.offset,
"order": null,
"sortBy": "createdTime"
};
Expand Down Expand Up @@ -3141,6 +3219,14 @@ export const UICustomizations = {
postProcess: (responseArray, uiConfig) => {
return responseArray;
},
customValidationCheck: (data) => {
//checking both to and from date are present
const { createdFrom, createdTo } = data;
if (createdTo !== "" && createdFrom === "") return {type:"warning", label: "ES_COMMON_ENTER_DATE_RANGE" };
else if (createdTo === "" && createdFrom !== "") return { type:"warning", label: "ES_COMMON_ENTER_DATE_RANGE" };

return false;
},
additionalValidations: (type, data, keys) => {
if (type === "date") {
return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true;
Expand Down Expand Up @@ -3180,25 +3266,32 @@ export const UICustomizations = {
);
}
if (key === "EXP_ESTIMATED_AMT") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_WAGE_PAYMENT_SUCCESS") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_WAGE_PAYMENT_FAILED") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_PUR_PAYMENT_SUCCESS") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_PUR_PAYMENT_FAILED") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_SUP_PAYMENT_SUCCESS") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_SUP_PAYMENT_FAILED") {
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { useTranslation } from "react-i18next";

const Amount = ({t,roundOff=true,...props}) => {
const value=roundOff?Math.round(props?.value):props?.value;
return `${props?.rupeeSymbol ? "₹" : ""}${value !== undefined && value !== null ? (props?.sameDisplay ? value : `${Digit?.Utils?.dss?.formatterWithoutRound(value, "number")}`) : t("ES_COMMON_NA")}`;
}

const cyrb53 = (str, seed = 0) => {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for(let i = 0, ch; i < str.length; i++) {
Expand Down Expand Up @@ -81,7 +76,7 @@ export const paymentTrackerReport = (props) => {
})
})
for (let i = 2; i < data.stickyFooterRow.length; i++) {
data.stickyFooterRow[i].value = Amount({ value: data.stickyFooterRow[i].value, rupeeSymbol: true, t: t });
data.stickyFooterRow[i].value = "₹" + data.stickyFooterRow[i].value?.toFixed(2);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-module-expenditure",
"version": "0.4.18",
"version": "0.4.19",
"description": "Expenditure Management Module UI",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const PaymentTrackerTable = ({excludeFailed, setExcludeFailed, ...props}) => {
const [tableRows, setTableRows] = useState(props?.tableRows);

const amountFormatter = (amount) => {
return Digit.Utils.dss.formatterWithoutRound(Math.round(parseFloat(amount)).toFixed(2),"number",undefined,true,undefined,2);
return Digit.Utils.dss.formatterWithoutRound(parseFloat(amount).toFixed(2),"number",undefined,true,undefined,2);
}

const tableColumns = useMemo(()=>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const ViewScheduledJobsExcelConfig = {
serviceName: "/wms/report/payment-tracker/_search",
requestParam: {},
requestBody: {
SearchCriteria: {},
reportSearchCriteria: {},
},
minParametersForSearchForm: 1,
masterName: "commonUiConfig",
moduleName: "ViewScheduledJobsConfig",
moduleName: "ViewScheduledJobsExcelConfig",
tableFormJsonPath: "requestBody.pagination",
filterFormJsonPath: "requestBody.SearchCriteria",
searchFormJsonPath: "requestBody.SearchCriteria",
filterFormJsonPath: "requestBody.reportSearchCriteria",
searchFormJsonPath: "requestBody.reportSearchCriteria",
},
sections: {
search: {
Expand All @@ -32,8 +32,8 @@ const ViewScheduledJobsExcelConfig = {
showFormInstruction: "",
defaultValues: {
status: "",
scheduleFrom: "",
scheduleTo: "",
scheduledFrom: "",
scheduledTo: "",
},
fields: [
{
Expand Down Expand Up @@ -86,8 +86,8 @@ const ViewScheduledJobsExcelConfig = {
additionalValidation: {
type: "date",
keys: {
start: "scheduleFrom",
end: "scheduleTo",
start: "scheduledFrom",
end: "scheduledTo",
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const paymentTrackerSearchConfig = {
"searchCriteria": {
"moduleSearchCriteria": {}
}
},
},
"minParametersForSearchForm": 1,
"masterName": "commonUiConfig",
"moduleName": "paymentTrackerSearchConfig",
Expand All @@ -31,13 +31,13 @@ export const paymentTrackerSearchConfig = {
"primaryLabel": "ES_COMMON_SEARCH",
"secondaryLabel": "ES_COMMON_CLEAR_SEARCH",
"minReqFields": 1,
"showFormInstruction": "BILL_SELECT_ONE_PARAM_TO_SEARCH",
"showFormInstruction": "BILL_SELECT_ONE_PARAM_TO_SEARCH_AND_FIRST_300_DISPLAYED",
"formClassName": "",
"defaultValues": {
"ward": "",
"projectType": "",
"name": "",
"projectNumber": "",
"projectName": "",
"projectId": "",
"createdFrom": "",
"createdTo": ""
},
Expand Down Expand Up @@ -107,7 +107,7 @@ export const paymentTrackerSearchConfig = {
"name": "projectId",
"error": "PROJECT_PATTERN_ERR_MSG",
"validation": {
"pattern": "PJ\\/[0-9]+-[0-9]+\\/[0-9]+\\/[0-9]+",
"pattern": /^[a-z0-9\/-]*$/i,
"minlength": 2
}
}
Expand Down Expand Up @@ -221,8 +221,8 @@ export const paymentTrackerSearchConfig = {
"resultsJsonPath": "aggsResponse.projects",
"showCheckBox": false,
"checkBoxActionLabel": "ES_COMMON_GENERATE_PAYMENT_ADVICE",
"showTableInstruction": "EXP_DOWNLOAD_BILL_INSTRUCTION",
"stickyFooter": true
"stickyFooter": true,
"paginationValues": [10, 20, 30, 40, 50, 100, 200, 300],
},
"children": {},
"show": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import { getBreakupDetails, transformBillData } from "../utils/paymentTrackerUtils";
import { useTranslation } from "react-i18next";

export const paymentTrackerViewConfig = (project, projectBillPaidData ,projectBillData, projectId) => {

const { t } = useTranslation();
const [excludeFailed, setExcludeFailed] = useState(false);

const breakupDetails = getBreakupDetails({projectBillPaidData});
Expand Down Expand Up @@ -30,7 +32,7 @@ export const paymentTrackerViewConfig = (project, projectBillPaidData ,projectBi
},
{
key: "PROJECT_LOCATION",
value: project?.address?.city,
value: `${project?.address?.locality || t("ES_COMMON_NA")}, ${(project?.address?.boundaryType && project?.address?.boundary) ? `${project?.address?.boundaryType} ${project?.address?.boundary}` : t("ES_COMMON_NA")}, ${project?.address?.city || t("ES_COMMON_NA")}`,
},
{
key: "PROJECT_DESCRIPTION",
Expand All @@ -52,19 +54,19 @@ export const paymentTrackerViewConfig = (project, projectBillPaidData ,projectBi
},
{
key: "WAGE_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.wageAmountPaid),
value: amountFormatter(breakupDetails?.wageAmountPaid || 0),
},
{
key: "PURCHASE_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.purchaseAmountPaid),
value: amountFormatter(breakupDetails?.purchaseAmountPaid || 0),
},
{
key: "SUPERVISION_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.supervisionAmountPaid),
value: amountFormatter(breakupDetails?.supervisionAmountPaid || 0),
},
{
key: "FAILED_PAYMENT_AMOUNT",
value: amountFormatter(breakupDetails?.failedPaymentAmount),
value: amountFormatter(breakupDetails?.failedPaymentAmount || 0),
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Header, InboxSearchComposer, Loader, Button, AddFilled } from "@egovernments/digit-ui-react-components";
import { useHistory, useLocation } from "react-router-dom";
//import ViewScheduledJobsConfig from "../../../../RateAnalysis/src/configs/ViewScheduledJobsConfig";
import ViewScheduledJobsExcelConfig from "../../configs/ViewScheduledJobsExcelConfig";

const ViewScheduledJobsExcel = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ export const transformBillData = ({projectBillData}) => {
billNumber: bill?.businessObject?.additionalDetails?.billNumber?.[0],
workOrderNumber: bill?.businessObject?.additionalDetails?.referenceId?.[0],
billType: billType,
total: bill?.businessObject?.grossAmount,
total: bill?.businessObject?.grossAmount || 0,
piNumber: bill?.businessObject?.jitBillNo,
paymentNumber: bill?.businessObject?.muktaReferenceId,
parentPi: bill?.businessObject?.parentPiNumber || t("NA"),
piType: piType,
piCreationDate: getDate(piCreationDate),
paidAmount: bill?.businessObject?.grossAmount,
paidAmount: bill?.businessObject?.grossAmount || 0,
piDate: getDate(piDate),
piStatus: bill?.businessObject?.piStatus,
paymentFailed: paymentFailed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ const Table = ({
showCheckBox = false,
actionLabel = 'CS_COMMON_DOWNLOAD',
tableSelectionHandler = () => {},
stickyFooter
stickyFooter,
paginationValues
}) => {
const {
getTableProps,
Expand Down Expand Up @@ -233,7 +234,7 @@ const Table = ({
style={{ marginRight: "15px" }}
onChange={manualPagination ? onPageSizeChange : (e) => setPageSize(Number(e.target.value))}
>
{[10, 20, 30, 40, 50].map((pageSize) => (
{(paginationValues ? paginationValues : [10, 20, 30, 40, 50]).map((pageSize) => (
<option key={pageSize} value={pageSize}>
{pageSize}
</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const ResultsTable = ({ tableContainerClass, config,data,isLoading,isFetching,fu
globalSearch={config?.enableGlobalSearch ? filterValue : undefined}
onSearch={config?.enableGlobalSearch ? searchQuery : undefined}
data={searchResult}
totalRecords={data?.count || data?.TotalCount || data?.totalCount || searchResult?.length}
totalRecords={data?.count || data?.TotalCount || data?.totalCount || data?.pagination?.totalCount || searchResult?.length}
columns={tableColumns}
isPaginationRequired={true}
onPageSizeChange={onPageSizeChange}
Expand All @@ -208,6 +208,7 @@ const ResultsTable = ({ tableContainerClass, config,data,isLoading,isFetching,fu
};
}}
stickyFooter={config?.stickyFooter ? data?.stickyFooterRow : undefined}
paginationValues={config?.paginationValues}
/>}
</div>
)
Expand Down
Loading

0 comments on commit 2e97ec6

Please sign in to comment.