1import{a as ee}from"./chunk-MNGQ4JVX.js";import{a as ne,b as ie,c as oe,d as se}from"./chunk-ZVKVS6QM.js";import{f as de,g as me}from"./chunk-LMVGS7L4.js";import{a as te}from"./chunk-OVNK2ETZ.js";import"./chunk-6UHQPIVE.js";import{a as ae,b as re}from"./chunk-ZXSNIZ6S.js";import{a as Y,b as Z}from"./chunk-5T5T7ANT.js";import{a as K,b as X}from"./chunk-2L7BC3FF.js";import{a as q}from"./chunk-JEL6HJ7P.js";import{aa as J}from"./chunk-YQOD7X2Z.js";import{b as U,c as $}from"./chunk-563YFTIG.js";import"./chunk-36JN3LZY.js";import{ra as H,sa as N}from"./chunk-WPHW6CRH.js";import{C as G,K as z,c as V,h as B,i as j,l as D,o as L,p as F}from"./chunk-76O7YCWW.js";import"./chunk-YYIIKC2W.js";import"./chunk-3WYGUSDH.js";import{a as R,c as W}from"./chunk-LU7SZU5X.js";import"./chunk-PO2RDVKE.js";import{E as k,Ec as h,Fc as y,G as C,Gc as M,Pb as S,Rb as x,Wb as f,Xb as i,Yb as a,Z as _,Zb as u,ca as T,db as d,ec as I,ga as Q,ha as b,jc as v,lc as m,n as w,oa as p,pa as c,s as P,ub as A,uc as O,y as E,zc as g}from"./chunk-3URBZWPM.js";import"./chunk-ODN5LVDJ.js";var le=(()=>{let o=class o{constructor(t){this.httpClient=t}getPaymentData(t){return this.httpClient.get(`${q.API_URL}/payment/aat-reference/${t}`,{headers:this.prepareHeaders()}).pipe(P(e=>e),k(e=>w(e)))}getTargetRegistration(t){return this.httpClient.get(`${q.API_URL}/registration/${t}`,{headers:this.prepareHeaders()}).pipe(P(e=>e),k(e=>w(e)))}prepareHeaders(){return new R({"Content-Type":"application/json"})}};o.\u0275fac=function(e){return new(e||o)(Q(W))},o.\u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();var pe=(()=>{let o=class o{constructor(t){this.httpClient=t}pushPaymentCodeToBizTalk(t){return this.httpClient.post(`${q.API_URL}/admin-tools/paymentcodes/biztalk-push`,{organisationId:t},{headers:this.prepareHeaders()}).pipe(P(e=>e),k(e=>w(e)))}prepareHeaders(){return new R({"Content-Type":"application/json"})}};o.\u0275fac=function(e){return new(e||o)(Q(W))},o.\u0275prov=T({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();function ge(r,o){r&1&&(i(0,"div",2),u(1,"p-progressspinner"),a())}function fe(r,o){if(r&1&&(i(0,"div",12),u(1,"p-message",24),a()),r&2){let n=m(3);d(),f("severity",n.paymentMessage.type)("text",n.paymentMessage.message)}}function _e(r,o){if(r&1&&(i(0,"div",12),u(1,"p-message",24),a()),r&2){let n=m(3);d(),f("severity",n.queueMessage.type)("text",n.queueMessage.message)}}function he(r,o){if(r&1){let n=I();i(0,"p-card",13),u(1,"br"),i(2,"form",4),v("ngSubmit",function(){p(n);let e=m(2);return c(e.onPaymentSubmit())}),i(3,"h5"),g(4,"Requeue a failed payment"),a(),i(5,"p-floatlabel",5)(6,"input",14),M("ngModelChange",function(e){p(n);let s=m(2);return y(s.paymentReference,e)||(s.paymentReference=e),c(e)}),a(),i(7,"label",15),g(8,"AAT payment reference of the failed payment"),a()(),u(9,"p-button",16),a(),u(10,"p-divider"),i(11,"form",4),v("ngSubmit",function(){p(n);let e=m(2);return c(e.onPaymentCodeSubmit())}),i(12,"h5"),g(13,"Push an organisation's payment codes to Biztalk"),a(),i(14,"p-floatlabel",5)(15,"input",17),M("ngModelChange",function(e){p(n);let s=m(2);return y(s.paymentCodeOrgId,e)||(s.paymentCodeOrgId=e),c(e)}),a(),i(16,"label",10),g(17,"Org Id that needs their payment codes pushed to Biztalk"),a()(),u(18,"p-button",18),a(),S(19,fe,2,2,"div",12),a(),i(20,"p-card",19),u(21,"br"),i(22,"form",4),v("ngSubmit",function(){p(n);let e=m(2);return c(e.onNonWorkerQueueSubmit())}),i(23,"h5"),g(24,"Submit items through non worker queues"),a(),i(25,"p-floatlabel",5)(26,"p-select",20),M("ngModelChange",function(e){p(n);let s=m(2);return y(s.nonWorkerQueue,e)||(s.nonWorkerQueue=e),c(e)}),a(),i(27,"label",21),g(28,"Queue type"),a()(),i(29,"p-floatlabel",5)(30,"input",22),M("ngModelChange",function(e){p(n);let s=m(2);return y(s.nonWorkerQueueGuid,e)||(s.nonWorkerQueueGuid=e),c(e)}),a(),i(31,"label",10),g(32,"Guid of the item you wish to send through queue"),a()(),u(33,"p-button",23),a(),S(34,_e,2,2,"div",12),a()}if(r&2){let n=m(2);d(6),h("ngModel",n.paymentReference),d(3),f("disabled",!n.paymentReference),d(6),h("ngModel",n.paymentCodeOrgId),d(3),f("disabled",!n.paymentCodeOrgId),d(),x(n.paymentMessage.active?19:-1),d(7
1),f("options",n.nonWorkerQueues),h("ngModel",n.nonWorkerQueue),d(4),h("ngModel",n.nonWorkerQueueGuid),d(3),f("disabled",!n.nonWorkerQueue||!n.nonWorkerQueueGuid),d(),x(n.queueMessage.active?34:-1)}}function ye(r,o){if(r&1&&(i(0,"div",12),u(1,"p-message",24),a()),r&2){let n=m(2);d(),f("severity",n.staffMessage.type)("text",n.staffMessage.message)}}function Me(r,o){if(r&1){let n=I();i(0,"p-card"),S(1,he,35,10),i(2,"p-card",3),u(3,"br"),i(4,"form",4),v("ngSubmit",function(){p(n);let e=m();return c(e.onAddStaffSubmit())}),i(5,"h5"),g(6,"Add staff Cognito Group to MyAAT account and send to Learning Portal"),a(),i(7,"p-floatlabel",5)(8,"input",6,0),M("ngModelChange",function(e){p(n);let s=m();return y(s.addStaff,e)||(s.addStaff=e),c(e)}),a(),i(10,"label",7),g(11,"AAT email address to add to the staff group"),a()(),u(12,"p-button",8),a(),u(13,"p-divider"),i(14,"form",4),v("ngSubmit",function(){p(n);let e=m();return c(e.onRemoveStaffSubmit())}),i(15,"h5"),g(16,"Remove staff Cognito Group from MyAAT account"),a(),i(17,"p-floatlabel",5)(18,"input",9,1),M("ngModelChange",function(e){p(n);let s=m();return y(s.removeStaff,e)||(s.removeStaff=e),c(e)}),a(),i(20,"label",10),g(21,"AAT email address to remove from the staff group"),a()(),u(22,"p-button",11),a(),S(23,ye,2,2,"div",12),a()()}if(r&2){let n=O(9),t=O(19),e=m();d(),x(e.isAdmin?1:-1),d(7),h("ngModel",e.addStaff),d(4),f("disabled",!e.addStaff||n.errors),d(6),h("ngModel",e.removeStaff),d(4),f("disabled",!e.removeStaff||t.errors),d(),x(e.staffMessage.active?23:-1)}}var et=(()=>{let o=class o{constructor(){this._qService=b(te),this._paymentService=b(le),this._paymentCodeService=b(pe),this._cognitoService=b(ee),this._contactService=b(J),this.isLoading=!0,this.isAdmin=this._contactService.contactGroups().includes("admin"),this.subscriptions=[],this.paymentMessage={active:!1,type:"success",message:""},this.queueMessage={active:!1,type:"success",message:""},this.staffMessage={active:!1,type:"success",message:""}}ngOnInit(){this.isAdmin?this.getQueueOptions():this.isLoading=!1}ngOnDestroy(){this.subscriptions.forEach(t=>t.unsubscribe)}onPaymentSubmit(){this._processPayment()}onPaymentCodeSubmit(){this._pushOrgPaymentCodesToBiztalk()}onNonWorkerQueueSubmit(){this._sendThroughQueue()}onAddStaffSubmit(){this._addStaff()}onRemoveStaffSubmit(){this._removeStaff()}getQueueOptions(){this.subscriptions.push(this._qService.getOtherQueueOptions().subscribe({next:t=>{this.nonWorkerQueues=t.map(e=>({label:e.value,value:e.reprocessingType})),this.isLoading=!1}}))}_sendThroughQueue(){let t=this.findQueueDescription(this.nonWorkerQueue);this._resetMessage("queue"),this._addMessage("queue","success",`Sending message through ${t} queue`),this.subscriptions.push(this._qService.addUserToNonWorkerQueue(this.nonWorkerQueueGuid,this.nonWorkerQueue).subscribe({next:e=>{e?.error?this._addMessage("queue","error",`Failed to send through ${t} queue`):this._addMessage("queue","success",`Successfully sent through ${t} queue`)},error:e=>{this._addMessage("queue","error",`Failed to send through ${t} queue. API returned this error: ${e}`)}}))}_addStaff(){this._resetMessage("staff"),this._addMessage("staff","success",`Beginning to add staff group for ${this.addStaff}`),this._cognitoService.updateStaffGrouping(this.addStaff,"add").subscribe({next:t=>{this._addMessage("staff","success",t)},error:t=>{this._addMessage("staff","error",t.status===404?t.error.message:`There has been an error adding the staff group to ${this.addStaff}, please contact the web team`)}})}_removeStaff(){this._resetMessage("staff"),this._addMessage("staff","success",`Beginning to remove staff group for ${this.addStaff}`),this._cognitoService.updateStaffGrouping(this.addStaff,"remove").subscribe({next:t=>{this._addMessage("staff","success",t)},error:t=>{this._addMessage("staff","error",t.status===404?t.error.message:`There has been an error removing the staff group to ${this.addStaff}, please contact the web team`)}})}findQueueDescription(t){return this.nonWorkerQueues.find(e=>e.value===t).label}_submitToFifo(t,e){return this._qService.addUserToNonWorkerQueue(t,e)}
1_processFifoPayment(t){this._addMessage("payment","success","Begin payment processing"),this.subscriptions.push(this._paymentService.getPaymentData(this.paymentReference).pipe(_(e=>{e?.error||(this.paymentObject=e)}),C(()=>this._submitToFifo(this.paymentObject.apiRecordId,t))).subscribe({error:()=>{this._addMessage("payment","error","Payment processing error")},complete:()=>{this._addMessage("payment","success","Payment sent through queue")}}))}_processPayment(){switch(this._resetMessage("payment"),!0){case this.paymentReference.startsWith("REG"):this.reprocessRegPayment();break;case this.paymentReference.startsWith("PP"):this._processFifoPayment("ProgressionPathwaysApplication");break;case this.paymentReference.startsWith("MR"):this._processFifoPayment("MembershipRenewalApplication");break;case this.paymentReference.startsWith("LR"):case this.paymentReference.startsWith("LMA"):this._processFifoPayment("LicenceRenewalApplication");break;case this.paymentReference.startsWith("RIP"):this._processFifoPayment("OutstandingFees");break;default:this._addMessage("payment","error","Unhandled payment type, please process manually")}}_queueAllProgrammes(){let t={};for(let e in this.registrationData.processingTasks.programmeRegistration)t[this.registrationData.processingTasks.programmeRegistration[e]]=this._qService.queueItem("CreateProgrammeRegistration",this.registrationData.processingTasks.programmeRegistration[e].programmeRegistrationId,"programme");return E(t)}_queueAllOrders(){let t={};return this.registrationData.processingTasks.order.forEach(e=>{t[e.orderId]=this._qService.queueItem("CreateOrder",e.orderId,"order")}),E(t)}_pushOrgPaymentCodesToBiztalk(){this._resetMessage("payment"),this._addMessage("payment","success","Begin sending payment code to BizTalk"),this._paymentCodeService.pushPaymentCodeToBizTalk(this.paymentCodeOrgId).subscribe(t=>{t?.error?this._addMessage("payment","error","Failed to process"):this._addMessage("payment","success","Payment code sent to BizTalk")})}_requeuePayment(){let t=this.paymentObject?.paymentMethod==="card"?"SendPaymentAsCard":"SendPaymentAsCode";return this._qService.queueItem(t,this.paymentObject.paymentId,"payment")}reprocessRegPayment(){let t=!1,e=!1,s=!1;this._addMessage("payment","success","Begin payment processing"),this.subscriptions.push(this._paymentService.getPaymentData(this.paymentReference).pipe(_(l=>{l?.error||(this._addMessage("payment","success","Retrieved payment data"),this.paymentObject=l)}),C(()=>this._paymentService.getTargetRegistration(this.paymentObject.apiRecordId)),_(l=>{l&&!l.error&&(this._addMessage("payment","success","Retrieved registration data"),this.registrationData=l)}),C(()=>this._queueAllProgrammes()),_(l=>{l?.error||(this._addMessage("payment","success","Requeued all programme registrations"),t=!0)}),C(()=>this._queueAllOrders()),_(l=>{l?.error||(this._addMessage("payment","success","Requeued all orders"),e=!0)}),C(()=>this._requeuePayment()),_(l=>{l?.error||(s=!0)})).subscribe({complete:()=>{t&&e&&s?this._addMessage("payment","success","Payment sent through queue"):this._addMessage("payment","error","Error sending payment through queue, please check DynamoDB data")},error:()=>{this._addMessage("payment","error","Error sending payment through queue, please check DynamoDB data")}}))}_addMessage(t,e,s){switch(t){case"payment":this.paymentMessage.message=s,this.paymentMessage.type=e,this.paymentMessage.active=!0;break;case"staff":this.staffMessage.message=s,this.staffMessage.type=e,this.staffMessage.active=!0;break;case"queue":this.queueMessage.message=s,this.queueMessage.type=e,this.queueMessage.active=!0}}_resetMessage(t){(t==="payment"||t==="all")&&(this.paymentMessage.active=!1,this.paymentMessage.message=""),(t==="staff"||t==="all")&&(this.staffMessage.active=!1,this.staffMessage.message=""),(t==="queue"||t==="all")&&(this.queueMessage.active=!1,this.queueMessage.message="")}};o.\u0275fac=function(e){return new(e||o)},o.\u0275cmp=A({type:o,selectors:[["app-queue-manager"]],decls:2,vars:1,consts:[["addEmail","ngModel"],["removeEmail","ngModel"],[1,"flex","justify-content-center"],["header","Staff management"],[3,"ngSubmit"],["variant","on",1,"mt-3","mb-5"],["type","email","name","add_staff_email","pInputText","","id","add_staff_email","data-auto","addStaffEmail","email","",1,"w-lg",3,"ngModelChange","ngModel"],["for","add_staff_email"],["label","Add user to staff group","type","submit","data-auto","addStaffSend",3,"disabled"],["type","email","name","remove_staff_email","pInputText","","id","remove_staff_email","data-auto","removeStaffEmail","email","",1,"w-lg",3,"ngModelChange","ngModel"],["for","payment_code_orgId"],["label","Remove user from staff group","type","submit","data-auto","removeStaffSend",3,"disabled"],[1,"mt-5"],["header","Payment management",1,"mb-5"],["type","text","name","payment_reference","pInputText","","id","payment_reference","data-auto","paymentReference",1,"w-lg",3,"ngModelChange","ngModel"],["for","payment_reference"],["label","Send payment to CRM","type","submit","data-auto","sendPaymentToCrm",3,"disabled"],["type","text","name","payment_code_orgId","pInputText","","id","payment_code_orgId","data-auto","paymentCodeOrgId",1,"w-lg",3,"ngModelChange","ngModel"],["label","Push an organisation's payment codes to Biztalk","type","submit","data-auto","paymentCodeSend",3,"disabled"],["header","Queue management",1,"mb-5"],["name","non_worker_queue","data-auto","nonWorkerQueue","inputId","non_worker_queue",1,"w-lg",3,"ngModelChange","options","ngModel"],["for","non_worker_queue"],["type","text","name","non_worker_queue_guid","pInputText","","id","non_worker_queue_guid","data-auto","nonWorkerQueueGuid",1,"w-lg",3,"ngModelChange","ngModel"],["label","Requeue item","type","submit","data-auto","nonWorkerSend",3,"disabled"],[3,"severity","text"]],template:function(e,s){e&1&&S(0,ge,2,0,"div",2)(1,Me,24,6,"p-card"),e&2&&x(s.isLoading?0:1)},dependencies:[z,F,V,B,j,G,L,D,ie,ne,Z,Y,se,oe,$,U,X,K,N,H,me,de,re,ae],styles:["[_ngcontent-%COMP%]:root{--aat-ui-grey-25: #bfbfbf;--aat-ui-grey-55: #737373;--aat-slate: #3a5066;--aat-ui-grey-05: #f2f2f2}.main[_ngcontent-%COMP%]{display:flex}.main__content[_ngcontent-%COMP%]{flex-basis:85%;max-width:80%;margin:auto}.data-container[_ngcontent-%COMP%]{background-color:#eee;display:flex;flex-direction:column}.data-container__beside[_ngcontent-%COMP%]{flex-direction:row}.data-container__beside--content[_ngcontent-%COMP%]{flex-grow:1;margin:10px}.data-container__content[_ngcontent-%COMP%]{background-color:#fff;max-width:90%;min-width:85%;margin:15px auto;padding:15px;font-size:smaller}.data-container__content--json-toggle[_ngcontent-%COMP%]{margin:10px 0;display:flex;justify-content:flex-end}.data-container__content--json-display[_ngcontent-%COMP%]{border:thin solid rgb(238.425,238.425,238.425);padding:5px}.data-container__content--box[_ngcontent-%COMP%]{padding:15px;border-bottom:thin solid rgb(238.425,238.425,238.425)}.data-container__double-panel[_ngcontent-%COMP%]{display:grid;grid-template-columns:48% 48%}.data-container__loader[_ngcontent-%COMP%]{background-color:#fff}.button-container[_ngcontent-%COMP%]{display:flex;justify-content:space-between;padding:10px}.button-container--single[_ngcontent-%COMP%]{justify-content:flex-end}"]});let r=o;return r})();export{et as QueueManagerComponent};
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.