mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
Merge branch 'development' into fix/expense-report-filter
This commit is contained in:
@@ -279,8 +279,6 @@ const ExpenseRequestContent = ({
|
||||
)}
|
||||
|
||||
<div className='w-full mt-4 flex flex-col gap-4'>
|
||||
{/* TODO: apply RBAC */}
|
||||
|
||||
<div className='w-full mx-auto flex flex-col sm:flex-row justify-end gap-2'>
|
||||
{isCurrentApprovalOnHeadArea && (
|
||||
<RequirePermission permissions='lti.expense.approve.head_area'>
|
||||
|
||||
@@ -59,8 +59,7 @@ const RowOptionsMenu = ({
|
||||
detailClickHandler: (id: number) => void;
|
||||
deleteClickHandler: () => void;
|
||||
}) => {
|
||||
// TODO: change this to real condition
|
||||
const showEditButton = true;
|
||||
const showEditButton = props.row.original.approval?.step_number !== 2;
|
||||
|
||||
const showDeleteButton = showEditButton;
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ const ReportExpenseTab = ({ tabId }: ReportExpenseTabProps) => {
|
||||
const isAnyExportLoading = isPdfExportLoading || isExcelExportLoading;
|
||||
|
||||
// ===== SUBMISSION STATE =====
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
const [filterParams, setFilterParams] = useState<FilterParams>({});
|
||||
|
||||
// ===== PAGINATION STATE =====
|
||||
@@ -117,12 +116,10 @@ const ReportExpenseTab = ({ tabId }: ReportExpenseTabProps) => {
|
||||
: undefined,
|
||||
});
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
setPage(1);
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({});
|
||||
setIsSubmitted(false);
|
||||
setPage(1);
|
||||
filterModal.closeModal();
|
||||
},
|
||||
@@ -194,27 +191,25 @@ const ReportExpenseTab = ({ tabId }: ReportExpenseTabProps) => {
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
const { data: reportExpenseResponse, isLoading } = useSWR(
|
||||
isSubmitted
|
||||
? () => {
|
||||
const params = new URLSearchParams();
|
||||
if (filterParams.location_id)
|
||||
params.append('location_id', filterParams.location_id);
|
||||
if (filterParams.supplier_id)
|
||||
params.append('supplier_id', filterParams.supplier_id);
|
||||
if (filterParams.kandang_id)
|
||||
params.append('kandang_id', filterParams.kandang_id);
|
||||
if (filterParams.nonstock_id)
|
||||
params.append('nonstock_id', filterParams.nonstock_id);
|
||||
if (filterParams.realization_date)
|
||||
params.append('realization_date', filterParams.realization_date);
|
||||
if (filterParams.category)
|
||||
params.append('category', filterParams.category);
|
||||
params.append('page', String(page));
|
||||
params.append('limit', String(pageSize));
|
||||
() => {
|
||||
const params = new URLSearchParams();
|
||||
if (filterParams.location_id)
|
||||
params.append('location_id', filterParams.location_id);
|
||||
if (filterParams.supplier_id)
|
||||
params.append('supplier_id', filterParams.supplier_id);
|
||||
if (filterParams.kandang_id)
|
||||
params.append('kandang_id', filterParams.kandang_id);
|
||||
if (filterParams.nonstock_id)
|
||||
params.append('nonstock_id', filterParams.nonstock_id);
|
||||
if (filterParams.realization_date)
|
||||
params.append('realization_date', filterParams.realization_date);
|
||||
if (filterParams.category)
|
||||
params.append('category', filterParams.category);
|
||||
params.append('page', String(page));
|
||||
params.append('limit', String(pageSize));
|
||||
|
||||
return [`${ReportExpenseApi.basePath}?${params.toString()}`];
|
||||
}
|
||||
: null,
|
||||
return [`${ReportExpenseApi.basePath}?${params.toString()}`];
|
||||
},
|
||||
([url]: string[]) => httpClient<BaseApiResponse<ReportExpense[]>>(url)
|
||||
);
|
||||
|
||||
@@ -529,25 +524,13 @@ const ReportExpenseTab = ({ tabId }: ReportExpenseTabProps) => {
|
||||
<>
|
||||
{TabActionsElement}
|
||||
<div className='w-full p-0 sm:p-3 flex flex-col gap-3'>
|
||||
{!isSubmitted ? (
|
||||
<ReportExpenseSkeleton
|
||||
columns={columns}
|
||||
icon={
|
||||
<Icon
|
||||
icon='heroicons:funnel'
|
||||
className='text-white'
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
}
|
||||
title='No Filters Selected'
|
||||
subtitle='Please choose filters to narrow down your results and make your search easier.'
|
||||
/>
|
||||
) : isLoading ? (
|
||||
{isLoading && (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
) : !data || data.length === 0 ? (
|
||||
)}
|
||||
|
||||
{!isLoading && (!data || data.length === 0) && (
|
||||
<ReportExpenseSkeleton
|
||||
columns={columns}
|
||||
icon={
|
||||
@@ -561,7 +544,9 @@ const ReportExpenseTab = ({ tabId }: ReportExpenseTabProps) => {
|
||||
title='Data Not Yet Available'
|
||||
subtitle='Please change your filters to get the data.'
|
||||
/>
|
||||
) : (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length > 0 && (
|
||||
<>
|
||||
<Table
|
||||
data={data}
|
||||
|
||||
@@ -61,7 +61,6 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
const [pageSize] = useState(10);
|
||||
|
||||
// ===== SUBMISSION STATE =====
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
const [filterParams, setFilterParams] = useState<FilterParams>({});
|
||||
const [dateErrorShown, setDateErrorShown] = useState(false);
|
||||
const [hasDateError, setHasDateError] = useState(false);
|
||||
@@ -102,13 +101,11 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
filter_by: values.filter_by || undefined,
|
||||
});
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
setCurrentPage(1);
|
||||
setSubmitting(false);
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({});
|
||||
setIsSubmitted(false);
|
||||
setCurrentPage(1);
|
||||
setHasDateError(false);
|
||||
if (dateErrorShown) {
|
||||
@@ -218,23 +215,21 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
const { data: customerPayment, isLoading } = useSWR(
|
||||
isSubmitted
|
||||
? () => {
|
||||
const params = {
|
||||
customer_ids: filterParams.customer_ids,
|
||||
filter_by: filterParams.filter_by as
|
||||
| 'trans_date'
|
||||
| 'realization_date'
|
||||
| undefined,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
page: currentPage,
|
||||
limit: pageSize,
|
||||
};
|
||||
() => {
|
||||
const params = {
|
||||
customer_ids: filterParams.customer_ids,
|
||||
filter_by: filterParams.filter_by as
|
||||
| 'trans_date'
|
||||
| 'realization_date'
|
||||
| undefined,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
page: currentPage,
|
||||
limit: pageSize,
|
||||
};
|
||||
|
||||
return ['customer-payment-report', params];
|
||||
}
|
||||
: null,
|
||||
return ['customer-payment-report', params];
|
||||
},
|
||||
([, params]) =>
|
||||
FinanceApi.getCustomerPaymentReport(
|
||||
params.customer_ids,
|
||||
@@ -700,25 +695,13 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
<>
|
||||
{TabActionsElement}
|
||||
<div className='w-full p-0 sm:p-3 flex flex-col gap-3'>
|
||||
{!isSubmitted ? (
|
||||
<CustomerSupplierSkeleton
|
||||
columns={getTableColumns({} as CustomerPaymentSummary)}
|
||||
icon={
|
||||
<Icon
|
||||
icon='heroicons:funnel'
|
||||
className='text-white'
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
}
|
||||
title='No Filters Selected'
|
||||
subtitle='Please choose filters to narrow down your results and make your search easier.'
|
||||
/>
|
||||
) : isLoading ? (
|
||||
{isLoading && (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
) : data.length === 0 ? (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length === 0 && (
|
||||
<CustomerSupplierSkeleton
|
||||
columns={getTableColumns({} as CustomerPaymentSummary)}
|
||||
icon={
|
||||
@@ -732,7 +715,10 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
title='Data Not Yet Available'
|
||||
subtitle='Please change your filters to get the data.'
|
||||
/>
|
||||
) : (
|
||||
)}
|
||||
|
||||
{!isLoading &&
|
||||
data.length > 0 &&
|
||||
data.map((customerReport) => {
|
||||
const summary = customerReport.summary || {
|
||||
total_qty: 0,
|
||||
@@ -761,7 +747,6 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
}}
|
||||
variant='bordered'
|
||||
collapsible={true}
|
||||
defaultCollapsed={true}
|
||||
>
|
||||
<Table
|
||||
data={[
|
||||
@@ -825,8 +810,7 @@ const CustomerPaymentTab = ({ tabId }: CustomerPaymentTabProps) => {
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
})
|
||||
)}
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Filter Modal */}
|
||||
|
||||
@@ -85,7 +85,6 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
supplier_ids: undefined,
|
||||
filter_by: undefined,
|
||||
});
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
|
||||
// ===== DATE ERROR STATE =====
|
||||
const [dateErrorShown, setDateErrorShown] = useState(false);
|
||||
@@ -129,7 +128,7 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
filter_by: values.filterBy?.value?.toString() || undefined,
|
||||
});
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
// setIsSubmitted(true);
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({
|
||||
@@ -138,7 +137,7 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
supplier_ids: undefined,
|
||||
filter_by: undefined,
|
||||
});
|
||||
setIsSubmitted(false);
|
||||
// setIsSubmitted(false);
|
||||
filterModal.closeModal();
|
||||
},
|
||||
});
|
||||
@@ -150,18 +149,16 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
const { data: debtSupplier, isLoading } = useSWR(
|
||||
isSubmitted
|
||||
? () => {
|
||||
const params = {
|
||||
supplier_ids: filterParams.supplier_ids,
|
||||
filter_by: filterParams.filter_by,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
};
|
||||
() => {
|
||||
const params = {
|
||||
supplier_ids: filterParams.supplier_ids,
|
||||
filter_by: filterParams.filter_by,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
};
|
||||
|
||||
return ['debt-supplier-report', params];
|
||||
}
|
||||
: null,
|
||||
return ['debt-supplier-report', params];
|
||||
},
|
||||
([, params]) =>
|
||||
DebtSupplierApi.getDebtSupplierReport(
|
||||
params.supplier_ids,
|
||||
@@ -611,25 +608,13 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
<>
|
||||
{TabActionsElement}
|
||||
<div className='w-full p-0 sm:p-3 flex flex-col gap-3'>
|
||||
{!isSubmitted ? (
|
||||
<DebtSupplierSkeleton
|
||||
columns={getTableColumns()}
|
||||
icon={
|
||||
<Icon
|
||||
icon='heroicons:funnel'
|
||||
className='text-white'
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
}
|
||||
title='No Filters Selected'
|
||||
subtitle='Please choose filters to narrow down your results and make your search easier.'
|
||||
/>
|
||||
) : isLoading ? (
|
||||
{isLoading && (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
) : data.length === 0 ? (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length === 0 && (
|
||||
<DebtSupplierSkeleton
|
||||
columns={getTableColumns()}
|
||||
icon={
|
||||
@@ -643,7 +628,10 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
title='Data Not Yet Available'
|
||||
subtitle='Please change your filters to get the data.'
|
||||
/>
|
||||
) : (
|
||||
)}
|
||||
|
||||
{!isLoading &&
|
||||
data.length > 0 &&
|
||||
data.map((supplierReport) => {
|
||||
return (
|
||||
<Card
|
||||
@@ -658,7 +646,6 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
}}
|
||||
variant='bordered'
|
||||
collapsible={true}
|
||||
defaultCollapsed={true}
|
||||
>
|
||||
<Table
|
||||
data={[
|
||||
@@ -729,8 +716,7 @@ const DebtSupplierTab = ({ tabId }: DebtSupplierTabProps) => {
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
})
|
||||
)}
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Filter Modal */}
|
||||
|
||||
@@ -61,7 +61,6 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
|
||||
// ===== SUBMISSION STATE =====
|
||||
const [filterParams, setFilterParams] = useState<FilterParams>({});
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
const [dateErrorShown, setDateErrorShown] = useState(false);
|
||||
const [hasDateError, setHasDateError] = useState(false);
|
||||
|
||||
@@ -141,13 +140,11 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
sort_by: values.sort_by || undefined,
|
||||
});
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
setCurrentPage(1);
|
||||
setSubmitting(false);
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({});
|
||||
setIsSubmitted(false);
|
||||
setCurrentPage(1);
|
||||
setHasDateError(false);
|
||||
if (dateErrorShown) {
|
||||
@@ -271,24 +268,22 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
const { data: purchasePerSupplier, isLoading } = useSWR(
|
||||
isSubmitted
|
||||
? () => {
|
||||
const params = {
|
||||
area_id: filterParams.area_id,
|
||||
supplier_id: filterParams.supplier_id,
|
||||
product_id: filterParams.product_id,
|
||||
product_category_id: filterParams.product_category_id,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
sort_by: filterParams.sort_by,
|
||||
filter_by: filterParams.filter_by,
|
||||
page: currentPage,
|
||||
limit: pageSize,
|
||||
};
|
||||
() => {
|
||||
const params = {
|
||||
area_id: filterParams.area_id,
|
||||
supplier_id: filterParams.supplier_id,
|
||||
product_id: filterParams.product_id,
|
||||
product_category_id: filterParams.product_category_id,
|
||||
start_date: filterParams.start_date,
|
||||
end_date: filterParams.end_date,
|
||||
sort_by: filterParams.sort_by,
|
||||
filter_by: filterParams.filter_by,
|
||||
page: currentPage,
|
||||
limit: pageSize,
|
||||
};
|
||||
|
||||
return ['logistic-purchase-report', params];
|
||||
}
|
||||
: null,
|
||||
return ['logistic-purchase-report', params];
|
||||
},
|
||||
([, params]) =>
|
||||
LogisticApi.getLogisticPurchasePerSupplierReport(
|
||||
params.area_id,
|
||||
@@ -736,21 +731,7 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
<>
|
||||
{TabActionsElement}
|
||||
<div className='w-full p-0 sm:p-3 flex flex-col gap-3'>
|
||||
{!isSubmitted ? (
|
||||
<PurchasePerSupplierSkeleton
|
||||
columns={getTableColumns({} as LogisticPurchasePerSupplierSummary)}
|
||||
icon={
|
||||
<Icon
|
||||
icon='heroicons:funnel'
|
||||
className='text-white'
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
}
|
||||
title='No Filters Selected'
|
||||
subtitle='Please choose filters to narrow down your results and make your search easier.'
|
||||
/>
|
||||
) : isLoading ? (
|
||||
{isLoading && (
|
||||
<PurchasePerSupplierSkeleton
|
||||
columns={getTableColumns({} as LogisticPurchasePerSupplierSummary)}
|
||||
icon={
|
||||
@@ -764,7 +745,9 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
title='Memuat Data Pembelian Per Supplier'
|
||||
subtitle='Silakan tunggu sebentar...'
|
||||
/>
|
||||
) : data.length === 0 ? (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length === 0 && (
|
||||
<PurchasePerSupplierSkeleton
|
||||
columns={getTableColumns({} as LogisticPurchasePerSupplierSummary)}
|
||||
icon={
|
||||
@@ -778,7 +761,10 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
title='Data Not Yet Available'
|
||||
subtitle='Please change your filters to get the data.'
|
||||
/>
|
||||
) : (
|
||||
)}
|
||||
|
||||
{!isLoading &&
|
||||
data.length > 0 &&
|
||||
data.map((supplierReport) => {
|
||||
const summary = supplierReport.summary || {
|
||||
total_qty: 0,
|
||||
@@ -808,7 +794,6 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
}}
|
||||
variant='bordered'
|
||||
collapsible={true}
|
||||
defaultCollapsed={true}
|
||||
>
|
||||
<Table
|
||||
data={supplierReport.rows}
|
||||
@@ -837,8 +822,7 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
})
|
||||
)}
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Filter Modal */}
|
||||
|
||||
@@ -70,9 +70,6 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
const [isExcelExportLoading, setIsExcelExportLoading] = useState(false);
|
||||
const isAnyExportLoading = isPdfExportLoading || isExcelExportLoading;
|
||||
|
||||
// ===== SUBMISSION STATE =====
|
||||
const [isSubmitted, setIsSubmitted] = useState(false);
|
||||
|
||||
// ===== SEARCH STATE =====
|
||||
const [searchValue, setSearchValue] = useState<string>('');
|
||||
|
||||
@@ -144,12 +141,10 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
sort_by: values.sort_by || undefined,
|
||||
});
|
||||
filterModal.closeModal();
|
||||
setIsSubmitted(true);
|
||||
setSubmitting(false);
|
||||
},
|
||||
onReset: () => {
|
||||
setFilterParams({});
|
||||
setIsSubmitted(false);
|
||||
filterModal.closeModal();
|
||||
},
|
||||
});
|
||||
@@ -223,31 +218,28 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
|
||||
// ===== DATA FETCHING =====
|
||||
const { data: dailyMarketings, isLoading } = useSWR(
|
||||
isSubmitted
|
||||
? () => {
|
||||
const params = new URLSearchParams();
|
||||
() => {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (searchValue) params.set('search', searchValue);
|
||||
if (filterParams.area_id) params.set('area_id', filterParams.area_id);
|
||||
if (filterParams.location_id)
|
||||
params.set('location_id', filterParams.location_id);
|
||||
if (filterParams.warehouse_id)
|
||||
params.set('warehouse_id', filterParams.warehouse_id);
|
||||
if (filterParams.customer_id)
|
||||
params.set('customer_id', filterParams.customer_id);
|
||||
if (filterParams.start_date)
|
||||
params.set('start_date', filterParams.start_date);
|
||||
if (filterParams.end_date)
|
||||
params.set('end_date', filterParams.end_date);
|
||||
if (filterParams.filter_by)
|
||||
params.set('filter_by', filterParams.filter_by);
|
||||
if (filterParams.marketing_type)
|
||||
params.set('marketing_type', filterParams.marketing_type);
|
||||
if (filterParams.sort_by) params.set('sort_by', filterParams.sort_by);
|
||||
if (searchValue) params.set('search', searchValue);
|
||||
if (filterParams.area_id) params.set('area_id', filterParams.area_id);
|
||||
if (filterParams.location_id)
|
||||
params.set('location_id', filterParams.location_id);
|
||||
if (filterParams.warehouse_id)
|
||||
params.set('warehouse_id', filterParams.warehouse_id);
|
||||
if (filterParams.customer_id)
|
||||
params.set('customer_id', filterParams.customer_id);
|
||||
if (filterParams.start_date)
|
||||
params.set('start_date', filterParams.start_date);
|
||||
if (filterParams.end_date) params.set('end_date', filterParams.end_date);
|
||||
if (filterParams.filter_by)
|
||||
params.set('filter_by', filterParams.filter_by);
|
||||
if (filterParams.marketing_type)
|
||||
params.set('marketing_type', filterParams.marketing_type);
|
||||
if (filterParams.sort_by) params.set('sort_by', filterParams.sort_by);
|
||||
|
||||
return ['daily-marketing-report', params.toString()];
|
||||
}
|
||||
: null,
|
||||
return ['daily-marketing-report', params.toString()];
|
||||
},
|
||||
([, params]) =>
|
||||
MarketingReportApi.getAllDailyMarketingFetcher(
|
||||
`${MarketingReportApi.basePath}?${params}`
|
||||
@@ -660,21 +652,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
<>
|
||||
{TabActionsElement}
|
||||
<div className='w-full p-0 sm:p-3 flex flex-col gap-3'>
|
||||
{!isSubmitted ? (
|
||||
<DailyMarketingReportSkeleton
|
||||
columns={getTableColumns()}
|
||||
icon={
|
||||
<Icon
|
||||
icon='heroicons:funnel'
|
||||
className='text-white'
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
}
|
||||
title='No Filters Selected'
|
||||
subtitle='Please choose filters to narrow down your results and make your search easier.'
|
||||
/>
|
||||
) : isLoading ? (
|
||||
{isLoading && (
|
||||
<DailyMarketingReportSkeleton
|
||||
columns={getTableColumns()}
|
||||
icon={
|
||||
@@ -688,7 +666,9 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
title='Memuat Data Penjualan Harian'
|
||||
subtitle='Silakan tunggu sebentar...'
|
||||
/>
|
||||
) : data.length === 0 ? (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length === 0 && (
|
||||
<DailyMarketingReportSkeleton
|
||||
columns={getTableColumns()}
|
||||
icon={
|
||||
@@ -702,7 +682,9 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
title='Data Not Yet Available'
|
||||
subtitle='Please change your filters to get the data.'
|
||||
/>
|
||||
) : (
|
||||
)}
|
||||
|
||||
{!isLoading && data.length > 0 && (
|
||||
<Table
|
||||
data={data}
|
||||
columns={getTableColumns()}
|
||||
|
||||
@@ -791,6 +791,10 @@ const HppPerKandangTab = ({ tabId }: HppPerKandangTabProps) => {
|
||||
[data, perWeightRangeSummary]
|
||||
);
|
||||
|
||||
useEffectHook(() => {
|
||||
filterModal.openModal();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{TabActionsElement}
|
||||
|
||||
+4
@@ -631,6 +631,10 @@ const ProductionResultContent = ({ tabId }: ProductionResultTabProps) => {
|
||||
// Render the TabActions component
|
||||
const TabActionsElement = useMemo(() => <TabActions />, [TabActions]);
|
||||
|
||||
useEffect(() => {
|
||||
filterModal.openModal();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{TabActionsElement}
|
||||
|
||||
Reference in New Issue
Block a user