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