selector room and machine work only left save

This commit is contained in:
2026-01-28 16:40:39 -06:00
parent c288fe959c
commit 8c9e0e5de6
3 changed files with 61 additions and 36 deletions
@@ -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