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,8DAkC3F;AAAA,YAAsI,CAACO,yDAAD,CAAtI;AAAA;;AACA;AAAA,qDAnC2FP,+DAmC3F,CAA2FoC,cAA3F,EAAuH,CAAC;AAC5GX,IAAAA,IAAI,EAAEpB,mDADsG;AAE5GqB,IAAAA,IAAI,EAAE,CAAC;AACCa,MAAAA,OAAO,EAAE,CAAChC,yDAAD,CADV;AAECiC,MAAAA,OAAO,EAAE,CAAChC,QAAD,CAFV;AAGCiC,MAAAA,YAAY,EAAE,CAACjC,QAAD;AAHf,KAAD;AAFsG,GAAD,CAAvH;AAAA;AASA;AACA;AACA","sources":["./src/app/promotions-by-id/promotions-by-id-routing.module.ts","./src/app/promotions-by-id/promotions-by-id.module.ts","./src/app/promotions-by-id/promotions-by-id.page.ts","./node_modules/primeng/fesm2015/primeng-skeleton.mjs"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\nimport { PromotionsByIdPage } from './promotions-by-id.page';\n\nconst routes: Routes = [\n {\n path: ':userId',\n component: PromotionsByIdPage,\n },\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class PromotionsByIdPageRoutingModule {}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IonicModule } from '@ionic/angular';\nimport { ButtonModule } from 'primeng/button';\nimport { SkeletonModule } from 'primeng/skeleton';\nimport { TableModule } from 'primeng/table';\nimport { SharedModule } from '../shared/shared.module';\nimport { PromotionsByIdPageRoutingModule } from './promotions-by-id-routing.module';\nimport { PromotionsByIdPage } from './promotions-by-id.page';\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n IonicModule,\n PromotionsByIdPageRoutingModule,\n SharedModule,\n TableModule,\n ButtonModule,\n SkeletonModule,\n ],\n declarations: [PromotionsByIdPage],\n})\nexport class PromotionsByIdPageModule {}\n","import { Component, OnInit } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { Apollo, gql } from 'apollo-angular';\nimport { CuponsService } from '../shared/cupons-service.service';\n\nconst searchById = gql`\n query promotionsById($userId: String!) {\n promotions(\n where: {\n status: { eq: \"ENABLED\" }\n promotionsOptions: {\n some: {\n value: { eq: \"MANUAL\" }\n and: { option: { code: { eq: \"PRIZE_RELEASE_TRIGGER_MODE\" } } }\n }\n }\n }\n ) {\n nodes {\n id\n code\n }\n }\n cupons(where: { userId: { eq: $userId } }) {\n nodes {\n promotionId\n status\n }\n }\n }\n`;\n\n@Component({\n selector: 'app-promotions-by-id',\n templateUrl: './promotions-by-id.page.html',\n styleUrls: ['./promotions-by-id.page.scss'],\n})\nexport class PromotionsByIdPage implements OnInit {\n dataColumns = [\n { header: 'admin.tableStructure.promotion', field: 'code' },\n { header: 'admin.tableStructure.given', field: 'given' },\n { header: 'admin.tableStructure.waiting', field: 'waiting' },\n { header: 'admin.tableStructure.total', field: 'total' },\n ];\n data: any[];\n userId: string;\n operator = '';\n loaded: boolean = false;\n\n constructor(\n private apollo: Apollo,\n private router: ActivatedRoute,\n public cuponsService: CuponsService\n ) {\n this.router.params.subscribe((params) => {\n this.userId = params['userId'];\n this.operator = params['operator'];\n this.apollo\n .watchQuery({\n query: searchById,\n variables: {\n userId: params['userId'],\n },\n })\n .valueChanges.subscribe((result: any) => {\n this.data = [];\n const cupons: any = [...result.data.cupons.nodes];\n result.data.promotions.nodes.forEach((promotion: any) => {\n let given = 0;\n let waiting = 0;\n let total = 0;\n cupons.forEach((cupon: any) => {\n if (promotion.id === cupon.promotionId) {\n if ((cupon.status as string).toUpperCase() === 'DELIVERED') {\n given++;\n } else {\n waiting++;\n }\n total++;\n }\n });\n this.data.push({\n id: promotion.id,\n code: promotion.code,\n given,\n waiting,\n total,\n });\n this.loaded = true;\n });\n });\n });\n }\n\n ngOnInit() {}\n\n createCupon(x: any) {\n this.cuponsService\n .onCreateCupon({\n promotionId: x.id,\n userId: this.userId,\n operator: this.operator,\n })\n .subscribe(\n (next) => {\n x.waiting++;\n x.total++;\n },\n (error: any) => {\n console.log(error);\n }\n );\n }\n}\n","import * as i0 from '@angular/core';\nimport { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule } from '@angular/core';\nimport * as i1 from '@angular/common';\nimport { CommonModule } from '@angular/common';\n\nclass Skeleton {\n constructor() {\n this.shape = \"rectangle\";\n this.animation = \"wave\";\n this.borderRadius = null;\n this.size = null;\n this.width = \"100%\";\n this.height = \"1rem\";\n }\n containerClass() {\n return {\n 'p-skeleton p-component': true,\n 'p-skeleton-circle': this.shape === 'circle',\n 'p-skeleton-none': this.animation === 'none'\n };\n }\n containerStyle() {\n if (this.size)\n return Object.assign(Object.assign({}, this.style), { width: this.size, height: this.size, borderRadius: this.borderRadius });\n else\n return Object.assign(Object.assign({}, this.style), { width: this.width, height: this.height, borderRadius: this.borderRadius });\n }\n}\nSkeleton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: Skeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });\nSkeleton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"12.0.0\", version: \"13.2.7\", type: Skeleton, selector: \"p-skeleton\", inputs: { styleClass: \"styleClass\", style: \"style\", shape: \"shape\", animation: \"animation\", borderRadius: \"borderRadius\", size: \"size\", width: \"width\", height: \"height\" }, host: { classAttribute: \"p-element\" }, ngImport: i0, template: `\n
\n
\n `, isInline: true, styles: [\".p-skeleton{position:relative;overflow:hidden}.p-skeleton:after{content:\\\"\\\";animation:p-skeleton-animation 1.2s infinite;height:100%;left:0;position:absolute;right:0;top:0;transform:translate(-100%);z-index:1}.p-skeleton.p-skeleton-circle{border-radius:50%}.p-skeleton-none:after{animation:none}@keyframes p-skeleton-animation{0%{transform:translate(-100%)}to{transform:translate(100%)}}\\n\"], directives: [{ type: i1.NgClass, selector: \"[ngClass]\", inputs: [\"class\", \"ngClass\"] }, { type: i1.NgStyle, selector: \"[ngStyle]\", inputs: [\"ngStyle\"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: Skeleton, decorators: [{\n type: Component,\n args: [{ selector: 'p-skeleton', template: `\n
\n
\n `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {\n 'class': 'p-element'\n }, styles: [\".p-skeleton{position:relative;overflow:hidden}.p-skeleton:after{content:\\\"\\\";animation:p-skeleton-animation 1.2s infinite;height:100%;left:0;position:absolute;right:0;top:0;transform:translate(-100%);z-index:1}.p-skeleton.p-skeleton-circle{border-radius:50%}.p-skeleton-none:after{animation:none}@keyframes p-skeleton-animation{0%{transform:translate(-100%)}to{transform:translate(100%)}}\\n\"] }]\n }], propDecorators: { styleClass: [{\n type: Input\n }], style: [{\n type: Input\n }], shape: [{\n type: Input\n }], animation: [{\n type: Input\n }], borderRadius: [{\n type: Input\n }], size: [{\n type: Input\n }], width: [{\n type: Input\n }], height: [{\n type: Input\n }] } });\nclass SkeletonModule {\n}\nSkeletonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: SkeletonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });\nSkeletonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: SkeletonModule, declarations: [Skeleton], imports: [CommonModule], exports: [Skeleton] });\nSkeletonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: SkeletonModule, imports: [[CommonModule]] });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.2.7\", ngImport: i0, type: SkeletonModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [CommonModule],\n exports: [Skeleton],\n declarations: [Skeleton]\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Skeleton, SkeletonModule };\n"],"names":["i0","Component","ChangeDetectionStrategy","ViewEncapsulation","Input","NgModule","i1","CommonModule","Skeleton","constructor","shape","animation","borderRadius","size","width","height","containerClass","containerStyle","Object","assign","style","ɵfac","ɵcmp","NgClass","NgStyle","type","args","selector","template","changeDetection","OnPush","encapsulation","None","host","styles","styleClass","SkeletonModule","ɵmod","ɵinj","imports","exports","declarations"],"sourceRoot":"webpack:///"}