1import{a as oe,b as ce}from"./chunk-M7LBFLIX.js";import{a as Q,b as se}from"./chunk-ZEONSQ4A.js";import"./chunk-5PW3IXDN.js";import{A as ae,C as le,c as X,k as Z,l as ee,n as te,p as ie,q as ne}from"./chunk-TT2QA5N2.js";import"./chunk-6MOVM5NX.js";import{h as W,i as j,m as Y,n as H}from"./chunk-REXD3XXG.js";import"./chunk-XZTRQ27X.js";import{b as $,c as q,e as J,f as K}from"./chunk-OVGYRFXU.js";import{o as R,s as U,z}from"./chunk-MZWCCPRN.js";import{Cc as O,Dc as N,Ec as w,Ic as A,Jc as F,Nb as h,Ob as C,Oc as s,Pc as c,Qb as T,Qc as B,Rb as M,Sb as I,Tb as b,Ub as i,Vb as n,Wb as v,Z as L,bc as E,da as f,ea as x,fc as d,gb as t,hc as p,kb as P,lb as y,md as V,tc as S,td as G,ub as D,wc as r,xc as m,yc as _}from"./chunk-JXIB5BED.js";import{e as re}from"./chunk-J6LPXIX4.js";function ge(l,u){l&1&&(i(0,"div",13)(1,"span",27),v(2,"i",28),n()())}function _e(l,u){l&1&&(i(0,"div",14),r(1),s(2,"translate"),n()),l&2&&(t(),_(" ",c(2,1,"BLOG_ADMIN.EMPTY")," "))}function he(l,u){if(l&1){let e=E();i(0,"tr")(1,"td"),r(2),n(),i(3,"td"),r(4),n(),i(5,"td")(6,"span",30),r(7),n()(),i(8,"td"),r(9),s(10,"date"),n(),i(11,"td",29)(12,"button",31),s(13,"langLink"),i(14,"span",32),v(15,"i",33),n()(),i(16,"button",34),d("click",function(){let a=f(e).$implicit,g=p(2);return x(g.openDeleteModal(a))}),i(17,"span",32),v(18,"i",35),n()()()()}if(l&2){let e=u.$implicit,o=p(2);t(2),m(e.title),t(2),m(o.getCategoryLabel(e)),t(3),_(" ",e.language.toUpperCase()||"FR"," "),t(2),m(B(10,5,e.created_at,"
1short")),t(3),b("routerLink",c(13,8,F(10,ue,e.id.toString())))}}function Ce(l,u){if(l&1&&(i(0,"table",15)(1,"thead")(2,"tr")(3,"th"),r(4),s(5,"translate"),n(),i(6,"th"),r(7),s(8,"translate"),n(),i(9,"th"),r(10),s(11,"translate"),n(),i(12,"th"),r(13),s(14,"translate"),n(),i(15,"th",29),r(16),s(17,"translate"),n()()(),i(18,"tbody"),M(19,he,19,12,"tr",null,T),n()()),l&2){let e=p();t(4),m(c(5,5,"BLOG_ADMIN.COL_TITLE")),t(3),m(c(8,7,"BLOG_ADMIN.COL_CATEGORY")),t(3),m(c(11,9,"BLOG_ADMIN.COL_LANGUAGE")),t(3),m(c(14,11,"BLOG_ADMIN.COL_CREATED_AT")),t(3),m(c(17,13,"BLOG_ADMIN.COL_ACTIONS")),t(3),I(e.articles)}}function fe(l,u){l&1&&(i(0,"li")(1,"span",40),r(2,"\u2026"),n()())}function xe(l,u){if(l&1){let e=E();i(0,"li")(1,"button",38),d("click",function(){let a=f(e).$implicit,g=p(2);return x(g.goToPage(a))}),r(2),n()()}if(l&2){let e=u.$implicit,o=p(2);t(),S("is-current",o.page===e),t(),_(" ",e," ")}}function be(l,u){l&1&&(i(0,"li")(1,"span",40),r(2,"\u2026"),n()())}function ve(l,u){if(l&1){let e=E();i(0,"li")(1,"button",38),d("click",function(){f(e);let a=p(2);return x(a.goToPage(a.totalPages))}),r(2),n()()}if(l&2){let e=p(2);t(),S("is-current",e.page===e.totalPages),t(),_(" ",e.totalPages," ")}}function Le(l,u){if(l&1){let e=E();i(0,"nav",16)(1,"ul",36)(2,"li")(3,"button",37),d("click",function(){f(e);let a=p();return x(a.goToPage(a.page-1))}),r(4," \u2039 "),n()(),i(5,"li")(6,"button",38),d("click",function(){f(e);let a=p();return x(a.goToPage(1))}),r(7," 1 "),n()(),h(8,fe,3,0,"li"),M(9,xe,3,3,"li",null,T),h(11,be,3,0,"li"),h(12,ve,3,3,"li"),i(13,"li")(14,"button",39),d("click",function(){f(e);let a=p();return x(a.goToPage(a.page+1))}),r(15," \u203A "),n()()()()}if(l&2){let e=p();t(3),b("disabled",e.page<=1),t(3),S("is-current",e.page===1),t(2),C(e.startPage>2?8:-1),t(),I(e.middlePages),t(2),C(e.endPage<e.totalPages-1?11:-1),t(),C(e.totalPages>1?12:-1),t(2),b("disabled",e.page>=e.totalPages)}}var de,pe,me,ue,Ve,Ee=re(()=>{G();z();H();le();K();ce();se();G();H();le();z();K();de=()=>({default:"Blog \u2013 Administration"}),pe=()=>["admin","blog","new"],me=()=>({default:"Rechercher un article..."}),ue=l=>["admin","blog",l,"edit"];Ve=(()=>{class l{service=L(oe);cdr=L(V);router=L(W);translate=L($);articles=[];loading=!1;page=1;pageSize=10;total=0;search=null;deleteModalOpen=!1;selectedArticle=null;cleaningUp=!1;cleanupResult=null;ngOnInit(){this.reload()}get totalPages(){return Math.max(1,Math.ceil(this.total/this.pageSize))}get startPage(){return Math.max(2,this.page-2)}get endPage(){return Math.min(this.totalPages-1,this.page+2)}get middlePages(){let e=[];for(let o=this.startPage;o<=this.endPage;o++)e.push(o);return e}goToPage(e){let o=Math.min(this.totalPages,Math.max(1,e));o!==this.page&&(this.page=o,this.reload())}onSearch(){this.reload({resetPage:!0})}reload(e){e?.resetPage&&(this.page=1),this.loading=!0,this.cdr.markForCheck(),this.service.list({page:this.page,pageSize:this.pageSize,search:this.search}).subscribe({next:o=>{this.articles=o.items??[],this.total=o.total,this.loading=!1,this.cdr.markForCheck()},error:()=>{this.loading=!1,this.cdr.markForCheck()}})}getCategoryLabel(e){let o=e.category;return o?this.translate.instant("BLOG_ADMIN.FORM.CATEGORY_"+String(o).toUpperCase(),{default:o}):"-"}openDeleteModal(e){this.selectedArticle=e,this.deleteModalOpen=!0}closeDeleteModal(){this.deleteModalOpen=!1,this.selectedArticle=null}confirmDelete(){this.selectedArticle&&this.service.delete(this.selectedArticle.id).subscribe({next:()=>{this.closeDeleteModal(),this.reload()}})}cleanupSlugs(){this.cleaningUp=!0,this.cleanupResult=null,this.cdr.markForCheck(),this.service.cleanupSlugs().subscribe({next:e=>{this.cleanupResult=e.updated,this.cleaningUp=!1,e.updated>0?this.reload():this.cdr.markForCheck()},error:()=>{this.cleaningUp=!1,this.cdr.markForCheck()}})}static \u0275fac=function(o){return new(o||l)};static \u0275cmp=D({type:l,selectors:[["app-blog-admin-list"]],decls:47,vars:37,consts:[[1,"container","my-6"],[1,"is-flex","is-justify-content-space-between","is-align-items-center","mb-4"],[1,"title","is-3","mb-0"],[1,"buttons"],[1,"button","is-link","is-2","shine-hover","mr-2","ml-2",3,"routerLink"],[1,"icon"],[1,"pi","pi-plus"],[1,"field","has-addons","mb-4",3,"ngSubmit"],[1,"control","is-expanded"],["type","search","name","search",1,"input",3,"ngModelChange","ngModel","placeholder"],[1,"control"],["type","submit",1,"button","is-light"],[1,"pi","pi-search"],[1,"has-text-centered","py-6"],[1,"n
1otification","is-light"],[1,"table","is-fullwidth","is-hoverable"],["role","navigation","aria-label","pagination",1,"pagination","is-centered","mt-4","is-small"],[1,"modal"],[1,"modal-background",3,"click"],[1,"modal-card"],[1,"modal-card-head"],[1,"modal-card-title"],["aria-label","close",1,"delete",3,"click"],[1,"modal-card-body"],[1,"modal-card-foot","is-justify-content-flex-end"],[1,"button",3,"click"],[1,"button","mr-2","ml-2","is-danger",3,"click"],[1,"icon","is-large"],[1,"pi","pi-spin","pi-spinner"],[1,"has-text-right"],[1,"tag","is-light","is-info","is-light"],[1,"button","is-small","is-light","mr-2","shine-hover",3,"routerLink"],[1,"icon","is-small"],[1,"pi","pi-pencil"],["type","button",1,"button","is-small","is-danger","is-light","shine-hover",3,"click"],[1,"pi","pi-trash"],[1,"pagination-list"],["type","button","aria-label","Page pr\xE9c\xE9dente",1,"pagination-link",3,"click","disabled"],["type","button",1,"pagination-link",3,"click"],["type","button","aria-label","Page suivante",1,"pagination-link",3,"click","disabled"],[1,"pagination-ellipsis"]],template:function(o,a){o&1&&(i(0,"section",0)(1,"div",1)(2,"h1",2),r(3),s(4,"translate"),n(),i(5,"div",3)(6,"button",4),s(7,"langLink"),i(8,"span",5),v(9,"i",6),n(),i(10,"span"),r(11),s(12,"translate"),n()()()(),i(13,"form",7),d("ngSubmit",function(){return a.onSearch()}),i(14,"div",8)(15,"input",9),s(16,"translate"),w("ngModelChange",function(k){return N(a.search,k)||(a.search=k),k}),n(),P(),n(),i(17,"div",10)(18,"button",11)(19,"span",5),v(20,"i",12),n()()()(),h(21,ge,3,0,"div",13),h(22,_e,3,3,"div",14),h(23,Ce,21,15,"table",15),h(24,Le,16,7,"nav",16),i(25,"div",17)(26,"div",18),d("click",function(){return a.closeDeleteModal()}),n(),i(27,"div",19)(28,"header",20)(29,"p",21),r(30),s(31,"translate"),n(),i(32,"button",22),d("click",function(){return a.closeDeleteModal()}),n()(),i(33,"section",23)(34,"p"),r(35),s(36,"translate"),i(37,"strong"),r(38),n(),r(39," ? "),n()(),i(40,"footer",24)(41,"button",25),d("click",function(){return a.closeDeleteModal()}),r(42),s(43,"translate"),n(),i(44,"button",26),d("click",function(){return a.confirmDelete()}),r(45),s(46,"translate"),n()()()()()),o&2&&(t(3),_(" ",B(4,16,"BLOG_ADMIN.TITLE",A(34,de))," "),t(3),b("routerLink",c(7,19,A(35,pe))),t(5),m(c(12,21,"BLOG_ADMIN.NEW_ARTICLE")),t(4),O("ngModel",a.search),b("placeholder",B(16,23,"BLOG_ADMIN.SEARCH_PLACEHOLDER",A(36,me))),y(),t(6),C(a.loading?21:-1),t(),C(!a.loading&&a.articles.length===0?22:-1),t(),C(!a.loading&&a.articles.length>0?23:-1),t(),C(!a.loading&&a.totalPages>1?24:-1),t(),S("is-active",a.deleteModalOpen),t(5),m(c(31,26,"BLOG_ADMIN.DELETE_TITLE")),t(5),_(" ",c(36,28,"BLOG_ADMIN.DELETE_CONFIRM")," "),t(3),m(a.selectedArticle?.title),t(4),_(" ",c(43,30,"COMMON.CANCEL")," "),t(3),_(" ",c(46,32,"COMMON.DELETE")," "))},dependencies:[U,Y,j,ae,ne,X,Z,ee,ie,te,J,R,q,Q],encapsulation:2})}return l})()});Ee();export{Ve as BlogAdminListComponent};
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.