mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
4.8 KiB
JavaScript
1 line
4.8 KiB
JavaScript
import{d as S,aK as T,x,r as u,q as G,o as d,c as p,b as e,F as _,E as w,t as b,f as a,A as O,B as k,e as g,v as P,as as R,C as D,at as I,w as M,i as L,D as B,j as F,_ as U,O as n,bE as V,bF as j,M as $,k as K}from"./index-e62f5c21.js";const z={class:"container w-full my-4"},H=e("hr",null,null,-1),Y=e("hr",null,null,-1),q=e("hr",null,null,-1),Q={class:"overflow-x-auto mt-4"},W={class:"align-middle inline-block min-w-full shadow overflow-hidden bg-white shadow-dashboard px-2 pt-1 rounded-bl-lg rounded-br-lg"},J={class:"min-w-full"},X=e("thead",null,[e("tr",null,[e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Group Name "),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Access Pages "),e("th",{class:"px-1 py-1 border-b-2 border-gray-300"})])],-1),Z={class:"bg-white"},ee={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},te={class:"flex items-center"},se={class:"text-sm leading-5 text-gray-800"},oe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ne={class:"text-sm leading-5 text-sky-800"},le={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},ae=["onClick"],re={action:"post",class:"p-1"},ie={class:"grid grid-cols-2 gap-x-4 mb-4"},de={class:"block col-span-2 mb-2"},ce=e("span",{class:"text-gray-700"},"Group Name",-1),ue={class:"block col-span-2 mb-2"},pe=e("span",{class:"text-gray-700"},"Pages",-1),be=["size"],me=["value"],_e={for:"toggle",class:"text-xs text-gray-700 mr-4"},ge={class:"relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in"},he=e("label",{for:"toggle",class:"toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"},null,-1),fe=e("hr",null,null,-1),ve=S({__name:"Groups",setup(ye){const A=F(()=>U(()=>import("./FelModal-44636049.js"),["assets/FelModal-44636049.js","assets/index-e62f5c21.js","assets/index-332ec99e.css","assets/FelModal-780aeea9.css"])),h=[n.ADMINISTRATION,n.DASHBOARD,n.CLIENTS,n.PATIENTS,n.PATIENTS_COMPACT,n.SAMPLES,n.QC_SAMPLES,n.WORKSHEETS,n.NOTICE_MANAGER,n.BIO_BANKING,n.INVENTORY,n.REFERRAL];let i=T();const{withClientMutation:f}=$();i.fetchGroupsAndPermissions();const E=x(()=>i.getGroups);u("permissions");let r=u(!1),v=u("");const m=u(!0);let l=G({});function y(o,s={}){m.value=o,r.value=!0,v.value=(o?"CREATE":"EDIT")+" ANALYSES PROFILE",o?Object.assign(l,{name:"",pages:[]}):Object.assign(l,{...s})}function C(){const o={...l},s=o.pages;o.pages=s.join(","),m.value===!0&&f(V,{payload:o},"createGroup").then(t=>i.addGroup(t)),m.value===!1&&f(j,{uid:l?.uid,payload:{name:o.name,pages:o.pages}},"updateGroup").then(t=>i.updateGroup(t)),r.value=!1}const N=(o,s)=>o?.reduce(function(t,c){return(t[c[s]]=t[c[s]]||[]).push(c),t},{});return x(()=>Array.from(Object.entries(N(i.getPermissions,"target")))),(o,s)=>(d(),p(_,null,[e("div",z,[H,e("button",{class:"px-2 py-1 border-sky-800 border text-sky-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none",onClick:s[0]||(s[0]=t=>y(!0))},"Add Group"),Y]),q,e("div",Q,[e("div",W,[e("table",J,[X,e("tbody",Z,[(d(!0),p(_,null,w(E.value,t=>(d(),p("tr",{key:t.uid},[e("td",ee,[e("div",te,[e("div",se,b(t.name),1)])]),e("td",oe,[e("div",ne,b(t.pages),1)]),e("td",le,[e("button",{onClick:c=>y(!1,t),class:"px-2 py-1 mr-2 border-orange-500 border text-orange-500 rounded-sm transition duration-300 hover:bg-orange-700 hover:text-white focus:outline-none"}," Edit ",8,ae)])]))),128))])])])]),a(r)?(d(),O(a(A),{key:0,onClose:s[5]||(s[5]=t=>L(r)?r.value=!1:r=!1)},{header:k(()=>[e("h3",null,b(a(v)),1)]),body:k(()=>[e("form",re,[e("div",ie,[e("label",de,[ce,g(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":s[1]||(s[1]=t=>a(l).name=t),placeholder:"Name ..."},null,512),[[P,a(l).name]])]),e("label",ue,[pe,g(e("select",{name:"controlLevels",id:"controlLevels","onUpdate:modelValue":s[2]||(s[2]=t=>a(l).pages=t),class:"form-input mt-1 block w-full",multiple:"",size:h.length},[(d(),p(_,null,w(h,t=>e("option",{key:t,value:t},b(t),9,me)),64))],8,be),[[R,a(l).pages]])]),e("label",_e,[D("Active "),e("div",ge,[g(e("input",{type:"checkbox",name:"toggle",id:"toggle","onUpdate:modelValue":s[3]||(s[3]=t=>a(l).active=t),class:"toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer outline-none"},null,512),[[I,a(l).active]]),he])])]),fe,e("button",{type:"button",onClick:s[4]||(s[4]=M(t=>C(),["prevent"])),class:"-mb-4 w-full border border-sky-800 bg-sky-800 text-white rounded-sm px-4 py-2 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Save Form ")])]),_:1})):B("",!0)],64))}}),we=K(ve,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/admin/users/Groups.vue"]]);export{we as default};
|