Merge pull request #152 from DeimosPr4/US-09-Activar-DesactivarAdministradoresdeSistema
Activar/Desactivar Admin del Sistema
This commit is contained in:
commit
bb748477e0
|
@ -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')
|
||||||
|
|
|
@ -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 ===============================
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ export class AppService {
|
||||||
.pipe(map((message: string) => ({ message })));
|
.pipe(map((message: string) => ({ message })));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number
|
createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number
|
||||||
, user_type: string, status: string, date_entry: Date, community_id: string) {
|
, user_type: string, status: string, date_entry: Date, community_id: string) {
|
||||||
const pattern = { cmd: 'createAdminCommunity' };
|
const pattern = { cmd: 'createAdminCommunity' };
|
||||||
|
@ -128,7 +128,7 @@ export class AppService {
|
||||||
map((message: string) => ({ message })),
|
map((message: string) => ({ message })),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//GET parameter from API
|
//GET parameter from API
|
||||||
findUser(paramUserDNI: string) {
|
findUser(paramUserDNI: string) {
|
||||||
|
@ -179,17 +179,10 @@ 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
|
||||||
findUserById(id: string) {
|
findUserById(id: string) {
|
||||||
const pattern = { cmd: 'findById' };
|
const pattern = { cmd: 'findById' };
|
||||||
const payload = { id: id };
|
const payload = { id: id };
|
||||||
return this.clientUserApp
|
return this.clientUserApp
|
||||||
|
@ -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
|
||||||
|
@ -286,8 +294,8 @@ export class AppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//GET parameter from API
|
//GET parameter from API
|
||||||
findByCommunity(paramCommunityId: string) {
|
findByCommunity(paramCommunityId: string) {
|
||||||
const pattern = { cmd: 'findByCommunity' };
|
const pattern = { cmd: 'findByCommunity' };
|
||||||
const payload = { community_id: paramCommunityId };
|
const payload = { community_id: paramCommunityId };
|
||||||
return this.clientCommonAreaApp
|
return this.clientCommonAreaApp
|
||||||
|
@ -296,14 +304,14 @@ export class AppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//DELETE parameter from API
|
//DELETE parameter from API
|
||||||
deleteCommonArea(paramCommonAreaId: string) {
|
deleteCommonArea(paramCommonAreaId: string) {
|
||||||
const pattern = { cmd: 'removeCommonArea' };
|
const pattern = { cmd: 'removeCommonArea' };
|
||||||
const payload = { id: paramCommonAreaId };
|
const payload = { id: paramCommonAreaId };
|
||||||
return this.clientCommonAreaApp
|
return this.clientCommonAreaApp
|
||||||
.send<string>(pattern, payload)
|
.send<string>(pattern, payload)
|
||||||
.pipe(map((message: string) => ({ message })));
|
.pipe(map((message: string) => ({ message })));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================== GUESTS ===============================
|
// ====================== GUESTS ===============================
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
@ -117,6 +117,11 @@ export class UsersController {
|
||||||
return this.userService.deleteAdminSystem(user['id']);
|
return this.userService.deleteAdminSystem(user['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@MessagePattern({ cmd: 'changeStatus' })
|
||||||
|
changeStatus(@Payload() body: string) {
|
||||||
|
let pid = body['id'];
|
||||||
|
let pstatus = body['status'];
|
||||||
|
return this.userService.changeStatus(pid, pstatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
let data = await adminRes.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';
|
||||||
|
}
|
||||||
|
})
|
||||||
setAdministrators(adminRes.message);
|
setAdministrators(adminRes.message);
|
||||||
console.log(administrators);
|
|
||||||
}
|
}
|
||||||
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>
|
||||||
|
@ -312,6 +419,26 @@ const AdministradoresSistema = () => {
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
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">
|
||||||
|
@ -402,8 +529,15 @@ const AdministradoresSistema = () => {
|
||||||
}}
|
}}
|
||||||
></Column>
|
></Column>
|
||||||
<Column
|
<Column
|
||||||
|
field="status"
|
||||||
style={{ flexGrow: 1, flexBasis: '130px', minWidth: '130px' }}
|
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}
|
body={actionsAdmin}
|
||||||
></Column>
|
></Column>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
@ -448,6 +582,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">
|
||||||
|
|
|
@ -12,9 +12,7 @@ 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 { icon } from '@fortawesome/fontawesome-svg-core';
|
|
||||||
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
|
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
const Communities = () => {
|
const Communities = () => {
|
||||||
|
@ -353,7 +351,6 @@ const Communities = () => {
|
||||||
id: community._id,
|
id: community._id,
|
||||||
status: community.status,
|
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',
|
||||||
|
@ -699,15 +696,15 @@ const Communities = () => {
|
||||||
|
|
||||||
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>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const tenantsBodyTemplate = (rowData) => {
|
const tenantsBodyTemplate = (rowData) => {
|
||||||
let tenants = rowData.tenants;
|
let tenants = rowData.tenants;
|
||||||
|
@ -793,12 +790,12 @@ const Communities = () => {
|
||||||
header={headerAdministrator}
|
header={headerAdministrator}
|
||||||
style={{ flexGrow: 1, flexBasis: '180px' }}
|
style={{ flexGrow: 1, flexBasis: '180px' }}
|
||||||
></Column>
|
></Column>
|
||||||
<Column
|
<Column
|
||||||
field="status"
|
field="status"
|
||||||
sortable
|
sortable
|
||||||
header={headerStatus}
|
header={headerStatus}
|
||||||
body={statusBodyTemplate}
|
body={statusBodyTemplate}
|
||||||
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
|
style={{ flexGrow: 1, flexBasis: '160px', minWidth: '160px', wordBreak: 'break-word' }}>
|
||||||
</Column>
|
</Column>
|
||||||
<Column
|
<Column
|
||||||
body={actionsCommunity}
|
body={actionsCommunity}
|
||||||
|
|
Loading…
Reference in New Issue