text: (window.webpackJsonp=window.webpackJsonp||[]).push([[8],{22:function(e,t,n){"use strict";n.r(t);var s=n(0),a=n.n(s);function r(e,t,n,s,a,r,i){try{var o=e[r](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(s,a)}function i(e){return function(){var t=this,n=arguments;return new Promise(function(s,a){var i=e.apply(t,n);function o(e){r(i,s,a,o,c,"next",e)}function c(e){r(i,s,a,o,c,"throw",e)}o(void 0)})}}var o={created:function(){var e=i(a.a.mark(function e(){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(Object.keys(this.$store.getters["pages/pages"]).length<=2)){e.next=6;break}return this.$store.commit("loading/SET_LOADING",!0),e.next=5,this.$store.dispatch("pages/fetchPages");case 5:this.$store.commit("loading/SET_LOADING",!1);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("error: ",e.t0),this.$store.commit("loading/SET_LOADING",!1);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}(),data:function(){return{sortBy:"id",sortDesc:!0,fields:[{key:"id",label:"ID",sortable:!0},{key:"name",label:"Nom",sortable:!0},{key:"slug",label:"Slug",sortable:!0},{key:"sections",label:"Sections",sortable:!1},{key:"content",label:"Contenu",sortable:!1},{key:"is_published",label:"Publié?",sortable:!0},{key:"updated_at",label:"Dernière modification",sortable:!0},{key:"actions",sortable:!1}]}},computed:{loading:function(){return this.$store.getters["loading/loading"]},pages:function(){return this.$store.getters["pages/pages"]},pagesArray:function(){var e=[];for(var t in this.pages)this.pages.hasOwnProperty(t)&&null!=this.pages[t]&&e.push(this.pages[t]);return e}},methods:{deletePage:function(){var e=i(a.a.mark(function e(t){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$bvModal.msgBoxConfirm("Etes-vous sûr de vouloir supprimer la page ".concat(t.name,"?"),{okTitle:"Oui",cancelTitle:"Annuler"});case 3:if(!e.sent){e.next=8;break}return e.next=7,this.$store.dispatch("pages/deletePage",{pageId:t.id});case 7:this.$noty.success("Page supprimée avec succès!");case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.log("error: ",e.t0),this.$noty.error("Une erreur est survenue et la page n'a pas pu être supprimée.");case 14:case"end":return e.stop()}},e,this,[[0,10]])}));return function(t){return e.apply(this,arguments)}}()}},c=(n(300),n(2)),l=Object(c.a)(o,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("b-container",[n("b-breadcrumb",[n("b-breadcrumb-item",{attrs:{active:""}},[n("font-awesome-icon",{attrs:{icon:"file"}}),e._v(" Pages")],1)],1),e._v(" "),n("h2",{staticClass:"text-center"},[e._v("Gestion des pages")]),e._v(" "),n("b-alert",{attrs:{show:"",dismissible:"",variant:"info"}},[e._v('Les pages correspondent aux éléments de la barre de menu. Chaque page est composée d\'une ou plusieurs sections, mais peut également avoir son propre contenu (colonne\n        "Contenu").')]),e._v(" "),n("b-button",{staticClass:"my-3",attrs:{to:"/admin/pages/create",variant:"primary"}},[e._v("Créer une nouvelle page")]),e._v(" "),e.loading?e._e():n("b-table",{staticClass:"nowrap",attrs:{responsive:"sm","show-empty":"",small:"",stacked:"md",items:e.pagesArray,fields:e.fields,"sort-by":e.sortBy,"sort-desc":e.sortDesc},on:{"update:sortBy":function(t){e.sortBy=t},"update:sort-by":function(t){e.sortBy=t},"update:sortDesc":function(t){e.sortDesc=t},"update:sort-desc":function(t){e.sortDesc=t}},scopedSlots:e._u([{key:"cell(sections)",fn:function(t){return e._l(t.item.sections,function(t){return n("div",{key:t.id},[n("router-link",{attrs:{to:"/admin/sections/"+t.id+"/edit"}},[e._v(e._s(t.name))])],1)})}},{key:"cell(content)",fn:function(t){return[e._v("\n            "+e._s(t.item.content?t.item.content.substring(0,20)+" ...":"-")+"\n        ")]}},{key:"cell(is_published)",fn:function(t){return[t.item.is_published?n("span",{staticClass:"text-success"},[e._v("\n                Oui\n            ")]):n("span",{staticClass:"text-danger"},[e._v("\n                Non\n            ")])]}},{key:"cell(updated_at)",fn:function(t){return[e._v("\n            "+e._s(e._f("moment")(t.item.updated_at,"from","now"))+"\n        ")]}},{key:"cell(actions)",fn:function(t){return[n("router-link",{staticClass:"btn btn-warning",staticStyle:{display:"inline-block"},attrs:{to:"/admin/pages/"+t.item.id}},[n("font-awesome-icon",{attrs:{icon:"eye"}})],1),e._v(" "),n("router-link",{staticClass:"btn btn-success",staticStyle:{display:"inline-block"},attrs:{to:"/admin/pages/"+t.item.id+"/edit"}},[n("font-awesome-icon",{attrs:{icon:"edit"}})],1),e._v(" "),n("button",{staticClass:"btn btn-danger",on:{click:function(n){return e.deletePage(t.item)}}},[n("font-awesome-icon",{attrs:{icon:"trash"}})],1)]}}],null,!1,3924083889)}),e._v(" "),e.loading?n("b-row",{staticClass:"justify-content-center"},[n("b-spinner",{attrs:{variant:"primary",label:"Spinning"}})],1):e._e()],1)},[],!1,null,"67a983b8",null);t.default=l.exports},300:function(e,t,n){"use strict";var s=n(51);n.n(s).a},301:function(e,t,n){(e.exports=n(6)(!1)).push([e.i,"\n.table.b-table > thead > tr > [aria-sort][data-v-67a983b8]:not(.b-table-sort-icon-left) {\r\n    vertical-align: middle;\n}\n.inline-block[data-v-67a983b8] {\r\n    display: inline-block;\n}\n.nowrap[data-v-67a983b8] {\r\n    white-space: nowrap;\n}\r\n",""])},51:function(e,t,n){var s=n(301);"string"==typeof s&&(s=[[e.i,s,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(7)(s,a);s.locals&&(e.exports=s.locals)}}]);