diff --git a/apps/infoalloggi/src/components/Layout.tsx b/apps/infoalloggi/src/components/Layout.tsx index 5789ba9..46b1369 100644 --- a/apps/infoalloggi/src/components/Layout.tsx +++ b/apps/infoalloggi/src/components/Layout.tsx @@ -190,7 +190,7 @@ export const AreaRiservataLayoutUserView = ({ isAdmin /> -
+
{children} diff --git a/apps/infoalloggi/src/components/custom_ui/multiselect.tsx b/apps/infoalloggi/src/components/custom_ui/multiselect.tsx index 05e7f7c..d96fa22 100644 --- a/apps/infoalloggi/src/components/custom_ui/multiselect.tsx +++ b/apps/infoalloggi/src/components/custom_ui/multiselect.tsx @@ -134,6 +134,7 @@ export const MultiSelect = ({ control: () => cn( "mt-2 w-full rounded-lg h-min-[42px] bg-card shadow-xs outline-hidden text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", + disabled && "bg-muted opacity-50 cursor-not-allowed", ), input: () => cn("*:ring-0 focus:*:ring-0"), menu: () => diff --git a/apps/infoalloggi/src/components/servizio/admin_conferma.tsx b/apps/infoalloggi/src/components/servizio/admin_conferma.tsx index 3e0d5a4..770d604 100644 --- a/apps/infoalloggi/src/components/servizio/admin_conferma.tsx +++ b/apps/infoalloggi/src/components/servizio/admin_conferma.tsx @@ -169,21 +169,6 @@ const DocSection = () => { const { data, updateServizioAnnunci } = useServizioAnnuncio(); const utils = api.useUtils(); - // const { mutate: updateServizio } = api.servizio.UpdateConfermaDoc.useMutation( - // { - // onError: (error) => { - // toast.error(error.message); - // }, - // onSuccess: async () => { - // await utils.servizio.getAllServizioAnnunci.invalidate({ userId }); - // await utils.servizio.getServizio.invalidate({ - // servizioId, - // }); - - // toast.success("Dati salvati con successo"); - // }, - // }, - // ); const { data: files, isLoading } = api.storage.getAll.useQuery(); @@ -622,6 +607,7 @@ const StabileSection = () => { 1000, [value], ); + //TODO selettore per pack consulenza return (
diff --git a/apps/infoalloggi/src/components/servizio/admin_contratto.tsx b/apps/infoalloggi/src/components/servizio/admin_contratto.tsx index 7a13294..1108051 100644 --- a/apps/infoalloggi/src/components/servizio/admin_contratto.tsx +++ b/apps/infoalloggi/src/components/servizio/admin_contratto.tsx @@ -39,7 +39,7 @@ export const AdminContratto = () => { aria-label="Open Contratto Section" className="w-fit" size="sm" - variant={data.doc_contratto_added ? "success" : "secondary"} + variant={data.doc_contratto_added ? "success" : "orange"} > {data.doc_contratto_added ? : } Contratto diff --git a/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx b/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx index 902ebd4..5e23435 100644 --- a/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx +++ b/apps/infoalloggi/src/components/servizio/annuncio_actions.tsx @@ -134,12 +134,11 @@ export const UserActions = () => { <>
+ {ConfermaUtente + ? !data.hasConfermaAdmin && + : ContattiSbloccati && } - {ContattiSbloccati && !ConfermaUtente && } - {ConfermaUtente && !data.hasConfermaAdmin && ( - - )} - {AccettatoConferma && ( + {AccettatoConferma ? ( { Rivedi la conferma - )} - {ConfermaLavorata && + ) : ( + ConfermaLavorata && (data.doc_conferma_ref ? ( { - ))} + )) + )}
{data.accettato_conferma_at != null && } diff --git a/apps/infoalloggi/src/components/servizio/annuncio_card.tsx b/apps/infoalloggi/src/components/servizio/annuncio_card.tsx index 22d419e..0e18735 100644 --- a/apps/infoalloggi/src/components/servizio/annuncio_card.tsx +++ b/apps/infoalloggi/src/components/servizio/annuncio_card.tsx @@ -1,3 +1,4 @@ +import { Toolbox } from "lucide-react"; import Image from "next/image"; import { AdminActions, @@ -10,22 +11,21 @@ import { cn, formatCurrency } from "~/lib/utils"; import { useTranslation } from "~/providers/I18nProvider"; import { useServizio, useServizioAnnuncio } from "~/providers/ServizioProvider"; import type { AnnuncioRicerca } from "~/server/controllers/annunci.controller"; +import { Button } from "../ui/button"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "../ui/collapsible"; import { AnnuncioDettaglio, TipoBadge } from "./annuncio_dettaglio"; -export const AnnuncioCard = ({ - className, - confirming, -}: { - className?: string; - confirming?: boolean; -}) => { +export const AnnuncioCard = ({ className }: { className?: string }) => { const { isAdmin } = useServizio(); const { data } = useServizioAnnuncio(); return ( : } + interactions={ + isAdmin ? ( +
+ + + + + + + + + + +
+ ) : ( + + ) + } /> ); }; +export const BasicAnnuncioCard = ({ + interactions, + className, + data, +}: { + interactions?: React.ReactNode; + className?: string; + data: AnnuncioRicerca; +}) => { + return ( + + + Annuncio {data.codice} + + +
+ +
{interactions}
+
+
+
+ ); +}; + export const AnnuncioDisplay = ({ data, - confirming, className, }: { data: AnnuncioRicerca; - confirming?: boolean; className?: string; }) => { const { t } = useTranslation(); @@ -53,7 +98,6 @@ export const AnnuncioDisplay = ({
@@ -103,42 +147,3 @@ export const AnnuncioDisplay = ({
); }; - -export const BasicAnnuncioCard = ({ - interactions, - className, - data, - confirming, -}: { - interactions?: React.ReactNode; - className?: string; - data: AnnuncioRicerca; - confirming?: boolean; -}) => { - return ( - - - Annuncio {data.codice} - - -
- -
- {interactions} -
-
-
-
- ); -}; diff --git a/apps/infoalloggi/src/components/servizio/main.tsx b/apps/infoalloggi/src/components/servizio/main.tsx index b74aeef..3b07212 100644 --- a/apps/infoalloggi/src/components/servizio/main.tsx +++ b/apps/infoalloggi/src/components/servizio/main.tsx @@ -285,10 +285,7 @@ export const ServizioContent = () => { servizioId={servizio.servizio_id} userId={userId} > - + ); })} diff --git a/apps/infoalloggi/src/components/servizio/servizio_actions.tsx b/apps/infoalloggi/src/components/servizio/servizio_actions.tsx index 9875ffc..6fb8ff0 100644 --- a/apps/infoalloggi/src/components/servizio/servizio_actions.tsx +++ b/apps/infoalloggi/src/components/servizio/servizio_actions.tsx @@ -6,12 +6,14 @@ import { ChevronUp, ClockAlert, Cog, + ExternalLink, Info, Plus, SlidersHorizontal, Trash2, UserCircle, } from "lucide-react"; +import Link from "next/link"; import { useState } from "react"; import toast from "react-hot-toast"; import { @@ -60,6 +62,7 @@ import { cn, formatCurrency } from "~/lib/utils"; import { useServizio } from "~/providers/ServizioProvider"; import type { AnnunciId } from "~/schemas/public/Annunci"; import type { ServizioServizioId } from "~/schemas/public/Servizio"; +import TipologiaPosizioneEnum from "~/schemas/public/TipologiaPosizioneEnum"; import type { UsersId } from "~/schemas/public/Users"; import { api } from "~/utils/api"; import { Confirm } from "../confirm"; @@ -131,9 +134,9 @@ const ServizioInfos = () => { )} - + -
+
@@ -173,7 +176,7 @@ const ServizioBasicActions = ({ className }: { className?: string }) => { if (isAdmin || canUserEdit) { return ( -
+
@@ -234,6 +237,27 @@ export const ServizioPacksInfos = () => { {packs.saldo.message} )}
+ {servizio.tipologia === TipologiaPosizioneEnum.Stabile && ( +
+ <> + Consulenza + + Il prezzo della consulenza varia in base alla tipologia + contrattuale.{" "} + + + + Vedi prezzi contratti + + + + +
+ )}
); @@ -390,7 +414,7 @@ const InterruzioneServizio = () => { servizio.annunci.some((a) => a.user_confirmed_at !== null)) } > - Richiedi Interruzione + Interruzione diff --git a/apps/infoalloggi/src/components/ui/form.tsx b/apps/infoalloggi/src/components/ui/form.tsx deleted file mode 100644 index df791a5..0000000 --- a/apps/infoalloggi/src/components/ui/form.tsx +++ /dev/null @@ -1,169 +0,0 @@ -"use client"; - -import { type Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui"; -import * as React from "react"; - -import { - Controller, - type ControllerProps, - type FieldPath, - type FieldValues, - FormProvider, - useFormContext, - useFormState, -} from "react-hook-form"; -import { Label } from "~/components/ui/label"; -import { cn } from "~/lib/utils"; - -const Form = FormProvider; - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, -> = { - name: TName; -}; - -const FormFieldContext = React.createContext( - {} as FormFieldContextValue, -); - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, ->({ - ...props -}: ControllerProps) => { - return ( - - - - ); -}; - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext); - const itemContext = React.useContext(FormItemContext); - const { getFieldState } = useFormContext(); - const formState = useFormState({ name: fieldContext.name }); - const fieldState = getFieldState(fieldContext.name, formState); - - if (!fieldContext) { - throw new Error("useFormField should be used within "); - } - - const { id } = itemContext; - - return { - formDescriptionId: `${id}-form-item-description`, - formItemId: `${id}-form-item`, - formMessageId: `${id}-form-item-message`, - id, - name: fieldContext.name, - ...fieldState, - }; -}; - -type FormItemContextValue = { - id: string; -}; - -const FormItemContext = React.createContext( - {} as FormItemContextValue, -); - -function FormItem({ className, ...props }: React.ComponentProps<"div">) { - const id = React.useId(); - - return ( - -
- - ); -} - -function FormLabel({ - className, - ...props -}: React.ComponentProps) { - const { error, formItemId } = useFormField(); - - return ( -