github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/static/bv/js/vote.0660b72c.js (about) 1 (function(t){function e(e){for(var n,i,s=e[0],u=e[1],c=e[2],p=0,f=[];p<s.length;p++)i=s[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&f.push(o[i][0]),o[i]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n]);l&&l(e);while(f.length)f.shift()();return a.push.apply(a,c||[]),r()}function r(){for(var t,e=0;e<a.length;e++){for(var r=a[e],n=!0,s=1;s<r.length;s++){var u=r[s];0!==o[u]&&(n=!1)}n&&(a.splice(e--,1),t=i(i.s=r[0]))}return t}var n={},o={vote:0},a=[];function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=n,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/static/bv/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],u=s.push.bind(s);s.push=e,s=s.slice();for(var c=0;c<s.length;c++)e(s[c]);var l=u;a.push([7,"chunk-vendors","chunk-common"]),r()})({7:function(t,e,r){t.exports=r("7f8b")},"7f8b":function(t,e,r){"use strict";r.r(e);r("e260"),r("e6cf"),r("cca6"),r("a79d"),r("0cdd");var n=r("2b0e"),o=(r("135e"),function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("base-app",{attrs:{title:t.title}},[t.output?r("success",{attrs:{output:t.output}}):t._e(),t.output?r("error",{attrs:{output:t.output}}):t._e(),r("b-container",{staticClass:"my-2 mb-3 mx-auto"},[r("b-card",{attrs:{"body-class":"py-3 px-3"}},[r("b-card-title",[r("b-row",[r("b-col",[t._v(" Votes en cours "),t.votesCourants>0?r("b-badge",{attrs:{variant:"fushia"}},[t._v(" "+t._s(t.votesCourants)+" ")]):t._e()],1),r("b-col",{staticClass:"text-right"},[r("b-button",{attrs:{href:t.urlExportVotes,target:"_blank",variant:"info",title:"Télécharger au format PDF"}},[r("b-icon-download"),t._v(" Capture ")],1),r("b-button",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip"}],staticClass:"ml-2",attrs:{variant:"light",title:"Rafraichir les données"},on:{click:t.refresh}},[r("b-icon-arrow-repeat")],1)],1)],1)],1),r("b-overlay",{attrs:{show:t.loading}},[r("b-card-text",t._l(t.votes,(function(e,n){return r("b-card",{key:n,staticClass:"my-2"},[r("b-card-title",[t._v(" "+t._s(e.nom)+" "),e.is_locked?r("b-badge",{attrs:{variant:"warning"}},[t._v("Vote cloturé")]):t._e()],1),r("b-card-sub-title",{staticClass:"mb-2"},[t._v(" "+t._s(e.description))]),r("b-card-text",[r("div",{staticClass:"border rounded border-secondary px-2 pt-2"},[r("b-form-group",{scopedSlots:t._u([{key:"label",fn:function(){return[t._v(" Mon vote "),t.hasVoted(e)?r("b-badge",[t._v(" dernier vote : "+t._s(t.formatDateTime(e.time))+" ")]):t._e()]},proxy:!0}],null,!0)},[e.is_qcm?r("b-form-checkbox-group",{attrs:{checked:e.choix||[],options:t.getItems(e),disabled:e.is_locked},on:{change:function(r){return t.onCheckboxInputVote(e,r)}}}):r("b-form-radio-group",{attrs:{options:t.getItems(e),checked:t.radioChecked(e.choix),disabled:e.is_locked},on:{change:function(r){return t.onRadioInputVote(e,r)}}})],1)],1)]),r("b-row",[r("b-col",[r("b-button",{attrs:{variant:t.isVoteDeletable(e)?"danger":"light",disabled:!t.isVoteDeletable(e)},on:{click:function(r){return t.resetVote(e)}}},[t._v("Effacer mon vote")])],1),r("b-col",{staticClass:"text-right"},[r("b-button",{attrs:{variant:t.isVoteDoable(e)?"success":"light",disabled:!t.isVoteDoable(e)},on:{click:function(r){return t.save(e)}}},[t._v("Enregistrer mon vote")])],1)],1)],1)})),1)],1)],1)],1)],1)}),a=[],i=(r("4de4"),r("d81d"),r("96cf"),r("1da1")),s=r("d4ec"),u=r("bee2"),c=r("262e"),l=r("2caf"),p=r("9ab4"),f=r("2fe1"),b=r("3b54"),d=r("c658"),v=r("9dc9"),h=r("fc87"),g=r("bc3a"),m=r.n(g),y=Object(h["c"])(),k=function(t){Object(c["a"])(r,t);var e=Object(l["a"])(r);function r(){return Object(s["a"])(this,r),e.apply(this,arguments)}return Object(u["a"])(r,[{key:"getVotes",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.a.post(y);case 3:return e=t.sent,t.abrupt("return",e.data);case 7:t.prev=7,t.t0=t["catch"](0),this.notifications.onAxiosError(t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));function e(){return t.apply(this,arguments)}return e}()},{key:"doVote",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.a.put(y,e);case 3:return r=t.sent,t.abrupt("return",r.data);case 7:t.prev=7,t.t0=t["catch"](0),this.notifications.onAxiosError(t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));function e(e){return t.apply(this,arguments)}return e}()},{key:"resetVote",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.a.delete(y,{params:{id:e}});case 3:return r=t.sent,t.abrupt("return",r.data);case 7:t.prev=7,t.t0=t["catch"](0),this.notifications.onAxiosError(t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));function e(e){return t.apply(this,arguments)}return e}()}]),r}(h["a"]),x=new k,w=r("da10"),_=function(t){Object(c["a"])(r,t);var e=Object(l["a"])(r);function r(){var t;return Object(s["a"])(this,r),t=e.apply(this,arguments),t.personne=Object(w["c"])(),t.output=x.notifications,t.loading=!1,t.votes=[],t.formatDateTime=w["h"],t.urlExportVotes=y+"/export",t}return Object(u["a"])(r,[{key:"created",value:function(){this.refresh()}},{key:"refresh",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return this.loading=!0,t.next=3,x.getVotes();case 3:if(e=t.sent,this.loading=!1,void 0!=e){t.next=7;break}return t.abrupt("return");case 7:this.votes=e||[],x.notifications.success={title:"Propositions",message:"Propositions chargées"};case 9:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}()},{key:"getItems",value:function(t){return(t.candidats||[]).map((function(t){return{value:t.id,text:t.label}}))}},{key:"hasVoted",value:function(t){return!Object(w["o"])(t.time)}},{key:"isVoteDeletable",value:function(t){return!t.is_locked&&this.hasVoted(t)}},{key:"isVoteDoable",value:function(t){return!t.is_locked&&t.isDirty}},{key:"onCheckboxInputVote",value:function(t,e){t.choix=e,t.isDirty=!0}},{key:"radioChecked",value:function(t){return t=t||[],t.length>0?t[0]:null}},{key:"onRadioInputVote",value:function(t,e){t.choix=null==e?[]:[e],t.isDirty=!0}},{key:"save",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return this.loading=!0,t.next=3,x.doVote(e);case 3:if(r=t.sent,this.loading=!1,void 0!=r){t.next=7;break}return t.abrupt("return");case 7:this.votes=r||[],x.notifications.success={title:"Vote",message:"Votre vote a bien été enregistré. Merci !"};case 9:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}()},{key:"resetVote",value:function(){var t=Object(i["a"])(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return this.loading=!0,t.next=3,x.resetVote(e.id);case 3:if(r=t.sent,this.loading=!1,void 0!=r){t.next=7;break}return t.abrupt("return");case 7:this.votes=r||[],x.notifications.success={title:"Suppression",message:"Votre vote a bien été effacé."};case 9:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}()},{key:"title",get:function(){return null==this.personne?"":"Page de vote de "+this.personne.prenom_nom}},{key:"votesCourants",get:function(){return this.votes.filter((function(t){return Object(w["o"])(t.time)})).length}}]),r}(n["default"]);_=p["a"]([Object(f["b"])({components:{BaseApp:b["a"],Success:d["a"],Error:v["a"]}})],_);var O=_,j=O,V=r("2877"),C=Object(V["a"])(j,o,a,!1,null,null,null),R=C.exports;n["default"].config.productionTip=!1,new n["default"]({render:function(t){return t(R)}}).$mount("#app")}}); 2 //# sourceMappingURL=vote.0660b72c.js.map