feat(access): paridad funcional de verificacion peaton vs conductor y pulsos a barrera/molinete segun desktop pct_view
This commit is contained in:
@@ -12,6 +12,7 @@ interface ExitVerificationModalProps {
|
||||
onClose: () => void;
|
||||
ticket: ActiveTicket | null;
|
||||
moduloSalidaId: number;
|
||||
esAccesoPeatonal?: boolean;
|
||||
onExitConfirmed: (message: string) => void;
|
||||
}
|
||||
|
||||
@@ -20,6 +21,7 @@ export const ExitVerificationModal: React.FC<ExitVerificationModalProps> = ({
|
||||
onClose,
|
||||
ticket,
|
||||
moduloSalidaId,
|
||||
esAccesoPeatonal = false,
|
||||
onExitConfirmed,
|
||||
}) => {
|
||||
const [ocupantesOriginales, setOcupantesOriginales] = useState<TicketOccupant[]>([]);
|
||||
@@ -163,11 +165,14 @@ export const ExitVerificationModal: React.FC<ExitVerificationModalProps> = ({
|
||||
rol_id: v.rol_id,
|
||||
}));
|
||||
|
||||
const isConductor = Boolean(ticket.patente && ticket.patente.trim());
|
||||
|
||||
await accessApi.registerExit({
|
||||
ticket_id: ticket.ticket_id,
|
||||
modulo_salida_id: moduloSalidaId,
|
||||
persona_id: ticket.persona_id,
|
||||
patente_salida: ticket.patente || '',
|
||||
tipo_salida: isConductor ? 'CONDUCTOR' : 'PEATON',
|
||||
abrir_barrera: true,
|
||||
personas_ids_permanecen: pidsPermanecen,
|
||||
integrantes_verificados: acompanantesDTO,
|
||||
@@ -534,7 +539,13 @@ export const ExitVerificationModal: React.FC<ExitVerificationModalProps> = ({
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
{isConfirming ? 'Procesando...' : `🚗 Confirmar Salida y Abrir Barrera (${verificados.length})`}
|
||||
{isConfirming
|
||||
? 'Procesando...'
|
||||
: Boolean(ticket?.patente && ticket.patente.trim())
|
||||
? `🚗 Confirmar Salida y Abrir Barrera (${verificados.length})`
|
||||
: esAccesoPeatonal
|
||||
? `🚶 Confirmar Salida (Habilitar Molinete/Puerta) (${verificados.length})`
|
||||
: `🚶 Confirmar Salida Peatonal (${verificados.length})`}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,9 @@ export interface LaneModule {
|
||||
name: string;
|
||||
address: number;
|
||||
type: string;
|
||||
tipo_acceso_id?: number;
|
||||
tipo_acceso_nombre?: string;
|
||||
es_acceso_peatonal?: boolean;
|
||||
barrier_state?: 'closed' | 'open' | 'opening';
|
||||
}
|
||||
|
||||
@@ -122,6 +125,7 @@ export interface ExitRequestData {
|
||||
modulo_salida_id: number;
|
||||
persona_id?: number;
|
||||
patente_salida?: string;
|
||||
tipo_salida?: 'CONDUCTOR' | 'PEATON';
|
||||
abrir_barrera: boolean;
|
||||
personas_ids_permanecen?: number[];
|
||||
integrantes_verificados?: Companion[];
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user