Skip to content

Commit ccb7981

Browse files
Merge branch 'development' of https://github.com/RealbindDevTeam/i4t-v2 into readme
2 parents e04bf23 + 0d35ecf commit ccb7981

File tree

12 files changed

+187
-30
lines changed

12 files changed

+187
-30
lines changed

i4t_web/client/imports/app/app.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
44
import { FlexLayoutModule } from '@angular/flex-layout';
55
import { RouterModule } from '@angular/router';
66
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7-
import { MatGridListModule, MatSnackBarModule, MatDatepickerModule, MatNativeDateModule, MatDialogModule, MatSidenavModule, MatListModule, MatCardModule, MatButtonModule, MatInputModule, MatSelectModule, MatSlideToggleModule, MatTabsModule, MatCheckboxModule, MatSliderModule, MatProgressSpinnerModule, MatTooltipModule, MatIconModule, MatToolbarModule, MatMenuModule, MatButtonToggleModule, MatRadioModule, MatExpansionModule, MatStepperModule, MatChipsModule } from '@angular/material';
7+
import { MatGridListModule, MatSnackBarModule, MatDatepickerModule, MatNativeDateModule, MatDialogModule, MatSidenavModule, MatListModule, MatCardModule, MatButtonModule, MatInputModule, MatSelectModule, MatSlideToggleModule, MatTabsModule, MatCheckboxModule, MatSliderModule, MatProgressSpinnerModule, MatTooltipModule, MatIconModule, MatToolbarModule, MatMenuModule, MatButtonToggleModule, MatRadioModule, MatExpansionModule, MatStepperModule, MatChipsModule, MatTableModule } from '@angular/material';
88
import { HttpClientModule, HttpClient } from '@angular/common/http';
99
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
1010
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
@@ -73,6 +73,7 @@ export function createTranslateLoader(http: HttpClient) {
7373
MatExpansionModule,
7474
MatStepperModule,
7575
MatChipsModule,
76+
MatTableModule,
7677
AgmCoreModule.forRoot({
7778
apiKey: 'AIzaSyCFXGTI9kCa4U7YyMd2USL9LCV_JlQinyw'
7879
}),

i4t_web/client/imports/app/app.routes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { OrdersTodayComponent } from "./web/administrator/orders-today/orders-to
6363
import { CashierOrdersTodayComponent } from "./web/cashier/cashier-orders-today.component";
6464
import { EstablishmentListComponent } from './web/administrator/administration/establishment/monthly-config/establishment-list/establishment-list.component';
6565
import { EnableDisableComponent } from './web/administrator/administration/establishment/monthly-config/enable-disable/enable-disable.component';
66+
import { BagsPaymentComponent } from './web/administrator/payment/bags-payment/bags-payment.component';
6667

6768
export const routes: Route[] = [
6869
{
@@ -119,7 +120,8 @@ export const routes: Route[] = [
119120
{ path: 'options', component: OptionsComponent, canActivate: [AdminGuard] },
120121
{ path: 'option-values', component: OptionValueComponent, canActivate: [AdminGuard] },
121122
{ path: 'reward-history-chart/:param1', component: RewardHistoryChartComponent, canActivate: [AdminGuard] },
122-
{ path: 'cashier-orders-today', component: CashierOrdersTodayComponent, canActivate: [CashierGuard] }
123+
{ path: 'cashier-orders-today', component: CashierOrdersTodayComponent, canActivate: [CashierGuard] },
124+
{ path: 'bags-payment', component: BagsPaymentComponent, canActivate: [AdminGuard] }
123125
]
124126
},
125127
{ path: '', component: SigninWebComponent },

i4t_web/client/imports/app/web/administrator/administration/establishment/monthly-config/establishment-list/establishment-list.component.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,25 @@ export class EstablishmentListComponent implements OnInit, OnDestroy {
6969
this._establishments = Establishments.find({}).zone();
7070
this.countEstablishments();
7171
this._establishments.subscribe(() => { this.countEstablishments(); });
72+
73+
this._currencySub = MeteorObservable.subscribe('getCurrenciesByUserId', Meteor.userId()).takeUntil(this._ngUnsubscribe).subscribe(() => {
74+
this._ngZone.run(() => {
75+
let _currenciesIds: string[] = [];
76+
Establishments.collection.find({ creation_user: Meteor.userId() }).forEach(function <Establishment>(establishment, index, args) {
77+
_currenciesIds.push(establishment.currencyId);
78+
});
79+
this._currencies = Currencies.find({ _id: { $in: _currenciesIds } }).zone();
80+
});
81+
});
7282
});
7383
});
7484
this._tableSub = MeteorObservable.subscribe('tables', Meteor.userId()).takeUntil(this._ngUnsubscribe).subscribe(() => {
75-
this._tables = this._tables = Tables.find({}).zone();
76-
});
77-
this._currencySub = MeteorObservable.subscribe('getCurrenciesByUserId').takeUntil(this._ngUnsubscribe).subscribe(() => {
78-
this._currencies = Currencies.find({}).zone();
85+
this._ngZone.run(() => {
86+
this._tables = this._tables = Tables.find({}).zone();
87+
});
7988
});
80-
this._countrySub = MeteorObservable.subscribe('countries').takeUntil(this._ngUnsubscribe).subscribe();
8189

