-
Notifications
You must be signed in to change notification settings - Fork 0
/
14-es5.79b6075debcae864b72f.js
1 lines (1 loc) · 14.7 KB
/
14-es5.79b6075debcae864b72f.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 t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function t(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}function o(){var e=c(['\n mutation PersonCheckOut($personUUIDEquals: uuid!, $eventUUIDEquals: uuid!) {\n update_PersonBooking(\n _set: { checkOutDateTime: "now()" }\n where: {\n Person: { randomUUID: { _eq: $personUUIDEquals } }\n Booking: { Event: { randomUUID: { _eq: $eventUUIDEquals } } }\n }\n ) {\n affected_rows\n returning {\n checkInDateTime\n checkOutDateTime\n randomUUID\n updated_at\n }\n }\n }\n']);return o=function(){return e},e}function r(){var e=c(['\n mutation PersonCheckIn($personUUIDEquals: uuid!, $eventUUIDEquals: uuid!) {\n update_PersonBooking(\n _set: { checkInDateTime: "now()" }\n where: {\n Person: { randomUUID: { _eq: $personUUIDEquals } }\n Booking: { Event: { randomUUID: { _eq: $eventUUIDEquals } } }\n }\n ) {\n affected_rows\n returning {\n checkInDateTime\n checkOutDateTime\n randomUUID\n updated_at\n }\n }\n }\n']);return r=function(){return e},e}function i(){var e=c(['\n mutation PersonAdHocCheckIn(\n $personInsertDetails: Person_insert_input! = {\n personFirstName: "test"\n personLastName: "test"\n personPhoneNumber: "1234567890"\n personEmailAddress: "[email protected]"\n }\n ) {\n insert_PersonBooking_one(\n object: {\n Person: {\n data: $personInsertDetails\n on_conflict: {\n constraint: Person_personFirstName_personLastName_personPhoneNumber_personE\n update_columns: updated_at\n }\n }\n Booking: {\n data: {\n Event: {\n data: {\n # Hard-coded for tracking. Allows updates and duplicate persons as the person creates a new booking 1:1 each time.\n randomUUID: "c1836401-aca3-499f-b409-6c8fc1239193"\n # All the rest are placeholders for NOT NULL passing.\n eventTopic: "Church"\n eventStartDateTime: "2020-02-01"\n eventName: "Eight Mile Plains Chinese Methodist Church"\n eventMedium: "In-person"\n eventEndDateTime: "2020-02-02"\n eventDescription: "Default event"\n eventDateTimeRange: "[2020-01-01, 2020-01-02]"\n eventCategory: "Church"\n eventCapacity: 1\n bookingAvailableStartDateTime: "2020-01-01"\n bookingAvailableEndDateTime: "2020-01-02"\n bookingAvailabilityDateTimeRange: "[2020-01-01, 2020-01-02]"\n #\n }\n on_conflict: { constraint: Event_randomUUID_key, update_columns: updated_at }\n }\n }\n on_conflict: { constraint: Booking_bookingID_eventID_key, update_columns: updated_at }\n }\n }\n ) {\n checkInDateTime\n randomUUID\n Person {\n personFirstName\n randomUUID\n }\n }\n }\n']);return i=function(){return e},e}function c(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{hRIL:function(n,c,a){"use strict";a.r(c),a.d(c,"CheckInPageModule",(function(){return G}));var s,u=a("s7LF"),l=a("UKGz"),d=a("SVse"),h=a("sZkV"),v=a("iInd"),m=a("mrSG"),k=a("LRne"),p=a("aDUK"),b=a("IxO4"),f=a("jp9Y"),g=a("lTCR"),I=a.n(g),P=a("8Y7J"),U=a("nbgS"),D=I.a(i()),C=I.a(r()),O=I.a(o()),y=((s=function(){function n(t){e(this,n),this.apollo=t}return t(n,[{key:"checkInPersonDetailsToGenericEventUUID",value:function(e){var n=e.personFirstName,t=e.personLastName,o=e.personPhoneNumber,r=e.personEmailAddress,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.apollo;return i.mutate({mutation:D,variables:{personInsertDetails:{personFirstName:n,personLastName:t,personPhoneNumber:o,personEmailAddress:r}}})}},{key:"checkInPersonByUUIDs",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.apollo,o={personUUIDEquals:e,eventUUIDEquals:n},r={mutation:C,variables:o};return console.log("CheckInService:: checkInPersonByUUIDs -> variables",o),t.mutate(r)}},{key:"checkOutPersonByUUIDs",value:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.apollo;return t.mutate({mutation:O,variables:{personUUIDEquals:e,eventUUIDEquals:n}})}}]),n}()).\u0275fac=function(e){return new(e||s)(P.Tb(U.b))},s.\u0275prov=P.Fb({token:s,factory:s.\u0275fac,providedIn:"root"}),s),B=a("mEpY"),E=a("t0hA"),T=a("Y+pZ"),F=a("f2/v"),_=a("L1O8");function A(e,n){1&e&&P.Lb(0)}function w(e,n){if(1&e&&(P.Pb(0,"h2"),P.rc(1),P.Ob(),P.Pb(2,"h3"),P.rc(3),P.cc(4,"date"),P.Ob()),2&e){var t=P.bc();P.zb(1),P.tc("",null==t.savedPersonBooking||null==t.savedPersonBooking.PersonBookings[0]?null:t.savedPersonBooking.PersonBookings[0].Booking.Event.eventName," starts soon"),P.zb(2),P.sc(P.ec(4,2,null==t.savedPersonBooking||null==t.savedPersonBooking.PersonBookings[0]?null:t.savedPersonBooking.PersonBookings[0].Booking.Event.eventStartDateTime,t.dateFormat))}}function N(e,n){1&e&&(P.Nb(0),P.rc(1," Nothing to do \ud83d\ude34. "),P.Kb(2,"br"),P.rc(3," We have already checked in or are awaiting registration. "),P.Kb(4,"br"),P.rc(5," \ud83d\udeaa\ud83e\uddf3\ud83d\udec4 "),P.Mb())}function M(e,n){if(1&e){var t=P.Qb();P.Pb(0,"ion-button",8),P.Xb("click",(function(){return P.mc(t),P.bc().onClickCheckIn()})),P.Kb(1,"ion-icon",9),P.rc(2," Check in "),P.Ob(),P.Pb(3,"ion-button",10),P.Xb("click",(function(){return P.mc(t),P.bc().onClickCheckOut()})),P.rc(4," Check out "),P.Kb(5,"ion-icon",11),P.Ob()}if(2&e){var o=P.bc();P.hc("hidden",o.isAlreadyCheckedIn||null==o.savedPersonBooking),P.zb(3),P.hc("hidden",o.isAlreadyCheckedOut||null==o.savedPersonBooking)}}var R,j,S,L=[{path:"",component:(R=function(){function n(t,o,r,i,c,a,s){var u=this;e(this,n),this.datePipe=t,this.formBuilder=o,this.activatedRoute=r,this.modalController=i,this.toastController=c,this.bookingService=a,this.checkInOutService=s,this.isAlreadyCheckedIn=!1,this.isAlreadyCheckedOut=!1,this.adhocGenericEventName="Eight Mile Plains Chinese Methodist Church",this.adhocCheckinCount=Object(k.a)(1),this.dateFormat="EEEE d MMMM yyyy HH:mm 'UTC'ZZZ",this.adhocCheckinCount=a.getLatestPersonCountForEventUUID("c1836401-aca3-499f-b409-6c8fc1239193");var l=Object(p.d)();if(null!=l){this.savedPersonBooking=l.savedPersonBooking,this.personFormAutofillMostRecent=l.personFormAutofillLast;var d=this.getSetupCreatedForm(this.personFormAutofillMostRecent);this.cachedPersonGenericCheckInForm=d,r.queryParams.subscribe((function(e){var n,t=Object(p.d)();null!=t?(n=t,u.savedPersonBooking=n.savedPersonBooking,u.personFormAutofillMostRecent=n.personFormAutofillLast,u.cachedPersonGenericCheckInForm=u.getSetupCreatedForm(u.personFormAutofillMostRecent)):console.log("CheckInPage:: routeNav() no pre-saved data -> checkNullStoredPreData")}))}else console.log("CheckInPage:: routeNav() no pre-saved data -> checkNullStoredPreData")}return t(n,[{key:"ngOnInit",value:function(){}},{key:"ngAfterViewInit",value:function(){}},{key:"getSetupCreatedForm",value:function(e){var n=this.formBuilder.group(f.a.createPersonForm());return null!=e&&n.patchValue(e),n}},{key:"getLoadBookingPersonsFromLocalStorage",value:function(){var e;e=Object(p.d)(),this.savedPersonBooking=e.savedPersonBooking,this.personFormAutofillMostRecent=e.personFormAutofillLast,console.log("CheckInPage:: getLoadBookingPersonsFromLocalStorage -> this.savedPersonBooking",this.savedPersonBooking,"this.personFormAutofillMostRecent",this.personFormAutofillMostRecent)}},{key:"onClickGenericCheckIn",value:function(e){var n=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.cachedPersonGenericCheckInForm;if(t.invalid)this.presentToast("Invalid form input. <br /> Please check first name, last name, phone number and email address").then((function(){})).catch((function(){}));else{var o=this.presentModal();o.then((function(e){return Object(m.a)(n,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o);case 1:case"end":return e.stop()}}),e)})))})).then((function(e){return e.onDidDismiss()})).then((function(e){e.data.isDeclarationChecked&&n.checkInToGenericLocationEvent(n.cachedPersonGenericCheckInForm.value)})).catch((function(e){}))}}},{key:"checkInToGenericLocationEvent",value:function(e){var n=this,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.checkInOutService;t.checkInPersonDetailsToGenericEventUUID(Object.assign({},e)).subscribe((function(t){var o=t.errors,r=t.data;if(void 0!==o||(null==o?void 0:o.length)>0||void 0===r)console.error(o,r);else{var i=new Date(r.insert_PersonBooking_one.checkInDateTime);if(null!==n.personFormAutofillMostRecent){var c=n.personFormAutofillMostRecent,a=c.randomUUID,s=c.selectedEventUUID;Object(p.f)(Object.assign(Object.assign({},e),{randomUUID:a,selectedEventUUID:s}))}else Object(p.f)(Object.assign({},e));n.personFormAutofillMostRecent=Object(p.c)();var u="\u2705Thank you for checking in ".concat(r.insert_PersonBooking_one.Person.personFirstName,"<br />Welcome to ").concat(n.adhocGenericEventName,"<br />").concat(n.getDateTimeText(i));n.presentToast(u).then((function(){})).catch((function(){}))}}))}},{key:"onClickCheckIn",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.savedPersonBooking,t=n.randomUUID,o=n.PersonBookings,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.personFormAutofillMostRecent,i=r.selectedEventUUID,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.checkInOutService;c.checkInPersonByUUIDs(t,i).subscribe((function(n){var t,r,i,c=n.errors,a=n.data;if(void 0!==c||(null==c?void 0:c.length)>0||void 0===a)console.error(c,a);else{var s=null===(r=null===(t=a.update_PersonBooking.returning)||void 0===t?void 0:t[0])||void 0===r?void 0:r.checkInDateTime,u="\u2705Successfully checked in<br />Welcome to ".concat(null===(i=null==o?void 0:o[0])||void 0===i?void 0:i.Booking.Event.eventName,"<br />").concat(e.getDateTimeText(s));e.presentToast(u).then((function(){})).catch((function(){})),e.isAlreadyCheckedIn=!0}}))}},{key:"onClickCheckOut",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.savedPersonBooking,t=n.randomUUID,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.personFormAutofillMostRecent,r=o.selectedEventUUID,i=o.personFirstName,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.checkInOutService;c.checkOutPersonByUUIDs(t,r).subscribe((function(n){var t,o,r=n.errors,c=n.data;if(void 0!==r||(null==r?void 0:r.length)>0||void 0===c)console.error(r,c);else{var a=null===(o=null===(t=c.update_PersonBooking.returning)||void 0===t?void 0:t[0])||void 0===o?void 0:o.checkOutDateTime,s="\ud83c\udfc1Successfully checked out<br />Have a nice day ".concat(i,"\ud83d\ude03<br />").concat(e.getDateTimeText(a));e.presentToast(s).then((function(){})).catch((function(){})),e.isAlreadyCheckedOut=!0,Object(p.e)(),e.savedPersonBooking=void 0}}))}},{key:"presentToast",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.toastController;return Object(m.a)(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.create({message:e,duration:3500,animated:!0,translucent:!0});case 2:return t.abrupt("return",t.sent.present().then((function(){})).catch((function(e){})));case 3:case"end":return t.stop()}}),t)})))}},{key:"presentModal",value:function(){return Object(m.a)(this,void 0,void 0,regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.modalController.create({component:B.a,cssClass:"modal-custom-class",componentProps:{isDeclarationChecked:!1},swipeToClose:!0,animated:!0,backdropDismiss:!0});case 2:return n=e.sent,e.abrupt("return",n.present().then((function(){return n})));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"getDateTimeText",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.datePipe;return n.transform(e,b.a)}}]),n}(),R.\u0275fac=function(e){return new(e||R)(P.Jb(d.e),P.Jb(u.c),P.Jb(v.a),P.Jb(h.J),P.Jb(h.M),P.Jb(E.a),P.Jb(y))},R.\u0275cmp=P.Db({type:R,selectors:[["app-check-in"]],decls:27,vars:10,consts:[["pageTitle","Check in","isRightAlignedEndButtonHidden","true"],["button",""],[4,"ngIf","ngIfElse"],["elseTemplateBookingRegisteredAvailableToCheckin",""],["elseTemplateCheckInOutISAvailable",""],["src","/assets/images/church-check-in-location-min.png","alt","check-in-lieu-church"],[3,"formGroup","selectedEventName"],["isSubmitMode","true",3,"checkInClick"],["color","tetradicgreen",3,"hidden","click"],["name","log-in-outline"],["color","cobaltblue",3,"hidden","click"],["name","log-out-outline"]],template:function(e,n){if(1&e&&(P.Pb(0,"ion-header"),P.Kb(1,"app-custom-header",0),P.Ob(),P.Pb(2,"ion-content"),P.Pb(3,"ion-card"),P.Pb(4,"ion-card-content"),P.Pb(5,"ion-item",1),P.Pb(6,"ion-label"),P.rc(7," Recent booking pre-registration "),P.Pb(8,"h2"),P.rc(9),P.Ob(),P.pc(10,A,1,0,"ng-container",2),P.pc(11,w,5,5,"ng-template",null,3,P.qc),P.Kb(13,"h3"),P.Ob(),P.Ob(),P.Ob(),P.Pb(14,"ion-card-content"),P.pc(15,N,6,0,"ng-container",2),P.pc(16,M,6,2,"ng-template",null,4,P.qc),P.Ob(),P.Ob(),P.Pb(18,"ion-card"),P.Pb(19,"ion-card-header"),P.rc(20," Check in venue "),P.Ob(),P.Kb(21,"ion-img",5),P.Pb(22,"ion-card-content"),P.Kb(23,"app-person-booking-form",6),P.rc(24),P.cc(25,"async"),P.Ob(),P.Ob(),P.Ob(),P.Pb(26,"app-check-in-floating-button",7),P.Xb("checkInClick",(function(e){return n.onClickGenericCheckIn(e)})),P.Ob()),2&e){var t=P.lc(12),o=P.lc(17);P.zb(9),P.sc(null==n.personFormAutofillMostRecent?null:n.personFormAutofillMostRecent.personFirstName),P.zb(1),P.hc("ngIf",null==n.savedPersonBooking)("ngIfElse",t),P.zb(5),P.hc("ngIf",null==n.savedPersonBooking)("ngIfElse",o),P.zb(8),P.hc("formGroup",n.cachedPersonGenericCheckInForm)("selectedEventName",n.adhocGenericEventName),P.zb(1),P.tc(" ",P.dc(25,8,n.adhocCheckinCount)," check-ins! ")}},directives:[h.o,T.a,h.k,h.g,h.h,h.s,h.w,d.k,h.i,h.q,F.a,u.l,u.f,_.a,h.e,h.p],pipes:[d.b,d.e],styles:[""]}),R)}],q=((S=function n(){e(this,n)}).\u0275mod=P.Hb({type:S}),S.\u0275inj=P.Gb({factory:function(e){return new(e||S)},imports:[[v.i.forChild(L)],v.i]}),S),G=((j=function n(){e(this,n)}).\u0275mod=P.Hb({type:j}),j.\u0275inj=P.Gb({factory:function(e){return new(e||j)},imports:[[d.c,u.g,h.H,u.m,l.a,q]]}),j)}}])}();