1import{a as z,g as S,m as D,j as f}from"./-W1VOijv.js";import L from"./B8Ry3j3y.js";import O from"./Cb9MYrcP.js";import $ from"./Dc6hFrXi.js";import{d as H}from"./BmaaQ1Wp.js";import{bg as l,b3 as u,Q as b,a0 as t,b_ as i,Z as c,bs as p,bz as N,y as G,F as B,be as C,J as F,aO as J,c1 as I,I as r,aL as V}from"./PW_UF68a.js";import"./Bz2dEcw7.js";import"./CIhhRri8.js";import"./Bs5_TFWz.js";import"./B_aewNsK.js";import"./fgnZjpTr.js";import"./CH7vd0UB.js";import"./206wqFYJ.js";const R={data(){return{articleBlocks:[{text:"Descriere LungÄ",value:"description"},{text:"Galerie Foto",value:"album"},{text:"ListÄ FiÈiere",value:"documents"},{text:"HartÄ",value:"map"},{text:"Sondaj",value:"poll"},{text:"Procente Realizare",value:"project"},{text:"DatÄ modificabilÄ",value:"display_date"},{text:"DatÄ Èi orÄ modificabilÄ",value:"display_date_time"}]}}},Q={name:"ManageArticleTypes",mixins:[R],props:{isEdit:{type:Boolean,default:!1},editedArticleType:{type:Object,default:()=>({})}},data(){return{articleType:{blocks:[]}}},computed:{...f("errors",["errors"]),...f("loader",["loading"]),manageArticleTypeModal:{get(){return this.$store.state.articleTypes.manageArticleTypesModal},set(e){this.toggleArticleTypesModal(e)}}},watch:{editedArticleType:{handler(e){this.articleType={blocks:[]},e&&e.id&&(this.articleType={...e})},immediate:!0,deep:!0}},methods:{...D("resources",["updateResource","storeResource"]),...S("errors",["clearError"]),...S("articleTypes",["toggleArticleTypesModal"]),async saveOrUpdate(){this.isEdit?await this.updateResource({scope:"article-types",data:this.articleType,navigate:!1,refreshData:!0}):await this.storeResource({scope:"article-types",data:this.articleType,navigate:!1,refreshData:!0}),await this.toggleArticleTypesModal(!1)}}},Z={class:"text-center"};function K(e,a,E,U,n,o){const h=l("v-card-title"),T=l("v-text-field"),y=l("v-card-text"),_=l("v-switch"),k=l("v-divider"),v=l("v-btn"),x=l("v-spacer"),w=l("v-card-actions"),A=l("v-card"),g=l("v-dialog");return u(),b("div",Z,[t(g,{modelValue:o.manageArticleTypeModal,"onUpdate:modelValue":a[5]||(a[5]=s=>o.manageArticleTypeModal=s),persistent:"",width:"600"},{default:i(()=>[t(A,null,{default:i(()=>[t(h,{class:"headline bg-primary text-white dialog-title"},{default:i(()=>[c(p(E.isEdit?e.$t("articleTypes.edit"):e.$t("articleTypes.create")),1)]),_:1}),t(y,{class:"mt-5"},{default:i(()=>[t(T,{modelValue:n.articleType.name,"onUpdate:modelValue":a[0]||(a[0]=s=>n.articleType.name=s),"error-messages":e.errors.name,variant:"outlined","prepend-inner-icon":"mdi-file-question",label:e.$t("fields.name"),onInput:a[1]||(a[1]=s=>("clearError"in e?e.clearError:N(G))("name"))},null,8,["modelValue","error-messages","label"])]),_:1}),t(y,null,{default:i(()=>[(u(!0),b(B,null,C(e.articleBlocks,s=>(u(),F(_,{key:s.key,modelValue:n.articleType.blocks,"onUpdate:modelValue":a[2]||(a[2]=M=>n.articleType.blocks=M),value:s.value,label:s.text,class:J({"v-input--model-value-1":n.articleType.blocks&&n.articleType.blocks.includes(s.value)})},null,8,["modelValue","value","label","class"]))),128))]),_:1}),t(k),t(w,null,{default:i(()=>[t(v,{variant:"text",color:"error","max-width":"200px","min-width":"100px",onClick:a[3]||(a[3]=I(s=>e.toggleArticleTypesModal(!1),["stop"]))},{default:i(()=>[c(p(e.$t("buttons.back")),1)]),_:1}),t(x),t(v,{variant:"text",color:"success","max-width":"200px","min-width":"100px",loading:e.loading,onClick:a[4]||(a[4]=s=>o.saveOrUpdate())},{default:i(()=>[c(p(e.$t("buttons.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const W=z(Q,[["render",K],["__scopeId","data-v-3868d8c1"]]),X={name:"ArticleTypesIndex",components:{ResetFiltersButton:$,SelectFilter:O,TextFieldFilter:L,ManageArticleTypes:W},mixins:[H,R],data(){return{isEdit:!1,editItem:{},headers:[{title:this.$t("fields.name"),align:"start",key:"name"},{title:this.$t("fields.blocks"),key:"blocks"},{title:"",sortable:!1,align:"end",key:"action"}]}},async mounted(){await this.fetchData()},head(){return{title:"Tipuri Articole"}},computed:{...f("articleTypes",["articleTypes"]),...f("loader",["loading"]),...f("query",["queryParams"]),currentScope(){return"article-types"}},methods:{...D("resources",["deleteResource","getData"]),...D("query",["resetScopeFilters","setVuetifyPagination"]),...S("articleTypes",["toggleArticleTypesModal"]),async fetchData(){try{await this.getData(this.currentScope)}catch(e){console.error("Error fetching article types:",e)}},handleOptionsUpdate(e){this.setVuetifyPagination({scope:this.currentScope,pagination:e}),this.getData(this.currentScope)},newItem(){this.editItem={},this.isEdit=!1,this.toggleArticleTypesModal(!0)},edit(e){this.editItem={...e},this.isEdit=!0,this.toggleArticleTypesModal(!0)},articleTypesBeautify(e){return{description:"Descriere LungÄ",album:"Galerie Foto",documents:"ListÄ FiÈiere",map:"HartÄ",poll:"Sondaj",project:"Procente Realizare",display_date:"DatÄ modificabilÄ",display_date_time:"DatÄ Èi orÄ modificabilÄ"}[e]||e}}},Y={class:"d-flex flex-column flex-grow-1"},ee={class:"text-h5 text-md-h4"},te={class:"filter-row"},ae={class:"text-end"},ie={class:"d-flex flex-wrap"},le={class:"d-flex no-wrap justify-end"},se={class:"font-weight-bold"},oe={class:"font-weight-bold"};function re(e,a,E,U,n,o){const h=l("manage-article-types"),T=l("v-divider"),y=l("v-spacer"),_=l("v-btn"),k=l("v-card-title"),v=l("text-field-filter"),x=l("select-filter"),w=l("reset-filters-button"),A=l("v-chip"),g=l("v-icon"),s=l("v-tooltip"),M=l("v-data-table"),j=l("v-card-text"),P=l("v-card");return u(),b("div",Y,[t(h,{"edited-article-type":n.editItem,"is-edit":n.isEdit},null,8,["edited-article-type","is-edit"]),t(P,{elevation:"5"},{default:i(()=>[t(k,{class:"d-flex align-center"},{default:i(()=>[r("div",ee,p(e.$t("menu.article_types")),1),t(T,{vertical:"",class:"mx-2 d-none d-md-inline"}),t(y),t(_,{size:"large",color:"primary",class:"mt-2 mt-md-0 create-button",onClick:I(o.newItem,["stop"])},{default:i(()=>[c(p(e.$t("buttons.create_article_type")),1)]),_:1},8,["onClick"])]),_:1}),t(j,null,{default:i(()=>[t(M,{headers:n.headers,"items-per-page-options":[10,15,30,60],loading:e.loading,"items-length":e.queryParams[o.currentScope]?.pagination?.total||0,items:e.articleTypes,class:"flex-grow-1 v2-style-table",options:e.pagination,"onUpdate:options":[a[0]||(a[0]=d=>e.pagination=d),o.handleOptionsUpdate]},{"body.prepend":i(()=>[r("tr",te,[r("td",null,[t(v,{label:e.$t("fields.name"),scope:o.currentScope,"scope-key":"name",class:"filter-field","hide-details":""},null,8,["label","scope"])]),r("td",null,[t(x,{items:e.articleBlocks,label:e.$t("fields.blocks"),scope:o.currentScope,"scope-key":"blocks",class:"filter-field","hide-details":""},null,8,["items","label","scope"])]),r("td",ae,[t(w,{scope:o.currentScope,class:"filter-reset-button"},null,8,["scope"])])])]),"item.blocks":i(({item:d})=>[r("div",ie,[(u(!0),b(B,null,C(d.blocks,m=>(u(),F(A,{key:m,class:"mr-1 mb-1",size:"small"},{default:i(()=>[c(p(o.articleTypesBeautify(m)),1)]),_:2},1024))),128))])]),"item.action":i(({item:d})=>[r("div",le,[t(s,{location:"bottom"},{activator:i(({props:m})=>[t(_,V({icon:"",size:"medium",variant:"text",density:"compact",onClick:q=>o.edit(d)},m),{default:i(()=>[t(g,{size:"large"},{default:i(()=>[...a[1]||(a[1]=[c("mdi-square-edit-outline",-1)])]),_:1})]),_:1},16,["onClick"])]),default:i(()=>[r("span",null,[a[2]||(a[2]=c("EditeazÄ ",-1)),r("i",se,p(d.name),1)])]),_:2},1024),t(s,{location:"bottom"},{activator:i(({props:m})=>[t(_,V({icon:"",size:"medium",variant:"text",density:"compact",onClick:q=>e.deleteResource({data:d,scope:o.currentScope})},m),{default:i(()=>[t(g,{size:"large"},{default:i(()=>[...a[3]||(a[3]=[c("mdi-delete",-1)])]),_:1})]),_:1},16,["onClick"])]),default:i(()=>[r("span",null,[a[4]||(a[4]=c("Èterge tipul articoululi ",-1)),r("i",oe,p(d.name),1)])]),_:2},1024)])]),_:1},8,["headers","loading","items-length","items","options","onUpdate:options"])]),_:1})]),_:1})])}const Te=z(X,[["render",re],["__scopeId","data-v-195eac36"]]);export{Te 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.