90+
this._countrySub = MeteorObservable.subscribe('countries').takeUntil(this._ngUnsubscribe).subscribe();
8291
this._paymentHistorySub = MeteorObservable.subscribe('getHistoryPaymentsByUser', Meteor.userId()).takeUntil(this._ngUnsubscribe).subscribe();
8392
}
8493

@@ -93,8 +102,15 @@ export class EstablishmentListComponent implements OnInit, OnDestroy {
93102
* Remove all subscriptions
94103
*/
95104
removeSubscription(): void {
105+
/**
96106
this._ngUnsubscribe.next();
97107
this._ngUnsubscribe.complete();
108+
*/
109+
if (this._establishmentSub) { this._establishmentSub.unsubscribe(); }
110+
if (this._tableSub) { this._tableSub.unsubscribe(); }
111+
if (this._currencySub) { this._currencySub.unsubscribe(); }
112+
if (this._countrySub) { this._countrySub.unsubscribe(); }
113+
if (this._paymentHistorySub) { this._paymentHistorySub.unsubscribe(); }
98114
}
99115

100116
/**
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<mat-card>
2+
<mat-card-title>{{'BAGS_PAYMENT.TITLE' | translate }}</mat-card-title>
3+
<mat-card-subtitle>{{'BAGS_PAYMENT.SUBTITLE' | translate}}</mat-card-subtitle>
4+
5+
<mat-card-content>
6+
<div class="example-container mat-elevation-z8">
7+
<mat-table #table [dataSource]="dataSource">
8+
9+
<ng-container matColumnDef="_id">
10+
<mat-header-cell *matHeaderCellDef> Id </mat-header-cell>
11+
<mat-cell *matCellDef="let element"> {{element._id}} </mat-cell>
12+
</ng-container>
13+
14+
<ng-container matColumnDef="isActive">
15+
<mat-header-cell *matHeaderCellDef> Active </mat-header-cell>
16+
<mat-cell *matCellDef="let element"> {{element.isActive}} </mat-cell>
17+
</ng-container>
18+
19+
<ng-container matColumnDef="name">
20+
<mat-header-cell *matHeaderCellDef> Nombre </mat-header-cell>
21+
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
22+
</ng-container>
23+
24+
<ng-container matColumnDef="code">
25+
<mat-header-cell *matHeaderCellDef> Código </mat-header-cell>
26+
<mat-cell *matCellDef="let element"> {{element.code}} </mat-cell>
27+
</ng-container>
28+
29+
<ng-container matColumnDef="numericCode">
30+
<mat-header-cell *matHeaderCellDef> Código </mat-header-cell>
31+
<mat-cell *matCellDef="let element"> {{element.numericCode}} </mat-cell>
32+
</ng-container>
33+
34+
<ng-container matColumnDef="decimal">
35+
<mat-header-cell *matHeaderCellDef> Código </mat-header-cell>
36+
<mat-cell *matCellDef="let element"> {{element.decimal}} </mat-cell>
37+
</ng-container>
38+
39+
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
40+
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
41+
</mat-table>
42+
</div>
43+
</mat-card-content>
44+
45+
<mat-card-actions>
46+
<button mat-button>PAGAR</button>
47+
</mat-card-actions>
48+
</mat-card>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.example-container {
2+
display: flex;
3+
flex-direction: column;
4+
max-height: 500px;
5+
min-width: 300px;
6+
}
7+
8+
.mat-table {
9+
overflow: auto;
10+
max-height: 500px;
11+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { Component, OnInit, OnDestroy, NgZone } from '@angular/core';
2+
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
3+
import { MatTableDataSource } from '@angular/material';
4+
import { Router } from '@angular/router';
5+
import { Meteor } from 'meteor/meteor';
6+
import { MeteorObservable } from 'meteor-rxjs';
7+
import { TranslateService } from '@ngx-translate/core';
8+
import { Observable, Subscription, Subject } from 'rxjs';
9+
import { UserLanguageService } from '../../../services/general/user-language.service';
10+
import { Establishment } from '../../../../../../../both/models/establishment/establishment.model';
11+
import { Establishments } from '../../../../../../../both/collections/establishment/establishment.collection';
12+
import { Currency } from '../../../../../../../both/models/general/currency.model';
13+
import { Currencies } from '../../../../../../../both/collections/general/currency.collection';
14+
15+
@Component({
16+
selector: 'bags-payment',
17+
templateUrl: './bags-payment.component.html',
18+
styleUrls: ['./bags-payment.component.scss']
19+
})
20+
21+
export class BagsPaymentComponent implements OnInit, OnDestroy {
22+
23+
private _user = Meteor.userId();
24+
private _establishments: Observable<Establishment[]>;
25+
private _currencies: Observable<Currency[]>;
26+
private _establishmentSub: Subscription;
27+
private _currencySub: Subscription;
28+
private _ngUnsubscribe: Subject<void> = new Subject<void>();
29+
30+
private _currenciesArray: Currency[] = [];
31+
private displayedColumns = ['_id', 'isActive', 'name', 'code', 'numericCode', 'decimal'];
32+
private dataSource: any;
33+
34+
/**
35+
* MonthlyPaymentComponent Constructor
36+
* @param {Router} router
37+
* @param {NgZone} _ngZone
38+
* @param {TranslateService} translate
39+
* @param {UserLanguageService} _userLanguageService
40+
*/
41+
constructor(private router: Router,
42+
private translate: TranslateService,
43+
private _ngZone: NgZone,
44+
private _userLanguageService: UserLanguageService) {
45+
translate.use(this._userLanguageService.getLanguage(Meteor.user()));
46+
translate.setDefaultLang('en');
47+
}
48+
49+
ngOnInit() {
50+
this.removeSubscriptions();
51+
52+
this._establishmentSub = MeteorObservable.subscribe('establishments', this._user).takeUntil(this._ngUnsubscribe).subscribe(() => {
53+
this._ngZone.run(() => {
54+
this._establishments = Establishments.find({ creation_user: this._user }).zone();
55+
});
56+
});
57+
58+
this._currencySub = MeteorObservable.subscribe('currencies').takeUntil(this._ngUnsubscribe).subscribe(() => {
59+
this._currencies = Currencies.find({}).zone();
60+
61+
this._currenciesArray = Currencies.find({}).fetch();
62+
63+
this.dataSource = new MatTableDataSource(this._currenciesArray);
64+
console.log(this._currenciesArray);
65+
});
66+
}
67+
68+
/**
69+
* Remove all subscriptions
70+
*/
71+
removeSubscriptions(): void {
72+
73+
}
74+
}

