mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'fix/daily-checklist' into 'development'
[FIX/FE] Daily Checklist See merge request mbugroup/lti-web-client!469
This commit is contained in:
@@ -866,7 +866,8 @@ const RecordingTable = () => {
|
|||||||
<>
|
<>
|
||||||
<span>
|
<span>
|
||||||
{props.row.original.day} (Minggu ke-
|
{props.row.original.day} (Minggu ke-
|
||||||
{props.row.original.project_flock.production_standart.week})
|
{props.row.original.week} hari ke-
|
||||||
|
{props.row.original.excess_days})
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'qty',
|
accessorKey: 'qty',
|
||||||
cell: (props) => formatNumber(props.row.original.qty),
|
cell: (props) => formatNumber(props.row.original.qty),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.total_qty
|
{summaryTotal?.total_qty
|
||||||
? formatNumber(summaryTotal.total_qty)
|
? formatNumber(summaryTotal.total_qty)
|
||||||
: '-'}
|
: '-'}
|
||||||
@@ -567,7 +567,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'average_weight_kg',
|
accessorKey: 'average_weight_kg',
|
||||||
cell: (props) => formatNumber(props.row.original.average_weight_kg),
|
cell: (props) => formatNumber(props.row.original.average_weight_kg),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.average_weight_kg
|
{summaryTotal?.average_weight_kg
|
||||||
? formatNumber(summaryTotal.average_weight_kg)
|
? formatNumber(summaryTotal.average_weight_kg)
|
||||||
: '-'}
|
: '-'}
|
||||||
@@ -580,7 +580,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'total_weight_kg',
|
accessorKey: 'total_weight_kg',
|
||||||
cell: (props) => formatNumber(props.row.original.total_weight_kg),
|
cell: (props) => formatNumber(props.row.original.total_weight_kg),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.total_weight_kg
|
{summaryTotal?.total_weight_kg
|
||||||
? formatNumber(summaryTotal.total_weight_kg)
|
? formatNumber(summaryTotal.total_weight_kg)
|
||||||
: '-'}
|
: '-'}
|
||||||
@@ -593,9 +593,9 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'sales_price_per_kg',
|
accessorKey: 'sales_price_per_kg',
|
||||||
cell: (props) => formatCurrency(props.row.original.sales_price_per_kg),
|
cell: (props) => formatCurrency(props.row.original.sales_price_per_kg),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.average_sales_price
|
{summaryTotal?.average_sales_price
|
||||||
? formatNumber(summaryTotal.average_sales_price)
|
? formatCurrency(summaryTotal.average_sales_price)
|
||||||
: '-'}
|
: '-'}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@@ -606,7 +606,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'hpp_price_per_kg',
|
accessorKey: 'hpp_price_per_kg',
|
||||||
cell: (props) => formatCurrency(props.row.original.hpp_price_per_kg),
|
cell: (props) => formatCurrency(props.row.original.hpp_price_per_kg),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.total_hpp_price_per_kg
|
{summaryTotal?.total_hpp_price_per_kg
|
||||||
? formatCurrency(summaryTotal.total_hpp_price_per_kg)
|
? formatCurrency(summaryTotal.total_hpp_price_per_kg)
|
||||||
: '-'}
|
: '-'}
|
||||||
@@ -619,7 +619,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
|||||||
accessorKey: 'sales_amount',
|
accessorKey: 'sales_amount',
|
||||||
cell: (props) => formatCurrency(props.row.original.sales_amount),
|
cell: (props) => formatCurrency(props.row.original.sales_amount),
|
||||||
footer: () => (
|
footer: () => (
|
||||||
<div className='text-right font-semibold text-gray-900'>
|
<div className='font-semibold text-gray-900'>
|
||||||
{summaryTotal?.total_sales_amount
|
{summaryTotal?.total_sales_amount
|
||||||
? formatCurrency(summaryTotal.total_sales_amount)
|
? formatCurrency(summaryTotal.total_sales_amount)
|
||||||
: '-'}
|
: '-'}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -160,13 +160,7 @@ export function ListDailyChecklistContent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleEdit = (item: DailyChecklist) => {
|
const handleEdit = (item: DailyChecklist) => {
|
||||||
const formattedDate = new Date(item.date).toISOString().split('T')[0];
|
router.push(`/daily-checklist/daily-checklist?checklistId=${item.id}`);
|
||||||
const kandangId = item.kandang?.id ?? '';
|
|
||||||
const category = item.category;
|
|
||||||
|
|
||||||
router.push(
|
|
||||||
`/daily-checklist/daily-checklist?date=${formattedDate}&kandang_id=${kandangId}&category=${category}`
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleApprove = (item: DailyChecklist) => {
|
const handleApprove = (item: DailyChecklist) => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
DailyChecklist,
|
DailyChecklist,
|
||||||
DailyChecklistReport,
|
DailyChecklistReport,
|
||||||
DetailDailyChecklist,
|
DetailDailyChecklist,
|
||||||
|
UpdateDailyChecklistPayload,
|
||||||
} from '@/types/api/daily-checklist/daily-checklist';
|
} from '@/types/api/daily-checklist/daily-checklist';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
@@ -16,12 +17,39 @@ import { toast } from 'sonner';
|
|||||||
export class DailyChecklistApiService extends BaseApiService<
|
export class DailyChecklistApiService extends BaseApiService<
|
||||||
DailyChecklist,
|
DailyChecklist,
|
||||||
CreateDailyChecklistPayload,
|
CreateDailyChecklistPayload,
|
||||||
unknown
|
UpdateDailyChecklistPayload
|
||||||
> {
|
> {
|
||||||
constructor(basePath: string = '/daily-checklists') {
|
constructor(basePath: string = '/daily-checklists') {
|
||||||
super(basePath);
|
super(basePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async update(id: number, payload: UpdateDailyChecklistPayload) {
|
||||||
|
const isFormData =
|
||||||
|
typeof FormData !== 'undefined' && payload instanceof FormData;
|
||||||
|
try {
|
||||||
|
const updatePath = `${this.basePath}/${id}`;
|
||||||
|
|
||||||
|
const headers = isFormData
|
||||||
|
? { ...(this.header ?? {}) }
|
||||||
|
: { 'Content-Type': 'application/json', ...(this.header ?? {}) };
|
||||||
|
|
||||||
|
const updateRes = await httpClient<BaseApiResponse<DailyChecklist>>(
|
||||||
|
updatePath,
|
||||||
|
{
|
||||||
|
method: 'PUT',
|
||||||
|
body: payload,
|
||||||
|
headers,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return updateRes;
|
||||||
|
} catch (error: unknown) {
|
||||||
|
if (axios.isAxiosError<BaseApiResponse<DailyChecklist>>(error)) {
|
||||||
|
return error.response?.data;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getOneDailyChecklist(id: string) {
|
async getOneDailyChecklist(id: string) {
|
||||||
try {
|
try {
|
||||||
const getOneDailyChecklistPath = `${this.basePath}/relation/${id}`;
|
const getOneDailyChecklistPath = `${this.basePath}/relation/${id}`;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export type BaseDailyChecklist = {
|
|||||||
category: string;
|
category: string;
|
||||||
date: string;
|
date: string;
|
||||||
empty_kandang?: boolean;
|
empty_kandang?: boolean;
|
||||||
|
empty_kandang_end_date?: string | null;
|
||||||
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
||||||
total_phase: number;
|
total_phase: number;
|
||||||
total_activity: number;
|
total_activity: number;
|
||||||
@@ -59,8 +60,11 @@ export type CreateDailyChecklistPayload = {
|
|||||||
category: string;
|
category: string;
|
||||||
status: string;
|
status: string;
|
||||||
empty_kandang: boolean;
|
empty_kandang: boolean;
|
||||||
|
empty_kandang_end_date?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type UpdateDailyChecklistPayload = CreateDailyChecklistPayload;
|
||||||
|
|
||||||
export type PerformanceOverviewItem = {
|
export type PerformanceOverviewItem = {
|
||||||
employee_id: number;
|
employee_id: number;
|
||||||
employee_name: string;
|
employee_name: string;
|
||||||
|
|||||||
+2
@@ -51,6 +51,8 @@ export type BaseRecording = {
|
|||||||
day: number;
|
day: number;
|
||||||
is_transition: boolean;
|
is_transition: boolean;
|
||||||
is_laying: boolean;
|
is_laying: boolean;
|
||||||
|
week: number;
|
||||||
|
excess_days: number;
|
||||||
} & ProductionMetrics;
|
} & ProductionMetrics;
|
||||||
|
|
||||||
export type RecordingDepletion = {
|
export type RecordingDepletion = {
|
||||||
|
|||||||
Reference in New Issue
Block a user