{isOpen ?
:
}
diff --git a/apps/infoalloggi/src/components/tables/servizio-table.tsx b/apps/infoalloggi/src/components/tables/servizio-table.tsx
deleted file mode 100644
index 69d0831..0000000
--- a/apps/infoalloggi/src/components/tables/servizio-table.tsx
+++ /dev/null
@@ -1,311 +0,0 @@
-import {
- Copy,
- EllipsisVertical,
- ExternalLink,
- Trash2,
- Wrench,
-} from "lucide-react";
-import Link from "next/link";
-import toast from "react-hot-toast";
-import { LoadingPage } from "~/components/loading";
-import { AddAnnuncio } from "~/components/servizio/servizio_actions";
-import { Button } from "~/components/ui/button";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuPortal,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuSeparator,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
-} from "~/components/ui/dropdown-menu";
-import {
- Table,
- TableBody,
- TableCaption,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from "~/components/ui/table";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from "~/components/ui/tooltip";
-import { env } from "~/env";
-import type { AnnunciId } from "~/schemas/public/Annunci";
-import type { Servizio, ServizioServizioId } from "~/schemas/public/Servizio";
-import type { UsersId } from "~/schemas/public/Users";
-import { api } from "~/utils/api";
-
-export const TabServizio = ({
- userId,
- setEditData,
- setOpen,
-}: {
- userId: UsersId;
- setEditData: (data: Servizio | undefined) => void;
- setOpen: (open: boolean) => void;
-}) => {
- const { data } = api.servizio.getUserServizi.useQuery({ userId });
- const utils = api.useUtils();
- const { mutate: remove } = api.servizio.deleteServizio.useMutation({
- onError: (error) => {
- toast.error(error.message);
- },
- onSuccess: async () => {
- toast.success("Servizio rimosso con successo");
- await utils.servizio.getUserServizi.invalidate();
- },
- });
-
- const { mutate: update } = api.servizio.updateServizio.useMutation({
- onError: (error) => {
- toast.error(error.message);
- },
- onSuccess: async (data) => {
- toast.success("Servizio modificato con successo");
- await utils.servizio.getUserServizi.invalidate();
- await utils.servizio.getPacksSolution.invalidate({
- servizioId: data.servizio_id,
- });
- },
- });
-
- if (!data) return
;
- return (
-
-
- {data.length > 0
- ? "Lista dai servizi dell'utente"
- : "Nessun servizio attualmente inserito"}
-
-
-
- Id
- Tipologia
- Creato Il
- Inviato
- Status
-
-
-
-
-
- {data.map((servizio) => {
- const onboardDone =
- servizio.isInterrotto ||
- servizio.isOkAcconto ||
- servizio.decorrenza !== null;
- return (
-
-
- {servizio.servizio_id}
-
- {servizio.tipologia}
-
- {new Date(servizio.created_at).toLocaleDateString("it-IT", {
- day: "2-digit",
- month: "2-digit",
- year: "numeric",
- })}
-
-
- {servizio.isSent ? (
- Inviato
- ) : (
- Non inviato
- )}
-
-
- {(() => {
- if (servizio.isInterrotto)
- return Interrotto;
- if (servizio.isOkAcconto && servizio.decorrenza !== null)
- return Attivo;
- return Inattivo;
- })()}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Status Servizio
-
-
-
- {
- console.log(v);
-
- update({
- data: {
- decorrenza: v === "true" ? new Date() : null,
- isOkAcconto: v === "true",
- },
- servizioId: servizio.servizio_id,
- });
- }}
- value={String(servizio.isOkAcconto)}
- >
-
- Attivo
-
-
- Disattiva
-
-
-
-
-
-
-
-
- Interruzione
-
-
-
- {
- update({
- data: {
- isInterrotto: v === "true",
- },
- servizioId: servizio.servizio_id,
- });
- }}
- value={servizio.isInterrotto.toString()}
- >
-
- Interrotto
-
-
- Non Interrotto
-
-
-
-
-
-
-
- {
- setEditData(servizio);
- setOpen(true);
- }}
- >
-
- Modifica parametri
-
-
- confirm("Sei sicuro di voler eliminare il servizio?") &&
- remove({ servizioId: servizio.servizio_id })
- }
- >
-
- Elimina Servizio
-
-
-
-
-
- );
- })}
-
-
- );
-};
-
-const AnnunciSection = ({
- selectedAnnunci,
- servizioId,
- userId,
-}: {
- selectedAnnunci: { codice: string; annunci_id: AnnunciId }[];
- servizioId: ServizioServizioId;
- userId: UsersId;
-}) => {
- return (
-
-
-
- {selectedAnnunci?.length}
-
-
- {selectedAnnunci?.length > 0 ? (
-
- {selectedAnnunci?.map((annuncio) => (
- - {annuncio.codice}
- ))}
-
- ) : (
- Nessun annuncio associato
- )}
-
-
-
-
- );
-};
diff --git a/apps/infoalloggi/src/components/tables/users-table.tsx b/apps/infoalloggi/src/components/tables/users-table.tsx
index 7497016..37b2a45 100644
--- a/apps/infoalloggi/src/components/tables/users-table.tsx
+++ b/apps/infoalloggi/src/components/tables/users-table.tsx
@@ -7,7 +7,6 @@ import {
Paperclip,
Search,
ShoppingBag,
- Tickets,
User,
UserCog,
} from "lucide-react";
@@ -186,15 +185,7 @@ export const UsersTable = (props: { data: UserWChatInfo[] }) => {
Azioni
-
-
- Servizio
-
-
+
{
) {
return {
redirect: {
- destination: `/area-riservata/admin/user-view/servizio/${servizio.user_id}`,
+ destination: `/area-riservata/dashboard`,
permanent: false,
},
};
diff --git a/apps/infoalloggi/src/pages/area-riservata/admin/user-view/ricerca/[userId].tsx b/apps/infoalloggi/src/pages/area-riservata/admin/user-view/ricerca/[userId].tsx
index 1aad2da..185a5c4 100644
--- a/apps/infoalloggi/src/pages/area-riservata/admin/user-view/ricerca/[userId].tsx
+++ b/apps/infoalloggi/src/pages/area-riservata/admin/user-view/ricerca/[userId].tsx
@@ -1,5 +1,6 @@
import type { GetServerSideProps } from "next";
import { AreaRiservataLayoutUserView } from "~/components/Layout";
+import { ServiziHeader } from "~/components/servizio/servizi_header";
import { AnnunciRichiesti } from "~/components/servizio/servizio_annunci_accordions";
import { TabRicerca } from "~/components/tables/ricerca-table";
import type { NextPageWithLayout } from "~/pages/_app";
@@ -15,16 +16,10 @@ const RicercaUser: NextPageWithLayout = ({
userId,
}: RicercaUserProps) => {
return (
-
-
-
+
);
};
diff --git a/apps/infoalloggi/src/pages/servizio/conferma-immobile/[...slug].tsx b/apps/infoalloggi/src/pages/servizio/conferma-immobile/[...slug].tsx
index 61395d1..f2295e1 100644
--- a/apps/infoalloggi/src/pages/servizio/conferma-immobile/[...slug].tsx
+++ b/apps/infoalloggi/src/pages/servizio/conferma-immobile/[...slug].tsx
@@ -104,8 +104,9 @@ const ConfirmSection = ({
await router.push(
`/area-riservata/admin/user-view/ricerca/${data.userId}`,
);
+ } else {
+ await router.push("/area-riservata/dashboard");
}
- await router.push("/area-riservata/dashboard");
},
});
return (