diff --git a/src/components/pages/dashboard/DashboardProduction.tsx b/src/components/pages/dashboard/DashboardProduction.tsx index 5ee4ea4e..f561e96d 100644 --- a/src/components/pages/dashboard/DashboardProduction.tsx +++ b/src/components/pages/dashboard/DashboardProduction.tsx @@ -1,7 +1,6 @@ 'use client'; import Button from '@/components/Button'; -import Card from '@/components/Card'; import { Icon } from '@iconify/react'; import Modal, { useModal } from '@/components/Modal'; import DateInput from '@/components/input/DateInput'; @@ -50,7 +49,7 @@ const DashboardProduction = () => { const [analysisMode, setAnalysisMode] = useState<'OVERVIEW' | 'COMPARISON'>( 'OVERVIEW' ); - const [endpointUrl, setEndpointUrl] = useState('/dashboard'); + const [endpointUrl, setEndpointUrl] = useState('/dashboards'); const [selectedLocationIds, setSelectedLocationIds] = useState([]); const [formErrorList, setFormErrorList] = useState([]); @@ -84,8 +83,8 @@ const DashboardProduction = () => { limit: 'limit', location_id: selectedLocationIds ? selectedLocationIds.toString() : '', }); - const comparedByOptions = [ - { value: 'LOCATION', label: 'Farm' }, + const comparisonTypeOptions = [ + { value: 'FARM', label: 'Farm' }, { value: 'FLOCK', label: 'Flock' }, { value: 'KANDANG', label: 'Kandang' }, ]; @@ -99,7 +98,7 @@ const DashboardProduction = () => { location: [] as OptionType[], kandang: [] as OptionType[], analysisMode: analysisMode, - comparedBy: '', + comparisonType: '', lokasiIds: [], flockIds: [], kandangIds: [], @@ -115,6 +114,7 @@ const DashboardProduction = () => { location_ids: normalizeToArray(values.location), flock_ids: normalizeToArray(values.flock), kandang_ids: normalizeToArray(values.kandang), + comparison_type: values.comparisonType, }); }, }); @@ -122,7 +122,7 @@ const DashboardProduction = () => { const handleResetFilter = () => { formik.resetForm(); setAnalysisMode('OVERVIEW'); - setEndpointUrl('/dashboard'); + setEndpointUrl('/dashboards'); }; const handleApplyFilter = (values: DashboardFilter) => { @@ -140,8 +140,9 @@ const DashboardProduction = () => { params.flock_ids = values.flock_ids.toString(); if (values.kandang_ids.length > 0) params.kandang_ids = values.kandang_ids.toString(); + if (values.comparison_type) params.comparison_type = values.comparison_type; - setEndpointUrl(`/dashboard?${new URLSearchParams(params).toString()}`); + setEndpointUrl(`/dashboards?${new URLSearchParams(params).toString()}`); console.log(endpointUrl); filterModal.closeModal(); refreshDashboardProductionData(); @@ -262,7 +263,13 @@ const DashboardProduction = () => { data={dashboardProductionData} /> ) : ( - + )} @@ -343,7 +350,7 @@ const DashboardProduction = () => { formik.setFieldValue('location', []); formik.setFieldValue('flock', []); formik.setFieldValue('kandang', []); - formik.setFieldValue('comparedBy', ''); + formik.setFieldValue('comparisonType', ''); setSelectedLocationIds([]); }} color='primary' @@ -368,21 +375,21 @@ const DashboardProduction = () => {
option.value === formik.values.comparedBy + value={comparisonTypeOptions.find( + (option) => option.value === formik.values.comparisonType )} onChange={(selected) => formik.setFieldValue( - 'comparedBy', + 'comparisonType', selected ? (selected as OptionType).value : '' ) } - errorMessage={formik.errors.comparedBy as string} - options={comparedByOptions} + errorMessage={formik.errors.comparisonType as string} + options={comparisonTypeOptions} isLoading={isLoadingLocationOptions} isError={ - Boolean(formik.errors.comparedBy) && - Boolean(formik.touched.comparedBy) + Boolean(formik.errors.comparisonType) && + Boolean(formik.touched.comparisonType) } />
@@ -405,9 +412,9 @@ const DashboardProduction = () => { options={locationOptions} isLoading={isLoadingLocationOptions} isMulti={ - comparedByOptions.find( - (option) => option.value === formik.values.comparedBy - )?.value === 'LOCATION' + comparisonTypeOptions.find( + (option) => option.value === formik.values.comparisonType + )?.value === 'FARM' } isError={ Boolean(formik.errors.location) && @@ -420,8 +427,8 @@ const DashboardProduction = () => { {!( formik.values.analysisMode === 'COMPARISON' && !( - formik.values.comparedBy === 'FLOCK' || - formik.values.comparedBy === 'KANDANG' + formik.values.comparisonType === 'FLOCK' || + formik.values.comparisonType === 'KANDANG' ) ) && (
@@ -435,8 +442,8 @@ const DashboardProduction = () => { options={flockOptions} isLoading={isLoadingFlockOptions} isMulti={ - comparedByOptions.find( - (option) => option.value === formik.values.comparedBy + comparisonTypeOptions.find( + (option) => option.value === formik.values.comparisonType )?.value === 'FLOCK' } isError={ @@ -450,7 +457,7 @@ const DashboardProduction = () => { {/* Kandang */} {!( formik.values.analysisMode === 'COMPARISON' && - !(formik.values.comparedBy === 'KANDANG') + !(formik.values.comparisonType === 'KANDANG') ) && (
{ options={kandangOptions} isLoading={isLoadingKandangOptions} isMulti={ - comparedByOptions.find( - (option) => option.value === formik.values.comparedBy + comparisonTypeOptions.find( + (option) => option.value === formik.values.comparisonType )?.value === 'KANDANG' } isError={ diff --git a/src/components/pages/dashboard/filter/DashboardProductionFilter.schema.ts b/src/components/pages/dashboard/filter/DashboardProductionFilter.schema.ts index 2034bcd9..d62157a8 100644 --- a/src/components/pages/dashboard/filter/DashboardProductionFilter.schema.ts +++ b/src/components/pages/dashboard/filter/DashboardProductionFilter.schema.ts @@ -5,7 +5,7 @@ export type DashboardFilterType = { startDate: string; endDate: string; analysisMode: string; - comparedBy: string | undefined; + comparisonType: string | undefined; location: OptionType | OptionType[]; lokasiIds: number[] | undefined; flock: OptionType | OptionType[] | undefined; @@ -20,7 +20,7 @@ export const DashboardFilterOverviewSchema: yup.ObjectSchema schema.required('Compared by is required'), otherwise: (schema) => schema.optional(), @@ -63,7 +63,7 @@ export const DashboardFilterComparisonSchema: yup.ObjectSchema schema.required('Compared by is required'), otherwise: (schema) => schema.optional(), @@ -80,7 +80,7 @@ export const DashboardFilterComparisonSchema: yup.ObjectSchema().when('comparedBy', { + flock: yup.mixed().when('comparisonType', { is: (value: string) => value === 'FLOCK' || value === 'KANDANG', then: (schema) => schema.test('is-required', 'Flock is required', (value) => { @@ -91,7 +91,7 @@ export const DashboardFilterComparisonSchema: yup.ObjectSchema schema.optional(), }), - kandang: yup.mixed().when('comparedBy', { + kandang: yup.mixed().when('comparisonType', { is: 'KANDANG', then: (schema) => schema.test('is-required', 'Kandang is required', (value) => { diff --git a/src/components/pages/dashboard/skeleton/DashboardLineChartSkeleton.tsx b/src/components/pages/dashboard/skeleton/DashboardLineChartSkeleton.tsx index cdd923f4..b479eced 100644 --- a/src/components/pages/dashboard/skeleton/DashboardLineChartSkeleton.tsx +++ b/src/components/pages/dashboard/skeleton/DashboardLineChartSkeleton.tsx @@ -1,6 +1,7 @@ import { Icon } from '@iconify/react'; +import { DashboardMeta } from '@/types/api/dashboard/dashboard'; -const DashboardLineChartSkeleton = () => { +const DashboardLineChartSkeleton = ({ meta }: { meta?: DashboardMeta }) => { return (
{/* Header with title skeleton */} @@ -32,24 +33,49 @@ const DashboardLineChartSkeleton = () => {
{/* Empty state centered in chart area */}
- {/* Filter icon */} -
- -
+ {!meta?.filters && ( + <> + {/* Filter icon */} +
+ +
- {/* Empty state text */} -

- No Filters Selected -

-

- Please choose filters to narrow down your results and make your - search easier. -

+ {/* Empty state text */} +

+ No Filters Selected +

+

+ Please choose filters to narrow down your results and make + your search easier. +

+ + )} + {meta?.filters && ( + <> + {/* Filter icon */} +
+ +
+ + {/* Empty state text */} +

+ Data Not Yet Available +

+

+ Please change your filters to get the data. +

+ + )}
{/* Placeholder for chart height */} diff --git a/src/components/pages/report/finance/FinanceTabs.tsx b/src/components/pages/report/finance/FinanceTabs.tsx index 7a970c76..aaaae985 100644 --- a/src/components/pages/report/finance/FinanceTabs.tsx +++ b/src/components/pages/report/finance/FinanceTabs.tsx @@ -2,6 +2,7 @@ import Tabs from '@/components/Tabs'; import CustomerPaymentTab from '@/components/pages/report/finance/tab/CustomerPaymentTab'; +import DebtSupplierTab from '@/components/pages/report/finance/tab/DebtSupplierTab'; const FinanceTabs = () => { const tabs = [ @@ -11,6 +12,12 @@ const FinanceTabs = () => { content: , }, + { + id: '2', + label: 'Rekapitulasi Hutang Ke Supplier', + + content: , + }, ]; return ( diff --git a/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx b/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx new file mode 100644 index 00000000..42d27847 --- /dev/null +++ b/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx @@ -0,0 +1,363 @@ +'use client'; + +import { + Page, + Text, + View, + Document, + StyleSheet, + Font, + pdf, +} from '@react-pdf/renderer'; + +import { formatDate, formatCurrency, formatNumber } from '@/lib/helper'; +import { DebtSupplier } from '@/types/api/report/debt-supplier'; + +Font.register({ + family: 'Helvetica', + src: 'helvetica', +}); + +const pdfStyles = StyleSheet.create({ + page: { + fontSize: 10, + fontFamily: 'Helvetica', + padding: 20, + backgroundColor: '#FFFFFF', + }, + titleSection: { + marginBottom: 10, + }, + mainTitle: { + fontSize: 14, + fontWeight: 'bold', + marginBottom: 5, + color: '#1f74bf', + }, + supplierTitle: { + fontSize: 12, + fontWeight: 'bold', + marginBottom: 8, + color: '#1f74bf', + }, + supplierInfo: { + fontSize: 9, + marginBottom: 5, + color: '#333333', + }, + table: { + borderWidth: 1, + borderColor: '#000000', + marginBottom: 15, + }, + tableRow: { + flexDirection: 'row', + }, + tableHeader: { + backgroundColor: '#F5F5F5', + }, + tableCell: { + flex: 1, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + textAlign: 'left', + }, + tableCellNo: { + flex: 0.5, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + textAlign: 'center', + }, + tableCellLast: { + flex: 1, + padding: 4, + fontSize: 7, + }, + tableCellHeader: { + flex: 1, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + fontWeight: 'bold', + backgroundColor: '#F5F5F5', + borderBottomWidth: 1, + borderBottomColor: '#000000', + borderBottomStyle: 'solid', + paddingVertical: 12, + textAlign: 'center', + }, + tableCellHeaderRight: { + flex: 1, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + fontWeight: 'bold', + backgroundColor: '#F5F5F5', + textAlign: 'right', + borderBottomWidth: 1, + borderBottomColor: '#000000', + borderBottomStyle: 'solid', + paddingVertical: 12, + }, + tableCellRight: { + flex: 1, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + textAlign: 'right', + }, + tableCellCenter: { + flex: 1, + borderRightWidth: 1, + borderRightColor: '#000000', + borderRightStyle: 'solid', + padding: 4, + fontSize: 7, + textAlign: 'center', + }, + tableBorderBottom: { + borderBottomWidth: 1, + borderBottomColor: '#000000', + borderBottomStyle: 'solid', + }, + summaryRow: { + backgroundColor: '#F0F0F0', + fontWeight: 'bold', + }, +}); + +interface DebtSupplierExportPDFParams { + data: DebtSupplier[]; +} + +const createPDFDocument = (params: DebtSupplierExportPDFParams) => { + return ( + + {params.data.map((supplierReport, supplierIndex) => ( + + {/* Title and Supplier Info */} + + + Laporan > Hutang Supplier + + + {supplierReport.supplier.name} + + + + {/* Table */} + + {/* Table Header */} + + + No + + + No. PR + + + No. PO + + + Tgl PR + + + Tgl PO + + + Aging + + + Area + + + Gudang + + + Tgl Jatuh Tempo + + + Status JT + + + Total Harga + + + Pembayaran + + + Hutang + + + Status + + + No. Perjalanan + + + + {/* Table Body */} + {supplierReport.rows.map((item, index) => ( + + + {index + 1} + + + {item.pr_number || '-'} + + + {item.po_number || '-'} + + + + {item.pr_date ? formatDate(item.pr_date, 'DD MMM YY') : '-'} + + + + + {item.po_date ? formatDate(item.po_date, 'DD MMM YY') : '-'} + + + + {formatNumber(item.aging)} Hari + + + {item.area?.name || '-'} + + + {item.warehouse?.name || '-'} + + + + {item.due_date + ? formatDate(item.due_date, 'DD MMM YY') + : '-'} + + + + {item.due_status || '-'} + + + {formatCurrency(item.total_price)} + + + {formatCurrency(item.payment_price)} + + + {formatCurrency(item.debt_price)} + + + {item.status || '-'} + + + {item.travel_number || '-'} + + + ))} + + {/* Summary Row */} + {supplierReport.total && ( + + + Total + + + + + + + + + + + + + + + {formatNumber(supplierReport.total.aging)} Hari + + + + + + + + + + + + + + + + {formatCurrency(supplierReport.total.total_price)} + + + + + {formatCurrency(supplierReport.total.payment_price)} + + + + {formatCurrency(supplierReport.total.debt_price)} + + + + + + + + + )} + + + ))} + + ); +}; + +export const generateDebtSupplierPDF = async ( + params: DebtSupplierExportPDFParams +): Promise => { + const PDFDocument = createPDFDocument(params); + + try { + const blob = await pdf(PDFDocument).toBlob(); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = `laporan-hutang-supplier-${formatDate(new Date(), 'YYYY-MM-DD-HHmm')}.pdf`; + + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + URL.revokeObjectURL(url); + } catch (error) { + throw error; + } +}; diff --git a/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx b/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx new file mode 100644 index 00000000..820ba7ec --- /dev/null +++ b/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx @@ -0,0 +1,101 @@ +'use client'; + +import * as XLSX from 'xlsx'; +import { formatDate, formatCurrency, formatNumber } from '@/lib/helper'; +import { DebtSupplier } from '@/types/api/report/debt-supplier'; + +interface DebtSupplierExportExcelParams { + data: DebtSupplier[]; +} + +export const generateDebtSupplierExcel = ( + params: DebtSupplierExportExcelParams +): void => { + if (!params.data || params.data.length === 0) { + return; + } + + const workbook = XLSX.utils.book_new(); + + params.data.forEach((supplierReport) => { + const supplierData = supplierReport.rows; + const supplierName = supplierReport.supplier.name || 'Unknown Supplier'; + + const excelData: { [key: string]: string | number }[] = supplierData.map( + (item, index) => ({ + No: index + 1, + 'Nomor PR': item.pr_number || '', + 'Nomor PO': item.po_number || '', + 'Tanggal PR': item.pr_date + ? formatDate(item.pr_date, 'DD MMM YYYY') + : '', + 'Tanggal PO': item.po_date + ? formatDate(item.po_date, 'DD MMM YYYY') + : '', + 'Aging (Hari)': formatNumber(item.aging || 0), + Area: item.area?.name || '', + Gudang: item.warehouse?.name || '', + 'Tanggal Jatuh Tempo': item.due_date + ? formatDate(item.due_date, 'DD MMM YYYY') + : '', + 'Status Jatuh Tempo': item.due_status || '', + 'Total Harga': formatCurrency(item.total_price || 0), + 'Harga Pembayaran': formatCurrency(item.payment_price || 0), + 'Harga Hutang': formatCurrency(item.debt_price || 0), + Status: item.status || '', + 'Nomor Perjalanan': item.travel_number || '', + }) + ); + + if (supplierReport.total) { + excelData.push({ + No: 'Total', + 'Nomor PR': '', + 'Nomor PO': '', + 'Tanggal PR': '', + 'Tanggal PO': '', + 'Aging (Hari)': formatNumber(supplierReport.total.aging || 0), + Area: '', + Gudang: '', + 'Tanggal Jatuh Tempo': '', + 'Status Jatuh Tempo': '', + 'Total Harga': formatCurrency(supplierReport.total.total_price || 0), + 'Harga Pembayaran': formatCurrency( + supplierReport.total.payment_price || 0 + ), + 'Harga Hutang': formatCurrency(supplierReport.total.debt_price || 0), + Status: '', + 'Nomor Perjalanan': '', + }); + } + + const worksheet = XLSX.utils.json_to_sheet(excelData); + + const colWidths = [ + { wch: 5 }, // No + { wch: 15 }, // Nomor PR + { wch: 15 }, // Nomor PO + { wch: 15 }, // Tanggal PR + { wch: 15 }, // Tanggal PO + { wch: 12 }, // Aging + { wch: 15 }, // Area + { wch: 15 }, // Gudang + { wch: 18 }, // Tanggal Jatuh Tempo + { wch: 18 }, // Status Jatuh Tempo + { wch: 15 }, // Total Harga + { wch: 15 }, // Harga Pembayaran + { wch: 15 }, // Harga Hutang + { wch: 12 }, // Status + { wch: 15 }, // Nomor Perjalanan + ]; + worksheet['!cols'] = colWidths; + + const sheetName = + supplierName.length > 31 ? supplierName.substring(0, 31) : supplierName; + XLSX.utils.book_append_sheet(workbook, worksheet, sheetName); + }); + + const filename = `laporan-hutang-supplier-${formatDate(new Date(), 'YYYY-MM-DD-HHmm')}.xlsx`; + + XLSX.writeFile(workbook, filename); +}; diff --git a/src/components/pages/report/finance/tab/DebtSupplierTab.tsx b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx new file mode 100644 index 00000000..8ac75821 --- /dev/null +++ b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx @@ -0,0 +1,607 @@ +import Button from '@/components/Button'; +import Card from '@/components/Card'; +import Dropdown from '@/components/Dropdown'; +import DateInput from '@/components/input/DateInput'; +import SelectInput, { + OptionType, + useSelect, +} from '@/components/input/SelectInput'; +import Menu from '@/components/menu/Menu'; +import MenuItem from '@/components/menu/MenuItem'; +import Modal, { useModal } from '@/components/Modal'; +import Table from '@/components/Table'; +import { isResponseSuccess } from '@/lib/api-helper'; +import { formatCurrency, formatDate, formatNumber } from '@/lib/helper'; +import { SupplierApi } from '@/services/api/master-data'; +import { FinanceApi } from '@/services/api/report/finance-report'; +import { DebtRow, DebtSupplier } from '@/types/api/report/debt-supplier'; +import { generateDebtSupplierExcel } from '@/components/pages/report/finance/export/DebtSupplierExportXLSX'; +import { generateDebtSupplierPDF } from '@/components/pages/report/finance/export/DebtSupllierExportPDF'; +import { Icon } from '@iconify/react'; +import { ColumnDef } from '@tanstack/react-table'; +import { useCallback, useMemo, useState } from 'react'; +import toast from 'react-hot-toast'; +import useSWR from 'swr'; +import Pagination from '@/components/Pagination'; + +const DebtSupplierTab = () => { + // ===== STATE MANAGEMENT ===== + const [isPdfExportLoading, setIsPdfExportLoading] = useState(false); + const [isExcelExportLoading, setIsExcelExportLoading] = useState(false); + const isAnyExportLoading = isPdfExportLoading || isExcelExportLoading; + + // ===== PAGINATION STATE ===== + const [currentPage, setCurrentPage] = useState(1); + const [pageSize, setPageSize] = useState(10); + + // ===== SUBMISSION STATE ===== + const [isSubmitted, setIsSubmitted] = useState(false); + + // ===== FILTER STATE ===== + const [filterSupplier, setFilterSupplier] = useState([]); + const [filterStartDate, setFilterStartDate] = useState(''); + const [filterEndDate, setFilterEndDate] = useState(''); + const [filterDataType, setFilterDataType] = useState(); + const [filterErrors, setFilterErrors] = useState>({}); + + const filterModal = useModal(); + + const { options: supplierOptions, isLoadingOptions: isLoadingSuppliers } = + useSelect(SupplierApi.basePath, 'id', 'name', '', { + limit: 'limit', + }); + + const dataTypeOptions = useMemo( + () => [ + { value: 'do_date', label: 'Tanggal Terima' }, + { value: 'po_date', label: 'Tanggal PO' }, + ], + [] + ); + + // ===== FILTER HANDLERS ===== + const handleResetFilters = useCallback(() => { + setIsSubmitted(false); + setFilterSupplier([]); + setFilterStartDate(''); + setFilterEndDate(''); + setFilterErrors({}); + }, []); + + const handleApplyFilters = useCallback(() => { + const errors: Record = {}; + + if (!filterStartDate) { + errors.start_date = 'Tanggal mulai wajib diisi'; + } + if (!filterEndDate) { + errors.end_date = 'Tanggal akhir wajib diisi'; + } + + setFilterErrors(errors); + + if (Object.keys(errors).length === 0) { + setIsSubmitted(true); + setCurrentPage(1); + filterModal.closeModal(); + } + }, [filterModal, filterStartDate, filterEndDate]); + + // ===== DATA FETCHING ===== + const { data: debtSupplier, isLoading } = useSWR( + isSubmitted + ? () => { + const params = { + supplier_ids: + filterSupplier.length > 0 + ? filterSupplier.map((v) => String(v.value)).join(',') + : undefined, + filter_by: 'do_date' as const, + start_date: filterStartDate || undefined, + end_date: filterEndDate || undefined, + page: currentPage, + limit: pageSize, + }; + + return ['debt-supplier-report', params]; + } + : null, + ([, params]) => + FinanceApi.getDebtSupplierReport( + params.supplier_ids, + params.filter_by, + params.start_date, + params.end_date, + params.page, + params.limit + ) + ); + // const { data: debtSupplier, isLoading } = useSWR(FinanceApi.basePath, () => + // FinanceApi.getDebtSupplierReport() + // ); + + const data: DebtSupplier[] = useMemo( + () => + isResponseSuccess(debtSupplier) + ? (debtSupplier?.data as unknown as DebtSupplier[]) || [] + : [], + [debtSupplier] + ); + const meta = + isResponseSuccess(debtSupplier) && debtSupplier?.meta + ? debtSupplier.meta + : null; + + // ===== EXPORT DATA FETCHER ===== + const debtSupplierExport = useCallback(async (): Promise< + DebtSupplier[] | null + > => { + const params = { + supplier_ids: + filterSupplier.length > 0 + ? filterSupplier.map((v) => String(v.value)).join(',') + : undefined, + filter_by: 'do_date' as const, + start_date: filterStartDate || undefined, + end_date: filterEndDate || undefined, + date_type: filterDataType ? filterDataType.value : undefined, + limit: 100, + page: 1, + }; + + const response = await FinanceApi.getDebtSupplierReport( + params.supplier_ids, + params.filter_by, + params.start_date, + params.end_date, + params.page, + params.limit + ); + + return isResponseSuccess(response) + ? (response.data as unknown as DebtSupplier[]) + : null; + }, [filterSupplier, filterStartDate, filterEndDate]); + + // ===== EXPORT HANDLERS ===== + const handleExportExcel = useCallback(async () => { + setIsExcelExportLoading(true); + try { + const allDataForExport = await debtSupplierExport(); + + if ( + !allDataForExport || + !Array.isArray(allDataForExport) || + allDataForExport.length === 0 + ) { + toast.error('Tidak ada data untuk diekspor.'); + return; + } + + generateDebtSupplierExcel({ data: allDataForExport }); + toast.success('Excel berhasil dibuat dan diunduh.'); + } catch { + toast.error('Gagal membuat Excel. Silakan coba lagi.'); + } finally { + setIsExcelExportLoading(false); + } + }, [debtSupplierExport]); + + const handleExportPdf = useCallback(async () => { + setIsPdfExportLoading(true); + try { + const allDataForExport = await debtSupplierExport(); + + if ( + !allDataForExport || + !Array.isArray(allDataForExport) || + allDataForExport.length === 0 + ) { + toast.error('Tidak ada data untuk diekspor.'); + return; + } + + await generateDebtSupplierPDF({ data: allDataForExport }); + toast.success('PDF berhasil dibuat dan diunduh.'); + } catch { + toast.error('Gagal membuat PDF. Silakan coba lagi.'); + } finally { + setIsPdfExportLoading(false); + } + }, [debtSupplierExport]); + + // ===== PAGINATION HANDLERS ===== + const handlePageChange = (page: number) => { + setCurrentPage(page); + }; + + const handleRowChange = (pageSize: number) => { + setPageSize(pageSize); + }; + + const handleNextPage = () => { + if (meta && currentPage < meta.total_pages) { + setCurrentPage(currentPage + 1); + } + }; + + const handlePrevPage = () => { + if (currentPage > 1) { + setCurrentPage(currentPage - 1); + } + }; + + const getTableColumns = (supplier: DebtSupplier): ColumnDef[] => [ + { + id: 'no', + header: 'No', + cell: (props) => props.row.index + 1, + }, + { + id: 'pr_number', + header: 'Nomor PR', + accessorKey: 'pr_number', + cell: (props) => { + const value = props.row.original.pr_number; + return value || '-'; + }, + }, + { + id: 'po_number', + header: 'Nomor PO', + accessorKey: 'po_number', + cell: (props) => { + const value = props.row.original.po_number; + return value || '-'; + }, + }, + { + id: 'pr_date', + header: 'Tanggal PR', + accessorKey: 'pr_date', + cell: (props) => { + const value = props.row.original.pr_date; + return formatDate(value, 'DD MMM YYYY'); + }, + }, + { + id: 'po_date', + header: 'Tanggal PO', + accessorKey: 'po_date', + cell: (props) => { + const value = props.row.original.po_date; + return formatDate(value, 'DD MMM YYYY'); + }, + }, + { + id: 'aging', + header: 'Aging', + accessorKey: 'aging', + cell: (props) => { + const value = props.row.original.aging; + return
{formatNumber(value)} Hari
; + }, + footer: () => { + const value = supplier.total.aging; + return
{formatNumber(value)} Hari
; + }, + }, + { + id: 'area', + header: 'Area', + accessorKey: 'area', + cell: (props) => { + const value = props.row.original.area?.name; + return value || '-'; + }, + }, + { + id: 'warehouse', + header: 'Gudang', + accessorKey: 'warehouse', + cell: (props) => { + const value = props.row.original.warehouse?.name; + return value || '-'; + }, + }, + { + id: 'due_date', + header: 'Tanggal Jatuh Tempo', + accessorKey: 'due_date', + cell: (props) => { + const value = props.row.original.due_date; + return formatDate(value, 'DD MMM YYYY'); + }, + }, + { + id: 'due_status', + header: 'Status Jatuh Tempo', + accessorKey: 'due_status', + cell: (props) => { + const value = props.row.original.due_status; + return value || '-'; + }, + }, + { + id: 'total_price', + header: 'Total Harga', + accessorKey: 'total_price', + cell: (props) => { + const value = props.row.original.total_price; + return
{formatCurrency(value)}
; + }, + footer: () => { + const value = supplier.total.total_price; + return
{formatCurrency(value)}
; + }, + }, + { + id: 'payment_price', + header: 'Harga Pembayaran', + accessorKey: 'payment_price', + cell: (props) => { + const value = props.row.original.payment_price; + return
{formatCurrency(value)}
; + }, + footer: () => { + const value = supplier.total.payment_price; + return
{formatCurrency(value)}
; + }, + }, + { + id: 'debt_price', + header: 'Harga Hutang', + accessorKey: 'debt_price', + cell: (props) => { + const value = props.row.original.debt_price; + return ( +
+ {formatCurrency(value)} +
+ ); + }, + footer: () => { + const value = supplier.total.debt_price; + return ( +
+ {formatCurrency(value)} +
+ ); + }, + }, + { + id: 'status', + header: 'Status', + accessorKey: 'status', + cell: (props) => { + const value = props.row.original.status; + return value || '-'; + }, + }, + { + id: 'travel_number', + header: 'Nomor Perjalanan', + accessorKey: 'travel_number', + cell: (props) => { + const value = props.row.original.travel_number; + return value || '-'; + }, + }, + ]; + return ( + <> +
+ +
+ + + + + Export + + } + align='end' + > + + + + + +
+
+ + {!isSubmitted ? ( +
+ Silakan klik tombol Filter untuk mengatur filter dan menampilkan + data. +
+ ) : isLoading ? ( +
+ +
+ ) : data.length === 0 ? ( +
+ Tidak ada data yang dapat ditampilkan... +
+ ) : ( + data.map((supplierReport) => { + return ( + + 0} + className={{ + containerClassName: 'w-full', + tableWrapperClassName: 'overflow-x-auto mt-4', + tableClassName: 'w-full table-auto text-sm', + headerRowClassName: 'border-b border-b-gray-200 bg-gray-50', + headerColumnClassName: + 'px-4 py-3 text-xs font-semibold text-gray-700 text-left border border-gray-200', + bodyRowClassName: + 'hover:bg-gray-50 transition-colors border-b border-l border-r border-b-gray-200 border-l-gray-200 border-r-gray-200', + bodyColumnClassName: + 'px-4 py-3 text-xs text-gray-900 whitespace-nowrap', + tableFooterClassName: + 'bg-gray-100 font-semibold border border-gray-200', + footerRowClassName: 'border-t-2 border-gray-300', + footerColumnClassName: + 'px-4 py-3 text-xs text-gray-900 whitespace-nowrap', + paginationClassName: 'hidden', + }} + /> + + ); + }) + )} + + {meta && data.length > 0 && ( +
+ +
+ )} + + {/* Filter Modal */} + +
+ {/* Modal Header */} +
+
+ +

Filter Data

+
+ +
+
+
+
+ { + setFilterStartDate(e.target.value); + setFilterErrors((prev) => ({ ...prev, start_date: '' })); + }} + className={{ wrapper: 'w-full' }} + /> + {filterErrors.start_date && ( +

+ {filterErrors.start_date} +

+ )} +
+ +
+ { + setFilterEndDate(e.target.value); + setFilterErrors((prev) => ({ ...prev, end_date: '' })); + }} + className={{ wrapper: 'w-full' }} + /> + {filterErrors.end_date && ( +

+ {filterErrors.end_date} +

+ )} +
+
+ +
+ { + setFilterSupplier( + Array.isArray(val) ? val : val ? [val] : [] + ); + }} + isLoading={isLoadingSuppliers} + isClearable + className={{ wrapper: 'w-full' }} + /> +
+ +
+ { + setFilterDataType(val ? (val as OptionType) : undefined); + }} + className={{ wrapper: 'w-full' }} + /> +
+
+ + {/* Action Buttons */} +
+ + +
+
+
+ + ); +}; + +export default DebtSupplierTab; diff --git a/src/config/route-permission.ts b/src/config/route-permission.ts index 10a66f8c..5b230a43 100644 --- a/src/config/route-permission.ts +++ b/src/config/route-permission.ts @@ -117,7 +117,10 @@ export const ROUTE_PERMISSIONS: Record = { '/report/expense/': ['lti.repport.expense.list'], '/report/marketing/': ['lti.repport.delivery.list'], '/report/production-result/': ['lti.repport.production_result.list'], - '/report/finance/': ['lti.repport.finance.list'], + '/report/finance/': [ + 'lti.repport.finance.list', + 'lti.repport.debtsupplier.list', + ], // Inventory '/inventory/adjustment/': ['lti.inventory.list'], diff --git a/src/dummy/dashboard/dashboard.comparasion.flock.dummy.json b/src/dummy/dashboard/dashboard.comparasion.flock.dummy.json deleted file mode 100644 index a2baf621..00000000 --- a/src/dummy/dashboard/dashboard.comparasion.flock.dummy.json +++ /dev/null @@ -1,366 +0,0 @@ -{ - "code": 200, - "status": "success", - "message": "Get dashboard performance flock comparison successfully", - "meta": { - "page": 1, - "limit": 10, - "total_pages": 1, - "total_results": 1, - "filters": { - "start_date": "2025-12-01", - "end_date": "2025-12-31", - "analysis_mode": "COMPARASION", - "lokasi_ids": [1], - "flock_ids": [1, 2, 3], - "kandang_ids": [] - } - }, - "data": { - "statistics_data": [ - { - "label": "HPP Global", - "value": 16200, - "percent_last_month": 15.5 - }, - { - "label": "Avg. Selling Price", - "value": 28300, - "percent_last_month": -50 - }, - { - "label": "FCR", - "value": 24.02, - "percent_last_month": 15.5 - }, - { - "label": "Mortality", - "value": 5, - "percent_last_month": -15.5 - } - ], - "charts": { - "flock": { - "series": [ - { - "id": 1, - "label": "Flock Dago", - "unit": "%" - }, - { - "id": 2, - "label": "Flock Sulanjana", - "unit": "%" - }, - { - "id": 3, - "label": "Flock Garut 2", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "1": 18.5, - "2": 20.2, - "3": 17.8 - }, - { - "week": 2, - "1": 19.2, - "2": 21.5, - "3": 18.1 - }, - { - "week": 3, - "1": 20.1, - "2": 22.8, - "3": 18.5 - }, - { - "week": 4, - "1": 21.5, - "2": 24.0, - "3": 19.2 - }, - { - "week": 5, - "1": 22.8, - "2": 23.5, - "3": 20.4 - }, - { - "week": 6, - "1": 24.2, - "2": 22.1, - "3": 21.6 - }, - { - "week": 7, - "1": 25.8, - "2": 21.8, - "3": 22.9 - }, - { - "week": 8, - "1": 26.5, - "2": 22.4, - "3": 23.5 - }, - { - "week": 9, - "1": 26.2, - "2": 23.9, - "3": 24.1 - }, - { - "week": 10, - "1": 25.4, - "2": 24.8, - "3": 24.8 - }, - { - "week": 11, - "1": 24.8, - "2": 26.2, - "3": 25.4 - }, - { - "week": 12, - "1": 24.1, - "2": 27.5, - "3": 26.2 - }, - { - "week": 13, - "1": 23.5, - "2": 28.1, - "3": 27.5 - }, - { - "week": 14, - "1": 22.8, - "2": 27.4, - "3": 28.4 - }, - { - "week": 15, - "1": 21.9, - "2": 26.5, - "3": 29.1 - }, - { - "week": 16, - "1": 21.2, - "2": 25.8, - "3": 28.5 - }, - { - "week": 17, - "1": 20.8, - "2": 24.2, - "3": 27.2 - }, - { - "week": 18, - "1": 20.1, - "2": 23.1, - "3": 26.1 - }, - { - "week": 19, - "1": 19.5, - "2": 22.5, - "3": 25.8 - }, - { - "week": 20, - "1": 19.8, - "2": 21.9, - "3": 24.5 - }, - { - "week": 21, - "1": 20.5, - "2": 21.4, - "3": 23.2 - }, - { - "week": 22, - "1": 21.8, - "2": 21.0, - "3": 22.8 - }, - { - "week": 23, - "1": 22.5, - "2": 21.8, - "3": 21.9 - }, - { - "week": 24, - "1": 23.9, - "2": 22.5, - "3": 21.2 - }, - { - "week": 25, - "1": 24.5, - "2": 23.4, - "3": 20.5 - }, - { - "week": 26, - "1": 25.1, - "2": 24.8, - "3": 20.1 - }, - { - "week": 27, - "1": 26.8, - "2": 25.5, - "3": 19.8 - }, - { - "week": 28, - "1": 27.5, - "2": 26.2, - "3": 20.4 - }, - { - "week": 29, - "1": 27.2, - "2": 27.8, - "3": 21.5 - }, - { - "week": 30, - "1": 26.4, - "2": 28.5, - "3": 22.1 - }, - { - "week": 31, - "1": 25.8, - "2": 29.2, - "3": 23.4 - }, - { - "week": 32, - "1": 24.9, - "2": 28.8, - "3": 24.2 - }, - { - "week": 33, - "1": 24.2, - "2": 27.4, - "3": 25.8 - }, - { - "week": 34, - "1": 23.5, - "2": 26.5, - "3": 26.4 - }, - { - "week": 35, - "1": 22.8, - "2": 25.8, - "3": 27.1 - }, - { - "week": 36, - "1": 21.4, - "2": 24.2, - "3": 27.8 - }, - { - "week": 37, - "1": 20.5, - "2": 23.5, - "3": 28.2 - }, - { - "week": 38, - "1": 19.8, - "2": 22.8, - "3": 28.9 - }, - { - "week": 39, - "1": 19.2, - "2": 21.9, - "3": 27.5 - }, - { - "week": 40, - "1": 18.8, - "2": 21.2, - "3": 26.4 - }, - { - "week": 41, - "1": 18.5, - "2": 20.8, - "3": 25.2 - }, - { - "week": 42, - "1": 19.1, - "2": 20.5, - "3": 24.1 - }, - { - "week": 43, - "1": 20.2, - "2": 21.4, - "3": 23.5 - }, - { - "week": 44, - "1": 21.5, - "2": 22.8, - "3": 22.1 - }, - { - "week": 45, - "1": 22.8, - "2": 24.1, - "3": 21.8 - }, - { - "week": 46, - "1": 23.4, - "2": 25.2, - "3": 20.9 - }, - { - "week": 47, - "1": 24.1, - "2": 26.8, - "3": 20.1 - }, - { - "week": 48, - "1": 25.8, - "2": 27.5, - "3": 19.5 - }, - { - "week": 49, - "1": 26.2, - "2": 28.2, - "3": 19.1 - }, - { - "week": 50, - "1": 26.8, - "2": 28.8, - "3": 18.8 - } - ] - } - } - } -} diff --git a/src/dummy/dashboard/dashboard.comparasion.kandang.dummy.json b/src/dummy/dashboard/dashboard.comparasion.kandang.dummy.json deleted file mode 100644 index fc0bf82d..00000000 --- a/src/dummy/dashboard/dashboard.comparasion.kandang.dummy.json +++ /dev/null @@ -1,347 +0,0 @@ -{ - "statistics_data": [ - { - "label": "HPP Global", - "value": 16200, - "percent_last_month": 15.5 - }, - { - "label": "Avg. Selling Price", - "value": 28300, - "percent_last_month": -50 - }, - { - "label": "FCR", - "value": 24.02, - "percent_last_month": 15.5 - }, - { - "label": "Mortality", - "value": 5, - "percent_last_month": -15.5 - } - ], - "charts": { - "kandang": { - "series": [ - { - "id": 1, - "label": "Kandang Dago", - "unit": "%" - }, - { - "id": 2, - "label": "Kandang Sulanjana", - "unit": "%" - }, - { - "id": 3, - "label": "Kandang Garut 2", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "1": 21.2, - "2": 19.5, - "3": 20.1 - }, - { - "week": 2, - "1": 22.5, - "2": 19.8, - "3": 20.4 - }, - { - "week": 3, - "1": 23.1, - "2": 20.2, - "3": 21.0 - }, - { - "week": 4, - "1": 24.5, - "2": 21.5, - "3": 22.1 - }, - { - "week": 5, - "1": 25.8, - "2": 22.4, - "3": 23.5 - }, - { - "week": 6, - "1": 26.2, - "2": 23.1, - "3": 24.8 - }, - { - "week": 7, - "1": 27.5, - "2": 24.5, - "3": 26.2 - }, - { - "week": 8, - "1": 28.1, - "2": 25.8, - "3": 27.5 - }, - { - "week": 9, - "1": 28.8, - "2": 26.2, - "3": 28.4 - }, - { - "week": 10, - "1": 29.1, - "2": 27.5, - "3": 28.1 - }, - { - "week": 11, - "1": 28.5, - "2": 28.1, - "3": 27.4 - }, - { - "week": 12, - "1": 27.2, - "2": 29.1, - "3": 26.5 - }, - { - "week": 13, - "1": 26.1, - "2": 28.5, - "3": 25.8 - }, - { - "week": 14, - "1": 25.8, - "2": 27.2, - "3": 24.2 - }, - { - "week": 15, - "1": 24.5, - "2": 26.1, - "3": 23.1 - }, - { - "week": 16, - "1": 23.2, - "2": 25.8, - "3": 22.5 - }, - { - "week": 17, - "1": 22.8, - "2": 24.5, - "3": 21.9 - }, - { - "week": 18, - "1": 21.9, - "2": 23.2, - "3": 21.0 - }, - { - "week": 19, - "1": 21.2, - "2": 22.8, - "3": 20.5 - }, - { - "week": 20, - "1": 20.5, - "2": 21.9, - "3": 19.8 - }, - { - "week": 21, - "1": 19.8, - "2": 21.2, - "3": 19.2 - }, - { - "week": 22, - "1": 20.4, - "2": 20.5, - "3": 18.5 - }, - { - "week": 23, - "1": 21.0, - "2": 19.8, - "3": 18.1 - }, - { - "week": 24, - "1": 22.1, - "2": 20.4, - "3": 17.8 - }, - { - "week": 25, - "1": 23.5, - "2": 21.0, - "3": 18.5 - }, - { - "week": 26, - "1": 24.8, - "2": 22.1, - "3": 19.2 - }, - { - "week": 27, - "1": 26.2, - "2": 23.5, - "3": 20.1 - }, - { - "week": 28, - "1": 27.5, - "2": 24.8, - "3": 21.5 - }, - { - "week": 29, - "1": 28.4, - "2": 26.2, - "3": 22.8 - }, - { - "week": 30, - "1": 28.1, - "2": 27.5, - "3": 24.2 - }, - { - "week": 31, - "1": 27.4, - "2": 28.4, - "3": 25.8 - }, - { - "week": 32, - "1": 26.5, - "2": 28.1, - "3": 26.5 - }, - { - "week": 33, - "1": 25.8, - "2": 27.4, - "3": 27.2 - }, - { - "week": 34, - "1": 24.2, - "2": 26.5, - "3": 28.1 - }, - { - "week": 35, - "1": 23.1, - "2": 25.8, - "3": 28.5 - }, - { - "week": 36, - "1": 22.5, - "2": 24.2, - "3": 29.1 - }, - { - "week": 37, - "1": 21.9, - "2": 23.1, - "3": 28.8 - }, - { - "week": 38, - "1": 21.0, - "2": 22.5, - "3": 28.1 - }, - { - "week": 39, - "1": 20.5, - "2": 21.9, - "3": 27.4 - }, - { - "week": 40, - "1": 19.8, - "2": 21.0, - "3": 26.5 - }, - { - "week": 41, - "1": 19.2, - "2": 20.5, - "3": 25.8 - }, - { - "week": 42, - "1": 18.5, - "2": 19.8, - "3": 24.2 - }, - { - "week": 43, - "1": 18.1, - "2": 19.2, - "3": 23.1 - }, - { - "week": 44, - "1": 17.8, - "2": 18.5, - "3": 22.5 - }, - { - "week": 45, - "1": 18.5, - "2": 18.1, - "3": 21.9 - }, - { - "week": 46, - "1": 19.2, - "2": 17.8, - "3": 21.0 - }, - { - "week": 47, - "1": 20.1, - "2": 18.5, - "3": 20.5 - }, - { - "week": 48, - "1": 21.5, - "2": 19.2, - "3": 19.8 - }, - { - "week": 49, - "1": 22.8, - "2": 20.1, - "3": 19.2 - }, - { - "week": 50, - "1": 24.2, - "2": 21.5, - "3": 18.5 - } - ] - } - } -} diff --git a/src/dummy/dashboard/dashboard.comparasion.location.dummy.json b/src/dummy/dashboard/dashboard.comparasion.location.dummy.json deleted file mode 100644 index 8404a931..00000000 --- a/src/dummy/dashboard/dashboard.comparasion.location.dummy.json +++ /dev/null @@ -1,1796 +0,0 @@ -{ - "statistics_data": [ - { - "label": "HPP Global", - "value": 16200, - "percent_last_month": 15.5 - }, - { - "label": "Avg. Selling Price", - "value": 28300, - "percent_last_month": -50 - }, - { - "label": "FCR", - "value": 24.02, - "percent_last_month": 15.5 - }, - { - "label": "Mortality", - "value": 5, - "percent_last_month": -15.5 - } - ], - "charts": { - "body_weight": { - "series": [ - { - "id": "body_weight", - "label": "Body Weight", - "unit": "g" - }, - { - "id": "std_body_weight", - "label": "STD. Body Weight", - "unit": "g" - } - ], - "dataset": [ - { - "week": 1, - "body_weight": 1400, - "std_body_weight": 1480 - }, - { - "week": 2, - "body_weight": 1490, - "std_body_weight": 1580 - }, - { - "week": 3, - "body_weight": 1560, - "std_body_weight": 1650 - }, - { - "week": 4, - "body_weight": 1600, - "std_body_weight": 1700 - }, - { - "week": 5, - "body_weight": 1720, - "std_body_weight": 1750 - }, - { - "week": 6, - "body_weight": 1760, - "std_body_weight": 1750 - }, - { - "week": 7, - "body_weight": 1800, - "std_body_weight": 1770 - }, - { - "week": 8, - "body_weight": 1765, - "std_body_weight": 1770 - }, - { - "week": 9, - "body_weight": 1750, - "std_body_weight": 1780 - }, - { - "week": 10, - "body_weight": 1820, - "std_body_weight": 1800 - }, - { - "week": 11, - "body_weight": 1800, - "std_body_weight": 1790 - }, - { - "week": 12, - "body_weight": 1790, - "std_body_weight": 1780 - }, - { - "week": 13, - "body_weight": 1810, - "std_body_weight": 1770 - }, - { - "week": 14, - "body_weight": 1750, - "std_body_weight": 1780 - }, - { - "week": 15, - "body_weight": 1740, - "std_body_weight": 1800 - }, - { - "week": 16, - "body_weight": 1740, - "std_body_weight": 1820 - }, - { - "week": 17, - "body_weight": 1800, - "std_body_weight": 1830 - }, - { - "week": 18, - "body_weight": 1830, - "std_body_weight": 1840 - }, - { - "week": 19, - "body_weight": 1830, - "std_body_weight": 1840 - }, - { - "week": 20, - "body_weight": 1810, - "std_body_weight": 1845 - }, - { - "week": 21, - "body_weight": 1800, - "std_body_weight": 1850 - }, - { - "week": 22, - "body_weight": 1830, - "std_body_weight": 1855 - }, - { - "week": 23, - "body_weight": 1810, - "std_body_weight": 1860 - }, - { - "week": 24, - "body_weight": 1840, - "std_body_weight": 1870 - }, - { - "week": 25, - "body_weight": 1800, - "std_body_weight": 1880 - }, - { - "week": 26, - "body_weight": 1880, - "std_body_weight": 1900 - }, - { - "week": 27, - "body_weight": 1910, - "std_body_weight": 1910 - }, - { - "week": 28, - "body_weight": 1900, - "std_body_weight": 1920 - }, - { - "week": 29, - "body_weight": 1840, - "std_body_weight": 1925 - }, - { - "week": 30, - "body_weight": 1810, - "std_body_weight": 1930 - }, - { - "week": 31, - "body_weight": 1780, - "std_body_weight": 1935 - }, - { - "week": 32, - "body_weight": 1820, - "std_body_weight": 1940 - }, - { - "week": 33, - "body_weight": 1800, - "std_body_weight": 1945 - }, - { - "week": 34, - "body_weight": 1770, - "std_body_weight": 1950 - }, - { - "week": 35, - "body_weight": 1840, - "std_body_weight": 1955 - }, - { - "week": 36, - "body_weight": 1810, - "std_body_weight": 1960 - }, - { - "week": 37, - "body_weight": 1780, - "std_body_weight": 1965 - }, - { - "week": 38, - "body_weight": 1820, - "std_body_weight": 1970 - }, - { - "week": 39, - "body_weight": 1770, - "std_body_weight": 1970 - }, - { - "week": 40, - "body_weight": 1840, - "std_body_weight": 1975 - }, - { - "week": 41, - "body_weight": 1820, - "std_body_weight": 1975 - }, - { - "week": 42, - "body_weight": 1790, - "std_body_weight": 1975 - }, - { - "week": 43, - "body_weight": 1860, - "std_body_weight": 1980 - }, - { - "week": 44, - "body_weight": 1820, - "std_body_weight": 1980 - }, - { - "week": 45, - "body_weight": 1800, - "std_body_weight": 1980 - }, - { - "week": 46, - "body_weight": 1840, - "std_body_weight": 1985 - }, - { - "week": 47, - "body_weight": 1790, - "std_body_weight": 1990 - }, - { - "week": 48, - "body_weight": 1910, - "std_body_weight": 1990 - }, - { - "week": 49, - "body_weight": 1950, - "std_body_weight": 1995 - }, - { - "week": 50, - "body_weight": 1910, - "std_body_weight": 2000 - } - ] - }, - "performance": { - "series": [ - { - "id": "act_laying", - "label": "Act. % Laying", - "unit": "%" - }, - { - "id": "std_laying", - "label": "STD. % Laying", - "unit": "%" - }, - { - "id": "act_egg_weight", - "label": "Act. Egg Weight", - "unit": "%" - }, - { - "id": "std_egg_weight", - "label": "STD. Egg Weight", - "unit": "%" - }, - { - "id": "act_feed_intake", - "label": "Act. Feed Intake", - "unit": "%" - }, - { - "id": "std_feed_intake", - "label": "STD. Feed Intake", - "unit": "%" - }, - { - "id": "act_uniformity", - "label": "Act. Uniformity", - "unit": "%" - }, - { - "id": "std_uniformity", - "label": "STD. Uniformity", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "act_laying": 60, - "std_laying": 63, - "act_egg_weight": 53, - "std_egg_weight": 54, - "act_feed_intake": 76, - "std_feed_intake": 75, - "act_uniformity": 85, - "std_uniformity": 85 - }, - { - "week": 2, - "act_laying": 64, - "std_laying": 68, - "act_egg_weight": 54, - "std_egg_weight": 55, - "act_feed_intake": 78, - "std_feed_intake": 76, - "act_uniformity": 85, - "std_uniformity": 85 - }, - { - "week": 3, - "act_laying": 68, - "std_laying": 72, - "act_egg_weight": 54, - "std_egg_weight": 57, - "act_feed_intake": 81, - "std_feed_intake": 77, - "act_uniformity": 86, - "std_uniformity": 85 - }, - { - "week": 4, - "act_laying": 70, - "std_laying": 76, - "act_egg_weight": 56, - "std_egg_weight": 60, - "act_feed_intake": 84, - "std_feed_intake": 78, - "act_uniformity": 86, - "std_uniformity": 85 - }, - { - "week": 5, - "act_laying": 76, - "std_laying": 78, - "act_egg_weight": 60, - "std_egg_weight": 64, - "act_feed_intake": 86, - "std_feed_intake": 78, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 6, - "act_laying": 78, - "std_laying": 78, - "act_egg_weight": 64, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 7, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 68, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 8, - "act_laying": 78, - "std_laying": 79, - "act_egg_weight": 72, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 9, - "act_laying": 81, - "std_laying": 78, - "act_egg_weight": 75, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 10, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 76, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 11, - "act_laying": 79, - "std_laying": 79, - "act_egg_weight": 75, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 12, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 77, - "std_egg_weight": 68, - "act_feed_intake": 88, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 13, - "act_laying": 81, - "std_laying": 78, - "act_egg_weight": 77, - "std_egg_weight": 68, - "act_feed_intake": 89, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 14, - "act_laying": 78, - "std_laying": 79, - "act_egg_weight": 78, - "std_egg_weight": 69, - "act_feed_intake": 88, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 15, - "act_laying": 77, - "std_laying": 79, - "act_egg_weight": 77, - "std_egg_weight": 70, - "act_feed_intake": 87, - "std_feed_intake": 80, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 16, - "act_laying": 77, - "std_laying": 80, - "act_egg_weight": 78, - "std_egg_weight": 70, - "act_feed_intake": 86, - "std_feed_intake": 80, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 17, - "act_laying": 80, - "std_laying": 80, - "act_egg_weight": 80, - "std_egg_weight": 72, - "act_feed_intake": 88, - "std_feed_intake": 81, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 18, - "act_laying": 82, - "std_laying": 81, - "act_egg_weight": 83, - "std_egg_weight": 73, - "act_feed_intake": 88, - "std_feed_intake": 81, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 19, - "act_laying": 82, - "std_laying": 82, - "act_egg_weight": 84, - "std_egg_weight": 73, - "act_feed_intake": 88, - "std_feed_intake": 82, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 20, - "act_laying": 81, - "std_laying": 82, - "act_egg_weight": 82, - "std_egg_weight": 74, - "act_feed_intake": 88, - "std_feed_intake": 82, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 21, - "act_laying": 80, - "std_laying": 83, - "act_egg_weight": 82, - "std_egg_weight": 74, - "act_feed_intake": 88, - "std_feed_intake": 83, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 22, - "act_laying": 82, - "std_laying": 83, - "act_egg_weight": 82, - "std_egg_weight": 75, - "act_feed_intake": 89, - "std_feed_intake": 83, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 23, - "act_laying": 80, - "std_laying": 84, - "act_egg_weight": 84, - "std_egg_weight": 75, - "act_feed_intake": 88, - "std_feed_intake": 84, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 24, - "act_laying": 82, - "std_laying": 84, - "act_egg_weight": 82, - "std_egg_weight": 76, - "act_feed_intake": 88, - "std_feed_intake": 84, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 25, - "act_laying": 84, - "std_laying": 85, - "act_egg_weight": 83, - "std_egg_weight": 76, - "act_feed_intake": 88, - "std_feed_intake": 85, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 26, - "act_laying": 86, - "std_laying": 86, - "act_egg_weight": 87, - "std_egg_weight": 77, - "act_feed_intake": 89, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 27, - "act_laying": 87, - "std_laying": 86, - "act_egg_weight": 88, - "std_egg_weight": 77, - "act_feed_intake": 89, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 28, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 84, - "std_egg_weight": 77, - "act_feed_intake": 88, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 29, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 77, - "act_feed_intake": 87, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 30, - "act_laying": 79, - "std_laying": 86, - "act_egg_weight": 80, - "std_egg_weight": 78, - "act_feed_intake": 86, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 31, - "act_laying": 81, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 78, - "act_feed_intake": 87, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 32, - "act_laying": 79, - "std_laying": 85, - "act_egg_weight": 80, - "std_egg_weight": 78, - "act_feed_intake": 86, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 33, - "act_laying": 82, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 78, - "act_feed_intake": 88, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 34, - "act_laying": 80, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 78, - "act_feed_intake": 88, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 35, - "act_laying": 83, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 36, - "act_laying": 81, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 37, - "act_laying": 83, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 38, - "act_laying": 80, - "std_laying": 85, - "act_egg_weight": 81, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 39, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 40, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 41, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 42, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 43, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 44, - "act_laying": 80, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 45, - "act_laying": 84, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 46, - "act_laying": 82, - "std_laying": 87, - "act_egg_weight": 83, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 47, - "act_laying": 84, - "std_laying": 87, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 48, - "act_laying": 82, - "std_laying": 87, - "act_egg_weight": 83, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 49, - "act_laying": 88, - "std_laying": 88, - "act_egg_weight": 90, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 90, - "std_uniformity": 85 - }, - { - "week": 50, - "act_laying": 85, - "std_laying": 88, - "act_egg_weight": 87, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - } - ] - }, - "fcr": { - "series": [ - { - "id": "act_fcr", - "label": "Act. FCR", - "unit": "" - }, - { - "id": "std_fcr", - "label": "STD. FCR", - "unit": "" - }, - { - "id": "act_fcr_cum", - "label": "Act. FCR Cumulative", - "unit": "" - }, - { - "id": "std_fcr_cum", - "label": "STD. FCR Cumulative", - "unit": "" - } - ], - "dataset": [ - { - "week": 1, - "act_fcr": 1.42, - "std_fcr": 1.45, - "act_fcr_cum": 1.42, - "std_fcr_cum": 1.45 - }, - { - "week": 2, - "act_fcr": 1.48, - "std_fcr": 1.5, - "act_fcr_cum": 1.45, - "std_fcr_cum": 1.48 - }, - { - "week": 3, - "act_fcr": 1.55, - "std_fcr": 1.55, - "act_fcr_cum": 1.48, - "std_fcr_cum": 1.51 - }, - { - "week": 4, - "act_fcr": 1.62, - "std_fcr": 1.6, - "act_fcr_cum": 1.52, - "std_fcr_cum": 1.54 - }, - { - "week": 5, - "act_fcr": 1.68, - "std_fcr": 1.65, - "act_fcr_cum": 1.56, - "std_fcr_cum": 1.57 - }, - { - "week": 6, - "act_fcr": 1.72, - "std_fcr": 1.7, - "act_fcr_cum": 1.6, - "std_fcr_cum": 1.6 - }, - { - "week": 7, - "act_fcr": 1.75, - "std_fcr": 1.75, - "act_fcr_cum": 1.63, - "std_fcr_cum": 1.64 - }, - { - "week": 8, - "act_fcr": 1.82, - "std_fcr": 1.8, - "act_fcr_cum": 1.67, - "std_fcr_cum": 1.68 - }, - { - "week": 9, - "act_fcr": 1.88, - "std_fcr": 1.85, - "act_fcr_cum": 1.7, - "std_fcr_cum": 1.72 - }, - { - "week": 10, - "act_fcr": 1.95, - "std_fcr": 1.9, - "act_fcr_cum": 1.75, - "std_fcr_cum": 1.75 - }, - { - "week": 11, - "act_fcr": 2.02, - "std_fcr": 2.0, - "act_fcr_cum": 1.78, - "std_fcr_cum": 1.79 - }, - { - "week": 12, - "act_fcr": 2.08, - "std_fcr": 2.1, - "act_fcr_cum": 1.82, - "std_fcr_cum": 1.83 - }, - { - "week": 13, - "act_fcr": 2.15, - "std_fcr": 2.15, - "act_fcr_cum": 1.86, - "std_fcr_cum": 1.87 - }, - { - "week": 14, - "act_fcr": 2.22, - "std_fcr": 2.2, - "act_fcr_cum": 1.9, - "std_fcr_cum": 1.91 - }, - { - "week": 15, - "act_fcr": 2.28, - "std_fcr": 2.25, - "act_fcr_cum": 1.94, - "std_fcr_cum": 1.95 - }, - { - "week": 16, - "act_fcr": 2.35, - "std_fcr": 2.3, - "act_fcr_cum": 1.98, - "std_fcr_cum": 1.99 - }, - { - "week": 17, - "act_fcr": 2.42, - "std_fcr": 2.4, - "act_fcr_cum": 2.02, - "std_fcr_cum": 2.03 - }, - { - "week": 18, - "act_fcr": 2.48, - "std_fcr": 2.5, - "act_fcr_cum": 2.06, - "std_fcr_cum": 2.07 - }, - { - "week": 19, - "act_fcr": 2.55, - "std_fcr": 2.55, - "act_fcr_cum": 2.1, - "std_fcr_cum": 2.11 - }, - { - "week": 20, - "act_fcr": 2.62, - "std_fcr": 2.6, - "act_fcr_cum": 2.15, - "std_fcr_cum": 2.15 - }, - { - "week": 21, - "act_fcr": 2.68, - "std_fcr": 2.7, - "act_fcr_cum": 2.19, - "std_fcr_cum": 2.19 - }, - { - "week": 22, - "act_fcr": 2.75, - "std_fcr": 2.75, - "act_fcr_cum": 2.23, - "std_fcr_cum": 2.23 - }, - { - "week": 23, - "act_fcr": 2.82, - "std_fcr": 2.8, - "act_fcr_cum": 2.27, - "std_fcr_cum": 2.27 - }, - { - "week": 24, - "act_fcr": 2.88, - "std_fcr": 2.9, - "act_fcr_cum": 2.31, - "std_fcr_cum": 2.31 - }, - { - "week": 25, - "act_fcr": 2.95, - "std_fcr": 2.95, - "act_fcr_cum": 2.35, - "std_fcr_cum": 2.35 - }, - { - "week": 26, - "act_fcr": 3.02, - "std_fcr": 3.0, - "act_fcr_cum": 2.39, - "std_fcr_cum": 2.39 - }, - { - "week": 27, - "act_fcr": 3.08, - "std_fcr": 3.1, - "act_fcr_cum": 2.43, - "std_fcr_cum": 2.43 - }, - { - "week": 28, - "act_fcr": 3.15, - "std_fcr": 3.15, - "act_fcr_cum": 2.47, - "std_fcr_cum": 2.47 - }, - { - "week": 29, - "act_fcr": 3.22, - "std_fcr": 3.2, - "act_fcr_cum": 2.51, - "std_fcr_cum": 2.51 - }, - { - "week": 30, - "act_fcr": 3.28, - "std_fcr": 3.3, - "act_fcr_cum": 2.55, - "std_fcr_cum": 2.55 - }, - { - "week": 31, - "act_fcr": 3.35, - "std_fcr": 3.35, - "act_fcr_cum": 2.59, - "std_fcr_cum": 2.59 - }, - { - "week": 32, - "act_fcr": 3.42, - "std_fcr": 3.4, - "act_fcr_cum": 2.63, - "std_fcr_cum": 2.63 - }, - { - "week": 33, - "act_fcr": 3.48, - "std_fcr": 3.5, - "act_fcr_cum": 2.67, - "std_fcr_cum": 2.67 - }, - { - "week": 34, - "act_fcr": 3.55, - "std_fcr": 3.55, - "act_fcr_cum": 2.71, - "std_fcr_cum": 2.71 - }, - { - "week": 35, - "act_fcr": 3.62, - "std_fcr": 3.6, - "act_fcr_cum": 2.75, - "std_fcr_cum": 2.75 - }, - { - "week": 36, - "act_fcr": 3.68, - "std_fcr": 3.7, - "act_fcr_cum": 2.79, - "std_fcr_cum": 2.79 - }, - { - "week": 37, - "act_fcr": 3.75, - "std_fcr": 3.75, - "act_fcr_cum": 2.83, - "std_fcr_cum": 2.83 - }, - { - "week": 38, - "act_fcr": 3.82, - "std_fcr": 3.8, - "act_fcr_cum": 2.87, - "std_fcr_cum": 2.87 - }, - { - "week": 39, - "act_fcr": 3.88, - "std_fcr": 3.9, - "act_fcr_cum": 2.91, - "std_fcr_cum": 2.91 - }, - { - "week": 40, - "act_fcr": 3.95, - "std_fcr": 3.95, - "act_fcr_cum": 2.95, - "std_fcr_cum": 2.95 - }, - { - "week": 41, - "act_fcr": 4.02, - "std_fcr": 4.0, - "act_fcr_cum": 2.99, - "std_fcr_cum": 2.99 - }, - { - "week": 42, - "act_fcr": 4.08, - "std_fcr": 4.1, - "act_fcr_cum": 3.03, - "std_fcr_cum": 3.03 - }, - { - "week": 43, - "act_fcr": 4.15, - "std_fcr": 4.15, - "act_fcr_cum": 3.07, - "std_fcr_cum": 3.07 - }, - { - "week": 44, - "act_fcr": 4.22, - "std_fcr": 4.2, - "act_fcr_cum": 3.11, - "std_fcr_cum": 3.11 - }, - { - "week": 45, - "act_fcr": 4.28, - "std_fcr": 4.3, - "act_fcr_cum": 3.15, - "std_fcr_cum": 3.15 - }, - { - "week": 46, - "act_fcr": 4.35, - "std_fcr": 4.35, - "act_fcr_cum": 3.19, - "std_fcr_cum": 3.19 - }, - { - "week": 47, - "act_fcr": 4.42, - "std_fcr": 4.4, - "act_fcr_cum": 3.23, - "std_fcr_cum": 3.23 - }, - { - "week": 48, - "act_fcr": 4.48, - "std_fcr": 4.5, - "act_fcr_cum": 3.27, - "std_fcr_cum": 3.27 - }, - { - "week": 49, - "act_fcr": 4.55, - "std_fcr": 4.55, - "act_fcr_cum": 3.31, - "std_fcr_cum": 3.31 - }, - { - "week": 50, - "act_fcr": 4.62, - "std_fcr": 4.6, - "act_fcr_cum": 3.35, - "std_fcr_cum": 3.35 - } - ] - }, - "quality_control": { - "series": [ - { - "id": "normal", - "label": "Normal", - "unit": "%" - }, - { - "id": "abnormal", - "label": "Abnormal", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "normal": 6.8, - "abnormal": 5.65 - }, - { - "week": 2, - "normal": 7.05, - "abnormal": 5.68 - }, - { - "week": 3, - "normal": 7.2, - "abnormal": 5.72 - }, - { - "week": 4, - "normal": 7.3, - "abnormal": 5.69 - }, - { - "week": 5, - "normal": 7.32, - "abnormal": 5.75 - }, - { - "week": 6, - "normal": 7.4, - "abnormal": 6.0 - }, - { - "week": 7, - "normal": 7.35, - "abnormal": 6.22 - }, - { - "week": 8, - "normal": 7.42, - "abnormal": 6.45 - }, - { - "week": 9, - "normal": 7.38, - "abnormal": 6.68 - }, - { - "week": 10, - "normal": 7.35, - "abnormal": 6.75 - }, - { - "week": 11, - "normal": 7.42, - "abnormal": 6.78 - }, - { - "week": 12, - "normal": 7.39, - "abnormal": 6.82 - }, - { - "week": 13, - "normal": 7.35, - "abnormal": 6.8 - }, - { - "week": 14, - "normal": 7.4, - "abnormal": 6.9 - }, - { - "week": 15, - "normal": 7.45, - "abnormal": 6.95 - }, - { - "week": 16, - "normal": 7.42, - "abnormal": 7.05 - }, - { - "week": 17, - "normal": 7.38, - "abnormal": 7.12 - }, - { - "week": 18, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 19, - "normal": 7.48, - "abnormal": 7.2 - }, - { - "week": 20, - "normal": 7.4, - "abnormal": 7.15 - }, - { - "week": 21, - "normal": 7.42, - "abnormal": 7.1 - }, - { - "week": 22, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 23, - "normal": 7.4, - "abnormal": 7.12 - }, - { - "week": 24, - "normal": 7.48, - "abnormal": 7.08 - }, - { - "week": 25, - "normal": 7.5, - "abnormal": 7.15 - }, - { - "week": 26, - "normal": 7.45, - "abnormal": 7.25 - }, - { - "week": 27, - "normal": 7.4, - "abnormal": 7.32 - }, - { - "week": 28, - "normal": 7.48, - "abnormal": 7.37 - }, - { - "week": 29, - "normal": 7.52, - "abnormal": 7.2 - }, - { - "week": 30, - "normal": 7.45, - "abnormal": 7.15 - }, - { - "week": 31, - "normal": 7.4, - "abnormal": 7.0 - }, - { - "week": 32, - "normal": 7.42, - "abnormal": 7.12 - }, - { - "week": 33, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 34, - "normal": 7.38, - "abnormal": 7.1 - }, - { - "week": 35, - "normal": 7.4, - "abnormal": 7.22 - }, - { - "week": 36, - "normal": 7.45, - "abnormal": 7.05 - }, - { - "week": 37, - "normal": 7.42, - "abnormal": 7.15 - }, - { - "week": 38, - "normal": 7.38, - "abnormal": 7.22 - }, - { - "week": 39, - "normal": 7.4, - "abnormal": 7.0 - }, - { - "week": 40, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 41, - "normal": 7.42, - "abnormal": 7.22 - }, - { - "week": 42, - "normal": 7.39, - "abnormal": 7.1 - }, - { - "week": 43, - "normal": 7.42, - "abnormal": 7.25 - }, - { - "week": 44, - "normal": 7.38, - "abnormal": 7.15 - }, - { - "week": 45, - "normal": 7.45, - "abnormal": 7.28 - }, - { - "week": 46, - "normal": 7.48, - "abnormal": 7.35 - }, - { - "week": 47, - "normal": 7.42, - "abnormal": 7.45 - }, - { - "week": 48, - "normal": 7.45, - "abnormal": 7.48 - }, - { - "week": 49, - "normal": 7.5, - "abnormal": 7.42 - }, - { - "week": 50, - "normal": 7.48, - "abnormal": 7.35 - } - ] - }, - "deplesi": { - "series": [ - { - "id": "act_deplesi", - "label": "Act. Deplesi", - "unit": "g" - }, - { - "id": "std_deplesi", - "label": "STD. Deplesi", - "unit": "g" - } - ], - "dataset": [ - { - "week": 1, - "act_deplesi": 1400, - "std_deplesi": 1480 - }, - { - "week": 2, - "act_deplesi": 1490, - "std_deplesi": 1580 - }, - { - "week": 3, - "act_deplesi": 1560, - "std_deplesi": 1650 - }, - { - "week": 4, - "act_deplesi": 1600, - "std_deplesi": 1700 - }, - { - "week": 5, - "act_deplesi": 1720, - "std_deplesi": 1750 - }, - { - "week": 6, - "act_deplesi": 1760, - "std_deplesi": 1750 - }, - { - "week": 7, - "act_deplesi": 1800, - "std_deplesi": 1770 - }, - { - "week": 8, - "act_deplesi": 1765, - "std_deplesi": 1770 - }, - { - "week": 9, - "act_deplesi": 1750, - "std_deplesi": 1780 - }, - { - "week": 10, - "act_deplesi": 1820, - "std_deplesi": 1800 - }, - { - "week": 11, - "act_deplesi": 1800, - "std_deplesi": 1790 - }, - { - "week": 12, - "act_deplesi": 1790, - "std_deplesi": 1780 - }, - { - "week": 13, - "act_deplesi": 1810, - "std_deplesi": 1770 - }, - { - "week": 14, - "act_deplesi": 1750, - "std_deplesi": 1780 - }, - { - "week": 15, - "act_deplesi": 1740, - "std_deplesi": 1800 - }, - { - "week": 16, - "act_deplesi": 1740, - "std_deplesi": 1820 - }, - { - "week": 17, - "act_deplesi": 1800, - "std_deplesi": 1830 - }, - { - "week": 18, - "act_deplesi": 1830, - "std_deplesi": 1840 - }, - { - "week": 19, - "act_deplesi": 1830, - "std_deplesi": 1840 - }, - { - "week": 20, - "act_deplesi": 1810, - "std_deplesi": 1845 - }, - { - "week": 21, - "act_deplesi": 1800, - "std_deplesi": 1850 - }, - { - "week": 22, - "act_deplesi": 1830, - "std_deplesi": 1855 - }, - { - "week": 23, - "act_deplesi": 1810, - "std_deplesi": 1860 - }, - { - "week": 24, - "act_deplesi": 1840, - "std_deplesi": 1870 - }, - { - "week": 25, - "act_deplesi": 1800, - "std_deplesi": 1880 - }, - { - "week": 26, - "act_deplesi": 1880, - "std_deplesi": 1900 - }, - { - "week": 27, - "act_deplesi": 1910, - "std_deplesi": 1910 - }, - { - "week": 28, - "act_deplesi": 1900, - "std_deplesi": 1920 - }, - { - "week": 29, - "act_deplesi": 1840, - "std_deplesi": 1925 - }, - { - "week": 30, - "act_deplesi": 1810, - "std_deplesi": 1930 - }, - { - "week": 31, - "act_deplesi": 1780, - "std_deplesi": 1935 - }, - { - "week": 32, - "act_deplesi": 1820, - "std_deplesi": 1940 - }, - { - "week": 33, - "act_deplesi": 1800, - "std_deplesi": 1945 - }, - { - "week": 34, - "act_deplesi": 1770, - "std_deplesi": 1950 - }, - { - "week": 35, - "act_deplesi": 1840, - "std_deplesi": 1955 - }, - { - "week": 36, - "act_deplesi": 1810, - "std_deplesi": 1960 - }, - { - "week": 37, - "act_deplesi": 1780, - "std_deplesi": 1965 - }, - { - "week": 38, - "act_deplesi": 1820, - "std_deplesi": 1970 - }, - { - "week": 39, - "act_deplesi": 1770, - "std_deplesi": 1970 - }, - { - "week": 40, - "act_deplesi": 1840, - "std_deplesi": 1975 - }, - { - "week": 41, - "act_deplesi": 1820, - "std_deplesi": 1975 - }, - { - "week": 42, - "act_deplesi": 1790, - "std_deplesi": 1975 - }, - { - "week": 43, - "act_deplesi": 1860, - "std_deplesi": 1980 - }, - { - "week": 44, - "act_deplesi": 1820, - "std_deplesi": 1980 - }, - { - "week": 45, - "act_deplesi": 1800, - "std_deplesi": 1980 - }, - { - "week": 46, - "act_deplesi": 1840, - "std_deplesi": 1985 - }, - { - "week": 47, - "act_deplesi": 1790, - "std_deplesi": 1990 - }, - { - "week": 48, - "act_deplesi": 1910, - "std_deplesi": 1990 - }, - { - "week": 49, - "act_deplesi": 1950, - "std_deplesi": 1995 - }, - { - "week": 50, - "act_deplesi": 1910, - "std_deplesi": 2000 - } - ] - } - } -} diff --git a/src/dummy/dashboard/dashboard.default.json b/src/dummy/dashboard/dashboard.default.json deleted file mode 100644 index 7e657aeb..00000000 --- a/src/dummy/dashboard/dashboard.default.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "statistics_data": [ - { - "label": "HPP Global", - "value": 16200, - "percent_last_month": 15.5 - }, - { - "label": "Avg. Selling Price", - "value": 28300, - "percent_last_month": -50 - } - ], - "charts": {} -} diff --git a/src/dummy/dashboard/dashboard.overview.dummy.json b/src/dummy/dashboard/dashboard.overview.dummy.json deleted file mode 100644 index 8404a931..00000000 --- a/src/dummy/dashboard/dashboard.overview.dummy.json +++ /dev/null @@ -1,1796 +0,0 @@ -{ - "statistics_data": [ - { - "label": "HPP Global", - "value": 16200, - "percent_last_month": 15.5 - }, - { - "label": "Avg. Selling Price", - "value": 28300, - "percent_last_month": -50 - }, - { - "label": "FCR", - "value": 24.02, - "percent_last_month": 15.5 - }, - { - "label": "Mortality", - "value": 5, - "percent_last_month": -15.5 - } - ], - "charts": { - "body_weight": { - "series": [ - { - "id": "body_weight", - "label": "Body Weight", - "unit": "g" - }, - { - "id": "std_body_weight", - "label": "STD. Body Weight", - "unit": "g" - } - ], - "dataset": [ - { - "week": 1, - "body_weight": 1400, - "std_body_weight": 1480 - }, - { - "week": 2, - "body_weight": 1490, - "std_body_weight": 1580 - }, - { - "week": 3, - "body_weight": 1560, - "std_body_weight": 1650 - }, - { - "week": 4, - "body_weight": 1600, - "std_body_weight": 1700 - }, - { - "week": 5, - "body_weight": 1720, - "std_body_weight": 1750 - }, - { - "week": 6, - "body_weight": 1760, - "std_body_weight": 1750 - }, - { - "week": 7, - "body_weight": 1800, - "std_body_weight": 1770 - }, - { - "week": 8, - "body_weight": 1765, - "std_body_weight": 1770 - }, - { - "week": 9, - "body_weight": 1750, - "std_body_weight": 1780 - }, - { - "week": 10, - "body_weight": 1820, - "std_body_weight": 1800 - }, - { - "week": 11, - "body_weight": 1800, - "std_body_weight": 1790 - }, - { - "week": 12, - "body_weight": 1790, - "std_body_weight": 1780 - }, - { - "week": 13, - "body_weight": 1810, - "std_body_weight": 1770 - }, - { - "week": 14, - "body_weight": 1750, - "std_body_weight": 1780 - }, - { - "week": 15, - "body_weight": 1740, - "std_body_weight": 1800 - }, - { - "week": 16, - "body_weight": 1740, - "std_body_weight": 1820 - }, - { - "week": 17, - "body_weight": 1800, - "std_body_weight": 1830 - }, - { - "week": 18, - "body_weight": 1830, - "std_body_weight": 1840 - }, - { - "week": 19, - "body_weight": 1830, - "std_body_weight": 1840 - }, - { - "week": 20, - "body_weight": 1810, - "std_body_weight": 1845 - }, - { - "week": 21, - "body_weight": 1800, - "std_body_weight": 1850 - }, - { - "week": 22, - "body_weight": 1830, - "std_body_weight": 1855 - }, - { - "week": 23, - "body_weight": 1810, - "std_body_weight": 1860 - }, - { - "week": 24, - "body_weight": 1840, - "std_body_weight": 1870 - }, - { - "week": 25, - "body_weight": 1800, - "std_body_weight": 1880 - }, - { - "week": 26, - "body_weight": 1880, - "std_body_weight": 1900 - }, - { - "week": 27, - "body_weight": 1910, - "std_body_weight": 1910 - }, - { - "week": 28, - "body_weight": 1900, - "std_body_weight": 1920 - }, - { - "week": 29, - "body_weight": 1840, - "std_body_weight": 1925 - }, - { - "week": 30, - "body_weight": 1810, - "std_body_weight": 1930 - }, - { - "week": 31, - "body_weight": 1780, - "std_body_weight": 1935 - }, - { - "week": 32, - "body_weight": 1820, - "std_body_weight": 1940 - }, - { - "week": 33, - "body_weight": 1800, - "std_body_weight": 1945 - }, - { - "week": 34, - "body_weight": 1770, - "std_body_weight": 1950 - }, - { - "week": 35, - "body_weight": 1840, - "std_body_weight": 1955 - }, - { - "week": 36, - "body_weight": 1810, - "std_body_weight": 1960 - }, - { - "week": 37, - "body_weight": 1780, - "std_body_weight": 1965 - }, - { - "week": 38, - "body_weight": 1820, - "std_body_weight": 1970 - }, - { - "week": 39, - "body_weight": 1770, - "std_body_weight": 1970 - }, - { - "week": 40, - "body_weight": 1840, - "std_body_weight": 1975 - }, - { - "week": 41, - "body_weight": 1820, - "std_body_weight": 1975 - }, - { - "week": 42, - "body_weight": 1790, - "std_body_weight": 1975 - }, - { - "week": 43, - "body_weight": 1860, - "std_body_weight": 1980 - }, - { - "week": 44, - "body_weight": 1820, - "std_body_weight": 1980 - }, - { - "week": 45, - "body_weight": 1800, - "std_body_weight": 1980 - }, - { - "week": 46, - "body_weight": 1840, - "std_body_weight": 1985 - }, - { - "week": 47, - "body_weight": 1790, - "std_body_weight": 1990 - }, - { - "week": 48, - "body_weight": 1910, - "std_body_weight": 1990 - }, - { - "week": 49, - "body_weight": 1950, - "std_body_weight": 1995 - }, - { - "week": 50, - "body_weight": 1910, - "std_body_weight": 2000 - } - ] - }, - "performance": { - "series": [ - { - "id": "act_laying", - "label": "Act. % Laying", - "unit": "%" - }, - { - "id": "std_laying", - "label": "STD. % Laying", - "unit": "%" - }, - { - "id": "act_egg_weight", - "label": "Act. Egg Weight", - "unit": "%" - }, - { - "id": "std_egg_weight", - "label": "STD. Egg Weight", - "unit": "%" - }, - { - "id": "act_feed_intake", - "label": "Act. Feed Intake", - "unit": "%" - }, - { - "id": "std_feed_intake", - "label": "STD. Feed Intake", - "unit": "%" - }, - { - "id": "act_uniformity", - "label": "Act. Uniformity", - "unit": "%" - }, - { - "id": "std_uniformity", - "label": "STD. Uniformity", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "act_laying": 60, - "std_laying": 63, - "act_egg_weight": 53, - "std_egg_weight": 54, - "act_feed_intake": 76, - "std_feed_intake": 75, - "act_uniformity": 85, - "std_uniformity": 85 - }, - { - "week": 2, - "act_laying": 64, - "std_laying": 68, - "act_egg_weight": 54, - "std_egg_weight": 55, - "act_feed_intake": 78, - "std_feed_intake": 76, - "act_uniformity": 85, - "std_uniformity": 85 - }, - { - "week": 3, - "act_laying": 68, - "std_laying": 72, - "act_egg_weight": 54, - "std_egg_weight": 57, - "act_feed_intake": 81, - "std_feed_intake": 77, - "act_uniformity": 86, - "std_uniformity": 85 - }, - { - "week": 4, - "act_laying": 70, - "std_laying": 76, - "act_egg_weight": 56, - "std_egg_weight": 60, - "act_feed_intake": 84, - "std_feed_intake": 78, - "act_uniformity": 86, - "std_uniformity": 85 - }, - { - "week": 5, - "act_laying": 76, - "std_laying": 78, - "act_egg_weight": 60, - "std_egg_weight": 64, - "act_feed_intake": 86, - "std_feed_intake": 78, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 6, - "act_laying": 78, - "std_laying": 78, - "act_egg_weight": 64, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 7, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 68, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 8, - "act_laying": 78, - "std_laying": 79, - "act_egg_weight": 72, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 9, - "act_laying": 81, - "std_laying": 78, - "act_egg_weight": 75, - "std_egg_weight": 67, - "act_feed_intake": 87, - "std_feed_intake": 78, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 10, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 76, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 11, - "act_laying": 79, - "std_laying": 79, - "act_egg_weight": 75, - "std_egg_weight": 67, - "act_feed_intake": 88, - "std_feed_intake": 78, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 12, - "act_laying": 80, - "std_laying": 78, - "act_egg_weight": 77, - "std_egg_weight": 68, - "act_feed_intake": 88, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 13, - "act_laying": 81, - "std_laying": 78, - "act_egg_weight": 77, - "std_egg_weight": 68, - "act_feed_intake": 89, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 14, - "act_laying": 78, - "std_laying": 79, - "act_egg_weight": 78, - "std_egg_weight": 69, - "act_feed_intake": 88, - "std_feed_intake": 79, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 15, - "act_laying": 77, - "std_laying": 79, - "act_egg_weight": 77, - "std_egg_weight": 70, - "act_feed_intake": 87, - "std_feed_intake": 80, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 16, - "act_laying": 77, - "std_laying": 80, - "act_egg_weight": 78, - "std_egg_weight": 70, - "act_feed_intake": 86, - "std_feed_intake": 80, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 17, - "act_laying": 80, - "std_laying": 80, - "act_egg_weight": 80, - "std_egg_weight": 72, - "act_feed_intake": 88, - "std_feed_intake": 81, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 18, - "act_laying": 82, - "std_laying": 81, - "act_egg_weight": 83, - "std_egg_weight": 73, - "act_feed_intake": 88, - "std_feed_intake": 81, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 19, - "act_laying": 82, - "std_laying": 82, - "act_egg_weight": 84, - "std_egg_weight": 73, - "act_feed_intake": 88, - "std_feed_intake": 82, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 20, - "act_laying": 81, - "std_laying": 82, - "act_egg_weight": 82, - "std_egg_weight": 74, - "act_feed_intake": 88, - "std_feed_intake": 82, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 21, - "act_laying": 80, - "std_laying": 83, - "act_egg_weight": 82, - "std_egg_weight": 74, - "act_feed_intake": 88, - "std_feed_intake": 83, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 22, - "act_laying": 82, - "std_laying": 83, - "act_egg_weight": 82, - "std_egg_weight": 75, - "act_feed_intake": 89, - "std_feed_intake": 83, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 23, - "act_laying": 80, - "std_laying": 84, - "act_egg_weight": 84, - "std_egg_weight": 75, - "act_feed_intake": 88, - "std_feed_intake": 84, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 24, - "act_laying": 82, - "std_laying": 84, - "act_egg_weight": 82, - "std_egg_weight": 76, - "act_feed_intake": 88, - "std_feed_intake": 84, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 25, - "act_laying": 84, - "std_laying": 85, - "act_egg_weight": 83, - "std_egg_weight": 76, - "act_feed_intake": 88, - "std_feed_intake": 85, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 26, - "act_laying": 86, - "std_laying": 86, - "act_egg_weight": 87, - "std_egg_weight": 77, - "act_feed_intake": 89, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 27, - "act_laying": 87, - "std_laying": 86, - "act_egg_weight": 88, - "std_egg_weight": 77, - "act_feed_intake": 89, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 28, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 84, - "std_egg_weight": 77, - "act_feed_intake": 88, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 29, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 77, - "act_feed_intake": 87, - "std_feed_intake": 85, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 30, - "act_laying": 79, - "std_laying": 86, - "act_egg_weight": 80, - "std_egg_weight": 78, - "act_feed_intake": 86, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 31, - "act_laying": 81, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 78, - "act_feed_intake": 87, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 32, - "act_laying": 79, - "std_laying": 85, - "act_egg_weight": 80, - "std_egg_weight": 78, - "act_feed_intake": 86, - "std_feed_intake": 86, - "act_uniformity": 87, - "std_uniformity": 85 - }, - { - "week": 33, - "act_laying": 82, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 78, - "act_feed_intake": 88, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 34, - "act_laying": 80, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 78, - "act_feed_intake": 88, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 35, - "act_laying": 83, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 86, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 36, - "act_laying": 81, - "std_laying": 85, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 37, - "act_laying": 83, - "std_laying": 85, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 38, - "act_laying": 80, - "std_laying": 85, - "act_egg_weight": 81, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 39, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 84, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 40, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 41, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 79, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 42, - "act_laying": 81, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 79, - "act_feed_intake": 88, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 43, - "act_laying": 83, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 87, - "act_uniformity": 88, - "std_uniformity": 85 - }, - { - "week": 44, - "act_laying": 80, - "std_laying": 86, - "act_egg_weight": 82, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 45, - "act_laying": 84, - "std_laying": 86, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 46, - "act_laying": 82, - "std_laying": 87, - "act_egg_weight": 83, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 47, - "act_laying": 84, - "std_laying": 87, - "act_egg_weight": 85, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 48, - "act_laying": 82, - "std_laying": 87, - "act_egg_weight": 83, - "std_egg_weight": 80, - "act_feed_intake": 88, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - }, - { - "week": 49, - "act_laying": 88, - "std_laying": 88, - "act_egg_weight": 90, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 90, - "std_uniformity": 85 - }, - { - "week": 50, - "act_laying": 85, - "std_laying": 88, - "act_egg_weight": 87, - "std_egg_weight": 80, - "act_feed_intake": 89, - "std_feed_intake": 88, - "act_uniformity": 89, - "std_uniformity": 85 - } - ] - }, - "fcr": { - "series": [ - { - "id": "act_fcr", - "label": "Act. FCR", - "unit": "" - }, - { - "id": "std_fcr", - "label": "STD. FCR", - "unit": "" - }, - { - "id": "act_fcr_cum", - "label": "Act. FCR Cumulative", - "unit": "" - }, - { - "id": "std_fcr_cum", - "label": "STD. FCR Cumulative", - "unit": "" - } - ], - "dataset": [ - { - "week": 1, - "act_fcr": 1.42, - "std_fcr": 1.45, - "act_fcr_cum": 1.42, - "std_fcr_cum": 1.45 - }, - { - "week": 2, - "act_fcr": 1.48, - "std_fcr": 1.5, - "act_fcr_cum": 1.45, - "std_fcr_cum": 1.48 - }, - { - "week": 3, - "act_fcr": 1.55, - "std_fcr": 1.55, - "act_fcr_cum": 1.48, - "std_fcr_cum": 1.51 - }, - { - "week": 4, - "act_fcr": 1.62, - "std_fcr": 1.6, - "act_fcr_cum": 1.52, - "std_fcr_cum": 1.54 - }, - { - "week": 5, - "act_fcr": 1.68, - "std_fcr": 1.65, - "act_fcr_cum": 1.56, - "std_fcr_cum": 1.57 - }, - { - "week": 6, - "act_fcr": 1.72, - "std_fcr": 1.7, - "act_fcr_cum": 1.6, - "std_fcr_cum": 1.6 - }, - { - "week": 7, - "act_fcr": 1.75, - "std_fcr": 1.75, - "act_fcr_cum": 1.63, - "std_fcr_cum": 1.64 - }, - { - "week": 8, - "act_fcr": 1.82, - "std_fcr": 1.8, - "act_fcr_cum": 1.67, - "std_fcr_cum": 1.68 - }, - { - "week": 9, - "act_fcr": 1.88, - "std_fcr": 1.85, - "act_fcr_cum": 1.7, - "std_fcr_cum": 1.72 - }, - { - "week": 10, - "act_fcr": 1.95, - "std_fcr": 1.9, - "act_fcr_cum": 1.75, - "std_fcr_cum": 1.75 - }, - { - "week": 11, - "act_fcr": 2.02, - "std_fcr": 2.0, - "act_fcr_cum": 1.78, - "std_fcr_cum": 1.79 - }, - { - "week": 12, - "act_fcr": 2.08, - "std_fcr": 2.1, - "act_fcr_cum": 1.82, - "std_fcr_cum": 1.83 - }, - { - "week": 13, - "act_fcr": 2.15, - "std_fcr": 2.15, - "act_fcr_cum": 1.86, - "std_fcr_cum": 1.87 - }, - { - "week": 14, - "act_fcr": 2.22, - "std_fcr": 2.2, - "act_fcr_cum": 1.9, - "std_fcr_cum": 1.91 - }, - { - "week": 15, - "act_fcr": 2.28, - "std_fcr": 2.25, - "act_fcr_cum": 1.94, - "std_fcr_cum": 1.95 - }, - { - "week": 16, - "act_fcr": 2.35, - "std_fcr": 2.3, - "act_fcr_cum": 1.98, - "std_fcr_cum": 1.99 - }, - { - "week": 17, - "act_fcr": 2.42, - "std_fcr": 2.4, - "act_fcr_cum": 2.02, - "std_fcr_cum": 2.03 - }, - { - "week": 18, - "act_fcr": 2.48, - "std_fcr": 2.5, - "act_fcr_cum": 2.06, - "std_fcr_cum": 2.07 - }, - { - "week": 19, - "act_fcr": 2.55, - "std_fcr": 2.55, - "act_fcr_cum": 2.1, - "std_fcr_cum": 2.11 - }, - { - "week": 20, - "act_fcr": 2.62, - "std_fcr": 2.6, - "act_fcr_cum": 2.15, - "std_fcr_cum": 2.15 - }, - { - "week": 21, - "act_fcr": 2.68, - "std_fcr": 2.7, - "act_fcr_cum": 2.19, - "std_fcr_cum": 2.19 - }, - { - "week": 22, - "act_fcr": 2.75, - "std_fcr": 2.75, - "act_fcr_cum": 2.23, - "std_fcr_cum": 2.23 - }, - { - "week": 23, - "act_fcr": 2.82, - "std_fcr": 2.8, - "act_fcr_cum": 2.27, - "std_fcr_cum": 2.27 - }, - { - "week": 24, - "act_fcr": 2.88, - "std_fcr": 2.9, - "act_fcr_cum": 2.31, - "std_fcr_cum": 2.31 - }, - { - "week": 25, - "act_fcr": 2.95, - "std_fcr": 2.95, - "act_fcr_cum": 2.35, - "std_fcr_cum": 2.35 - }, - { - "week": 26, - "act_fcr": 3.02, - "std_fcr": 3.0, - "act_fcr_cum": 2.39, - "std_fcr_cum": 2.39 - }, - { - "week": 27, - "act_fcr": 3.08, - "std_fcr": 3.1, - "act_fcr_cum": 2.43, - "std_fcr_cum": 2.43 - }, - { - "week": 28, - "act_fcr": 3.15, - "std_fcr": 3.15, - "act_fcr_cum": 2.47, - "std_fcr_cum": 2.47 - }, - { - "week": 29, - "act_fcr": 3.22, - "std_fcr": 3.2, - "act_fcr_cum": 2.51, - "std_fcr_cum": 2.51 - }, - { - "week": 30, - "act_fcr": 3.28, - "std_fcr": 3.3, - "act_fcr_cum": 2.55, - "std_fcr_cum": 2.55 - }, - { - "week": 31, - "act_fcr": 3.35, - "std_fcr": 3.35, - "act_fcr_cum": 2.59, - "std_fcr_cum": 2.59 - }, - { - "week": 32, - "act_fcr": 3.42, - "std_fcr": 3.4, - "act_fcr_cum": 2.63, - "std_fcr_cum": 2.63 - }, - { - "week": 33, - "act_fcr": 3.48, - "std_fcr": 3.5, - "act_fcr_cum": 2.67, - "std_fcr_cum": 2.67 - }, - { - "week": 34, - "act_fcr": 3.55, - "std_fcr": 3.55, - "act_fcr_cum": 2.71, - "std_fcr_cum": 2.71 - }, - { - "week": 35, - "act_fcr": 3.62, - "std_fcr": 3.6, - "act_fcr_cum": 2.75, - "std_fcr_cum": 2.75 - }, - { - "week": 36, - "act_fcr": 3.68, - "std_fcr": 3.7, - "act_fcr_cum": 2.79, - "std_fcr_cum": 2.79 - }, - { - "week": 37, - "act_fcr": 3.75, - "std_fcr": 3.75, - "act_fcr_cum": 2.83, - "std_fcr_cum": 2.83 - }, - { - "week": 38, - "act_fcr": 3.82, - "std_fcr": 3.8, - "act_fcr_cum": 2.87, - "std_fcr_cum": 2.87 - }, - { - "week": 39, - "act_fcr": 3.88, - "std_fcr": 3.9, - "act_fcr_cum": 2.91, - "std_fcr_cum": 2.91 - }, - { - "week": 40, - "act_fcr": 3.95, - "std_fcr": 3.95, - "act_fcr_cum": 2.95, - "std_fcr_cum": 2.95 - }, - { - "week": 41, - "act_fcr": 4.02, - "std_fcr": 4.0, - "act_fcr_cum": 2.99, - "std_fcr_cum": 2.99 - }, - { - "week": 42, - "act_fcr": 4.08, - "std_fcr": 4.1, - "act_fcr_cum": 3.03, - "std_fcr_cum": 3.03 - }, - { - "week": 43, - "act_fcr": 4.15, - "std_fcr": 4.15, - "act_fcr_cum": 3.07, - "std_fcr_cum": 3.07 - }, - { - "week": 44, - "act_fcr": 4.22, - "std_fcr": 4.2, - "act_fcr_cum": 3.11, - "std_fcr_cum": 3.11 - }, - { - "week": 45, - "act_fcr": 4.28, - "std_fcr": 4.3, - "act_fcr_cum": 3.15, - "std_fcr_cum": 3.15 - }, - { - "week": 46, - "act_fcr": 4.35, - "std_fcr": 4.35, - "act_fcr_cum": 3.19, - "std_fcr_cum": 3.19 - }, - { - "week": 47, - "act_fcr": 4.42, - "std_fcr": 4.4, - "act_fcr_cum": 3.23, - "std_fcr_cum": 3.23 - }, - { - "week": 48, - "act_fcr": 4.48, - "std_fcr": 4.5, - "act_fcr_cum": 3.27, - "std_fcr_cum": 3.27 - }, - { - "week": 49, - "act_fcr": 4.55, - "std_fcr": 4.55, - "act_fcr_cum": 3.31, - "std_fcr_cum": 3.31 - }, - { - "week": 50, - "act_fcr": 4.62, - "std_fcr": 4.6, - "act_fcr_cum": 3.35, - "std_fcr_cum": 3.35 - } - ] - }, - "quality_control": { - "series": [ - { - "id": "normal", - "label": "Normal", - "unit": "%" - }, - { - "id": "abnormal", - "label": "Abnormal", - "unit": "%" - } - ], - "dataset": [ - { - "week": 1, - "normal": 6.8, - "abnormal": 5.65 - }, - { - "week": 2, - "normal": 7.05, - "abnormal": 5.68 - }, - { - "week": 3, - "normal": 7.2, - "abnormal": 5.72 - }, - { - "week": 4, - "normal": 7.3, - "abnormal": 5.69 - }, - { - "week": 5, - "normal": 7.32, - "abnormal": 5.75 - }, - { - "week": 6, - "normal": 7.4, - "abnormal": 6.0 - }, - { - "week": 7, - "normal": 7.35, - "abnormal": 6.22 - }, - { - "week": 8, - "normal": 7.42, - "abnormal": 6.45 - }, - { - "week": 9, - "normal": 7.38, - "abnormal": 6.68 - }, - { - "week": 10, - "normal": 7.35, - "abnormal": 6.75 - }, - { - "week": 11, - "normal": 7.42, - "abnormal": 6.78 - }, - { - "week": 12, - "normal": 7.39, - "abnormal": 6.82 - }, - { - "week": 13, - "normal": 7.35, - "abnormal": 6.8 - }, - { - "week": 14, - "normal": 7.4, - "abnormal": 6.9 - }, - { - "week": 15, - "normal": 7.45, - "abnormal": 6.95 - }, - { - "week": 16, - "normal": 7.42, - "abnormal": 7.05 - }, - { - "week": 17, - "normal": 7.38, - "abnormal": 7.12 - }, - { - "week": 18, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 19, - "normal": 7.48, - "abnormal": 7.2 - }, - { - "week": 20, - "normal": 7.4, - "abnormal": 7.15 - }, - { - "week": 21, - "normal": 7.42, - "abnormal": 7.1 - }, - { - "week": 22, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 23, - "normal": 7.4, - "abnormal": 7.12 - }, - { - "week": 24, - "normal": 7.48, - "abnormal": 7.08 - }, - { - "week": 25, - "normal": 7.5, - "abnormal": 7.15 - }, - { - "week": 26, - "normal": 7.45, - "abnormal": 7.25 - }, - { - "week": 27, - "normal": 7.4, - "abnormal": 7.32 - }, - { - "week": 28, - "normal": 7.48, - "abnormal": 7.37 - }, - { - "week": 29, - "normal": 7.52, - "abnormal": 7.2 - }, - { - "week": 30, - "normal": 7.45, - "abnormal": 7.15 - }, - { - "week": 31, - "normal": 7.4, - "abnormal": 7.0 - }, - { - "week": 32, - "normal": 7.42, - "abnormal": 7.12 - }, - { - "week": 33, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 34, - "normal": 7.38, - "abnormal": 7.1 - }, - { - "week": 35, - "normal": 7.4, - "abnormal": 7.22 - }, - { - "week": 36, - "normal": 7.45, - "abnormal": 7.05 - }, - { - "week": 37, - "normal": 7.42, - "abnormal": 7.15 - }, - { - "week": 38, - "normal": 7.38, - "abnormal": 7.22 - }, - { - "week": 39, - "normal": 7.4, - "abnormal": 7.0 - }, - { - "week": 40, - "normal": 7.45, - "abnormal": 7.18 - }, - { - "week": 41, - "normal": 7.42, - "abnormal": 7.22 - }, - { - "week": 42, - "normal": 7.39, - "abnormal": 7.1 - }, - { - "week": 43, - "normal": 7.42, - "abnormal": 7.25 - }, - { - "week": 44, - "normal": 7.38, - "abnormal": 7.15 - }, - { - "week": 45, - "normal": 7.45, - "abnormal": 7.28 - }, - { - "week": 46, - "normal": 7.48, - "abnormal": 7.35 - }, - { - "week": 47, - "normal": 7.42, - "abnormal": 7.45 - }, - { - "week": 48, - "normal": 7.45, - "abnormal": 7.48 - }, - { - "week": 49, - "normal": 7.5, - "abnormal": 7.42 - }, - { - "week": 50, - "normal": 7.48, - "abnormal": 7.35 - } - ] - }, - "deplesi": { - "series": [ - { - "id": "act_deplesi", - "label": "Act. Deplesi", - "unit": "g" - }, - { - "id": "std_deplesi", - "label": "STD. Deplesi", - "unit": "g" - } - ], - "dataset": [ - { - "week": 1, - "act_deplesi": 1400, - "std_deplesi": 1480 - }, - { - "week": 2, - "act_deplesi": 1490, - "std_deplesi": 1580 - }, - { - "week": 3, - "act_deplesi": 1560, - "std_deplesi": 1650 - }, - { - "week": 4, - "act_deplesi": 1600, - "std_deplesi": 1700 - }, - { - "week": 5, - "act_deplesi": 1720, - "std_deplesi": 1750 - }, - { - "week": 6, - "act_deplesi": 1760, - "std_deplesi": 1750 - }, - { - "week": 7, - "act_deplesi": 1800, - "std_deplesi": 1770 - }, - { - "week": 8, - "act_deplesi": 1765, - "std_deplesi": 1770 - }, - { - "week": 9, - "act_deplesi": 1750, - "std_deplesi": 1780 - }, - { - "week": 10, - "act_deplesi": 1820, - "std_deplesi": 1800 - }, - { - "week": 11, - "act_deplesi": 1800, - "std_deplesi": 1790 - }, - { - "week": 12, - "act_deplesi": 1790, - "std_deplesi": 1780 - }, - { - "week": 13, - "act_deplesi": 1810, - "std_deplesi": 1770 - }, - { - "week": 14, - "act_deplesi": 1750, - "std_deplesi": 1780 - }, - { - "week": 15, - "act_deplesi": 1740, - "std_deplesi": 1800 - }, - { - "week": 16, - "act_deplesi": 1740, - "std_deplesi": 1820 - }, - { - "week": 17, - "act_deplesi": 1800, - "std_deplesi": 1830 - }, - { - "week": 18, - "act_deplesi": 1830, - "std_deplesi": 1840 - }, - { - "week": 19, - "act_deplesi": 1830, - "std_deplesi": 1840 - }, - { - "week": 20, - "act_deplesi": 1810, - "std_deplesi": 1845 - }, - { - "week": 21, - "act_deplesi": 1800, - "std_deplesi": 1850 - }, - { - "week": 22, - "act_deplesi": 1830, - "std_deplesi": 1855 - }, - { - "week": 23, - "act_deplesi": 1810, - "std_deplesi": 1860 - }, - { - "week": 24, - "act_deplesi": 1840, - "std_deplesi": 1870 - }, - { - "week": 25, - "act_deplesi": 1800, - "std_deplesi": 1880 - }, - { - "week": 26, - "act_deplesi": 1880, - "std_deplesi": 1900 - }, - { - "week": 27, - "act_deplesi": 1910, - "std_deplesi": 1910 - }, - { - "week": 28, - "act_deplesi": 1900, - "std_deplesi": 1920 - }, - { - "week": 29, - "act_deplesi": 1840, - "std_deplesi": 1925 - }, - { - "week": 30, - "act_deplesi": 1810, - "std_deplesi": 1930 - }, - { - "week": 31, - "act_deplesi": 1780, - "std_deplesi": 1935 - }, - { - "week": 32, - "act_deplesi": 1820, - "std_deplesi": 1940 - }, - { - "week": 33, - "act_deplesi": 1800, - "std_deplesi": 1945 - }, - { - "week": 34, - "act_deplesi": 1770, - "std_deplesi": 1950 - }, - { - "week": 35, - "act_deplesi": 1840, - "std_deplesi": 1955 - }, - { - "week": 36, - "act_deplesi": 1810, - "std_deplesi": 1960 - }, - { - "week": 37, - "act_deplesi": 1780, - "std_deplesi": 1965 - }, - { - "week": 38, - "act_deplesi": 1820, - "std_deplesi": 1970 - }, - { - "week": 39, - "act_deplesi": 1770, - "std_deplesi": 1970 - }, - { - "week": 40, - "act_deplesi": 1840, - "std_deplesi": 1975 - }, - { - "week": 41, - "act_deplesi": 1820, - "std_deplesi": 1975 - }, - { - "week": 42, - "act_deplesi": 1790, - "std_deplesi": 1975 - }, - { - "week": 43, - "act_deplesi": 1860, - "std_deplesi": 1980 - }, - { - "week": 44, - "act_deplesi": 1820, - "std_deplesi": 1980 - }, - { - "week": 45, - "act_deplesi": 1800, - "std_deplesi": 1980 - }, - { - "week": 46, - "act_deplesi": 1840, - "std_deplesi": 1985 - }, - { - "week": 47, - "act_deplesi": 1790, - "std_deplesi": 1990 - }, - { - "week": 48, - "act_deplesi": 1910, - "std_deplesi": 1990 - }, - { - "week": 49, - "act_deplesi": 1950, - "std_deplesi": 1995 - }, - { - "week": 50, - "act_deplesi": 1910, - "std_deplesi": 2000 - } - ] - } - } -} diff --git a/src/dummy/dashboard/dashboard.production.dummy.ts b/src/dummy/dashboard/dashboard.production.dummy.ts deleted file mode 100644 index 285505c0..00000000 --- a/src/dummy/dashboard/dashboard.production.dummy.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Dummy data for DashboardProduction - * Generated from: dashboard.production.dummy.json - * - * This file is auto-generated. Do not edit manually. - */ - -import { Dashboard, DashboardMeta } from '../../types/api/dashboard/dashboard'; -import { BaseApiResponse } from '@/types/api/api-general'; -import dummyData from './dashboard.overview.dummy.json'; -import dummyData2 from './dashboard.comparasion.location.dummy.json'; -import dummyData3 from './dashboard.comparasion.flock.dummy.json'; -import dummyData4 from './dashboard.comparasion.kandang.dummy.json'; -import dummyData5 from './dashboard.default.json'; -/** - * Get dummy DashboardProduction data - * @returns Promise with BaseApiResponse containing DashboardProduction - */ -export async function getDummySingle(): Promise> { - return new Promise((resolve) => { - setTimeout(() => { - resolve({ - code: 200, - status: 'success', - message: 'Data retrieved successfully', - meta: { - page: 1, - limit: 1, - total_pages: 1, - total_results: 1, - filters: { - analysis_mode: 'OVERVIEW', - location_ids: [1], - flock_ids: [1], - kandang_ids: [1], - }, - } as DashboardMeta, - data: dummyData as unknown as Dashboard, - }); - }); - }); -} diff --git a/src/services/api/dashboard.ts b/src/services/api/dashboard.ts index 942a5a67..5cfc9b8f 100644 --- a/src/services/api/dashboard.ts +++ b/src/services/api/dashboard.ts @@ -1,7 +1,7 @@ import { BaseApiService } from '@/services/api/base'; import { BaseApiResponse } from '@/types/api/api-general'; import { Dashboard } from '@/types/api/dashboard/dashboard'; -import { getDummySingle } from '@/dummy/dashboard/dashboard.production.dummy'; +import { httpClientFetcher } from '@/services/http/client'; class DashboardService extends BaseApiService { constructor(basePath: string) { @@ -12,19 +12,14 @@ class DashboardService extends BaseApiService { * Fetch dashboard production data * @param endpoint - The endpoint URL with query parameters * @returns Promise with BaseApiResponse containing DashboardProduction - * - * Note: Currently using dummy data. When real API is ready, - * uncomment the line below and remove getDummySingle() call: - * return await this.customRequest>(endpoint); */ async getDashboardProductionFetcher( endpoint: string - ): Promise> { - // For now, we're using dummy data regardless of the endpoint - // The endpoint parameter is kept for future API integration - console.log('Fetching dashboard data with endpoint:', endpoint); - return await getDummySingle(); + ): Promise | undefined> { + return await httpClientFetcher>( + `${endpoint ? endpoint : this.basePath}` + ); } } -export const DashboardApi = new DashboardService('/dashboard'); +export const DashboardApi = new DashboardService('/dashboards'); diff --git a/src/services/api/report/finance-report.ts b/src/services/api/report/finance-report.ts index e0acb6b0..85f8a356 100644 --- a/src/services/api/report/finance-report.ts +++ b/src/services/api/report/finance-report.ts @@ -1,6 +1,7 @@ import { BaseApiService } from '@/services/api/base'; import { BaseApiResponse } from '@/types/api/api-general'; import { CustomerPaymentReport } from '@/types/api/report/customer-payment'; +import { DebtSupplier } from '@/types/api/report/debt-supplier'; export class FinanceApiService extends BaseApiService< CustomerPaymentReport, @@ -36,10 +37,30 @@ export class FinanceApiService extends BaseApiService< } ); } + + async getDebtSupplierReport( + supplier_ids?: string, + filter_by?: 'do_date', + start_date?: string, + end_date?: string, + page?: number, + limit?: number + ): Promise | undefined> { + return await this.customRequest>( + `debt-supplier`, + { + method: 'GET', + params: { + supplier_ids: supplier_ids, + filter_by: filter_by, + start_date: start_date, + end_date: end_date, + page: page, + limit: limit, + }, + } + ); + } } export const FinanceApi = new FinanceApiService('reports'); - -// export const FinanceApi = new FinanceApiService( -// 'http://localhost:4010/api/reports/finance' -// ); diff --git a/src/types/api/dashboard/dashboard.d.ts b/src/types/api/dashboard/dashboard.d.ts index 9be93528..ec3dafdb 100644 --- a/src/types/api/dashboard/dashboard.d.ts +++ b/src/types/api/dashboard/dashboard.d.ts @@ -47,6 +47,7 @@ export interface DashboardFilter { end_date: string; analysis_mode: 'OVERVIEW' | 'COMPARISON'; location_ids: number[]; + comparison_type?: string | undefined; flock_ids: number[]; kandang_ids: number[]; } diff --git a/src/types/api/report/debt-supplier.d.ts b/src/types/api/report/debt-supplier.d.ts new file mode 100644 index 00000000..f7342501 --- /dev/null +++ b/src/types/api/report/debt-supplier.d.ts @@ -0,0 +1,34 @@ +import { BaseMetadata } from '@/types/api/api-general'; +import { Area } from '@/types/api/master-data/area'; +import { Supplier } from '@/types/api/master-data/supplier'; +import { Warehouse } from '@/types/api/master-data/warehouse'; + +export type DebtSupplier = BaseMetadata & { + supplier: Supplier; + rows: DebtRow[]; + total: DebtTotal; +}; + +export type DebtRow = { + pr_number: string; + po_number: string; + pr_date: string; + po_date: string; + aging: number; + area: Area; + warehouse: Warehouse; + due_date: string; + due_status: string; + total_price: number; + payment_price: number; + debt_price: number; + status: string; + travel_number: string; +}; + +export type DebtTotal = { + aging: number; + total_price: number; + payment_price: number; + debt_price: number; +};