PageSourceSearch

https://translayte.com/build/assets/partner-discount-index-DGWJoXW7.js

js translayte.com collected 2026-09-28 09:29:51 UTC 3,157 bytes, 1 lines download raw bytes

1import{V as i}from"./vendor-rOs9tNHD.js";i.component("partner-discount-index",{props:["user","stripe_url","paypal_url","currencies"],data(){return{discounts:[],pagination:{},status:"",loading:!1,search:"",showSearch:!1,editMode:!1,activePayment:{},activeIndex:"",formError:"",form:new SparkForm({name:this.user.name,email:this.user.email,code:"",percent_off:"",amount_off:"",currency_code:"GBP",max_redemptions:"",expires_by:moment().add(30,"days").format("DD/MM/YYYY"),type:"admin"}),options:{format:"DD/MM/YYYY",useCurrent:!0}}},methods:{fetchDiscountCodes(e,t){const s=this;let r=e||"/api/partners/discounts",o={};s.loading=!0,s.showSearch&&s.search?o.search=s.search:t&&(o.status=t),axios.get(r,{params:o}).then(a=>{s.discounts=a.data.data,s.makePagination(a.data),s.loading=!1})},makePagination(e){let t={current_page:e.current_page,last_page:e.last_page,next_page_url:e.next_page_url,prev_page_url:e.prev_page_url};this.pagination=t},createDiscountCode(){this.editMode=!1,$("#discountModal").modal("show"),this.form.code="",this.form.percent_off="",this.form.amount_off="",this.form.currency_code="GBP",this.form.max_redemptions="",this.form.expires_by=moment().add(30,"days").format("DD/MM/YYYY"),this.formError=""},editDiscountCode(e,t){this.editMode=!0,$("#discountModal").modal("show"),this.activePayment=e,this.activeIndex=t,this.form.code=e.code,this.form.percent_off=e.percent_off,this.form.amount_off=e.amount_off,this.form.currency_code=e.currency_code,this.form.max_redemptions=e.max_redemptions,this.form.expires_by=moment(new Date(e.expires_by)).format("DD/MM/YYYY"),this.formError=""},clearSearch(){this.search="",this.showSearch=!1,this.fetchDiscountCodes()},storeDiscountCode(){const e=this;axios.post("/api/partners/discounts",this.form).then(t=>{t.data.success&&(e.discounts.push(t.data.discount),$("#discountModal").modal("hide"),swal("Success!","Discount code created successfully.","success"))}).catch(t=>{var s,r;e.form.busy=!1,(r=(s=t==null?void 0:t.response)==null?void 0:s.data)!=null&&r.errors&&e.form.setErrors(t.response.data.errors)})},updateDiscountCode(e){const t=this;axios.patch("/api/partners/discounts/"+e,this.form).then(s=>{$("#discountModal").modal("hide"),s.data.success&&t.discounts.splice(t.activeIndex,1,s.data.discount)}).catch(s=>{t.formError=s.message,t.form.setErrors(s.response.data.errors)})},deleteDiscountCode(e,t){swal({title:"Delete Discount Code",text:`Are you sure you want to delete this discount code ${e.code}`,icon:"warning",buttons:!0,dangerMode:!0}).then(s=>{if(s){const r=this;axios.delete("/api/discounts/"+e.id).then(o=>{var a;o.data.success?r.discounts.splice(t,1):((a=o==null?void 0:o.data)==null?void 0:a.message)==="discount_code_order_exists"?swal({text:this.trans("Discount code with already existing order(s) cannot be deleted"),icon:"error",toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0}):swal({title:"Error",text:"An error occured. Discount code could not be deleted",icon:"error",dangerMode:!0,toast:!0,position:"top-end"})}).catch(o=>{r.formError=o.message,r.form.setErrors(o.response.data.errors)})}})}},mounted(){this.fetchDiscountCodes()}});

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.