1import{a as ne}from"./chunk-YUOM4OEN.js";import{a as ie}from"./chunk-HBTIAQWU.js";import{a as te}from"./chunk-IPKLJJ3K.js";import{a as ee}from"./chunk-ATXEZIPJ.js";import{a as Z}from"./chunk-QIOURN4K.js";import{a as X,b as Y}from"./chunk-M6YDMVQ7.js";import{a as j}from"./chunk-EB6TJ75L.js";import{D as Q,c as q,g as z,l as H,t as J,u as G,v as K}from"./chunk-FOJCKIWO.js";import{a as U}from"./chunk-NBMUSEX4.js";import"./chunk-AB6CKZTE.js";import"./chunk-H4HD3LNW.js";import"./chunk-AQEWHUN5.js";import"./chunk-YQZAETCE.js";import{o as B,s as P,x as $}from"./chunk-EO42E46J.js";import"./chunk-3QVSKJ3X.js";import{D as R,I as W,r as O,s as N}from"./chunk-ERUCNOOT.js";import{$b as M,Cc as w,Dc as b,Ec as A,Gc as F,Hc as I,Jb as d,Qc as v,Sc as x,Vb as i,Wb as t,Xb as h,Yb as D,Zb as k,da as E,db as a,fc as S,gc as c,la as f,ma as _,sb as V,tc as n,uc as p,vc as g,wc as T,xc as L,yb as u}from"./chunk-DBE7WQEG.js";import{g as C}from"./chunk-W7GRJBO5.js";var re=o=>["/admin/workspaces",o],oe=()=>["/admin/tickets"],le=o=>({ticketId:o});function de(o,r){o&1&&h(0,"app-widget-loading",6)}function se(o,r){if(o&1&&(i(0,"div",7),n(1),t()),o&2){let e=c();a(),p(e.erreur)}}function me(o,r){if(o&1&&(i(0,"option",28),n(1),t()),o&2){let e=r.$implicit,l=c(3);d("ngValue",e.id),a(),T(" ",l.nom(e)," (",e.comptes," compte(s)) ")}}function ce(o,r){o&1&&(i(0,"p",34),n(1," Aucun autre account manager pour reprendre. Vous pouvez rendre le portefeuille au vivier. "),t())}function pe(o,r){if(o&1){let e=M();i(0,"div",17)(1,"div",14)(2,"h3",24),n(3,"Transf\xE9rer tout le portefeuille"),t(),i(4,"p",10),n(5),t(),i(6,"div",26)(7,"select",27),A("ngModelChange",function(s){f(e);let m=c(2);return b(m.transfertCible,s)||(m.transfertCible=s),_(s)}),i(8,"option",28),n(9,"Choisir le repreneur\u2026"),t(),u(10,me,2,3,"option",29),t(),i(11,"input",30),A("ngModelChange",function(s){f(e);let m=c(2);return b(m.transfertMotif,s)||(m.transfertMotif=s),_(s)}),t(),i(12,"button",31),S("click",function(){f(e);let s=c(2);return _(s.transferer())}),n(13," Transf\xE9rer "),t(),i(14,"button",32),S("click",function(){f(e);let s=c(2);return _(s.toutLiberer())}),n(15," Tout rendre au vivier "),t()(),u(16,ce,2,0,"p",33),t()()}if(o&2){let e=c(2);a(5),g(" Le geste d\u2019un d\xE9part ou d\u2019un changement de secteur : les ",e.actifs.length," compte(s) passent d\u2019un coup au repreneur. La date de prise en charge repart \xE0 maintenant, donc sa r\xE9mun\xE9ration ne compte pas ce qui a \xE9t\xE9 produit avant. "),a(2),w("ngModel",e.transfertCible),a(),d("ngValue",null),a(2),d("ngForOf",e.autres),a(),w("ngModel",e.transfertMotif),a(),d("disabled",!e.transfertCible||e.transfertEnCours),a(4),d("ngIf",!e.autres.length)}}function ue(o,r){if(o&1&&(i(0,"option",28),n(1),t()),o&2){let e=r.$implicit,l=c(3);d("ngValue",e.id),a(),g(" ",l.nom(e)," ")}}function ge(o,r){if(o&1){let e=M();i(0,"tr")(1,"td")(2,"a",35),h(3,"app-widget-workspace-avatar",36),i(4,"span"),n(5),t()()(),i(6,"td",37),n(7),v(8,"date"),t(),i(9,"td",21),n(10),t(),i(11,"td",21),n(12),t(),i(13,"td")(14,"div",38)(15,"input",39),A("ngModelChange",function(s){let m=f(e).$implicit,y=c(2);return b(y.motif[m.id],s)||(y.motif[m.id]=s),_(s)}),t(),i(16,"select",40),A("ngModelChange",function(s){let m=f(e).$implicit,y=c(2);return b(y.cible[m.id],s)||(y.cible[m.id]=s),_(s)}),i(17,"option",28),n(18," Retirer (retour au vivier) "),t(),u(19,ue,2,2,"option",29),t(),i(20,"button",41),S("click",function(){let s=f(e).$implicit,m=c(2);return _(m.reattribuer(s))}),n(21," Appliquer "),t()()()()}if(o&2){let e=r.$implicit,l=c(2);a(2),d("routerLink",I(14,re,e.id)),a(),d("workspace",e)("size",28),a(2),p(e.name),a(2),g(" ",x(8,11,e.assignedAt,"dd/MM/yyyy")," "),a(3),p(l.euros(e.caCents)),a(2),g(" ",l.nombre(e.coinsTotal)," "),a(3),w("ngModel",l.motif[e.id]),a(),w("ngModel",l.cible[e.id]),a(),d("ngValue",null),a(2),d("ngForOf",l.autres)}}function fe(o,r){o&1&&(i(0,"tr")(1,"td",42),n(2," Aucun compte en cours. "),t()())}function _e(o,r){if(o&1&&(i(0,"tr")(1,"td"),n(2),t(),i(3,"td",37),n(4),v(5,"date"),t(),i(6,"td",37),n(7),v(8,"date"),t()()),o&2){let e=r.$implicit;a(2),p(e.name),a(2),g(" ",x(5,3,e.assignedAt,"dd/MM/yyyy")," "),a(3),g(" ",x(8,6,e.releasedAt,"dd/MM/yyyy")," ")}}function ve(o,r){if(o&1&&(i(0,"div",17)(1,"div",14)(2,"h3",18),n(3,"Comptes rendus"),t(),i(4,"div",19)(5,"table",20)(6,"thead")(7,"tr")(8,"th"),n(9,"Compte"),t(),i(10,"th"),n(11,"Pris le"),t(),i(12,"th"),n(13,"Re
1ndu le"),t()()(),i(14,"tbody"),u(15,_e,9,9,"tr",23),t()()()()()),o&2){let e=c(2);a(15),d("ngForOf",e.rendus)}}function xe(o,r){if(o&1&&(i(0,"tr")(1,"td",37),n(2),v(3,"date"),t(),i(4,"td"),h(5,"p-tag",43),t(),i(6,"td"),n(7),t(),i(8,"td",44),n(9),t()()),o&2){let e=r.$implicit;a(2),g(" ",x(3,5,e.createdAt,"dd/MM/yyyy HH:mm")," "),a(3),d("severity",e.action==="boost"?"warn":"secondary")("value",e.action==="boost"?"Boost":"Retrait"),a(2),p(e.workspaceName||e.workspaceId),a(2),g(" ",e.videoId," ")}}function he(o,r){o&1&&(i(0,"tr")(1,"td",45),n(2," Aucun boost. "),t()())}function ye(o,r){if(o&1&&(i(0,"tr")(1,"td"),n(2),t(),i(3,"td",37),n(4),v(5,"date"),t(),i(6,"td",37),n(7),t(),i(8,"td",21)(9,"a",46),n(10,"Ouvrir"),t()()()),o&2){let e=r.$implicit;a(2),p(e.subject||"Sans objet"),a(2),g(" ",x(5,5,e.updatedAt,"dd/MM/yyyy HH:mm")," "),a(3),p(e.status),a(2),d("routerLink",F(8,oe))("queryParams",I(9,le,e.id))}}function Ce(o,r){o&1&&(i(0,"tr")(1,"td",45),n(2," Aucune conversation. "),t()())}function Ee(o,r){if(o&1&&(D(0),i(1,"div",8)(2,"h2",9),n(3),t(),i(4,"div",10),n(5),v(6,"date"),t()(),i(7,"div",11)(8,"div",12)(9,"div",13)(10,"div",14)(11,"div",10),n(12,"Comptes en cours"),t(),i(13,"div",15),n(14),t()()()(),i(15,"div",12)(16,"div",13)(17,"div",14)(18,"div",10),n(19,"Comptes rendus"),t(),i(20,"div",15),n(21),t()()()(),i(22,"div",12)(23,"div",13)(24,"div",14)(25,"div",10),n(26,"CA g\xE9n\xE9r\xE9"),t(),i(27,"div",15),n(28),t()()()(),i(29,"div",12)(30,"div",13)(31,"div",14)(32,"div",10),n(33,"Coins re\xE7us"),t(),i(34,"div",15),n(35),t()()()()(),u(36,pe,17,7,"div",16),i(37,"div",17)(38,"div",14)(39,"h3",18),n(40,"Comptes accompagn\xE9s"),t(),i(41,"div",19)(42,"table",20)(43,"thead")(44,"tr")(45,"th"),n(46,"Compte"),t(),i(47,"th"),n(48,"Depuis"),t(),i(49,"th",21),n(50,"CA g\xE9n\xE9r\xE9"),t(),i(51,"th",21),n(52,"Coins"),t(),i(53,"th",22),n(54,"R\xE9attribuer"),t()()(),i(55,"tbody"),u(56,ge,22,16,"tr",23)(57,fe,3,0,"tr",5),t()()()()(),u(58,ve,16,1,"div",16),i(59,"div",17)(60,"div",14)(61,"h3",24),n(62,"Journal des boosts"),t(),i(63,"p",10),n(64," Le boost est puissant : il multiplie fortement le score dans le fil. D\u2019o\xF9 le quota et cette trace. "),t(),i(65,"div",19)(66,"table",20)(67,"thead")(68,"tr")(69,"th"),n(70,"Date"),t(),i(71,"th"),n(72,"Action"),t(),i(73,"th"),n(74,"Compte"),t(),i(75,"th"),n(76,"Contenu"),t()()(),i(77,"tbody"),u(78,xe,10,8,"tr",23)(79,he,3,0,"tr",5),t()()()()(),i(80,"div",25)(81,"div",14)(82,"h3",24),n(83,"Conversations avec ses comptes"),t(),i(84,"p",10),n(85," Ouvrez un fil depuis le back-office Tickets pour y r\xE9pondre. "),t(),i(86,"div",19)(87,"table",20)(88,"thead")(89,"tr")(90,"th"),n(91,"Objet"),t(),i(92,"th"),n(93,"Mise \xE0 jour"),t(),i(94,"th"),n(95,"\xC9tat"),t(),h(96,"th"),t()(),i(97,"tbody"),u(98,ye,11,11,"tr",23)(99,Ce,3,0,"tr",5),t()()()()(),k()),o&2){let e=c();a(3),p(e.nom(e.detail)),a(2),L(" ",e.detail.email," \xB7 compte ",e.detail.status," \xB7 depuis le ",x(6,16,e.detail.createdAt,"dd/MM/yyyy")," "),a(9),p(e.actifs.length),a(7),p(e.rendus.length),a(7),p(e.euros(e.totalCa)),a(7),p(e.nombre(e.totalCoins)),a(),d("ngIf",e.actifs.length),a(20),d("ngForOf",e.actifs),a(),d("ngIf",!e.actifs.length),a(),d("ngIf",e.rendus.length),a(20),d("ngForOf",e.detail.boosts),a(),d("ngIf",!e.detail.boosts.length),a(19),d("ngForOf",e.conversations),a(),d("ngIf",!e.conversations.length)}}var ae=class o{api=E(ne);route=E(B);toast=E(j);confirm=E(Z);nombre=te;euros=ie;detail=null;autres=[];conversations=[];loading=!0;erreur=null;cible={};motif={};transfertCible=null;transfertMotif="";transfertEnCours=!1;get actifs(){return(this.detail?.comptes??[]).filter(r=>!r.releasedAt)}get rendus(){return(this.detail?.comptes??[]).filter(r=>r.releasedAt)}get totalCa(){return this.actifs.reduce((r,e)=>r+Number(e.caCents||0),0)}get totalCoins(){return this.actifs.reduce((r,e)=>r+Number(e.coinsTotal||0),0)}nom(r){return[r.firstName,r.lastName].filter(Boolean).join(" ").trim()||r.email}ngOnInit(){return C(this,null,function*(){let r=this.route.snapshot.paramMap.get("id");if(!r){this.erreur="Account manager introuvable.",this.loading=!1;return}try{this.detail=yield this.api.detail(r)}catch{this.erreur="Account manager introuvable.",this.loading=!1;return}let[e,l]=yield Promise.all([this.api.list().catch(()=>[]),this.api.conversations(r).catch(()=>({data:[],total:0}))]);this.autres=e.filter(s=>s.id!==r),this.conversations=l.data??[],this.loading=!1})}transferer(){return C(this,null,function*(){if(!this.detail||!this.transfertCible)return;let r=this.autres.find(l=>l.id===this.transfertCible);if(!(!r||!(yield this.confirm.confirm({message:`Transf\xE9rer les ${this.actifs.length} compte(s) de ${this.nom(this.detail)} \xE0 ${this.nom(r)} ? La date de prise en charge repart \xE0 maintenant, donc la r\xE9mun\xE9ration du repreneur aussi.`,header:"Transfert du portefeuille",severity:"warn"})))){this.transfertEnCours=!0;try{let l=yield this.api.transferAll(this.detail.id,this.transfertCible,this.transfertMotif.trim()||void 0);this.toast.add({severity:l.echecs.length?"warn":"success",detail
1:l.echecs.length?`${l.transferes} transf\xE9r\xE9(s), ${l.echecs.length} en \xE9chec.`:`${l.transferes} compte(s) transf\xE9r\xE9(s).`}),this.transfertCible=null,this.transfertMotif="",this.detail=yield this.api.detail(this.detail.id)}catch{this.toast.add({severity:"error",detail:"Le transfert a \xE9chou\xE9."})}finally{this.transfertEnCours=!1}}})}toutLiberer(){return C(this,null,function*(){if(!(!this.detail||!(yield this.confirm.confirm({message:`Rendre au vivier les ${this.actifs.length} compte(s) de ${this.nom(this.detail)} ? Ils redeviennent disponibles pour tous les account managers.`,header:"Rendre le portefeuille"}))))try{let e=yield this.api.releaseAll(this.detail.id);this.toast.add({severity:"success",detail:`${e.released} compte(s) rendus au vivier.`}),this.detail=yield this.api.detail(this.detail.id)}catch{this.toast.add({severity:"error",detail:"La lib\xE9ration a \xE9chou\xE9."})}})}reattribuer(r){return C(this,null,function*(){let e=this.cible[r.id]??null,l=e?this.nom(this.autres.find(m=>m.id===e)):"personne (retour au vivier)";if(yield this.confirm.confirm({message:`R\xE9attribuer \xAB ${r.name} \xBB \xE0 ${l} ? La date de prise en charge repart \xE0 maintenant, donc la r\xE9mun\xE9ration aussi.`,header:"R\xE9attribution",severity:"warn"}))try{yield this.api.assign(r.id,e,this.motif[r.id]),this.toast.add({severity:"success",detail:"R\xE9attribu\xE9."}),this.detail=yield this.api.detail(this.detail.id)}catch{this.toast.add({severity:"error",detail:"La r\xE9attribution a \xE9chou\xE9."})}})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["app-view-admin-account-manager-details"]],decls:7,vars:3,consts:[[1,"p-4"],["routerLink","/admin/account-managers",1,"small","text-decoration-none"],[1,"pi","pi-arrow-left"],["class","d-block mt-3",4,"ngIf"],["class","alert alert-warning mt-3",4,"ngIf"],[4,"ngIf"],[1,"d-block","mt-3"],[1,"alert","alert-warning","mt-3"],[1,"mt-3","mb-4"],[1,"h4","mb-1"],[1,"text-muted","small"],[1,"row","g-3","mb-4"],[1,"col-6","col-lg-3"],[1,"card","h-100"],[1,"card-body"],[1,"h3","mb-0"],["class","card mb-4",4,"ngIf"],[1,"card","mb-4"],[1,"h6","mb-3"],[1,"table-responsive"],[1,"table","table-sm","align-middle","mb-0"],[1,"text-end"],[2,"min-width","260px"],[4,"ngFor","ngForOf"],[1,"h6","mb-1"],[1,"card"],[1,"d-flex","flex-wrap","gap-2","align-items-center"],[1,"form-select",2,"max-width","320px",3,"ngModelChange","ngModel"],[3,"ngValue"],[3,"ngValue",4,"ngFor","ngForOf"],["type","text","placeholder","Motif (facultatif)",1,"form-control",2,"max-width","280px",3,"ngModelChange","ngModel"],["type","button",1,"btn","btn-primary",3,"click","disabled"],["type","button",1,"btn","btn-outline-secondary","ms-auto",3,"click"],["class","text-muted small mb-0 mt-2",4,"ngIf"],[1,"text-muted","small","mb-0","mt-2"],[1,"d-flex","align-items-center","gap-2","text-decoration-none",3,"routerLink"],[3,"workspace","size"],[1,"small"],[1,"d-flex","gap-1"],["type","text","placeholder","Motif",1,"form-control","form-control-sm",2,"max-width","120px",3,"ngModelChange","ngModel"],[1,"form-select","form-select-sm",3,"ngModelChange","ngModel"],["type","button",1,"btn","btn-sm","btn-outline-primary",3,"click"],["colspan","5",1,"text-muted","small"],[3,"severity","value"],[1,"font-monospace","small"],["colspan","4",1,"text-muted","small"],[1,"btn","btn-sm","btn-outline-primary",3,"routerLink","queryParams"]],template:function(e,l){e&1&&(i(0,"div",0)(1,"a",1),h(2,"i",2),n(3," Account managers "),t(),u(4,de,1,0,"app-widget-loading",3)(5,se,2,1,"div",4)(6,Ee,100,19,"ng-container",5),t()),e&2&&(a(4),d("ngIf",l.loading),a(),d("ngIf",l.erreur),a(),d("ngIf",!l.loading&&l.detail))},dependencies:[W,O,N,R,Q,G,K,q,J,z,H,$,P,Y,X,U,ee],encapsulation:2})};export{ae as ViewAdminAccountManagerDetailsComponent};
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.