2021-01-14 23:24:55 +00:00
|
|
|
import { estilosGlobales } from "../Estilos";
|
|
|
|
import { StyleSheet, css } from "aphrodite";
|
2021-01-15 00:49:21 +00:00
|
|
|
import { Tabla } from "./Tabla";
|
2021-03-04 13:02:33 +00:00
|
|
|
import { mostrarDescansos } from "../Store";
|
2021-03-03 14:56:22 +00:00
|
|
|
import { EstadoLayout } from "./ContenedorHorarios";
|
2021-03-11 13:52:21 +00:00
|
|
|
import { Switch, Match, For, createMemo } from "solid-js";
|
2021-03-04 13:02:33 +00:00
|
|
|
import { BotonMaxMin } from "./BotonMaxMin";
|
2021-03-11 13:52:21 +00:00
|
|
|
import { AnioData, ListaCursosUsuario } from "../types/DatosHorario";
|
2021-01-14 23:24:55 +00:00
|
|
|
|
2021-03-04 13:02:33 +00:00
|
|
|
interface MiHorarioProps {
|
|
|
|
estadoLayout: EstadoLayout,
|
2021-03-11 13:52:21 +00:00
|
|
|
setEstadoLayout: (v: EstadoLayout) => EstadoLayout,
|
|
|
|
cursosUsuario: ListaCursosUsuario
|
2021-03-04 13:02:33 +00:00
|
|
|
}
|
|
|
|
|
2021-03-11 13:52:21 +00:00
|
|
|
function Horario(props: { cursosUsuario: ListaCursosUsuario }) {
|
|
|
|
return <div>
|
|
|
|
<For each={props.cursosUsuario.cursos}>
|
|
|
|
{c => {
|
|
|
|
return <div>
|
|
|
|
<p>{c.abreviado} - {c.nombre}</p>
|
|
|
|
</div>
|
|
|
|
}}
|
|
|
|
</For>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
const e = StyleSheet.create({
|
|
|
|
horario: {},
|
|
|
|
boton: {
|
|
|
|
textDecoration: "none",
|
|
|
|
// paddingRight: "0.5rem",
|
|
|
|
"::before": {
|
|
|
|
fontSize: "1rem",
|
|
|
|
// transform: "translateY(0.2rem)",
|
|
|
|
textDecoration: "none"
|
2021-01-15 13:34:24 +00:00
|
|
|
}
|
2021-03-11 13:52:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export function MiHorario(props: MiHorarioProps) {
|
|
|
|
|
|
|
|
const datosMiHorario = createMemo(() => {
|
|
|
|
const obj: AnioData = {};
|
|
|
|
props.cursosUsuario.cursos.forEach(x => {
|
|
|
|
obj[x.nombre] = {...x};
|
|
|
|
});
|
|
|
|
return obj;
|
2021-01-14 23:24:55 +00:00
|
|
|
});
|
|
|
|
|
2021-01-15 13:34:24 +00:00
|
|
|
const claseBotonMostrarDescansos = () =>
|
|
|
|
mostrarDescansos()
|
|
|
|
? "ph-check " + css(e.boton)
|
|
|
|
: "ph-circle " + css(e.boton);
|
|
|
|
|
2021-03-04 13:02:33 +00:00
|
|
|
const fnMaximizar = () => props.setEstadoLayout("MaxPersonal");
|
|
|
|
const fnMinimizar = () => props.setEstadoLayout("Normal");
|
|
|
|
const estadoActualLayout = () => props.estadoLayout;
|
2021-03-03 14:56:22 +00:00
|
|
|
|
2021-03-04 13:02:33 +00:00
|
|
|
return <div>
|
2021-03-03 14:56:22 +00:00
|
|
|
<Switch>
|
2021-03-04 13:02:33 +00:00
|
|
|
<Match when={props.estadoLayout === "Normal" || props.estadoLayout === "MaxPersonal"}>
|
2021-03-03 14:56:22 +00:00
|
|
|
<div>
|
|
|
|
<div className={css(
|
|
|
|
estilosGlobales.inlineBlock,
|
|
|
|
estilosGlobales.contenedor
|
|
|
|
)}>
|
|
|
|
Mi horario
|
|
|
|
</div>
|
2021-03-04 13:02:33 +00:00
|
|
|
|
|
|
|
|
<BotonMaxMin
|
|
|
|
fnMaximizar={fnMaximizar}
|
|
|
|
fnMinimizar={fnMinimizar}
|
|
|
|
estadoActualLayout={estadoActualLayout}
|
|
|
|
estadoLayoutMax={"MaxPersonal"}
|
|
|
|
/>
|
2021-03-03 14:56:22 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={css(
|
|
|
|
e.horario,
|
|
|
|
estilosGlobales.contenedor
|
|
|
|
)}>
|
2021-03-11 13:52:21 +00:00
|
|
|
<Tabla data={datosMiHorario()} anio={"Mi horario"} version={1}/>
|
|
|
|
|
|
|
|
<Horario cursosUsuario={props.cursosUsuario}/>
|
|
|
|
|
2021-03-03 14:56:22 +00:00
|
|
|
</div>
|
|
|
|
</Match>
|
|
|
|
<Match when={props.estadoLayout === "MaxHorarios"}>
|
2021-03-04 13:02:33 +00:00
|
|
|
<BotonMaxMin
|
|
|
|
fnMaximizar={fnMaximizar}
|
|
|
|
fnMinimizar={fnMinimizar}
|
|
|
|
estadoActualLayout={estadoActualLayout}
|
|
|
|
estadoLayoutMax={"MaxPersonal"}
|
|
|
|
/>
|
2021-03-03 14:56:22 +00:00
|
|
|
</Match>
|
|
|
|
</Switch>
|
2021-01-14 23:24:55 +00:00
|
|
|
</div>;
|
|
|
|
}
|