mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE-84-87) refactor checkbox using reuseable component checkboxinput
This commit is contained in:
@@ -15,7 +15,7 @@ import { Kandang } from '@/types/api/master-data/kandang';
|
||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { use, useEffect, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import useSWR from 'swr';
|
||||
|
||||
@@ -34,9 +34,8 @@ const AddChickin = () => {
|
||||
const [selectedKandang, setSelectedKandang] = useState<Kandang | undefined>(
|
||||
undefined
|
||||
);
|
||||
const [projectFlockKandang, setProjectFlockKandang] = useState<
|
||||
BaseApiResponse<ProjectFlockKandang>
|
||||
>();
|
||||
const [projectFlockKandang, setProjectFlockKandang] =
|
||||
useState<BaseApiResponse<ProjectFlockKandang>>();
|
||||
const [isLoadingProjectFlockKandang, setIsLoadingProjectFlockKandang] =
|
||||
useState(false);
|
||||
const [searchProjectFlock, setSearchProjectFlock] = useState('');
|
||||
@@ -87,7 +86,7 @@ const AddChickin = () => {
|
||||
}
|
||||
|
||||
// Handle Function
|
||||
const handleChickinClick = async (kandang: Kandang) => {
|
||||
const handleChickinClick = async (kandang: Kandang) => {
|
||||
setIsLoadingProjectFlockKandang(true);
|
||||
setSelectedKandang(kandang);
|
||||
const ProjectFlockKandangRes = await ProjectFlockApi.customRequest<
|
||||
@@ -100,9 +99,7 @@ const AddChickin = () => {
|
||||
kandang_id: kandang.id,
|
||||
},
|
||||
});
|
||||
if (
|
||||
isResponseSuccess(ProjectFlockKandangRes)
|
||||
) {
|
||||
if (isResponseSuccess(ProjectFlockKandangRes)) {
|
||||
setProjectFlockKandang(ProjectFlockKandangRes);
|
||||
setIsLoadingProjectFlockKandang(false);
|
||||
if (
|
||||
@@ -110,7 +107,7 @@ const AddChickin = () => {
|
||||
ProjectFlockKandangRes.data.available_quantity > 0
|
||||
) {
|
||||
chickinModal.openModal();
|
||||
}else{
|
||||
} else {
|
||||
alertModal.openModal();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user