selector room and machine work only left save
This commit is contained in:
@@ -48,10 +48,6 @@ export default function ProgramSelector({
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
const handleChangeEquipo = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
setEquipoSeleccionado(Number(e.target.value));
|
||||
};
|
||||
|
||||
const handleTogglePrograma = (id: number) => {
|
||||
setCheckboxes((prev) => ({
|
||||
...prev,
|
||||
@@ -72,7 +68,7 @@ export default function ProgramSelector({
|
||||
|
||||
useEffect(() => {
|
||||
if (!programas.length) return;
|
||||
if (!ubicacion && !id) return;
|
||||
if (ubicacion === null && id === null) return;
|
||||
|
||||
const buildCheckboxes = async () => {
|
||||
const baseCheckboxes: Record<number, boolean> = {};
|
||||
@@ -83,14 +79,16 @@ export default function ProgramSelector({
|
||||
try {
|
||||
let res;
|
||||
|
||||
if (ubicacion) {
|
||||
if (ubicacion && ubicacion !== "0") {
|
||||
res = await axios.get(
|
||||
`${envConfig.apiUrl}/programa-equipo/${ubicacion}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (id) {
|
||||
res = await axios.get(`${envConfig.apiUrl}/area-ubicacion/programs/${id}`);
|
||||
res = await axios.get(
|
||||
`${envConfig.apiUrl}/area-ubicacion/programs/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
res?.data.forEach((item: any) => {
|
||||
@@ -135,3 +133,4 @@ export default function ProgramSelector({
|
||||
</form>
|
||||
);
|
||||
}
|
||||
//IO
|
||||
Reference in New Issue
Block a user