import{_ as W}from"./myImg-B3XMH9SK.js";import{_ as q}from"./AppDateTimePicker.vue_vue_type_style_index_0_lang-DxkjJlWf.js";import{d as G,a as Y,s as J,r,P as Q,x as X,w as o,O as Z,f as ee,i as t,y as te,h as u,G as w,L as y,I as oe,A as S,j as n,E as le,t as _,l as I,k as g,K as ae,d0 as se,_ as re}from"./index-N7CMQwFv.js";import{g as ue,p as ne}from"./myProduct-BNmFFulZ.js";import{V as ie,a as de,b as k,c as ce,d as D}from"./VStepper-BmhzrFkQ.js";import{V as pe}from"./VRow-CGgRlzLk.js";import{V as x}from"./VCol-xRADuXqd.js";import{V as me}from"./VAutocomplete-B-jGSTKg.js";import{V as ve}from"./VInfiniteScroll-CqDQ5FMk.js";import{V as fe}from"./VDataTable-UguPFD5B.js";import"./VSheet-BUpJdv3I.js";/* empty css */import"./VSelect-CAAOHY78.js";import"./VList-BYq4u0VJ.js";import"./VMenu-Dbaxs5uG.js";import"./VChip-iaVLrPY0.js";import"./VSlideGroup-BGEgBoXK.js";import"./filter-D7iDI7IV.js";import"./VPagination-CN_An-w0.js";import"./VTable-JZ8Hgj7V.js";const Ve={class:"d-flex justify-end"},ye={class:"d-flex align-center pt-5 pb-5",style:{width:"400px"}},_e={class:"ml-5"},ge={class:"product-title"},he={class:"product-text"},be={class:"product-text"},Se={class:"btn-cancel d-flex justify-center mt-7"},Ie={class:"d-flex justify-center mt-7 pa-7"},xe={class:"btn-cancel d-flex justify-center mt-7"},Pe=G({__name:"copyProductsToStores",props:{copyProductVisible:{type:Boolean},productCopyId:{},storeData:{},outSideStoreId:{}},emits:["change:confirmAddProduct","update:copyProductVisible"],setup(T,{emit:U}){const i=T,h=U;Y();const A=J(),L=()=>{h("update:copyProductVisible",!1)},d=r(1),N=r([]),P=r(1),B=[{title:"Selected Products",key:"productInfo"},{title:"Creation Time",key:"addDate"}],p=r([]),m=r([]),s=r({keyword:i.productCopyId?i.productCopyId:null,typeIds:null,status:null,defaultLogisticsChannelId:null,startDate:null,endDate:null,size:5,current:1}),C=r(0),b=r(!1),v=async()=>{b.value=!0,ue(s.value).then(a=>{C.value=a.data.total,b.value=!1,a.data.records!==null&&a.data.records.forEach(e=>{p.value.push(e)})})},V=r(null),j=()=>{const a=se(V.value);s.value.startDate=a[0],s.value.endDate=a[a.length-1],s.value.current=1,v()},E=[{name:"Unpublished",id:1},{name:"Published",id:2}],F=()=>{s.value.current=1,p.value=[],v()},M=()=>{s.value.current=1,p.value=[],v()};async function O({done:a}){if(p.value){if(C.value===p.value.length){a("empty");return}if(b.value){a("empty");return}s.value.current+=1,v(),a("ok");return}a("empty")}const c=r(0),$=()=>{const a={customProductIds:m.value,toStoreId:P.value};H(),ne(a).then(e=>{A.changeSnackbar({color:"#7367f0",location:"top",variant:"elevated",text:"Copy to store successful !",visible:!0}),c.value=100,m.value=[],setTimeout(()=>{h("update:copyProductVisible",!1),h("change:confirmAddProduct",!0),d.value=1},2e3)})};Q(()=>{i.copyProductVisible&&(N.value=i.storeData,s.value.keyword=i.productCopyId?i.productCopyId:null,i.outSideStoreId&&(P.value=i.outSideStoreId),v())});const z=()=>{d.value=2},f=r(null),H=()=>{if(c.value>=100){clearInterval(f.value),f.value=null;return}f.value=setInterval(()=>{c.value<100&&(c.value+=1),c.value>=100&&(clearInterval(f.value),f.value=null)},500)};return(a,e)=>{const K=q,R=W;return ee(),X(Z,{modelValue:i.copyProductVisible,"onUpdate:modelValue":e[6]||(e[6]=l=>i.copyProductVisible=l),width:a.$vuetify.display.smAndDown?"auto":800,persistent:""},{default:o(()=>[t(te,{class:"pa-6 pa-2 add-product-dialog"},{default:o(()=>[u("div",Ve,[t(w,{icon:"custom-close-line",onClick:y(L,["prevent"])})]),t(oe,{class:"stepper-box pa-0"},{default:o(()=>[t(ie,{modelValue:n(d),"onUpdate:modelValue":e[5]||(e[5]=l=>S(d)?d.value=l:null),"alt-labels":""},{default:o(()=>[t(de,null,{default:o(()=>[t(k,{title:"Select Product",value:1,color:"#000000"}),t(w,{icon:"custom-arrow-right-s-line",class:"mb-5",color:"#AEB0B9"}),t(k,{title:"Complete Copy",value:2,color:"#000000"})]),_:1}),t(ce,{class:"pt-5"},{default:o(()=>[t(D,{value:1},{default:o(()=>[t(pe,{class:"mb-5"},{default:o(()=>[t(x,{md:"12",cols:"12"},{default:o(()=>[t(le,{modelValue:n(s).keyword,"onUpdate:modelValue":[e[0]||(e[0]=l=>n(s).keyword=l),M],label:"Product Name, SKU, Product Num",variant:"outlined","prepend-inner-icon":"custom-search-2-line"},null,8,["modelValue"])]),_:1}),t(x,{md:"6",cols:"12"},{default:o(()=>[t(me,{modelValue:n(s).status,"onUpdate:modelValue":[e[1]||(e[1]=l=>n(s).status=l),F],chips:"","closable-chips":"",items:E,"item-title":"name","item-value":"id",label:"Order Status",variant:"outlined"},null,8,["modelValue"])]),_:1}),t(x,{md:"6",cols:"12"},{default:o(()=>[t(K,{modelValue:n(V),"onUpdate:modelValue":[e[2]||(e[2]=l=>S(V)?V.value=l:null),j],placeholder:"Time Selection",variant:"outlined",config:{mode:"range"},multiple:""},null,8,["modelValue"])]),_:1})]),_:1}),t(ve,{height:370,onLoad:O},{default:o(()=>[t(fe,{modelValue:n(m),"onUpdate:modelValue":e[3]||(e[3]=l=>S(m)?m.value=l:null),"items-per-page":-1,"disable-sort":"",headers:B,items:n(p),"item-value":"id","show-select":"",class:"order-data-table","hide-default-footer":""},{"item.productInfo":o(({item:l})=>[u("div",ye,[t(R,{src:l.mainImageUrl,height:70,width:70,"no-compress":!0,"is-preview":!0,previewList:[l.mainImageUrl]},null,8,["src","previewList"]),u("div",_e,[u("div",ge,_(l.title),1),u("div",he,_(l.optionInfo),1),u("div",be," NO: "+_(l.blankProductSeqNo),1)])])]),"no-data":o(()=>e[7]||(e[7]=[u("div",null,null,-1)])),_:1},8,["modelValue","items"])]),_:1}),u("div",Se,[t(I,{class:"text-none text-subtitle-1 ml-5",color:"#000000",height:"42px",variant:"flat",disabled:n(d)>=2,onClick:y(z,["prevent"])},{default:o(()=>e[8]||(e[8]=[g(" Next Step ")])),_:1,__:[8]},8,["disabled"])])]),_:1}),t(D,{value:2},{default:o(()=>[e[11]||(e[11]=u("div",{class:"copy-product-item3-title"}," Product copying may take a few minutes. You can hide the pop-up box and continue using ArtShiney. ",-1)),u("div",Ie,[t(ae,{"model-value":n(c),rotate:360,size:100,width:10,color:"#000000"},{default:o(()=>[g(_(n(c)),1)]),_:1},8,["model-value"])]),u("div",xe,[t(I,{variant:"outlined",color:"#6D788D",height:"42px",onClick:e[4]||(e[4]=y(l=>d.value=1,["prevent"]))},{default:o(()=>e[9]||(e[9]=[g(" Previous ")])),_:1,__:[9]}),t(I,{class:"text-none text-subtitle-1 ml-5",color:"#000000",height:"42px",variant:"flat",onClick:y($,["prevent"])},{default:o(()=>e[10]||(e[10]=[g(" Confirm ")])),_:1,__:[10]})])]),_:1,__:[11]})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue","width"])}}}),We=re(Pe,[["__scopeId","data-v-e3fe326e"]]);export{We as default};