Adding Status and UI implementation in Collection.
This commit is contained in:
parent
a3be63b74f
commit
7773b7a43b
@ -40,7 +40,6 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => {
|
|||||||
);
|
);
|
||||||
const { setProcessedPayment, setAddPayment, setViewCollection } =
|
const { setProcessedPayment, setAddPayment, setViewCollection } =
|
||||||
useCollectionContext();
|
useCollectionContext();
|
||||||
|
|
||||||
const paginate = (page) => {
|
const paginate = (page) => {
|
||||||
if (page >= 1 && page <= (data?.totalPages ?? 1)) {
|
if (page >= 1 && page <= (data?.totalPages ?? 1)) {
|
||||||
setCurrentPage(page);
|
setCurrentPage(page);
|
||||||
@ -129,6 +128,16 @@ const CollectionList = ({ fromDate, toDate, isPending, searchString }) => {
|
|||||||
),
|
),
|
||||||
align: "text-end",
|
align: "text-end",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "status",
|
||||||
|
label: "Status",
|
||||||
|
getValue: (col) => (
|
||||||
|
<span className={`badge bg-label-${col?.isActive ? "primary" : "danger"}`}>
|
||||||
|
{col?.isActive ? "Active" : "Inactive"}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
align: "text-center",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "balance",
|
key: "balance",
|
||||||
label: "Balance",
|
label: "Balance",
|
||||||
|
|||||||
@ -25,7 +25,6 @@ const ViewCollection = ({ onClose }) => {
|
|||||||
|
|
||||||
if (isLoading) return <CollectionDetailsSkeleton />;
|
if (isLoading) return <CollectionDetailsSkeleton />;
|
||||||
if (isError) return <div>{error.message}</div>;
|
if (isError) return <div>{error.message}</div>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container p-3">
|
<div className="container p-3">
|
||||||
<p className="fs-5 fw-semibold">Collection Details</p>
|
<p className="fs-5 fw-semibold">Collection Details</p>
|
||||||
@ -43,8 +42,7 @@ const ViewCollection = ({ onClose }) => {
|
|||||||
<div>
|
<div>
|
||||||
{" "}
|
{" "}
|
||||||
<span
|
<span
|
||||||
className={`badge bg-label-${
|
className={`badge bg-label-${data?.isActive ? "primary" : "danger"
|
||||||
data?.isActive ? "primary" : "danger"
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{data?.isActive ? "Active" : "Inactive"}
|
{data?.isActive ? "Active" : "Inactive"}
|
||||||
@ -214,8 +212,7 @@ const ViewCollection = ({ onClose }) => {
|
|||||||
<ul className="nav nav-tabs" role="tablist">
|
<ul className="nav nav-tabs" role="tablist">
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<button
|
<button
|
||||||
className={`nav-link ${
|
className={`nav-link ${activeTab === "payments" ? "active" : ""
|
||||||
activeTab === "payments" ? "active" : ""
|
|
||||||
}`}
|
}`}
|
||||||
onClick={() => setActiveTab("payments")}
|
onClick={() => setActiveTab("payments")}
|
||||||
type="button"
|
type="button"
|
||||||
@ -225,8 +222,7 @@ const ViewCollection = ({ onClose }) => {
|
|||||||
</li>
|
</li>
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<button
|
<button
|
||||||
className={`nav-link ${
|
className={`nav-link ${activeTab === "details" ? "active" : ""
|
||||||
activeTab === "details" ? "active" : ""
|
|
||||||
}`}
|
}`}
|
||||||
onClick={() => setActiveTab("details")}
|
onClick={() => setActiveTab("details")}
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@ -118,32 +118,33 @@ const CollectionPage = () => {
|
|||||||
<div className="card my-3 py-2 px-sm-4 px-2">
|
<div className="card my-3 py-2 px-sm-4 px-2">
|
||||||
<div className="row align-items-center mx-0">
|
<div className="row align-items-center mx-0">
|
||||||
{/* Left side: Date Picker + Show Pending (stacked on mobile) */}
|
{/* Left side: Date Picker + Show Pending (stacked on mobile) */}
|
||||||
<div className="col-12 col-md-6 d-flex flex-column flex-md-row flex-wrap align-items-start align-md-items-center gap-2 gap-md-3 mb-3 mb-md-0">
|
<div className="col-12 col-md-6 d-flex flex-column flex-md-row flex-wrap align-items-start">
|
||||||
<FormProvider {...methods}>
|
<div className="d-inline-flex border rounded-pill overflow-hidden shadow-none">
|
||||||
<DateRangePicker1 howManyDay={180} startField="fromDate"
|
<button
|
||||||
endField="toDate" />
|
type="button"
|
||||||
</FormProvider>
|
className={`btn px-2 py-1 rounded-0 text-tiny ${!showPending ? "btn-primary text-white" : ""
|
||||||
|
}`}
|
||||||
<div className="form-check form-switch d-flex align-items-center mt-1">
|
onClick={() => setShowPending(false)}
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
className="form-check-input"
|
|
||||||
role="switch"
|
|
||||||
id="inactiveEmployeesCheckbox"
|
|
||||||
checked={showPending}
|
|
||||||
onChange={(e) => setShowPending(e.target.checked)}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="form-check-label ms-2"
|
|
||||||
htmlFor="inactiveEmployeesCheckbox"
|
|
||||||
>
|
>
|
||||||
Show Completed Collections
|
All
|
||||||
</label>
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`btn px-2 py-1 rounded-0 text-tiny ${showPending ? "btn-primary text-white" : ""
|
||||||
|
}`}
|
||||||
|
onClick={() => setShowPending(true)}
|
||||||
|
>
|
||||||
|
Pending
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right side: Search + Add Button */}
|
{/* Right side: Search + Add Button */}
|
||||||
<div className="col-12 col-sm-6 d-flex justify-content-end align-items-center gap-2">
|
<div className="col-12 col-sm-6 d-flex justify-content-end align-items-center gap-2">
|
||||||
|
<FormProvider {...methods}>
|
||||||
|
<DateRangePicker1 howManyDay={180} startField="fromDate"
|
||||||
|
endField="toDate" />
|
||||||
|
</FormProvider>
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
value={searchText}
|
value={searchText}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user