diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index f6bf3ab0..56c1252c 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -468,38 +468,7 @@ export class AppController { } - // #==== API Payment - @Post('payment/createPayment') - createPayment( - @Body('date_payment') date_payment: Date, - @Body('mount') mount: number, - @Body('description') description: string, - @Body('period') period: string, - @Body('status') status: string, - @Body('user_id') user_id: string, - @Body('communty_id') communty_id: string, - ) { - return this.appService.createPayment( - date_payment, - mount, - description, - period, - status, - user_id, - communty_id, - ); - } - - @Get('payment/allPayments') - allPayments() { - return this.appService.allPayments(); - } - - @Get('payment/find/:dni') - findPayment(@Param('dni') paramPaymentDNI: string) { - return this.appService.findPayment(paramPaymentDNI); - } // #==== API Reservation @@ -541,7 +510,13 @@ export class AppController { return this.appService.findReservations(community_id); } - + + @Delete('reservation/deleteReservation/:id') + deleteReservation(@Param('id') id: string) { + return this.appService.deleteReservation(id); + } + + // #==== API Post @Post('post/createPost') @@ -554,6 +529,16 @@ export class AppController { return this.appService.createPost(post, date_entry, user_id, community_id); } + @Put('post/updatePost/:id') + updatePost( + @Param('id') id: string, + @Body('post') post: string, + @Body('user_id') user_id: string, + @Body('community_id') community_id: string, + ) { + return this.appService.updatePost(id, post, user_id, community_id); + } + @Get('post/allPosts') allPosts() { return this.appService.allPosts(); diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 380e23d1..7677f6ba 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -540,7 +540,7 @@ export class AppService { const pattern = { cmd: 'createGuest' }; const payload = { name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone, - status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry + status: status, tenant_id: tenant_id, community_id: community_id, date_entry: date_entry }; return this.clientGuestApp .send(pattern, payload) @@ -571,55 +571,17 @@ export class AppService { .send(pattern, payload) .pipe(map((message: string) => ({ message }))); } - // ====================== PAYMENTS =============================== - - //POST parameter from API - createPayment( - date_payment: Date, - mount: number, - description: string, - period: string, - status: string, - user_id: string, - communty_id: string, - ) { - const pattern = { cmd: 'createPayment' }; - const payload = { - date_payment: date_payment, mount: mount, description: description, - period: period, status: status, user_id: user_id, communty_id: communty_id - }; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - - allPayments() { - const pattern = { cmd: 'findAllPayments' }; - const payload = {}; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - - //GET parameter from API - findPayment(paramPaymentId: string) { - const pattern = { cmd: 'findOnePayment' }; - const payload = { id: paramPaymentId }; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } // ====================== RESERVATIONS =============================== //POST parameter from API createReservation(date: string, time: string, status: string, - date_entry: Date, user_id: string, common_area_id: string, + date_entry: Date, user_id: string, common_area_id: string, common_area_name: string, community_id: string) { const pattern = { cmd: 'createReservation' }; const payload = { date: date, time: time, status: status, - date_entry: date_entry, user_id: user_id, common_area_id: common_area_id, + date_entry: date_entry, user_id: user_id, common_area_id: common_area_id, common_area_name: common_area_name, community_id: community_id }; return this.clientReservationApp @@ -652,6 +614,15 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + //DELETE parameter from API + deleteReservation(paramReservationId: string) { + const pattern = { cmd: 'removeReservation' }; + const payload = { id: paramReservationId }; + return this.clientReservationApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + // ====================== POSTS =============================== //POST parameter from API @@ -667,6 +638,16 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + updatePost(id: string, post: string, user_id: string, community_id: string) { + const pattern = { cmd: 'updatePost' }; + const payload = { + post: post, id: id, user_id: user_id, community_id: community_id + }; + return this.clientPostApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + allPosts() { const pattern = { cmd: 'findAllPosts' }; const payload = {}; diff --git a/web-ui/web-react/src/App.js b/web-ui/web-react/src/App.js index 164aaa17..48ea0ccd 100644 --- a/web-ui/web-react/src/App.js +++ b/web-ui/web-react/src/App.js @@ -34,6 +34,7 @@ import GuardasSeguridad from './components/GuardasSeguridad'; import Communities from './components/ComunidadViviendas'; import Inquilinos from './components/Inquilinos'; import RegistroComunicado from './components/RegistroComunicado'; +import InvitadosComunidad from './components/InvitadosComunidad'; import "../node_modules/bootstrap/dist/css/bootstrap.min.css"; import Crud from './pages/Crud'; @@ -202,10 +203,9 @@ const App = () => { icon: PrimeIcons.BUILDING, to: '/areasComunes', }, - + { label: 'Comunicados', icon: PrimeIcons.COMMENTS, to: '/registroComunicado' }, + { label: 'Invitados', icon: PrimeIcons.USERS, to: '/invitadosComunidad' }, { label: 'Reservaciones', icon: PrimeIcons.CALENDAR, to: '/reservaciones'}, - { label: 'Comunicados', icon: PrimeIcons.COMMENTS, to: '/registroComunicado'}, - ] }, ] @@ -471,6 +471,7 @@ const App = () => { + ) } else { diff --git a/web-ui/web-react/src/components/InvitadosComunidad.js b/web-ui/web-react/src/components/InvitadosComunidad.js new file mode 100644 index 00000000..4e59b24f --- /dev/null +++ b/web-ui/web-react/src/components/InvitadosComunidad.js @@ -0,0 +1,219 @@ +import React, { useEffect, useState, useRef } from 'react'; +import { InputText } from 'primereact/inputtext'; +import { Button } from 'primereact/button'; +import { DataTable } from 'primereact/datatable'; +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 { faCircleQuestion } from '@fortawesome/free-solid-svg-icons'; +import { useCookies } from 'react-cookie'; +import classNames from 'classnames'; + +const InvitadosComunidad = () => { + const [cookies] = useCookies(); + const [globalFilter, setGlobalFilter] = useState(null); + const [invitados, setInvitados] = useState([]); + const [selectedInvitados, setSelectedInvitados] = useState([]); + const tableRef = useRef(null); + const toastRef = useRef(null); + + const getInvitados = async () => { + await fetch(`http://localhost:4000/guest/allGuests`, { + method: 'GET', + }) + .then((response) => response.json()) + .then((data) => data.message) + .then((data) => { + data = data.filter( + (invitado) => invitado.community === cookies.community_id, + ); + setInvitados(data); + }); + }; + + useEffect(() => { + getInvitados(); + }, [getInvitados, invitados]); + + const leftToolbarTemplate = () => { + return ( + +
+

Boton Eliminar aqui

+
+
+ ); + }; + + const rightToolbarTemplate = () => { + return ( + +