diff --git a/src/components/Employee/ManageRole.jsx b/src/components/Employee/ManageRole.jsx index 98cf3813..d94907a5 100644 --- a/src/components/Employee/ManageRole.jsx +++ b/src/components/Employee/ManageRole.jsx @@ -14,8 +14,7 @@ const formSchema = z.object({ selectedRole: z.record(z.boolean()), }); -const ManageRole = ( {employeeId, onClosed} ) => -{ +const ManageRole = ({ employeeId, onClosed }) => { const dispatch = useDispatch(); const formStateRef = useRef({}); @@ -38,7 +37,7 @@ const ManageRole = ( {employeeId, onClosed} ) => }); const { updateRoles, - isPending : isLoading, + isPending: isLoading, isError, error, } = useUpdateEmployeeRoles({ @@ -112,56 +111,57 @@ const ManageRole = ( {employeeId, onClosed} ) => const isLoadingData = roleLoading || empLoading; return ( -
-
-
Select Roles :
-
+ +
+
Select Roles :
+
- {isLoadingData ? ( -

Loading...

- ) : ( -
- {roles.map((role) => ( -
-
- - -
-
- ))} + {isLoadingData ? ( +

Loading...

+ ) : ( +
+ {roles.slice() + .sort((a, b) => a.role.localeCompare(b.role)).map((role) => ( +
+
+ +
- )} - - {errors.selectedRole && ( -
- {errors.selectedRole.message} -
- )} - -
- -
- + ))} +
+ )} + + {errors.selectedRole && ( +
+ {errors.selectedRole.message} +
+ )} + +
+ + +
+ ); }; diff --git a/src/components/Expenses/ViewExpense.jsx b/src/components/Expenses/ViewExpense.jsx index 6264e471..d6bb87e7 100644 --- a/src/components/Expenses/ViewExpense.jsx +++ b/src/components/Expenses/ViewExpense.jsx @@ -386,7 +386,7 @@ const ViewExpense = ({ ExpenseId }) => { )}
)} -
+ {/*
*/} {Array.isArray(data?.nextStatus) && data.nextStatus.length > 0 && ( <> @@ -526,7 +526,7 @@ const ViewExpense = ({ ExpenseId }) => {
-
+
{" "}

TimeLine

diff --git a/src/components/PaymentRequest/PaymentRequestList.jsx b/src/components/PaymentRequest/PaymentRequestList.jsx index 8df4c3d9..241662be 100644 --- a/src/components/PaymentRequest/PaymentRequestList.jsx +++ b/src/components/PaymentRequest/PaymentRequestList.jsx @@ -253,7 +253,7 @@ const PaymentRequestList = ({ filters, groupBy = "submittedBy", search }) => {
{" "} - + {displayField} :{" "} {" "} diff --git a/src/components/PaymentRequest/ViewPaymentRequest.jsx b/src/components/PaymentRequest/ViewPaymentRequest.jsx index 8c65c219..612af4af 100644 --- a/src/components/PaymentRequest/ViewPaymentRequest.jsx +++ b/src/components/PaymentRequest/ViewPaymentRequest.jsx @@ -411,7 +411,7 @@ const ViewPaymentRequest = ({ requestId }) => {
- { - const { setManageRequest, setVieRequest , setViewRecurring} = useRecurringExpenseContext(); + const { setManageRequest, setVieRequest, setViewRecurring } = useRecurringExpenseContext(); const navigate = useNavigate(); const [IsDeleteModalOpen, setIsDeleteModalOpen,] = useState(false); const [deletingId, setDeletingId] = useState(null); @@ -25,6 +26,13 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { (store) => store?.globalVariables?.loginUser?.employeeInfo?.id ); + const statusColorMap = { + "da462422-13b2-45cc-a175-910a225f6fc8": "primary", // Active + "306856fb-5655-42eb-bf8b-808bb5e84725": "success", // Completed + "3ec864d2-8bf5-42fb-ba70-5090301dd816": "danger", // De-Activated + "8bfc9346-e092-4a80-acbf-515ae1ef6868": "warning", // Paused + }; + const recurringExpenseColumns = [ { key: "expenseCategory", @@ -72,8 +80,18 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { { key: "status", label: "Status", - align: "text-start", - getValue: (e) => e?.status?.name || "N/A", + align: "text-center", + getValue: (e) => { + const color = statusColorMap[e?.status?.id] || "secondary"; + const label = PAYEE_RECURRING_EXPENSE.find( + (s) => s.id === e?.status?.id + )?.label; + return ( + + {label || e?.status?.name || "N/A"} + + ); + }, }, ]; @@ -192,10 +210,10 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { - setViewRecurring({ - recurringId: recurringExpense?.id, - view: true, - }) + setViewRecurring({ + recurringId: recurringExpense?.id, + view: true, + }) } > @@ -261,9 +279,8 @@ const RecurringExpenseList = ({ search, filterStatuses }) => { {[...Array(totalPages)].map((_, index) => (
  • + +
    + -
    - - )} + {/* Mark Payment */} + {isAdmin && ( +
  • + + setProcessedPayment({ + isOpen: true, + invoiceId: row.id, + }) + } + > + + Mark Payment + +
  • + )} + + )} + +
    + + )} )) ) : ( diff --git a/src/components/collections/ManageCollection.jsx b/src/components/collections/ManageCollection.jsx index 68667d61..71d33517 100644 --- a/src/components/collections/ManageCollection.jsx +++ b/src/components/collections/ManageCollection.jsx @@ -227,7 +227,7 @@ const ManageCollection = ({ collectionId, onClose }) => {
    - {
    - {
    - { return (

    Collection Details

    -
    + +
    + + {/* Row 0: Balance Amount + Expected Payment Date */} +
    + {/* Balance Amount */} +
    +
    Balance Amount :
    +
    + {formatFigure(data?.balanceAmount, { + type: "currency", + currency: "INR", + })} +
    +
    + + {/* Expected Payment Date */} +
    +
    Expected Payment Date :
    +
    + {formatUTCToLocalTime(data?.exceptedPaymentDate)} +
    +
    +
    + + + {/* Project and Status */}
    {data?.project?.name}
    - {" "} - {data?.isActive ? "Active" : "Inactive"} + {data?.markAsCompleted ? "Active" : "Inactive"} {(isAdmin || canEditCollection) && - !data?.receivedInvoicePayments && ( + !data?.receivedInvoicePayments && + !data?.markAsCompleted && ( )}
    + + {/* Title */}
    -
    +
    Title :
    {data?.title}
    + + {/* Invoice Number */}
    Invoice Number:
    {data?.invoiceNumber}
    - {/* Row 2: E-Invoice Number + Project */} + + {/* E-Invoice Number */}
    E-Invoice Number:
    @@ -77,15 +106,15 @@ const ViewCollection = ({ onClose }) => {
    - {/* Row 3: Invoice Date + Client Submitted Date */} + {/* Invoice Date */}
    Invoice Date:
    -
    - {formatUTCToLocalTime(data?.invoiceDate)} -
    +
    {formatUTCToLocalTime(data?.invoiceDate)}
    + + {/* Client Submitted Date */}
    Client Submission Date:
    @@ -94,17 +123,8 @@ const ViewCollection = ({ onClose }) => {
    - {/* Row 4: Expected Payment Date + Mark as Completed */} -
    -
    -
    Expected Payment Date:
    -
    - {formatUTCToLocalTime(data?.exceptedPaymentDate)} -
    -
    -
    - {/* Row 5: Basic Amount + Tax Amount */} + {/* Basic Amount */}
    Basic Amount :
    @@ -116,6 +136,8 @@ const ViewCollection = ({ onClose }) => {
    + + {/* Tax Amount */}
    Tax Amount :
    @@ -127,25 +149,16 @@ const ViewCollection = ({ onClose }) => {
    - {/* Row 6: Balance Amount + Created At */} -
    -
    -
    Balance Amount :
    -
    - {formatFigure(data?.balanceAmount, { - type: "currency", - currency: "INR", - })} -
    -
    -
    + + {/* Created At */}
    Created At :
    {formatUTCToLocalTime(data?.createdAt)}
    - {/* Row 7: Created By */} + + {/* Created By */}
    Created By :
    @@ -161,23 +174,23 @@ const ViewCollection = ({ onClose }) => {
    + {/* Description */}
    -
    Description :
    +
    Description :
    {data?.description}
    + {/* Attachments */}
    - - +
    {data?.attachments?.map((doc) => { const isImage = doc.contentType?.includes("image"); - return (
    {
    -
    - {/* Tabs Navigation */} + {/* Tabs Section */} +
    - {/* Tab Content */}
    {activeTab === "payments" && (
    @@ -252,6 +260,7 @@ const ViewCollection = ({ onClose }) => {
    + ); }; diff --git a/src/components/common/DateRangePicker.jsx b/src/components/common/DateRangePicker.jsx index b8dde3bd..ff293bde 100644 --- a/src/components/common/DateRangePicker.jsx +++ b/src/components/common/DateRangePicker.jsx @@ -178,7 +178,7 @@ export const DateRangePicker1 = ({
    { diff --git a/src/hooks/useCollections.jsx b/src/hooks/useCollections.jsx index c300462d..119f465b 100644 --- a/src/hooks/useCollections.jsx +++ b/src/hooks/useCollections.jsx @@ -84,6 +84,7 @@ export const useMarkedPaymentReceived = (onSuccessCallBack) => { await CollectionRepository.markPaymentReceived(payload), onSuccess: async () => { client.invalidateQueries({ queryKey: ["collections"] }); + client.invalidateQueries({ queryKey: ["collection"] }); showToast("Payment Received marked Successfully", "success"); if (onSuccessCallBack) onSuccessCallBack(); }, diff --git a/src/pages/PaymentRequest/PaymentRequestPage.jsx b/src/pages/PaymentRequest/PaymentRequestPage.jsx index f4c8bb55..f530f5b0 100644 --- a/src/pages/PaymentRequest/PaymentRequestPage.jsx +++ b/src/pages/PaymentRequest/PaymentRequestPage.jsx @@ -73,13 +73,13 @@ const PaymentRequestPage = () => { {/* Top Bar */}
    -
    +
    setSearch(e.target.value)} /> diff --git a/src/pages/RecurringExpense/RecurringExpensePage.jsx b/src/pages/RecurringExpense/RecurringExpensePage.jsx index 02121b04..61e935f4 100644 --- a/src/pages/RecurringExpense/RecurringExpensePage.jsx +++ b/src/pages/RecurringExpense/RecurringExpensePage.jsx @@ -47,7 +47,7 @@ const RecurringExpensePage = () => {
    {/* Breadcrumb */} { {/* Top Bar */}
    -
    - {/* Left side: Search + Filter */} -
    - setSearch(e.target.value)} - /> +
    + {/* Left Column: Search + Filter */} +
    +
    + setSearch(e.target.value)} + /> -
    - -
      - {PAYEE_RECURRING_EXPENSE.map(({ id, label }) => ( -
    • -
      - handleStatusChange(id)} - /> - -
      -
    • - ))} -
    +
    + +
      + {PAYEE_RECURRING_EXPENSE.map(({ id, label }) => ( +
    • +
      + handleStatusChange(id)} + /> + +
      +
    • + ))} +
    +
    - {/* Right side: Add Button */} -
    + {/* Right Column: Add Button */} +
    +
    @@ -135,7 +138,7 @@ const RecurringExpensePage = () => { /> )} - {viewRecurring.view && ( + {viewRecurring.view && ( { } recurringId={viewRecurring.recurringId} /> - + )} diff --git a/src/pages/collections/CollectionPage.jsx b/src/pages/collections/CollectionPage.jsx index aac80d26..c5eb0ea2 100644 --- a/src/pages/collections/CollectionPage.jsx +++ b/src/pages/collections/CollectionPage.jsx @@ -82,18 +82,18 @@ const CollectionPage = () => { const handleMarkedPayment = (payload) => { MarkedReceived(payload); }; - if (isAdmin === undefined || - canAddPayment === undefined || - canEditCollection === undefined || - canViewCollection === undefined || + if (isAdmin === undefined || + canAddPayment === undefined || + canEditCollection === undefined || + canViewCollection === undefined || canCreate === undefined -) { - return
    Checking access...
    ; -} + ) { + return
    Checking access...
    ; + } -if (!isAdmin && !canAddPayment && !canEditCollection && !canViewCollection && !canCreate) { - return ; -} + if (!isAdmin && !canAddPayment && !canEditCollection && !canViewCollection && !canCreate) { + return ; + } return (
    @@ -101,15 +101,15 @@ if (!isAdmin && !canAddPayment && !canEditCollection && !canViewCollection && !c data={[{ label: "Home", link: "/" }, { label: "Collection" }]} /> -
    -
    -
    +
    +
    + {/* Left side: Date Picker + Show Pending */} +
    -
    -
    -
    + +
    setShowPending(e.target.checked)} />
    -
    -
    - {" "} + {/* Right side: Search + Add Button */} +
    +
    setSearchText(e.target.value)} - placeholder="search Collection" + placeholder="Search Collection" className="form-control form-control-sm" />
    - { (canCreate || isAdmin) && ( - -)} + {(canCreate || isAdmin) && ()}
    + handleMarkedPayment(processedPayment?.invoiceId)}