import{_ as C}from"./D_7E8SMU.js";import{_ as v}from"./BOhf1Bbf.js";import{u as k}from"./BHvLfWtM.js";import{u as w}from"./7pZkuj9N.js";import{_ as S,d as D,e as a,w as V,h as K,s as h,N as T,r as j,o as n,b as s,G as d,c as p,t as o,D as c,I as m,f as _}from"./Bgmy51Qv.js";import"./CNIrc0EA.js";import"./DZl4_Bww.js";import"./AmaTRG5a.js";import"./DuSynPle.js";import"./B2895E6R.js";const U={setup(){const e=w(),{getAllList:l}=e,{allCategories:f}=h(e),u=T(),{currentLanguage:t}=h(u);return{currentLanguage:t,getAllList:l,allCategories:f}},name:"sub-categories",data(){return{result:{id:"",title:"",featured:2,category_id:"",status:2,slug:"",meta_description:"",meta_title:"",image:""}}},mixins:[k],components:{DataPage:v,Dropdown:C},computed:{},methods:{titleChanged(){this.result.slug=this.convertToSlug(this.result.title)},categorySelected(e){this.result.category_id=e.key},featuredSelected(e){this.result.featured=e.key},dropdownSelected(e){this.result.status=e.key}},async mounted(){if(!this.allCategories)try{await this.getAllList({api:"getAllCategories",action:"setAllCategories"})}catch(e){K({statusCode:400,message:e.message})}}},q={class:"input-wrapper"},A=["placeholder"],B={key:0,class:"error"},L={class:"input-wrapper"},N=["placeholder"],I={key:0,class:"error"},O={class:"input-wrapper"},P={class:"dply-felx j-left mb-20 mb-sm-15"},R={class:"mr-15"},$={class:"input-wrapper"},z={class:"dply-felx j-left mb-20 mb-sm-15"},G={class:"mr-15"},M={class:"input-wrapper"},F=["placeholder"],H={key:0,class:"error"},J={class:"input-wrapper"},Q=["placeholder"],W={key:0,class:"error"},X={class:"input-wrapper"},Y={class:"dply-felx j-left mb-20 mb-sm-15"},Z={class:"mr-15"};function E(e,l,f,u,t,g){const y=C,b=j("data-page");return u.allCategories&&e.$can("subcategory","view")?(n(),D(b,{key:0,ref:"dataPage","set-api":"setSubCategory","get-api":"getSubCategory","set-image-api":"setSubCategoryImage","empty-store-variable":"allSubCategories","route-name":"sub-categories",name:e.$t("prod.subCat"),gate:"subcategory","validation-keys":["title","slug","meta_title","meta_description"],"file-keys":["id","status","featured","category_id"],result:t.result,onResult:l[5]||(l[5]=r=>t.result=r)},{form:V(({hasError:r})=>[s("div",q,[s("label",null,o(e.$t("index.title")),1),d(s("input",{type:"text",placeholder:e.$t("index.title"),"onUpdate:modelValue":l[0]||(l[0]=i=>t.result.title=i),ref:"title",onChange:l[1]||(l[1]=(...i)=>e.slugChange&&e.slugChange(...i)),class:c({invalid:!t.result.title&&r})},null,42,A),[[m,t.result.title]]),!t.result.title&&r?(n(),p("span",B,o(e.$t("category.req",{type:e.$t("index.title")})),1)):a("",!0)]),s("div",L,[s("label",null,o(e.$t("category.slug")),1),d(s("input",{type:"text",placeholder:e.$t("category.slug"),"onUpdate:modelValue":l[2]||(l[2]=i=>t.result.slug=i),ref:"title",class:c({invalid:!t.result.slug&&r})},null,10,N),[[m,t.result.slug]]),!t.result.slug&&r?(n(),p("span",I,o(e.$t("category.req",{type:e.$t("category.slug")})),1)):a("",!0)]),s("div",O,[s("div",P,[s("span",R,o(e.$t("category.catUp")),1),_(y,{selectedKey:`${t.result.category_id}`,options:u.allCategories,onClicked:g.categorySelected},null,8,["selectedKey","options","onClicked"])])]),s("div",$,[s("div",z,[s("span",G,o(e.$t("category.featured")),1),_(y,{selectedKey:`${t.result.featured}`,options:e.featuredObj,onClicked:g.featuredSelected},null,8,["selectedKey","options","onClicked"])])]),s("div",M,[s("label",null,o(e.$t("category.mTitle")),1),d(s("input",{type:"text",placeholder:e.$t("category.mTitle"),"onUpdate:modelValue":l[3]||(l[3]=i=>t.result.meta_title=i),class:c({invalid:!t.result.meta_title&&r})},null,10,F),[[m,t.result.meta_title]]),!t.result.meta_title&&r?(n(),p("span",H,o(e.$t("category.req",{type:e.$t("category.mTitle")})),1)):a("",!0)]),s("div",J,[s("label",null,o(e.$t("category.mDesc")),1),d(s("textarea",{placeholder:e.$t("category.mDesc"),"onUpdate:modelValue":l[4]||(l[4]=i=>t.result.meta_description=i),class:c({invalid:!t.result.meta_description&&r})},null,10,Q),[[m,t.result.meta_description]]),!t.result.meta_description&&r?(n(),p("span",W,o(e.$t("category.req",{type:e.$t("category.mDesc")})),1)):a("",!0)]),s("div",X,[s("div",Y,[s("span",Z,o(e.$t("category.status")),1),_(y,{selectedKey:`${t.result.status}`,options:e.statusObj,onClicked:g.dropdownSelected},null,8,["selectedKey","options","onClicked"])])])]),_:1},8,["name","result"])):a("",!0)}const ue=S(U,[["render",E]]);export{ue as default};
