PageSourceSearch

https://comunaighiu.ro/_nuxt/CuVrn2iq.js

js comunaighiu.ro collected 2026-09-25 12:31:50 UTC 15,527 bytes, 1 lines download raw bytes

1import{bf as m,b2 as p,O as _,$ as r,bW as i,G as d,I as w,Y as y,M as F,br as h,aN as T,aK as S,F as E,by as P,x as B,bE as b}from"./yzds40HC.js";import{a as j,d as G,e as H,m as W,f as v}from"./CqawAVUb.js";import"./BgqE2USM.js";import"./C8Dppsyt.js";import"./CbO2Rjsj.js";import"./DhlRdtTC.js";import"./Dz0mkqCC.js";import"./DkpuU7u1.js";import"./DtS_aP2E.js";const Y={name:"MolRegistries",components:{draggable:G},data(){return{selectedCategoryId:null,registryHeaders:[{title:"",key:"drag",sortable:!1,width:40},{title:"Nume Registru",key:"name",align:"start"},{title:"Acțiuni",key:"action",sortable:!1,align:"end"}],registryDialog:!1,editingRegistry:null,registryForm:{name:""},categoryDialog:!1,categoryForm:{name:""},rules:{required:t=>t&&!!t||t===0||"Câmp Obligatoriu"},orderedRegistries:[],savingOrder:!1,sortKey:null,sortDesc:!1,page:1,itemsPerPage:10,totalItems:0}},head(){return{title:"Registre MOL"}},computed:{...v("molCategories",["molCategories"]),...v("molRegistries",["molRegistries"]),...v("loader",["loading"]),...v("errors",["errors"]),...v("navigators",["navigator"]),registries(){return this.molRegistries.map(t=>({id:Number(t.id),category_id:Number(t.mol_category_id),name:t.name,slug:t.key,isCore:t.is_core,order:t.order??0}))},selectedCategory(){if(!this.selectedCategoryId)return null;const t=Number(this.selectedCategoryId);return this.molCategories.find(e=>Number(e.id)===t)||null},filteredRegistries(){if(!this.selectedCategoryId)return[];const t=Number(this.selectedCategoryId);return this.registries.filter(e=>Number(e.category_id)===t)},nextRegistryOrder(){if(!this.filteredRegistries.length)return 1;const t=this.filteredRegistries.map(e=>e.order||0);return Math.max(...t)+1},pageCount(){return Math.ceil(this.orderedRegistries.length/this.itemsPerPage)||1},pageStart(){return this.orderedRegistries.length?(this.page-1)*this.itemsPerPage+1:0},pageEnd(){const t=this.page*this.itemsPerPage;return t>this.orderedRegistries.length?this.orderedRegistries.length:t}},watch:{molRegistries:{handler(){this.syncOrderedRegistries()},deep:!0,immediate:!0},itemsPerPage(){this.page=1},selectedCategoryId(){this.selectedCategoryId!=null&&(this.selectedCategoryId=Number(this.selectedCategoryId)),this.syncOrderedRegistries()}},async mounted(){await this.createResource("mol-categories"),await this.getData("mol-categories"),this.syncOrderedRegistries()},methods:{...W("resources",["getData","createResource","deleteRegistryResource","storeResource","updateResource","getRegistriesByCategory"]),...H("errors",["clearError"]),cycleSort(t){if(this.sortKey===t)if(!this.sortDesc)this.sortDesc=!0;else{this.sortKey=null,this.sortDesc=!1,this.syncOrderedRegistries();return}else this.sortKey=t,this.sortDesc=!1;this.applySort()},applySort(){this.sortKey&&(this.orderedRegistries.sort((t,e)=>{const g=t[this.sortKey]?.toString().toLowerCase()||"",u=e[this.sortKey]?.toString().toLowerCase()||"";return g<u?this.sortDesc?1:-1:g>u?this.sortDesc?-1:1:0}),this.page=1)},syncOrderedRegistries(){if(!this.selectedCategoryId){this.orderedRegistries=[];return}const t=this.filteredRegistries.slice();t.sort((e,g)=>{const u=typeof e.order=="number"?e.order:0,o=typeof g.order=="number"?g.order:0;return u!==o?u-o:(e.id||0)-(g.id||0)}),this.orderedRegistries=t},checkMove(t){const e=t.draggedContext.element,g=t.relatedContext?.element;return!(e.isCore||g&&g.isCore)},async onDragEnd(){try{this.savingOrder=!0;const t=this.orderedRegistries.filter(s=>s.isCore),g=this.orderedRegistries.filter(s=>!s.isCore).map((s,n)=>({id:s.id,order:t.length+n+1})),u=new Map(this.filteredRegistries.map(s=>[s.id,s.order??0])),o=g.filter(s=>(u.get(s.id)??0)!==s.order);if(!o.length)return;for(const s of o)await this.updateResource({scope:"mol-registries",data:{id:s.id,order:s.order},isFormData:!0,navigate:!1,suppressAlert:!0});await this.getData("mol-registries"),await this.getRegistriesByCategory(this.selectedCategoryId),await this.updateMolNavigator();const{$successAlert:l}=b();await l("Ordinea registrelor a fost actualizată cu succes.")}finally{this.savingOrder=!1}},async onCategoryChange(){this.selectedCategoryId!=null&&(this.selectedCategoryId=Number(this.selectedCategoryId)),this.editingRegistry=null,await this.getRegistriesByCategory(this.selectedCategoryId),this.syncOrderedRegistries()},openRegistryDialog(t=null){t?(this.editingRegistry=t,this.registryForm={name:t.name}):(this.editingRegistry=null,this.registryForm={name:""}),this.registryDialog=!0,this.$nextTick(()=>{const e=this.$refs.registryForm?.$el.querySelector("input");e&&e.focus()})},closeRegistryDialog(){this.registryDialog=!1,this.editingRegistry=null,this.registryForm={name:""}},openCategoryDialog(){this.categoryForm={name:this.selectedCategory?.name||""},this.categoryDialog=!0,this.$nextTick(()=>{const t=this.$refs.categoryForm?.$el.querySelector("input");t&&t.focus()})},closeCategoryDialog(){this.categoryDialog=!1,this.categoryForm={name:""}},async saveCategory(){if(!(await this.$refs.categoryForm.validate()).valid){const{$errorAlert:e,$i18n:g}=b();await e(g.t("validation_error"));return}await this.updateResource({scope:"mol-categories",data:{name:this.categoryForm.name,id:this.selectedCategoryId},isFormData:!0,navigate:!1}),this.closeCategoryDialog(),await this.getData("mol-categories"),await this.updateMolNavigator()},async saveRegistry(){if(!(await this.$refs.registryForm.validate()).valid){const{$errorAlert:g,$i18n:u}=b();await g(u.t("validation_error"));return}const e={name:this.registryForm.name,mol_category_id:this.selectedCategoryId,order:this.editingRegistry?.order??this.nextRegistryOrder};try{this.editingRegistry&&this.editingRegistry.id?await this.updateResource({scope:"mol-registries",data:{...e,id:this.editingRegistry.id},isFormData:!0,navigate:!1}):await this.storeResource({scope:"mol-registries",data:e,navigate:!1}),this.closeRegistryDialog(),await this.getData("mol-registries"),await this.getRegistriesByCategory(this.selectedCategoryId),await this.updateMolNavigator()}catch(g){if(g.response?.status===422){const u=g.response.data.message||"Eroare la validare",{$errorAlert:o}=b();await o(u),this.errors.email=[u]}}},async deleteRegistry(t){if(t.isCore)return;await this.deleteRegistryResource(t),await this.getData("mol-registries"),await this.getRegistriesByCategory(this.selectedCategoryId),this.syncOrderedRegistries();const e=this.orderedRegistries.filter(s=>s.isCore),u=this.orderedRegistries.filter(s=>!s.isCore).map((s,n)=>({id:s.id,order:e.length+n+1})),o=new Map(this.filteredRegistries.map(s=>[s.id,s.order??0])),l=u.filter(s=>(o.get(s.id)??0)!==s.order);
1if(l.length){for(const s of l)await this.updateResource({scope:"mol-registries",data:{id:s.id,order:s.order},isFormData:!0,navigate:!1,suppressAlert:!0});await this.getData("mol-registries"),await this.getRegistriesByCategory(this.selectedCategoryId),this.syncOrderedRegistries()}await this.updateMolNavigator()},async updateMolNavigator(){if(!this.navigator||!this.navigator.items||!Array.isArray(this.navigator.items.line1)&&!Array.isArray(this.navigator.items.line2))return;const t=(s=[])=>Array.isArray(s)&&s.some(n=>n.model==="mol");if(!t(this.navigator.items.line1)&&!t(this.navigator.items.line2))return;const e=this.molCategories||[],u=await(async()=>await Promise.all(e.map(async n=>{const R=((await this.getRegistriesByCategory(n.id))?.items||[]).slice().sort((c,D)=>(c.order||0)-(D.order||0)).map(c=>({model:"mol-registry",model_id:c.id,id:c.id,name:c.name,key:c.key,color:c.color||this.navigator?.background_color,url:`/mol/client/${n.key}/${c.key}`,expanded:!1}));return{model:"mol-category",model_id:n.id,id:n.id,name:n.name,key:n.key,icon:n.icon,color:this.navigator?.background_color,expanded:!1,children:R}})))(),o=JSON.parse(JSON.stringify(this.navigator)),l=(s=[])=>{s.forEach(n=>{n.model==="mol"&&(n.children=JSON.parse(JSON.stringify(u))),Array.isArray(n.children)&&n.children.length&&l(n.children)})};l(o.items.line1||[]),l(o.items.line2||[]),await this.updateResource({scope:"navigators",data:o,isFormData:!0,navigate:!1,suppressAlert:!0})}}},Q={class:"d-flex flex-column flex-grow-1",style:{"min-height":"100%"}},X={class:"smooth-dnd-container vertical"},Z={class:"d-flex justify-end"},$={class:"v-data-table-footer align-right-footer"},ee={class:"footer-section"},te={class:"footer-section"},re={class:"footer-section pagination-wrapper"},se={key:1,class:"text-center py-8"};function ie(t,e,g,u,o,l){const s=m("v-divider"),n=m("v-spacer"),C=m("v-card-title"),x=m("v-select"),R=m("v-col"),c=m("v-btn"),D=m("v-row"),f=m("v-icon"),V=m("v-tooltip"),K=m("draggable"),q=m("v-pagination"),U=m("v-data-table"),L=m("v-scroll-y-transition"),k=m("v-card-text"),I=m("v-card"),A=m("v-text-field"),O=m("v-form"),M=m("v-card-actions"),z=m("v-dialog");return p(),_("div",Q,[r(I,{class:"mt-4 mb-6",elevation:"5"},{default:i(()=>[r(C,{class:"d-flex align-center mb-6"},{default:i(()=>[e[12]||(e[12]=d("div",{class:"text-h5 text-md-h4"},"Registre Monitorul Oficial Local",-1)),r(s,{class:"mx-2 d-none d-md-inline",vertical:""}),r(n)]),_:1}),r(k,null,{default:i(()=>[r(D,{class:"mb-4"},{default:i(()=>[r(R,{cols:"12",md:"6"},{default:i(()=>[r(x,{modelValue:o.selectedCategoryId,"onUpdate:modelValue":[e[0]||(e[0]=a=>o.selectedCategoryId=a),l.onCategoryChange],items:t.molCategories,clearable:"",density:"comfortable","hide-details":"","item-title":"name","item-value":"id",label:"Selectează Categorie MOL",variant:"outlined"},null,8,["modelValue","items","onUpdate:modelValue"])]),_:1}),r(R,{class:"d-flex align-center",cols:"12",md:"6"},{default:i(()=>[o.selectedCategoryId?(p(),w(c,{key:0,class:"mr-2",color:"primary",size:"large",variant:"outlined","prepend-icon":"mdi-pencil",onClick:e[1]||(e[1]=a=>l.openCategoryDialog())},{default:i(()=>[...e[13]||(e[13]=[y(" Redenumește Categorie ",-1)])]),_:1})):F("",!0),o.selectedCategoryId?(p(),w(c,{key:1,class:"create-button",color:"primary",size:"large",onClick:e[2]||(e[2]=a=>l.openRegistryDialog())},{default:i(()=>[...e[14]||(e[14]=[y(" Adaugă Registru ",-1)])]),_:1})):F("",!0)]),_:1})]),_:1}),o.selectedCategoryId?(p(),w(L,{key:0,mode:"out-in"},{default:i(()=>[d("div",X,[r(s,{class:"mb-4"}),r(U,{"footer-props":{"items-per-page-options":[-1]},headers:[],items:[],class:"custom-table"},{thead:i(()=>[d("thead",null,[d("tr",null,[e[16]||(e[16]=d("th",{style:{width:"40px"}},null,-1)),d("th",null,[d("span",{class:"sortable-header",onClick:e[3]||(e[3]=a=>l.cycleSort("name"))},[e[15]||(e[15]=y(" Nume Registru ",-1)),o.sortKey==="name"?(p(),w(f,{key:0,class:"sort-icon"},{default:i(()=>[y(h(o.sortDesc?"mdi-arrow-down":"mdi-arrow-up"),1)]),_:1})):F("",!0)])]),e[17]||(e[17]=d("th",{class:"text-right actions-header"},"Acțiuni",-1))])])]),tbody:i(()=>[r(K,{list:o.orderedRegistries,move:l.checkMove,handle:".drag-handle","
1item-key":"id",tag:"tbody",onEnd:l.onDragEnd},{item:i(({element:a})=>[d("tr",null,[d("td",null,[r(f,{class:T([{"disabled-drag":a.isCore},"drag-handle"]),size:"24"},{default:i(()=>[...e[18]||(e[18]=[y(" mdi-drag ",-1)])]),_:1},8,["class"])]),d("td",null,h(a.name),1),d("td",Z,[r(V,{location:"bottom"},{activator:i(({props:N})=>[r(c,S({class:"mx-1",density:"compact",icon:"",size:"medium"},N,{variant:"text",onClick:J=>l.openRegistryDialog(a)}),{default:i(()=>[r(f,{size:"large"},{default:i(()=>[...e[19]||(e[19]=[y("mdi-square-edit-outline",-1)])]),_:1})]),_:1},16,["onClick"])]),default:i(()=>[d("span",null,[e[20]||(e[20]=y("Editează ",-1)),d("strong",null,h(a.name),1)])]),_:2},1024),r(V,{location:"bottom"},{activator:i(({props:N})=>[r(c,S({disabled:a.isCore,class:"mx-1",density:"compact",icon:"",size:"medium"},N,{variant:"text",onClick:J=>l.deleteRegistry(a)}),{default:i(()=>[r(f,{size:"large"},{default:i(()=>[...e[21]||(e[21]=[y("mdi-delete",-1)])]),_:1})]),_:1},16,["disabled","onClick"])]),default:i(()=>[d("span",null,[a.isCore?(p(),_(E,{key:0},[y(" Registru esențial - nu poate fi șters ")],64)):(p(),_(E,{key:1},[e[22]||(e[22]=y(" Șterge ",-1)),d("strong",null,h(a.name),1)],64))])]),_:2},1024)])])]),_:1},8,["list","move","onEnd"])]),bottom:i(()=>[d("div",$,[d("div",ee,[e[23]||(e[23]=d("span",null,"Articole pe pagină:",-1)),r(x,{modelValue:o.itemsPerPage,"onUpdate:modelValue":e[4]||(e[4]=a=>o.itemsPerPage=a),items:[10,15,30,60],density:"compact","hide-details":"",style:{width:"80px","margin-left":"8px"},variant:"outlined"},null,8,["modelValue"])]),d("div",te,h(l.pageStart)+"–"+h(l.pageEnd)+" din "+h(o.orderedRegistries.length),1),d("div",re,[r(q,{modelValue:o.page,"onUpdate:modelValue":e[5]||(e[5]=a=>o.page=a),length:l.pageCount,"aria-label":"Navigare prin pagini",density:"comfortable","first-icon":"mdi-page-first","last-icon":"mdi-page-last","next-icon":"mdi-chevron-right","prev-icon":"mdi-chevron-left","show-first-last-page":"","total-visible":"5"},null,8,["modelValue","length"])])])]),_:1})])]),_:1})):(p(),_("div",se,[r(f,{color:"grey-lighten-1",size:"80"},{default:i(()=>[...e[24]||(e[24]=[y("mdi-folder-open-outline",-1)])]),_:1}),e[25]||(e[25]=d("p",{class:"text-h6 text-grey-darken-1 mt-4"}," Selectează o categorie MOL pentru a vizualiza registrele ",-1))]))]),_:1})]),_:1}),r(z,{modelValue:o.registryDialog,"onUpdate:modelValue":e[8]||(e[8]=a=>o.registryDialog=a),"max-width":"600px",persistent:""},{default:i(()=>[r(I,null,{default:i(()=>[r(C,{class:"bg-primary text-white dialog-title"},{default:i(()=>[y(h(o.editingRegistry?"Editează Registru":"Adaugă Registru"),1)]),_:1}),r(k,{class:"mt-5"},{default:i(()=>[r(O,{ref:"registryForm"},{default:i(()=>[r(A,{modelValue:o.registryForm.name,"onUpdate:modelValue":[e[6]||(e[6]=a=>o.registryForm.name=a),e[7]||(e[7]=a=>("clearError"in t?t.clearError:P(B))("name"))],"error-messages":t.errors.name,rules:[o.rules.required],density:"comfortable",label:"Nume Registru",required:"",variant:"outlined"},null,8,["modelValue","error-messages","rules"])]),_:1},512)]),_:1}),r(s),r(M,null,{default:i(()=>[r(c,{color:"error","max-width":"200px","min-width":"100px",variant:"text",onClick:l.closeRegistryDialog},{default:i(()=>[...e[26]||(e[26]=[y(" Anulează ",-1)])]),_:1},8,["onClick"]),r(n),r(c,{color:"success","max-width":"200px","min-width":"100px",variant:"text",onClick:l.saveRegistry},{default:i(()=>[...e[27]||(e[27]=[y(" Salvează ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),r(z,{modelValue:o.categoryDialog,"onUpdate:modelValue":e[11]||(e[11]=a=>o.categoryDialog=a),"max-width":"600px",persistent:""},{default:i(()=>[r(I,null,{default:i(()=>[r(C,{class:"bg-primary text-white dialog-title"},{default:i(()=>[...e[28]||(e[28]=[y(" Redenumește Categorie ",-1)])]),_:1}),r(k,{class:"mt-5"},{default:i(()=>[r(O,{ref:"categoryForm"},{default:i(()=>[r(A,{modelValue:o.categoryForm.name,"onUpdate:modelValue":[e[9]||(e[9]=a=>o.categoryForm.name=a),e[10]||(e[10]=a=>("clearError"in t?t.clearError:P(B))("name"))],"error-messages":t.errors.name,rules:[o.rules.required],density:"comfortable",label:"Nume Categorie",required:"",variant:"outlined"},null,8,["modelValue","error-messages","rules"])]),_:1},512)]),_:1}),r(s),r(M,null,{default:i(()=>[r(c,{color:"error","max-width":"200px","min-width":"100px",variant:"text",onClick:l.closeCategoryDialog},{default:i(()=>[...e[29]||(e[29]=[y(" Anulează ",-1)])]),_:1},8,["onClick"]),r(n),r(c,{color:"success","max-width":"200px","min-width":"100px",variant:"text",onClick:l.saveCategory},{default:i(()=>[...e[30]||(e[30]=[y(" Salvează ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const ye=j(Y,[["render",ie],["__scopeId","data-v-aa3b2b01"]]);export{ye 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.