added new column proform amount
This commit is contained in:
parent
8a3228c0c1
commit
2392a96eb8
@ -49,6 +49,17 @@ export const PurchaseColumn = [
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "proformaInvoiceAmount",
|
||||||
|
label: "Proforma Amount",
|
||||||
|
className: "text-end",
|
||||||
|
render: (item) => (
|
||||||
|
<span>
|
||||||
|
{formatFigure(item?.proformaInvoiceAmount, { type: "currency" })}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
key: "totalAmount",
|
key: "totalAmount",
|
||||||
label: "Total Amount",
|
label: "Total Amount",
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import { usePurchase } from "../../hooks/usePurchase";
|
import { usePurchase } from "../../hooks/usePurchase";
|
||||||
import { SpinnerLoader } from "../common/Loader";
|
import { SpinnerLoader } from "../common/Loader";
|
||||||
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||||
import { getColorNameFromHex } from "../../utils/appUtils";
|
import { formatFigure, getColorNameFromHex } from "../../utils/appUtils";
|
||||||
|
|
||||||
const ViewPurchase = ({ purchaseId }) => {
|
const ViewPurchase = ({ purchaseId }) => {
|
||||||
const { data, isLoading, isError, error } = usePurchase(purchaseId);
|
const { data, isLoading, isError, error } = usePurchase(purchaseId);
|
||||||
@ -25,11 +25,14 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
|
|
||||||
<div className="col-md-2 d-flex align-items-center">
|
<div className="col-md-2 d-flex align-items-center">
|
||||||
<p className="fw-light me-2 mb-0"></p>
|
<p className="fw-light me-2 mb-0"></p>
|
||||||
<span className={`badge rounded-pill bg-label-${getColorNameFromHex(data?.status?.color)}`}>
|
<span
|
||||||
|
className={`badge rounded-pill bg-label-${getColorNameFromHex(
|
||||||
|
data?.status?.color
|
||||||
|
)}`}
|
||||||
|
>
|
||||||
{data?.status?.displayName || "NA"}
|
{data?.status?.displayName || "NA"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -38,11 +41,15 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
<p className="fw-semibold mb-3">Purchase Details</p>
|
<p className="fw-semibold mb-3">Purchase Details</p>
|
||||||
<div className="row mb-3">
|
<div className="row mb-3">
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-captions bx-sm me-1'></i>Title:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-captions bx-sm me-1"></i>Title:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-1">{data?.title}</p>
|
<p className="fw-light mb-1">{data?.title}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-comment-detail bx-sm me-1'></i>Description:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-comment-detail bx-sm me-1"></i>Description:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-1 ">{data?.description}</p>
|
<p className="fw-light mb-1 ">{data?.description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -56,68 +63,87 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
<div className="row text-start h-auto">
|
<div className="row text-start h-auto">
|
||||||
{/* Project Name */}
|
{/* Project Name */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-captions bx-sm me-1'></i>Project Name:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-captions bx-sm me-1"></i>Project Name:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.project?.name}</p>
|
<p className="fw-light mb-0">{data?.project?.name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Organization Name */}
|
{/* Organization Name */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bxs-component bx-sm me-1'></i>Organization:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bxs-component bx-sm me-1"></i>Organization:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.organization?.name}</p>
|
<p className="fw-light mb-0">{data?.organization?.name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Email */}
|
{/* Email */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-envelope me-1 bx-sm'></i>Email:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-envelope me-1 bx-sm"></i>Email:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.organization?.email}</p>
|
<p className="fw-light mb-0">{data?.organization?.email}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Contact Number */}
|
{/* Contact Number */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bxs-contact bx-sm me-1' ></i>Contact:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bxs-contact bx-sm me-1"></i>Contact:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.organization?.contactNumber}</p>
|
<p className="fw-light mb-0">{data?.organization?.contactNumber}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Address */}
|
{/* Address */}
|
||||||
<div className="col-12 mb-3">
|
<div className="col-12 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-message-square-detail bx-sm me-1'></i>Address:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-message-square-detail bx-sm me-1"></i>Address:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.organization?.address}</p>
|
<p className="fw-light mb-0">{data?.organization?.address}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div className="col-12 border-bottom">
|
<div className="col-12 border-bottom">
|
||||||
<div className="row text-start h-auto">
|
<div className="row text-start h-auto">
|
||||||
<p className="text-muted mb-2 fw-semibold">Supplier</p>
|
<p className="text-muted mb-2 fw-semibold">Supplier</p>
|
||||||
|
|
||||||
{/* Supplier Name */}
|
{/* Supplier Name */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-captions bx-sm me-1'></i>Name:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-captions bx-sm me-1"></i>Name:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.supplier?.name}</p>
|
<p className="fw-light mb-0">{data?.supplier?.name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Contact Person */}
|
{/* Contact Person */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-support bx-sm me-1'></i>Contact Person:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-support bx-sm me-1"></i>Contact Person:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.supplier?.contactPerson}</p>
|
<p className="fw-light mb-0">{data?.supplier?.contactPerson}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Email */}
|
{/* Email */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-envelope me-1 bx-sm'></i>Email:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-envelope me-1 bx-sm"></i>Email:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.supplier?.email}</p>
|
<p className="fw-light mb-0">{data?.supplier?.email}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Contact Number */}
|
{/* Contact Number */}
|
||||||
<div className="col-12 col-md-4 mb-3">
|
<div className="col-12 col-md-4 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bxs-contact bx-sm me-1' ></i>Contact:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bxs-contact bx-sm me-1"></i>Contact:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.supplier?.contactNumber}</p>
|
<p className="fw-light mb-0">{data?.supplier?.contactNumber}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Address */}
|
{/* Address */}
|
||||||
<div className="col-12 mb-3">
|
<div className="col-12 mb-3">
|
||||||
<p className="text-secondary mb-0"><i className='bx bx-message-square-detail bx-sm me-1'></i>Address:</p>
|
<p className="text-secondary mb-0">
|
||||||
|
<i className="bx bx-message-square-detail bx-sm me-1"></i>Address:
|
||||||
|
</p>
|
||||||
<p className="fw-light mb-0">{data?.supplier?.address}</p>
|
<p className="fw-light mb-0">{data?.supplier?.address}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -132,22 +158,26 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
<div className="col-12 col-sm-6">
|
<div className="col-12 col-sm-6">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">Invoice No:</p>
|
<p className="text-secondary mb-0">Invoice No:</p>
|
||||||
<p className="fw-light mb-1">{data?.invoiceNumber}</p>
|
<p className="fw-light mb-1">{data?.invoiceNumber ?? "NA"}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">Proforma No:</p>
|
<p className="text-secondary mb-0">Proforma No:</p>
|
||||||
<p className="fw-light mb-1">{data?.proformaInvoiceNumber}</p>
|
<p className="fw-light mb-1">
|
||||||
|
{data?.proformaInvoiceNumber ?? "NA"}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">E-Way Bill:</p>
|
<p className="text-secondary mb-0">E-Way Bill:</p>
|
||||||
<p className="fw-light mb-1">{data?.eWayBillNumber}</p>
|
<p className="fw-light mb-1">{data?.eWayBillNumber ?? "NA"}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">PO No:</p>
|
<p className="text-secondary mb-0">PO No:</p>
|
||||||
<p className="fw-light mb-1">{data?.purchaseOrderNumber}</p>
|
<p className="fw-light mb-1">
|
||||||
|
{data?.purchaseOrderNumber ?? "NA"}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -156,28 +186,36 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0 ">Invoice Date:</p>
|
<p className="text-secondary mb-0 ">Invoice Date:</p>
|
||||||
<p className="fw-light mb-1">
|
<p className="fw-light mb-1">
|
||||||
{formatUTCToLocalTime(data?.invoiceDate)}
|
{data?.invoiceDate
|
||||||
|
? formatUTCToLocalTime(data?.invoiceDate)
|
||||||
|
: "NA"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">Proforma Date:</p>
|
<p className="text-secondary mb-0">Proforma Date:</p>
|
||||||
<p className="fw-light mb-1">
|
<p className="fw-light mb-1">
|
||||||
{formatUTCToLocalTime(data?.proformaInvoiceDate)}
|
{data?.proformaInvoiceDate
|
||||||
|
? formatUTCToLocalTime(data?.proformaInvoiceDate)
|
||||||
|
: "NA"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">E-Way Date:</p>
|
<p className="text-secondary mb-0">E-Way Date:</p>
|
||||||
<p className="fw-light mb-1">
|
<p className="fw-light mb-1">
|
||||||
{formatUTCToLocalTime(data?.eWayBillDate)}
|
{data?.eWayBillDate
|
||||||
|
? formatUTCToLocalTime(data?.eWayBillDate)
|
||||||
|
: "NA"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-secondary mb-0">PO Date:</p>
|
<p className="text-secondary mb-0">PO Date:</p>
|
||||||
<p className="fw-light">
|
<p className="fw-light">
|
||||||
{formatUTCToLocalTime(data?.purchaseOrderDate)}
|
{data?.purchaseOrderDate
|
||||||
|
? formatUTCToLocalTime(data?.purchaseOrderDate)
|
||||||
|
: "NA"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -189,26 +227,55 @@ const ViewPurchase = ({ purchaseId }) => {
|
|||||||
<div className="text-start h-auto">
|
<div className="text-start h-auto">
|
||||||
<p className="text-muted mb-2 fw-semibold">Amount Summary</p>
|
<p className="text-muted mb-2 fw-semibold">Amount Summary</p>
|
||||||
|
|
||||||
|
<div className="d-flex justify-content-between">
|
||||||
|
<p className="text-secondary mb-0">Proforma Amount</p>
|
||||||
|
<p className="fw-light mb-1">
|
||||||
|
{formatFigure(data?.proformaInvoiceAmount, {
|
||||||
|
type: "currency",
|
||||||
|
currency: "INR",
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div className="d-flex justify-content-between">
|
<div className="d-flex justify-content-between">
|
||||||
<p className="text-secondary mb-0">Base Amount</p>
|
<p className="text-secondary mb-0">Base Amount</p>
|
||||||
<p className="fw-light mb-1">₹ {data?.baseAmount}</p>
|
<p className="fw-light mb-1">
|
||||||
|
{formatFigure(data?.baseAmount, {
|
||||||
|
type: "currency",
|
||||||
|
currency: "INR",
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="d-flex justify-content-between">
|
<div className="d-flex justify-content-between">
|
||||||
<p className="text-secondary mb-0">Tax</p>
|
<p className="text-secondary mb-0">Tax</p>
|
||||||
<p className="fw-light mb-1">₹ {data?.taxAmount}</p>
|
<p className="fw-light mb-1">
|
||||||
|
{formatFigure(data?.taxAmount, {
|
||||||
|
type: "currency",
|
||||||
|
currency: "INR",
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="d-flex justify-content-between">
|
<div className="d-flex justify-content-between">
|
||||||
<p className="text-secondary mb-0">Transport</p>
|
<p className="text-secondary mb-0">Transport</p>
|
||||||
<p className="fw-light mb-1">₹ {data?.transportCharges}</p>
|
<p className="fw-light mb-1">
|
||||||
|
{formatFigure(data?.transportCharges, {
|
||||||
|
type: "currency",
|
||||||
|
currency: "INR",
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr className="my-2" />
|
<hr className="my-2" />
|
||||||
|
|
||||||
<div className="d-flex justify-content-between fs-6 fs-medium">
|
<div className="d-flex justify-content-between fs-6 fs-medium">
|
||||||
<span>Total</span>
|
<span>Total</span>
|
||||||
<span>₹ {data?.totalAmount}</span>
|
<span>
|
||||||
|
{formatFigure(data?.totalAmount, {
|
||||||
|
type: "currency",
|
||||||
|
currency: "INR",
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
|||||||
@ -137,7 +137,7 @@ export const formatFigure = (
|
|||||||
maximumFractionDigits = 2,
|
maximumFractionDigits = 2,
|
||||||
} = {}
|
} = {}
|
||||||
) => {
|
) => {
|
||||||
if (amount == null || isNaN(amount)) return "-";
|
if (amount == null || isNaN(amount)) return "--";
|
||||||
|
|
||||||
const formatterOptions = {
|
const formatterOptions = {
|
||||||
style:
|
style:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user