2022-07-26 01:03:32 +00:00
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
2022-07-19 02:55:01 +00:00
|
|
|
import { InputText } from 'primereact/inputtext';
|
|
|
|
import { Button } from 'primereact/button';
|
|
|
|
import { DataTable } from 'primereact/datatable';
|
|
|
|
import { Column } from 'primereact/column';
|
2022-07-26 01:03:32 +00:00
|
|
|
import { Toast } from 'primereact/toast';
|
|
|
|
import { Dialog } from 'primereact/dialog';
|
|
|
|
import { Toolbar } from 'primereact/toolbar';
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
|
|
import { faUserAlt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { faAt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons';
|
2022-08-03 05:19:00 +00:00
|
|
|
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { useCookies } from "react-cookie";
|
2022-07-19 02:55:01 +00:00
|
|
|
|
|
|
|
const GuardasSeguridad = () => {
|
2022-08-03 05:19:00 +00:00
|
|
|
|
2022-07-26 01:03:32 +00:00
|
|
|
let emptyGuarda = {
|
|
|
|
_id: null,
|
|
|
|
dni: '',
|
|
|
|
name: '',
|
|
|
|
last_name: '',
|
|
|
|
email: '',
|
|
|
|
phone: '',
|
|
|
|
password: '',
|
|
|
|
user_type: '1',
|
2022-08-03 05:58:45 +00:00
|
|
|
status: '1',
|
2022-08-03 05:19:00 +00:00
|
|
|
status_text: '',
|
2022-07-26 01:03:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-08-03 05:58:45 +00:00
|
|
|
const [listaGuardas, setListaGuardas] = useState([]);
|
|
|
|
const [urlFetch, setUrlFetch] = useState('http://localhost:4000/user/findGuards/');
|
|
|
|
const [guarda, setGuarda] = useState(emptyGuarda);
|
|
|
|
const [selectedGuardas, setSelectedGuardas] = useState(null);
|
|
|
|
const [globalFilter, setGlobalFilter] = useState(null);
|
|
|
|
const [deleteGuardaDialog, setDeleteGuardaDialog] = useState(false);
|
|
|
|
const [deleteGuardasDialog, setDeleteGuardasDialog] = useState(false);
|
|
|
|
const toast = useRef(null);
|
|
|
|
const dt = useRef(null);
|
|
|
|
|
|
|
|
const [cookies, setCookie] = useCookies();
|
|
|
|
const [changeStatusGuardDialog, setChangeStatusGuardDialog] = useState(false);
|
|
|
|
|
|
|
|
const [guardDialog, setGuardDialog] = useState(false);
|
|
|
|
const [submitted, setSubmitted] = useState(false);
|
|
|
|
|
2022-07-26 01:03:32 +00:00
|
|
|
|
2022-08-01 03:09:57 +00:00
|
|
|
async function listaGuardasF() {
|
2022-08-03 05:58:45 +00:00
|
|
|
let nombres = await fetch((urlFetch + cookies.community_id), { method: 'GET' });
|
2022-08-01 03:09:57 +00:00
|
|
|
let listaGuardasRes = await nombres.json();
|
2022-08-03 05:19:00 +00:00
|
|
|
let data = await listaGuardasRes.message.filter(
|
|
|
|
(val) => val.status != -1,
|
|
|
|
)
|
|
|
|
await data.map((item) => {
|
|
|
|
if (item.status == '1') {
|
|
|
|
item.status_text = 'Activo';
|
|
|
|
} else if (item.status == '0') {
|
|
|
|
item.status_text = 'Inactivo';
|
|
|
|
}
|
|
|
|
})
|
|
|
|
setListaGuardas(await data);
|
2022-08-01 03:09:57 +00:00
|
|
|
}
|
2022-08-03 05:58:45 +00:00
|
|
|
|
2022-08-01 03:09:57 +00:00
|
|
|
useEffect(() => {
|
2022-07-26 01:03:32 +00:00
|
|
|
listaGuardasF();
|
2022-08-01 03:09:57 +00:00
|
|
|
}, [])
|
2022-07-19 02:55:01 +00:00
|
|
|
|
2022-07-19 03:33:36 +00:00
|
|
|
function registrarGuarda() {
|
2022-07-19 02:55:01 +00:00
|
|
|
var data = {
|
|
|
|
dni: document.getElementById('identificacion').value,
|
|
|
|
name: document.getElementById('nombre').value,
|
|
|
|
last_name: document.getElementById('apellidos').value,
|
|
|
|
email: document.getElementById('correo_electronico').value,
|
|
|
|
phone: document.getElementById('telefono').value,
|
|
|
|
password: document.getElementById('correo_electronico').value,
|
2022-07-19 03:33:36 +00:00
|
|
|
user_type: "4", //4 es guarda
|
|
|
|
status: "1",
|
2022-08-03 05:19:00 +00:00
|
|
|
community_id: cookies.community_id
|
2022-07-19 02:55:01 +00:00
|
|
|
};
|
2022-08-01 03:09:57 +00:00
|
|
|
var data2 = {
|
2022-07-26 01:03:32 +00:00
|
|
|
dni: "11979037",
|
|
|
|
name: "Jorge",
|
|
|
|
last_name: "Soto",
|
|
|
|
email: "jorgesoto@gmail.com",
|
2022-07-19 03:33:36 +00:00
|
|
|
phone: 84664515,
|
|
|
|
password: "1203",
|
|
|
|
user_type: "2",
|
2022-08-03 05:19:00 +00:00
|
|
|
status: "1",
|
2022-08-01 03:09:57 +00:00
|
|
|
community_id: "62be68215692582bbfd77134"
|
2022-07-19 03:33:36 +00:00
|
|
|
}
|
2022-08-01 03:09:57 +00:00
|
|
|
console.log('ssss');
|
|
|
|
fetch('http://localhost:4000/user/createGuard', {
|
2022-07-19 02:55:01 +00:00
|
|
|
cache: 'no-cache',
|
|
|
|
method: 'POST',
|
2022-08-01 03:09:57 +00:00
|
|
|
mode: 'cors',
|
2022-08-03 05:19:00 +00:00
|
|
|
body: JSON.stringify(data),
|
2022-07-19 02:55:01 +00:00
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
2022-08-01 03:09:57 +00:00
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
if (response.status != 201)
|
|
|
|
console.log('Ocurrió un error con el servicio: ' + response.status);
|
|
|
|
else
|
|
|
|
return response.json();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
listaGuardasF();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.catch(
|
|
|
|
err => console.log('Ocurrió un error con el fetch', err)
|
|
|
|
);
|
2022-07-19 02:55:01 +00:00
|
|
|
}
|
|
|
|
|
2022-08-03 05:19:00 +00:00
|
|
|
const cambiarStatusUser = () => {
|
|
|
|
if (guarda.status == '1') {
|
|
|
|
guarda.status = '0';
|
|
|
|
guarda.status_text = 'Inactivo';
|
2022-07-26 01:03:32 +00:00
|
|
|
|
2022-08-03 05:19:00 +00:00
|
|
|
} else if (guarda.status == '0') {
|
|
|
|
guarda.status = '1';
|
|
|
|
guarda.status_text = 'Activo';
|
|
|
|
}
|
|
|
|
var data = {
|
|
|
|
id: guarda._id,
|
|
|
|
status: guarda.status,
|
|
|
|
};
|
|
|
|
fetch('http://localhost:4000/user/changeStatus', {
|
|
|
|
cache: 'no-cache',
|
|
|
|
method: 'POST',
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
if (response.status != 201)
|
|
|
|
console.log('Ocurrió un error con el servicio: ' + response.status);
|
|
|
|
else
|
|
|
|
return response.json();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
setChangeStatusGuardDialog(false);
|
|
|
|
toast.current.show({
|
|
|
|
severity: 'success',
|
|
|
|
summary: 'Éxito',
|
|
|
|
detail: 'Guarda de Seguridad Actualizado',
|
|
|
|
life: 3000,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.catch(
|
|
|
|
err => console.log('Ocurrió un error con el fetch', err)
|
|
|
|
);
|
2022-07-26 01:03:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const deleteGuarda = () => {
|
|
|
|
|
|
|
|
fetch('http://localhost:4000/user/deleteAdminSystem/' + guarda._id, {
|
|
|
|
cache: 'no-cache',
|
|
|
|
method: 'DELETE',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
if (response.status != 201)
|
|
|
|
console.log('Ocurrió un error con el servicio: ' + response.status);
|
|
|
|
else
|
|
|
|
return response.json();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.then(
|
|
|
|
function (response) {
|
|
|
|
let _guarda = listaGuardas.filter(val => val._id !== guarda._id);
|
|
|
|
setListaGuardas(_guarda);
|
|
|
|
setDeleteGuardaDialog(false);
|
|
|
|
setGuarda(emptyGuarda);
|
|
|
|
toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administrador del Sistema Eliminado', life: 3000 });
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.catch(
|
|
|
|
err => {
|
|
|
|
console.log('Ocurrió un error con el fetch', err)
|
|
|
|
toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Administrador del Sistema no se pudo Eliminar', life: 3000 });
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const deleteSelectedGuardas = () => {
|
|
|
|
let _guardas = listaGuardas.filter(val => !selectedGuardas.includes(val));
|
|
|
|
selectedGuardas.map((item) => {
|
|
|
|
fetch('http://localhost:4000/user/deleteAdminSystem/' + item._id, {
|
|
|
|
cache: 'no-cache',
|
|
|
|
method: 'DELETE',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
setListaGuardas(_guardas);
|
|
|
|
setDeleteGuardasDialog(false);
|
|
|
|
setSelectedGuardas(null);
|
|
|
|
toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administradores del Sistema Eliminados', life: 3000 });
|
|
|
|
}
|
|
|
|
|
2022-08-03 05:19:00 +00:00
|
|
|
const hideDeleteGuardaDialog = () => {
|
|
|
|
setDeleteGuardaDialog(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
const hideDeleteGuardasDialog = () => {
|
|
|
|
setDeleteGuardasDialog(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
const confirmDeleteGuarda = (guarda) => {
|
|
|
|
setGuarda(guarda);
|
|
|
|
setDeleteGuardaDialog(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
const confirmDeleteSelected = () => {
|
|
|
|
setDeleteGuardasDialog(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
const hideChangeStatusGuardDialog = () => {
|
|
|
|
setChangeStatusGuardDialog(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
const confirmChangeStatusGuard = (guard) => {
|
|
|
|
setGuarda(guard);
|
|
|
|
setChangeStatusGuardDialog(true);
|
|
|
|
};
|
|
|
|
|
2022-08-03 05:58:45 +00:00
|
|
|
const hideGuardDialog = () => {
|
|
|
|
setSubmitted(false);
|
|
|
|
setGuardDialog(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
const infoGuard = (guard) => {
|
|
|
|
setGuarda(guard);
|
|
|
|
setGuardDialog(true);
|
|
|
|
};
|
|
|
|
|
2022-08-03 05:19:00 +00:00
|
|
|
|
2022-08-03 05:58:45 +00:00
|
|
|
const actionsGuard = (rowData) => {
|
2022-08-03 05:19:00 +00:00
|
|
|
let icono = '';
|
|
|
|
let text = '';
|
|
|
|
if (rowData.status == '0') {
|
|
|
|
icono = "pi pi-eye";
|
|
|
|
text = "Activar Guarda de Seguridad"
|
|
|
|
} else if (rowData.status == '1') {
|
|
|
|
icono = "pi pi-eye-slash";
|
|
|
|
text = "Inactivar Guarda de Seguridad"
|
|
|
|
|
|
|
|
}
|
2022-07-26 01:03:32 +00:00
|
|
|
return (
|
|
|
|
<div className="actions">
|
2022-08-03 05:58:45 +00:00
|
|
|
<Button
|
|
|
|
icon="pi pi-exclamation-circle"
|
|
|
|
className="p-button-rounded p-button-info mt-2 mx-2"
|
|
|
|
onClick={() => infoGuard(rowData)}
|
|
|
|
/>
|
2022-08-03 05:19:00 +00:00
|
|
|
<Button
|
|
|
|
icon={`${icono}`}
|
|
|
|
className="p-button-rounded p-button-warning mt-2 mx-2"
|
|
|
|
onClick={() => confirmChangeStatusGuard(rowData)}
|
|
|
|
title={`${text}`}
|
|
|
|
/>
|
|
|
|
<Button icon="pi pi-trash"
|
2022-08-03 05:22:51 +00:00
|
|
|
className="p-button-rounded p-button-danger mt-2 mx-2"
|
2022-08-03 05:19:00 +00:00
|
|
|
onClick={() => confirmDeleteGuarda(rowData)} />
|
2022-07-26 01:03:32 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const leftToolbarTemplate = () => {
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
|
|
|
<div className="my-2">
|
2022-08-03 05:19:00 +00:00
|
|
|
<Button label="Eliminar"
|
|
|
|
icon="pi pi-trash"
|
|
|
|
className="p-button-danger"
|
|
|
|
onClick={confirmDeleteSelected}
|
|
|
|
disabled={!selectedGuardas || !selectedGuardas.length} />
|
2022-07-26 01:03:32 +00:00
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const rightToolbarTemplate = () => {
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
2022-08-03 05:19:00 +00:00
|
|
|
<Button label="Exportar"
|
|
|
|
icon="pi pi-upload"
|
|
|
|
className="p-button-help" />
|
2022-07-26 01:03:32 +00:00
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const header = (
|
|
|
|
<div className="flex flex-column md:flex-row md:justify-content-between md:align-items-center">
|
|
|
|
<h5 className="m-0">Guardas de seguridad</h5>
|
|
|
|
<span className="block mt-2 md:mt-0 p-input-icon-left">
|
|
|
|
<i className="pi pi-search" />
|
|
|
|
<InputText type="search" onInput={(e) => setGlobalFilter(e.target.value)} placeholder="Buscar..." />
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
const deleteAdminSystemDialogFooter = (
|
|
|
|
<>
|
|
|
|
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} />
|
2022-08-03 05:22:51 +00:00
|
|
|
<Button label="Sí" icon="pi pi-check" className="p-button-text" onClick={deleteGuarda} />
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
const deleteAdminsSystemDialogFooter = (
|
|
|
|
<>
|
|
|
|
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} />
|
2022-08-03 05:22:51 +00:00
|
|
|
<Button label="Sí" icon="pi pi-check" className="p-button-text" onClick={deleteSelectedGuardas} />
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2022-08-03 05:19:00 +00:00
|
|
|
const changeStatusGuardDialogFooter = (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
label="No"
|
|
|
|
icon="pi pi-times"
|
|
|
|
className="p-button-text"
|
|
|
|
onClick={hideChangeStatusGuardDialog}
|
|
|
|
/>
|
|
|
|
<Button
|
2022-08-03 05:22:51 +00:00
|
|
|
label="Sí"
|
2022-08-03 05:19:00 +00:00
|
|
|
icon="pi pi-check"
|
|
|
|
className="p-button-text"
|
|
|
|
onClick={cambiarStatusUser}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2022-08-03 05:58:45 +00:00
|
|
|
const guardDialogFooter = (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
label="Cerrar"
|
|
|
|
icon="pi pi-times"
|
|
|
|
className="p-button-text"
|
|
|
|
onClick={hideGuardDialog}
|
|
|
|
/>
|
|
|
|
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2022-07-26 01:03:32 +00:00
|
|
|
const headerName = (
|
|
|
|
<>
|
2022-08-01 03:09:57 +00:00
|
|
|
<p>{' '}
|
|
|
|
<FontAwesomeIcon icon={faUserAlt} style={{ color: "#C08135" }} /> {' '}
|
|
|
|
Nombre
|
|
|
|
</p>
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
|
|
|
|
const headerLastName = (
|
|
|
|
<>
|
2022-08-01 03:09:57 +00:00
|
|
|
<p>
|
|
|
|
{' '}
|
|
|
|
<FontAwesomeIcon icon={faUserAlt} style={{ color: "#D7A86E" }} />{' '}
|
|
|
|
Apellido(s)
|
|
|
|
</p>
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
|
|
|
|
const headerDNI = (
|
2022-08-01 03:09:57 +00:00
|
|
|
<p> {' '}
|
|
|
|
<FontAwesomeIcon icon={faIdCardAlt} style={{ color: "#C08135" }} />{' '}
|
|
|
|
Identificación
|
|
|
|
</p>
|
2022-07-26 01:03:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const headerEmail = (
|
|
|
|
<>
|
2022-08-01 03:09:57 +00:00
|
|
|
<p> {' '}
|
|
|
|
<FontAwesomeIcon icon={faAt} style={{ color: "#D7A86E" }} />{' '}
|
|
|
|
Correo Electrónico
|
|
|
|
</p>
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
|
|
|
|
const headerPhone = (
|
|
|
|
<>
|
2022-08-01 03:09:57 +00:00
|
|
|
<p>
|
|
|
|
{' '}
|
|
|
|
<FontAwesomeIcon icon={faPhoneAlt} style={{ color: '#C08135' }} />{' '}
|
|
|
|
Teléfono
|
|
|
|
</p>
|
2022-07-26 01:03:32 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
|
2022-08-03 05:26:32 +00:00
|
|
|
const headerStatus = (
|
|
|
|
<>
|
|
|
|
<p> {' '}
|
|
|
|
<FontAwesomeIcon icon={faCircleQuestion} style={{ color: "#D7A86E" }} />{' '}
|
|
|
|
Estado
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
|
|
|
|
const statusBodyTemplate = (rowData) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span
|
|
|
|
className={`status status-${rowData.status}`}
|
|
|
|
>
|
|
|
|
{rowData.status_text}
|
|
|
|
</span>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
2022-07-26 01:03:32 +00:00
|
|
|
|
2022-07-19 02:55:01 +00:00
|
|
|
return (
|
|
|
|
<div className="grid">
|
2022-08-01 03:09:57 +00:00
|
|
|
<div className="col-12">
|
2022-07-26 01:03:32 +00:00
|
|
|
<Toast ref={toast} />
|
2022-07-19 02:55:01 +00:00
|
|
|
<div className="card">
|
2022-08-01 03:09:57 +00:00
|
|
|
<Toolbar className="mb-4" left={leftToolbarTemplate} right={rightToolbarTemplate}></Toolbar>
|
2022-07-26 01:03:32 +00:00
|
|
|
<DataTable ref={dt} value={listaGuardas} dataKey="_id" paginator rows={5} selection={selectedGuardas} onSelectionChange={(e) => setSelectedGuardas(e.value)}
|
2022-08-01 03:09:57 +00:00
|
|
|
responsiveLayout="scroll" header={header}
|
2022-07-26 01:03:32 +00:00
|
|
|
rowsPerPageOptions={[5, 10, 25]} className="datatable-responsive mt-3"
|
|
|
|
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
|
|
|
currentPageReportTemplate="Mostrando {first} a {last} de {totalRecords}"
|
|
|
|
globalFilter={globalFilter} emptyMessage="No hay guardas registrados.">
|
|
|
|
<Column selectionMode="multiple" headerStyle={{ width: '3rem' }}></Column>
|
|
|
|
<Column field="name" sortable header={headerName} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}></Column>
|
|
|
|
<Column field="last_name" sortable header={headerLastName} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }} alignFrozen="left"></Column>
|
|
|
|
<Column field="dni" sortable header={headerDNI} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
|
|
|
|
</Column>
|
|
|
|
<Column field="email" sortable header={headerEmail} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}></Column>
|
2022-08-01 03:09:57 +00:00
|
|
|
<Column field="phone" header={headerPhone} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}></Column>
|
2022-08-03 05:26:32 +00:00
|
|
|
<Column
|
|
|
|
field="status"
|
|
|
|
sortable
|
|
|
|
header={headerStatus}
|
|
|
|
body={statusBodyTemplate}
|
|
|
|
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
|
|
|
|
</Column>
|
2022-08-03 05:58:45 +00:00
|
|
|
<Column style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px' }} body={actionsGuard}></Column>
|
2022-07-19 02:55:01 +00:00
|
|
|
</DataTable>
|
2022-08-03 05:58:45 +00:00
|
|
|
<Dialog
|
|
|
|
visible={guardDialog}
|
|
|
|
style={{ width: '650px' }}
|
|
|
|
header="Información del Guarda de Seguridad"
|
|
|
|
modal
|
|
|
|
className="p-fluid"
|
|
|
|
footer={guardDialogFooter}
|
|
|
|
onHide={hideGuardDialog}>
|
|
|
|
<div className='container text-center'>
|
|
|
|
<div className='row my-4'>
|
2022-08-03 06:10:45 +00:00
|
|
|
<div className=" col-4 md:col-4">
|
2022-08-03 05:58:45 +00:00
|
|
|
<p>Nombre</p>
|
|
|
|
<div className="p-0 col-2 md:col-2" style={{ margin: '0 auto' }}>
|
|
|
|
<div className="p-inputgroup align-items-center justify-content-evenly">
|
|
|
|
<i className="pi pi-user icon-khaki"></i>
|
|
|
|
<p>{guarda.name}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-03 06:10:45 +00:00
|
|
|
<div className=" col-4 md:col-4">
|
2022-08-03 05:58:45 +00:00
|
|
|
<p>Apellido(s)</p>
|
|
|
|
<div className="p-0 col-6 md:col-6" style={{ margin: '0 auto' }}>
|
|
|
|
<div className="p-inputgroup align-items-center justify-content-evenly">
|
|
|
|
<i className="pi pi-user icon-khaki"></i>
|
|
|
|
<p>{guarda.last_name}</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className=" col-4 col-md-4 md:col-4">
|
|
|
|
<p>Identificación</p>
|
2022-08-03 06:10:45 +00:00
|
|
|
<div className="p-0 col-10 md:col-10" style={{ margin: '0 auto' }}>
|
2022-08-03 05:58:45 +00:00
|
|
|
<div className="p-inputgroup align-items-center justify-content-evenly">
|
2022-08-03 06:10:45 +00:00
|
|
|
<i className="pi pi-id-card icon-khaki"></i>
|
2022-08-03 05:58:45 +00:00
|
|
|
<p>{guarda.dni}</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-03 06:10:45 +00:00
|
|
|
</div>
|
|
|
|
<div className='row my-5 justify-content-center'>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div className='row my-5 justify-content-center'>
|
2022-08-03 05:58:45 +00:00
|
|
|
<div className=" col-4 md:col-4">
|
|
|
|
<p>Teléfono</p>
|
|
|
|
<div className="p-0 col-10 md:col-10">
|
|
|
|
<div className="p-inputgroup align-items-center justify-content-evenly">
|
|
|
|
<i className="pi pi-phone icon-khaki"></i>
|
|
|
|
<p>{guarda.phone}</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-03 06:10:45 +00:00
|
|
|
<div className=" col-6 md:col-6">
|
|
|
|
<p>Correo Electrónico</p>
|
|
|
|
<div className="p-0 col-10 md:col-10" style={{ margin: '0 auto' }}>
|
|
|
|
<div className="p-inputgroup align-items-center justify-content-evenly">
|
|
|
|
<i className="pi pi-envelope icon-khaki"></i>
|
|
|
|
<p>{guarda.email}</p>
|
|
|
|
</div>
|
2022-08-03 05:58:45 +00:00
|
|
|
|
2022-08-03 06:10:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-03 05:58:45 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</Dialog>
|
2022-07-26 01:03:32 +00:00
|
|
|
<Dialog visible={deleteGuardaDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminSystemDialogFooter} onHide={hideDeleteGuardaDialog}>
|
|
|
|
<div className="flex align-items-center justify-content-center">
|
|
|
|
<i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
|
|
|
|
{guarda && <span>¿Estás seguro que desea eliminar a <b>{guarda.name}</b>?</span>}
|
|
|
|
</div>
|
|
|
|
</Dialog>
|
|
|
|
<Dialog visible={deleteGuardasDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminsSystemDialogFooter} onHide={hideDeleteGuardasDialog}>
|
|
|
|
<div className="flex align-items-center justify-content-center">
|
|
|
|
<i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
|
2022-08-03 05:22:51 +00:00
|
|
|
{selectedGuardas && <span>¿Está seguro eliminar los guardas de seguridad seleccionados?</span>}
|
2022-07-26 01:03:32 +00:00
|
|
|
</div>
|
|
|
|
</Dialog>
|
2022-08-03 05:19:00 +00:00
|
|
|
<Dialog
|
|
|
|
visible={changeStatusGuardDialog}
|
|
|
|
style={{ width: '450px' }}
|
|
|
|
header="Confirmar"
|
|
|
|
modal
|
|
|
|
footer={changeStatusGuardDialogFooter}
|
|
|
|
onHide={hideChangeStatusGuardDialog}
|
|
|
|
>
|
|
|
|
<div className="flex align-items-center justify-content-center">
|
|
|
|
<i
|
|
|
|
className="pi pi-exclamation-triangle mr-3"
|
|
|
|
style={{ fontSize: '2rem' }}
|
|
|
|
/>
|
|
|
|
{guarda && (
|
|
|
|
<span>
|
|
|
|
¿Estás seguro que desea cambiar estado a <b>{guarda.name}</b>?
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</Dialog>
|
2022-07-19 02:55:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="col-12">
|
|
|
|
<div className="card">
|
2022-07-19 03:33:36 +00:00
|
|
|
<h5>Registro de un guarda de seguridad</h5>
|
2022-07-19 02:55:01 +00:00
|
|
|
<div className="p-fluid formgrid grid">
|
|
|
|
<div className="field col-12 md:col-6">
|
|
|
|
<label htmlFor="nombre">Nombre</label>
|
|
|
|
<InputText id="nombre" type="text" />
|
|
|
|
</div>
|
|
|
|
<div className="field col-12 md:col-6">
|
2022-08-03 05:26:32 +00:00
|
|
|
<label htmlFor="apellidos">Apellido(s)</label>
|
2022-07-19 02:55:01 +00:00
|
|
|
<InputText id="apellidos" type="text" />
|
|
|
|
</div>
|
|
|
|
<div className="field col-12 md:col-6">
|
|
|
|
<label htmlFor="correo_electronico">Correo electrónico</label>
|
2022-08-03 05:26:32 +00:00
|
|
|
<InputText id="correo_electronico" type="email" />
|
2022-07-19 02:55:01 +00:00
|
|
|
</div>
|
|
|
|
<div className="field col-12 md:col-6">
|
|
|
|
<label htmlFor="identificacion">Identificación</label>
|
|
|
|
<InputText id="identificacion" type="text" />
|
|
|
|
</div>
|
|
|
|
<div className="field col-12">
|
|
|
|
<label htmlFor="telefono">Teléfono</label>
|
2022-08-03 05:26:32 +00:00
|
|
|
<InputText id="telefono" type="tel" rows="4" />
|
2022-07-19 02:55:01 +00:00
|
|
|
</div>
|
2022-07-19 03:33:36 +00:00
|
|
|
<Button label="Registrar" onClick={registrarGuarda}></Button>
|
2022-07-19 02:55:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-01 03:09:57 +00:00
|
|
|
);
|
2022-07-25 04:38:48 +00:00
|
|
|
};
|
2022-07-19 02:55:01 +00:00
|
|
|
|
2022-07-25 04:38:48 +00:00
|
|
|
export default React.memo(GuardasSeguridad);
|