text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["Profile"],{"12b6":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("LotteryArchive")},r=[],i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-container",[a("LotteryList",{attrs:{"call-result":t.callResult,ethereumData:null!=t.ethereumData?t.ethereumData[0]:null,archive:"",projectData:t.projectData}})],1)},s=[],o=a("3835"),l=a("1da1"),c=(a("d3b7"),a("159b"),a("25f0"),a("96cf"),a("8169")),u=a("20ef"),d=a("14b0"),h={name:"LotteryArchive",components:{LotteryList:c["a"]},data:function(){return{ethereumData:[],projectData:[],account:null,callResult:{loading:!1,error:null}}},created:function(){var t=this;return Object(l["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.$xapi.get("https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&ids=ethereum").then((function(e){t.ethereumData=e.data})),e.next=3,t.getAddress();case 3:return e.next=5,t.getClosedProjects();case 5:case"end":return e.stop()}}),e)})))()},methods:{getAddress:function(){var t=this;this.$web3.eth.getAccounts().then((function(e){var a=Object(o["a"])(e,1);t.account=a[0]}))},getClosedProjects:function(){var t=this;this.callResult.loading=!0,d["a"].methods.returnClosedProjects().call().then((function(e){e.forEach((function(e){var a=Object(u["a"])(e),n=null;a.methods.getDetails(t.account).call().then((function(e){n=e,n.isLoading=!1,n.contract=a,n.ticketPrice=t.$web3.utils.fromWei(n.ticketPrice,"ether"),n.deadlineTime=n.deadlineTime.toString()+"000",n.lotteryDateCreated=n.lotteryDateCreated.toString()+"000",t.projectData.push(n)})).catch((function(t){})).finally((function(){t.callResult.loading=!1})),a.methods.getPlayersDetails().call().then((function(t){n.players=t.lotteryPlayers,n.tickets=t.lotteryTickets})).catch((function(t){}))}))})).catch((function(t){})).finally((function(){t.callResult.loading=!1}))}}},f=h,p=a("2877"),v=a("6544"),m=a.n(v),y=a("a523"),b=Object(p["a"])(f,i,s,!1,null,null,null),g=b.exports;m()(b,{VContainer:y["a"]});var w={name:"ArchiveView",components:{LotteryArchive:g}},_=w,x=Object(p["a"])(_,n,r,!1,null,null,null);e["default"]=x.exports},"1f09":function(t,e,a){},3129:function(t,e,a){"use strict";var n=a("3835"),r=a("5530"),i=(a("ac1f"),a("1276"),a("d81d"),a("a630"),a("3ca3"),a("5319"),a("1f09"),a("c995")),s=a("24b2"),o=a("7560"),l=a("58df"),c=a("80d2");e["a"]=Object(l["a"])(i["a"],s["a"],o["a"]).extend({name:"VSkeletonLoader",props:{boilerplate:Boolean,loading:Boolean,tile:Boolean,transition:String,type:String,types:{type:Object,default:function(){return{}}}},computed:{attrs:function(){return this.isLoading?this.boilerplate?{}:Object(r["a"])({"aria-busy":!0,"aria-live":"polite",role:"alert"},this.$attrs):this.$attrs},classes:function(){return Object(r["a"])(Object(r["a"])({"v-skeleton-loader--boilerplate":this.boilerplate,"v-skeleton-loader--is-loading":this.isLoading,"v-skeleton-loader--tile":this.tile},this.themeClasses),this.elevationClasses)},isLoading:function(){return!("default"in this.$scopedSlots)||this.loading},rootTypes:function(){return Object(r["a"])({actions:"button@2",article:"heading, paragraph",avatar:"avatar",button:"button",card:"image, card-heading","card-avatar":"image, list-item-avatar","card-heading":"heading",chip:"chip","date-picker":"list-item, card-heading, divider, date-picker-options, date-picker-days, actions","date-picker-options":"text, avatar@2","date-picker-days":"avatar@28",heading:"heading",image:"image","list-item":"text","list-item-avatar":"avatar, text","list-item-two-line":"sentences","list-item-avatar-two-line":"avatar, sentences","list-item-three-line":"paragraph","list-item-avatar-three-line":"avatar, paragraph",paragraph:"text@3",sentences:"text@2",table:"table-heading, table-thead, table-tbody, table-tfoot","table-heading":"heading, text","table-thead":"heading@6","table-tbody":"table-row-divider@6","table-row-divider":"table-row, divider","table-row":"table-cell@6","table-cell":"text","table-tfoot":"text@2, avatar@2",text:"text"},this.types)}},methods:{genBone:function(t,e){return this.$createElement("div",{staticClass:"v-skeleton-loader__".concat(t," v-skeleton-loader__bone")},e)},genBones:function(t){var e=this,a=t.split("@"),r=Object(n["a"])(a,2),i=r[0],s=r[1],o=function(){return e.genStructure(i)};return Array.from({length:s}).map(o)},genStructure:function(t){var e=[];t=t||this.type||"";var a=this.rootTypes[t]||"";if(t===a);else{if(t.indexOf(",")>-1)return this.mapBones(t);if(t.indexOf("@")>-1)return this.genBones(t);a.indexOf(",")>-1?e=this.mapBones(a):a.indexOf("@")>-1?e=this.genBones(a):a&&e.push(this.genStructure(a))}return[this.genBone(t,e)]},genSkeleton:function(){var t=[];return this.isLoading?t.push(this.genStructure()):t.push(Object(c["t"])(this)),this.transition?this.$createElement("transition",{props:{name:this.transition},on:{afterEnter:this.resetStyles,beforeEnter:this.onBeforeEnter,beforeLeave:this.onBeforeLeave,leaveCancelled:this.resetStyles}},t):t},mapBones:function(t){return t.replace(/\s/g,"").split(",").map(this.genStructure)},onBeforeEnter:function(t){this.resetStyles(t),this.isLoading&&(t._initialStyle={display:t.style.display,transition:t.style.transition},t.style.setProperty("transition","none","important"))},onBeforeLeave:function(t){t.style.setProperty("display","none","important")},resetStyles:function(t){t._initialStyle&&(t.style.display=t._initialStyle.display||"",t.style.transition=t._initialStyle.transition,delete t._initialStyle)}},render:function(t){return t("div",{staticClass:"v-skeleton-loader",attrs:this.attrs,on:this.$listeners,class:this.classes,style:this.isLoading?this.measurableStyles:void 0},[this.genSkeleton()])}})},8169:function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-container",{attrs:{"fill-height":"",fluid:""}},[t.callResult.loading?a("v-sheet",{staticClass:"pa-3",attrs:{color:"grey lighten-2"}},[a("v-skeleton-loader",{attrs:{type:"card"}})],1):t._e(),a("v-row",{attrs:{justify:"center"}},t._l(t.projectData,(function(e){return a("v-col",{key:e.projectTitle},[a("LotteryCard",{attrs:{ethereumData:t.ethereumData,archive:t.archive,lottery:e}})],1)})),1)],1)},r=[],i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-card",{staticClass:"rounded-lg",staticStyle:{width:"450px"},attrs:{color:"blue lighten-1",elevation:"0",height:"300"}},[a("v-card-title",{staticClass:"white--text subtitle-2"},[t._v(t._s(t.lottery.projectTitle))]),a("v-card-text",[a("v-row",{staticClass:"text-center"},[a("v-col",[a("span",{staticClass:"title white--text"},[t._v("Jackpot "),a("br")]),a("span",{staticClass:"headline white--text"},[t._v(" "+t._s(t.calculateEthAmount())+" "+t._s(null!=this.ethereumData?this.ethereumData.symbol:""))]),a("br"),a("span",{staticClass:"subtitle-1 white--text"},[t._v(" "+t._s(t.calculateEthPrice())+" ")]),a("br"),a("span",{staticClass:"subtitle-1 white--text"},[t._v(" "+t._s(t.lottery.lotteryRewards.length)+" winners ")])])],1),a("v-row",{staticClass:"text-center"},[a("v-col",{staticClass:"white--text"},[a("div",[t._v(" "+t._s(t._f("two_digits")(t.days))+" days "+t._s(t._f("two_digits")(t.hours))+":"+t._s(t._f("two_digits")(t.minutes))+":"+t._s(t._f("two_digits")(t.seconds))+" ")])])],1)],1),a("v-card-actions",{staticClass:"justify-center"},[a("v-chip",{attrs:{color:"accent","text-color":"white"},on:{click:function(e){return t.lotteryDetail(t.lottery)}}},[t._v(t._s(t.getBtnLabel()))])],1)],1)},s=[],o=a("5530"),l=(a("b65f"),a("b680"),{name:"LotteryCard",data:function(){return{now:Math.trunc((new Date).getTime()/1e3)}},props:{ethereumData:{type:Object,default:null},lottery:{type:Object,required:!0},archive:{type:Boolean,default:!1}},computed:{dateInMilliseconds:function(){return Math.trunc(Date.parse(this.formatDateToTimer(this.lottery.deadlineTime))/1e3)},seconds:function(){return(this.dateInMilliseconds-this.now)%60},minutes:function(){return Math.trunc((this.dateInMilliseconds-this.now)/60)%60},hours:function(){return Math.trunc((this.dateInMilliseconds-this.now)/60/60)%24},days:function(){return Math.trunc((this.dateInMilliseconds-this.now)/60/60/24)}},mounted:function(){var t=this;window.setInterval((function(){t.now=Math.trunc((new Date).getTime()/1e3)}),1e3)},methods:{calculateEthAmount:function(){return parseFloat(this.$web3.utils.fromWei(this.lottery.currentAmount,"ether")).toFixed(3)},calculateEthPrice:function(){var t=null!=this.ethereumData?parseFloat(this.ethereumData.current_price)*this.$web3.utils.fromWei(this.lottery.currentAmount,"ether"):0;return t.toFixed(2)+"€"},formatDateToTimer:function(t){return this.$utils.formatDateToTimer(new Date(+t))},getLotteryStatus:function(){return this.lottery.deadlineTime<(new Date).getTime()?"closed":"open"},getBtnLabel:function(){return this.archive?"See Details":"Get tickets from "+this.lottery.ticketPrice+" ETH"},lotteryDetail:function(t){this.$router.push({name:"LotteryDetail",params:{address:this.lottery.contract._address,obj:Object(o["a"])({},t),ethData:Object(o["a"])({},this.ethereumData)}})}}}),c=l,u=a("2877"),d=a("6544"),h=a.n(d),f=a("b0af"),p=a("99d9"),v=a("cc20"),m=a("62ad"),y=a("0fd9"),b=Object(u["a"])(c,i,s,!1,null,"35712360",null),g=b.exports;h()(b,{VCard:f["a"],VCardActions:p["a"],VCardText:p["c"],VCardTitle:p["d"],VChip:v["a"],VCol:m["a"],VRow:y["a"]});var w={name:"LotteryList",components:{LotteryCard:g},props:{ethereumData:{type:Object,default:null},projectData:{type:Array,required:!0},archive:{type:Boolean,default:!1},callResult:{type:Object,required:!0}},methods:{closedOpenLabel:function(){return this.archive?"CLOSED":"OPEN"}}},_=w,x=a("a523"),D=a("8dd9"),C=a("3129"),j=Object(u["a"])(_,n,r,!1,null,null,null);e["a"]=j.exports;h()(j,{VCol:m["a"],VContainer:x["a"],VRow:y["a"],VSheet:D["a"],VSkeletonLoader:C["a"]})},c66d:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("AccountProfile")},r=[],i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticStyle:{"justify-content":"center",display:"grid"}},[a("v-card",{staticClass:"mx-auto"},[a("v-row",[a("v-col",{attrs:{md:"6"}},[a("v-card-title",[t._v(" Account ")]),a("v-card-subtitle",[t._v(" "+t._s(t.account)+" ")])],1),a("v-col",{attrs:{md:"6"}},[a("v-card-title",[t._v(" Balance ")]),t.profileInfo.rewardsWon?a("v-card-subtitle",[t._v(" "+t._s(t.profileInfo.rewardsWon)+" eth "),t.profileInfo.rewardsWon>0?a("v-icon",{attrs:{large:"",color:"green darken-2"}},[t._v(" mdi-chevron-up ")]):t.profileInfo.rewardsWon<0?a("v-icon",{attrs:{large:"",color:"red darken-2"}},[t._v(" mdi-chevron-down ")]):t._e()],1):t._e()],1)],1),a("v-card-title",[t._v(" Lottery Participated "),a("v-spacer"),a("v-text-field",{attrs:{"append-icon":"mdi-magnify",label:"Search","single-line":"","hide-details":""},model:{value:t.search,callback:function(e){t.search=e},expression:"search"}})],1),a("v-data-table",{attrs:{headers:t.headers,items:t.profileInfo.lotteryParticipated,search:t.search,"no-data-text":"No Data",loading:!t.callResult.finished},scopedSlots:t._u([{key:"item.funds",fn:function(e){var a=e.item;return[t._v(" "+t._s(parseFloat(t.$web3.utils.fromWei(a.funds,"ether")).toFixed(5))+" ")]}},{key:"item.amountWon",fn:function(e){var a=e.item;return[t._v(" "+t._s(parseFloat(t.$web3.utils.fromWei(a.amountWon,"ether")).toFixed(5))+" ")]}},{key:"item.state",fn:function(e){var a=e.item;return[t._v(" "+t._s(t.getState(a.state))+" ")]}}],null,!0)})],1)],1)},s=[],o=a("3835"),l=(a("d3b7"),a("b680"),a("14b0")),c={name:"AccountProfile",components:{},data:function(){return{account:null,callResult:{finished:!0,authorized:!1,error:null,info:null},search:"",headers:[{text:"Lottery address",align:"start",sortable:!1,value:"address"},{text:"Funds (eth)",align:"start",sortable:!0,value:"funds"},{text:"Tickets",align:"start",sortable:!0,value:"tickets"},{text:"State",align:"start",sortable:!0,value:"state"},{text:"Won",align:"start",sortable:!1,value:"won"},{text:"AmountWon",align:"start",sortable:!0,value:"amountWon"}],profileInfo:{lotteryParticipated:[],rewardsWon:0}}},created:function(){this.getData()},methods:{getState:function(t){return 0==t?"Open":"Closed"},getData:function(){var t=this;this.$web3.eth.getAccounts().then((function(e){var a=Object(o["a"])(e,1);t.account=a[0],t.callResult.finished=!1,l["a"].methods.participatedByAddress(t.account).call().then((function(e){for(var a=0;a<e[0].length;a++){t.winner={};var n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],l=e[5],c={};c.address=n[a],c.funds=r[a],c.tickets=i[a],c.state=s[a],c.won=o[a],c.amountWon=l[a],t.profileInfo.lotteryParticipated.push(c),t.callResult.finished=!0}})).catch((function(e){t.callResult.error=e})).finally((function(){return t.callResult.finished=!0})),l["a"].methods.getRewardsWonByAddress(t.account).call().then((function(e){t.profileInfo.rewardsWon=t.$web3.utils.fromWei(e,"ether"),l["a"].methods.getSpentState(t.account).call().then((function(e){t.profileInfo.rewardsWon-=t.$web3.utils.fromWei(e,"ether"),t.profileInfo.rewardsWon=t.profileInfo.rewardsWon.toFixed(4)}))}))}))}}},u=c,d=a("2877"),h=a("6544"),f=a.n(h),p=a("b0af"),v=a("99d9"),m=a("62ad"),y=a("8fea"),b=a("132d"),g=a("0fd9"),w=a("2fa4"),_=a("8654"),x=Object(d["a"])(u,i,s,!1,null,null,null),D=x.exports;f()(x,{VCard:p["a"],VCardSubtitle:v["b"],VCardTitle:v["d"],VCol:m["a"],VDataTable:y["a"],VIcon:b["a"],VRow:g["a"],VSpacer:w["a"],VTextField:_["a"]});var C={name:"AccountProfileView",components:{AccountProfile:D}},j=C,k=Object(d["a"])(j,n,r,!1,null,null,null);e["default"]=k.exports}}]);
  //# sourceMappingURL=Profile.9d0b0d48.js.map