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