fixes textos
This commit is contained in:
parent
b775e73242
commit
a77782acaa
|
@ -55,7 +55,7 @@
|
|||
"parentCode": "101"
|
||||
},
|
||||
{
|
||||
"name": "Escazú",
|
||||
"name": "Escazú",
|
||||
"code": "10201",
|
||||
"parentCode": "102"
|
||||
},
|
||||
|
@ -355,7 +355,7 @@
|
|||
"parentCode": "111"
|
||||
},
|
||||
{
|
||||
"name": "Dulce Name de Jesús",
|
||||
"name": "Dulce Name de Jesús",
|
||||
"code": "11103",
|
||||
"parentCode": "111"
|
||||
},
|
||||
|
@ -555,7 +555,7 @@
|
|||
"parentCode": "119"
|
||||
},
|
||||
{
|
||||
"name": "Barú",
|
||||
"name": "Barú",
|
||||
"code": "11909",
|
||||
"parentCode": "119"
|
||||
},
|
||||
|
@ -785,7 +785,7 @@
|
|||
"parentCode": "204"
|
||||
},
|
||||
{
|
||||
"name": "Jesús María",
|
||||
"name": "Jesús María",
|
||||
"code": "20403",
|
||||
"parentCode": "204"
|
||||
},
|
||||
|
@ -795,7 +795,7 @@
|
|||
"parentCode": "205"
|
||||
},
|
||||
{
|
||||
"name": "Jesús",
|
||||
"name": "Jesús",
|
||||
"code": "20502",
|
||||
"parentCode": "205"
|
||||
},
|
||||
|
@ -1510,7 +1510,7 @@
|
|||
"parentCode": "404"
|
||||
},
|
||||
{
|
||||
"name": "Jesús",
|
||||
"name": "Jesús",
|
||||
"code": "40404",
|
||||
"parentCode": "404"
|
||||
},
|
||||
|
|
|
@ -105,10 +105,10 @@ const Communities = () => {
|
|||
|
||||
async function fillDistricts() {
|
||||
const resJson = await getDistricts();
|
||||
const cantones = await resJson.filter(function (i, n) {
|
||||
return i.parentCode === provinciaId;
|
||||
const districts = await resJson.filter(function (i, n) {
|
||||
return i.parentCode === cantonId;
|
||||
});
|
||||
setCantonsList(await cantones);
|
||||
setDistrictsList(await districts);
|
||||
}
|
||||
|
||||
const handleProvinces = (event) => {
|
||||
|
@ -149,6 +149,7 @@ const Communities = () => {
|
|||
const saveCommunity = () => {
|
||||
setSubmitted(true);
|
||||
|
||||
|
||||
if (community.name.trim()) {
|
||||
let _communities = [...communitiesList];
|
||||
let _community = { ...community };
|
||||
|
@ -164,20 +165,6 @@ const Communities = () => {
|
|||
description: "es esta descripcion",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
_communities.push(_community);
|
||||
toast.current.show({ severity: 'success', summary: 'Successful', detail: 'Community Created', life: 3000 });
|
||||
|
||||
setCommunitiesList(_communities);
|
||||
|
||||
setProvinciaId('');
|
||||
setCantonId('');
|
||||
setDistrictId('');
|
||||
setCommunity(emptyCommunity);
|
||||
|
||||
|
||||
|
||||
// console.log(houses)
|
||||
fetch('http://localhost:4000/community/createCommunity', {
|
||||
cache: 'no-cache',
|
||||
|
@ -195,9 +182,28 @@ const Communities = () => {
|
|||
return response.json();
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
|
||||
_community.province = provincesList.find(p => p.code === _community.province).name
|
||||
_community.canton = cantonsList.find(p => p.code === _community.canton).name
|
||||
_community.district = districtsList.find(p => p.code === _community.district).name
|
||||
|
||||
_communities.push(_community);
|
||||
toast.current.show({ severity: 'success', summary: 'Registro exitoso', detail: 'Comunidad de vivienda Creada', life: 3000 });
|
||||
|
||||
setCommunitiesList(_communities);
|
||||
|
||||
|
||||
setProvinciaId('');
|
||||
setCantonId('');
|
||||
setDistrictId('');
|
||||
setCommunity(emptyCommunity);
|
||||
})
|
||||
.catch(
|
||||
err => console.log('Ocurrió un error con el fetch', err)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -241,7 +247,7 @@ const Communities = () => {
|
|||
<span className="p-inputgroup-addon p-button p-icon-input-khaki">
|
||||
<i className="pi pi-home"></i>
|
||||
</span>
|
||||
<InputText id="name" value={community.name} onChange={(e) => onInputChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && !community.name } )} />
|
||||
<InputText id="name" value={community.name} onChange={(e) => onInputChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && community.name==='' } )} />
|
||||
</div>
|
||||
{submitted && community.name==='' && <small className="p-invalid">Nombre es requirido.</small>}
|
||||
</div>
|
||||
|
@ -253,9 +259,9 @@ const Communities = () => {
|
|||
<span className="p-inputgroup-addon p-button p-icon-input-khaki">
|
||||
<i className="pi pi-map-marker"></i>
|
||||
</span>
|
||||
<Dropdown placeholder="--Seleccione Provincia--" value={provinciaId} options={p} onChange={handleProvinces} required autoFocus className={classNames({ 'p-invalid': submitted && !community.province } )} />
|
||||
<Dropdown placeholder="--Seleccione Provincia--" value={provinciaId} options={p} onChange={handleProvinces} required autoFocus className={classNames({ 'p-invalid': submitted && (!community.province || community.province === '') } )} />
|
||||
</div>
|
||||
{submitted && !community.province && <small className="p-invalid">Provincia es requirido.</small>}
|
||||
{submitted && (!community.province || community.province === '') && <small className="p-invalid">Provincia es requirido.</small>}
|
||||
</div>
|
||||
</div>
|
||||
<div className="field col-12 md:col-6">
|
||||
|
@ -289,7 +295,7 @@ const Communities = () => {
|
|||
<span className="p-inputgroup-addon p-button p-icon-input-khaki">
|
||||
<i className="pi pi-phone"></i>
|
||||
</span>
|
||||
<InputText id="phone" value={community.phone} onChange={(e) => onInputChange(e, 'phone')} required autoFocus className={classNames({ 'p-invalid': submitted && !community.phone } )} />
|
||||
<InputText id="phone" value={community.phone} onChange={(e) => onInputChange(e, 'phone')} required autoFocus className={classNames({ 'p-invalid': submitted && community.phone==='' } )} />
|
||||
</div>
|
||||
{submitted && community.phone==='' && <small className="p-invalid">Número de teléfono es requirido.</small>}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue