add button
This commit is contained in:
parent
f6ab828ed4
commit
22dff4fe07
|
@ -41,6 +41,7 @@ const Communities = () => {
|
|||
const [districtId, setDistrictId] = useState(null);
|
||||
const [codeHouses, setCodeHouses] = useState('');
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const [saveButtonLabel, setSaveButtonLabel] = useState('Registrar')
|
||||
const [selectedCommunities, setSelectedCommunities] = useState(null);
|
||||
const [globalFilter, setGlobalFilter] = useState(null);
|
||||
const [deleteCommunityDialog, setDeleteCommunityDialog] = useState(false);
|
||||
|
@ -454,6 +455,16 @@ const Communities = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const updateCommunity = (community) => {
|
||||
console.log(community);
|
||||
setCommunity(community);
|
||||
setSaveButtonLabel('Actualizar');
|
||||
setHousesList(community.houses);
|
||||
setProvinciaId(community.provincia);
|
||||
setCantonId(community.canton);
|
||||
setDistrictId(community.district);
|
||||
}
|
||||
|
||||
const actionsCommunity = (rowData) => {
|
||||
|
||||
let icono = '';
|
||||
|
@ -465,6 +476,12 @@ const Communities = () => {
|
|||
|
||||
return (
|
||||
<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
|
||||
icon="pi pi-exclamation-circle"
|
||||
className="p-button-rounded p-button-info mt-2 mx-2"
|
||||
|
@ -1169,7 +1186,7 @@ const Communities = () => {
|
|||
</div>
|
||||
<div className="col-12 md:col-12 py-2">
|
||||
<Button
|
||||
label="Registrar"
|
||||
label={saveButtonLabel}
|
||||
icon="pi pi-check"
|
||||
onClick={saveCommunity}
|
||||
></Button>
|
||||
|
|
Loading…
Reference in New Issue