From f5a2c0774e8bfe1ae9933d6482da237915827116 Mon Sep 17 00:00:00 2001 From: Horacio Daniel Ros Date: Tue, 22 Sep 2026 11:20:53 -0300 Subject: [PATCH] feat: integrate bottom toolbar store in various organization profile pages - Added bottom toolbar functionality to the Schedules, Services, Templates, and WAP pages. - Ensured the bottom toolbar is cleared on component unmount. - Improved code formatting and consistency across components. - Minor adjustments to state management and event handling for better clarity and performance. --- .../[oid]/client/[clientId]/account/page.tsx | 481 +++++++++++------ .../client/[clientId]/appointments/page.tsx | 42 +- .../org/[oid]/client/[clientId]/edit/page.tsx | 16 +- .../[oid]/client/[clientId]/merge/page.tsx | 12 +- .../client/[clientId]/notifications/page.tsx | 44 +- .../[oid]/client/[clientId]/profile/page.tsx | 68 +-- .../[oid]/client/[clientId]/repeats/page.tsx | 10 +- .../org/profile/[id]/address/page.tsx | 10 +- .../org/profile/[id]/advanced/page.tsx | 10 +- .../org/profile/[id]/assistance/page.tsx | 8 + .../org/profile/[id]/collaborators/page.tsx | 8 + .../org/profile/[id]/discounts-email/page.tsx | 22 +- .../org/profile/[id]/discounts/page.tsx | 18 +- .../org/profile/[id]/edit/page.tsx | 120 +++-- .../org/profile/[id]/fiscal/page.tsx | 121 +++-- .../org/profile/[id]/notifications/page.tsx | 86 ++- .../profile/[id]/payments/not-payed/page.tsx | 457 +++++++++++----- .../org/profile/[id]/payments/page.tsx | 509 +++++++++++++----- .../org/profile/[id]/schedules/page.tsx | 10 +- .../org/profile/[id]/services/[sid]/page.tsx | 33 +- .../org/profile/[id]/services/page.tsx | 89 ++- .../[id]/templates/new/[templateId]/page.tsx | 6 +- .../org/profile/[id]/templates/page.tsx | 12 +- .../org/profile/[id]/wap/page.tsx | 10 +- 24 files changed, 1537 insertions(+), 665 deletions(-) diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/account/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/account/page.tsx index d5ec1ed..b5fca51 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/account/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/account/page.tsx @@ -23,6 +23,7 @@ import { CLIENT_ACCOUNT_MOVEMENT_TYPES } from "@core/Models/ClientAccountMovemen import { getPaymentIcon } from "@core/app/components/PaymentIcons/PaymentIcons"; import SecureByPlan, { SECURE_CONTENTS } from "@core/app/components/SecureByPlan/SecureByPlan"; import { motion } from "motion/react"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -36,13 +37,14 @@ export default function ClientAccount() { const alert = useAlert(); const SessionInfo = useSessionStore(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const { goTo } = useNavigation(); const [view, setView] = useState(null); const [isScrolled, setIsScrolled] = useState(false); const [forceMinimized, setForceMinimized] = useState(false); - + const isMinimized = forceMinimized || isScrolled; useEffect(() => { @@ -68,6 +70,8 @@ export default function ClientAccount() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id + "/clients", title: "Clientes", @@ -85,6 +89,10 @@ export default function ClientAccount() { title: "Cuenta Corriente", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -127,149 +135,273 @@ export default function ClientAccount() {
- {/* Top Status Card */} -
- {view && ( - + {view && ( + = 0 + ? "linear-gradient(135deg, #1d976c 0%, #93f9b9 100%)" + : "linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%)", + color: "white", + boxShadow: isMinimized + ? "0 4px 15px rgba(0,0,0,0.3)" + : "0 10px 30px rgba(0,0,0,0.15)", + position: "relative", + overflow: "hidden", + transition: "box-shadow 0.3s ease", + }} + > + setForceMinimized(!forceMinimized)} + style={{ + position: "absolute", + top: "10px", + left: "10px", + color: "rgba(255,255,255,0.7)", + zIndex: 10, + }} + size="small" + title={forceMinimized ? "Maximizar" : "Minimizar"} + > + {forceMinimized ? : } + + + {/* Decorative background circles */} +
+
+ + + Saldo Actual + + + {formatPrice(view.amount)} + + + {!isMinimized && ( + + + + add(CLIENT_ACCOUNT_MOVEMENT_TYPES.DEPOSIT) + } + > + + + Ingresar + + + + + + + add(CLIENT_ACCOUNT_MOVEMENT_TYPES.WITHDRAWAL) + } + > + + + Retirar + + + + + + = 0 ? "#1d976c" : "#cb2d3e", + display: "flex", + alignItems: "center", + flexDirection: "column", + width: "110px", + height: "90px", + borderRadius: "15px", + boxShadow: "0 4px 15px rgba(0,0,0,0.1)", + "&:hover": { backgroundColor: "#f8f9fa" }, + }} + onClick={() => + goTo( + "/admin/org/" + + id + + "/client/" + + clientId + + "/account/movements", + ) + } + > + + + Historial + + + + + )} +
+ )} +
+ +
+
= 0 - ? "linear-gradient(135deg, #1d976c 0%, #93f9b9 100%)" - : "linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%)", - color: "white", - boxShadow: isMinimized ? "0 4px 15px rgba(0,0,0,0.3)" : "0 10px 30px rgba(0,0,0,0.15)", - position: "relative", - overflow: "hidden", - transition: "box-shadow 0.3s ease" + marginBottom: "15px", + padding: "0 10px", }} > - setForceMinimized(!forceMinimized)} - style={{ position: "absolute", top: "10px", left: "10px", color: "rgba(255,255,255,0.7)", zIndex: 10 }} - size="small" - title={forceMinimized ? "Maximizar" : "Minimizar"} - > - {forceMinimized ? : } - - - {/* Decorative background circles */} -
-
- - - Saldo Actual - - - {formatPrice(view.amount)} - - - - {!isMinimized && ( - - - add(CLIENT_ACCOUNT_MOVEMENT_TYPES.DEPOSIT)} - > - - Ingresar - - - - - add(CLIENT_ACCOUNT_MOVEMENT_TYPES.WITHDRAWAL)} - > - - Retirar - - - - - = 0 ? "#1d976c" : "#cb2d3e", - display: "flex", - alignItems: "center", - flexDirection: "column", - width: "110px", - height: "90px", - borderRadius: "15px", - boxShadow: "0 4px 15px rgba(0,0,0,0.1)", - "&:hover": { backgroundColor: "#f8f9fa" } - }} - onClick={() => goTo("/admin/org/" + id + "/client/" + clientId + "/account/movements")} - > - - Historial - - - - )} - - )} -
- -
-
-
Últimos Movimientos
-
goTo("/admin/org/" + id + "/client/" + clientId + "/account/movements")} +
+ goTo( + "/admin/org/" + + id + + "/client/" + + clientId + + "/account/movements", + ) + } > Ver todos
@@ -294,42 +426,79 @@ export default function ClientAccount() { boxShadow: "0 2px 8px rgba(0,0,0,0.05)", }} > -
-
0 ? "rgba(40, 167, 69, 0.1)" : "rgba(220, 53, 69, 0.1)", - display: "flex", - alignItems: "center", - justifyContent: "center", - color: movement.amount > 0 ? "#28a745" : "#dc3545" - }}> +
+
0 + ? "rgba(40, 167, 69, 0.1)" + : "rgba(220, 53, 69, 0.1)", + display: "flex", + alignItems: "center", + justifyContent: "center", + color: + movement.amount > 0 ? "#28a745" : "#dc3545", + }} + > {getPaymentIcon(movement.paymentMethod)}
-
+
{movement.description}
- {dayjs(movement.createdAt).format("DD MMMM YYYY • HH:mm")} + {dayjs(movement.createdAt).format( + "DD MMMM YYYY • HH:mm", + )}
-
0 ? "#28a745" : "#dc3545", - }}> - {movement.amount > 0 ? "+" : ""}{formatPrice(movement.amount)} +
0 ? "#28a745" : "#dc3545", + }} + > + {movement.amount > 0 ? "+" : ""} + {formatPrice(movement.amount)}
))}
) : ( -
- -
+
+ +
Aún no hay movimientos
diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/appointments/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/appointments/page.tsx index 8ced675..0a3a28b 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/appointments/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/appointments/page.tsx @@ -1,9 +1,6 @@ "use client"; import { useAlert } from "@core/Store/Alert.Store"; -import { - useEventHandlerStore, - EVENT_TYPES, -} from "@core/Store/EventHandler.Store"; +import { useEventHandlerStore, EVENT_TYPES } from "@core/Store/EventHandler.Store"; import { useLocationStore } from "@core/Store/Location.Store"; import { useParams } from "next/navigation"; import { useEffect, useState } from "react"; @@ -14,6 +11,7 @@ import ServiceItem from "@core/app/components/ServiceItem/ServiceItem"; import Location from "@core/app/components/Location/Location"; import { useNavigation } from "@core/app/hooks/goto"; import { useMenuStore } from "@core/Store/Menu.Store"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -26,14 +24,14 @@ export default function ClientAppointments() { const clientId = data.clientId; const alert = useAlert(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const menu = useMenuStore(); const { goTo } = useNavigation(); - const [appintments, setAppointments] = - useState({ - events: [], - }); + const [appintments, setAppointments] = useState({ + events: [], + }); useEffect(() => { eventHandler.setEventType(EVENT_TYPES.SLEEP); @@ -44,6 +42,8 @@ export default function ClientAppointments() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id + "/clients", title: "Clientes", @@ -61,6 +61,10 @@ export default function ClientAppointments() { title: "Turnos reservados", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -89,15 +93,17 @@ export default function ClientAppointments() { }} > {appintments.events.length === 0 ? ( -
+
No hay turnos registrados para este cliente.
) : ( @@ -113,7 +119,7 @@ export default function ClientAppointments() { "/client/" + clientId + "/appointments/" + - event.id + event.id, ); }} /> diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/edit/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/edit/page.tsx index d684c1b..056c277 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/edit/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/edit/page.tsx @@ -15,6 +15,7 @@ import { validatePhone } from "@core/helpers/validatePhone"; import { useConfirmStore } from "@core/Store/Confirm.Store"; import Switch from "@core/app/components/Switch/Switch"; import { Box, Typography } from "@mui/material"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -29,6 +30,7 @@ export default function ClientCreate() { const confirm = useConfirmStore(); const SessionInfo = useSessionStore(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); @@ -46,6 +48,8 @@ export default function ClientCreate() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id + "/clients", title: "Clientes", @@ -63,6 +67,10 @@ export default function ClientCreate() { title: "Editar", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -92,7 +100,7 @@ export default function ClientCreate() { confirm.show( validationPhoneResult.message, () => {}, - () => {} + () => {}, ); eventHandler.setEventType(EVENT_TYPES.SLEEP); return; @@ -112,7 +120,7 @@ export default function ClientCreate() { }) .then(() => { alert.showSuccess( - `Información del cliente ${firstName} ${lastName} actualizada` + `Información del cliente ${firstName} ${lastName} actualizada`, ); setTimeout(() => { goTo("/admin/org/" + id + "/client/" + clientId + "/profile"); @@ -180,7 +188,9 @@ export default function ClientCreate() { />
- Baneado (No puede reservar) + + Baneado (No puede reservar) + { diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/merge/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/merge/page.tsx index 8f87d50..e4dff39 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/merge/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/merge/page.tsx @@ -18,6 +18,7 @@ import { ClientMergeParams, OrganizationClientView } from "@core/Models/Clients. import Button from "@core/app/components/Button/Button"; import MaterialAlert from "@mui/material/Alert"; import { useConfirmStore } from "@core/Store/Confirm.Store"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -32,6 +33,7 @@ export default function ClientCreate() { const confirm = useConfirmStore(); const SessionInfo = useSessionStore(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const { goTo } = useNavigation(); @@ -53,7 +55,7 @@ export default function ClientCreate() { }); const [clientMergeFilterData, setClientMergeFilterData] = useState( - [] + [], ); const [clientMergeId, setClientMergeId] = useState(""); @@ -94,7 +96,7 @@ export default function ClientCreate() { () => { mergeClients(); }, - () => {} + () => {}, ); }; @@ -105,6 +107,8 @@ export default function ClientCreate() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id + "/clients", title: "Clientes", @@ -122,6 +126,10 @@ export default function ClientCreate() { title: "Fusionar clientes", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/notifications/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/notifications/page.tsx index 1f209fd..cd9c3ab 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/notifications/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/notifications/page.tsx @@ -11,6 +11,7 @@ import ClientsIcon from "@mui/icons-material/AccountBoxOutlined"; import NotificationsIcon from "@mui/icons-material/NotificationsOutlined"; import MaterialAlert from "@mui/material/Alert"; import styles from "./NotificationsPage.module.css"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -20,7 +21,7 @@ type UrlData = { const CHANNELS: { key: NotificationChannel; label: string }[] = [ { key: "whatsapp", label: "WhatsApp" }, { key: "email", label: "Email" }, - { key: "system", label: "Sistema" } + { key: "system", label: "Sistema" }, ]; type ChannelPreference = "default" | "preferred" | "muted"; @@ -30,34 +31,41 @@ export default function NotificationsPage() { const oid = data.oid; const clientId = data.clientId; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const store = useNotificationPreferencesStore(); useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Organizaciones", - icon: null + icon: null, }); location.add({ url: "/admin/org/profile/" + oid, title: "Organización", - icon: + icon: , }); location.add({ url: "/admin/org/" + oid + "/client/" + clientId + "/profile", title: "Cliente", - icon: + icon: , }); location.add({ url: "", title: "Notificaciones", - icon: + icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, [oid, clientId]); const getChannelPreference = (channel: NotificationChannel): ChannelPreference => { @@ -81,7 +89,7 @@ export default function NotificationsPage() { mutedChannels: preference === "muted" ? [...store.formData.mutedChannels.filter((c) => c !== channel), channel] - : store.formData.mutedChannels.filter((c) => c !== channel) + : store.formData.mutedChannels.filter((c) => c !== channel), }); }; @@ -91,7 +99,9 @@ export default function NotificationsPage() {
- Preferencias del cliente: Configure cómo esta organización debe comunicarse con este cliente. Si deja un canal en estándar, se usará la política general de la organización. + Preferencias del cliente: Configure cómo esta organización debe + comunicarse con este cliente. Si deja un canal en estándar, se usará la política + general de la organización.
@@ -102,24 +112,32 @@ export default function NotificationsPage() {
{channel.label}
- {selectedPreference === "preferred" && "Priorizar este canal para el cliente."} - {selectedPreference === "muted" && "No enviar notificaciones por este canal."} - {selectedPreference === "default" && "Usar la configuración general de la organización."} + {selectedPreference === "preferred" && + "Priorizar este canal para el cliente."} + {selectedPreference === "muted" && + "No enviar notificaciones por este canal."} + {selectedPreference === "default" && + "Usar la configuración general de la organización."}
{[ { key: "default" as ChannelPreference, label: "Estándar" }, - { key: "preferred" as ChannelPreference, label: "Preferido" }, - { key: "muted" as ChannelPreference, label: "Silenciado" } + { + key: "preferred" as ChannelPreference, + label: "Preferido", + }, + { key: "muted" as ChannelPreference, label: "Silenciado" }, ].map((option) => { const isSelected = selectedPreference === option.key; return (
diff --git a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/repeats/page.tsx b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/repeats/page.tsx index ce4a119..2cd66b4 100644 --- a/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/repeats/page.tsx +++ b/txclient/src/app/admin/(client-profile)/org/[oid]/client/[clientId]/repeats/page.tsx @@ -17,6 +17,7 @@ import { deleteRepeat, getRepeatsByClient } from "../Client.Service"; import { DeleteRepeatsParams, FindRepeatsParams, RepeatView } from "@core/Models/Repeats.model"; import style from "./repeats.module.css"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { oid: string; @@ -31,6 +32,7 @@ export default function ClientCreate() { const confirm = useConfirmStore(); const SessionInfo = useSessionStore(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const [repeats, setRepeats] = useState([]); @@ -52,6 +54,8 @@ export default function ClientCreate() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id + "/clients", title: "Clientes", @@ -69,6 +73,10 @@ export default function ClientCreate() { title: "Repeticiones", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -162,7 +170,7 @@ export default function ClientCreate() { () => { handleDelete(repeat.id); }, - () => {} + () => {}, ); }} > diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/address/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/address/page.tsx index b5d59c3..7d2973e 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/address/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/address/page.tsx @@ -27,6 +27,7 @@ import TextObjectFilter from "@components/TextObjectFilter/TextObjectFilter"; import SelectLocationMap, { LocationCoordinates, } from "@core/app/components/SelectLocationMap/SelectLocationMap"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -36,6 +37,7 @@ export default function OrganizationEdit() { const data = useParams(); const id = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const SessionInfo = useSessionStore(); const alert = useAlert(); @@ -140,7 +142,7 @@ export default function OrganizationEdit() { }); const [localidadesFilterData, setLocalidadesFilterData] = useState( - [] + [], ); const [selectedLocalidad, setSelectedLocalidad] = useState(""); @@ -188,6 +190,8 @@ export default function OrganizationEdit() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Organizaciones", @@ -205,6 +209,10 @@ export default function OrganizationEdit() { title: "Ubicación", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/advanced/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/advanced/page.tsx index 302b5fa..a837269 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/advanced/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/advanced/page.tsx @@ -14,6 +14,7 @@ import Button from "@core/app/components/Button/Button"; import { useConfirmStore } from "@core/Store/Confirm.Store"; import { deleteOrganization } from "./advanced.Service"; import { useNavigation } from "@core/app/hooks/goto"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -23,6 +24,7 @@ export default function OrganizationAdvancedEdit() { const data = useParams(); const id = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const SessionInfo = useSessionStore(); const alert = useAlert(); @@ -33,6 +35,8 @@ export default function OrganizationAdvancedEdit() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Organizaciones", @@ -50,6 +54,10 @@ export default function OrganizationAdvancedEdit() { title: "Avanzado", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); const eliminarHandler = () => { @@ -73,7 +81,7 @@ export default function OrganizationAdvancedEdit() { }, () => { eventHandler.setEventType(EVENT_TYPES.SLEEP); - } + }, ); } else { alert.showError("La confirmación no es correcta"); diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/assistance/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/assistance/page.tsx index 8edfcaa..b1ab19e 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/assistance/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/assistance/page.tsx @@ -12,6 +12,7 @@ import { UserAssistanceInfo } from "@core/Models/User.model"; import Link from "next/link"; import { getAssistanceUserInfo } from "./Assistance.Service"; import AssistanceIcon from "@mui/icons-material/HeadsetMicOutlined"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -23,6 +24,7 @@ export default function CollaboratorsAdd() { const alert = useAlert(); const eventHandler = useEventHandlerStore(); const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const SessionInfo = useSessionStore(); const [user, setUser] = useState(null); const [findEmail, setFindEmail] = useState(""); @@ -34,6 +36,8 @@ export default function CollaboratorsAdd() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org/profile/" + id, title: "Organizacion", @@ -45,6 +49,10 @@ export default function CollaboratorsAdd() { title: "Asistencia", icon: , }); + + return () => { + bottomToolbar.clear(); + }; }, []); const findUser = async () => { diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/collaborators/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/collaborators/page.tsx index bcc9156..2789442 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/collaborators/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/collaborators/page.tsx @@ -10,6 +10,7 @@ import { CompanyEmployeesView } from "@models/Collaborators.model"; import { loadCollaboratorsByCompanyId } from "./Collaborators.Service"; import { useAlert } from "@store/Alert.Store"; import CollaboratorItem from "@core/app/components/CollaboratorItem/CollaboratorItem"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -19,6 +20,7 @@ export default function OrganizationProfile() { const data = useParams(); const id = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const alert = useAlert(); const { goTo } = useNavigation(); @@ -31,6 +33,8 @@ export default function OrganizationProfile() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Mis organizaciones", @@ -60,6 +64,10 @@ export default function OrganizationProfile() { .finally(() => { eventHandler.setEventType(EVENT_TYPES.NEED_ADD); }); + + return () => { + bottomToolbar.clear(); + }; }, []); const handleCollaboratorClick = (collaboratorId: string) => { diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts-email/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts-email/page.tsx index d30266f..9a51233 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts-email/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts-email/page.tsx @@ -35,6 +35,7 @@ import TextObjectFilterItem from "@core/app/components/TextObjectFilterItem/Text import TextObjectFilter from "@core/app/components/TextObjectFilter/TextObjectFilter"; import { useFilterStore } from "@core/Store/Filter.Store"; import filterObjects from "@components/TextObjectFilter/Filter.Service"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -112,6 +113,7 @@ export default function DiscountsEmailGrid() { const data = useParams(); const oid = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const SessionInfo = useSessionStore(); const eventHandler = useEventHandlerStore(); const alert = useAlert(); @@ -151,7 +153,9 @@ export default function DiscountsEmailGrid() { render: (value: DiscountEmailRow) => (
-
+
{value.discountName + " (" + value.discountCode + ")"}
@@ -206,8 +210,10 @@ export default function DiscountsEmailGrid() { const [pageSize] = useState( parseInt( - process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE ? process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE : "10" - ) + process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE + ? process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE + : "10", + ), ); const [discounts, setDiscounts] = useState(); const discountsRef = useRef(discounts); @@ -219,6 +225,8 @@ export default function DiscountsEmailGrid() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Mis organizaciones", @@ -238,6 +246,10 @@ export default function DiscountsEmailGrid() { }); loadDiscountsEmail(1, pageSize); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -267,7 +279,7 @@ export default function DiscountsEmailGrid() { setDiscountId={setDiscountId} filterEmail={filterEmail} setFilterEmail={setFilterEmail} - /> + />, ); filter.setOnFilter(() => { setSearchByFilters(true); @@ -327,7 +339,7 @@ export default function DiscountsEmailGrid() { alert.showError(err.format()); }); }, - () => {} + () => {}, ); }; diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts/page.tsx index ae4dd43..4309c3b 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/discounts/page.tsx @@ -22,6 +22,7 @@ import turnosXpressTheme from "@core/app/theme/turnosXpress"; import { ButtonGroup } from "@mui/material"; import ButtonMaterial from "@mui/material/Button"; import { useNavigation } from "@core/app/hooks/goto"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -33,6 +34,7 @@ export default function DiscountsGrid() { const data = useParams(); const oid = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const { goTo } = useNavigation(); @@ -67,7 +69,9 @@ export default function DiscountsGrid() { color: "var(--green-darkestX2)", }} > - {value.type === DiscountType.FIXED ? formatPrice(value.value) : value.value + "%"} + {value.type === DiscountType.FIXED + ? formatPrice(value.value) + : value.value + "%"}
), @@ -76,8 +80,10 @@ export default function DiscountsGrid() { const [pageSize] = useState( parseInt( - process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE ? process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE : "10" - ) + process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE + ? process.env.NEXT_PUBLIC_DATAGRID_PAGE_SIZE + : "10", + ), ); const [discounts, setDiscounts] = useState(); @@ -88,6 +94,8 @@ export default function DiscountsGrid() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Mis organizaciones", @@ -107,6 +115,10 @@ export default function DiscountsGrid() { }); loadDiscounts(1, pageSize); + + return () => { + bottomToolbar.clear(); + }; }, []); const loadDiscounts = (page: number = 1, pageSize: number = 30) => { diff --git a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/edit/page.tsx b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/edit/page.tsx index 8d73484..d7e9522 100644 --- a/txclient/src/app/admin/(organization-profile)/org/profile/[id]/edit/page.tsx +++ b/txclient/src/app/admin/(organization-profile)/org/profile/[id]/edit/page.tsx @@ -38,6 +38,7 @@ import Switch from "@core/app/components/Switch/Switch"; import { FindTemplatesParams } from "@core/Models/Templates.model"; import filterObjects from "@core/app/components/TextObjectFilter/Filter.Service"; import { CompanyServiceView } from "@models/Service.model"; +import { useBottomToolbarStore } from "@core/Store/BottomToolbar.Store"; type UrlData = { id: string; @@ -47,6 +48,7 @@ export default function OrganizationEdit() { const data = useParams(); const id = data.id; const location = useLocationStore(); + const bottomToolbar = useBottomToolbarStore(); const eventHandler = useEventHandlerStore(); const SessionInfo = useSessionStore(); const alert = useAlert(); @@ -66,11 +68,12 @@ export default function OrganizationEdit() { const [servicesShowPublicScores, setServicesShowPublicScores] = useState(true); const [servicesShowPublicOpinions, setServicesShowPublicOpinions] = useState(true); const [originalServicesShowPublicScores, setOriginalServicesShowPublicScores] = useState(true); - const [originalServicesShowPublicOpinions, setOriginalServicesShowPublicOpinions] = useState(true); + const [originalServicesShowPublicOpinions, setOriginalServicesShowPublicOpinions] = + useState(true); const [services, setServices] = useState([]); const [orgPublished, setOrgPublished] = useState( - undefined + undefined, ); const [savePublishedStatusAvailable, setSavePublishedStatusAvailable] = useState(false); @@ -199,6 +202,8 @@ export default function OrganizationEdit() { useEffect(() => { location.clear(); + bottomToolbar.set(<>); + location.add({ url: "/admin/org", title: "Organizaciones", @@ -218,6 +223,10 @@ export default function OrganizationEdit() { }); loadCategories(); + + return () => { + bottomToolbar.clear(); + }; }, []); useEffect(() => { @@ -241,25 +250,33 @@ export default function OrganizationEdit() { setCategoryId(organization.categoryId.toString()); setOrgSlug(getSlug(organization.name)); setOrgPublished(organization.published); - setShowPublicScores(organization.showPublicScores !== undefined ? organization.showPublicScores : true); - setShowPublicOpinions(organization.showPublicOpinions !== undefined ? organization.showPublicOpinions : true); + setShowPublicScores( + organization.showPublicScores !== undefined + ? organization.showPublicScores + : true, + ); + setShowPublicOpinions( + organization.showPublicOpinions !== undefined + ? organization.showPublicOpinions + : true, + ); setShowPublicProfessionals( organization.showPublicProfessionals !== undefined ? organization.showPublicProfessionals - : true + : true, ); setServices(loadedServices); setServicesShowPublicScores( - loadedServices.every((service) => service.showPublicScores !== false) + loadedServices.every((service) => service.showPublicScores !== false), ); setServicesShowPublicOpinions( - loadedServices.every((service) => service.showPublicOpinions !== false) + loadedServices.every((service) => service.showPublicOpinions !== false), ); setOriginalServicesShowPublicScores( - loadedServices.every((service) => service.showPublicScores !== false) + loadedServices.every((service) => service.showPublicScores !== false), ); setOriginalServicesShowPublicOpinions( - loadedServices.every((service) => service.showPublicOpinions !== false) + loadedServices.every((service) => service.showPublicOpinions !== false), ); requestAnimationFrame(() => { @@ -287,7 +304,7 @@ export default function OrganizationEdit() { confirm.show( validationPhoneResult.message, () => {}, - () => {} + () => {}, ); eventHandler.setEventType(EVENT_TYPES.SLEEP); return; @@ -307,7 +324,8 @@ export default function OrganizationEdit() { phoneNumber: phone, templateWapNotifId: templateWapNotifId === "" ? undefined : templateWapNotifId, templateWapAltaId: templateWapAltaId === "" ? undefined : templateWapAltaId, - templateWapCancellationId: templateWapCancellationId === "" ? undefined : templateWapCancellationId, + templateWapCancellationId: + templateWapCancellationId === "" ? undefined : templateWapCancellationId, ...(canEditPublicVisibilityFlags ? { showPublicScores, @@ -321,31 +339,31 @@ export default function OrganizationEdit() { id: Yup.string().required("En este momento no es posible procesar su solicitud."), name: Yup.string().required("Debe introducir el nombre de la organización."), description: Yup.string().required( - "Debe introducir la descripción de la organización." + "Debe introducir la descripción de la organización.", ), categoryId: Yup.number().required( - "Debe seleccionar una categoría para la organización." + "Debe seleccionar una categoría para la organización.", ), phoneAreaCode: Yup.number() .typeError("Código de área debe ser un número.") .transform((value, originalValue) => - originalValue.toString().trim() === "" ? null : value + originalValue.toString().trim() === "" ? null : value, ) .nullable(), phoneNumber: Yup.number() .typeError("El teléfono debe ser un número.") .transform((value, originalValue) => - originalValue.toString().trim() === "" ? null : value + originalValue.toString().trim() === "" ? null : value, ) .nullable(), appointmentAlert: Yup.string().optional().default(""), sessionUser: Yup.string().required( - "Para crear una organización debe iniciar sesión." + "Para crear una organización debe iniciar sesión.", ), heatMapFraction: Yup.number() .typeError("Fracción de tiempo debe ser un número.") .transform((value, originalValue) => - originalValue.toString().trim() === "" ? null : value + originalValue.toString().trim() === "" ? null : value, ) .nullable() .integer("Fracción de tiempo debe ser un número entero en minutos.") @@ -354,7 +372,7 @@ export default function OrganizationEdit() { appointmentTime: Yup.number() .typeError("El Plazo Mínimo de Reserva debe ser un número.") .transform((value, originalValue) => - originalValue.toString().trim() === "" ? null : value + originalValue.toString().trim() === "" ? null : value, ) .nullable() .integer("El Plazo Mínimo de Reserva debe ser un número entero en horas.") @@ -362,7 +380,7 @@ export default function OrganizationEdit() { cancellationTime: Yup.number() .typeError("El Plazo Mínimo de Cancelación debe ser un número.") .transform((value, originalValue) => - originalValue.toString().trim() === "" ? null : value + originalValue.toString().trim() === "" ? null : value, ) .nullable() .integer("El Plazo Mínimo de Cancelación debe ser un número entero en horas.") @@ -386,7 +404,8 @@ export default function OrganizationEdit() { originalServicesShowPublicOpinions !== servicesShowPublicOpinions; const changedServices = canEditPublicVisibilityFlags && - (servicesShowPublicScoresChanged || servicesShowPublicOpinionsChanged) + (servicesShowPublicScoresChanged || + servicesShowPublicOpinionsChanged) ? services : []; @@ -414,8 +433,8 @@ export default function OrganizationEdit() { : service.showPublicOpinions !== undefined ? service.showPublicOpinions : true, - }) - ) + }), + ), ).then(() => { const updatedServices = services.map((service) => ({ ...service, @@ -434,7 +453,9 @@ export default function OrganizationEdit() { }); }) .catch((error: ApiError | Error) => { - alert.showError(error instanceof ApiError ? error.format() : error.message); + alert.showError( + error instanceof ApiError ? error.format() : error.message, + ); }) .finally(() => { eventHandler.setEventType(EVENT_TYPES.SLEEP); @@ -453,7 +474,7 @@ export default function OrganizationEdit() { id: category.id.toString(), name: category.name, description: category.description, - })) + })), ); }; @@ -533,7 +554,7 @@ export default function OrganizationEdit() { setOrgPublished( checked ? COMPANY_PUBLISHED_STATUS.PUBLISHED - : COMPANY_PUBLISHED_STATUS.PRIVATE + : COMPANY_PUBLISHED_STATUS.PRIVATE, ); }} /> @@ -581,15 +602,23 @@ export default function OrganizationEdit() { /> - Visibilidad pública: Elegí si querés mostrar puntuaciones, opiniones y profesionales en el perfil público y las páginas de reserva. Disponible para planes pagos. + Visibilidad pública: Elegí si querés mostrar puntuaciones, opiniones y + profesionales en el perfil público y las páginas de reserva. Disponible para planes + pagos. {!canEditPublicVisibilityFlags && ( - Para modificar las opciones de visibilidad pública de opiniones, puntuaciones y profesionales de esta organización y sus servicios, el propietario de la organización necesita un plan pago. + Para modificar las opciones de visibilidad pública de opiniones, puntuaciones y + profesionales de esta organización y sus servicios, el propietario de la + organización necesita un plan pago. )} -
-