feat(access): paridad funcional de verificacion peaton vs conductor y pulsos a barrera/molinete segun desktop pct_view

This commit is contained in:
Carlos Tello
2026-10-14 08:36:35 -03:00
parent d80a4dba74
commit 1f2b029e39
11 changed files with 345 additions and 15 deletions
+61 -7
View File
@@ -519,6 +519,21 @@ export const ControlPostView: React.FC = () => {
}
};
const selectedEntryModule = useMemo(() => {
return config?.entry_modules?.find((m) => m.id === selectedEntryModuleId);
}, [config, selectedEntryModuleId]);
const esModuloPeatonal = useMemo(() => {
if (!selectedEntryModule) return false;
if (selectedEntryModule.es_acceso_peatonal !== undefined) {
return selectedEntryModule.es_acceso_peatonal;
}
if (selectedEntryModule.tipo_acceso_id) {
return [1, 2, 7].includes(selectedEntryModule.tipo_acceso_id);
}
return false;
}, [selectedEntryModule]);
return (
<div
style={{
@@ -804,7 +819,13 @@ export const ControlPostView: React.FC = () => {
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0.5rem' }}>
<button
type="button"
onClick={() => setForm((prev) => ({ ...prev, tipo_ingreso: 'CONDUCTOR' }))}
onClick={() =>
setForm((prev) => ({
...prev,
tipo_ingreso: 'CONDUCTOR',
entidad: !prev.entidad || prev.entidad === 'PEATON...' ? 'CONDUCTOR...' : prev.entidad,
}))
}
style={{
minHeight: '48px',
borderRadius: '8px',
@@ -825,7 +846,14 @@ export const ControlPostView: React.FC = () => {
</button>
<button
type="button"
onClick={() => setForm((prev) => ({ ...prev, tipo_ingreso: 'PEATON' }))}
onClick={() =>
setForm((prev) => ({
...prev,
tipo_ingreso: 'PEATON',
patente: '',
entidad: !prev.entidad || prev.entidad === 'CONDUCTOR...' ? 'PEATON...' : prev.entidad,
}))
}
style={{
minHeight: '48px',
borderRadius: '8px',
@@ -864,7 +892,7 @@ export const ControlPostView: React.FC = () => {
>
{config.entry_modules.map((m) => (
<option key={m.id} value={m.id}>
{m.name} (Addr {m.address})
{m.name} (Addr {m.address}) — {m.tipo_acceso_nombre || (m.es_acceso_peatonal ? 'Molinete/Puerta' : 'Barrera')}
</option>
))}
</select>
@@ -1487,7 +1515,7 @@ export const ControlPostView: React.FC = () => {
)}
</div>
{/* Switch Abrir Barrera */}
{/* Switch Abrir Barrera / Molinete */}
<div
style={{
display: 'flex',
@@ -1510,9 +1538,23 @@ export const ControlPostView: React.FC = () => {
htmlFor="abrir_barrera_check"
style={{ fontSize: '0.9rem', fontWeight: 600, cursor: 'pointer', flex: 1 }}
>
Abrir barrera física al confirmar
{form.tipo_ingreso === 'CONDUCTOR'
? 'Abrir barrera física al confirmar'
: esModuloPeatonal
? 'Accionar paso físico (Molinete / Puerta)'
: 'Paso Peatonal (Barrera vehicular no accionada)'}
</label>
</div>
{form.tipo_ingreso === 'PEATON' && !esModuloPeatonal && (
<div style={{ fontSize: '0.8rem', color: 'var(--text-secondary)', padding: '0 0.5rem', marginTop: '-0.35rem' }}>
ℹ️ Según la regla del puesto de control, al registrar un peatón por un carril con barrera vehicular no se enviará pulso de apertura.
</div>
)}
{form.tipo_ingreso === 'PEATON' && esModuloPeatonal && (
<div style={{ fontSize: '0.8rem', color: 'var(--status-success)', padding: '0 0.5rem', marginTop: '-0.35rem', fontWeight: 600 }}>
✓ Módulo configurado como Molinete/Puerta: se enviará pulso para destrabar el paso.
</div>
)}
{/* Botón Principal de Envío */}
<button
@@ -1531,7 +1573,13 @@ export const ControlPostView: React.FC = () => {
boxShadow: 'var(--shadow-md)',
}}
>
{isSubmitting ? 'Registrando...' : '✓ REGISTRAR INGRESO Y ABRIR'}
{isSubmitting
? 'Registrando...'
: form.tipo_ingreso === 'CONDUCTOR'
? '✓ REGISTRAR INGRESO Y ABRIR BARRERA'
: esModuloPeatonal
? '✓ REGISTRAR INGRESO PEATONAL (HABILITAR PASO)'
: '✓ REGISTRAR INGRESO PEATONAL (SIN BARRERA)'}
</button>
</form>
</section>
@@ -1669,7 +1717,7 @@ export const ControlPostView: React.FC = () => {
>
{config.exit_modules.map((m) => (
<option key={m.id} value={m.id}>
{m.name} (Addr {m.address})
{m.name} (Addr {m.address}) — {m.tipo_acceso_nombre || (m.es_acceso_peatonal ? 'Molinete/Puerta' : 'Barrera')}
</option>
))}
</select>
@@ -1924,6 +1972,12 @@ export const ControlPostView: React.FC = () => {
}}
ticket={ticketForExit}
moduloSalidaId={selectedExitModuleId}
esAccesoPeatonal={
config?.exit_modules?.find((m) => m.id === selectedExitModuleId)?.es_acceso_peatonal ??
(config?.exit_modules?.find((m) => m.id === selectedExitModuleId)?.tipo_acceso_id
? [1, 2, 7].includes(config.exit_modules.find((m) => m.id === selectedExitModuleId)!.tipo_acceso_id!)
: false)
}
onExitConfirmed={(msg) => {
setActionSuccess(msg);
setTimeout(() => setActionSuccess(null), 5000);