{formatCurrency(value)}
@@ -398,6 +401,7 @@ const DebtSupplierTab = () => {
id: 'status',
header: 'Status',
accessorKey: 'status',
+ enableSorting: false,
cell: (props) => {
const value = props.row.original.status;
return value || '-';
@@ -407,6 +411,7 @@ const DebtSupplierTab = () => {
id: 'travel_number',
header: 'Nomor Perjalanan',
accessorKey: 'travel_number',
+ enableSorting: false,
cell: (props) => {
const value = props.row.original.travel_number;
return value || '-';
@@ -421,10 +426,11 @@ const DebtSupplierTab = () => {
className={{ wrapper: 'w-full', body: 'p-1!' }}
>
-
+
{
collapsible={true}
>
0}
className={{
containerClassName: 'w-full',
@@ -493,26 +504,38 @@ const DebtSupplierTab = () => {
'px-4 py-3 text-xs text-gray-900 whitespace-nowrap',
paginationClassName: 'hidden',
}}
+ renderCustomRow={(row) => {
+ if (row.index == 0) {
+ return (
+
+ |
+
+
+ {formatCurrency(row.original.balance)}
+
+ |
+ |
+
+ );
+ }
+ }}
/>
);
})
)}
- {meta && data.length > 0 && (
-
- )}
{/* Filter Modal */}
{
modalBox: 'p-0 rounded-2xl xl:max-w-4/12 max-w-sm',
}}
>
-
@@ -614,18 +645,15 @@ const DebtSupplierTab = () => {
-
>
);
diff --git a/src/lib/formik-helper.ts b/src/lib/formik-helper.ts
index 9c457e86..17c6bc7d 100644
--- a/src/lib/formik-helper.ts
+++ b/src/lib/formik-helper.ts
@@ -1,4 +1,4 @@
-import { FormikErrors } from 'formik';
+import { FormikErrors, FormikValues } from 'formik';
export type ErrorMessage = {
key: string;
@@ -69,3 +69,66 @@ export function getUniqueFormikErrors(errors: FormikErrors): string[] {
export function getAllFormikErrors(errors: FormikErrors): ErrorMessage[] {
return parseFormikErrors(errors);
}
+
+/**
+ * Check if a value is considered "filled" (not empty)
+ * @param value - Value to check
+ * @returns True if value is filled, false otherwise
+ */
+function isValueFilled(value: unknown): boolean {
+ // Check for null or undefined
+ if (value === null || value === undefined) {
+ return false;
+ }
+
+ // Check for empty string
+ if (typeof value === 'string' && value.trim() === '') {
+ return false;
+ }
+
+ // Check for empty array
+ if (Array.isArray(value) && value.length === 0) {
+ return false;
+ }
+
+ // Check for empty object (but not Date or other special objects)
+ if (
+ typeof value === 'object' &&
+ !Array.isArray(value) &&
+ !(value instanceof Date) &&
+ Object.keys(value).length === 0
+ ) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Count the number of filled (non-empty) values in Formik values object
+ * @param values - Formik values object
+ * @returns Number of filled values
+ * @example
+ * const values = {
+ * name: 'John',
+ * email: '',
+ * age: null,
+ * tags: ['tag1', 'tag2'],
+ * emptyArray: [],
+ * };
+ * getFilledFormikValuesCount(values); // Returns 2 (name and tags)
+ */
+export function getFilledFormikValuesCount(
+ values: T
+): number {
+ let count = 0;
+
+ Object.keys(values).forEach((key) => {
+ const value = values[key];
+ if (isValueFilled(value)) {
+ count++;
+ }
+ });
+
+ return count;
+}
diff --git a/src/services/api/report/debt-supplier.ts b/src/services/api/report/debt-supplier.ts
index dad46d18..706c873e 100644
--- a/src/services/api/report/debt-supplier.ts
+++ b/src/services/api/report/debt-supplier.ts
@@ -15,9 +15,7 @@ export class DebtSupplierApiService extends BaseApiService<
supplier_ids?: string,
filter_by?: string,
start_date?: string,
- end_date?: string,
- page?: number,
- limit?: number
+ end_date?: string
): Promise | undefined> {
return await this.customRequest>(
`debt-supplier`,
@@ -28,8 +26,6 @@ export class DebtSupplierApiService extends BaseApiService<
filter_by: filter_by,
start_date: start_date,
end_date: end_date,
- page: page,
- limit: limit,
},
}
);
diff --git a/src/types/api/report/debt-supplier.d.ts b/src/types/api/report/debt-supplier.d.ts
index 46849599..c00db7df 100644
--- a/src/types/api/report/debt-supplier.d.ts
+++ b/src/types/api/report/debt-supplier.d.ts
@@ -33,3 +33,11 @@ export interface DebtRow {
travel_number: string;
balance: number;
}
+
+// Filter Param
+export interface DebtSupplierFilter {
+ start_date?: string;
+ end_date?: string;
+ supplier_ids?: string;
+ filter_by?: string;
+}