PageSourceSearch

https://my.eciatto.com/build/assets/FormIncentivePackage-CaYULmn6.js

js eciatto.com collected 2026-10-06 19:08:39 UTC 7,638 bytes, 1 lines download raw bytes

1import{_ as j}from"./CardBox-DtNFb3gM.js";import{_ as q}from"./BaseButtons-BSiRq0c7.js";import{i as I,u as W,m as N,r as A,o as z,Q as H,a as c,c as m,b as o,d as h,w as _,F as T,y as $,D as J,e as P,l as Y,n as V,h as F,k as E,N as S}from"./app-DT5vx9qp.js";import{_ as Q}from"./FormField-Bc4JMUc2.js";import{_ as R}from"./FormControlWithLeftLabel-BewK-Yp0.js";import{u as G}from"./incentive-Cabf8KN6.js";import X from"./index-BgGf-3lI.js";import{r as O}from"./index-rnzSFQs9.js";const Z={class:"flex justify-end"},ee={key:0},te={key:1},ae={class:"flex justify-end"},ne={key:0},le={key:1},pe={__name:"FormIncentivePackage",props:{incentivePackage:Object,incentiveType:Object,action:String,pagenumber:Number},setup(x){const e=x,v=I("$swal"),M=W(),D=G(),C=N(!1);let g=new Date,p=[];for(let t=0;t<e.incentiveType.length;t++)p.push({id:g.getTime()+Math.floor(Math.random()*999)+"-"+e.incentiveType[t].id,name:e.incentiveType[t].name,type:e.incentiveType[t].reward_type==1?"credit":"point",amount:0});let f=N(e.action==="edit"?e.incentivePackage.tier:[]),b=N([{id:0,target:0,incentiveList:p}]);const w=A({pagenumber:e.pagenumber,action:e.action,id:e.action==="edit"?e.incentivePackage.id:"",name:e.action==="edit"?e.incentivePackage.name:""}),B=(t,a=0)=>{let s=0;
1switch(t){case"new_tier_more":g=new Date,p=[];for(let l=0;l<e.incentiveType.length;l++)p.push({id:g.getTime()+Math.floor(Math.random()*999)+"-"+e.incentiveType[l].id,name:e.incentiveType[l].name,amount:0});const r={id:g.getTime()+Math.floor(Math.random()*999),target:0,incentiveList:p};b.value.push(r);break;case"new_tier_delete":s=b.value.map(l=>l.id).indexOf(a),b.value.splice(s,1);break;case"tier_more":g=new Date,p=[];for(let l=0;l<e.incentiveType.length;l++)p.push({id:g.getTime()+Math.floor(Math.random()*999)+"-"+e.incentiveType[l].id,name:e.incentiveType[l].name,amount:0});const k={id:g.getTime()+Math.floor(Math.random()*999),target:0,incentive_list:p};f.value.push(k);break;case"tier_delete":s=f.value.map(l=>l.id).indexOf(a),f.value.splice(s,1);break;case"back":S.get(route("admin.incentivepackage.index",{pagenumber:e.pagenumber}));break}},U=()=>{e.action==="edit"?v({icon:"question",title:"Are you sure?",text:"Are you sure want to update this!",allowOutsideClick:!1,showCancelButton:!0,showCloseButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, update it!"}).then(t=>{if(t.value){C.value=!0;let a={form:w,tier:f.value,tierNew:[]},s=JSON.stringify(a);D.updateIncentivePackage(s).then(r=>{r.type==="success"?v({icon:"success",title:"Updated!",text:r.message,allowOutsideClick:!1,showCancelButton:!1,confirmButtonColor:"#3085d6",confirmButtonText:"OK!"}).then(k=>{S.get(route("admin.incentivepackage.index",{pagenumber:e.pagenumber}))}):v({icon:"error",title:"Fail!",text:r.message,allowOutsideClick:!1,showCancelButton:!1,confirmButtonColor:"#3085d6",confirmButtonText:"OK!"})}).catch(r=>{}).finally(()=>{C.value=!1})}}):v({icon:"question",title:"Are you sure?",text:"Are you sure want to create this!",allowOutsideClick:!1,showCancelButton:!0,showCloseButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, create it!"}).then(t=>{if(t.value){C.value=!0;let a={form:w,tier:[],tierNew:b.value},s=JSON.stringify(a);D.storeIncentivePackage(s).then(r=>{r.type==="success"?v({icon:"success",title:"Created!",text:r.message,allowOutsideClick:!1,showCancelButton:!1,confirmButtonColor:"#3085d6",confirmButtonText:"OK!"}).then(k=>{S.get(route("admin.incentivepackage.index",{pagenumber:e.pagenumber}))}):v({icon:"error",title:"Fail!",text:r.message,allowOutsideClick:!1,showCancelButton:!1,confirmButtonColor:"#3085d6",confirmButtonText:"OK!"})}).catch(r=>{}).finally(()=>{C.value=!1})}})};return z(()=>{const t=Object.keys(O).find(a=>O[a].name===H().component);M.setHeaderTitle(O[t].meta.title),M.setSideMenuChild(O[t].meta.title),M.setHeaderRecordCount(0)}),(t,a)=>{const s=R,r=Q,k=J,l=Y,K=q,L=j;return c(),m(T,null,[o(h(X),{active:C.value,"can-cancel":!1,"is-full-page":!0,"lock-scroll":!0,loader:"dots"},null,8,["active"]),o(L,{isForm:!0,onSubmit:E(U,["prevent"]),class:"shadow-lg"},{default:_(()=>[o(r,{class:"mx-4 mb-3"},{default:_(()=>[o(s,{modelValue:w.name,"onUpdate:modelValue":a[0]||(a[0]=u=>w.name=u),type:"text",label:"Incentive Package Name",labelFor:"package",maxlength:"100",id:"package",name:"package",required:!0},null,8,["modelValue"])]),_:1}),(c(!0),m(T,null,$(h(f),(u,i)=>(c(),m("div",{key:"tier"+i,class:"m-2 p-2 rounded-md bg-sky-50"},[o(r,{class:"mb-3"},{default:_(()=>[o(s,{modelValue:u.target,"onUpdate:modelValue":n=>u.target=n,type:"text",maxlength:"10",label:"Target",id:"target"+i,name:"target"+i,labelFor:"target"+i,required:!0,isCurrency:!0,tooltip:"Total sales from direct downline",onKeypress:a[1]||(a[1]=n=>t.$isNumberWithDot(n))},null,8,["modelValue","onUpdate:modelValue","id","name","labelFor"])]),_:2},1024),o(k,{class:"mx-3"}),(c(!0),m(T,null,$(u.incentive_list,(n,d)=>(c(),m("div",{key:"incentive"+i+d},[o(s,{modelValue:n.amount,"onUpdate:modelValue":y=>n.amount=y,type:"text",maxlength:"10",label:t.$currency+", "+n.name+" ("+n.type+")",id:"existing"+i+d,name:"existing"+i+d,labelFor:"existing"+i+d,labelSize:"w-80",required:!0,isCurrency:!0,onKeypress:a[2]||(a[2]=y=>t.$isNumberWithDot(y))},null,8,["modelValue","onUpdate:modelValue","label","id","name","labelFor"])]))),128)),P("div",Z,[h(f).length!=1?(c(),m("div",ee,[o(l,{type:"button",color:"danger",label:"Delete",onClick:n=>B("tier_delete",u.id),class:V("mr-5 shadow-lg shadow-red-600/50")},null,8,["onClick"])])):F("",!0),i==h(f).length-1?(c(),m("div",te,[o(l,{type:"button",color:"success",label:"More",onClick:n=>
1B("tier_more",u.id),class:V("mr-5 shadow-lg shadow-green-600/50")},null,8,["onClick"])])):F("",!0)])]))),128)),x.action=="add"?(c(!0),m(T,{key:0},$(h(b),(u,i)=>(c(),m("div",{key:"newtier"+i,class:"m-2 p-2 rounded-md bg-sky-50"},[o(r,{class:"mb-3"},{default:_(()=>[o(s,{modelValue:u.target,"onUpdate:modelValue":n=>u.target=n,type:"text",maxlength:"10",label:"Target",id:"newTarget"+i,name:"newTarget"+i,labelFor:"newTarget"+i,required:!0,isCurrency:!0,tooltip:"Total sales from direct downline",onKeypress:a[3]||(a[3]=n=>t.$isNumberWithDot(n))},null,8,["modelValue","onUpdate:modelValue","id","name","labelFor"])]),_:2},1024),o(k,{class:"mx-3"}),(c(!0),m(T,null,$(u.incentiveList,(n,d)=>(c(),m("div",{key:"newincentive"+i+d},[o(s,{modelValue:n.amount,"onUpdate:modelValue":y=>n.amount=y,type:"text",maxlength:"10",label:t.$currency+", "+n.name+" ("+n.type+")",id:"new"+i+d,name:"new"+i+d,labelFor:"new"+i+d,labelSize:"w-80",required:!0,isCurrency:!0,onKeypress:a[4]||(a[4]=y=>t.$isNumberWithDot(y))},null,8,["modelValue","onUpdate:modelValue","label","id","name","labelFor"])]))),128)),P("div",ae,[h(b).length!=1?(c(),m("div",ne,[o(l,{type:"button",color:"danger",label:"Delete",onClick:n=>B("new_tier_delete",u.id),class:V("mr-5 shadow-lg shadow-red-600/50")},null,8,["onClick"])])):F("",!0),i==h(b).length-1?(c(),m("div",le,[o(l,{type:"button",color:"success",label:"More",onClick:n=>
1B("new_tier_more",u.id),class:V("mr-5 shadow-lg shadow-green-600/50")},null,8,["onClick"])])):F("",!0)])]))),128)):F("",!0),o(r,{class:"flex flex-row w-full justify-end mt-[3rem] pr-[2rem]"},{default:_(()=>[o(K,null,{default:_(()=>[o(l,{type:"button",color:"warning",outline:"",label:"Back",class:"shadow-lg shadow-yellow-600/50",onClick:a[5]||(a[5]=u=>B("back"))}),o(l,{type:"submit",color:"info",label:"Submit",class:V(["bg-blue-600 shadow-lg shadow-blue-600/50",{"opacity-25":w.processing}]),disabled:w.processing},null,8,["class","disabled"])]),_:1})]),_:1})]),_:1})],64)}}};export{pe 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.