1import{bg as l,b3 as d,J as m,b_ as c,a0 as g,I as K,bs as p,Z as h,O as f,bh as _,P as y}from"./PW_UF68a.js";import{D as R,a as w,S as k}from"./Cl_RIlgr.js";import{a as v,m as D,j as u}from"./-W1VOijv.js";import"./Bs5_TFWz.js";import"./Bz2dEcw7.js";import"./YBCtw0SD.js";import"./CIhhRri8.js";import"./B_aewNsK.js";import"./fgnZjpTr.js";import"./CH7vd0UB.js";import"./206wqFYJ.js";const T={class:"text-h5 text-md-h4 registry-title"},B={name:"MolRegistryByCategory",components:{SimpleTable:k,DraftResolutionsTable:w,DispositionsTable:R},data(){return{}},head(){return{title:this.decodedRegistry||"Registru"}},computed:{...u("molCategories",["molCategories"]),...u("molRegistries",["molRegistries"]),...u("molDocuments",["molDocuments"]),categoryKey(){return((this._.provides[y]||this.$route).params.category||"").toLowerCase()},registryKey(){return((this._.provides[y]||this.$route).params.registry||"").toLowerCase()},selectedComponentKey(){if(!this.molCategories.length||!this.molRegistries.length)return"SimpleTable";const e=this.getRegistryByKeys(this.categoryKey,this.registryKey);if(!e)return"SimpleTable";if((this.registryKey||"").toLowerCase()==="registrul-pentru-evidenta-hotarariilor-autoritatii-deliberative")return"DraftResolutionsTable";const r=(e.table_type||e.tableType||"").toLowerCase();return{documentsimple:"SimpleTable",documentesimple:"SimpleTable",proiectedehotarari:"DraftResolutionsTable",proiectededispozitii:"DispositionsTable",dispozitii:"DispositionsTable"}[r]||"SimpleTable"},selectedComponent(){const e=this.selectedComponentKey;return this.$options.components[e]||this.$options.components.SimpleTable},registryId(){const e=this.getRegistryByKeys(this.categoryKey,this.registryKey);return e?e.id:null},showAddButton(){if((this.registryKey||"").toLowerCase()==="registrul-pentru-evidenta-hotarariilor-autoritatii-deliberative")return!0;const t=this.getRegistryByKeys(this.categoryKey,this.registryKey),r=(t&&(t.table_type||t.tableType)||"").toLowerCase();return r==="documentsimple"||r==="documentesimple"||r==="proiectededispozitii"||r==="dispozitii"||r==="proiectedehotarari"},decodedRegistry(){const e=this.getRegistryByKeys(this.categoryKey,this.registryKey);return e?e.name:this.deslugify((this._.provides[y]||this.$route).params.registry||"")},isClientRoute(){return(this._.provides[y]||this.$route).path.includes("client")}},async mounted(){await this.getData("mol-categories");const e=this.getCategoryByKey(this.categoryKey);if(e&&await this.getRegistriesByCategory(e.id),this.molCategories.length&&this.molRegistries.length){const t=this.molCategories,r=this.molRegistries;t.forEach(s=>{s.registries=r.filter(i=>i.mol_category_id===s.id)})}},methods:{...D("resources",["getData","getRegistriesByCategory"]),getCategoryByKey(e){return this.molCategories.find(t=>(t.key||"").toLowerCase()===(e||"").toLowerCase())},getRegistryByKeys(e,t){const r=this.getCategoryByKey(e);if(!r)return null;const s=r.registries||[];return s.length?s.find(n=>{const a=(n.key||"").toLowerCase().trim(),o=(t||"").toLowerCase().trim();return a===o})||null:this.molRegistries.filter(o=>o.mol_category_id===r.id).find(o=>{const C=(o.key||"").toLowerCase().trim(),b=(t||"").toLowerCase().trim();return C===b})||null},getDocNumber(e,t){const r=t&&t.numKey||"number",s=e&&e[r];return this.extractInteger(s??(e&&(e.number||e.id)))},getDocDate(e,t){const r=t&&t.dateKey||"date",s=e&&e[r];return this.formatDate(s)},extractInteger(e){if(e==null)return"-";const r=String(e).match(/\d+/g);if(!r)return"-";const s=parseInt(r.join(""),10);return Number.isNaN(s)?"-":String(s)},formatDate(e){if(!e||typeof e!="string")return"-";const r=e.split(" ")[0].split("-");if(r.length!==3)return e;const[s,i,n]=r,a=(n||"").padStart(2,"0"),o=(i||"").padStart(2,"0");return`${a}.${o}.${s}`},deslugify(e){return e?e.toString().replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase()):""},onAddClick(){this.$router.push(`${(this._.provides[y]||this.$route).path}/create`)},goToMainMenu(){this.$router.push("/mol/main-menu/client")}}},L=Object.assign(B,{setup(e){return(t,r)=>{const s=l("v-spacer"),i=l("v-btn"),n=l("v-card-title"),a=l("v-card-text"),o=l("v-card");return t.molCategories?.length&&t.molRegistries?.length&&t.decodedRegistry?(d(),m(o,{key:0,class:"text-center pa-1 full-with",elevation:"5"},{default:c(()=>[g(n,{class:"d-flex align-center mb-2 text-h5 text-md-h4"},{default:c(()=>[K("div",T,p(t.decodedRegistry),1),g(s),g(i,{color:"error",class:"ml-2 back-button text-white",onClick:t.goToMainMenu},{default:c(()=>[h(p(t.$t("buttons.back")),1)]),_:1},8,["onClick"]),t.showAddButton&&!t.isClientRoute?(d(),m(i,{key:0,color:"primary",class:"text-white ml-2 create-button",onClick:t.onAddClick},{default:c(()=>[...r[0]||(r[0]=[h(" Adauga ",-1)])]),_:1},8,["onClick"])):f("",!0)]),_:1}),g(a,null,{default:c(()=>[(d(),m(_(t.selectedComponent),{key:t.selectedComponentKey,"category-key":t.categoryKey,"registry-key":t.registryKey,"registry-id":t.registryId},null,8,["category-key","registry-key","registry-id"]))]),_:1})]),_:1})):f("",!0)}}}),O=v(L,[["__scopeId","data-v-c31298e8"]]);export{O 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.