Merge pull request #218 from DeimosPr4/24-us-19-modificar-comunidad-de-vivienda

24-us-19-modificar-comunidad-de-vivienda
This commit is contained in:
Eduardo Quiros 2022-09-01 20:28:15 +00:00 committed by GitHub
commit 31593c5203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 284 additions and 187 deletions

View File

@ -353,6 +353,33 @@ export class AppController {
); );
} }
@Put('community/updateCommunity/:id')
updateCommunity(
@Param('id') id: string,
@Body('name') name: string,
@Body('province') province: string,
@Body('canton') canton: string,
@Body('district') district: string,
@Body('num_houses') num_houses: number,
@Body('phone') phone: string,
@Body('status') status: string,
@Body('date_entry') date_entry: Date,
@Body('houses') houses: [],
) {
return this.appService.updateCommunity(
id,
name,
province,
canton,
district,
num_houses,
phone,
status,
date_entry,
houses,
);
}
@Get('community/allCommunities') @Get('community/allCommunities')
allcommunities() { allcommunities() {
return this.appService.allCommunities(); return this.appService.allCommunities();

View File

@ -426,6 +426,25 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
updateCommunity(id: string, name: string, province: string, canton: string, district: string, num_houses: number, phone: string, status: string, date_entry: Date, houses: unknown) {
const pattern = { cmd: 'updateCommunity' };
const payload = {
id: id,
name: name,
province: province,
canton: canton,
district: district,
num_houses: num_houses,
phone: phone,
status: status,
date_entry: date_entry,
houses: houses,
};
return this.clientCommunityApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
allCommunities() { allCommunities() {
const pattern = { cmd: 'findAllCommunities' }; const pattern = { cmd: 'findAllCommunities' };
const payload = {}; const payload = {};

View File

@ -16,7 +16,7 @@ import { faHashtag } from '@fortawesome/free-solid-svg-icons';
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons'; import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
const Communities = () => { const Communities = () => {
let emptyCommunity = { const emptyCommunity = {
_id: null, _id: null,
name: '', name: '',
province: provinciaId, province: provinciaId,
@ -32,7 +32,6 @@ const Communities = () => {
const [communitiesList, setCommunitiesList] = useState([]); const [communitiesList, setCommunitiesList] = useState([]);
const [community, setCommunity] = useState(emptyCommunity); const [community, setCommunity] = useState(emptyCommunity);
const [housesList, setHousesList] = useState([]); const [housesList, setHousesList] = useState([]);
const [provincesList, setProvincesList] = useState([]); const [provincesList, setProvincesList] = useState([]);
const [provinciaId, setProvinciaId] = useState(null); const [provinciaId, setProvinciaId] = useState(null);
@ -42,6 +41,7 @@ const Communities = () => {
const [districtId, setDistrictId] = useState(null); const [districtId, setDistrictId] = useState(null);
const [codeHouses, setCodeHouses] = useState(''); const [codeHouses, setCodeHouses] = useState('');
const [submitted, setSubmitted] = useState(false); const [submitted, setSubmitted] = useState(false);
const [saveButtonLabel, setSaveButtonLabel] = useState('Registrar');
const [selectedCommunities, setSelectedCommunities] = useState(null); const [selectedCommunities, setSelectedCommunities] = useState(null);
const [globalFilter, setGlobalFilter] = useState(null); const [globalFilter, setGlobalFilter] = useState(null);
const [deleteCommunityDialog, setDeleteCommunityDialog] = useState(false); const [deleteCommunityDialog, setDeleteCommunityDialog] = useState(false);
@ -50,15 +50,11 @@ const Communities = () => {
const toast = useRef(null); const toast = useRef(null);
const dt = useRef(null); const dt = useRef(null);
//para el perfil de la comunidad //para el perfil de la comunidad
const [tenants, setTenants] = useState([]); const [tenants, setTenants] = useState([]);
const [communityDialog, setCommunityDialog] = useState(false); const [communityDialog, setCommunityDialog] = useState(false);
const p = provincesList.map((item) => ({ const p = provincesList.map((item) => ({
label: item.name, label: item.name,
value: item.code, value: item.code,
@ -76,7 +72,6 @@ const Communities = () => {
parent: item.parentCode, parent: item.parentCode,
})); }));
async function getProvinces() { async function getProvinces() {
const response = await fetch('assets/demo/data/provincias.json', { const response = await fetch('assets/demo/data/provincias.json', {
method: 'GET', method: 'GET',
@ -98,7 +93,7 @@ const Communities = () => {
async function fillCantons() { async function fillCantons() {
const resJson = await getCantons(); const resJson = await getCantons();
const cantones = await resJson.filter(function (i, n) { const cantones = await resJson.filter((i, _n) => {
return i.parentCode === provinciaId; return i.parentCode === provinciaId;
}); });
setCantonsList(await cantones); setCantonsList(await cantones);
@ -113,13 +108,12 @@ const Communities = () => {
async function fillDistricts() { async function fillDistricts() {
const resJson = await getDistricts(); const resJson = await getDistricts();
const districts = await resJson.filter(function (i, n) { const districts = await resJson.filter((i, _n) => {
return i.parentCode === cantonId; return i.parentCode === cantonId;
}); });
setDistrictsList(await districts); setDistrictsList(await districts);
} }
useEffect(() => { useEffect(() => {
fillProvinces(); fillProvinces();
}, []); }, []);
@ -132,7 +126,6 @@ const Communities = () => {
fillDistricts(); fillDistricts();
}, [cantonId]); }, [cantonId]);
const handleProvinces = (event) => { const handleProvinces = (event) => {
const getprovinciaId = event.target.value; const getprovinciaId = event.target.value;
setProvinciaId(getprovinciaId); setProvinciaId(getprovinciaId);
@ -162,9 +155,7 @@ 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();
let data = await resJson.message.filter( let data = await resJson.message.filter((val) => val.status != -1);
(val) => val.status != -1,
)
await data.map((item) => { await data.map((item) => {
if (item.status == '1') { if (item.status == '1') {
item.status_text = 'Activo'; item.status_text = 'Activo';
@ -188,21 +179,20 @@ const Communities = () => {
}, []); }, []);
async function tenantsList(id) { async function tenantsList(id) {
await fetch(`http://localhost:4000/user/findTenants/${id}`, { method: 'GET' }) await fetch(`http://localhost:4000/user/findTenants/${id}`, {
method: 'GET',
})
.then((response) => response.json()) .then((response) => response.json())
.then(data => data.message) .then((data) => data.message)
.then(data => { .then((data) => {
data = data.filter( data = data.filter((val) => val.status != -1);
(val) => val.status != -1, setTenants(data);
)
setTenants(data)
}); });
} }
useEffect(() => { useEffect(() => {
tenantsList(community._id); tenantsList(community._id);
}, []) }, []);
const saveCommunity = () => { const saveCommunity = () => {
if ( if (
@ -213,6 +203,7 @@ const Communities = () => {
districtId && districtId &&
community.phone community.phone
) { ) {
if (saveButtonLabel === 'Registrar') {
let _communities = [...communitiesList]; let _communities = [...communitiesList];
let _community = { ...community }; let _community = { ...community };
_community.province = provinciaId; _community.province = provinciaId;
@ -224,7 +215,6 @@ const Communities = () => {
number_house: codeHouses + (i + 1), number_house: codeHouses + (i + 1),
}); });
} }
// console.log(houses)
fetch('http://localhost:4000/community/createCommunity', { fetch('http://localhost:4000/community/createCommunity', {
cache: 'no-cache', cache: 'no-cache',
method: 'POST', method: 'POST',
@ -233,7 +223,7 @@ const Communities = () => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
.then(function (response) { .then((response) => {
if (response.status != 201) if (response.status != 201)
console.log('Ocurrió un error con el servicio: ' + response.status); console.log('Ocurrió un error con el servicio: ' + response.status);
else return response.json(); else return response.json();
@ -256,30 +246,48 @@ const Communities = () => {
detail: 'Comunidad de vivienda Creada', detail: 'Comunidad de vivienda Creada',
life: 3000, life: 3000,
}); });
setCommunitiesList(_communities); setCommunitiesList(_communities);
setProvinciaId(''); setProvinciaId('');
setCantonId(''); setCantonId('');
setDistrictId(''); setDistrictId('');
setCodeHouses(''); setCodeHouses('');
getCommunites();
setCommunity(emptyCommunity); setCommunity(emptyCommunity);
}) })
.catch((err) => console.log('Ocurrió un error con el fetch', err)); .catch((err) => console.log('Ocurrió un error con el fetch', err));
} else {
let _community = { ...community };
_community.province = provinciaId;
_community.canton = cantonId;
_community.district = districtId;
console.log(`Actualizando comunidad: ${_community}`);
fetch(`http://localhost:4000/community/updateCommunity/${community._id}`, {
method: 'PUT',
cache: 'no-cache',
body: JSON.stringify(_community),
headers: {
'Content-Type': 'application/json',
}
}).then((response) => {
getCommunites();
if (response.status != 200)
console.log('Ocurrió un error con el servicio: ' + response.status);
else return response.json();
}).catch((err) => console.log('Ocurrió un error con el fetch', err));
setSaveButtonLabel('Registrar');
setCommunity(emptyCommunity);
}
} else { } else {
setSubmitted(true); setSubmitted(true);
} }
}; };
function findNameTenant(tenant_id) { function findNameTenant(tenant_id) {
let name = ''; let name = '';
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'];
} }
return name; return name;
@ -340,7 +348,6 @@ const Communities = () => {
if (community.status == '1') { if (community.status == '1') {
community.status = '0'; community.status = '0';
community.status_text = 'Inactivo'; community.status_text = 'Inactivo';
} else if (community.status == '0') { } else if (community.status == '0') {
community.status = '1'; community.status = '1';
community.status_text = 'Activo'; community.status_text = 'Activo';
@ -354,19 +361,15 @@ const Communities = () => {
method: 'POST', method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
} },
}) })
.then( .then((response) => {
function (response) {
if (response.status != 201) if (response.status != 201)
console.log('Ocurrió un error con el servicio: ' + response.status); console.log('Ocurrió un error con el servicio: ' + response.status);
else else return response.json();
return response.json(); })
} .then((_response) => {
)
.then(
function (response) {
setEditCommunityDialog(false); setEditCommunityDialog(false);
toast.current.show({ toast.current.show({
severity: 'success', severity: 'success',
@ -374,49 +377,51 @@ const Communities = () => {
detail: 'Comunidad de Viviendas Actualizada', detail: 'Comunidad de Viviendas Actualizada',
life: 3000, life: 3000,
}); });
} getCommunites();
) })
.catch( .catch((err) => console.log('Ocurrió un error con el fetch', err));
err => console.log('Ocurrió un error con el fetch', err) };
);
}
const deleteCommunity = () => { const deleteCommunity = () => {
fetch('http://localhost:4000/community/deleteCommunity/' + community._id, { fetch('http://localhost:4000/community/deleteCommunity/' + community._id, {
cache: 'no-cache', cache: 'no-cache',
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
} },
}) })
.then( .then((response) => {
function (response) {
if (response.status != 201) if (response.status != 201)
console.log('Ocurrió un error con el servicio: ' + response.status); console.log('Ocurrió un error con el servicio: ' + response.status);
else else return response.json();
return response.json(); })
} .then((_response) => {
) let _community = communitiesList.filter(
.then( (val) => val._id !== community._id,
function (response) { );
let _community = communitiesList.filter(val => val._id !== community._id);
setCommunitiesList(_community); setCommunitiesList(_community);
setDeleteCommunityDialog(false); setDeleteCommunityDialog(false);
setCommunity(emptyCommunity); setCommunity(emptyCommunity);
toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Comunidad de Viviendas Eliminada', life: 3000 }); toast.current.show({
} severity: 'success',
) summary: 'Exito',
.catch( detail: 'Comunidad de Viviendas Eliminada',
err => { life: 3000,
console.log('Ocurrió un error con el fetch', err) });
toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Comunidad de Viviendas no se pudo eliminar', life: 3000 }); })
} .catch((err) => {
console.log('Ocurrió un error con el fetch', err);
toast.current.show({
severity: 'danger',
summary: 'Error',
detail: 'Comunidad de Viviendas no se pudo eliminar',
life: 3000,
});
});
let _communities = communitiesList.filter(
(val) => val._id !== community._id,
); );
let _communities = communitiesList.filter((val) => val._id !== community._id); _communities = _communities.filter((val) => val.status != -1);
_communities = _communities.filter(
(val) => val.status != -1,
)
setCommunitiesList(_communities); setCommunitiesList(_communities);
setDeleteCommunityDialog(false); setDeleteCommunityDialog(false);
setCommunity(emptyCommunity); setCommunity(emptyCommunity);
@ -441,9 +446,7 @@ const Communities = () => {
} }
}) })
})*/ })*/
_communities = _communities.filter( _communities = _communities.filter((val) => val.status != -1);
(val) => val.status != -1,
)
setCommunitiesList(_communities); setCommunitiesList(_communities);
setDeleteCommunitiesDialog(false); setDeleteCommunitiesDialog(false);
setSelectedCommunities(null); setSelectedCommunities(null);
@ -455,17 +458,37 @@ const Communities = () => {
}); });
}; };
const actionsCommunity = (rowData) => { const updateCommunity = (community) => {
setCommunity(community);
setSaveButtonLabel('Actualizar');
setHousesList(community.houses);
};
const cancelEdit = () => {
setCommunity(emptyCommunity);
setCantonId('');
setHousesList([]);
setProvinciaId('');
setDistrictId('');
setSaveButtonLabel('Registrar');
}
const actionsCommunity = (rowData) => {
let icono = ''; let icono = '';
if (rowData.status == '0') { if (rowData.status == '0') {
icono = "pi pi-eye"; icono = 'pi pi-eye';
} else if (rowData.status == '1') { } else if (rowData.status == '1') {
icono = "pi pi-eye-slash"; icono = 'pi pi-eye-slash';
} }
return ( return (
<div className="actions"> <div className="actions">
<Button
icon="pi pi-pencil"
className="p-button-rounded p-button-success mt-2 mx-2"
onClick={() => updateCommunity(rowData)}
title="Editar"
/>
<Button <Button
icon="pi pi-exclamation-circle" icon="pi pi-exclamation-circle"
className="p-button-rounded p-button-info mt-2 mx-2" className="p-button-rounded p-button-info mt-2 mx-2"
@ -535,7 +558,6 @@ const Communities = () => {
className="p-button-text" className="p-button-text"
onClick={hideCommunityDialog} onClick={hideCommunityDialog}
/> />
</> </>
); );
@ -589,8 +611,6 @@ const Communities = () => {
</> </>
); );
const headerName = ( const headerName = (
<> <>
<p> <p>
@ -653,8 +673,8 @@ const Communities = () => {
<> <>
<p> <p>
{' '} {' '}
<FontAwesomeIcon icon={faHashtag} style={{ color: '#D7A86E' }} />{' '} <FontAwesomeIcon icon={faHashtag} style={{ color: '#D7A86E' }} /> Número
Número de viviendas de viviendas
</p> </p>
</> </>
); );
@ -671,12 +691,16 @@ const Communities = () => {
const headerStatus = ( const headerStatus = (
<> <>
<p> {' '} <p>
<FontAwesomeIcon icon={faCircleQuestion} style={{ color: "#D7A86E" }} />{' '} {' '}
<FontAwesomeIcon
icon={faCircleQuestion}
style={{ color: '#D7A86E' }}
/>{' '}
Estado Estado
</p> </p>
</> </>
) );
//ver perfil comunidad //ver perfil comunidad
const headerTenant = ( const headerTenant = (
@ -686,16 +710,13 @@ const Communities = () => {
<FontAwesomeIcon icon={faUserAlt} style={{ color: '#C08135' }} />{' '} <FontAwesomeIcon icon={faUserAlt} style={{ color: '#C08135' }} />{' '}
Inquilinos Inquilinos
</p> </p>
</> </>
); );
const statusBodyTemplate = (rowData) => { const statusBodyTemplate = (rowData) => {
return ( return (
<> <>
<span <span className={`status status-${rowData.status}`}>
className={`status status-${rowData.status}`}
>
{rowData.status_text} {rowData.status_text}
</span> </span>
</> </>
@ -709,11 +730,7 @@ const Communities = () => {
name = findNameTenant(tenants.tenant_id); name = findNameTenant(tenants.tenant_id);
} }
return ( return <>{name}</>;
<>
{name}
</>
)
}; };
return ( return (
@ -795,15 +812,19 @@ const Communities = () => {
sortable sortable
header={headerStatus} header={headerStatus}
body={statusBodyTemplate} body={statusBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}> style={{
</Column> flexGrow: 1,
flexBasis: '160px',
minWidth: '160px',
wordBreak: 'break-word',
}}
></Column>
<Column <Column
body={actionsCommunity} body={actionsCommunity}
style={{ flexGrow: 1, flexBasis: '100px' }} style={{ flexGrow: 2, flexBasis: '100px', flexDirection: 'row' }}
></Column> ></Column>
</DataTable> </DataTable>
<Dialog <Dialog
visible={communityDialog} visible={communityDialog}
style={{ width: '650px' }} style={{ width: '650px' }}
@ -811,12 +832,16 @@ const Communities = () => {
modal modal
className="p-fluid" className="p-fluid"
footer={communityDialogFooter} footer={communityDialogFooter}
onHide={hideCommunityDialog}> onHide={hideCommunityDialog}
<div className='container text-center'> >
<div className='row my-4'> <div className="container text-center">
<div className="row my-4">
<div className=" col-12 md:col-12"> <div className=" col-12 md:col-12">
<p>Nombre</p> <p>Nombre</p>
<div className="p-0 col-2 md:col-2" style={{ margin: '0 auto' }}> <div
className="p-0 col-2 md:col-2"
style={{ margin: '0 auto' }}
>
<div className="p-inputgroup align-items-center justify-content-evenly"> <div className="p-inputgroup align-items-center justify-content-evenly">
<i className="pi pi-home icon-khaki"></i> <i className="pi pi-home icon-khaki"></i>
<p>{community.name}</p> <p>{community.name}</p>
@ -824,30 +849,34 @@ const Communities = () => {
</div> </div>
</div> </div>
</div> </div>
<div className='row my-5'> <div className="row my-5">
<div className=" col-6 md:col-6"> <div className=" col-6 md:col-6">
<p>Administrador</p> <p>Administrador</p>
<div className="p-0 col-6 md:col-6" style={{ margin: '0 auto' }}> <div
className="p-0 col-6 md:col-6"
style={{ margin: '0 auto' }}
>
<div className="p-inputgroup align-items-center justify-content-evenly"> <div className="p-inputgroup align-items-center justify-content-evenly">
<i className="pi pi-user icon-khaki"></i> <i className="pi pi-user icon-khaki"></i>
<p>{community.name_admin}</p> <p>{community.name_admin}</p>
</div> </div>
</div> </div>
</div> </div>
<div className=" col-6 md:col-6"> <div className=" col-6 md:col-6">
<p>Teléfono Administrativo</p> <p>Teléfono Administrativo</p>
<div className="p-0 col-6 md:col-6" style={{ margin: '0 auto' }}> <div
className="p-0 col-6 md:col-6"
style={{ margin: '0 auto' }}
>
<div className="p-inputgroup align-items-center justify-content-evenly"> <div className="p-inputgroup align-items-center justify-content-evenly">
<i className="pi pi-phone icon-khaki"></i> <i className="pi pi-phone icon-khaki"></i>
<p>{community.phone}</p> <p>{community.phone}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className='row my-5'> <div className="row my-5">
<div className=" col-4 col-md-4 md:col-4"> <div className=" col-4 col-md-4 md:col-4">
<p>Provincia</p> <p>Provincia</p>
<div className="p-0 col-10 md:col-10"> <div className="p-0 col-10 md:col-10">
@ -855,7 +884,6 @@ const Communities = () => {
<i className="pi pi-map-marker icon-khaki"></i> <i className="pi pi-map-marker icon-khaki"></i>
<p>{community.province}</p> <p>{community.province}</p>
</div> </div>
</div> </div>
</div> </div>
<div className=" col-4 md:col-4"> <div className=" col-4 md:col-4">
@ -865,7 +893,6 @@ const Communities = () => {
<i className="pi pi-map-marker icon-khaki"></i> <i className="pi pi-map-marker icon-khaki"></i>
<p>{community.canton}</p> <p>{community.canton}</p>
</div> </div>
</div> </div>
</div> </div>
<div className=" col-4 md:col-4"> <div className=" col-4 md:col-4">
@ -875,14 +902,16 @@ const Communities = () => {
<i className="pi pi-map-marker icon-khaki"></i> <i className="pi pi-map-marker icon-khaki"></i>
<p>{community.district}</p> <p>{community.district}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className='row my-5'> <div className="row my-5">
<div className=" col-12 md:col-12"> <div className=" col-12 md:col-12">
<p>Número de Viviendas</p> <p>Número de Viviendas</p>
<div className="p-0 col-2 md:col-2" style={{ margin: '0 auto' }}> <div
className="p-0 col-2 md:col-2"
style={{ margin: '0 auto' }}
>
<div className="p-inputgroup justify-content-evenly"> <div className="p-inputgroup justify-content-evenly">
<i className="pi pi-hashtag icon-khaki"></i> <i className="pi pi-hashtag icon-khaki"></i>
<p>{community.num_houses}</p> <p>{community.num_houses}</p>
@ -890,12 +919,16 @@ const Communities = () => {
</div> </div>
</div> </div>
</div> </div>
<div className='row my-5'> <div className="row my-5">
<div className=" col-12 md:col-12"> <div className=" col-12 md:col-12">
<p>
{' '}
<p> <i className="pi pi-home icon-khaki"></i> Viviendas</p> <i className="pi pi-home icon-khaki"></i> Viviendas
<div className="p-0 col-12 md:col-12" style={{ margin: '0 auto' }}> </p>
<div
className="p-0 col-12 md:col-12"
style={{ margin: '0 auto' }}
>
<div className="p-inputgroup justify-content-evenly"> <div className="p-inputgroup justify-content-evenly">
<DataTable <DataTable
value={community.houses} value={community.houses}
@ -913,13 +946,21 @@ const Communities = () => {
<Column <Column
field="number_house" field="number_house"
header={headerNumberHouses} header={headerNumberHouses}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px' }} style={{
flexGrow: 1,
flexBasis: '160px',
minWidth: '160px',
}}
></Column> ></Column>
<Column <Column
field="tenants" field="tenants"
header={headerTenant} header={headerTenant}
body={tenantsBodyTemplate} body={tenantsBodyTemplate}
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px' }} style={{
flexGrow: 1,
flexBasis: '160px',
minWidth: '160px',
}}
></Column> ></Column>
</DataTable> </DataTable>
</div> </div>
@ -927,7 +968,6 @@ const Communities = () => {
</div> </div>
</div> </div>
</div> </div>
</Dialog> </Dialog>
<Dialog <Dialog
@ -945,7 +985,8 @@ const Communities = () => {
/> />
{community && ( {community && (
<span> <span>
¿Estás seguro que desea cambiar estado a <b>{community.name}</b>? ¿Estás seguro que desea cambiar estado a{' '}
<b>{community.name}</b>?
</span> </span>
)} )}
</div> </div>
@ -1168,12 +1209,22 @@ const Communities = () => {
)} )}
</div> </div>
</div> </div>
<div className="col-12 md:col-12 py-2"> <div style={{
display: "flex",
justifyContent: "center",
gap: "10px",
width: "100%"
}} className="col-12 md:col-12 py-2">
<Button <Button
label="Registrar" label={saveButtonLabel}
icon="pi pi-check" icon="pi pi-check"
onClick={saveCommunity} onClick={saveCommunity}
></Button> />
{saveButtonLabel === 'Actualizar' && (
<Button
label="Cancelar"
onClick={cancelEdit}
className="p-button-danger" />)}
</div> </div>
</div> </div>
</div> </div>