import{T as S}from"./Input-b786da58.js";import{T as V}from"./Label-fda955a2.js";import{L as B}from"./LoadingButton-1a262643.js";import{T as C}from"./InputError-8d3cfe49.js";import{T as N}from"./FormSection-07a3c25c.js";import{T as I}from"./ActionMessage-e7228db2.js";import{T as U}from"./SecondaryButton-7ef0b567.js";import{_ as L,r as n,o as f,d as v,e as r,h as a,t as i,c as A,a as l,g as t,m as g,p as P,G as D,w as b,b as w}from"./app-32ed258c.js";import"./SectionTitle-8b846035.js";const E={components:{TecInput:S,TecLabel:V,TecButton:B,TecInputError:C,TecFormSection:N,TecActionMessage:I,TecSecondaryButton:U},props:["user"],data(){return{form:this.$inertia.form({_method:"PUT",name:this.user.name,email:this.user.email,photo:null}),photoPreview:null}},methods:{updateProfileInformation(){this.$refs.photo&&(this.form.photo=this.$refs.photo.files[0]),this.form.post(route("user-profile-information.update"),{errorBag:"updateProfileInformation",preserveScroll:!0})},selectNewPhoto(){this.$refs.photo.click()},updatePhotoPreview(){const e=new FileReader;e.onload=s=>{this.photoPreview=s.target.result},e.readAsDataURL(this.$refs.photo.files[0])},deletePhoto(){this.$inertia.delete(route("current-user-photo.destroy"),{preserveScroll:!0,onSuccess:()=>this.photoPreview=null})}}},F={key:0,class:"col-span-6 sm:col-span-4"},R={class:"mt-2"},j=["src","alt"],z={class:"mt-2"},M={class:"col-span-6 sm:col-span-4"},G={class:"col-span-6 sm:col-span-4"};function q(e,s,u,H,o,m){const p=n("tec-label"),h=n("tec-secondary-button"),d=n("tec-input-error"),_=n("tec-input"),k=n("tec-action-message"),y=n("tec-button"),T=n("tec-form-section");return f(),v(T,{onSubmitted:m.updateProfileInformation},{title:r(()=>[a(i(e.$t("Profile Information")),1)]),description:r(()=>[a(i(e.$t("Update your account's profile information and email address.")),1)]),form:r(()=>[e.$page.props.jetstream.managesProfilePhotos?(f(),A("div",F,[l("input",{type:"file",class:"hidden",ref:"photo",onChange:s[0]||(s[0]=(...c)=>m.updatePhotoPreview&&m.updatePhotoPreview(...c))},null,544),t(p,{for:"photo",value:e.$t("Photo")},null,8,["value"]),g(l("div",R,[l("img",{src:u.user.profile_photo_url,alt:u.user.name,class:"rounded-full h-20 w-20 object-cover"},null,8,j)],512),[[P,!o.photoPreview]]),g(l("div",z,[l("span",{class:"block rounded-full w-20 h-20",style:D("background-size: cover; background-repeat: no-repeat; background-position: center center; background-image: url('"+o.photoPreview+"');")},null,4)],512),[[P,o.photoPreview]]),t(h,{class:"mt-2 mr-2",type:"button",onClick:b(m.selectNewPhoto,["prevent"])},{default:r(()=>[a(i(e.$t("Select A New Photo")),1)]),_:1},8,["onClick"]),u.user.profile_photo_path?(f(),v(h,{key:0,type:"button",class:"mt-2",onClick:b(m.deletePhoto,["prevent"])},{default:r(()=>[a(i(e.$t("Remove Photo")),1)]),_:1},8,["onClick"])):w("",!0),t(d,{message:o.form.errors.photo,class:"mt-2"},null,8,["message"])])):w("",!0),l("div",M,[t(p,{for:"name",value:e.$t("Name")},null,8,["value"]),t(_,{id:"name",type:"text",class:"mt-1 block w-full",modelValue:o.form.name,"onUpdate:modelValue":s[1]||(s[1]=c=>o.form.name=c),autocomplete:"name"},null,8,["modelValue"]),t(d,{message:o.form.errors.name,class:"mt-2"},null,8,["message"])]),l("div",G,[t(p,{for:"email",value:e.$t("Email")},null,8,["value"]),t(_,{id:"email",type:"email",class:"mt-1 block w-full",modelValue:o.form.email,"onUpdate:modelValue":s[2]||(s[2]=c=>o.form.email=c)},null,8,["modelValue"]),t(d,{message:o.form.errors.email,class:"mt-2"},null,8,["message"])])]),actions:r(()=>[t(k,{on:o.form.recentlySuccessful,class:"mr-3"},{default:r(()=>[a(i(e.$t("Saved.")),1)]),_:1},8,["on"]),t(y,{loading:o.form.processing,disabled:o.form.processing},{default:r(()=>[a(i(e.$t("Save")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["onSubmitted"])}const x=L(E,[["render",q]]);export{x as default};
