bettertend/frontend/dist/assets/ProfileView-B9z7U8vB.js

2 lines
13 KiB
JavaScript

import{F as te,a as ae}from"./FPPageHeader-CFIwZZgQ.js";import{_ as le,r as c,c as oe,o as se,i as g,w as i,g as d,b as a,d as s,e as o,aS as ne,F as w,k as v,t as m,a as b,af as N,aR as A,aX as D,j as F}from"./index-QAlcqU00.js";import{F as u}from"./FPInput-D5RURom0.js";import{F as h}from"./FPCard-AB6NRXg5.js";import{F as V}from"./FPCheckbox-DcRYwN3n.js";import{F as k}from"./FPSelect-j7n_x8eB.js";import{F as re}from"./FPModal-DMoPysvU.js";import{F as ie}from"./FPBadge-DvOitM1C.js";const de={class:"p-6"},ue={class:"max-w-4xl mx-auto space-y-8"},me={class:"flex items-start space-x-6"},ce={class:"flex flex-col items-center space-y-4"},pe={class:"flex-1 space-y-6"},ve={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},fe={class:"space-y-6"},ge={class:"p-4 border border-gray-200 rounded"},we={class:"flex items-center justify-between"},ye={class:"p-4 border border-gray-200 rounded"},xe={class:"flex items-center justify-between"},be={class:"text-sm text-gray-600"},he={class:"p-4 border border-gray-200 rounded"},Ve={class:"flex items-center justify-between mb-4"},ke={class:"text-sm text-gray-600"},Ce={class:"space-y-3"},_e={class:"flex items-center space-x-3"},Fe={class:"w-8 h-8 rounded bg-gray-100 flex items-center justify-center"},Me={class:"text-sm font-medium text-gray-900"},Pe={class:"text-xs text-gray-600"},Ye={class:"flex items-center space-x-2"},Ne={class:"space-y-6"},Ae={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},De={class:"space-y-4"},Te={class:"space-y-3"},Ue={class:"space-y-4"},Ee={class:"w-8 h-8 rounded-full bg-primary-100 flex items-center justify-center mt-1"},Se={class:"flex-1"},je={class:"text-sm text-gray-900"},ze={class:"text-xs text-gray-600 mt-1"},Ie={class:"space-y-4"},Be={__name:"ProfileView",setup(Le){const C=c(!1),y=c(!1),x=c(!1),l=c({firstName:"John",lastName:"Smith",email:"john.smith@facilityplus.com",phone:"(555) 123-4567",jobTitle:"Facility Manager",department:"Operations",bio:"Experienced facility manager with 10+ years in maintenance operations.",twoFactorEnabled:!1,preferences:{language:"en",timezone:"America/New_York",dateFormat:"MM/DD/YYYY",theme:"light",emailNotifications:!0,pushNotifications:!1,weeklyReports:!0,maintenanceReminders:!0}}),M=c({...l.value}),p=c({current:"",new:"",confirm:""}),f=c([{id:1,device:"Chrome on MacOS",location:"New York, NY",lastActive:"2024-01-20T10:00:00Z",current:!0},{id:2,device:"Safari on iPhone",location:"New York, NY",lastActive:"2024-01-19T15:30:00Z",current:!1},{id:3,device:"Firefox on Windows",location:"New York, NY",lastActive:"2024-01-18T09:00:00Z",current:!1}]),T=c([{id:1,type:"login",description:"Signed in from Chrome on MacOS",timestamp:"2024-01-20T10:00:00Z"},{id:2,type:"profile",description:"Updated profile information",timestamp:"2024-01-19T14:30:00Z"},{id:3,type:"password",description:"Changed account password",timestamp:"2024-01-15T11:00:00Z"},{id:4,type:"workorder",description:"Created work order WO-12345",timestamp:"2024-01-14T16:45:00Z"}]),U=[{title:"English",value:"en"},{title:"Spanish",value:"es"},{title:"French",value:"fr"}],E=[{title:"Eastern Time (ET)",value:"America/New_York"},{title:"Central Time (CT)",value:"America/Chicago"},{title:"Mountain Time (MT)",value:"America/Denver"},{title:"Pacific Time (PT)",value:"America/Los_Angeles"}],S=[{title:"MM/DD/YYYY",value:"MM/DD/YYYY"},{title:"DD/MM/YYYY",value:"DD/MM/YYYY"},{title:"YYYY-MM-DD",value:"YYYY-MM-DD"}],j=[{title:"Light",value:"light"},{title:"Dark",value:"dark"},{title:"Auto",value:"auto"}],z={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /></svg>'},I={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z" /></svg>'},B={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1" /></svg>'},P={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /></svg>'},L={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" /></svg>'},R={template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" /></svg>'};oe(()=>{var t,_;const n=((t=l.value.firstName)==null?void 0:t[0])||"",e=((_=l.value.lastName)==null?void 0:_[0])||"";return(n+e).toUpperCase()});const r=()=>{y.value=!0},O=async()=>{C.value=!0,setTimeout(()=>{C.value=!1,y.value=!1,M.value={...l.value},console.log("Profile saved:",l.value)},1e3)},H=()=>{l.value={...M.value},y.value=!1},Z=({file:n,url:e})=>{console.log("Avatar uploaded:",n.name,e),l.value.avatar=e,r()},q=n=>{console.error("Avatar upload failed:",n)},W=()=>{l.value.twoFactorEnabled=!l.value.twoFactorEnabled,r()},J=n=>{const e=f.value.findIndex(t=>t.id===n);e>-1&&f.value.splice(e,1)},$=()=>{f.value=f.value.filter(n=>n.current)},Y=()=>{x.value=!1,p.value={current:"",new:"",confirm:""}},X=()=>{console.log("Changing password..."),Y()},G=n=>n.includes("iPhone")||n.includes("Android")?I:z,K=n=>({login:B,profile:P,password:L,workorder:R})[n]||P,Q=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ee=n=>new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"});return se(()=>{}),(n,e)=>(d(),g(te,null,{header:i(()=>[s(ae,{title:"Profile",description:"Manage your personal account settings and preferences",breadcrumbs:[{text:"Profile",to:null}]},{actions:i(()=>[y.value?(d(),g(o(w),{key:0,variant:"outline",size:"sm",onClick:H},{default:i(()=>e[20]||(e[20]=[v(" Cancel ",-1)])),_:1,__:[20]})):F("",!0),y.value?(d(),g(o(w),{key:1,variant:"primary",size:"sm",onClick:O,loading:C.value},{default:i(()=>e[21]||(e[21]=[v(" Save Changes ",-1)])),_:1,__:[21]},8,["loading"])):F("",!0)]),_:1})]),default:i(()=>[a("div",de,[a("div",ue,[s(o(h),{padding:"lg"},{default:i(()=>[a("div",me,[a("div",ce,[s(o(ne),{user:l.value,size:"2xl",editable:!0,onUpload:Z,onError:q},null,8,["user"]),e[22]||(e[22]=a("p",{class:"text-xs text-gray-500 text-center max-w-32"}," Click to upload a new photo or we'll use a random one from Pexels ",-1))]),a("div",pe,[a("div",ve,[s(o(u),{modelValue:l.value.firstName,"onUpdate:modelValue":e[0]||(e[0]=t=>l.value.firstName=t),label:"First Name",placeholder:"Enter first name",required:"",onInput:r},null,8,["modelValue"]),s(o(u),{modelValue:l.value.lastName,"onUpdate:modelValue":e[1]||(e[1]=t=>l.value.lastName=t),label:"Last Name",placeholder:"Enter last name",required:"",onInput:r},null,8,["modelValue"]),s(o(u),{modelValue:l.value.email,"onUpdate:modelValue":e[2]||(e[2]=t=>l.value.email=t),label:"Email Address",type:"email",placeholder:"Enter email",required:"",onInput:r},null,8,["modelValue"]),s(o(u),{modelValue:l.value.phone,"onUpdate:modelValue":e[3]||(e[3]=t=>l.value.phone=t),label:"Phone Number",type:"tel",placeholder:"(555) 123-4567",onInput:r},null,8,["modelValue"]),s(o(u),{modelValue:l.value.jobTitle,"onUpdate:modelValue":e[4]||(e[4]=t=>l.value.jobTitle=t),label:"Job Title",placeholder:"Enter job title",onInput:r},null,8,["modelValue"]),s(o(u),{modelValue:l.value.department,"onUpdate:modelValue":e[5]||(e[5]=t=>l.value.department=t),label:"Department",placeholder:"Enter department",onInput:r},null,8,["modelValue"])]),s(o(u),{modelValue:l.value.bio,"onUpdate:modelValue":e[6]||(e[6]=t=>l.value.bio=t),label:"Bio",placeholder:"Tell us about yourself",type:"textarea",onInput:r},null,8,["modelValue"])])])]),_:1}),s(o(h),{padding:"lg"},{default:i(()=>[e[29]||(e[29]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Account Security",-1)),a("div",fe,[a("div",ge,[a("div",we,[e[24]||(e[24]=a("div",null,[a("h4",{class:"font-medium text-gray-900"},"Password"),a("p",{class:"text-sm text-gray-600"},"Last changed 30 days ago")],-1)),s(o(w),{variant:"outline",size:"sm",onClick:e[7]||(e[7]=t=>x.value=!0)},{default:i(()=>e[23]||(e[23]=[v(" Change Password ",-1)])),_:1,__:[23]})])]),a("div",ye,[a("div",xe,[a("div",null,[e[25]||(e[25]=a("h4",{class:"font-medium text-gray-900"},"Two-Factor Authentication",-1)),a("p",be,m(l.value.twoFactorEnabled?"Enabled":"Add an extra layer of security"),1)]),s(o(w),{variant:l.value.twoFactorEnabled?"outline":"primary",size:"sm",onClick:W},{default:i(()=>[v(m(l.value.twoFactorEnabled?"Disable":"Enable"),1)]),_:1},8,["variant"])])]),a("div",he,[a("div",Ve,[a("div",null,[e[26]||(e[26]=a("h4",{class:"font-medium text-gray-900"},"Active Sessions",-1)),a("p",ke,m(f.value.length)+" active sessions",1)]),s(o(w),{variant:"outline",size:"sm",onClick:$},{default:i(()=>e[27]||(e[27]=[v(" Revoke All ",-1)])),_:1,__:[27]})]),a("div",Ce,[(d(!0),b(N,null,A(f.value,t=>(d(),b("div",{key:t.id,class:"flex items-center justify-between py-2"},[a("div",_e,[a("div",Fe,[(d(),g(D(G(t.device)),{class:"w-4 h-4 text-gray-600"}))]),a("div",null,[a("div",Me,m(t.device),1),a("div",Pe,m(t.location)+" • "+m(Q(t.lastActive)),1)])]),a("div",Ye,[s(o(ie),{variant:t.current?"success":"secondary",size:"sm"},{default:i(()=>[v(m(t.current?"Current":"Active"),1)]),_:2},1032,["variant"]),t.current?F("",!0):(d(),g(o(w),{key:0,variant:"ghost",size:"sm",onClick:_=>J(t.id)},{default:i(()=>e[28]||(e[28]=[v(" Revoke ",-1)])),_:2,__:[28]},1032,["onClick"]))])]))),128))])])])]),_:1,__:[29]}),s(o(h),{padding:"lg"},{default:i(()=>[e[31]||(e[31]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Preferences",-1)),a("div",Ne,[a("div",Ae,[s(o(k),{modelValue:l.value.preferences.language,"onUpdate:modelValue":[e[8]||(e[8]=t=>l.value.preferences.language=t),r],label:"Language",options:U},null,8,["modelValue"]),s(o(k),{modelValue:l.value.preferences.timezone,"onUpdate:modelValue":[e[9]||(e[9]=t=>l.value.preferences.timezone=t),r],label:"Timezone",options:E},null,8,["modelValue"]),s(o(k),{modelValue:l.value.preferences.dateFormat,"onUpdate:modelValue":[e[10]||(e[10]=t=>l.value.preferences.dateFormat=t),r],label:"Date Format",options:S},null,8,["modelValue"]),s(o(k),{modelValue:l.value.preferences.theme,"onUpdate:modelValue":[e[11]||(e[11]=t=>l.value.preferences.theme=t),r],label:"Theme",options:j},null,8,["modelValue"])]),a("div",De,[e[30]||(e[30]=a("h4",{class:"font-medium text-gray-900"},"Notifications",-1)),a("div",Te,[s(o(V),{modelValue:l.value.preferences.emailNotifications,"onUpdate:modelValue":[e[12]||(e[12]=t=>l.value.preferences.emailNotifications=t),r],label:"Email notifications for work order updates"},null,8,["modelValue"]),s(o(V),{modelValue:l.value.preferences.pushNotifications,"onUpdate:modelValue":[e[13]||(e[13]=t=>l.value.preferences.pushNotifications=t),r],label:"Browser push notifications"},null,8,["modelValue"]),s(o(V),{modelValue:l.value.preferences.weeklyReports,"onUpdate:modelValue":[e[14]||(e[14]=t=>l.value.preferences.weeklyReports=t),r],label:"Weekly summary reports"},null,8,["modelValue"]),s(o(V),{modelValue:l.value.preferences.maintenanceReminders,"onUpdate:modelValue":[e[15]||(e[15]=t=>l.value.preferences.maintenanceReminders=t),r],label:"Maintenance reminders"},null,8,["modelValue"])])])])]),_:1,__:[31]}),s(o(h),{padding:"lg"},{default:i(()=>[e[32]||(e[32]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Recent Activity",-1)),a("div",Ue,[(d(!0),b(N,null,A(T.value,t=>(d(),b("div",{key:t.id,class:"flex items-start space-x-3 py-3 border-b border-gray-100 last:border-b-0"},[a("div",Ee,[(d(),g(D(K(t.type)),{class:"w-4 h-4 text-primary-600"}))]),a("div",Se,[a("p",je,m(t.description),1),a("p",ze,m(ee(t.timestamp)),1)])]))),128))])]),_:1,__:[32]})])]),s(o(re),{modelValue:x.value,"onUpdate:modelValue":e[19]||(e[19]=t=>x.value=t),title:"Change Password",onConfirm:X,onCancel:Y},{default:i(()=>[a("div",Ie,[s(o(u),{modelValue:p.value.current,"onUpdate:modelValue":e[16]||(e[16]=t=>p.value.current=t),label:"Current Password",type:"password",placeholder:"Enter current password",required:""},null,8,["modelValue"]),s(o(u),{modelValue:p.value.new,"onUpdate:modelValue":e[17]||(e[17]=t=>p.value.new=t),label:"New Password",type:"password",placeholder:"Enter new password",required:""},null,8,["modelValue"]),s(o(u),{modelValue:p.value.confirm,"onUpdate:modelValue":e[18]||(e[18]=t=>p.value.confirm=t),label:"Confirm New Password",type:"password",placeholder:"Confirm new password",required:""},null,8,["modelValue"])])]),_:1},8,["modelValue"])]),_:1}))}},Xe=le(Be,[["__scopeId","data-v-b3be30e1"]]);export{Xe as default};