import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Transition as v}from"@headlessui/react";import{usePage as N,useForm as P,Head as y}from"@inertiajs/react";import{useState as w,useEffect as S}from"react";import{User as C}from"lucide-react";import{A as F,S as j,H as L}from"./layout-DaDw2XWr.js";import{I as l}from"./input-error-DvUE3Y6M.js";import{B as I}from"./button-BvFBRYHq.js";import{I as s}from"./input-qMvM9qch.js";import{L as n}from"./label-DMnntKPk.js";import"./app-sidebar-header-BX2s-HO_.js";import"@radix-ui/react-collapsible";import"./dropdown-menu-BP80qPHw.js";import"@radix-ui/react-dropdown-menu";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";import"./app-logo-icon-beRg1XGs.js";import"./fonts-CqawFh47.js";import"@radix-ui/react-slot";import"class-variance-authority";import"@radix-ui/react-dialog";import"@radix-ui/react-tooltip";import"@radix-ui/react-avatar";import"../app.js";/* empty css     */import"axios";import"sonner";import"react-dom/client";import"./main-CWwoxgdq.js";import"./toaster-DuLpwsc2.js";import"./separator-BDLxzoJ8.js";import"@radix-ui/react-separator";import"@radix-ui/react-label";const B=[{title:"Profile settings",href:"/dashboard/settings/profile"}];function fe({mustVerifyEmail:D,status:E,phone:d,photoUrl:i}){const{auth:h}=N().props,{data:c,setData:a,post:f,errors:m,processing:g,recentlySuccessful:b}=P({truename:h.user.truename??"",mobilenumber:d||"",photo:null}),[u,p]=w(i||null);return S(()=>{p(i||null)},[i]),t(F,{breadcrumbs:B,children:[e(y,{title:"Profile settings"}),e(j,{children:t("div",{className:"space-y-6",children:[e(L,{title:"Profile information",description:"Update your profile photo, name and phone number"}),t("form",{onSubmit:r=>{r.preventDefault(),f(route("profile.update"),{forceFormData:!0,preserveScroll:!0,onSuccess:()=>{a("photo",null)}})},className:"space-y-6",children:[t("div",{className:"grid gap-2",children:[e(n,{children:"Profile Photo"}),t("div",{className:"flex items-start gap-4",children:[e("div",{className:"relative h-24 w-24 overflow-hidden rounded-full border-2 border-border bg-muted",children:u?e("img",{src:u,alt:"Profile",className:"h-full w-full object-cover"}):e("div",{className:"flex h-full w-full items-center justify-center",children:e(C,{className:"h-12 w-12 text-muted-foreground"})})}),t("div",{className:"flex-1 space-y-2",children:[e(s,{id:"photo",type:"file",accept:"image/*",onChange:r=>{const o=r.target.files?.[0];if(o){a("photo",o);const x=URL.createObjectURL(o);p(x)}},className:"cursor-pointer"}),e(l,{message:m.photo}),e("p",{className:"text-xs text-muted-foreground",children:"JPG, PNG or GIF. Max size 2MB."})]})]})]}),t("div",{className:"grid gap-2",children:[e(n,{htmlFor:"truename",children:"Name"}),e(s,{id:"truename",className:"mt-1 block w-full",value:c.truename,onChange:r=>a("truename",r.target.value),required:!0,autoComplete:"name",placeholder:"Full name"}),e(l,{className:"mt-2",message:m.truename})]}),t("div",{className:"grid gap-2",children:[e(n,{htmlFor:"mobilenumber",children:"Phone Number"}),e(s,{id:"mobilenumber",type:"tel",className:"mt-1 block w-full",value:c.mobilenumber,onChange:r=>{const o=r.target.value.replace(/[^0-9]/g,"");a("mobilenumber",o)},autoComplete:"tel",placeholder:"08xxxxxxxxxx",inputMode:"numeric",pattern:"[0-9]*"}),e(l,{className:"mt-2",message:m.mobilenumber}),e("p",{className:"text-sm text-muted-foreground",children:"Phone number is required for payment transactions."})]}),t("div",{className:"flex items-center gap-4",children:[e(I,{disabled:g,children:"Save Changes"}),e(v,{show:b,enter:"transition ease-in-out",enterFrom:"opacity-0",leave:"transition ease-in-out",leaveTo:"opacity-0",children:e("p",{className:"text-sm text-neutral-600",children:"Saved"})})]})]})]})})]})}export{fe as default};
