mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +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,
|
id: 1,
|
||||||
flock: {
|
flock: {
|
||||||
id: 1,
|
id: 1,
|
||||||
period: 1,
|
name: 'Flock Recording 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',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
created_at: '2024-01-01',
|
created_at: '2024-01-01',
|
||||||
updated_at: '2024-01-01',
|
updated_at: '2024-01-01',
|
||||||
created_user: {
|
created_user: {
|
||||||
@@ -290,9 +207,7 @@ const RecordingTable = () => {
|
|||||||
const paginatedData = useMemo(() => {
|
const paginatedData = useMemo(() => {
|
||||||
const filteredData = dummyRecordings.filter(
|
const filteredData = dummyRecordings.filter(
|
||||||
(recording) =>
|
(recording) =>
|
||||||
recording.flock.flock.name
|
recording.flock.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||||
.toLowerCase()
|
|
||||||
.includes(search.toLowerCase()) ||
|
|
||||||
recording.location.name.toLowerCase().includes(search.toLowerCase()) ||
|
recording.location.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||||
recording.coop.name.toLowerCase().includes(search.toLowerCase())
|
recording.coop.name.toLowerCase().includes(search.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|||||||
+10
-16
@@ -1,35 +1,29 @@
|
|||||||
import { Area } from "@/types/api/master-data/area";
|
import { Area } from '@/types/api/master-data/area';
|
||||||
import { Fcr } from "@/types/api/master-data/fcr";
|
import { Fcr } from '@/types/api/master-data/fcr';
|
||||||
import { Flock } from "@/types/api/master-data/flock";
|
import { Flock } from '@/types/api/master-data/flock';
|
||||||
import { Kandang } from "@/types/api/master-data/kandang";
|
import { Kandang } from '@/types/api/master-data/kandang';
|
||||||
import { Location } from "@/types/api/master-data/location";
|
import { Location } from '@/types/api/master-data/location';
|
||||||
import { BaseMetadata } from "@/types/api/api-general";
|
import { BaseMetadata } from '@/types/api/api-general';
|
||||||
|
|
||||||
export type BaseProjectFlock = {
|
export type BaseProjectFlock = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
status: string;
|
status: string;
|
||||||
flock: Flock;
|
flock: Flock;
|
||||||
flock_id: number;
|
|
||||||
area: Area;
|
area: Area;
|
||||||
area_id: number;
|
|
||||||
category: string;
|
category: string;
|
||||||
fcr: Fcr;
|
fcr: Fcr;
|
||||||
fcr_id: number;
|
|
||||||
location: Location;
|
location: Location;
|
||||||
location_id: number;
|
|
||||||
period: number;
|
period: number;
|
||||||
kandang_ids: number[];
|
|
||||||
kandangs: Kandang[];
|
kandangs: Kandang[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type PeriodFlock = {
|
export type PeriodFlock = {
|
||||||
flock: Flock;
|
flock: Flock;
|
||||||
next_period: number;
|
next_period: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export type ProjectFlock = BaseMetadata & BaseProjectFlock;
|
||||||
export type ProjectFlock = BaseMetadata & BaseProjectFlock
|
|
||||||
|
|
||||||
export type CreateProjectFlockPayload = {
|
export type CreateProjectFlockPayload = {
|
||||||
flock_id: number;
|
flock_id: number;
|
||||||
@@ -39,6 +33,6 @@ export type CreateProjectFlockPayload = {
|
|||||||
location_id: number;
|
location_id: number;
|
||||||
period: number;
|
period: number;
|
||||||
kandang_ids: 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 { BaseMetadata } from '@/types/api/api-general';
|
||||||
import { ProjectFlock } from '@/types/api/production/project-flock';
|
|
||||||
import { Location } from '@/types/api/master-data/location';
|
import { Location } from '@/types/api/master-data/location';
|
||||||
import { Kandang } from '@/types/api/master-data/kandang';
|
import { Kandang } from '@/types/api/master-data/kandang';
|
||||||
|
import { Flock } from '@/types/api/master-data/flock';
|
||||||
|
|
||||||
export type BaseRecording = {
|
export type BaseRecording = {
|
||||||
id: number;
|
id: number;
|
||||||
flock: ProjectFlock;
|
flock: Flock;
|
||||||
recording_date: string;
|
recording_date: string;
|
||||||
location: Location;
|
location: Location;
|
||||||
coop: Kandang;
|
coop: Kandang;
|
||||||
|
|||||||
Reference in New Issue
Block a user