mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
refactor(FE): Disable sales and filter_by until backend ready
This commit is contained in:
@@ -177,10 +177,12 @@ interface CustomerPaymentExportPDFParams {
|
||||
data: CustomerPaymentReport[];
|
||||
params?: {
|
||||
customer_name?: string;
|
||||
sales?: string;
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales?: string;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
filter_by?: string;
|
||||
// TODO: Uncomment when BE is ready
|
||||
// filter_by?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -195,9 +197,10 @@ const getParameterText = (
|
||||
paramsText.push('Semua Customer');
|
||||
}
|
||||
|
||||
if (params?.sales) {
|
||||
paramsText.push(`Sales: ${params.sales}`);
|
||||
}
|
||||
// TODO: Uncomment when BE is ready
|
||||
// if (params?.sales) {
|
||||
// paramsText.push(`Sales: ${params.sales}`);
|
||||
// }
|
||||
|
||||
if (params?.start_date && params?.end_date) {
|
||||
const startDate = formatDate(params.start_date, 'DD MMM YYYY');
|
||||
@@ -242,9 +245,10 @@ const createPDFDocument = (params: CustomerPaymentExportPDFParams) => {
|
||||
: '-'}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.parameterBadge}>
|
||||
{/* TODO: Uncomment when BE is ready */}
|
||||
{/* <View style={pdfStyles.parameterBadge}>
|
||||
<Text>Filter Tanggal: Tanggal DO</Text>
|
||||
</View>
|
||||
</View> */}
|
||||
<View style={pdfStyles.parameterBadge}>
|
||||
<Text>
|
||||
Customer: {params.params?.customer_name || 'Semua Customer'}
|
||||
|
||||
@@ -47,6 +47,8 @@ const CustomerPaymentTab = () => {
|
||||
const [filterCustomer, setFilterCustomer] = useState<typeof customerOptions>(
|
||||
[]
|
||||
);
|
||||
// TODO: Uncomment when BE is ready
|
||||
// const [filterSales, setFilterSales] = useState<typeof salesOptions>([]);
|
||||
const [filterSales, setFilterSales] = useState<typeof salesOptions>([]);
|
||||
const [filterStartDate, setFilterStartDate] = useState('');
|
||||
const [filterEndDate, setFilterEndDate] = useState('');
|
||||
@@ -60,6 +62,7 @@ const CustomerPaymentTab = () => {
|
||||
hasMore: hasMoreCustomers,
|
||||
} = useSelect(CustomerApi.basePath, 'id', 'name', 'search');
|
||||
|
||||
// TODO: Uncomment when BE is ready
|
||||
const {
|
||||
options: salesOptions,
|
||||
isLoadingOptions: isLoadingSales,
|
||||
@@ -133,23 +136,18 @@ const CustomerPaymentTab = () => {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
// Sales filter
|
||||
if (filterSales.length > 0) {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
// Filter by (always count if submitted)
|
||||
if (isSubmitted) {
|
||||
count += 1;
|
||||
}
|
||||
// TODO: Uncomment when BE is ready
|
||||
// // Sales filter
|
||||
// if (filterSales.length > 0) {
|
||||
// count += 1;
|
||||
// }
|
||||
|
||||
return count;
|
||||
}, [
|
||||
filterStartDate,
|
||||
filterEndDate,
|
||||
filterCustomer,
|
||||
filterSales,
|
||||
isSubmitted,
|
||||
// filterSales,
|
||||
]);
|
||||
|
||||
const hasFilters = activeFiltersCount > 0;
|
||||
@@ -163,11 +161,12 @@ const CustomerPaymentTab = () => {
|
||||
filterCustomer.length > 0
|
||||
? filterCustomer.map((v) => String(v.value)).join(',')
|
||||
: undefined,
|
||||
sales_id:
|
||||
filterSales.length > 0
|
||||
? filterSales.map((v) => String(v.value)).join(',')
|
||||
: undefined,
|
||||
filter_by: 'do_date' as const,
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales_id:
|
||||
// filterSales.length > 0
|
||||
// ? filterSales.map((v) => String(v.value)).join(',')
|
||||
// : undefined,
|
||||
// filter_by: 'do_date' as const,
|
||||
start_date: filterStartDate || undefined,
|
||||
end_date: filterEndDate || undefined,
|
||||
page: currentPage,
|
||||
@@ -180,8 +179,8 @@ const CustomerPaymentTab = () => {
|
||||
([, params]) =>
|
||||
FinanceApi.getCustomerPaymentReport(
|
||||
params.customer_id,
|
||||
params.sales_id,
|
||||
params.filter_by,
|
||||
undefined, // TODO: Change to params.sales_id when BE is ready
|
||||
undefined, // TODO: Change to params.filter_by when BE is ready
|
||||
params.start_date,
|
||||
params.end_date,
|
||||
params.page,
|
||||
@@ -206,11 +205,11 @@ const CustomerPaymentTab = () => {
|
||||
filterCustomer.length > 0
|
||||
? filterCustomer.map((v) => String(v.value)).join(',')
|
||||
: undefined,
|
||||
sales_id:
|
||||
filterSales.length > 0
|
||||
? filterSales.map((v) => String(v.value)).join(',')
|
||||
: undefined,
|
||||
filter_by: 'do_date' as const,
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales_id:
|
||||
// filterSales.length > 0
|
||||
// ? filterSales.map((v) => String(v.value)).join(',')
|
||||
// : undefined,
|
||||
start_date: filterStartDate || undefined,
|
||||
end_date: filterEndDate || undefined,
|
||||
limit: 100,
|
||||
@@ -219,8 +218,8 @@ const CustomerPaymentTab = () => {
|
||||
|
||||
const response = await FinanceApi.getCustomerPaymentReport(
|
||||
params.customer_id,
|
||||
params.sales_id,
|
||||
params.filter_by,
|
||||
undefined, // TODO: Change to params.sales_id when BE is ready
|
||||
undefined, // TODO: Change to params.filter_by when BE is ready
|
||||
params.start_date,
|
||||
params.end_date,
|
||||
params.page,
|
||||
@@ -277,13 +276,15 @@ const CustomerPaymentTab = () => {
|
||||
filterCustomer.length > 0
|
||||
? filterCustomer.map((c) => c.label).join(', ')
|
||||
: undefined,
|
||||
sales:
|
||||
filterSales.length > 0
|
||||
? filterSales.map((s) => s.label).join(', ')
|
||||
: undefined,
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales:
|
||||
// filterSales.length > 0
|
||||
// ? filterSales.map((s) => s.label).join(', ')
|
||||
// : undefined,
|
||||
start_date: filterStartDate || undefined,
|
||||
end_date: filterEndDate || undefined,
|
||||
filter_by: 'do_date',
|
||||
// TODO: Uncomment when BE is ready
|
||||
// filter_by: 'do_date' as const,
|
||||
},
|
||||
});
|
||||
toast.success('PDF berhasil dibuat dan diunduh.');
|
||||
@@ -661,7 +662,8 @@ const CustomerPaymentTab = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{/* TODO: Uncomment when BE is ready */}
|
||||
{/* <div>
|
||||
<SelectInputCheckbox
|
||||
label='Sales'
|
||||
placeholder='Pilih Sales'
|
||||
@@ -675,9 +677,10 @@ const CustomerPaymentTab = () => {
|
||||
onMenuScrollToBottom={loadMoreSales}
|
||||
className={{ wrapper: 'w-full' }}
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div>
|
||||
{/* TODO: Uncomment when BE is ready */}
|
||||
{/* <div>
|
||||
<SelectInput
|
||||
label='Filter Berdasarkan'
|
||||
placeholder='Pilih Filter Berdasarkan'
|
||||
@@ -686,7 +689,7 @@ const CustomerPaymentTab = () => {
|
||||
isDisabled={true}
|
||||
className={{ wrapper: 'w-full' }}
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
{/* Action Buttons */}
|
||||
|
||||
@@ -13,8 +13,11 @@ export class FinanceApiService extends BaseApiService<
|
||||
|
||||
async getCustomerPaymentReport(
|
||||
customer_id?: string,
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales_id?: string,
|
||||
// filter_by?: 'do_date',
|
||||
sales_id?: string,
|
||||
filter_by?: 'do_date',
|
||||
filter_by?: 'do_date' | undefined,
|
||||
start_date?: string,
|
||||
end_date?: string,
|
||||
page?: number,
|
||||
@@ -26,8 +29,9 @@ export class FinanceApiService extends BaseApiService<
|
||||
method: 'GET',
|
||||
params: {
|
||||
customer_id: customer_id,
|
||||
sales_id: sales_id,
|
||||
filter_by: filter_by,
|
||||
// TODO: Uncomment when BE is ready
|
||||
// sales_id: sales_id,
|
||||
// filter_by: filter_by,
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
page: page,
|
||||
|
||||
Reference in New Issue
Block a user