From 69dd68ea72ecc589498105bd91e0cc651195a603 Mon Sep 17 00:00:00 2001 From: Mariela Date: Fri, 22 Jul 2022 23:08:58 -0600 Subject: [PATCH] add fontawesome --- web-ui/web-react/package-lock.json | 77 +++++++++ web-ui/web-react/package.json | 3 + .../src/components/AdministradoresSistema.js | 72 +++++++-- .../src/components/ComunidadViviendas.js | 147 ++++++++++-------- web-ui/web-react/src/pages/Crud.js | 2 +- 5 files changed, 220 insertions(+), 81 deletions(-) diff --git a/web-ui/web-react/package-lock.json b/web-ui/web-react/package-lock.json index 48c45103..5ddda7d4 100644 --- a/web-ui/web-react/package-lock.json +++ b/web-ui/web-react/package-lock.json @@ -9,6 +9,9 @@ "version": "7.0.3-SNAPSHOT", "license": "MIT", "dependencies": { + "@fortawesome/fontawesome-svg-core": "^6.1.1", + "@fortawesome/free-solid-svg-icons": "^6.1.1", + "@fortawesome/react-fontawesome": "^0.2.0", "@fullcalendar/core": "^5.7.2", "@fullcalendar/daygrid": "^5.7.2", "@fullcalendar/interaction": "^5.7.2", @@ -1874,6 +1877,51 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "node_modules/@fortawesome/fontawesome-common-types": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.1.1.tgz", + "integrity": "sha512-wVn5WJPirFTnzN6tR95abCx+ocH+3IFLXAgyavnf9hUmN0CfWoDjPT/BAWsUVwSlYYVBeCLJxaqi7ZGe4uSjBA==", + "hasInstallScript": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/fontawesome-svg-core": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.1.1.tgz", + "integrity": "sha512-NCg0w2YIp81f4V6cMGD9iomfsIj7GWrqmsa0ZsPh59G7PKiGN1KymZNxmF00ssuAlo/VZmpK6xazsGOwzKYUMg==", + "hasInstallScript": true, + "dependencies": { + "@fortawesome/fontawesome-common-types": "6.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/free-solid-svg-icons": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.1.1.tgz", + "integrity": "sha512-0/5exxavOhI/D4Ovm2r3vxNojGZioPwmFrKg0ZUH69Q68uFhFPs6+dhAToh6VEQBntxPRYPuT5Cg1tpNa9JUPg==", + "hasInstallScript": true, + "dependencies": { + "@fortawesome/fontawesome-common-types": "6.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@fortawesome/react-fontawesome": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.2.0.tgz", + "integrity": "sha512-uHg75Rb/XORTtVt7OS9WoK8uM276Ufi7gCzshVWkUJbHhh3svsUUeqXerrM96Wm7fRiDzfKRwSoahhMIkGAYHw==", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "@fortawesome/fontawesome-svg-core": "~1 || ~6", + "react": ">=16.3" + } + }, "node_modules/@fullcalendar/common": { "version": "5.11.0", "resolved": "https://registry.npmjs.org/@fullcalendar/common/-/common-5.11.0.tgz", @@ -19237,6 +19285,35 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "@fortawesome/fontawesome-common-types": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.1.1.tgz", + "integrity": "sha512-wVn5WJPirFTnzN6tR95abCx+ocH+3IFLXAgyavnf9hUmN0CfWoDjPT/BAWsUVwSlYYVBeCLJxaqi7ZGe4uSjBA==" + }, + "@fortawesome/fontawesome-svg-core": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.1.1.tgz", + "integrity": "sha512-NCg0w2YIp81f4V6cMGD9iomfsIj7GWrqmsa0ZsPh59G7PKiGN1KymZNxmF00ssuAlo/VZmpK6xazsGOwzKYUMg==", + "requires": { + "@fortawesome/fontawesome-common-types": "6.1.1" + } + }, + "@fortawesome/free-solid-svg-icons": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.1.1.tgz", + "integrity": "sha512-0/5exxavOhI/D4Ovm2r3vxNojGZioPwmFrKg0ZUH69Q68uFhFPs6+dhAToh6VEQBntxPRYPuT5Cg1tpNa9JUPg==", + "requires": { + "@fortawesome/fontawesome-common-types": "6.1.1" + } + }, + "@fortawesome/react-fontawesome": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.2.0.tgz", + "integrity": "sha512-uHg75Rb/XORTtVt7OS9WoK8uM276Ufi7gCzshVWkUJbHhh3svsUUeqXerrM96Wm7fRiDzfKRwSoahhMIkGAYHw==", + "requires": { + "prop-types": "^15.8.1" + } + }, "@fullcalendar/common": { "version": "5.11.0", "resolved": "https://registry.npmjs.org/@fullcalendar/common/-/common-5.11.0.tgz", diff --git a/web-ui/web-react/package.json b/web-ui/web-react/package.json index 00421d8f..876ccccc 100644 --- a/web-ui/web-react/package.json +++ b/web-ui/web-react/package.json @@ -9,6 +9,9 @@ }, "license": "MIT", "dependencies": { + "@fortawesome/fontawesome-svg-core": "^6.1.1", + "@fortawesome/free-solid-svg-icons": "^6.1.1", + "@fortawesome/react-fontawesome": "^0.2.0", "@fullcalendar/core": "^5.7.2", "@fullcalendar/daygrid": "^5.7.2", "@fullcalendar/interaction": "^5.7.2", diff --git a/web-ui/web-react/src/components/AdministradoresSistema.js b/web-ui/web-react/src/components/AdministradoresSistema.js index 58b21b3b..243ff142 100644 --- a/web-ui/web-react/src/components/AdministradoresSistema.js +++ b/web-ui/web-react/src/components/AdministradoresSistema.js @@ -6,9 +6,16 @@ import { Column } from 'primereact/column'; import { Toast } from 'primereact/toast'; import { Dialog } from 'primereact/dialog'; import { Toolbar } from 'primereact/toolbar'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faUserAlt } from '@fortawesome/free-solid-svg-icons'; +import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; +import { faAt } from '@fortawesome/free-solid-svg-icons'; +import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; +import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; + const AdministradoresSistema = () => { -`` + const [administrators, setAdministrators] = useState([]); const [urlFetch, setUrlFetch] = useState('http://localhost:4000/user/findAdminSistema/'); const [sysadmin, setSysAdmin] = useState(emptySysAdmin); @@ -124,13 +131,13 @@ const AdministradoresSistema = () => { setAdministrators(_sysadmin); setDeleteAdminSystemDialog(false); setSysAdmin(emptySysAdmin); - toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Administrador del Sistema Eliminado', life: 3000 }); + toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administrador del Sistema Eliminado', life: 3000 }); } ) .catch( err => { console.log('Ocurrió un error con el fetch', err) - toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Administrador del Sistema no se pudo eliminar', life: 3000 }); + toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Administrador del Sistema no se pudo Eliminar', life: 3000 }); } ); } @@ -149,7 +156,7 @@ const AdministradoresSistema = () => { setAdministrators(_administrators); setDeleteAdminsSystemDialog(false); setSelectedAdministrators(null); - toast.current.show({ severity: 'success', summary: 'Successful', detail: 'Products Deleted', life: 3000 }); + toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Administradores del Sistema Eliminados', life: 3000 }); } const actionsAdmin = (rowData) => { @@ -173,7 +180,7 @@ const AdministradoresSistema = () => { const rightToolbarTemplate = () => { return ( - diff --git a/web-ui/web-react/src/components/ComunidadViviendas.js b/web-ui/web-react/src/components/ComunidadViviendas.js index f6beee33..dcee03df 100644 --- a/web-ui/web-react/src/components/ComunidadViviendas.js +++ b/web-ui/web-react/src/components/ComunidadViviendas.js @@ -6,7 +6,7 @@ import { Column } from 'primereact/column'; import { Dropdown } from 'primereact/dropdown'; import { Toast } from 'primereact/toast'; import classNames from 'classnames'; - +import { Toolbar } from 'primereact/toolbar'; const Communities = () => { @@ -36,9 +36,12 @@ const Communities = () => { const [districtId, setDistrictId] = useState(null); const [codeHouses, setCodeHouses] = useState(''); const [submitted, setSubmitted] = useState(false); + const [selectedCommunities, setSelectedCommunities] = useState(null); + const [globalFilter, setGlobalFilter] = useState(null); + const [deleteCommunityDialog, setDeleteCommunityDialog] = useState(false); + const [deleteCommunitiesDialog, setDeleteCommunitiesDialog] = useState(false); const toast = useRef(null); - const dt = useRef(null); - + const dt = useEffect(null); const p = provincesList.map((item) => ({ @@ -157,7 +160,7 @@ const Communities = () => { const saveCommunity = () => { - if (community.name && community.num_houses > 0 && provinciaId && cantonId && districtId && community.phone ) { + if (community.name && community.num_houses > 0 && provinciaId && cantonId && districtId && community.phone) { let _communities = [...communitiesList]; let _community = { ...community }; _community.province = provinciaId; @@ -229,78 +232,85 @@ const Communities = () => { } - const hideDeleteAdminSystemDialog = () => { - setDeleteAdminSystemDialog(false); + const hideDeleteCommunityDialog = () => { + setDeleteCommunityDialog(false); } - const hideDeleteAdminsSystemsDialog = () => { - setDeleteAdminsSystemDialog(false); + const hideDeleteCommunitiesDialog = () => { + setDeleteCommunitiesDialog(false); } - const confirmDeleteAdminSystem = (sysAdmin) => { - setSysAdmin(sysAdmin); - setDeleteAdminSystemDialog(true); + const confirmDeleteCommunity = (community) => { + setCommunity(community); + setDeleteCommunityDialog(true); } const confirmDeleteSelected = () => { - setDeleteAdminsSystemDialog(true); + setDeleteCommunitiesDialog(true); } - const deleteSysAdmin = () => { + const deleteCommunity = () => { - fetch('http://localhost:4000/user/deleteAdminSystem/' + sysadmin._id, { - cache: 'no-cache', - method: 'DELETE', - 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) { - let _sysadmin = communities.filter(val => val._id !== community._id); - setAdministrators(_sysadmin); - setDeleteAdminSystemDialog(false); - setSysAdmin(emptySysAdmin); - toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Administrador del Sistema Eliminado', life: 3000 }); - } - ) - .catch( - err => { - console.log('Ocurrió un error con el fetch', err) - toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Administrador del Sistema no se pudo eliminar', life: 3000 }); - } - ); + /* fetch('http://localhost:4000/community/deleteCommunity/' + community._id, { + cache: 'no-cache', + method: 'DELETE', + 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) { + + let _community = communities.filter(val => val._id !== community._id); + setCommunities(_community); + setDeleteCommunityDialog(false); + setCommunity(emptyCommunity); + toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Comunidad de Viviendas Eliminada', 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 _community = communitiesList.filter(val => val._id !== community._id); + setCommunitiesList(_community); + setDeleteCommunityDialog(false); + setCommunity(emptyCommunity); + toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Comunidad de Viviendas Eliminada', life: 3000 }); } - const deleteSelectedAdminsSystem = () => { - let _communities = communitiesList.filter(val => !selectedAdministrators.includes(val)); - selectedAdministrators.map((item) => { - fetch('http://localhost:4000/user/deleteAdminSystem/' + item._id, { + const deleteSelectedCommunities = () => { + let _communities = communitiesList.filter(val => !selectedCommunities.includes(val)); + /* selectedCommunities.map((item) => { + fetch('http://localhost:4000/user/deleteCommunity/' + item._id, { cache: 'no-cache', method: 'DELETE', headers: { 'Content-Type': 'application/json' } }) - }) + })*/ setCommunitiesList(_communities); - setDeleteAdminsSystemDialog(false); - setSelectedAdministrators(null); - toast.current.show({ severity: 'success', summary: 'Successful', detail: 'Products Deleted', life: 3000 }); + setDeleteCommunitiesDialog(false); + setSelectedCommunities(null); + toast.current.show({ severity: 'success', summary: 'Éxito', detail: 'Comunidades de Viviendas Eliminada', life: 3000 }); } - const actionsAdmin = (rowData) => { + const actionsCommunity = (rowData) => { return (
-
); } @@ -309,7 +319,7 @@ const Communities = () => { return (
-
) @@ -318,14 +328,14 @@ const Communities = () => { const rightToolbarTemplate = () => { return ( -