var pikadayDefaults={format:"YYYY-MM-DD",minDate:new Date},vc_pickaday={props:{value:{required:!0},options:{"default":function(){return{}}},placeholder:"",arialabel:"",toggle:{type:Boolean,"default":!1}},template:'<input type="text" :value="value" :placeholder="placeholder" :aria-label="arialabel">',computed:{opts:function(){return $.extend({},pikadayDefaults,this.options)}},watch:{toggle:function(a){a?this.show():this.hide()}},mounted:function(){var a=this,b=this.opts;if(b.onSelect){var c=b.onSelect;
b.onSelect=function(){c(Array.from(arguments));a.change(this.toString())}}else b.onSelect=function(){a.change(this.toString())};b.field=this.$el;this.pikaday=new Pikaday(b);console.log(this.pikaday)},beforeDestroy:function(){this.pikaday.destroy()},methods:{change:function(a){this.$emit("input",a)},show:function(){this.pikaday.show()},hide:function(){this.pikaday.hide()}}},giftcardVue=new Vue({el:"#v-giftcard",store:vo_store,data:{itemkey:"",cardtype:"GIFTCARD",amount:20,recipientname:"",recipientemail:"",
sendername:"",message:"",senddate:moment().format("DD/MM/YYYY"),errors:[]},components:{pickaday:vc_pickaday},computed:{isdigital:function(){return"EGIFTCARD"==this.cardtype},recentlyadded:function(){return this.$store.state.recentlyadded},canpreview:function(){return""!=this.recipientname&&""!=this.sendername&&""!=this.message&&20<=this.amount},charactersremaining:function(){return"undefined"===typeof this.message?140:140-(""+this.message).length}},watch:{amount:function(){this.errors.amount=""},
recipientname:function(){this.errors.recipientname=""},recipientemail:function(){this.errors.recipientemail=""},sendername:function(){this.errors.sendername=""},senddate:function(){this.errors.senddate=""}},methods:{addtocart:function(){var a=this;$.ajax("_ps/api/giftcardapi/addtocart",{data:JSON.stringify(this.$data),type:"POST",processData:!1,contentType:"application/json"}).done(function(b){a.errors=b.errors;b.status?a.$store.dispatch("addgiftcardtocart",{data:b.giftcard,key:a.itemkey}).then(function(){$.getJSON("/cart-actions",
{a:"getcartslider"},function(a){a.success?($(".slidingCartWrap").html(a.content),$(".cartWrapToggler").click(),$(".cartQty").html(a.itemcount)):alert(a.message)});$("html, body").animate({scrollTop:$("body").offset().top},1E3)}):$("html, body").animate({scrollTop:$(".dollarInput").offset().top-150},1E3)})}},created:function(){this.$store.dispatch("setcheckoutdata")}});