Merge branch 'US-48-Activar-Desactivarguardadeseguridad' into US-42-EliminarInquilino

This commit is contained in:
Mariela 2022-08-02 23:28:29 -06:00
commit f5adbeb20f
9 changed files with 657 additions and 187 deletions

View File

@ -128,6 +128,14 @@ export class AppController {
return this.appService.deleteAdminSystem(id); return this.appService.deleteAdminSystem(id);
} }
@Post('user/changeStatus')
changeStatusUser(
@Body('id') pId: string,
@Body('status') pStatus: string,
) {
return this.appService.changeStatusUser(pId, pStatus);
}
// #==== API Communities // #==== API Communities
@Post('community/createCommunity') @Post('community/createCommunity')
createCommunity( createCommunity(
@ -174,11 +182,11 @@ export class AppController {
return this.appService.findCommunityAdmin(community_id); return this.appService.findCommunityAdmin(community_id);
} }
@Post('community/changeStatus') @Post('community/changeStatus')
changeStatus( changeStatusCommunity(
@Body('id') pId: string, @Body('id') pId: string,
@Body('status') pStatus: string, @Body('status') pStatus: string,
) { ) {
return this.appService.changeStatus(pId, pStatus); return this.appService.changeStatusCommunity(pId, pStatus);
} }
// #==== API Common Areas // #==== API Common Areas
@Post('commonArea/createCommonArea') @Post('commonArea/createCommonArea')

View File

@ -18,7 +18,7 @@ export class AppService {
@Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy, @Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy,
@Inject('SERVICIO_NOTIFICACIONES') @Inject('SERVICIO_NOTIFICACIONES')
private readonly clientNotificationtApp: ClientProxy, private readonly clientNotificationtApp: ClientProxy,
) {} ) { }
// ====================== USERS =============================== // ====================== USERS ===============================
@ -179,13 +179,6 @@ export class AppService {
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
changeStatus(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientCommunityApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
//GET parameter from API //GET parameter from API
@ -197,8 +190,23 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
changeStatusUser(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientUserApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
// ====================== COMMUNITIES =============================== // ====================== COMMUNITIES ===============================
changeStatusCommunity(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientCommunityApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
//POST parameter from API //POST parameter from API
createCommunity(name: string, province: string, canton: string, district: string createCommunity(name: string, province: string, canton: string, district: string

View File

@ -51,8 +51,6 @@ export class CommunitiesController {
changeStatus(@Payload() body: string) { changeStatus(@Payload() body: string) {
let pid = body['id']; let pid = body['id'];
let pstatus = body['status']; let pstatus = body['status'];
console.log(pid);
console.log(pstatus);
return this.communitiesService.changeStatus(pid,pstatus); return this.communitiesService.changeStatus(pid,pstatus);
} }
} }

View File

@ -6,7 +6,7 @@ import { MongoExceptionFilter } from 'src/MongoExceptionFilter';
@Controller() @Controller()
export class UsersController { export class UsersController {
constructor(private readonly userService: UsersService) {} constructor(private readonly userService: UsersService) { }
@MessagePattern({ cmd: 'createUser' }) @MessagePattern({ cmd: 'createUser' })
create(@Payload() user: UserDocument) { create(@Payload() user: UserDocument) {
@ -118,5 +118,10 @@ export class UsersController {
} }
@MessagePattern({ cmd: 'changeStatus' })
changeStatus(@Payload() body: string) {
let pid = body['id'];
let pstatus = body['status'];
return this.userService.changeStatus(pid, pstatus);
}
} }

View File

@ -223,5 +223,10 @@ export class UsersService {
return num_house; return num_house;
} }
async changeStatus(id: string, status: string) {
return this.userModel.findOneAndUpdate({ _id: id }, {status: status}, {
new: true,
});
}
} }

View File

@ -11,7 +11,7 @@ import { faUserAlt } from '@fortawesome/free-solid-svg-icons';
import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons';
import { faAt } from '@fortawesome/free-solid-svg-icons'; import { faAt } from '@fortawesome/free-solid-svg-icons';
import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons';
import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
const AdministradoresSistema = () => { const AdministradoresSistema = () => {
const [administrators, setAdministrators] = useState([]); const [administrators, setAdministrators] = useState([]);
@ -27,6 +27,10 @@ const AdministradoresSistema = () => {
const toast = useRef(null); const toast = useRef(null);
const dt = useRef(null); const dt = useRef(null);
const [changeStatusAdminSystemDialog, setChangeStatusAdminSystemDialog] = useState(false);
const [changeStatusAdminsSystemDialog, setChangeStatusAdminsSystemDialog] =
useState(false);
let emptySysAdmin = { let emptySysAdmin = {
_id: null, _id: null,
dni: '', dni: '',
@ -37,14 +41,24 @@ const AdministradoresSistema = () => {
password: '', password: '',
user_type: '1', user_type: '1',
status: '1', status: '1',
status_text: '',
}; };
async function fetchP() { async function fetchP() {
let nombres = await fetch(urlFetch, { method: 'GET' }); let nombres = await fetch(urlFetch, { method: 'GET' });
let adminRes = await nombres.json(); let adminRes = await nombres.json();
setAdministrators(adminRes.message); let data = await adminRes.message.filter(
console.log(administrators); (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';
}
})
setAdministrators(await data);
} }
useEffect(() => { useEffect(() => {
fetchP(); fetchP();
@ -63,7 +77,6 @@ const AdministradoresSistema = () => {
status: "1" status: "1"
}; };
setSysAdmin(data) setSysAdmin(data)
// console.log(data);
fetch('http://localhost:4000/user/createAdminSystem/', { fetch('http://localhost:4000/user/createAdminSystem/', {
cache: 'no-cache', cache: 'no-cache',
@ -94,6 +107,51 @@ const AdministradoresSistema = () => {
); );
} }
const cambiarStatusUser = () => {
if (sysadmin.status == '1') {
sysadmin.status = '0';
sysadmin.status_text = 'Inactivo';
} else if (sysadmin.status == '0') {
sysadmin.status = '1';
sysadmin.status_text = 'Activo';
}
var data = {
id: sysadmin._id,
status: sysadmin.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) {
setChangeStatusAdminSystemDialog(false);
toast.current.show({
severity: 'success',
summary: 'Éxito',
detail: 'Administrador del Sistema Actualizado',
life: 3000,
});
}
)
.catch(
err => console.log('Ocurrió un error con el fetch', err)
);
}
const confirmDeleteAdminSystem = (sysAdmin) => { const confirmDeleteAdminSystem = (sysAdmin) => {
setSysAdmin(sysAdmin); setSysAdmin(sysAdmin);
setDeleteAdminSystemDialog(true); setDeleteAdminSystemDialog(true);
@ -111,6 +169,14 @@ const AdministradoresSistema = () => {
setDeleteAdminsSystemDialog(false); setDeleteAdminsSystemDialog(false);
}; };
const hideChangeStatusAdminDialog = () => {
setChangeStatusAdminSystemDialog(false);
};
const confirmChangeStatusAdminSystem = (sysAdmin) => {
setSysAdmin(sysAdmin);
setChangeStatusAdminSystemDialog(true);
};
const deleteSysAdmin = () => { const deleteSysAdmin = () => {
fetch('http://localhost:4000/user/deleteAdminSystem/' + sysadmin._id, { fetch('http://localhost:4000/user/deleteAdminSystem/' + sysadmin._id, {
@ -127,8 +193,9 @@ const AdministradoresSistema = () => {
}) })
.then(function (response) { .then(function (response) {
let _sysadmin = administrators.filter( let _sysadmin = administrators.filter(
(val) => val._id !== sysadmin._id, (val) => (val._id !== sysadmin._id || val.status != -1),
); );
setAdministrators(_sysadmin); setAdministrators(_sysadmin);
setDeleteAdminSystemDialog(false); setDeleteAdminSystemDialog(false);
setSysAdmin(emptySysAdmin); setSysAdmin(emptySysAdmin);
@ -152,7 +219,7 @@ const AdministradoresSistema = () => {
const deleteSelectedAdminsSystem = () => { const deleteSelectedAdminsSystem = () => {
let _administrators = administrators.filter( let _administrators = administrators.filter(
(val) => !selectedAdministrators.includes(val), (val) => (!selectedAdministrators.includes(val)),
); );
selectedAdministrators.map((item) => { selectedAdministrators.map((item) => {
fetch('http://localhost:4000/user/deleteAdminSystem/' + item._id, { fetch('http://localhost:4000/user/deleteAdminSystem/' + item._id, {
@ -163,6 +230,9 @@ const AdministradoresSistema = () => {
}, },
}); });
}); });
_administrators = _administrators.filter(
(val) => val.status != -1,
)
setAdministrators(_administrators); setAdministrators(_administrators);
setDeleteAdminsSystemDialog(false); setDeleteAdminsSystemDialog(false);
setSelectedAdministrators(null); setSelectedAdministrators(null);
@ -174,13 +244,33 @@ const AdministradoresSistema = () => {
}); });
}; };
const actionsAdmin = (rowData) => { const actionsAdmin = (rowData) => {
let icono = '';
let text = '';
if (rowData.status == '0') {
icono = "pi pi-eye";
text = "Activar Administrador"
} else if (rowData.status == '1') {
icono = "pi pi-eye-slash";
text = "Inactivar Administrador"
}
return ( return (
<div className="actions"> <div className="actions">
<Button
icon={`${icono}`}
className="p-button-rounded p-button-warning mt-2 mx-2"
onClick={() => confirmChangeStatusAdminSystem(rowData)}
title={`${text}`}
/>
<Button <Button
icon="pi pi-trash" icon="pi pi-trash"
className="p-button-rounded p-button-danger mt-2" className="p-button-rounded p-button-danger mt-2 mx-2"
onClick={() => confirmDeleteAdminSystem(rowData)} onClick={() => confirmDeleteAdminSystem(rowData)}
title="Eliminar Administrador"
/> />
</div> </div>
); );
@ -264,6 +354,23 @@ const AdministradoresSistema = () => {
</> </>
); );
const changeStatusAdminSystemDialogFooter = (
<>
<Button
label="No"
icon="pi pi-times"
className="p-button-text"
onClick={hideChangeStatusAdminDialog}
/>
<Button
label="Yes"
icon="pi pi-check"
className="p-button-text"
onClick={cambiarStatusUser}
/>
</>
);
const headerName = ( const headerName = (
<> <>
<p> <p>
@ -313,6 +420,27 @@ const AdministradoresSistema = () => {
</> </>
); );
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>
</>
);
};
return ( return (
<div className="grid"> <div className="grid">
<div className="col-12"> <div className="col-12">
@ -401,9 +529,16 @@ const AdministradoresSistema = () => {
wordBreak: 'break-word', wordBreak: 'break-word',
}} }}
></Column> ></Column>
<Column
field="status"
sortable
header={headerStatus}
body={statusBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
</Column>
<Column <Column
style={{ flexGrow: 1, flexBasis: '130px', minWidth: '130px' }} style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px' }}
body={actionsAdmin} body={actionsAdmin}
></Column> ></Column>
</DataTable> </DataTable>
@ -448,6 +583,26 @@ const AdministradoresSistema = () => {
)} )}
</div> </div>
</Dialog> </Dialog>
<Dialog
visible={changeStatusAdminSystemDialog}
style={{ width: '450px' }}
header="Confirmar"
modal
footer={changeStatusAdminSystemDialogFooter}
onHide={hideChangeStatusAdminDialog}
>
<div className="flex align-items-center justify-content-center">
<i
className="pi pi-exclamation-triangle mr-3"
style={{ fontSize: '2rem' }}
/>
{sysadmin && (
<span>
¿Estás seguro que desea cambiar estado a <b>{sysadmin.name}</b>?
</span>
)}
</div>
</Dialog>
</div> </div>
</div> </div>
<div className="col-12"> <div className="col-12">
@ -459,12 +614,12 @@ const AdministradoresSistema = () => {
<InputText id="nombre" type="text" /> <InputText id="nombre" type="text" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="apellidos">Apellidos</label> <label htmlFor="apellidos">Apellido(s)</label>
<InputText id="apellidos" type="text" /> <InputText id="apellidos" type="text" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="correo_electronico">Correo electrónico</label> <label htmlFor="correo_electronico">Correo electrónico</label>
<InputText id="correo_electronico" type="text" /> <InputText id="correo_electronico" type="email" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="identificacion">Identificación</label> <label htmlFor="identificacion">Identificación</label>

View File

@ -12,8 +12,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHome, faUserAlt } from '@fortawesome/free-solid-svg-icons'; import { faHome, faUserAlt } from '@fortawesome/free-solid-svg-icons';
import { faMapLocationDot } from '@fortawesome/free-solid-svg-icons'; import { faMapLocationDot } from '@fortawesome/free-solid-svg-icons';
import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons';
import { faEllipsis } from '@fortawesome/free-solid-svg-icons';
import { faHashtag } from '@fortawesome/free-solid-svg-icons'; import { faHashtag } from '@fortawesome/free-solid-svg-icons';
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
const Communities = () => { const Communities = () => {
let emptyCommunity = { let emptyCommunity = {
@ -25,6 +25,7 @@ const Communities = () => {
phone: '', phone: '',
num_houses: 0, num_houses: 0,
status: '1', status: '1',
status_text: '',
date_entry: new Date(), date_entry: new Date(),
houses: [], houses: [],
}; };
@ -161,7 +162,17 @@ const Communities = () => {
let pList = await getProvinces(); let pList = await getProvinces();
let cList = await getCantons(); let cList = await getCantons();
let dList = await getDistricts(); let dList = await getDistricts();
await resJson.message.map((item) => { let data = await resJson.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';
} else {
item.status_text = 'Eliminado';
}
item.province = pList.find((p) => p.code === item.province).name; item.province = pList.find((p) => p.code === item.province).name;
item.canton = cList.find((p) => p.code === item.canton).name; item.canton = cList.find((p) => p.code === item.canton).name;
item.district = dList.find((p) => p.code === item.district).name; item.district = dList.find((p) => p.code === item.district).name;
@ -169,7 +180,7 @@ const Communities = () => {
item.name_admin = 'Sin Administrador'; item.name_admin = 'Sin Administrador';
} }
}); });
setCommunitiesList(await resJson.message); setCommunitiesList(await data);
} }
useEffect(() => { useEffect(() => {
@ -181,6 +192,9 @@ const Communities = () => {
.then((response) => response.json()) .then((response) => response.json())
.then(data => data.message) .then(data => data.message)
.then(data => { .then(data => {
data = data.filter(
(val) => val.status != -1,
)
setTenants(data) setTenants(data)
}); });
} }
@ -265,10 +279,9 @@ const Communities = () => {
if (tenant_id == '') { if (tenant_id == '') {
name = 'Sin inquilino'; name = 'Sin inquilino';
} else { } else {
let tenant = tenants.find(t => t._id == tenant_id ) let tenant = tenants.find(t => t._id == tenant_id)
name = tenant['name'] + ' ' + tenant['last_name']; name = tenant['name'] + ' ' + tenant['last_name'];
} }
console.log(name);
return name; return name;
} }
@ -323,52 +336,21 @@ const Communities = () => {
setCommunity(community); setCommunity(community);
setEditCommunityDialog(true); setEditCommunityDialog(true);
}; };
//desactivar o activar una comunidad
const cambiarDesactivarEstadoCommunity = () => {
var data = {
id: community._id,
status: "0",
};
console.log(data);
fetch('http://localhost:4000/community/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) {
setEditCommunityDialog(false);
toast.current.show({
severity: 'success',
summary: 'Éxito',
detail: 'Comunidad de Viviendas Actualizada',
life: 3000,
});
}
)
.catch(
err => console.log('Ocurrió un error con el fetch', err)
);
}
//desactivar o activar una comunidad //desactivar o activar una comunidad
const cambiarActivarEstadoCommunity = () => { const cambiarEstadoCommunity = () => {
if (community.status == '1') {
community.status = '0';
community.status_text = 'Inactivo';
} else if (community.status == '0') {
community.status = '1';
community.status_text = 'Activo';
}
var data = { var data = {
id: community._id, id: community._id,
status: "1", status: community.status,
}; };
console.log(data);
fetch('http://localhost:4000/community/changeStatus', { fetch('http://localhost:4000/community/changeStatus', {
cache: 'no-cache', cache: 'no-cache',
method: 'POST', method: 'POST',
@ -435,8 +417,11 @@ const Communities = () => {
} }
); );
*/ */
let _community = communitiesList.filter((val) => val._id !== community._id); let _communities = communitiesList.filter((val) => val._id !== community._id);
setCommunitiesList(_community); _communities = _communities.filter(
(val) => val.status != -1,
)
setCommunitiesList(_communities);
setDeleteCommunityDialog(false); setDeleteCommunityDialog(false);
setCommunity(emptyCommunity); setCommunity(emptyCommunity);
toast.current.show({ toast.current.show({
@ -460,6 +445,9 @@ const Communities = () => {
} }
}) })
})*/ })*/
_communities = _communities.filter(
(val) => val.status != -1,
)
setCommunitiesList(_communities); setCommunitiesList(_communities);
setDeleteCommunitiesDialog(false); setDeleteCommunitiesDialog(false);
setSelectedCommunities(null); setSelectedCommunities(null);
@ -472,23 +460,26 @@ const Communities = () => {
}; };
const actionsCommunity = (rowData) => { const actionsCommunity = (rowData) => {
let icono = '';
if (rowData.status == '0') {
icono = "pi pi-eye";
} else if (rowData.status == '1') {
icono = "pi pi-eye-slash";
}
return ( return (
<div className="actions"> <div className="actions">
<Button
icon="pi pi-eye"
className="p-button-rounded p-button-success mt-2 mx-2"
onClick={() => confirmEditCommunity(rowData)}
/>
<Button
icon="pi pi-eye-slash"
className="p-button-rounded p-button-danger mt-2 mx-2"
onClick={() => confirmEditCommunity(rowData)}
/>
<Button <Button
icon="pi pi-exclamation-circle" icon="pi pi-exclamation-circle"
className="p-button-rounded p-button-primary mt-2 mx-2" className="p-button-rounded p-button-info mt-2 mx-2"
onClick={() => infoCommunity(rowData)} onClick={() => infoCommunity(rowData)}
/> />
<Button
icon={`${icono}`}
className={`p-button-rounded p-button-warning mt-2 mx-2`}
onClick={() => confirmEditCommunity(rowData)}
/>
<Button <Button
icon="pi pi-trash" icon="pi pi-trash"
className="p-button-rounded p-button-danger mt-2 mx-2" className="p-button-rounded p-button-danger mt-2 mx-2"
@ -528,7 +519,7 @@ const Communities = () => {
const header = ( const header = (
<div className="flex flex-column md:flex-row md:justify-content-between md:align-items-center"> <div className="flex flex-column md:flex-row md:justify-content-between md:align-items-center">
<h5 className="m-0">Comunidade de Viviendas</h5> <h5 className="m-0">Comunidades de Viviendas</h5>
<span className="block mt-2 md:mt-0 p-input-icon-left"> <span className="block mt-2 md:mt-0 p-input-icon-left">
<i className="pi pi-search" /> <i className="pi pi-search" />
<InputText <InputText
@ -585,7 +576,7 @@ const Communities = () => {
/> />
</> </>
); );
const editDesactivarCommunityDialogFooter = ( const editEstadoCommunityDialogFooter = (
<> <>
<Button <Button
label="No" label="No"
@ -597,27 +588,12 @@ const Communities = () => {
label="Yes" label="Yes"
icon="pi pi-check" icon="pi pi-check"
className="p-button-text" className="p-button-text"
onClick={cambiarDesactivarEstadoCommunity} onClick={cambiarEstadoCommunity}
/> />
</> </>
); );
const editActivarCommunityDialogFooter = (
<>
<Button
label="No"
icon="pi pi-times"
className="p-button-text"
onClick={hideEditCommunityDialog}
/>
<Button
label="Yes"
icon="pi pi-check"
className="p-button-text"
onClick={cambiarActivarEstadoCommunity}
/>
</>
);
const headerName = ( const headerName = (
<> <>
@ -697,6 +673,15 @@ const Communities = () => {
</> </>
); );
const headerStatus = (
<>
<p> {' '}
<FontAwesomeIcon icon={faCircleQuestion} style={{ color: "#D7A86E" }} />{' '}
Estado
</p>
</>
)
//ver perfil comunidad //ver perfil comunidad
const headerTenant = ( const headerTenant = (
<> <>
@ -709,11 +694,21 @@ const Communities = () => {
</> </>
); );
const statusBodyTemplate = (rowData) => {
return (
<>
<span
className={`status status-${rowData.status}`}
>
{rowData.status_text}
</span>
</>
);
};
const tenantsBodyTemplate = (rowData) => { const tenantsBodyTemplate = (rowData) => {
let tenants = rowData.tenants; let tenants = rowData.tenants;
let name = findNameTenant(tenants.tenant_id); let name = findNameTenant(tenants.tenant_id);
console.log(name);
return ( return (
<> <>
{name} {name}
@ -795,9 +790,16 @@ const Communities = () => {
header={headerAdministrator} header={headerAdministrator}
style={{ flexGrow: 1, flexBasis: '180px' }} style={{ flexGrow: 1, flexBasis: '180px' }}
></Column> ></Column>
<Column
field="status"
sortable
header={headerStatus}
body={statusBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
</Column>
<Column <Column
body={actionsCommunity} body={actionsCommunity}
style={{ flexGrow: 1, flexBasis: '180px' }} style={{ flexGrow: 1, flexBasis: '100px' }}
></Column> ></Column>
</DataTable> </DataTable>
@ -927,32 +929,13 @@ const Communities = () => {
</div> </div>
</Dialog> </Dialog>
<Dialog <Dialog
visible={editCommunityDialog} visible={editCommunityDialog}
style={{ width: '450px' }} style={{ width: '450px' }}
header="Confirmar" header="Confirmar"
modal modal
footer={editActivarCommunityDialogFooter} footer={editEstadoCommunityDialogFooter}
onHide={hideEditCommunityDialog}
>
<div className="flex align-items-center justify-content-center">
<i
className="pi pi-exclamation-triangle mr-3"
style={{ fontSize: '2rem' }}
/>
{community && (
<span>
¿Estás seguro que desea cambiar estado a <b>{community.name}</b>?
</span>
)}
</div>
</Dialog>
<Dialog
visible={editCommunityDialog}
style={{ width: '450px' }}
header="Confirmar"
modal
footer={editDesactivarCommunityDialogFooter}
onHide={hideEditCommunityDialog} onHide={hideEditCommunityDialog}
> >
<div className="flex align-items-center justify-content-center"> <div className="flex align-items-center justify-content-center">

View File

@ -11,7 +11,8 @@ import { faUserAlt } from '@fortawesome/free-solid-svg-icons';
import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons';
import { faAt } from '@fortawesome/free-solid-svg-icons'; import { faAt } from '@fortawesome/free-solid-svg-icons';
import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons';
import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
import { useCookies } from "react-cookie";
const GuardasSeguridad = () => { const GuardasSeguridad = () => {
const [listaGuardas, setListaGuardas] = useState([]); const [listaGuardas, setListaGuardas] = useState([]);
@ -23,6 +24,10 @@ const GuardasSeguridad = () => {
const [deleteGuardasDialog, setDeleteGuardasDialog] = useState(false); const [deleteGuardasDialog, setDeleteGuardasDialog] = useState(false);
const toast = useRef(null); const toast = useRef(null);
const dt = useRef(null); const dt = useRef(null);
const [cookies, setCookie] = useCookies();
const [changeStatusGuardDialog, setChangeStatusGuardDialog] = useState(false);
let emptyGuarda = { let emptyGuarda = {
_id: null, _id: null,
dni: '', dni: '',
@ -32,7 +37,8 @@ const GuardasSeguridad = () => {
phone: '', phone: '',
password: '', password: '',
user_type: '1', user_type: '1',
status: '' status: '',
status_text: '',
}; };
@ -40,7 +46,17 @@ const GuardasSeguridad = () => {
async function listaGuardasF() { async function listaGuardasF() {
let nombres = await fetch(urlFetch, { method: 'GET' }); let nombres = await fetch(urlFetch, { method: 'GET' });
let listaGuardasRes = await nombres.json(); let listaGuardasRes = await nombres.json();
setListaGuardas(listaGuardasRes.message); 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);
} }
useEffect(() => { useEffect(() => {
listaGuardasF(); listaGuardasF();
@ -56,7 +72,7 @@ const GuardasSeguridad = () => {
password: document.getElementById('correo_electronico').value, password: document.getElementById('correo_electronico').value,
user_type: "4", //4 es guarda user_type: "4", //4 es guarda
status: "1", status: "1",
community_id: "62be68215692582bbfd77134" community_id: cookies.community_id
}; };
var data2 = { var data2 = {
dni: "11979037", dni: "11979037",
@ -66,7 +82,7 @@ const GuardasSeguridad = () => {
phone: 84664515, phone: 84664515,
password: "1203", password: "1203",
user_type: "2", user_type: "2",
status: "4", status: "1",
community_id: "62be68215692582bbfd77134" community_id: "62be68215692582bbfd77134"
} }
console.log('ssss'); console.log('ssss');
@ -74,7 +90,7 @@ const GuardasSeguridad = () => {
cache: 'no-cache', cache: 'no-cache',
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
body: JSON.stringify(data2), body: JSON.stringify(data),
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
@ -89,7 +105,6 @@ const GuardasSeguridad = () => {
) )
.then( .then(
function (response) { function (response) {
console.log('fff');
listaGuardasF(); listaGuardasF();
} }
) )
@ -98,22 +113,51 @@ const GuardasSeguridad = () => {
); );
} }
const hideDeleteGuardaDialog = () => { const cambiarStatusUser = () => {
setDeleteGuardaDialog(false); if (guarda.status == '1') {
guarda.status = '0';
guarda.status_text = 'Inactivo';
} 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)
);
} }
const hideDeleteGuardasDialog = () => {
setDeleteGuardasDialog(false);
}
const confirmDeleteGuarda = (guarda) => {
setGuarda(guarda);
setDeleteGuardaDialog(true);
}
const confirmDeleteSelected = () => {
setDeleteGuardasDialog(true);
}
const deleteGuarda = () => { const deleteGuarda = () => {
@ -166,10 +210,55 @@ const GuardasSeguridad = () => {
toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administradores del Sistema Eliminados', life: 3000 }); toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administradores del Sistema Eliminados', life: 3000 });
} }
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);
};
const actionsAdmin = (rowData) => { const actionsAdmin = (rowData) => {
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"
}
return ( return (
<div className="actions"> <div className="actions">
<Button icon="pi pi-trash" className="p-button-rounded p-button-danger mt-2" onClick={() => confirmDeleteGuarda(rowData)} /> <Button
icon={`${icono}`}
className="p-button-rounded p-button-warning mt-2 mx-2"
onClick={() => confirmChangeStatusGuard(rowData)}
title={`${text}`}
/>
<Button icon="pi pi-trash"
className="p-button-rounded p-button-danger mt-2 mx-2"
onClick={() => confirmDeleteGuarda(rowData)} />
</div> </div>
); );
} }
@ -178,7 +267,11 @@ const GuardasSeguridad = () => {
return ( return (
<React.Fragment> <React.Fragment>
<div className="my-2"> <div className="my-2">
<Button label="Eliminar" icon="pi pi-trash" className="p-button-danger" onClick={confirmDeleteSelected} disabled={!selectedGuardas || !selectedGuardas.length} /> <Button label="Eliminar"
icon="pi pi-trash"
className="p-button-danger"
onClick={confirmDeleteSelected}
disabled={!selectedGuardas || !selectedGuardas.length} />
</div> </div>
</React.Fragment> </React.Fragment>
) )
@ -187,7 +280,9 @@ const GuardasSeguridad = () => {
const rightToolbarTemplate = () => { const rightToolbarTemplate = () => {
return ( return (
<React.Fragment> <React.Fragment>
<Button label="Exportar" icon="pi pi-upload" className="p-button-help" /> <Button label="Exportar"
icon="pi pi-upload"
className="p-button-help" />
</React.Fragment> </React.Fragment>
) )
} }
@ -205,14 +300,31 @@ const GuardasSeguridad = () => {
const deleteAdminSystemDialogFooter = ( const deleteAdminSystemDialogFooter = (
<> <>
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} /> <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} />
<Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteGuarda} /> <Button label="" icon="pi pi-check" className="p-button-text" onClick={deleteGuarda} />
</> </>
); );
const deleteAdminsSystemDialogFooter = ( const deleteAdminsSystemDialogFooter = (
<> <>
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} /> <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteGuardasDialog} />
<Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteSelectedGuardas} /> <Button label="Sí" icon="pi pi-check" className="p-button-text" onClick={deleteSelectedGuardas} />
</>
);
const changeStatusGuardDialogFooter = (
<>
<Button
label="No"
icon="pi pi-times"
className="p-button-text"
onClick={hideChangeStatusGuardDialog}
/>
<Button
label="Sí"
icon="pi pi-check"
className="p-button-text"
onClick={cambiarStatusUser}
/>
</> </>
); );
@ -261,6 +373,26 @@ const GuardasSeguridad = () => {
</> </>
) )
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>
</>
);
};
return ( return (
<div className="grid"> <div className="grid">
@ -281,7 +413,14 @@ const GuardasSeguridad = () => {
</Column> </Column>
<Column field="email" sortable header={headerEmail} 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>
<Column field="phone" header={headerPhone} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}></Column> <Column field="phone" header={headerPhone} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}></Column>
<Column style={{ flexGrow: 1, flexBasis: '130px', minWidth: '130px' }} body={actionsAdmin}></Column> <Column
field="status"
sortable
header={headerStatus}
body={statusBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
</Column>
<Column style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px' }} body={actionsAdmin}></Column>
</DataTable> </DataTable>
<Dialog visible={deleteGuardaDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminSystemDialogFooter} onHide={hideDeleteGuardaDialog}> <Dialog visible={deleteGuardaDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminSystemDialogFooter} onHide={hideDeleteGuardaDialog}>
<div className="flex align-items-center justify-content-center"> <div className="flex align-items-center justify-content-center">
@ -292,7 +431,27 @@ const GuardasSeguridad = () => {
<Dialog visible={deleteGuardasDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminsSystemDialogFooter} onHide={hideDeleteGuardasDialog}> <Dialog visible={deleteGuardasDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteAdminsSystemDialogFooter} onHide={hideDeleteGuardasDialog}>
<div className="flex align-items-center justify-content-center"> <div className="flex align-items-center justify-content-center">
<i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} /> <i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
{selectedGuardas && <span>¿Está seguro eliminar los adminsitradores del sistema seleccionados?</span>} {selectedGuardas && <span>¿Está seguro eliminar los guardas de seguridad seleccionados?</span>}
</div>
</Dialog>
<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> </div>
</Dialog> </Dialog>
</div> </div>
@ -306,12 +465,12 @@ const GuardasSeguridad = () => {
<InputText id="nombre" type="text" /> <InputText id="nombre" type="text" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="apellidos">Apellidos</label> <label htmlFor="apellidos">Apellido(s)</label>
<InputText id="apellidos" type="text" /> <InputText id="apellidos" type="text" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="correo_electronico">Correo electrónico</label> <label htmlFor="correo_electronico">Correo electrónico</label>
<InputText id="correo_electronico" type="text" /> <InputText id="correo_electronico" type="email" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="identificacion">Identificación</label> <label htmlFor="identificacion">Identificación</label>
@ -319,7 +478,7 @@ const GuardasSeguridad = () => {
</div> </div>
<div className="field col-12"> <div className="field col-12">
<label htmlFor="telefono">Teléfono</label> <label htmlFor="telefono">Teléfono</label>
<InputText id="telefono" type="number" rows="4" /> <InputText id="telefono" type="tel" rows="4" />
</div> </div>
<Button label="Registrar" onClick={registrarGuarda}></Button> <Button label="Registrar" onClick={registrarGuarda}></Button>
</div> </div>

View File

@ -15,6 +15,7 @@ import { faAt } from '@fortawesome/free-solid-svg-icons';
import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons';
import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; import { faEllipsis } from '@fortawesome/free-solid-svg-icons';
import { faHashtag } from '@fortawesome/free-solid-svg-icons'; import { faHashtag } from '@fortawesome/free-solid-svg-icons';
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
import { useCookies } from "react-cookie"; import { useCookies } from "react-cookie";
@ -34,7 +35,8 @@ const Inquilinos = () => {
number_house: 'Sin número de vivienda', number_house: 'Sin número de vivienda',
user_type: '4', user_type: '4',
date_entry: new Date(), date_entry: new Date(),
status: '1' status: '1',
status_text: '',
}; };
const [tenants, setTenants] = useState([]); const [tenants, setTenants] = useState([]);
@ -50,6 +52,7 @@ const Inquilinos = () => {
const dt = useRef(null); const dt = useRef(null);
const [cookies, setCookie] = useCookies(); const [cookies, setCookie] = useCookies();
const [changeStatusTenantDialog, setChangeStatusTenantDialog] = useState(false);
async function tenantsList() { async function tenantsList() {
@ -57,9 +60,18 @@ const Inquilinos = () => {
.then((response) => response.json()) .then((response) => response.json())
.then(data => data.message) .then(data => data.message)
.then(data => { .then(data => {
data = data.filter(
(val) => val.status != -1,
)
data.map((item) => { data.map((item) => {
if(item.number_house ==""){ if (item.status == '1') {
item.status_text = 'Activo';
} else if (item.status == '0') {
item.status_text = 'Inactivo';
}
if (item.number_house == "") {
item.number_house = "Sin vivienda asignada"; item.number_house = "Sin vivienda asignada";
} }
}) })
@ -72,7 +84,9 @@ const Inquilinos = () => {
let response = await fetch('http://localhost:4000/community/allCommunities', { method: 'GET' }); let response = await fetch('http://localhost:4000/community/allCommunities', { method: 'GET' });
let resList = await response.json(); let resList = await response.json();
let list = await resList.message; let list = await resList.message;
list = await list.filter(
(val) => val.status != -1,
)
setCommunitiesList(await list); setCommunitiesList(await list);
} }
@ -189,6 +203,50 @@ const Inquilinos = () => {
}); });
}; };
const cambiarStatusUser = () => {
if (tenant.status == '1') {
tenant.status = '0';
tenant.status_text = 'Inactivo';
} else if (tenant.status == '0') {
tenant.status = '1';
tenant.status_text = 'Activo';
}
var data = {
id: tenant._id,
status: tenant.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) {
setChangeStatusTenantDialog(false);
toast.current.show({
severity: 'success',
summary: 'Éxito',
detail: 'Inquilino Actualizado',
life: 3000,
});
}
)
.catch(
err => console.log('Ocurrió un error con el fetch', err)
);
}
const hideDeleteTenantDialog = () => { const hideDeleteTenantDialog = () => {
setDeleteTenantDialog(false); setDeleteTenantDialog(false);
@ -207,11 +265,37 @@ const Inquilinos = () => {
setDeleteTenantsDialog(true); setDeleteTenantsDialog(true);
}; };
const hideChangeStatusTenantDialog = () => {
setChangeStatusTenantDialog(false);
};
const confirmChangeStatusTenant = (tenant) => {
setTenant(tenant);
setChangeStatusTenantDialog(true);
};
const actionsTenant = (rowData) => { const actionsTenant = (rowData) => {
let icono = '';
let text = '';
if (rowData.status == '0') {
icono = "pi pi-eye";
text = "Activar Inquilino"
} else if (rowData.status == '1') {
icono = "pi pi-eye-slash";
text = "Inactivar Inquilino"
}
return ( return (
<div className="actions"> <div className="actions">
<Button icon="pi pi-trash" className="p-button-rounded p-button-danger mt-2" onClick={() => confirmDeleteTenant(rowData)} /> <Button
icon={`${icono}`}
className="p-button-rounded p-button-warning mt-2 mx-2"
onClick={() => confirmChangeStatusTenant(rowData)}
title={`${text}`}
/>
<Button icon="pi pi-trash"
className="p-button-rounded p-button-danger mt-2 mx-2"
onClick={() => confirmDeleteTenant(rowData)} />
</div> </div>
); );
} }
@ -247,14 +331,32 @@ const Inquilinos = () => {
const deleteTenantDialogFooter = ( const deleteTenantDialogFooter = (
<> <>
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteTenantDialog} /> <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteTenantDialog} />
<Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteTenant} /> <Button label="" icon="pi pi-check" className="p-button-text" onClick={deleteTenant} />
</> </>
); );
const deleteTenantsDialogFooter = ( const deleteTenantsDialogFooter = (
<> <>
<Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteTenantsDialog} /> <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteTenantsDialog} />
<Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteSelectedTenants} /> <Button label="Sí" icon="pi pi-check" className="p-button-text" onClick={deleteSelectedTenants} />
</>
);
const changeStatusTenantDialogFooter = (
<>
<Button
label="No"
icon="pi pi-times"
className="p-button-text"
onClick={hideChangeStatusTenantDialog}
/>
<Button
label="Sí"
icon="pi pi-check"
className="p-button-text"
onClick={cambiarStatusUser}
/>
</> </>
); );
@ -296,6 +398,26 @@ const Inquilinos = () => {
</> </>
) )
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>
</>
);
};
return ( return (
<div className="grid"> <div className="grid">
@ -317,7 +439,14 @@ const Inquilinos = () => {
<Column field="email" sortable header={headerEmail} 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>
<Column field="phone" header={headerPhone} style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px', wordBreak: 'break-word' }}></Column> <Column field="phone" header={headerPhone} style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px', wordBreak: 'break-word' }}></Column>
<Column field="number_house" sortable header={headerNumberHouse} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word', justifyContent: 'center' }}></Column> <Column field="number_house" sortable header={headerNumberHouse} style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word', justifyContent: 'center' }}></Column>
<Column style={{ flexGrow: 1, flexBasis: '130px', minWidth: '130px' }} body={actionsTenant}></Column> <Column
field="status"
sortable
header={headerStatus}
body={statusBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
</Column>
<Column style={{ flexGrow: 1, flexBasis: '80px', minWidth: '80px' }} body={actionsTenant}></Column>
</DataTable> </DataTable>
<Dialog visible={deleteTenantDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteTenantDialogFooter} onHide={hideDeleteTenantDialog}> <Dialog visible={deleteTenantDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteTenantDialogFooter} onHide={hideDeleteTenantDialog}>
<div className="flex align-items-center justify-content-center"> <div className="flex align-items-center justify-content-center">
@ -328,7 +457,27 @@ const Inquilinos = () => {
<Dialog visible={deleteTenantsDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteTenantsDialogFooter} onHide={hideDeleteTenantsDialog}> <Dialog visible={deleteTenantsDialog} style={{ width: '450px' }} header="Confirmar" modal footer={deleteTenantsDialogFooter} onHide={hideDeleteTenantsDialog}>
<div className="flex align-items-center justify-content-center"> <div className="flex align-items-center justify-content-center">
<i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} /> <i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
{selectedTentants && <span>¿Está seguro eliminar los Inquilinos seleccionados?</span>} {selectedTentants && <span>¿Está seguro eliminar los inquilinos seleccionados?</span>}
</div>
</Dialog>
<Dialog
visible={changeStatusTenantDialog}
style={{ width: '450px' }}
header="Confirmar"
modal
footer={changeStatusTenantDialogFooter}
onHide={hideChangeStatusTenantDialog}
>
<div className="flex align-items-center justify-content-center">
<i
className="pi pi-exclamation-triangle mr-3"
style={{ fontSize: '2rem' }}
/>
{tenant && (
<span>
¿Estás seguro que desea cambiar estado a <b>{tenant.name}</b>?
</span>
)}
</div> </div>
</Dialog> </Dialog>
</div> </div>
@ -342,7 +491,7 @@ const Inquilinos = () => {
<InputText type="text" className="form-control" id="nombre" /> <InputText type="text" className="form-control" id="nombre" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">
<label htmlFor="apellidos">Apellidos</label> <label htmlFor="apellidos">Apellido(s)</label>
<InputText type="text" className="form-control" id="apellidos" /> <InputText type="text" className="form-control" id="apellidos" />
</div> </div>
<div className="field col-12 md:col-6"> <div className="field col-12 md:col-6">