Loading web/src/domain/useCase/usePlace.ts +22 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ import { showErrorAxios } from "../../core/utils/Messages"; const placeDatasouce = new PlaceDatasourceProd(); const placeRepository = new PlaceRepositoryProd(placeDatasouce); let lastSubmitTime = 0; // Define resolver for form validation const resolver: Resolver<Place> = async (data) => { const errors: FieldErrors<Place> = {}; Loading Loading @@ -199,6 +201,13 @@ export const usePlace = ( // Handle form submission for registering a place const onSubmitRegister: SubmitHandler<Place> = (data: Place) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await placeRepository.registerPlace(data).then(() => { Loading @@ -212,12 +221,12 @@ export const usePlace = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading @@ -244,6 +253,13 @@ export const usePlace = ( // Handle form submission for updating a place const onSubmitUpdate: SubmitHandler<Place> = (data: Place) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await placeRepository.updatePlace(data); Loading @@ -256,12 +272,12 @@ export const usePlace = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading web/src/domain/useCase/usePointOfInterest.ts +9 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ import { showErrorAxios } from "../../core/utils/Messages"; const POIDatasouce = new POIDatasourceProd(); const POIRepository = new POIRepositoryProd(POIDatasouce); let lastSubmitTime = 0; // Custom hook for point of interest functionality export const usePointOfInterest = ( forceRenderList?: () => void, Loading Loading @@ -145,6 +147,13 @@ export const usePointOfInterest = ( const onSubmitRegister: SubmitHandler<PointOfInterest> = ( data: PointOfInterest ) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await POIRepository.registerPoint(data).then(() => { Loading web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,9 @@ export const AdminPanelPlaceList = ({ // Function to delete the selected place with a toast notification const deleteSelectedPlace = (place: Place) => { toast.promise(deletePlace(place.idPlace || -1), { pending: "Eliminando categoría...", success: "La categoría se ha eliminado correctamente", error: "No se pudo eliminar la categoría", pending: "Eliminando lugar...", success: "El lugar se ha eliminado correctamente", error: "No se pudo eliminar el lugar", }); }; Loading web/src/presentation/admin/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx +7 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ export const AdminPanelPlaceRegister = ({ return ( <div className="place_register_wrap"> <div className="place_register_header"> Registra el lugar {isRegister ? "Registra" : "Actualiza"} el lugar <FontAwesomeIcon icon={faWindowClose} className="close_btn" Loading @@ -173,7 +173,12 @@ export const AdminPanelPlaceRegister = ({ <div className="inputs_container"> <div className="input"> <div className="input_header">Nombre del lugar</div> <input type="text" {...register("name")} autoComplete="off" maxLength={255}/> <input type="text" {...register("name")} autoComplete="off" maxLength={255} /> <p className="error">{errors.name?.message}</p> </div> Loading web/src/presentation/superadmin/sa_panel_admin/sa_panel_admin_register/assets/css/styles.css +16 −14 Original line number Diff line number Diff line Loading @@ -11,10 +11,11 @@ margin: auto; width: 30vw; height: 70vh; background: green; background: white; display: flex; z-index: 999; flex-direction: column; border: solid 2px black; } .admin_register_header { Loading @@ -23,6 +24,7 @@ align-items: center; justify-content: center; padding: 5px; background: #ccc; } .admin_register_close_btn { Loading Loading
web/src/domain/useCase/usePlace.ts +22 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ import { showErrorAxios } from "../../core/utils/Messages"; const placeDatasouce = new PlaceDatasourceProd(); const placeRepository = new PlaceRepositoryProd(placeDatasouce); let lastSubmitTime = 0; // Define resolver for form validation const resolver: Resolver<Place> = async (data) => { const errors: FieldErrors<Place> = {}; Loading Loading @@ -199,6 +201,13 @@ export const usePlace = ( // Handle form submission for registering a place const onSubmitRegister: SubmitHandler<Place> = (data: Place) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await placeRepository.registerPlace(data).then(() => { Loading @@ -212,12 +221,12 @@ export const usePlace = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading @@ -244,6 +253,13 @@ export const usePlace = ( // Handle form submission for updating a place const onSubmitUpdate: SubmitHandler<Place> = (data: Place) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await placeRepository.updatePlace(data); Loading @@ -256,12 +272,12 @@ export const usePlace = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading
web/src/domain/useCase/usePointOfInterest.ts +9 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ import { showErrorAxios } from "../../core/utils/Messages"; const POIDatasouce = new POIDatasourceProd(); const POIRepository = new POIRepositoryProd(POIDatasouce); let lastSubmitTime = 0; // Custom hook for point of interest functionality export const usePointOfInterest = ( forceRenderList?: () => void, Loading Loading @@ -145,6 +147,13 @@ export const usePointOfInterest = ( const onSubmitRegister: SubmitHandler<PointOfInterest> = ( data: PointOfInterest ) => { const currentTime = Date.now(); if (currentTime - lastSubmitTime < 5000) { toast.error("Debe esperar 5 segundos entre ejecuciones."); return; } lastSubmitTime = currentTime; const fetch = async () => { try { await POIRepository.registerPoint(data).then(() => { Loading
web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,9 @@ export const AdminPanelPlaceList = ({ // Function to delete the selected place with a toast notification const deleteSelectedPlace = (place: Place) => { toast.promise(deletePlace(place.idPlace || -1), { pending: "Eliminando categoría...", success: "La categoría se ha eliminado correctamente", error: "No se pudo eliminar la categoría", pending: "Eliminando lugar...", success: "El lugar se ha eliminado correctamente", error: "No se pudo eliminar el lugar", }); }; Loading
web/src/presentation/admin/admin_panel_places/admin_panel_place_register/admin_panel_place_register.tsx +7 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ export const AdminPanelPlaceRegister = ({ return ( <div className="place_register_wrap"> <div className="place_register_header"> Registra el lugar {isRegister ? "Registra" : "Actualiza"} el lugar <FontAwesomeIcon icon={faWindowClose} className="close_btn" Loading @@ -173,7 +173,12 @@ export const AdminPanelPlaceRegister = ({ <div className="inputs_container"> <div className="input"> <div className="input_header">Nombre del lugar</div> <input type="text" {...register("name")} autoComplete="off" maxLength={255}/> <input type="text" {...register("name")} autoComplete="off" maxLength={255} /> <p className="error">{errors.name?.message}</p> </div> Loading
web/src/presentation/superadmin/sa_panel_admin/sa_panel_admin_register/assets/css/styles.css +16 −14 Original line number Diff line number Diff line Loading @@ -11,10 +11,11 @@ margin: auto; width: 30vw; height: 70vh; background: green; background: white; display: flex; z-index: 999; flex-direction: column; border: solid 2px black; } .admin_register_header { Loading @@ -23,6 +24,7 @@ align-items: center; justify-content: center; padding: 5px; background: #ccc; } .admin_register_close_btn { Loading