import{U as X,ak as oe,aW as n,c as x,o as m,w as t,a as e,bW as H,b as o,d as v,bX as I,ap as V,bm as i,c1 as se,c2 as ie,bY as N,c3 as A,e as g,b_ as ne,aU as de,bG as W,a$ as E,H as y,c6 as re,G as D,cj as F,cv as G,ca as j,cw as ue,aw as Y,f as R,F as B,aZ as Z,V as M,cf as ce,c8 as pe,dn as me,bd as $,ci as fe,cm as ve,c7 as O}from"./index-BRGNG7bs.js";import{d as q}from"./diyApi-Dpc5qnZC.js";import{_ as J}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{_ as he}from"./TitleBreadcrumb.vue_vue_type_style_index_0_lang-CBeB41zV.js";const ge={class:"d-flex align-center px-5",style:{height:"72px"}},_e={class:"d-flex mt-6 pb-5"},ke={class:"ml-auto"},xe=X({__name:"SaveTemplateDialog",emits:["save"],setup(K,{expose:z,emit:C}){oe("productInfo");const _=C,S=q();let u=n(""),d=n(!1),c=n(!1),w=n();function T(p){w.value=p,u.value=p.name,d.value=!0}const f=()=>{d.value=!1,c.value=!1};function k(){c.value=!0;const p={id:w.value.id,name:u.value};S.renameTemplate(p).then(s=>{_("save"),c.value=!1,f()})}return z({openDialog:T,closeDialog:f}),(p,s)=>(m(),x(ne,{modelValue:i(d),"onUpdate:modelValue":s[2]||(s[2]=h=>V(d)?d.value=h:d=h),width:"557px"},{default:t(()=>[e(H,null,{default:t(()=>[o("h3",ge,[s[3]||(s[3]=v("Rename the Template ")),e(I,{src:i(se),width:32,height:32,class:"close",onClick:s[0]||(s[0]=h=>V(d)?d.value=!1:d=!1)},null,8,["src"])]),e(ie),e(N,{style:{"padding-top":"24px"}},{default:t(()=>[s[6]||(s[6]=o("p",{style:{"font-size":"14px",color:"#565656"}},"Enter a name for the template to make it easier to find and use.",-1)),e(A,{class:"mt-3",label:"Title",color:"primary",variant:"outlined","hide-details":"",modelValue:i(u),"onUpdate:modelValue":s[1]||(s[1]=h=>V(u)?u.value=h:u=h)},null,8,["modelValue"]),o("div",_e,[o("div",ke,[e(g,{color:"lightprimary",onClick:f},{default:t(()=>s[4]||(s[4]=[v("Cancel")])),_:1}),e(g,{class:"ml-4",color:"btnBlue",loading:i(c),disabled:i(c),onClick:k},{default:t(()=>s[5]||(s[5]=[v("Rename the Template")])),_:1},8,["loading","disabled"])])])]),_:1})]),_:1})]),_:1},8,["modelValue"]))}}),we=J(xe,[["__scopeId","data-v-a5e95c3a"]]),ye="/assets/noTemplate-CetOUoiD.svg",Ve="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='&%23228;&%23184;&%23170;&%23230;&%23128;&%23167;&%23229;&%23140;&%23150;'%20clip-path='url(%23clip0_6677_183484)'%3e%3cpath%20id='Vector'%20d='M5.45312%205.36435C5.45312%205.65367%205.56806%205.93115%205.77265%206.13574C5.97723%206.34032%206.25471%206.45526%206.54403%206.45526C6.83336%206.45526%207.11084%206.34032%207.31542%206.13574C7.52001%205.93115%207.63494%205.65367%207.63494%205.36435C7.63494%205.07502%207.52001%204.79754%207.31542%204.59296C7.11084%204.38837%206.83336%204.27344%206.54403%204.27344C6.25471%204.27344%205.97723%204.38837%205.77265%204.59296C5.56806%204.79754%205.45312%205.07502%205.45312%205.36435Z'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_2'%20d='M2.17969%204.81854V3.72763C2.17969%203.4383%202.29462%203.16082%202.49921%202.95624C2.70379%202.75165%202.98127%202.63672%203.2706%202.63672H4.36151'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_3'%20d='M2.17969%209.18164V10.2725C2.17969%2010.5619%202.29462%2010.8394%202.49921%2011.0439C2.70379%2011.2485%202.98127%2011.3635%203.2706%2011.3635H4.36151'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_4'%20d='M8.72656%202.63672H9.81747C10.1068%202.63672%2010.3843%202.75165%2010.5889%202.95624C10.7934%203.16082%2010.9084%203.4383%2010.9084%203.72763V4.81854'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_5'%20d='M8.72656%2011.3635H9.81747C10.1068%2011.3635%2010.3843%2011.2485%2010.5889%2011.0439C10.7934%2010.8394%2010.9084%2010.5619%2010.9084%2010.2725V9.18164'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20id='Vector_6'%20d='M4.36719%209.18271C4.36719%208.89338%204.48212%208.6159%204.68671%208.41132C4.89129%208.20673%205.16877%208.0918%205.4581%208.0918H7.63991C7.92924%208.0918%208.20672%208.20673%208.4113%208.41132C8.61589%208.6159%208.73082%208.89338%208.73082%209.18271'%20stroke='white'%20stroke-width='0.872727'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_6677_183484'%3e%3crect%20width='13.0909'%20height='13.0909'%20fill='white'%20transform='translate(0%200.455078)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Ce={class:"d-flex align-center ml-auto"},Te={class:"d-flex align-center"},be={class:"ml-auto"},De={class:"mt-7"},Ie={key:0,class:"personlize d-flex align-center"},ze={class:"personlizes m-hover position-relative",style:{height:"255px"}},Se=["onClick"],Pe={class:"text-h4 line-clamp2"},Le={class:"mt-2",style:{"font-size":"12px"}},Ue={class:"mt-1",style:{"font-size":"12px"}},je={class:"opera"},Re={class:"text-center overflow-auto"},Be={key:4,style:{height:"calc(100vh - 300px)"},class:"text-center"},Me=X({__name:"Index",setup(K){const z=n([{title:"Product Templates",disabled:!0}]),C=q(),_=n([]);let S=n(!1),u=n(""),d=n(null),c=n(1),w=n(null),T=n(),f=de({keyword:"",current:1,size:20,total:1}),k=n(!1);n(null),W(c,r=>{f.current=r,p()}),W(()=>f.keyword,r=>{p()});function p(){k.value=!1,C.listTemplate(f).then(r=>{_.value=r.data.records,k.value=!0})}function s(r){w.value.openDialog(r)}function h(){p()}function Q(r){T.value=r,d.value.openDialog()}function ee(){C.removeTemplate({id:T.value}).then(r=>{p(),d.value.closeDialog()})}function te(r,l){O.push("/diy?id="+r+"&productType=product&templateId="+l)}function P(){O.push("/products")}p();let L=n("");return L.value=window.innerWidth,window.addEventListener("resize",function(r){L.value=window.innerWidth}),(r,l)=>{const le=E("DotsIcon"),ae=E("DotsVerticalIcon");return m(),y(B,null,[e(he,{title:"Product Templates",breadcrumbs:z.value},null,8,["breadcrumbs"]),e(we,{ref_key:"refSaveTemplateDialog",ref:w,onSave:h},null,512),e(re,{ref_key:"refTipDialog",ref:d,title:"Delete the Template",message:"Are you sure to delete this template?",confirmText:"Delete",onReflash:ee},null,512),e(H,{variant:"flat",class:"px-4 py-5",loading:i(S)},{default:t(()=>[i(L)>760?(m(),x(N,{key:0,class:"d-flex align-center",style:{"padding-top":"0","padding-left":"0"}},{default:t(()=>[l[4]||(l[4]=o("div",{style:{"font-size":"16px","font-weight":"500"}},"Product Templates",-1)),o("div",Ce,[e(A,{modelValue:i(f).keyword,"onUpdate:modelValue":l[0]||(l[0]=a=>i(f).keyword=a),"persistent-placeholder":"",placeholder:"Search",color:"primary",variant:"outlined","hide-details":"","prepend-inner-icon":"mdi-magnify",style:{width:"287px"}},null,8,["modelValue"]),e(g,{color:"primary",class:"ml-5",height:"44px",onClick:P},{default:t(()=>l[3]||(l[3]=[v("Create a Template")])),_:1})])]),_:1})):(m(),x(N,{key:1,style:{padding:"10px 0px"}},{default:t(()=>[o("div",Te,[l[6]||(l[6]=o("div",{style:{"font-size":"16px","font-weight":"500"}},"Product Templates",-1)),o("div",be,[e(F,null,{activator:t(({props:a})=>[e(g,Y({size:"x-small"},a,{icon:"",variant:"text"}),{default:t(()=>[e(le,{width:"20","stroke-width":"1.5"})]),_:2},1040)]),default:t(()=>[e(G,null,{default:t(()=>[e(j,{color:"secondary",onClick:P},{default:t(()=>[e(ue,null,{default:t(()=>l[5]||(l[5]=[v("Create a Template")])),_:1})]),_:1})]),_:1})]),_:1})])]),o("div",De,[e(A,{modelValue:i(u),"onUpdate:modelValue":l[1]||(l[1]=a=>V(u)?u.value=a:u=a),"persistent-placeholder":"",placeholder:"Search",color:"primary",variant:"outlined","hide-details":"","prepend-inner-icon":"mdi-magnify"},null,8,["modelValue"])])]),_:1})),i(k)?D("",!0):(m(),x(R,{key:2,class:"mt-3"},{default:t(()=>[(m(),y(B,null,Z(10,(a,U)=>e(M,{cols:"12",sm:"6",lg:"3",key:U},{default:t(()=>[e(ce,{class:"mx-auto border","max-width":"300",type:"image, article"})]),_:2},1024)),64))]),_:1})),e(R,null,{default:t(()=>[(m(!0),y(B,null,Z(_.value,(a,U)=>(m(),x(M,{cols:"12",sm:"6",md:"4",lg:"2",xl:"2",class:"custom-col",key:U},{default:t(()=>[e(H,{variant:"flat",class:"rounded white overflow-hidden product-carousel position-relative card-border card-hover-border"},{default:t(()=>[a.personalizeFlag?(m(),y("div",Ie,[e(I,{alt:"product",src:i(Ve),width:"18px",height:"18px",rounded:"",inline:""},null,8,["src"]),l[7]||(l[7]=o("span",{style:{"padding-left":"2px"}},"Personalization",-1))])):D("",!0),o("div",ze,[e(I,{alt:"product",cover:"",src:a.effectImageUrl,"lazy-src":i(pe),class:"w-100",style:{height:"255px"},rounded:""},null,8,["src","lazy-src"]),o("div",{class:"card-edit",onClick:b=>te(a.blankProductId,a.id)},[e(g,{color:"secondary"},{default:t(()=>l[8]||(l[8]=[v("Edit")])),_:1})],8,Se)]),e(me,{class:"pa-3"},{default:t(()=>[o("div",Pe,$(a.name),1),o("div",Le,"Last modified: "+$(a.editDate),1),o("div",Ue,"Created: "+$(a.addDate),1)]),_:2},1024),o("div",je,[e(F,{"close-on-content-click":!0,location:"bottom"},{activator:t(({props:b})=>[e(g,Y({icon:"",variant:"text",ref_for:!0},b),{default:t(()=>[e(ae,{size:"20","stroke-width":"1.5"})]),_:2},1040)]),default:t(()=>[e(fe,{rounded:"md",elevation:"12"},{default:t(()=>[e(G,null,{default:t(()=>[e(j,{class:"text-medium-emphasis",link:"",onClick:b=>s(a)},{default:t(()=>l[9]||(l[9]=[v(" Rename ")])),_:2},1032,["onClick"]),e(j,{class:"text-medium-emphasis",link:"",onClick:b=>Q(a.id)},{default:t(()=>l[10]||(l[10]=[v(" Archive ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)])]),_:2},1024)]),_:2},1024))),128))]),_:1}),_.value.length>0?(m(),x(R,{key:3},{default:t(()=>[e(M,{cols:"12",lg:"12"},{default:t(()=>[o("div",Re,[e(ve,{"active-color":"primary",modelValue:i(c),"onUpdate:modelValue":l[2]||(l[2]=a=>V(c)?c.value=a:c=a),length:i(f).total,"total-visible":7},null,8,["modelValue","length"])])]),_:1})]),_:1})):D("",!0),_.value.length==0&&i(k)?(m(),y("div",Be,[e(I,{src:i(ye),width:"299px",height:"299px",inline:"",style:{"margin-top":"80px"}},null,8,["src"]),l[12]||(l[12]=o("p",{style:{"font-size":"16px","font-weight":"500"},class:"mt-5"},"No templates yet...",-1)),l[13]||(l[13]=o("p",{style:{"font-size":"14px"},class:"mt-5"},"Your created templates could be repeatedly used, start to design one!",-1)),e(g,{color:"primary",class:"mt-5",onClick:P},{default:t(()=>l[11]||(l[11]=[v("Create a Template")])),_:1})])):D("",!0)]),_:1},8,["loading"])],64)}}}),We=J(Me,[["__scopeId","data-v-c4afd161"]]);export{We as default};