import{_ as f}from"./D_7E8SMU.js";import{_ as h,c as r,o as d,b as t,t as s,E as m,F as y,g as b,f as u,D as $,r as S,w as C,u as I,s as w}from"./Bgmy51Qv.js";import{_ as P}from"./DuhDFJjj.js";import{_ as x}from"./DJbnGWvO.js";import{_ as D}from"./DSZLzbC1.js";import{u as j}from"./BHvLfWtM.js";import{P as B}from"./CnTHyurX.js";const F={name:"ProductSource",data(){return{}},props:{title:{type:String,default:""},type:{type:String,default:""},allData:{type:Object,default:null},items:{type:Array,default:[]}},mixins:[],components:{Dropdown:f},computed:{},methods:{itemSelected(e,o){this.$emit("itemSelected",{index:e,value:o.key})},removeItem(e){var l;let o=!0;(l=this.items[e])!=null&&l.deleted&&(o=!1),this.$emit("removeItem",{index:e,deleted:o})},addItem(){this.$emit("addItem")}},async mounted(){}},T={class:"mb-20 mb-sm-15"},z={class:"dply-felx"},A={class:"mb-10 capitalize"},E={class:"dply-felx j-left f-wrap mlr--7-5"},L=["onClick"];function N(e,o,l,k,g,c){const _=f;return d(),r("div",T,[t("div",z,[t("h5",A,s(l.title),1),t("button",{class:"outline-btn mb-10",onClick:o[0]||(o[0]=m((...i)=>c.addItem&&c.addItem(...i),["prevent"]))},s(e.$t("list.add",{title:l.title})),1)]),t("div",E,[(d(!0),r(y,null,b(l.items,(i,a)=>(d(),r("div",{key:a,class:"mlr-7-5 dply-felx mt-10"},[u(_,{disabled:i.deleted,"selected-key":i[l.type].id,options:l.allData,onClicked:n=>c.itemSelected(a,n)},null,8,["disabled","selected-key","options","onClicked"]),t("button",{class:"ml-5 close-btn",onClick:m(n=>c.removeItem(a),["prevent"])},[t("i",{class:$(["icon",i.deleted?"undo-icon":"close-icon"])},null,2)],8,L)]))),128))])])}const nt=h(F,[["render",N]]),R={setup(){const e=I(),{setting:o}=w(e);return{setting:o}},name:"SourceTypeProducts",data(){return{}},props:{sourceProducts:{type:Array,default(){return[]}}},watch:{},directives:{},components:{PriceFormat:B,ProductSearch:D},mixins:[j],computed:{currencyIcon(){var e;return((e=this.setting)==null?void 0:e.currency_icon)||"$"}},methods:{autoSuggestionClose(){this.$refs.productSearch.autoSuggestionClose()}},destroyed(){},mounted(){}},V={class:"table-wrapper mb-20 mb-sm-15"},M={class:"mn-w-600x"},O={class:"lite-bold"},U={class:"dply-felx j-left"},q=["src","alt"],G={class:"mx-w-400x"},H={class:"undo-container"},J=["onClick"],K=["onClick"];function Q(e,o,l,k,g,c){const _=S("product-search"),i=P,a=x;return d(),r("div",null,[u(_,{ref:"productSearch",onProductClicked:o[0]||(o[0]=n=>e.$emit("product-clicked",n))},null,512),t("h4",null,s(e.$t("fSale.sProd")),1),t("div",V,[t("table",M,[t("thead",null,[t("tr",O,[t("th",null,s(e.$t("index.title")),1),t("th",null,s(e.$t("brand.price"))+"("+s(c.currencyIcon)+")",1),t("th",null,s(e.$t("prod.offered"))+"("+s(c.currencyIcon)+")",1),o[1]||(o[1]=t("th",null,null,-1))])]),t("tbody",null,[(d(!0),r(y,null,b(l.sourceProducts,(n,p)=>(d(),r("tr",{key:p,class:$(["deletable",{deleted:n.deleted}])},[t("td",null,[t("div",U,[t("img",{class:"mr-20",src:e.getThumbImageURL(n.product.image),alt:n.product.title},null,8,q),u(i,{to:`/products/${n.product.id}`},{default:C(()=>[t("h5",G,s(n.product.title),1)]),_:2},1032,["to"])])]),t("td",null,[u(a,{price:n.product.selling},null,8,["price"])]),t("td",null,[u(a,{price:n.product.offered},null,8,["price"])]),t("td",H,[n.deleted?(d(),r("button",{key:0,onClick:m(v=>e.$emit("undo-delete",p),["prevent"]),class:"lite-btn"},s(e.$t("fSale.undo")),9,J)):(d(),r("button",{key:1,onClick:m(v=>e.$emit("delete-product",p),["prevent"]),class:"lite-btn"},s(e.$t("category.delete")),9,K))])],2))),128))])])])])}const st=h(R,[["render",Q]]);export{nt as _,st as a};
