feat(panel): quita la sección de Ajustes de la vista del becario
Elimina de la interfaz el formulario/lista de Ajustes (minutos ± con motivo) en la vista de detalle del becario, junto con su handler, estado y el fetch de /becarios/:id/ajustes. El endpoint del backend se conserva. El desglose de Avance (Checado + Ajustes = Total) se mantiene: sigue reconciliando el total y refleja ajustes ya existentes en la BD. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
59a0fecb1a
commit
28a7524f8f
1 file changed
+2
-39
+2
-39
@@ -322,22 +322,18 @@ function CerrarJornadaModal({ jornada, onDone, onCancel, onError }) {
|
||||
function VistaBecario({ becarioId, onBack, onError }) {
|
||||
const [data, setData] = useState(null);
|
||||
const [jornadas, setJornadas] = useState([]);
|
||||
const [ajustes, setAjustes] = useState([]);
|
||||
const [checadas, setChecadas] = useState([]);
|
||||
const [editJornada, setEditJornada] = useState(null);
|
||||
const [cerrarJornada, setCerrarJornada] = useState(null);
|
||||
const [ajuste, setAjuste] = useState({ minutos: "", motivo: "" });
|
||||
const [busyAjuste, setBusyAjuste] = useState(false);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try {
|
||||
const [d, j, a, c] = await Promise.all([
|
||||
const [d, j, c] = await Promise.all([
|
||||
apiFetch(`/becarios/${becarioId}`),
|
||||
apiFetch(`/becarios/${becarioId}/jornadas`),
|
||||
apiFetch(`/becarios/${becarioId}/ajustes`),
|
||||
apiFetch(`/becarios/${becarioId}/checadas`),
|
||||
]);
|
||||
setData(d); setJornadas(j); setAjustes(a); setChecadas(c);
|
||||
setData(d); setJornadas(j); setChecadas(c);
|
||||
} catch (e) { onError(e.message); }
|
||||
}, [becarioId, onError]);
|
||||
useEffect(() => { load(); }, [load]);
|
||||
@@ -349,15 +345,6 @@ function VistaBecario({ becarioId, onBack, onError }) {
|
||||
catch (e) { onError(e.message); }
|
||||
} else { setCerrarJornada(j); }
|
||||
};
|
||||
const crearAjuste = async (e) => {
|
||||
e.preventDefault(); setBusyAjuste(true);
|
||||
try {
|
||||
await apiFetch(`/becarios/${becarioId}/ajustes`, {
|
||||
method: "POST", body: JSON.stringify({ minutos: Number(ajuste.minutos), motivo: ajuste.motivo.trim() }),
|
||||
});
|
||||
setAjuste({ minutos: "", motivo: "" }); await load();
|
||||
} catch (err) { onError(err.message); } finally { setBusyAjuste(false); }
|
||||
};
|
||||
|
||||
if (!data) return <p style={{ color: palette.inkSoft, fontFamily: fonts.body }}>Cargando…</p>;
|
||||
const h = data.horas;
|
||||
@@ -429,30 +416,6 @@ function VistaBecario({ becarioId, onBack, onError }) {
|
||||
</Table>
|
||||
</div>}
|
||||
|
||||
<h3 style={sec}>Ajustes</h3>
|
||||
<Card style={{ marginBottom: "22px", padding: "20px 22px" }}>
|
||||
<form onSubmit={crearAjuste} style={{ display: "flex", gap: "12px", alignItems: "flex-end", flexWrap: "wrap", marginBottom: ajustes.length ? "4px" : 0 }}>
|
||||
<div style={{ width: "130px" }}>
|
||||
<Field label="Minutos (+/−)"><Input type="number" value={ajuste.minutos} onChange={(e) => setAjuste({ ...ajuste, minutos: e.target.value })} placeholder="ej. 60 o -30" required /></Field>
|
||||
</div>
|
||||
<div style={{ flex: 1, minWidth: "220px" }}>
|
||||
<Field label="Motivo (obligatorio)"><Input value={ajuste.motivo} onChange={(e) => setAjuste({ ...ajuste, motivo: e.target.value })} required /></Field>
|
||||
</div>
|
||||
<div style={{ marginBottom: "14px" }}>
|
||||
<Btn type="submit" loading={busyAjuste} disabled={busyAjuste || !ajuste.minutos || Number(ajuste.minutos) === 0 || !ajuste.motivo.trim()}>Agregar</Btn>
|
||||
</div>
|
||||
</form>
|
||||
{ajustes.map((a) => (
|
||||
<div key={a.id} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", borderTop: `1px solid ${palette.cardBorder}`, padding: "12px 0", gap: "10px" }}>
|
||||
<div style={{ fontFamily: fonts.body, fontSize: "14px", color: palette.ink }}>
|
||||
<strong style={{ color: a.minutos >= 0 ? palette.green : palette.danger, fontWeight: 700 }}>{a.minutos >= 0 ? "+" : ""}{a.minutos} min</strong>
|
||||
<span style={{ color: palette.inkSoft }}> · {a.motivo}</span>
|
||||
</div>
|
||||
<span style={{ fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft, whiteSpace: "nowrap" }}>{fmtDT(a.created_at)}</span>
|
||||
</div>
|
||||
))}
|
||||
</Card>
|
||||
|
||||
<h3 style={{ ...sec, marginBottom: "6px" }}>Checadas <span style={{ fontFamily: fonts.body, fontWeight: 400, fontSize: "13px", color: palette.inkSoft }}>(con IP / dispositivo)</span></h3>
|
||||
<p style={{ margin: "0 0 12px", fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft }}>
|
||||
IP y user-agent son señal secundaria de anomalías, no prueba de ubicación.
|
||||
|
||||
Reference in new issue
Block a user