1import{g as k,d as L,s as Ae,f as p,a as t,t as f,j as h,h as y,i as P,b as N,w as ue,F as R,k as O,o as c,e as E,v as Se,c as Pe,D as Ne,E as De,n as ce}from"./app.92a0a85e.js";import Te from"./Table.3b4c81f5.js";import $e from"./TableHead.cfb68898.js";import Fe from"./DataLoader.1a35afc0.js";import Ue from"./ConsignmentNumber.e308e8ee.js";import pe from"./Copyable.3dc7e473.js";import Me from"./NoData.6788e646.js";import{S as n}from"./sweetalert2.793d6e74.js";import Re from"./WhatsAppChatByPhone.2d5d36ec.js";import Ve from"./CreateCampaign.ede1022b.js";import"./_plugin-vue_export-helper.cdc0426e.js";import"./ChatPopup.75121451.js";/* empty css */const je={class:"row mt-2"},Ye={class:"col-4"},Ie={key:0,class:"small-text"},Le={key:1,class:"small-text"},Oe={class:"col-8"},Ee={class:"btn-group btn-group-sm shadow-sm",role:"group","aria-label":"Button group with nested dropdown"},He={key:1,class:"btn-group btn-group-sm",role:"group"},qe={class:"dropdown-menu dropdown-menu-dark"},ze={key:0},We={key:2,class:"btn-group btn-group-sm",role:"group"},Ge={class:"dropdown-menu dropdown-menu-dark"},Je={key:0},Ke={class:"row mt-2"},Qe={class:"col"},Xe={class:"d-inline-block me-2 pb-0 mb-0"},Ze={class:"form-check form-checkbox-dark form-check-sm"},et=["checked",".indeterminate"],tt={key:0},at={colspan:"100%",class:"text-center"},lt={key:1},ot={class:"d-inline-block me-2 pb-0 mb-0"},st={class:"form-check form-checkbox-dark form-check-sm"},nt=["value"],rt={key:1},it={class:"text-capitalize"},dt=["onUpdate:modelValue","title"],ut=["onUpdate:modelValue","title"],ct=["value"],pt=["disabled","id","onClick"],mt=["id"],ft={key:2},ht={colspan:"100%",class:"text-center"},vt={class:"row align-items-center mt-3"},bt={class:"col-4"},gt={key:0},_t={class:"col"},kt={key:0,"aria-label":"Users Pagination"},yt={class:"pagination pagination-sm mt-2 float-end border-primary"},wt=["onClick","innerHTML"],xt={class:"modal fade modal-lg overflow-auto",id:"create_campaign","data-bs-backdrop":"static","data-bs-keyboard":"false",tabindex:"-1","aria-labelledby":"staticBackdropLabel","aria-hidden":"true"},Ct={class:"modal-dialog modal-dialog-scrollable modal-dialog-centered"},Bt={class:"modal-content"},It={__name:"Marked",props:{params:{type:Array,required:!0,default:()=>[]},user:{type:Array,required:!0,default:()=>[]}},setup(me,{expose:fe}){const w=me,i=k(!1),v=k([]),H=k("marked"),$=k(null),D=k(null);let d=k({data:{},links:{}});const F=L(()=>{var e;const a=(e=d.value)==null?void 0:e.data;return a&&a.length>0?a.map(o=>o.id):[]}),he=L(()=>{var a;return((a=F.value)==null?void 0:a.length)>0&&v.value.length===F.value.length}),ve=L(()=>{var a;return((a=v.value)==null?void 0:a.length)>0&&v.value.length<F.value.length}),be=a=>{v.value=a.target.checked?[...F.value]:[]},V=a=>new Promise(e=>setTimeout(e,a)),B=async(a=null)=>{v.value=[],a||(a="/api/shipper_advice/get");let e={...w==null?void 0:w.params};e.filters.status=H.value,i.value=!0,d.value.data={},d.value.links={},axios.post(a,e).then(function(o){i.value=!1,d.value=o.data}).catch(function(o){var r,s;n.fire({icon:"error",text:(s=(r=o.response)==null?void 0:r.data)==null?void 0:s.message}),i.value=!1})},ge=async()=>{var e,o;if(((e=d.value.data)==null?void 0:e.length)===0){n.fire("No data found","","error");return}await V(500),i.value=!0;let a={...w==null?void 0:w.params};a.filters.status=H.value,a.user_id=(o=w==null?void 0:w.user)==null?void 0:o.id,a.download=!0,axios.post("/api/shipper_advice/shipper_advice_report",a,{responseType:"json",headers:{"Content-Type":"application/json"}}).then(r=>{let s=r.data.message;i.value=!1;let u=r.data.hasOwnProperty("url")?`<br><a href='${r.data.url}' target="_blank">Download</a>`:"";s=s+u,n.fire({icon:"success",html:s,allowOutsideClick:!1})}).catch(function(r){n.fire({icon:"error",text:r.response.data.message})})},_e=async a=>{n.fire({text:"Are you sure? You want to save advice",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Save"}).then(e=>{e.isConfirmed&&(i.value=!0,axios.post("/api/shipper_advice/save",a).then(o=>{i.value=!1,B()}).catch(function(o){n.fire(o.response.data.message,"","error"),i.value=!1}))})},q=k(null),z=k(null),W=k(null),ke={uploadPhoneNumbers:q,uploadRoboCallNumbers:z,uploadBulkAdvice:W},j=a=>{const e=ke[a];e&&e.value&&e.value.click()},ye=a=>{var o;const e=a.target.files[0];if(!e){n.fire("Please Select excel file","","error");return}if(((o=e.name.split(".").pop())==null?void 0:o.toLowerCase())!=="xlsx"){n.fire("Please Select excel file","","error"),a.target.value="";return}D.value=e,n.fire({text:"Are you sure? You want to upload bulk advice from this file",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Upload!"}).then(r=>{if(!r.isConfirmed){a.target.value="",D.value=null;return}i.value=!0;const s=new FormData;s.append("file",D.value),axios.post("/api/shipper_advice/bulk_advice",s,{headers:{"Content-Type":"multipart/form-data"}}).then(u=>{var A,S,T;i.value=!1,D.value=null,a.target.value="",B();const b=((A=u.data)==null?void 0:A.data)||{},_=b.skipped&&b.skipped>0?"warning":"success",g=b.skip_breakdown?Object.entries(b.skip_breakdown).map(([U,M])=>`<li>${U}: ${M}</li>`).join(""):"";n.fire({icon:_,html:` 2 <div>${(T=(S=u.data)==null?void 0:S.message)!=null?T:"Bulk advice processed successfully."}</div> 3 ${g?`<ul class="text-start mt-2 mb-0">${g}</ul>`:""} 4 `,allowOutsideClick:!1})}).catch(u=>{var b,_,g;i.value=!1,D.value=null,a.target.value="",n.fire((g=(_=(b=u.response)==null?void 0:b.data)==null?void 0:_.message)!=null?g:"Something went wrong","","error")})})},x=k(null),Y=()=>{var e;return(((e=d.value)==null?void 0:e.data)||[]).filter(o=>v.value.includes(o.id)).map(o=>o.consignee_phone).filter(o=>!!o)},we=async()=>{await V(100);const a=Y();a.length>0&&x.value?(await n.fire({text:"Are you sure? You want to send messages to selected phone numbers",
4icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Send!"})).isConfirmed&&(i.value=!0,axios.post("/api/shipper_advice/upload_phone_numbers",{phone_numbers:a,channel:x.value}).then(o=>{B(),n.fire({icon:"success",text:"Messages sent successfully."})}).catch(o=>{var s,u;i.value=!1;const r=((u=(s=o.response)==null?void 0:s.data)==null?void 0:u.message)||"Something went wrong";n.fire(r,"","error")})):n.fire("Please Select phone numbers","","error")},xe=async()=>{await V(100);const a=Y();a.length>0?(await n.fire({text:"Are you sure? you want to dispatch a call to the selected phone numbers",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Dispatch!"})).isConfirmed&&(i.value=!0,axios.post("/api/robocall/make_call",{phone_numbers:a,action:"shipper_advise"}).then(o=>{B(),n.fire({icon:"success",text:"Calls dispatched successfully."})}).catch(o=>{var s,u;i.value=!1;const r=((u=(s=o.response)==null?void 0:s.data)==null?void 0:u.message)||"Something went wrong";n.fire(r,"","error")})):n.fire("Please Select phone numbers","","error")},Ce=a=>{const e=a.target.files[0];e?e.name.split(".").pop()==="xlsx"&&x.value?($.value=e,n.fire({text:"Are you sure? You want to upload phone numbers to send messages",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Upload!"}).then(o=>{if(o.isConfirmed){i.value=!0;const r=new FormData;r.append("file",$.value),r.append("channel",x.value),axios.post("/api/shipper_advice/upload_phone_numbers",r,{headers:{"Content-Type":"multipart/form-data"}}).then(s=>{i.value=!1,B(),n.fire({icon:"success",text:"Phone Numbers has been uploaded successfully."})}).catch(s=>{var u;i.value=!1,(u=s.response)!=null&&u.data&&n.fire(s.response.data.message,"","error")})}})):n.fire("Please Select excel file","","error"):n.fire("Please Select excel file","","error")},Be=a=>{const e=a.target.files[0];e?e.name.split(".").pop()==="xlsx"&&x.value?($.value=e,n.fire({text:"Are you sure? You want to upload phone numbers to dispatch calls",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Upload!"}).then(o=>{if(o.isConfirmed){i.value=!0;const r=new FormData;r.append("file",$.value),r.append("action","shipper_advise"),axios.post("/api/robocall/make_call",r,{headers:{"Content-Type":"multipart/form-data"}}).then(s=>{i.value=!1,B(),n.fire({icon:"success",text:"Phone Numbers has been uploaded successfully."})}).catch(s=>{var u,b,_,g,A,S;i.value=!1,(u=s==null?void 0:s.response)!=null&&u.data&&n.fire((S=(_=(b=s==null?void 0:s.response)==null?void 0:b.data)==null?void 0:_.error)!=null?S:(A=(g=s==null?void 0:s.response)==null?void 0:g.data)==null?void 0:A.message,"","error")})}})):n.fire("Please Select excel file","","error"):n.fire("Please Select excel file","","error")};return fe({search:B}),Ae(()=>{i.value=!0}),(a,e)=>{var o,r,s,u,b,_,g,A,S,T,U,M,G,J,K,Q,X,Z,ee,te,ae,le,oe,se,ne,re,ie;return c(),p(R,null,[t("div",je,[t("div",Ye,[v.value.length>0?(c(),p("p",Ie,f(v.value.length)+" records selected",1)):((r=(o=h(d))==null?void 0:o.data)==null?void 0:r.length)>0&&v.value.length===0?(c(),p("p",Le," Showing "+f((u=(s=h(d))==null?void 0:s.meta)==null?void 0:u.from)+" to "+f((_=(b=h(d))==null?void 0:b.meta)==null?void 0:_.to)+" of "+f((A=(g=h(d))==null?void 0:g.meta)==null?void 0:A.total)+" results ",1)):y("",!0)]),t("div",Oe,[t("div",Ee,[a.userCan("shipper-advice-bulk")&&((T=(S=h(d)
4)==null?void 0:S.data)==null?void 0:T.length)>0?(c(),p("button",{key:0,type:"button",class:"btn btn-sm btn-outline-primary",href:"javascript:void(0)",onClick:e[0]||(e[0]=m=>j("uploadBulkAdvice")),title:"Bulk Advice"},e[9]||(e[9]=[t("i",{class:"fa fa-file-excel"},null,-1),P(" Bulk Advice ")]))):y("",!0),t("button",{type:"button",class:"btn btn-sm btn-outline-primary",href:"javascript:void(0)",onClick:ge,title:"Download"},e[10]||(e[10]=[t("i",{class:"fa fa-file-download"},null,-1),P(" Download Shipper Advice ")])),a.userCan("shipper-advice-send-whatsapp-message")?(c(),p("div",He,[e[13]||(e[13]=t("button",{type:"button",class:"btn btn-outline-primary dropdown-toggle","data-bs-toggle":"dropdown","aria-expanded":"false"},[t("i",{id:"UploadIcon",class:"mdi mdi-whatsapp mdi-18px"}),P(" WhatsApp Advice Message ")],-1)),t("ul",qe,[t("li",null,[t("a",{class:"dropdown-item small",href:"#",onClick:e[1]||(e[1]=m=>{j("uploadPhoneNumbers"),x.value="whatsapp"})},e[11]||(e[11]=[t("i",{class:"fa fa-file"},null,-1),P(" By File")]))]),((U=v.value)==null?void 0:U.length)>0?(c(),p("li",ze,[t("a",{class:"dropdown-item small",href:"#",onClick:e[2]||(e[2]=m=>{we(),x.value="whatsapp"})},e[12]||(e[12]=[t("i",{class:"fa fa-phone"},null,-1),P(" By Selected Phone")]))])):y("",!0)])])):y("",!0),a.userCan("shipper-advice-robocall")?(c(),p("div",We,[e[16]||(e[16]=t("button",{type:"button",class:"btn btn-outline-primary dropdown-toggle","data-bs-toggle":"dropdown","aria-expanded":"false"},[t("i",{class:"mdi mdi-phone mdi-18px"}),P(" RoboCall ")],-1)),t("ul",Ge,[t("li",null,[t("a",{class:"dropdown-item small",href:"#",onClick:e[3]||(e[3]=m=>{j("uploadRoboCallNumbers"),x.value="robocall"})},e[14]||(e[14]=[t("i",{class:"fa fa-file"},null,-1),P(" By File")]))]),((M=v.value)==null?void 0:M.length)>0?(c(),p("li",Je,[t("a",{class:"dropdown-item small",href:"#",onClick:e[4]||(e[4]=m=>{xe(),x.value="robocall"})},e[15]||(e[15]=[t("i",{class:"fa fa-phone"},null,-1),P(" By Selected Phone")]))])):y("",!0)])])):y("",!0),t("input",{class:"form-control form-control-sm shadow-sm searchfile",hidden:"",type:"file",onChange:e[5]||(e[5]=m=>Ce(m)),name:"file",id:"uploadPhoneNumbers",ref_key:"uploadPhoneNumbers",ref:q,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"},null,544),t("input",{class:"form-control form-control-sm shadow-sm searchfile",hidden:"",type:"file",onChange:e[6]||(e[6]=m=>Be(m)),name:"file",id:"uploadRoboCallNumbers",ref_key:"uploadRoboCallNumbers",ref:z,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"},null,544),t("input",{class:"form-control form-control-sm shadow-sm searchfile",hidden:"",type:"file",onChange:e[7]||(e[7]=m=>ye(m)),name:"file",id:"uploadBulkAdvice",ref_key:"uploadBulkAdvice",ref:W,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,.xlsx"},null,544)])])]),t("div",Ke,[t("div",Qe,[N(Te,null,{default:ue(()=>{var m,I,de;return[N($e,{slot_start:!0,th_array:["Store","CN#","Store Order ID","Name","Phone","Payment Method","Amount","Courier","Courier Reason","Marked At","Expired At","Remaining Expiry (hrs)","Client Remarks","Action",""]},{default:ue(()=>[t("li",Xe,[t("div",Ze,[t("input",{type:"checkbox",class:"form-check-input form-check-input-header shadow-sm",checked:he.value,".indeterminate":ve.value,onChange:be},null,40,et)])])]),_:1}),i.value?(c(),p("tbody",tt,[t("tr",null,[t("td",at,[N(Fe)])])])):((I=(m=h(d))==null?void 0:m.data)==null?void 0:I.length)>0?(c(),p("tbody",lt,[(c(!0),p(R,null,O((de=h(d))==null?void 0:de.data,(l,At)=>(c(),p("tr",null,[t("td",null,[t("li",ot,[t("div",st,[E(t("input",{type:"checkbox",class:"form-check-input shadow-sm","onUpdate:modelValue":e[8]||(e[8]=C=>v.value=C),value:l.id},null,8,nt),[[Se,v.value]])])])]),t("td",null,f(l.store_name),1),t("td",null,[N(Ue,{consignment_number:l.consignment_number},null,8,["consignment_number"])]),t("td",null,[N(pe,{value:l.store_order_id,label:"Store Order Id"},null,8,["value"])]),t("td",null,f(l.consignee_name),1),t("td",null,[l.message?(c(),Pe(Re,{key:0,item:l},null,8,["item"])):(c(),p("span",rt,[N(pe,{value:l.consignee_phone,label:"Phone Number"},null,8,["value"])]))]),t("td",null,f(l.payment_method),1),t("td",null,f(l.amount),1),t("td",it,f(l.courier?l.courier.replaceAll("_"," "):"-"),1),t("td",null,f(l.reason?l.reason.substring(0,120):"-"),1),t("td",null,f(l==null?void 0:l.marked_at),1),t("td",null,f(l==null?void 0:l.expired_at),1),t("td",null,f(l==null?void 0:l.remaining_hours),1),t("td",null,[E(t("input",{class:"form-control form-control-sm",type:"text","onUpdate:modelValue":C=>l.remarks=C,title:l.remarks},null,8,dt),[[Ne,l.remarks]])]),t("td",null,[E(t("select",{class:"form-select form-select-sm","onUpdate:modelValue":C=>l.action=C,title:l.action},[e[17]||(e[17]=t("option",{value:null},"Select",-1)),l.available_actions.length>0?(c(!0),p(R,{key:0},O(l.available_actions,C=>(c(),p("option",{value:C},f(C),9,ct))),256)):y("",!0)],8,ut),[[De,l.action]])]),t("td",null,[t("button",{disabled:!l.action,t
4ype:"button",class:"btn btn-sm btn-primary border-primary",id:"btn"+l.id,onClick:C=>_e(l)},[t("i",{class:"fa fa-save",id:"icon"+l.id,"data-bs-toggle":"tooltip","data-bs-placement":"top",title:"Save"},null,8,mt)],8,pt)])]))),256))])):(c(),p("tbody",ft,[t("tr",null,[t("td",ht,[N(Me,{text_heading:"No Data Found",hide_data:!0})])])]))]}),_:1})]),t("div",vt,[t("div",bt,[((J=(G=h(d))==null?void 0:G.data)==null?void 0:J.length)>0?(c(),p("p",gt," Showing "+f((Q=(K=h(d))==null?void 0:K.meta)==null?void 0:Q.from)+" to "+f((Z=(X=h(d))==null?void 0:X.meta)==null?void 0:Z.to)+" of "+f((te=(ee=h(d))==null?void 0:ee.meta)==null?void 0:te.total)+" results",1)):y("",!0)]),t("div",_t,[((le=(ae=h(d))==null?void 0:ae.data)==null?void 0:le.length)>0?(c(),p("nav",kt,[t("ul",yt,[(oe=h(d))!=null&&oe.links?(c(!0),p(R,{key:0},O((ne=(se=h(d))==null?void 0:se.meta)==null?void 0:ne.links,m=>(c(),p("li",{class:ce(["page-item",m.active?"active shadow":""])},[t("a",{class:ce(["page-link",m.url==null?"disabled":""]),href:"#",onClick:I=>B(m.url),innerHTML:m.label,disabled:""},null,10,wt)],2))),256)):y("",!0)])])):y("",!0)])])]),t("div",xt,[t("div",Ct,[t("div",Bt,[N(Ve,{"phone-numbers":(ie=(re=h(d))==null?void 0:re.data)!=null&&ie.length?Y():[]},null,8,["phone-numbers"])])])])],64)}}};export{It 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.