mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-114): simplify project flock types and update flock reference in recording
This commit is contained in:
@@ -22,90 +22,7 @@ const dummyRecordings: Recording[] = [
|
||||
id: 1,
|
||||
flock: {
|
||||
id: 1,
|
||||
period: 1,
|
||||
flock: {
|
||||
id: 1,
|
||||
name: 'Flock A',
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin',
|
||||
},
|
||||
},
|
||||
area: {
|
||||
id: 1,
|
||||
name: 'Area 1',
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin',
|
||||
},
|
||||
},
|
||||
fcr: {
|
||||
id: 1,
|
||||
name: 'FCR 1.5',
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin',
|
||||
},
|
||||
},
|
||||
location: {
|
||||
id: 1,
|
||||
name: 'Location 1',
|
||||
address: 'Address 1',
|
||||
area: {
|
||||
id: 1,
|
||||
name: 'Area 1',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin',
|
||||
},
|
||||
},
|
||||
kandangs: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Kandang 1',
|
||||
status: 'ACTIVE',
|
||||
location: {
|
||||
id: 1,
|
||||
name: 'Location 1',
|
||||
address: 'Address 1',
|
||||
area: {
|
||||
id: 1,
|
||||
name: 'Area 1',
|
||||
},
|
||||
},
|
||||
pic: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'pic@example.com',
|
||||
name: 'PIC User',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin',
|
||||
},
|
||||
},
|
||||
],
|
||||
name: 'Flock Recording 1',
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
created_user: {
|
||||
@@ -290,9 +207,7 @@ const RecordingTable = () => {
|
||||
const paginatedData = useMemo(() => {
|
||||
const filteredData = dummyRecordings.filter(
|
||||
(recording) =>
|
||||
recording.flock.flock.name
|
||||
.toLowerCase()
|
||||
.includes(search.toLowerCase()) ||
|
||||
recording.flock.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||
recording.location.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||
recording.coop.name.toLowerCase().includes(search.toLowerCase())
|
||||
);
|
||||
|
||||
+11
-17
@@ -1,35 +1,29 @@
|
||||
import { Area } from "@/types/api/master-data/area";
|
||||
import { Fcr } from "@/types/api/master-data/fcr";
|
||||
import { Flock } from "@/types/api/master-data/flock";
|
||||
import { Kandang } from "@/types/api/master-data/kandang";
|
||||
import { Location } from "@/types/api/master-data/location";
|
||||
import { BaseMetadata } from "@/types/api/api-general";
|
||||
import { Area } from '@/types/api/master-data/area';
|
||||
import { Fcr } from '@/types/api/master-data/fcr';
|
||||
import { Flock } from '@/types/api/master-data/flock';
|
||||
import { Kandang } from '@/types/api/master-data/kandang';
|
||||
import { Location } from '@/types/api/master-data/location';
|
||||
import { BaseMetadata } from '@/types/api/api-general';
|
||||
|
||||
export type BaseProjectFlock = {
|
||||
id: number;
|
||||
name: string;
|
||||
status: string;
|
||||
flock: Flock;
|
||||
flock_id: number;
|
||||
area: Area;
|
||||
area_id: number;
|
||||
category: string;
|
||||
fcr: Fcr;
|
||||
fcr_id: number;
|
||||
location: Location;
|
||||
location_id: number;
|
||||
period: number;
|
||||
kandang_ids: number[];
|
||||
kandangs: Kandang[];
|
||||
}
|
||||
};
|
||||
|
||||
export type PeriodFlock = {
|
||||
flock: Flock;
|
||||
next_period: number;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export type ProjectFlock = BaseMetadata & BaseProjectFlock
|
||||
export type ProjectFlock = BaseMetadata & BaseProjectFlock;
|
||||
|
||||
export type CreateProjectFlockPayload = {
|
||||
flock_id: number;
|
||||
@@ -39,6 +33,6 @@ export type CreateProjectFlockPayload = {
|
||||
location_id: number;
|
||||
period: number;
|
||||
kandang_ids: number[];
|
||||
}
|
||||
};
|
||||
|
||||
export type UpdateProjectFlockPayload = CreateProjectFlockPayload;
|
||||
export type UpdateProjectFlockPayload = CreateProjectFlockPayload;
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import { BaseMetadata } from '@/types/api/api-general';
|
||||
import { ProjectFlock } from '@/types/api/production/project-flock';
|
||||
import { Location } from '@/types/api/master-data/location';
|
||||
import { Kandang } from '@/types/api/master-data/kandang';
|
||||
import { Flock } from '@/types/api/master-data/flock';
|
||||
|
||||
export type BaseRecording = {
|
||||
id: number;
|
||||
flock: ProjectFlock;
|
||||
flock: Flock;
|
||||
recording_date: string;
|
||||
location: Location;
|
||||
coop: Kandang;
|
||||
|
||||
Reference in New Issue
Block a user