admin_panel/admin_panel/public/frontend/assets/Settings-e05aef0e.js

3 lines
11 KiB
JavaScript

import{aD as R,o as d,c as u,d as n,b as e,p as k,q as V,t as o,g as i,e as l,f as _,v as h,i as I,r as g,E as q,F as w,j as y,k as m,G as $,D as c,h as Y,H as G}from"./index-236aaeb3.js";import{_ as H}from"./LayoutHeader-46b723f4.js";const W={class:"flex flex-col h-full"},J={class:"flex-1 overflow-auto"},K={class:"border-b px-5"},Q={class:"flex gap-2"},X=["onClick"],Z={class:"p-5"},ee={key:0,class:"space-y-4"},te={class:"flex justify-between items-center"},se={class:"text-lg font-medium text-ink-gray-9"},oe={class:"rounded-lg border overflow-hidden"},ae={class:"min-w-full divide-y"},le={class:"bg-surface-gray-2"},ne={class:"px-6 py-3 text-left text-xs font-medium text-ink-gray-5 uppercase"},ie={class:"px-6 py-3 text-left text-xs font-medium text-ink-gray-5 uppercase"},de={class:"px-6 py-3 text-right text-xs font-medium text-ink-gray-5 uppercase"},re={class:"divide-y"},ue={class:"px-6 py-4"},me={class:"flex items-center gap-3"},ce={class:"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center"},pe={class:"text-sm font-medium text-blue-600"},ve={class:"text-sm font-medium text-ink-gray-9"},ge={class:"px-6 py-4 text-sm text-ink-gray-7"},ye={class:"px-6 py-4"},fe={class:"px-6 py-4 text-sm text-ink-gray-7"},be={class:"px-6 py-4 text-right"},xe={class:"flex items-center justify-end gap-2"},_e={key:1,class:"space-y-6"},he={class:"rounded-lg border p-5"},we={class:"text-base font-medium text-ink-gray-9 mb-4"},ke={class:"space-y-4 max-w-md"},Ve={class:"rounded-lg border p-5"},Ue={class:"flex items-center justify-between mb-4"},$e={class:"text-base font-medium text-ink-gray-9"},Ye={class:"rounded-lg border p-5"},Ce={class:"text-base font-medium text-ink-gray-9 mb-4"},Ae={class:"space-y-3"},De={class:"flex items-center gap-3"},Me={class:"text-sm text-ink-gray-9"},Se={class:"text-xs text-ink-gray-4"},Ee={key:2,class:"space-y-6"},Fe={class:"rounded-lg border p-5"},ze={class:"text-base font-medium text-ink-gray-9 mb-4"},je={class:"max-w-md"},Ne={class:"rounded-lg border p-5"},Le={class:"text-base font-medium text-ink-gray-9 mb-4"},Pe={class:"max-w-md"},Oe={class:"rounded-lg border p-5"},Te={class:"text-base font-medium text-ink-gray-9 mb-4"},Be={class:"max-w-md"},Re={class:"flex justify-end"},Ie={key:3,class:"space-y-6"},qe={class:"rounded-lg border p-5"},Ge={class:"text-base font-medium text-ink-gray-9 mb-4"},He={class:"space-y-4"},We={class:"flex items-center justify-between"},Je={class:"text-sm text-ink-gray-7"},Ke={class:"flex items-center justify-between"},Qe={class:"text-sm text-ink-gray-7"},Xe={class:"flex items-center justify-between"},Ze={class:"text-sm text-ink-gray-7"},et={class:"flex items-center justify-between"},tt={class:"text-sm text-ink-gray-7"},st={class:"flex justify-end"},ot={class:"space-y-4"},it={__name:"Settings",setup(at){const{locale:C}=R(),b=g("adminUsers"),x=g(!1),A=[{id:"adminUsers",label:"settings.adminUsers"},{id:"security",label:"settings.security"},{id:"system",label:"settings.system"},{id:"notifications",label:"settings.notifications"}],D=g([{id:1,name:"Admin User",email:"admin@example.com",role:"Super Admin",lastLogin:"2024-03-15 10:30"},{id:2,name:"Developer",email:"dev@example.com",role:"Admin",lastLogin:"2024-03-14 15:45"},{id:3,name:"Support",email:"support@example.com",role:"Viewer",lastLogin:"2024-03-13 09:00"}]),r=g({name:"",email:"",role:"Admin",password:""}),M=[{label:"Super Admin",value:"Super Admin"},{label:"Admin",value:"Admin"},{label:"Viewer",value:"Viewer"}],f=g({current:"",new:"",confirm:""}),S=g([{id:1,device:"Chrome on MacOS",location:"Moscow, Russia",lastActive:"Now",current:!0},{id:2,device:"Firefox on Windows",location:"Saint Petersburg, Russia",lastActive:"2 hours ago",current:!1}]),p=g({language:"ru",timezone:"Europe/Moscow",dateFormat:"DD.MM.YYYY"}),E=[{label:"English",value:"en"},{label:"Русский",value:"ru"}],F=[{label:"Europe/Moscow (UTC+3)",value:"Europe/Moscow"},{label:"Europe/London (UTC+0)",value:"Europe/London"},{label:"America/New_York (UTC-5)",value:"America/New_York"}],z=[{label:"DD.MM.YYYY",value:"DD.MM.YYYY"},{label:"MM/DD/YYYY",value:"MM/DD/YYYY"},{label:"YYYY-MM-DD",value:"YYYY-MM-DD"}],v=g({newUser:!0,accountFrozen:!0,containerError:!0,payment:!0});function j(){console.log("Adding user:",r.value),x.value=!1,r.value={name:"",email:"",role:"Admin",password:""}}function N(a){console.log("Editing user:",a)}function L(a){console.log("Deleting user:",a)}function P(){console.log("Changing password"),f.value={current:"",new:"",confirm:""}}function O(){C.value=p.value.language,localStorage.setItem("admin-panel-locale",p.value.language)}function T(){console.log("Saving system settings:",p.value)}function B(){console.log("Saving notification settings:",v.value)}return(a,s)=>(d(),u("div",W,[n(H,{title:a.$t("settings.title")},null,8,["title"]),e("div",J,[e("div",K,[e("nav",Q,[(d(),u(k,null,V(A,t=>e("button",{key:t.id,class:q(["px-4 py-2 text-sm font-medium transition-colors",b.value===t.id?"border-b-2 border-ink-gray-9 text-ink-gray-9":"text-ink-gray-5 hover:text-ink-gray-7"]),onClick:U=>b.value=t.id},o(a.$t(t.label)),11,X)),64))])]),e("div",Z,[b.value==="adminUsers"?(d(),u("div",ee,[e("div",te,[e("h3",se,o(a.$t("settings.adminUsers")),1),n(l(m),{variant:"solid",onClick:s[0]||(s[0]=t=>x.value=!0)},{prefix:i(()=>[n(l(w),{name:"plus",class:"h-4 w-4"})]),default:i(()=>[y(" "+o(a.$t("settings.admin.addUser")),1)]),_:1})]),e("div",oe,[e("table",ae,[e("thead",le,[e("tr",null,[s[17]||(s[17]=e("th",{class:"px-6 py-3 text-left text-xs font-medium text-ink-gray-5 uppercase"},"Name",-1)),s[18]||(s[18]=e("th",{class:"px-6 py-3 text-left text-xs font-medium text-ink-gray-5 uppercase"},"Email",-1)),e("th",ne,o(a.$t("settings.admin.role")),1),e("th",ie,o(a.$t("settings.admin.lastLogin")),1),e("th",de,o(a.$t("common.actions")),1)])]),e("tbody",re,[(d(!0),u(k,null,V(D.value,t=>(d(),u("tr",{key:t.id},[e("td",ue,[e("div",me,[e("div",ce,[e("span",pe,o(t.name.charAt(0)),1)]),e("span",ve,o(t.name),1)])]),e("td",ge,o(t.email),1),e("td",ye,[n(l($),{variant:t.role==="Super Admin"?"warning":"info",label:t.role},null,8,["variant","label"])]),e("td",fe,o(t.lastLogin),1),e("td",be,[e("div",xe,[n(l(m),{variant:"ghost",size:"sm",onClick:U=>N(t)},{default:i(()=>[n(l(w),{name:"edit-2",class:"h-4 w-4"})]),_:1},8,["onClick"]),n(l(m),{variant:"ghost",size:"sm",onClick:U=>L(t)},{default:i(()=>[n(l(w),{name:"trash-2",class:"h-4 w-4 text-red-500"})]),_:1},8,["onClick"])])])]))),128))])])])])):b.value==="security"?(d(),u("div",_e,[e("div",he,[e("h3",we,o(a.$t("settings.security.changePassword")),1),e("div",ke,[n(l(c),{modelValue:f.value.current,"onUpdate:modelValue":s[1]||(s[1]=t=>f.value.current=t),label:"Current Password",type:"password"},null,8,["modelValue"]),n(l(c),{modelValue:f.value.new,"onUpdate:modelValue":s[2]||(s[2]=t=>f.value.new=t),label:"New Password",type:"password"},null,8,["modelValue"]),n(l(c),{modelValue:f.value.confirm,"onUpdate:modelValue":s[3]||(s[3]=t=>f.value.confirm=t),label:"Confirm Password",type:"password"},null,8,["modelValue"]),n(l(m),{variant:"solid",onClick:P},{default:i(()=>[...s[19]||(s[19]=[y(" Update Password ",-1)])]),_:1})])]),e("div",Ve,[e("div",Ue,[e("div",null,[e("h3",$e,o(a.$t("settings.security.twoFactorAuth")),1),s[20]||(s[20]=e("p",{class:"text-sm text-ink-gray-5 mt-1"}," Add an extra layer of security to your account ",-1))]),n(l(m),{variant:"subtle"},{default:i(()=>[...s[21]||(s[21]=[y(" Enable 2FA ",-1)])]),_:1})])]),e("div",Ye,[e("h3",Ce,o(a.$t("settings.security.activeSessions")),1),e("div",Ae,[(d(!0),u(k,null,V(S.value,t=>(d(),u("div",{key:t.id,class:"flex items-center justify-between py-2 border-b last:border-0"},[e("div",De,[n(l(w),{name:"monitor",class:"h-5 w-5 text-ink-gray-4"}),e("div",null,[e("p",Me,o(t.device),1),e("p",Se,o(t.location)+" - "+o(t.lastActive),1)])]),t.current?(d(),Y(l($),{key:1,variant:"success",label:"Current"})):(d(),Y(l(m),{key:0,variant:"ghost",size:"sm"},{default:i(()=>[...s[22]||(s[22]=[y(" Revoke ",-1)])]),_:1}))]))),128))])])])):b.value==="system"?(d(),u("div",Ee,[e("div",Fe,[e("h3",ze,o(a.$t("settings.system.language")),1),e("div",je,[n(l(c),{modelValue:p.value.language,"onUpdate:modelValue":s[4]||(s[4]=t=>p.value.language=t),type:"select",options:E,onChange:O},null,8,["modelValue"])])]),e("div",Ne,[e("h3",Le,o(a.$t("settings.system.timezone")),1),e("div",Pe,[n(l(c),{modelValue:p.value.timezone,"onUpdate:modelValue":s[5]||(s[5]=t=>p.value.timezone=t),type:"select",options:F},null,8,["modelValue"])])]),e("div",Oe,[e("h3",Te,o(a.$t("settings.system.dateFormat")),1),e("div",Be,[n(l(c),{modelValue:p.value.dateFormat,"onUpdate:modelValue":s[6]||(s[6]=t=>p.value.dateFormat=t),type:"select",options:z},null,8,["modelValue"])])]),e("div",Re,[n(l(m),{variant:"solid",onClick:T},{default:i(()=>[y(o(a.$t("common.save")),1)]),_:1})])])):b.value==="notifications"?(d(),u("div",Ie,[e("div",qe,[e("h3",Ge,o(a.$t("settings.notification.emailNotifications")),1),e("div",He,[e("label",We,[e("span",Je,o(a.$t("settings.notification.newUser")),1),_(e("input",{"onUpdate:modelValue":s[7]||(s[7]=t=>v.value.newUser=t),type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[h,v.value.newUser]])]),e("label",Ke,[e("span",Qe,o(a.$t("settings.notification.accountFrozen")),1),_(e("input",{"onUpdate:modelValue":s[8]||(s[8]=t=>v.value.accountFrozen=t),type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[h,v.value.accountFrozen]])]),e("label",Xe,[e("span",Ze,o(a.$t("settings.notification.containerError")),1),_(e("input",{"onUpdate:modelValue":s[9]||(s[9]=t=>v.value.containerError=t),type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[h,v.value.containerError]])]),e("label",et,[e("span",tt,o(a.$t("settings.notification.payment")),1),_(e("input",{"onUpdate:modelValue":s[10]||(s[10]=t=>v.value.payment=t),type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"},null,512),[[h,v.value.payment]])])])]),e("div",st,[n(l(m),{variant:"solid",onClick:B},{default:i(()=>[y(o(a.$t("common.save")),1)]),_:1})])])):I("",!0)])]),n(l(G),{modelValue:x.value,"onUpdate:modelValue":s[16]||(s[16]=t=>x.value=t),options:{title:a.$t("settings.admin.addUser")}},{"body-content":i(()=>[e("div",ot,[n(l(c),{modelValue:r.value.name,"onUpdate:modelValue":s[11]||(s[11]=t=>r.value.name=t),label:"Name",type:"text"},null,8,["modelValue"]),n(l(c),{modelValue:r.value.email,"onUpdate:modelValue":s[12]||(s[12]=t=>r.value.email=t),label:"Email",type:"email"},null,8,["modelValue"]),n(l(c),{modelValue:r.value.role,"onUpdate:modelValue":s[13]||(s[13]=t=>r.value.role=t),label:"Role",type:"select",options:M},null,8,["modelValue"]),n(l(c),{modelValue:r.value.password,"onUpdate:modelValue":s[14]||(s[14]=t=>r.value.password=t),label:"Password",type:"password"},null,8,["modelValue"])])]),actions:i(()=>[n(l(m),{variant:"subtle",onClick:s[15]||(s[15]=t=>x.value=!1)},{default:i(()=>[y(o(a.$t("common.cancel")),1)]),_:1}),n(l(m),{variant:"solid",onClick:j},{default:i(()=>[y(o(a.$t("common.create")),1)]),_:1})]),_:1},8,["modelValue","options"])]))}};export{it as default};
//# sourceMappingURL=Settings-e05aef0e.js.map