diff --git a/backend/src/place/entities/place-traduction.entity.ts b/backend/src/place/entities/place-traduction.entity.ts index 5804fa470f310041b62f70365484b40dab0086f5..a27f4da4bf5625eac81cbba8a90ab2c11fa0e66f 100644 --- a/backend/src/place/entities/place-traduction.entity.ts +++ b/backend/src/place/entities/place-traduction.entity.ts @@ -11,6 +11,6 @@ export class PlaceTraduction { @ManyToOne(() => Place, (place) => place.availableDates, { nullable: false }) idPlace: number; - @Column() + @Column({ length: 1024 }) description: string; } diff --git a/backend/src/pointOfInterest/entities/PointOfInterestTraduction.entity.ts b/backend/src/pointOfInterest/entities/PointOfInterestTraduction.entity.ts index 858f810319934456eb796c3cccf9fdb416e1bd4b..54fb88f92dc7d0e158b95479442f6cde312688a0 100644 --- a/backend/src/pointOfInterest/entities/PointOfInterestTraduction.entity.ts +++ b/backend/src/pointOfInterest/entities/PointOfInterestTraduction.entity.ts @@ -10,9 +10,9 @@ export class PointOfInterestTraduction { @PrimaryColumn() language: LANGUAGES; - @Column({ nullable: false }) + @Column({ nullable: false, length: 1024 }) content: string; - @Column({ nullable: true }) + @Column({ nullable: true, length: 1024 }) directions: string; @Column() diff --git a/backend/src/town/entities/town-traduction.entity.ts b/backend/src/town/entities/town-traduction.entity.ts index 42a4d3f4b05f5555cdba68295213eec76fc671a0..3cfae8d7cbc36dc4aa8dc2a68c3bd05b25c0e138 100644 --- a/backend/src/town/entities/town-traduction.entity.ts +++ b/backend/src/town/entities/town-traduction.entity.ts @@ -9,6 +9,6 @@ export class TownTraduction { @PrimaryColumn() language: LANGUAGES; - @Column() + @Column({ length: 1024 }) description: string; } diff --git a/web/public/index.html b/web/public/index.html index aa069f27cbd9d53394428171c3989fd03db73c76..babfdb0e22a07905df6b0aca16c0cf602535d4c8 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -2,14 +2,13 @@ - + - - React App + Pueblos Magicos diff --git a/web/public/logotipo.png b/web/public/logotipo.png new file mode 100644 index 0000000000000000000000000000000000000000..35c0c715e3a96bc6456dc14ad0357c57e2ae7849 Binary files /dev/null and b/web/public/logotipo.png differ diff --git a/web/src/App.tsx b/web/src/App.tsx index 0c54f7ff25cb420f58ed174bc56b125909e14ef9..769ac63a34dcad037dcee3c27d99543ac2594dc2 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,11 +1,10 @@ import { RouterProvider } from "react-router-dom"; import "./App.css"; -import { AuthContextProvider } from "./context/auth_context"; -import { MessageContextProvider } from "./context/message_context"; -import { router } from "./router/router"; +import { AuthContextProvider } from "./core/context/auth_context"; +import { MessageContextProvider } from "./core/context/message_context"; +import { router } from "./core/router/router"; import { ToastContainer } from "react-toastify"; - function App() { return (
diff --git a/web/src/components/admin_panel_navbar/admin_navbar.tsx b/web/src/components/admin_panel_navbar/admin_navbar.tsx deleted file mode 100644 index 81e61e3dc2d3ee73715b5016c1e107657f7806d6..0000000000000000000000000000000000000000 --- a/web/src/components/admin_panel_navbar/admin_navbar.tsx +++ /dev/null @@ -1,173 +0,0 @@ -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faEye, faEyeSlash, faSignOut, faUser, faWindowClose } from "@fortawesome/free-solid-svg-icons"; -import { Link } from "react-router-dom"; -import './assets/styles/style.css'; -import { UserRole } from "../../constants/roles"; -import { useUserData } from "../../hooks/useUserData"; -import { Dispatch, SetStateAction, useState } from "react"; -import { useAdminChangePassword } from "../../hooks/useAdminChangePassword"; -import { usePasswoordVisibility } from "../../hooks/usePasswordVisibility"; - -interface props{ - isWindowActive: boolean; - setIsWindowActive: Dispatch>; -} - -export const AdminPanelNavBar = ({isWindowActive, setIsWindowActive}:props) => { - const {user, handleLogout, setToggle, toggle, userData} = useUserData(); - const [changePasswordWindowActive, setChangePasswordWindowActive] = useState(false); - const setChangePasswordWindowVisibility = (visibility: boolean) => { - setIsWindowActive(visibility); - setChangePasswordWindowActive(visibility); - } - const {register, handleSubmit, errors, onSubmit} = useAdminChangePassword(setChangePasswordWindowVisibility); - const { - values: valuesPrevPassword, - handleClickShowPassword: handleClickShowPrevPassword, - handleMouseDownPassword: handleMouseDownPrevPassword - } = usePasswoordVisibility(); - const { - values: valuesNewPassword, - handleClickShowPassword: handleClickShowNewPassword, - handleMouseDownPassword: handleMouseDownNewPassword - } = usePasswoordVisibility(); - const { - values: valuesNewPasswordConfirm, - handleClickShowPassword: handleClickShowNewPasswordConfirm, - handleMouseDownPassword: handleMouseDownNewPasswordConfirm - } = usePasswoordVisibility(); - - - if(!user ){ - return null; - }else{ - if(user.role !== UserRole.ADMIN && user.role !== UserRole.SUPERADMIN){ - return null; - } - } - - return ( -
-
- { - isWindowActive - ? - setToggle(false) - : - setToggle(!toggle) - }} - style={ - isWindowActive - ? - {cursor: "auto"} - : - {cursor: "pointer"} - } - /> - {toggle && -
-
-
- -

{userData?.name}

-
-
- - {setChangePasswordWindowVisibility(true); setToggle(false);}} className="sub-menu-link"> - -

Cambiar contraseña

- - - - -

Cerrar sesión

- -
-
- } -
- { - changePasswordWindowActive && -
-
- Cambio de contraseña - setChangePasswordWindowVisibility(false)}/> -
- -
-
-
- -
- - -
-

{errors.prevPassword?.message}

-
- -
- -
- - -
-

{errors.newPassword?.message}

-
- -
- -
- - -
-

{errors.newPasswordConfirm?.message}

-
- -
- -
-
-
-
- } -
- ); -} \ No newline at end of file diff --git a/web/src/components/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx b/web/src/components/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx deleted file mode 100644 index 94aa6d31ffe06ed8d4b5e1ae4bd05e650e4f8bfc..0000000000000000000000000000000000000000 --- a/web/src/components/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import DataTable, { TableColumn } from 'react-data-table-component'; -import { usePlace } from '../../../hooks/usePlace'; -import './assets/css/styles.css'; -import { Place } from '../../../infraestructure/entities/place'; -import { LoadingSpinner } from '../../loading_spinner/loading_spinner'; -import { faEdit } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Dispatch, SetStateAction, useEffect } from 'react'; - -interface props{ - idTown: number; - isWindowActive: boolean; - setWindowVisibility: (visibility: boolean) => void; - setActualPlace: Dispatch>; - setIsRegisterPane: Dispatch>; -} - -export const AdminPanelPlaceList = ({idTown, isWindowActive, setWindowVisibility, setActualPlace, setIsRegisterPane}: props) => { - const { - placeList, - pending, - updatePlacesByTown - } = usePlace(); - - const handleEditSelectedCategory = (place: Place) => { - setIsRegisterPane(false); - setActualPlace(place); - setWindowVisibility(true); - } - - useEffect(() => { - updatePlacesByTown(idTown); - },[]); - - const columns : TableColumn[] = [ - { - name: "Identificador", - selector: row => row.idPlace || 0 - }, - { - name: "Nombre", - selector: row => row.name, - sortable: true - }, - { - name: "Estado", - selector: row => row.available - }, - { - name: "Acciones", - cell: (row) => { - return ( - { - if(!isWindowActive){ - handleEditSelectedCategory(row); - } - }} - /> - ); - } - } - ]; - - return ( -
- - } - columns={columns} data={placeList} className="data_table"/> -
- ); -} \ No newline at end of file diff --git a/web/src/components/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx b/web/src/components/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx deleted file mode 100644 index 8250307c032a81fe7f3a7ed5c39a181415b5e8c3..0000000000000000000000000000000000000000 --- a/web/src/components/admin_panel_poi/admin_panel_poi_list/admin_panel_poi_list.tsx +++ /dev/null @@ -1,157 +0,0 @@ -import DataTable, { TableColumn } from 'react-data-table-component'; -import { usePlace } from '../../../hooks/usePlace'; -import './assets/css/styles.css'; -import { LoadingSpinner } from '../../loading_spinner/loading_spinner'; -import { faEye } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Dispatch, SetStateAction, useEffect, useState } from 'react'; -import { usePointOfInterest } from '../../../hooks/usePointOfInterest'; -import { PointOfInterest } from '../../../infraestructure/entities/poi'; -import { LoadingScreen } from '../../loading_screen/loading_screen'; - -interface props{ - idTown: number; - isWindowActive: boolean; - setActualPoint: Dispatch>; - setWindowVisibilityViewer: (visibility: boolean) => void; - setBinaryData: Dispatch>; - setIsPDFViewerActive: Dispatch>; -} - -export const AdminPanelPoiList = ({idTown, isWindowActive, setActualPoint, setWindowVisibilityViewer, setBinaryData, - setIsPDFViewerActive -}: props) => { - const [isLoading, setIsLoading] = useState(false); - const [isPDFLoading, setIsPDFLoading] = useState(false); - const [printButtonActive, setPrintButtonActive] = useState(false); - const [selectedRows, setSelectedRows] = useState([]); - const [actualPlaceId, setActualPlaceId] = useState(0); - const {getPdfById} = usePointOfInterest(); - - const handleRowSelected = (selected: { allSelected: boolean; selectedCount: number; selectedRows: PointOfInterest[];}) => { - setSelectedRows(selected.selectedRows.map((element)=>{return element.idPoint || -1})); - } - - useEffect(()=>{ - if(selectedRows.length>0){ - setPrintButtonActive(true); - }else{ - setPrintButtonActive(false); - } - },[selectedRows]); - - const handleClickPrintButton = () => { - const fetchPdf = async () => { - setIsPDFLoading(true); - const res = await getPdfById(actualPlaceId, selectedRows); - if(res!==null){ - setIsPDFViewerActive(true); - setBinaryData(res); - } - setIsPDFLoading(false); - } - fetchPdf(); - } - - const { - placeList, - updatePlacesByTown - } = usePlace(); - - const { - pending, - updatePOIByPlace, - poiList - } = usePointOfInterest(); - - const handleViewSelectedPoint = (point: PointOfInterest) => { - setActualPoint(point); - setWindowVisibilityViewer(true); - } - - const columns : TableColumn[] = [ - { - name: "Identificador", - selector: row => row.idPoint || -1, - sortable: true - }, - { - name: "Nombre", - selector: row => row.name.substring(0,40), - sortable: true - }, - { - name: "Acciones", - cell: (row) => { - return ( - { - if(!isWindowActive){ - handleViewSelectedPoint(row); - } - }} - /> - ); - } - } - ]; - - useEffect(() => { - setIsLoading(true); - updatePlacesByTown(idTown); - setIsLoading(false); - },[]); - - const refreshList = (idPlace: number) => { - updatePOIByPlace(idPlace) - }; - - - if(isLoading) return - - return ( -
-
- Lugar - - -
-
- - } - onSelectedRowsChange={handleRowSelected} - columns={columns} data={poiList} selectableRows className="data_table" - /> -
- { - isPDFLoading && - } -
- ); -} \ No newline at end of file diff --git a/web/src/components/admin_panel_poi/admin_panel_poi_register/admin_panel_poi_register.tsx b/web/src/components/admin_panel_poi/admin_panel_poi_register/admin_panel_poi_register.tsx deleted file mode 100644 index 25b25c85ed27df302a748c63b7bb2cc4ea164e00..0000000000000000000000000000000000000000 --- a/web/src/components/admin_panel_poi/admin_panel_poi_register/admin_panel_poi_register.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import { faWindowClose } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { useEffect, useState} from "react"; -import "./assets/css/styles.css"; -import { languaguesList } from "../../../constants/languages"; -import { LoadingScreen } from "../../loading_screen/loading_screen"; -import { usePointOfInterest } from "../../../hooks/usePointOfInterest"; -import { EmptyPointOfInterest, PointOfInterest } from "../../../infraestructure/entities/poi"; -import { ImageDropzone } from "../../image_dropzone/image_dropzone"; -import { usePlace } from "../../../hooks/usePlace"; - -interface props { - setWindowVisibility: (visibility: boolean) => void; - idTown: number; - forceRenderList: () => void; - isRegister: boolean; - form?: PointOfInterest; -} - -export const AdminPanelPoiRegister = ({setWindowVisibility, idTown,forceRenderList, isRegister, form}: props) => { - const { - register, - errors, - setDescriptions, - setDirections, - descriptions, - directions, - setLanguageDescriptionIndexSelected, - handleSubmit, - onSubmitRegister, - getPointById, - setValue, - languageDescriptionIndexSelected, - languageDirectionsIndexSelected, - setLanguageDirectionsIndexSelected, - } = usePointOfInterest(forceRenderList, setWindowVisibility); - const [isLoading, setIsLoading] = useState(false); - const [preview, setPreview] = useState(null); - const [image, setImage] = useState(null); - const { - placeList, - updatePlacesByTown - } = usePlace(); - - useEffect(() => { - if(image){ - setValue('image', image, {shouldValidate: true}); - } - },[image]); - - useEffect(() => { - setIsLoading(true); - const fetchData = async () => { - await updatePlacesByTown(idTown); - if (!isRegister && form) { - const pointGetted = await getPointById(form.idPoint || 0); - if(pointGetted){ - setValue('idPoint', pointGetted.idPlace); - setValue('name', pointGetted.name); - setValue('contentEN', pointGetted.contentEN); - setValue('contentES', pointGetted.contentES); - setValue('directionsEN', pointGetted.directionsEN); - setValue('directionsES', pointGetted.directionsES); - } - } - }; - fetchData(); - setIsLoading(false); - },[]); - - return ( -
-
- Registra el punto de interés - setWindowVisibility(false)}/> -
-
- {isLoading - ? - - : -
-
-
-
- Nombre del punto de interés -
- -

{errors.name?.message}

-
- -
-
- Descripción del punto de interés - -
- { - languaguesList.map((language, index) => { - if(index===languageDescriptionIndexSelected){ - return ( -