i4t_web/client/imports/app/web/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import { OptionValueEditComponent } from './administrator/menu/options/values/op
9595
import { RewardHistoryChartComponent } from './administrator/dashboard/reward-history-chart/reward-history-chart.component';
9696
import { OrdersTodayComponent } from "./administrator/orders-today/orders-today.component";
9797
import { CashierOrdersTodayComponent } from "./cashier/cashier-orders-today.component";
98+
import { BagsPaymentComponent } from './administrator/payment/bags-payment/bags-payment.component';
9899

99100
export const WEB_DECLARATIONS = [
100101
AppComponent,
@@ -160,7 +161,8 @@ export const WEB_DECLARATIONS = [
160161
OptionsComponent,
161162
OptionValueComponent,
162163
RewardHistoryChartComponent,
163-
CashierOrdersTodayComponent
164+
CashierOrdersTodayComponent,
165+
BagsPaymentComponent
164166
];
165167

166168
export const MODAL_DIALOG_DECLARATIONS = [

i4t_web/package-lock.json

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

i4t_web/public/i18n/en.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@
287287
"PAYMENTS": "Service payment",
288288
"MONTHLY_PAYMENT": "Monthly Payment",
289289
"PAYMENT_HISTORY": "Payment History",
290-
"REACTIVATE_RESTAURANT": "Reactivate restaurant"
290+
"REACTIVATE_RESTAURANT": "Reactivate restaurant",
291+
"BAGS": "Bags",
292+
"PURCHASE_BAGS": "Purchase of bags"
291293
},
292294
"MENU_DEFINITION": {
293295
"MENU_DEFINITION": "Menu",
@@ -1836,5 +1838,9 @@
18361838
"SMALL": "NORMAL",
18371839
"MEDIUM": "EXECUTIVE",
18381840
"LARGE": "A LA CARTÉ"
1841+
},
1842+
"BAGS_PAYMENT": {
1843+
"TITLE": "Purchase of bags",
1844+
"SUBTITLE": "Here you can to purchase the bag of points by restaurant that you want"
18391845
}
18401846
}

i4t_web/public/i18n/es.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@
287287
"PAYMENTS": "Pago del servicio",
288288
"MONTHLY_PAYMENT": "Pago mensual",
289289
"PAYMENT_HISTORY": "Historial de Pagos",
290-
"REACTIVATE_RESTAURANT": "Reactivar restaurante"
290+
"REACTIVATE_RESTAURANT": "Reactivar restaurante",
291+
"BAGS": "Bolsas",
292+
"PURCHASE_BAGS": "Compra de bolsas"
291293
},
292294
"MENU_DEFINITION": {
293295
"MENU_DEFINITION": "Menú",
@@ -1836,5 +1838,9 @@
18361838
"SMALL": "NORMAL",
18371839
"MEDIUM": "EJECUTIVA",
18381840
"LARGE": "A LA CARTA"
1841+
},
1842+
"BAGS_PAYMENT": {
1843+
"TITLE": "Compra de bolsas",
1844+
"SUBTITLE": "Aquí puedes comprar la bolsa de puntos por restaurante que desees"
18391845
}
18401846
}

0 commit comments

Comments
 (0)