3 lines
16 KiB
JavaScript
3 lines
16 KiB
JavaScript
import{F as re,a as de}from"./FPPageHeader-CFIwZZgQ.js";import{_ as ue,r as p,o as me,i as M,w as n,g as d,b as a,d as t,e as o,a as c,j as V,F as g,k as r,t as u,af as x,aR as C,aX as pe,n as ce}from"./index-QAlcqU00.js";import{F as m}from"./FPInput-D5RURom0.js";import{F as f}from"./FPCard-AB6NRXg5.js";import{F as w}from"./FPCheckbox-DcRYwN3n.js";import{F as b}from"./FPSelect-j7n_x8eB.js";import{F as ge}from"./FPTable-CWvngIYd.js";import{F as ve}from"./FPModal-DMoPysvU.js";import{F as U}from"./FPBadge-DvOitM1C.js";import{F as fe}from"./FPTabs-qq-Tmb7J.js";const ye={class:"p-6"},ke={key:0,class:"space-y-8"},be={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},_e={class:"md:col-span-2"},Ve={class:"space-y-6"},xe={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Ce={class:"space-y-4"},we={key:1,class:"space-y-8"},Ue={class:"flex items-center justify-between mb-6"},Ne={class:"flex items-center"},Me={class:"w-8 h-8 rounded-full bg-primary-100 flex items-center justify-center mr-3"},De={class:"text-primary-600 font-medium text-sm"},Ae={class:"font-medium text-gray-900"},Fe={class:"text-sm text-gray-600"},Ee={class:"flex items-center space-x-2"},Te={class:"space-y-6"},Pe={class:"flex items-center justify-between mb-4"},he={class:"font-medium text-gray-900"},Ye={class:"grid grid-cols-2 md:grid-cols-3 gap-3"},Re={key:2,class:"space-y-8"},Ie={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Se={class:"md:col-span-2"},Le={class:"mt-6"},Oe={class:"space-y-6"},Be={class:"flex items-center"},ze={class:"w-10 h-10 rounded bg-gray-100 flex items-center justify-center mr-4"},je={class:"font-medium text-gray-900"},We={class:"text-sm text-gray-600"},qe={class:"flex items-center space-x-3"},He={key:3,class:"space-y-8"},Ge={class:"space-y-6"},Ze={class:"flex items-center justify-between p-4 border border-gray-200 rounded"},Je={class:"flex items-center justify-between p-4 border border-gray-200 rounded"},$e={class:"space-y-4"},Xe={class:"flex items-center justify-between"},Ke={class:"flex items-center space-x-4"},Qe={class:"bg-gray-50 rounded p-4 h-64 overflow-y-auto"},el={class:"text-gray-500"},ll={class:"ml-2 text-gray-900"},al={class:"space-y-4"},tl={__name:"SettingsView",setup(ol){const N=p(!1),y=p("general"),_=p(!1),D=p("all"),s=p({general:{companyName:"Facility Plus Corp",contactEmail:"admin@facilityplus.com",phone:"(555) 123-4567",timezone:"America/New_York",address:`123 Business Ave
|
|
New York, NY 10001`,defaultLanguage:"en",dateFormat:"MM/DD/YYYY",currency:"USD",workOrderPrefix:"WO-",enableNotifications:!0,enableAutoBackup:!0,requireApproval:!1},email:{smtpHost:"smtp.gmail.com",smtpPort:587,username:"",password:"",fromEmail:"noreply@facilityplus.com"}}),v=p({email:"",firstName:"",lastName:"",role:""}),A=p([{id:1,name:"John Smith",email:"john@facilityplus.com",role:"ADMIN",active:!0,lastLogin:"2024-01-20T10:00:00Z"},{id:2,name:"Sarah Johnson",email:"sarah@facilityplus.com",role:"MANAGER",active:!0,lastLogin:"2024-01-19T15:30:00Z"},{id:3,name:"Mike Wilson",email:"mike@facilityplus.com",role:"TECHNICIAN",active:!1,lastLogin:"2024-01-15T09:00:00Z"}]),E=p([{id:1,name:"Administrator",userCount:1,permissions:["read_all","write_all","delete_all","manage_users"]},{id:2,name:"Manager",userCount:2,permissions:["read_all","write_workorders","manage_assets"]},{id:3,name:"Technician",userCount:5,permissions:["read_workorders","update_workorders"]}]),T=p([{key:"read_all",name:"View All Data"},{key:"write_all",name:"Edit All Data"},{key:"delete_all",name:"Delete Data"},{key:"manage_users",name:"Manage Users"},{key:"read_workorders",name:"View Work Orders"},{key:"write_workorders",name:"Edit Work Orders"},{key:"manage_assets",name:"Manage Assets"},{key:"update_workorders",name:"Update Work Orders"}]),P=p([{id:1,timestamp:"2024-01-20T10:00:00Z",level:"INFO",message:"User john@facilityplus.com logged in"},{id:2,timestamp:"2024-01-20T09:45:00Z",level:"WARN",message:"Work order WO-123 is overdue"},{id:3,timestamp:"2024-01-20T09:30:00Z",level:"ERROR",message:"Failed to send notification email"}]),h=p([{key:"slack",name:"Slack",description:"Send notifications to Slack channels",connected:!0,icon:{template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" /></svg>'}},{key:"teams",name:"Microsoft Teams",description:"Send notifications to Teams channels",connected:!1,icon:{template:'<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2v4l.586-.586z" /></svg>'}}]),Y=[{key:"general",label:"General"},{key:"users",label:"Users & Permissions"},{key:"integrations",label:"Integrations"},{key:"maintenance",label:"Maintenance"}],R=[{key:"name",label:"User"},{key:"role",label:"Role"},{key:"status",label:"Status"},{key:"lastLogin",label:"Last Login"}],I=[{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:"English",value:"en"},{title:"Spanish",value:"es"},{title:"French",value:"fr"}],L=[{title:"MM/DD/YYYY",value:"MM/DD/YYYY"},{title:"DD/MM/YYYY",value:"DD/MM/YYYY"},{title:"YYYY-MM-DD",value:"YYYY-MM-DD"}],O=[{title:"US Dollar (USD)",value:"USD"},{title:"Euro (EUR)",value:"EUR"},{title:"British Pound (GBP)",value:"GBP"}],B=[{title:"Administrator",value:"ADMIN"},{title:"Manager",value:"MANAGER"},{title:"Technician",value:"TECHNICIAN"}],z=[{title:"All Logs",value:"all"},{title:"Errors Only",value:"error"},{title:"Warnings",value:"warn"},{title:"Info",value:"info"}],j=async()=>{N.value=!0,setTimeout(()=>{N.value=!1,console.log("Settings saved:",s.value)},1e3)},W=()=>{console.log("Resetting to defaults...")},q=i=>{y.value=i},H=()=>{v.value={email:"",firstName:"",lastName:"",role:""},_.value=!0},F=()=>{_.value=!1},G=()=>{console.log("Inviting user:",v.value),F()},Z=i=>{console.log("Editing user:",i)},J=i=>{const e=A.value.find(l=>l.id===i);e&&(e.active=!e.active)},$=()=>{console.log("Testing email settings...")},X=i=>{console.log("Configuring integration:",i)},K=()=>{console.log("Creating backup...")},Q=()=>{console.log("Restoring data...")},ee=()=>{console.log("Refreshing logs...")},le=()=>{console.log("Downloading logs...")},ae=i=>i.split(" ").map(e=>e[0]).join("").toUpperCase(),te=i=>({ADMIN:"error",MANAGER:"warning",TECHNICIAN:"info"})[i]||"secondary",oe=i=>i.toLowerCase().replace(/\b\w/g,e=>e.toUpperCase()),se=i=>new Date(i).toLocaleString(),ne=i=>({ERROR:"text-red-600",WARN:"text-yellow-600",INFO:"text-blue-600"})[i]||"text-gray-600";return me(()=>{}),(i,e)=>(d(),M(re,null,{header:n(()=>[t(de,{title:"Settings",description:"Manage application settings and preferences",breadcrumbs:[{text:"Settings",to:null}]},{actions:n(()=>[t(o(g),{variant:"outline",size:"sm",onClick:W},{default:n(()=>e[24]||(e[24]=[r(" Reset to Defaults ",-1)])),_:1,__:[24]}),t(o(g),{variant:"primary",size:"sm",onClick:j,loading:N.value},{default:n(()=>e[25]||(e[25]=[r(" Save Changes ",-1)])),_:1,__:[25]},8,["loading"])]),_:1})]),default:n(()=>[a("div",ye,[t(o(fe),{modelValue:y.value,"onUpdate:modelValue":e[18]||(e[18]=l=>y.value=l),tabs:Y,onTabChange:q},{default:n(()=>[y.value==="general"?(d(),c("div",ke,[t(o(f),{padding:"lg"},{default:n(()=>[e[26]||(e[26]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Company Information",-1)),a("div",be,[t(o(m),{modelValue:s.value.general.companyName,"onUpdate:modelValue":e[0]||(e[0]=l=>s.value.general.companyName=l),label:"Company Name",placeholder:"Enter company name",required:""},null,8,["modelValue"]),t(o(m),{modelValue:s.value.general.contactEmail,"onUpdate:modelValue":e[1]||(e[1]=l=>s.value.general.contactEmail=l),label:"Contact Email",type:"email",placeholder:"contact@company.com",required:""},null,8,["modelValue"]),t(o(m),{modelValue:s.value.general.phone,"onUpdate:modelValue":e[2]||(e[2]=l=>s.value.general.phone=l),label:"Phone Number",type:"tel",placeholder:"(555) 123-4567"},null,8,["modelValue"]),t(o(b),{modelValue:s.value.general.timezone,"onUpdate:modelValue":e[3]||(e[3]=l=>s.value.general.timezone=l),label:"Timezone",options:I,required:""},null,8,["modelValue"]),a("div",_e,[t(o(m),{modelValue:s.value.general.address,"onUpdate:modelValue":e[4]||(e[4]=l=>s.value.general.address=l),label:"Address",placeholder:"Enter company address",type:"textarea"},null,8,["modelValue"])])])]),_:1,__:[26]}),t(o(f),{padding:"lg"},{default:n(()=>[e[27]||(e[27]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Application Preferences",-1)),a("div",Ve,[a("div",xe,[t(o(b),{modelValue:s.value.general.defaultLanguage,"onUpdate:modelValue":e[5]||(e[5]=l=>s.value.general.defaultLanguage=l),label:"Default Language",options:S},null,8,["modelValue"]),t(o(b),{modelValue:s.value.general.dateFormat,"onUpdate:modelValue":e[6]||(e[6]=l=>s.value.general.dateFormat=l),label:"Date Format",options:L},null,8,["modelValue"]),t(o(b),{modelValue:s.value.general.currency,"onUpdate:modelValue":e[7]||(e[7]=l=>s.value.general.currency=l),label:"Currency",options:O},null,8,["modelValue"]),t(o(m),{modelValue:s.value.general.workOrderPrefix,"onUpdate:modelValue":e[8]||(e[8]=l=>s.value.general.workOrderPrefix=l),label:"Work Order Prefix",placeholder:"WO-"},null,8,["modelValue"])]),a("div",Ce,[t(o(w),{modelValue:s.value.general.enableNotifications,"onUpdate:modelValue":e[9]||(e[9]=l=>s.value.general.enableNotifications=l),label:"Enable email notifications"},null,8,["modelValue"]),t(o(w),{modelValue:s.value.general.enableAutoBackup,"onUpdate:modelValue":e[10]||(e[10]=l=>s.value.general.enableAutoBackup=l),label:"Enable automatic data backup"},null,8,["modelValue"]),t(o(w),{modelValue:s.value.general.requireApproval,"onUpdate:modelValue":e[11]||(e[11]=l=>s.value.general.requireApproval=l),label:"Require approval for work orders"},null,8,["modelValue"])])])]),_:1,__:[27]})])):V("",!0),y.value==="users"?(d(),c("div",we,[t(o(f),{padding:"lg"},{default:n(()=>[a("div",Ue,[e[29]||(e[29]=a("h3",{class:"text-lg font-semibold text-gray-900"},"User Management",-1)),t(o(g),{variant:"primary",size:"sm",onClick:H},{default:n(()=>e[28]||(e[28]=[a("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),r(" Invite User ",-1)])),_:1,__:[28]})]),t(o(ge),{columns:R,data:A.value,loading:!1,"empty-message":"No users found"},{"column-name":n(({row:l})=>[a("div",Ne,[a("div",Me,[a("span",De,u(ae(l.name)),1)]),a("div",null,[a("div",Ae,u(l.name),1),a("div",Fe,u(l.email),1)])])]),"column-role":n(({row:l})=>[t(o(U),{variant:te(l.role)},{default:n(()=>[r(u(oe(l.role)),1)]),_:2},1032,["variant"])]),"column-status":n(({row:l})=>[t(o(U),{variant:l.active?"success":"secondary"},{default:n(()=>[r(u(l.active?"Active":"Inactive"),1)]),_:2},1032,["variant"])]),"row-actions":n(({row:l})=>[a("div",Ee,[t(o(g),{variant:"ghost",size:"sm",onClick:k=>Z(l.id)},{default:n(()=>e[30]||(e[30]=[r(" Edit ",-1)])),_:2,__:[30]},1032,["onClick"]),t(o(g),{variant:"ghost",size:"sm",onClick:k=>J(l.id)},{default:n(()=>[r(u(l.active?"Deactivate":"Activate"),1)]),_:2},1032,["onClick"])])]),_:1},8,["data"])]),_:1}),t(o(f),{padding:"lg"},{default:n(()=>[e[31]||(e[31]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Role Permissions",-1)),a("div",Te,[(d(!0),c(x,null,C(E.value,l=>(d(),c("div",{key:l.id,class:"border border-gray-200 rounded p-4"},[a("div",Pe,[a("h4",he,u(l.name),1),t(o(U),{variant:"secondary"},{default:n(()=>[r(u(l.userCount)+" users",1)]),_:2},1024)]),a("div",Ye,[(d(!0),c(x,null,C(T.value,k=>(d(),M(o(w),{key:k.key,modelValue:l.permissions,"onUpdate:modelValue":ie=>l.permissions=ie,value:k.key,label:k.name},null,8,["modelValue","onUpdate:modelValue","value","label"]))),128))])]))),128))])]),_:1,__:[31]})])):V("",!0),y.value==="integrations"?(d(),c("div",Re,[t(o(f),{padding:"lg"},{default:n(()=>[e[33]||(e[33]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Email Configuration",-1)),a("div",Ie,[t(o(m),{modelValue:s.value.email.smtpHost,"onUpdate:modelValue":e[12]||(e[12]=l=>s.value.email.smtpHost=l),label:"SMTP Host",placeholder:"smtp.gmail.com"},null,8,["modelValue"]),t(o(m),{modelValue:s.value.email.smtpPort,"onUpdate:modelValue":e[13]||(e[13]=l=>s.value.email.smtpPort=l),label:"SMTP Port",type:"number",placeholder:"587"},null,8,["modelValue"]),t(o(m),{modelValue:s.value.email.username,"onUpdate:modelValue":e[14]||(e[14]=l=>s.value.email.username=l),label:"Username",placeholder:"your-email@gmail.com"},null,8,["modelValue"]),t(o(m),{modelValue:s.value.email.password,"onUpdate:modelValue":e[15]||(e[15]=l=>s.value.email.password=l),label:"Password",type:"password",placeholder:"App password"},null,8,["modelValue"]),a("div",Se,[t(o(m),{modelValue:s.value.email.fromEmail,"onUpdate:modelValue":e[16]||(e[16]=l=>s.value.email.fromEmail=l),label:"From Email",type:"email",placeholder:"noreply@company.com"},null,8,["modelValue"])])]),a("div",Le,[t(o(g),{variant:"outline",size:"sm",onClick:$},{default:n(()=>e[32]||(e[32]=[r(" Test Email Configuration ",-1)])),_:1,__:[32]})])]),_:1,__:[33]}),t(o(f),{padding:"lg"},{default:n(()=>[e[35]||(e[35]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"API Integrations",-1)),a("div",Oe,[(d(!0),c(x,null,C(h.value,l=>(d(),c("div",{key:l.key,class:"flex items-center justify-between p-4 border border-gray-200 rounded"},[a("div",Be,[a("div",ze,[(d(),M(pe(l.icon),{class:"w-5 h-5 text-gray-600"}))]),a("div",null,[a("h4",je,u(l.name),1),a("p",We,u(l.description),1)])]),a("div",qe,[t(o(U),{variant:l.connected?"success":"secondary"},{default:n(()=>[r(u(l.connected?"Connected":"Not Connected"),1)]),_:2},1032,["variant"]),t(o(g),{variant:"outline",size:"sm",onClick:k=>X(l.key)},{default:n(()=>e[34]||(e[34]=[r(" Configure ",-1)])),_:2,__:[34]},1032,["onClick"])])]))),128))])]),_:1,__:[35]})])):V("",!0),y.value==="maintenance"?(d(),c("div",He,[t(o(f),{padding:"lg"},{default:n(()=>[e[40]||(e[40]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"Backup & Restore",-1)),a("div",Ge,[a("div",Ze,[e[37]||(e[37]=a("div",null,[a("h4",{class:"font-medium text-gray-900"},"Create Backup"),a("p",{class:"text-sm text-gray-600"},"Download a complete backup of your data")],-1)),t(o(g),{variant:"primary",size:"sm",onClick:K},{default:n(()=>e[36]||(e[36]=[r(" Create Backup ",-1)])),_:1,__:[36]})]),a("div",Je,[e[39]||(e[39]=a("div",null,[a("h4",{class:"font-medium text-gray-900"},"Restore Data"),a("p",{class:"text-sm text-gray-600"},"Restore data from a previous backup")],-1)),t(o(g),{variant:"outline",size:"sm",onClick:Q},{default:n(()=>e[38]||(e[38]=[r(" Restore Data ",-1)])),_:1,__:[38]})])])]),_:1,__:[40]}),t(o(f),{padding:"lg"},{default:n(()=>[e[43]||(e[43]=a("h3",{class:"text-lg font-semibold text-gray-900 mb-6"},"System Logs",-1)),a("div",$e,[a("div",Xe,[a("div",Ke,[t(o(b),{modelValue:D.value,"onUpdate:modelValue":e[17]||(e[17]=l=>D.value=l),placeholder:"Filter logs",options:z},null,8,["modelValue"]),t(o(g),{variant:"outline",size:"sm",onClick:ee},{default:n(()=>e[41]||(e[41]=[r(" Refresh ",-1)])),_:1,__:[41]})]),t(o(g),{variant:"outline",size:"sm",onClick:le},{default:n(()=>e[42]||(e[42]=[r(" Download Logs ",-1)])),_:1,__:[42]})]),a("div",Qe,[(d(!0),c(x,null,C(P.value,l=>(d(),c("div",{key:l.id,class:"text-sm font-mono mb-2"},[a("span",el,u(se(l.timestamp)),1),a("span",{class:ce([ne(l.level),"ml-2"])},"["+u(l.level)+"]",3),a("span",ll,u(l.message),1)]))),128))])])]),_:1,__:[43]})])):V("",!0)]),_:1},8,["modelValue"])]),t(o(ve),{modelValue:_.value,"onUpdate:modelValue":e[23]||(e[23]=l=>_.value=l),title:"Invite New User",onConfirm:G,onCancel:F},{default:n(()=>[a("div",al,[t(o(m),{modelValue:v.value.email,"onUpdate:modelValue":e[19]||(e[19]=l=>v.value.email=l),label:"Email Address",type:"email",placeholder:"user@company.com",required:""},null,8,["modelValue"]),t(o(m),{modelValue:v.value.firstName,"onUpdate:modelValue":e[20]||(e[20]=l=>v.value.firstName=l),label:"First Name",placeholder:"John",required:""},null,8,["modelValue"]),t(o(m),{modelValue:v.value.lastName,"onUpdate:modelValue":e[21]||(e[21]=l=>v.value.lastName=l),label:"Last Name",placeholder:"Doe",required:""},null,8,["modelValue"]),t(o(b),{modelValue:v.value.role,"onUpdate:modelValue":e[22]||(e[22]=l=>v.value.role=l),label:"Role",options:B,required:""},null,8,["modelValue"])])]),_:1},8,["modelValue"])]),_:1}))}},vl=ue(tl,[["__scopeId","data-v-096e2542"]]);export{vl as default};
|