PageSourceSearch

https://gorilladash.com/build/main-core/subApps/ghidorah/assets/DefaultOrganisationRoleEditView--Vy1646F.js

js gorilladash.com collected 2026-09-29 15:21:38 UTC 6,943 bytes, 1 lines download raw bytes

1import{d as K,ap as L,at as W,v as g,r as b,a as X,a6 as R,a7 as O,af as o,A as t,ah as A,u as a,j as ee,Q as N,Z as r,Y as s,R as E,E as i}from"./vue-vendor-DU31Z9ja.js";import{a as ae,f as v,f1 as te,f2 as oe,f3 as se,f4 as S,s as x,a4 as P}from"./main-D0rI_NT2.js";import{b as ie,c as ne,d as le,e as re,g as ce}from"./defaultOrganisationRoles-KbvFFEwb.js";import{_ as de}from"./DefaultOrganisationRoleFormFields.vue_vue_type_script_setup_true_lang-DWr74QLn.js";import{q as D,s as V,R as F,u as U,n as u,w as $,t as j,x as M,j as ue,ae as me,k as fe,J as pe,i as ge}from"./vuetify-BrYxyD-o.js";import"./apollo-hXwLCVfN.js";import"./vite-helpers-CHo5Xokm.js";import"./date-utils-o_cfa2Sl.js";import"./lodash-CuhjbElB.js";import"./useAxios-DYxIG8bk.js";const ve={class:"text-h6"},he={class:"text-body-2 text-medium-emphasis"},ye={class:"text-body-2"},we={class:"mb-2"},_e={class:"mb-2"},be={class:"mb-0"},xe={class:"d-flex align-center ga-3"},Ve={class:"text-body-2"},Ce={class:"d-flex ga-3 flex-wrap"},ke={class:"text-h6 text-error d-flex align-center ga-2"},Re={class:"text-body-2 mb-3"},Oe={class:"text-body-2 mb-3"},Se={class:"text-body-2 mb-2"},De={class:"d-inline-block bg-surface-light text-body-2 mx-1 rounded px-1"},Me=K({__name:"DefaultOrganisationRoleEditView",setup(Fe){const{t:e}=ae(),q=L(),C=W(),d=Number(q.params.roleId),T=Number.isFinite(d)&&d>0;T||C.replace({name:"admin.defaultOrganisationRoles.index"});const c=ie({roleId:d}),{data:k,execute:z}=ne({roleId:d}),B=g(()=>k.value?.data?.name??""),H=g(()=>!!k.value?.data),h=b(!1),y=b(!1),p=b(!1),w=b(""),m=g(()=>h.value||y.value),_=g(()=>B.value?`FORCE UPDATE ${B.value}`:""),I=g(()=>w.value.trim()===_.value&&_.value.length>0),J=async()=>{try{await c.submit(),await x(e("Success"),e("Role updated successfully")),await C.push({name:"admin.defaultOrganisationRoles.index"})}catch(l){await v(l)}},Q=async()=>{if(await P({title:e("Are you sure?"),text:e("This will permanently delete the role")}))try{await le(d),await x(e("Success"),e("Role deleted successfully")),await C.push({name:"admin.defaultOrganisationRoles.index"})}catch(n){await v(n)}},Y=async()=>{if(await P({title:e("Backfill missing roles?"),text:e("Organisations that already have a role with this name will be skipped (their existing permissions stay untouched). Only organisations missing this role will get it")}))try{h.value=!0,await re(d),await x(e("Success"),e("Backfill completed"))}catch(n){await v(n)}finally{h.value=!1}},Z=()=>{w.value="",p.value=!0},G=async()=>{if(I.value){p.value=!1;try{y.value=!0,await ce(d),await x(e("Success"),e("Force overwrite completed"))}catch(l){await v(l)}finally{y.value=!1}}};return X(async()=>{if(T)try{await z();const l=k.value?.data;l&&c.setData({name:l.name,permission_ids:l.permissions.map(n=>n.id)})}catch(l){await v(l)}}),(l,n)=>(O(),R(ge,null,{default:o(()=>[t(D,{title:a(e)("Edit Default Organisation Role")},{default:o(()=>[t(V),t(F,null,{default:o(()=>[t(de,{form:a(c),"onUpdate:form":n[0]||(n[0]=f=>ee(c)?c.value=f:null)},null,8,["form"])]),_:1}),t(U,null,{default:o(()=>[N(t(u,{color:"error",variant:"text",disabled:m.value,onClick:Q},{default:o(()=>[r(s(a(e)("Delete")),1)]),_:1},8,["disabled"]),[[E,!a(c).processing]]),t($),N(t(u,{color:"primary",to:{name:"admin.defaultOrganisationRoles.index"},disabled:m.value,exact:""},{default:o(()=>[r(s(a(e)("Cancel")),1)]),_:1},8,["disabled"]),[[E,!a(c).processing]]),t(u,{color:"primary",loading:a(c).processing,disabled:m.value,"prepend-icon":a(te),onClick:J},{default:o(()=>[r(s(a(e)("Save template")),1)]),_:1},8,["loading","disabled","prepend-icon"])]),_:1})]),_:1},8,["title"]),H.value?(O(),R(D,{key:0,variant:"text",border:"",rounded:"lg",class:"mt-6"},{default:o(()=>[t(F,null,{title:o(()=>[i("span",ve,s(a(e)("Apply to organisations")),1)]),subtitle:o(()=>[i("span",he,s(a(e)("Push the current template state to existing organisations")),1)]),_:1}),t(V),t(j,null,{default:o(()=>[t(M,{type:"info",variant:"tonal",density:"comfortable",class:"mb-4",icon:a(oe)},{default:o(()=>[i("div",ye,[i("p",we,[i("strong",null,s(a(e)("Save template")),1),r(" "+s(a(e)("only changes this template row. Newly created organisations will pick up the latest template automatically;
1 existing organisations are not affected")),1)]),i("p",_e,[i("strong",null,s(a(e)("Backfill to organisations")),1),r(" "+s(a(e)("gives this role to organisations that do not yet have it (a safe additive operation). Organisations that already have a role with the same name are left untouched — including their permissions")),1)]),i("p",be,[i("strong",null,s(a(e)("Force overwrite all organisations")),1),r(" "+s(a(e)("replaces every organisation's same-named role with the current template permissions. Any local customisation on those organisations will be lost. This action cannot be undone")),1)])])]),_:1},8,["icon"]),m.value?(O(),R(M,{key:0,type:"warning",variant:"tonal",density:"comfortable",class:"mb-4"},{default:o(()=>[i("div",xe,[t(ue,{indeterminate:"",size:"20",width:"2",color:"warning"}),i("div",Ve,s(a(e)("Syncing this role to every organisation, please keep this tab open. This may take a few minutes for accounts with many organisations")),1)])]),_:1})):A("",!0),i("div",Ce,[t(u,{color:"info",variant:"tonal","prepend-icon":a(se),loading:h.value,disabled:m.value||a(c).processing,onClick:Y},{default:o(()=>[r(s(a(e)("Backfill to organisations")),1)]),_:1},8,["prepend-icon","loading","disabled"]),t(u,{color:"error",variant:"tonal","prepend-icon":a(S),loading:y.value,disabled:m.value||a(c).processing,onClick:Z},{default:o(()=>[r(s(a(e)("Force overwrite all organisations")),1)]),_:1},8,["prepend-icon","loading","disabled"])])]),_:1})]),_:1})):A("",!0),t(me,{modelValue:p.value,"onUpdate:modelValue":n[3]||(n[3]=f=>p.value=f),"max-width":"32rem",persistent:""},{default:o(()=>[t(D,null,{default:o(()=>[t(F,null,{title:o(()=>[i("span",ke,[t(fe,{icon:a(S)},null,8,["icon"]),r(" "+s(a(e)("Force overwrite all organisations")),1)])]),_:1}),t(V),t(j,null,{default:o(()=>[i("p",Re,s(a(e)("This will overwrite every organisation's same-named role with the current template permissions, including any local customisations made by individual organisations")),1),i("p",Oe,[i("strong",null,s(a(e)("This action cannot be undone")),1)]),i("p",Se,[r(s(a(e)("Type the phrase below to confirm"))+" ",1),i("code",De,s(_.value),1)]),t(pe,{modelValue:w.value,"onUpdate:modelValue":n[1]||(n[1]=f=>w.value=f),placeholder:_.value,color:"error",variant:"outlined",density:"comfortable",autofocus:"","hide-details":""},null,8,["modelValue","placeholder"])]),_:1}),t(V),t(U,null,{default:o(()=>[t($),t(u,{variant:"text",onClick:n[2]||(n[2]=f=>p.value=!1)},{default:o(()=>[r(s(a(e)("Cancel")),1)]),_:1}),t(u,{color:"error",variant:"flat",disabled:!I.value,"prepend-icon":a(S),onClick:G},{default:o(()=>[r(s(a(e)("Force overwrite")),1)]),_:1},8,["disabled","prepend-icon"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}))}});export{Me as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.