Skip to content

Commit

Permalink
Merge pull request #741 from odisha-muktasoft/revert-737-UCEM-843-5-UAT
Browse files Browse the repository at this point in the history
Revert "Ucem 843 5 uat"
  • Loading branch information
Tulika-eGov authored Oct 22, 2024
2 parents 2e97ec6 + 5d27180 commit 1eea315
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 139 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.19",
"@egovernments/digit-ui-module-expenditure": "0.4.18",
"@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,100 +2882,22 @@ export const UICustomizations = {
},
ViewScheduledJobsConfig: {
preProcess: (data) => {
const scheduledFrom = Digit.Utils.pt.convertDateToEpoch(data?.body?.SearchCriteria?.scheduleFrom);
const scheduledTo = Digit.Utils.pt.convertDateToEpoch(data.body.SearchCriteria?.scheduleTo);
const scheduledFrom = Digit.Utils.pt.convertDateToEpoch(data?.body?.SearchCriteria?.scheduledFrom);
const scheduledTo = Digit.Utils.pt.convertDateToEpoch(data.body.SearchCriteria?.scheduledTo);
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": data.body.pagination?.limit,
"offSet": data.body.pagination?.offset,
"limit": 10,
"offSet": 0,
"order": null,
"sortBy": "createdTime"
};
Expand Down Expand Up @@ -3219,14 +3141,6 @@ 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 @@ -3266,32 +3180,25 @@ export const UICustomizations = {
);
}
if (key === "EXP_ESTIMATED_AMT") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_WAGE_PAYMENT_SUCCESS") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_WAGE_PAYMENT_FAILED") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_PUR_PAYMENT_SUCCESS") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_PUR_PAYMENT_FAILED") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_SUP_PAYMENT_SUCCESS") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
if (key === "EXP_SUP_PAYMENT_FAILED") {
value = value || 0;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value?.toFixed(2)} roundOff={false} sameDisplay={true} rupeeSymbol={true} t={t}></Amount>;
return <Amount customStyle={{ textAlign: "right", minWidth: "120px" }} value={value || 0} rupeeSymbol={true} t={t}></Amount>;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
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 @@ -76,7 +81,7 @@ export const paymentTrackerReport = (props) => {
})
})
for (let i = 2; i < data.stickyFooterRow.length; i++) {
data.stickyFooterRow[i].value = "₹" + data.stickyFooterRow[i].value?.toFixed(2);
data.stickyFooterRow[i].value = Amount({ value: data.stickyFooterRow[i].value, rupeeSymbol: true, t: t });
}
}

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.19",
"version": "0.4.18",
"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(parseFloat(amount).toFixed(2),"number",undefined,true,undefined,2);
return Digit.Utils.dss.formatterWithoutRound(Math.round(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: {
reportSearchCriteria: {},
SearchCriteria: {},
},
minParametersForSearchForm: 1,
masterName: "commonUiConfig",
moduleName: "ViewScheduledJobsExcelConfig",
moduleName: "ViewScheduledJobsConfig",
tableFormJsonPath: "requestBody.pagination",
filterFormJsonPath: "requestBody.reportSearchCriteria",
searchFormJsonPath: "requestBody.reportSearchCriteria",
filterFormJsonPath: "requestBody.SearchCriteria",
searchFormJsonPath: "requestBody.SearchCriteria",
},
sections: {
search: {
Expand All @@ -32,8 +32,8 @@ const ViewScheduledJobsExcelConfig = {
showFormInstruction: "",
defaultValues: {
status: "",
scheduledFrom: "",
scheduledTo: "",
scheduleFrom: "",
scheduleTo: "",
},
fields: [
{
Expand Down Expand Up @@ -86,8 +86,8 @@ const ViewScheduledJobsExcelConfig = {
additionalValidation: {
type: "date",
keys: {
start: "scheduledFrom",
end: "scheduledTo",
start: "scheduleFrom",
end: "scheduleTo",
},
},
},
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_AND_FIRST_300_DISPLAYED",
"showFormInstruction": "BILL_SELECT_ONE_PARAM_TO_SEARCH",
"formClassName": "",
"defaultValues": {
"ward": "",
"projectType": "",
"projectName": "",
"projectId": "",
"name": "",
"projectNumber": "",
"createdFrom": "",
"createdTo": ""
},
Expand Down Expand Up @@ -107,7 +107,7 @@ export const paymentTrackerSearchConfig = {
"name": "projectId",
"error": "PROJECT_PATTERN_ERR_MSG",
"validation": {
"pattern": /^[a-z0-9\/-]*$/i,
"pattern": "PJ\\/[0-9]+-[0-9]+\\/[0-9]+\\/[0-9]+",
"minlength": 2
}
}
Expand Down Expand Up @@ -221,8 +221,8 @@ export const paymentTrackerSearchConfig = {
"resultsJsonPath": "aggsResponse.projects",
"showCheckBox": false,
"checkBoxActionLabel": "ES_COMMON_GENERATE_PAYMENT_ADVICE",
"stickyFooter": true,
"paginationValues": [10, 20, 30, 40, 50, 100, 200, 300],
"showTableInstruction": "EXP_DOWNLOAD_BILL_INSTRUCTION",
"stickyFooter": true
},
"children": {},
"show": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, { useState } from "react";
import React, { useEffect, 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 @@ -32,7 +30,7 @@ export const paymentTrackerViewConfig = (project, projectBillPaidData ,projectBi
},
{
key: "PROJECT_LOCATION",
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")}`,
value: project?.address?.city,
},
{
key: "PROJECT_DESCRIPTION",
Expand All @@ -54,19 +52,19 @@ export const paymentTrackerViewConfig = (project, projectBillPaidData ,projectBi
},
{
key: "WAGE_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.wageAmountPaid || 0),
value: amountFormatter(breakupDetails?.wageAmountPaid),
},
{
key: "PURCHASE_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.purchaseAmountPaid || 0),
value: amountFormatter(breakupDetails?.purchaseAmountPaid),
},
{
key: "SUPERVISION_AMOUNT_PAID",
value: amountFormatter(breakupDetails?.supervisionAmountPaid || 0),
value: amountFormatter(breakupDetails?.supervisionAmountPaid),
},
{
key: "FAILED_PAYMENT_AMOUNT",
value: amountFormatter(breakupDetails?.failedPaymentAmount || 0),
value: amountFormatter(breakupDetails?.failedPaymentAmount),
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 || 0,
total: bill?.businessObject?.grossAmount,
piNumber: bill?.businessObject?.jitBillNo,
paymentNumber: bill?.businessObject?.muktaReferenceId,
parentPi: bill?.businessObject?.parentPiNumber || t("NA"),
piType: piType,
piCreationDate: getDate(piCreationDate),
paidAmount: bill?.businessObject?.grossAmount || 0,
paidAmount: bill?.businessObject?.grossAmount,
piDate: getDate(piDate),
piStatus: bill?.businessObject?.piStatus,
paymentFailed: paymentFailed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ const Table = ({
showCheckBox = false,
actionLabel = 'CS_COMMON_DOWNLOAD',
tableSelectionHandler = () => {},
stickyFooter,
paginationValues
stickyFooter
}) => {
const {
getTableProps,
Expand Down Expand Up @@ -234,7 +233,7 @@ const Table = ({
style={{ marginRight: "15px" }}
onChange={manualPagination ? onPageSizeChange : (e) => setPageSize(Number(e.target.value))}
>
{(paginationValues ? paginationValues : [10, 20, 30, 40, 50]).map((pageSize) => (
{[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 || data?.pagination?.totalCount || searchResult?.length}
totalRecords={data?.count || data?.TotalCount || data?.totalCount || searchResult?.length}
columns={tableColumns}
isPaginationRequired={true}
onPageSizeChange={onPageSizeChange}
Expand All @@ -208,7 +208,6 @@ 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 1eea315

Please sign in to comment.