mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE-327): Temporarily map Indonesian sales fields to English
This commit is contained in:
@@ -88,6 +88,34 @@ const generateCustomHeaders = (template: {
|
|||||||
return rows;
|
return rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: TEMPORARY - Remove this when backend API returns English field names
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const mapIndonesianDataToEnglish = (data: any): BaseClosingSales[] => {
|
||||||
|
if (!data || !data.penjualan || !Array.isArray(data.penjualan)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
return data.penjualan.map((item: any) => ({
|
||||||
|
id: item.id,
|
||||||
|
realization_date: item.tanggal_realisasi,
|
||||||
|
age_label: item.umur_label,
|
||||||
|
umur_minggu: item.umur_minggu,
|
||||||
|
delivery_order_number: item.no_do,
|
||||||
|
product: item.produk,
|
||||||
|
jenis_produk: item.jenis_produk,
|
||||||
|
customer: item.customer,
|
||||||
|
quantity: item.qty,
|
||||||
|
weight: item.kg,
|
||||||
|
average: item.avg,
|
||||||
|
price: item.harga,
|
||||||
|
total: item.total,
|
||||||
|
kandang: item.kandang,
|
||||||
|
payment_status: item.status_pembayaran,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
// END TODO
|
||||||
|
|
||||||
const SalesReportTable = ({
|
const SalesReportTable = ({
|
||||||
type = 'detail',
|
type = 'detail',
|
||||||
initialValues,
|
initialValues,
|
||||||
@@ -96,6 +124,13 @@ const SalesReportTable = ({
|
|||||||
|
|
||||||
const salesBroilerData: BaseClosingSales[] = useMemo(() => {
|
const salesBroilerData: BaseClosingSales[] = useMemo(() => {
|
||||||
if (activeTabId === 'penjualan' && initialValues) {
|
if (activeTabId === 'penjualan' && initialValues) {
|
||||||
|
// TODO: TEMPORARY - Remove this when backend API returns English field names
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
if (initialValues.penjualan && Array.isArray(initialValues.penjualan)) {
|
||||||
|
return mapIndonesianDataToEnglish(initialValues);
|
||||||
|
}
|
||||||
|
// END TODO
|
||||||
return [initialValues];
|
return [initialValues];
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user