-
Notifications
You must be signed in to change notification settings - Fork 0
/
13-es5.4be6b8642c2031583a73.js
1 lines (1 loc) · 7.32 KB
/
13-es5.4be6b8642c2031583a73.js
1
!function(){function e(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function n(e,n){for(var o=0;o<n.length;o++){var t=n[o];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{eNtl:function(o,t,i){"use strict";i.r(t),i.d(t,"BookingPageModule",(function(){return E}));var r=i("pMoy"),s=i("UKGz"),a=i("SVse"),c=i("s7LF"),b=i("sZkV"),l=i("iInd"),u=i("mrSG"),d=i("jp9Y"),h=i("t0hA"),p=i("8Y7J"),g=i("h80k"),f=i("T/V+");function m(e,n){if(1&e&&(p.Pb(0,"div"),p.Pb(1,"ion-button",18),p.Kb(2,"ion-icon",19),p.rc(3," Add Person to Booking "),p.Ob(),p.Pb(4,"button",20),p.Kb(5,"ion-icon",21),p.rc(6," Add Person (enter) "),p.Ob(),p.Ob()),2&e){var o=p.bc();p.zb(1),p.hc("disabled",o.bookingForm.invalid),p.zb(3),p.hc("disabled",o.bookingForm.invalid)}}function v(e,n){if(1&e){var o=p.Qb();p.Pb(0,"div"),p.Pb(1,"ion-button",22),p.Xb("click",(function(e){p.mc(o);var n=p.bc(),t=p.lc(8);return n.clickSubmitForm(n.selectedEventUUID,t,e)})),p.rc(2," Register for Sunday service "),p.Ob(),p.Ob()}if(2&e){var t=p.bc();p.zb(1),p.hc("disabled",t.bookingForm.invalid)}}function P(e,n){1&e&&(p.Pb(0,"ion-text",23),p.rc(1," Registrations reached maximum capacity "),p.Ob())}var k,C,O,y=[{path:"",component:(k=function(){function o(n,t,i){e(this,o),this.bookingService=n,this.formBuilder=t,this.toastController=i,this.selectedEventUUID="",this.selectedEventName="",this.bookingChineseUUID="445538f0-e22e-4568-acf8-9bc5bba3ceb6",this.bookingEnglishUUID="81508052-8691-4ff4-a3ef-c36bf7fccc88",this.eventChineseUUID="667c1a54-3c59-4eff-a507-b55a80094249",this.eventEnglishUUID="f883134b-661a-4388-b677-582bc2ea39aa",this.latestPersonsEnglishCap=49,this.latestPersonsChineseCap=49;var r=t.group(d.a.createPersonForm());this.bookingForm=r}var t,i,r;return t=o,(i=[{key:"ngOnInit",value:function(){var e=this,n=Object(h.b)(this.bookingService.getNumberOfPersonBookingsForEvent());this.latestPersonsCountChinese=n,n.subscribe((function(n){e.chineseCount=n}));var o=Object(h.b)(this.bookingService.getNumberOfPersonBookingsForEvent(this.eventEnglishUUID));this.latestPersonsCountEnglish=o,o.subscribe((function(n){return e.englishCount=n}))}},{key:"clickSubmitForm",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"445538f0-e22e-4568-acf8-9bc5bba3ceb6",o=arguments.length>1?arguments[1]:void 0,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.bookingForm,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.bookingService;n===this.bookingEnglishUUID?this.englishCount+=1:this.chineseCount+=1;var r=t.value;""!==r.personFirstName?(o.control.setErrors({invalid:"Saving form..."}),i.addPersonToBookingByUUID(n,r).subscribe((function(n){var o,t,i,r;e.presentToast("Successfully saved booking "+(null===(r=null===(i=null===(t=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.insert_Person)||void 0===t?void 0:t.returning)||void 0===i?void 0:i[0])||void 0===r?void 0:r.personFirstName)).catch(),e.resetRecreateForm()}),(function(n){e.presentToast("Error saving "+JSON.stringify(n)).catch()}))):this.presentToast("Invalid inputs detected").catch()}},{key:"resetRecreateForm",value:function(){var e=this.formBuilder.group(d.a.createPersonForm());this.bookingForm=e}},{key:"presentToast",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Loading...",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.toastController;return Object(u.a)(this,void 0,void 0,regeneratorRuntime.mark((function o(){return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,n.create({message:e,duration:3500,animated:!0,translucent:!0});case 2:return o.abrupt("return",o.sent.present().then((function(){})));case 3:case"end":return o.stop()}}),o)})))}},{key:"compare",value:function(e,n){return e<n}},{key:"isEnglishCountCappedLocked",get:function(){return this.englishCount>=this.latestPersonsEnglishCap}},{key:"isChineseCountCappedLocked",get:function(){return this.chineseCount>=this.latestPersonsChineseCap}},{key:"isRegistrationAllowedEnglishCountBelowCap",get:function(){return!this.isEnglishCountCappedLocked}},{key:"isRegistrationAllowedChineseCountBelowCap",get:function(){return!this.isChineseCountCappedLocked}}])&&n(t.prototype,i),r&&n(t,r),o}(),k.\u0275fac=function(e){return new(e||k)(p.Jb(h.a),p.Jb(c.c),p.Jb(b.M))},k.\u0275cmp=p.Db({type:k,selectors:[["app-booking"]],decls:42,vars:6,consts:[[3,"translucent"],["color","cobaltblue"],["slot","start"],[2,"padding-inline-start","0.25em"],[3,"formGroup"],["f","ngForm"],[2,"color","gray"],["col-12","","col-sm-9","","col-md-6","","col-lg-4","","col-xl-3",""],["position","floating"],["formControlName","personFirstName","type","text","placeholder","First name for registration, check in and contact-tracing purposes","required",""],["formControlName","personLastName","type","text","placeholder","Your last name","required",""],["sizeXl","2","sizeLg","2.2","sizeMd","2.5","sizeSm","4","sizeXs","5.6"],["formControlName","personPhoneNumber","type","tel","placeholder","0412345678","size","12","required",""],["formControlName","personEmailAddress","type","text","placeholder","[email protected]","required",""],[3,"eventName"],[4,"ngIf"],[4,"ngIf","ngIfElse"],["maxedChinese",""],["type","button","color","cobaltblue",3,"disabled"],["name","person-add-outline"],["type","button","mat-button","","color","primary","hidden","",3,"disabled"],["name","document-text"],["type","button","color","brightnavyblue",3,"disabled","click"],["color","warning"]],template:function(e,n){if(1&e&&(p.Pb(0,"ion-header",0),p.Pb(1,"ion-toolbar",1),p.Pb(2,"ion-buttons",2),p.Kb(3,"app-home-button"),p.Ob(),p.Pb(4,"ion-title",3),p.rc(5," Booking "),p.Ob(),p.Ob(),p.Ob(),p.Pb(6,"ion-content"),p.Pb(7,"form",4,5),p.Pb(9,"ion-grid"),p.Pb(10,"ion-row",6),p.Pb(11,"ion-col"),p.rc(12," Test"),p.Ob(),p.Ob(),p.Pb(13,"ion-row"),p.Pb(14,"ion-col",7),p.Pb(15,"ion-label",8),p.rc(16," First name "),p.Ob(),p.Kb(17,"ion-input",9),p.Ob(),p.Ob(),p.Pb(18,"ion-row"),p.Pb(19,"ion-col"),p.Pb(20,"ion-label",8),p.rc(21," Last name "),p.Ob(),p.Kb(22,"ion-input",10),p.Ob(),p.Ob(),p.Pb(23,"ion-row"),p.Pb(24,"ion-col",11),p.Pb(25,"ion-label",8),p.rc(26," Phone number "),p.Ob(),p.Kb(27,"ion-input",12),p.Ob(),p.Ob(),p.Pb(28,"ion-row"),p.Pb(29,"ion-col"),p.Pb(30,"ion-label",8),p.rc(31," Email address "),p.Ob(),p.Kb(32,"ion-input",13),p.Ob(),p.Ob(),p.Kb(33,"app-covid-declaration",14),p.Pb(34,"ion-row"),p.Pb(35,"ion-col"),p.pc(36,m,7,2,"div",15),p.Ob(),p.Ob(),p.Pb(37,"ion-row"),p.Pb(38,"ion-col"),p.pc(39,v,3,1,"div",16),p.Ob(),p.Ob(),p.pc(40,P,2,0,"ng-template",null,17,p.qc),p.Ob(),p.Ob(),p.Ob()),2&e){var o=p.lc(41);p.hc("translucent",!0),p.zb(7),p.hc("formGroup",n.bookingForm),p.zb(26),p.hc("eventName",n.selectedEventName),p.zb(3),p.hc("ngIf",n.isRegistrationAllowedEnglishCountBelowCap&&n.isRegistrationAllowedChineseCountBelowCap),p.zb(3),p.hc("ngIf",n.latestPersonsCountEnglish)("ngIfElse",o)}},directives:[b.o,b.G,b.f,g.a,b.F,b.k,c.p,c.l,c.f,b.n,b.B,b.j,b.w,b.r,b.L,c.k,c.e,c.n,f.a,a.k,b.e,b.p,b.D],styles:[""]}),k)}],w=((O=function n(){e(this,n)}).\u0275mod=p.Hb({type:O}),O.\u0275inj=p.Gb({factory:function(e){return new(e||O)},imports:[[l.i.forChild(y)],l.i]}),O),E=((C=function n(){e(this,n)}).\u0275mod=p.Hb({type:C}),C.\u0275inj=p.Gb({factory:function(e){return new(e||C)},imports:[[a.c,c.g,c.m,b.H,s.a,r.b,w]]}),C)}}])}();