mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +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>
|
||||
{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>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -554,7 +554,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'qty',
|
||||
cell: (props) => formatNumber(props.row.original.qty),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{summaryTotal?.total_qty
|
||||
? formatNumber(summaryTotal.total_qty)
|
||||
: '-'}
|
||||
@@ -567,7 +567,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'average_weight_kg',
|
||||
cell: (props) => formatNumber(props.row.original.average_weight_kg),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{summaryTotal?.average_weight_kg
|
||||
? formatNumber(summaryTotal.average_weight_kg)
|
||||
: '-'}
|
||||
@@ -580,7 +580,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'total_weight_kg',
|
||||
cell: (props) => formatNumber(props.row.original.total_weight_kg),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{summaryTotal?.total_weight_kg
|
||||
? formatNumber(summaryTotal.total_weight_kg)
|
||||
: '-'}
|
||||
@@ -593,9 +593,9 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'sales_price_per_kg',
|
||||
cell: (props) => formatCurrency(props.row.original.sales_price_per_kg),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{summaryTotal?.average_sales_price
|
||||
? formatNumber(summaryTotal.average_sales_price)
|
||||
? formatCurrency(summaryTotal.average_sales_price)
|
||||
: '-'}
|
||||
</div>
|
||||
),
|
||||
@@ -606,7 +606,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'hpp_price_per_kg',
|
||||
cell: (props) => formatCurrency(props.row.original.hpp_price_per_kg),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{summaryTotal?.total_hpp_price_per_kg
|
||||
? formatCurrency(summaryTotal.total_hpp_price_per_kg)
|
||||
: '-'}
|
||||
@@ -619,7 +619,7 @@ const DailyMarketingTab = ({ tabId }: DailyMarketingTabProps) => {
|
||||
accessorKey: 'sales_amount',
|
||||
cell: (props) => formatCurrency(props.row.original.sales_amount),
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{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 formattedDate = new Date(item.date).toISOString().split('T')[0];
|
||||
const kandangId = item.kandang?.id ?? '';
|
||||
const category = item.category;
|
||||
|
||||
router.push(
|
||||
`/daily-checklist/daily-checklist?date=${formattedDate}&kandang_id=${kandangId}&category=${category}`
|
||||
);
|
||||
router.push(`/daily-checklist/daily-checklist?checklistId=${item.id}`);
|
||||
};
|
||||
|
||||
const handleApprove = (item: DailyChecklist) => {
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
DailyChecklist,
|
||||
DailyChecklistReport,
|
||||
DetailDailyChecklist,
|
||||
UpdateDailyChecklistPayload,
|
||||
} from '@/types/api/daily-checklist/daily-checklist';
|
||||
import { isResponseError } from '@/lib/api-helper';
|
||||
import { toast } from 'sonner';
|
||||
@@ -16,12 +17,39 @@ import { toast } from 'sonner';
|
||||
export class DailyChecklistApiService extends BaseApiService<
|
||||
DailyChecklist,
|
||||
CreateDailyChecklistPayload,
|
||||
unknown
|
||||
UpdateDailyChecklistPayload
|
||||
> {
|
||||
constructor(basePath: string = '/daily-checklists') {
|
||||
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) {
|
||||
try {
|
||||
const getOneDailyChecklistPath = `${this.basePath}/relation/${id}`;
|
||||
|
||||
@@ -13,6 +13,7 @@ export type BaseDailyChecklist = {
|
||||
category: string;
|
||||
date: string;
|
||||
empty_kandang?: boolean;
|
||||
empty_kandang_end_date?: string | null;
|
||||
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
||||
total_phase: number;
|
||||
total_activity: number;
|
||||
@@ -59,8 +60,11 @@ export type CreateDailyChecklistPayload = {
|
||||
category: string;
|
||||
status: string;
|
||||
empty_kandang: boolean;
|
||||
empty_kandang_end_date?: string | null;
|
||||
};
|
||||
|
||||
export type UpdateDailyChecklistPayload = CreateDailyChecklistPayload;
|
||||
|
||||
export type PerformanceOverviewItem = {
|
||||
employee_id: number;
|
||||
employee_name: string;
|
||||
|
||||
+2
@@ -51,6 +51,8 @@ export type BaseRecording = {
|
||||
day: number;
|
||||
is_transition: boolean;
|
||||
is_laying: boolean;
|
||||
week: number;
|
||||
excess_days: number;
|
||||
} & ProductionMetrics;
|
||||
|
||||
export type RecordingDepletion = {
|
||||
|
||||
Reference in New Issue
Block a user