changed currency format in list
This commit is contained in:
parent
e8698473db
commit
4069720ed0
@ -12,6 +12,7 @@ import {
|
|||||||
} from "../../utils/constants";
|
} from "../../utils/constants";
|
||||||
import {
|
import {
|
||||||
formatCurrency,
|
formatCurrency,
|
||||||
|
formatFigure,
|
||||||
getColorNameFromHex,
|
getColorNameFromHex,
|
||||||
useDebounce,
|
useDebounce,
|
||||||
} from "../../utils/appUtils";
|
} from "../../utils/appUtils";
|
||||||
@ -166,7 +167,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
|
|||||||
{
|
{
|
||||||
key: "amount",
|
key: "amount",
|
||||||
label: "Amount",
|
label: "Amount",
|
||||||
getValue: (e) => <>{formatCurrency(e?.amount)}</>,
|
getValue: (e) => <>{formatFigure(e?.amount,{type:"currency",currency : e?.currency?.currencyCode ?? "INR"} )}</>,
|
||||||
isAlwaysVisible: true,
|
isAlwaysVisible: true,
|
||||||
align: "text-end",
|
align: "text-end",
|
||||||
},
|
},
|
||||||
@ -288,11 +289,11 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
|
|||||||
(col.isAlwaysVisible || groupBy !== col.key) && (
|
(col.isAlwaysVisible || groupBy !== col.key) && (
|
||||||
<td
|
<td
|
||||||
key={col.key}
|
key={col.key}
|
||||||
className={`d-table-cell ${col.align ?? ""}`}
|
className={`d-table-cell ml-2 ${col.align ?? ""}`}
|
||||||
>
|
>
|
||||||
{col.customRender
|
<div className="d-flex px-2">{col.customRender
|
||||||
? col.customRender(expense)
|
? col.customRender(expense)
|
||||||
: col.getValue(expense)}
|
: col.getValue(expense)}</div>
|
||||||
</td>
|
</td>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -18,9 +18,7 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => {
|
|||||||
{/* File icon and info */}
|
{/* File icon and info */}
|
||||||
<div className="col-10 d-flex align-items-center gap-2">
|
<div className="col-10 d-flex align-items-center gap-2">
|
||||||
<i
|
<i
|
||||||
className={`bx ${getIconByFileType(
|
className={`bx ${getIconByFileType(file?.contentType)} fs-3`}
|
||||||
file?.contentType
|
|
||||||
)} fs-3`}
|
|
||||||
style={{ minWidth: "30px" }}
|
style={{ minWidth: "30px" }}
|
||||||
></i>
|
></i>
|
||||||
|
|
||||||
@ -41,11 +39,11 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => {
|
|||||||
role="button"
|
role="button"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
debugger;
|
||||||
removeFile(expenseToEdit ? file.documentId : idx);
|
removeFile(expenseToEdit ? file.documentId : idx);
|
||||||
}}
|
}}
|
||||||
></i>
|
></i>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -55,3 +53,44 @@ const Filelist = ({ files, removeFile, expenseToEdit }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default Filelist;
|
export default Filelist;
|
||||||
|
|
||||||
|
export const FilelistView = ({ files, viewFile }) => {
|
||||||
|
return (
|
||||||
|
<div className="d-flex flex-wrap gap-2 mt-2">
|
||||||
|
{files?.map((file, idx) => (
|
||||||
|
<div className="col-12 col-sm-6 col-md-4 bg-white " key={idx}>
|
||||||
|
<div className="row align-items-center">
|
||||||
|
{/* File icon and info */}
|
||||||
|
<div className="col-10 d-flex align-items-center gap-2">
|
||||||
|
<i
|
||||||
|
className={`bx ${getIconByFileType(file?.fileName)} fs-3`}
|
||||||
|
style={{ minWidth: "30px" }}
|
||||||
|
></i>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="d-flex flex-column text-truncate"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
viewFile({
|
||||||
|
IsOpen: true,
|
||||||
|
Image: file.preSignedUrl,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="fw-medium small text-truncate">
|
||||||
|
{file.fileName}
|
||||||
|
</span>
|
||||||
|
<span className="text-body-secondary small">
|
||||||
|
<Tooltip text={"Click on file"}>
|
||||||
|
{" "}
|
||||||
|
{file.fileSize ? formatFileSize(file.fileSize) : ""}
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@ -129,7 +129,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
|
|||||||
reader.onload = () => resolve(reader.result.split(",")[1]);
|
reader.onload = () => resolve(reader.result.split(",")[1]);
|
||||||
reader.onerror = (error) => reject(error);
|
reader.onerror = (error) => reject(error);
|
||||||
});
|
});
|
||||||
const removeFile = (index) => {
|
const removeFile = (index) => {documentId
|
||||||
if (expenseToEdit) {
|
if (expenseToEdit) {
|
||||||
const newFiles = files.map((file, i) => {
|
const newFiles = files.map((file, i) => {
|
||||||
if (file.documentId !== index) return file;
|
if (file.documentId !== index) return file;
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|||||||
import { defaultActionValues, ExpenseActionScheam } from "./ExpenseSchema";
|
import { defaultActionValues, ExpenseActionScheam } from "./ExpenseSchema";
|
||||||
import { useExpenseContext } from "../../pages/Expense/ExpensePage";
|
import { useExpenseContext } from "../../pages/Expense/ExpensePage";
|
||||||
import {
|
import {
|
||||||
|
formatCurrency,
|
||||||
getColorNameFromHex,
|
getColorNameFromHex,
|
||||||
getIconByFileType,
|
getIconByFileType,
|
||||||
localToUtc,
|
localToUtc,
|
||||||
@ -165,7 +166,7 @@ const ViewExpense = ({ ExpenseId }) => {
|
|||||||
<label className="form-label me-2 mb-0 fw-semibold text-start" style={{ minWidth: "130px" }}>
|
<label className="form-label me-2 mb-0 fw-semibold text-start" style={{ minWidth: "130px" }}>
|
||||||
Amount :
|
Amount :
|
||||||
</label>
|
</label>
|
||||||
<div className="text-muted">₹ {data.amount}</div>
|
<div className="text-muted"> {formatCurrency(data.amount,data.curency.currencyCode)}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -289,6 +290,7 @@ const ViewExpense = ({ ExpenseId }) => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
|||||||
reader.onerror = (error) => reject(error);
|
reader.onerror = (error) => reject(error);
|
||||||
});
|
});
|
||||||
const removeFile = (index) => {
|
const removeFile = (index) => {
|
||||||
|
debugger
|
||||||
if (requestToEdit) {
|
if (requestToEdit) {
|
||||||
const newFiles = files.map((file, i) => {
|
const newFiles = files.map((file, i) => {
|
||||||
if (file.documentId !== index) return file;
|
if (file.documentId !== index) return file;
|
||||||
@ -153,12 +154,12 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
|
|||||||
projectId: data.project.id || "",
|
projectId: data.project.id || "",
|
||||||
expenseCategoryId: data.expenseCategory.id || "",
|
expenseCategoryId: data.expenseCategory.id || "",
|
||||||
isAdvancePayment: data.isAdvancePayment || false,
|
isAdvancePayment: data.isAdvancePayment || false,
|
||||||
billAttachments: data.attc
|
billAttachments: data.attachments
|
||||||
? data.documents.map((doc) => ({
|
? data?.attachments?.map((doc) => ({
|
||||||
fileName: doc.fileName,
|
fileName: doc.fileName,
|
||||||
base64Data: null,
|
base64Data: null,
|
||||||
contentType: doc.contentType,
|
contentType: doc.contentType,
|
||||||
documentId: doc.documentId,
|
documentId: doc.id,
|
||||||
fileSize: 0,
|
fileSize: 0,
|
||||||
description: "",
|
description: "",
|
||||||
preSignedUrl: doc.preSignedUrl,
|
preSignedUrl: doc.preSignedUrl,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
} from "../../utils/constants";
|
} from "../../utils/constants";
|
||||||
import {
|
import {
|
||||||
formatCurrency,
|
formatCurrency,
|
||||||
|
formatFigure,
|
||||||
getColorNameFromHex,
|
getColorNameFromHex,
|
||||||
useDebounce,
|
useDebounce,
|
||||||
} from "../../utils/appUtils";
|
} from "../../utils/appUtils";
|
||||||
@ -131,7 +132,7 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => {
|
|||||||
align: "text-start",
|
align: "text-start",
|
||||||
getValue: (e) => (
|
getValue: (e) => (
|
||||||
<>
|
<>
|
||||||
{formatCurrency(e?.amount)} {e.currency.currencyCode}
|
{formatFigure(e?.amount,{type:"currency",currency : e?.currency?.currencyCode})}
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ import {
|
|||||||
PaymentRequestActionScheam,
|
PaymentRequestActionScheam,
|
||||||
} from "./PaymentRequestSchema";
|
} from "./PaymentRequestSchema";
|
||||||
import PaymentStatusLogs from "./PaymentStatusLogs";
|
import PaymentStatusLogs from "./PaymentStatusLogs";
|
||||||
|
import { FilelistView } from "../Expenses/Filelist";
|
||||||
|
|
||||||
const ViewPaymentRequest = ({ requestId }) => {
|
const ViewPaymentRequest = ({ requestId }) => {
|
||||||
const { data, isLoading, isError, error, isFetching } =
|
const { data, isLoading, isError, error, isFetching } =
|
||||||
@ -299,13 +300,13 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
<label className="fw-semibold form-label">Description : </label>
|
<label className="fw-semibold form-label">Description : </label>
|
||||||
<div className="text-muted">{data?.description}</div>
|
<div className="text-muted">{data?.description}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-12 text-start">
|
<div className="col-12 text-start mb-2">
|
||||||
<label className="form-label me-2 mb-2 fw-semibold">
|
<label className="form-label me-2 mb-1 fw-semibold">
|
||||||
Attachment :
|
Attachment :
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="d-flex flex-wrap gap-2">
|
<div className="d-flex flex-wrap gap-2">
|
||||||
{data?.attachments?.length > 0 ? (
|
{/* {data?.attachments?.length > 0 ? (
|
||||||
data?.attachments?.map((doc) => {
|
data?.attachments?.map((doc) => {
|
||||||
const isImage = doc?.contentType?.includes("image");
|
const isImage = doc?.contentType?.includes("image");
|
||||||
|
|
||||||
@ -341,7 +342,10 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<p className="m-0">No Attachment</p>
|
<p className="m-0">No Attachment</p>
|
||||||
)}
|
)} */}
|
||||||
|
{data?.attachments?.length > 0 ? (
|
||||||
|
<FilelistView files={data?.attachments}/>
|
||||||
|
):(<p className="m-0 text-secondary">No Attachment</p>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -471,7 +475,7 @@ const ViewPaymentRequest = ({ requestId }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className=" col-sm-12 my-2 my-md-0 border-top border-md-none col-md-5">
|
<div className=" col-sm-12 my-2 my-md-0 border-top border-md-none col-md-5">
|
||||||
<div className="d-flex my-2">
|
<div className="d-flex mb-2">
|
||||||
<i className="bx bx-time-five me-2 "></i>{" "}
|
<i className="bx bx-time-five me-2 "></i>{" "}
|
||||||
<p className="fw-medium">TimeLine</p>
|
<p className="fw-medium">TimeLine</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export function localToUtc(dateString) {
|
|||||||
export const formatCurrency = (amount, currency = "INR", locale = "en-US") => {
|
export const formatCurrency = (amount, currency = "INR", locale = "en-US") => {
|
||||||
return new Intl.NumberFormat(locale, {
|
return new Intl.NumberFormat(locale, {
|
||||||
style: "currency",
|
style: "currency",
|
||||||
notation: "compact",
|
notation: "compact", // standard or compact
|
||||||
compactDisplay: "short",
|
compactDisplay: "short",
|
||||||
currency: currency,
|
currency: currency,
|
||||||
minimumFractionDigits: 0,
|
minimumFractionDigits: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user