Skip to content

Commit e04bf23

Browse files
Merge whith development branch
2 parents 7e316fd + 81bebfb commit e04bf23

File tree

66 files changed

+1724
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1724
-518
lines changed

i4t_mobile/src/assets/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@
129129
"ERROR_TITLE": "Error"
130130
},
131131
"SIGN_OUT": "Sign Out",
132-
"MSG_COMFIRM": "Your data has been updated"
132+
"MSG_COMFIRM": "Your data has been updated",
133+
"FULL_NAME": "Full name",
134+
"GENDER": "Gender"
133135
},
134136
"CODE_TYPE_SELECT": {
135137
"TITTLE": "Type of code",

i4t_mobile/src/assets/i18n/es.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@
129129
"ERROR_TITLE": "Error"
130130
},
131131
"SIGN_OUT": "Cerrar sesión",
132-
"MSG_COMFIRM": "Tus datos han sido actualizados"
132+
"MSG_COMFIRM": "Tus datos han sido actualizados",
133+
"FULL_NAME": "Nombres y apellidos",
134+
"GENDER": "Género"
133135
},
134136
"CODE_TYPE_SELECT": {
135137
"TITTLE": "Tipo de código",

i4t_mobile/src/pages/auth/signup/signup.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@
4242
<div *ngIf="signupForm.controls['username'].hasError('maxlength') && signupForm.controls['username'].touched" class="error-message">
4343
<p class="error-message">{{'MOBILE.SIGNUP.MAX_LENGTH_USERNAME' | translate}}</p>
4444
</div>
45-
46-
47-
<ion-item>
48-
<ion-label floating>
49-
<ion-icon name="gender"></ion-icon>
50-
{{'MOBILE.SIGNUP.GENDER' | translate}}
51-
</ion-label>
52-
<ion-select formControlName="gender" [(ngModel)]="_selectedGender" style="color: white">
53-
<ion-option *ngFor="let gender of _genderArray" value="{{gender.value}}">{{gender.label | translate}}</ion-option>
54-
</ion-select>
55-
</ion-item>
56-
5745
<ion-item>
5846
<ion-label floating>
5947
<ion-icon name="mail"></ion-icon>

i4t_mobile/src/pages/auth/signup/signup.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export class SignupComponent implements OnInit {
5353
username: new FormControl('', [Validators.required, Validators.minLength(6), Validators.maxLength(20)]),
5454
email: new FormControl('', [Validators.required, Validators.minLength(6), Validators.maxLength(40), CustomValidators.emailValidator]),
5555
password: new FormControl('', [Validators.required, Validators.minLength(8), Validators.maxLength(20)]),
56-
confirmPassword: new FormControl('', [Validators.required, Validators.minLength(8), Validators.maxLength(20)]),
57-
gender: new FormControl('', [Validators.required])
56+
confirmPassword: new FormControl('', [Validators.required, Validators.minLength(8), Validators.maxLength(20)])
5857
});
5958
this.error = '';
6059

@@ -66,11 +65,9 @@ export class SignupComponent implements OnInit {
6665
register() {
6766

6867
if (this.signupForm.value.password == this.signupForm.value.confirmPassword) {
69-
70-
this.userProfile.first_name = "";
71-
this.userProfile.last_name = "";
68+
this.userProfile.full_name = "";
7269
this.userProfile.language_code = this.userLang;
73-
this.userProfile.gender = this.signupForm.value.gender;
70+
this.userProfile.gender = "";
7471

7572
if (this.signupForm.valid) {
7673
let confirmMsg: string;
@@ -94,6 +91,7 @@ export class SignupComponent implements OnInit {
9491
role_id: '400',
9592
is_active: true,
9693
establishment_work: '',
94+
grant_start_points: true,
9795
penalties: [],
9896
current_establishment: '',
9997
current_table: ''
@@ -162,6 +160,7 @@ export class SignupComponent implements OnInit {
162160
is_active: true,
163161
establishment_work: '',
164162
penalties: [],
163+
grant_start_points: true,
165164
current_establishment: '',
166165
current_table: ''
167166
});

i4t_mobile/src/pages/customer/options/settings/settings.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h2 style="font-weight: bold;">{{'MOBILE.SETTINGS.MY_DATA' | translate}}</h2>
4343
<ion-label floating>{{'MOBILE.USERNAME' | translate}}</ion-label>
4444
<ion-input formControlName="username" type="text"></ion-input>
4545
</ion-item>
46+
4647
<ion-item *ngIf="_userForm.controls['first_name']">
4748
<ion-label floating>{{'MOBILE.SETTINGS.FIRST_NAME' | translate}}</ion-label>
4849
<ion-input formControlName="first_name" type="text"></ion-input>
@@ -51,6 +52,21 @@ <h2 style="font-weight: bold;">{{'MOBILE.SETTINGS.MY_DATA' | translate}}</h2>
5152
<ion-label floating>{{'MOBILE.SETTINGS.LAST_NAME' | translate}}</ion-label>
5253
<ion-input formControlName="last_name" type="text"></ion-input>
5354
</ion-item>
55+
56+
<ion-item *ngIf="_userForm.controls['full_name']">
57+
<ion-label floating>{{'MOBILE.SETTINGS.FULL_NAME' | translate}}</ion-label>
58+
<ion-input formControlName="full_name" type="text"></ion-input>
59+
</ion-item>
60+
61+
<ion-item *ngIf="_userForm.controls['gender']">
62+
<ion-label>
63+
<ion-icon name="gender"></ion-icon>
64+
{{'MOBILE.SETTINGS.GENDER' | translate}}
65+
</ion-label>
66+
<ion-select formControlName="gender" [(ngModel)]="_selectedGender">
67+
<ion-option *ngFor="let gender of _genderArray" value="{{gender.value}}">{{gender.label | translate}}</ion-option>
68+
</ion-select>
69+
</ion-item>
5470
</ion-list>
5571

5672
<div *ngIf="this._user.username">

i4t_mobile/src/pages/customer/options/settings/settings.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ export class SettingsPage implements OnInit, OnDestroy {
4141
private _languageCode: string;
4242
private _imageProfile: string;
4343
private _userLang: string;
44-
4544
private _user: any;
4645
private _userDetail: any;
4746
private _languages: any;
48-
4947
private _validateChangeEmail: boolean = true;
5048
private _validateChangePass: boolean = true;
51-
5249
private disconnectSubscription: Subscription;
50+
private _genderArray: any[] = [];
5351

5452
/**
5553
* SettingsPage constructor
@@ -88,7 +86,6 @@ export class SettingsPage implements OnInit, OnDestroy {
8886
* ionViewWillEnter implementation
8987
*/
9088
ionViewWillEnter() {
91-
this.init();
9289
}
9390

9491
init() {
@@ -104,6 +101,9 @@ export class SettingsPage implements OnInit, OnDestroy {
104101
});
105102
});
106103

104+
this._genderArray = [{ value: "SIGNUP.MALE_GENDER", label: "SIGNUP.MALE_GENDER" },
105+
{ value: "SIGNUP.FEMALE_GENDER", label: "SIGNUP.FEMALE_GENDER" },
106+
{ value: "SIGNUP.OTHER_GENDER", label: "SIGNUP.OTHER_GENDER" }];
107107

108108
this._userDetailSubscription = MeteorObservable.subscribe('getUserDetailsByUser', Meteor.userId()).takeUntil(this.ngUnsubscribe).subscribe(() => {
109109
this._ngZone.run(() => {
@@ -121,9 +121,10 @@ export class SettingsPage implements OnInit, OnDestroy {
121121
}
122122

123123
if (this._user && this._user.username) {
124-
this._userForm = this.formBuilder.group({
124+
this._userForm = new FormGroup({
125125
username: new FormControl({ value: this._user.username, disabled: !controlsDisabled }),
126-
language_code: new FormControl({ value: this._user.profile.language_code, disabled: controlsDisabled })
126+
language_code: new FormControl({ value: this._user.profile.language_code, disabled: controlsDisabled }),
127+
gender: new FormControl({value: this._user.profile.gender, disabled: controlsDisabled})
127128
});
128129

129130
this._validateChangePass = false;
@@ -134,11 +135,16 @@ export class SettingsPage implements OnInit, OnDestroy {
134135
controlsDisabled = true
135136
}
136137

138+
/**
137139
let first_name: FormControl = new FormControl({ value: this._user.profile.first_name, disabled: controlsDisabled });
138140
this._userForm.addControl('first_name', first_name);
139141
140142
let last_name: FormControl = new FormControl({ value: this._user.profile.last_name, disabled: controlsDisabled });
141143
this._userForm.addControl('last_name', last_name);
144+
*/
145+
146+
let full_name: FormControl = new FormControl({ value: this._user.profile.full_name, disabled: controlsDisabled });
147+
this._userForm.addControl('full_name', full_name);
142148
}
143149
});
144150
});
@@ -180,9 +186,11 @@ export class SettingsPage implements OnInit, OnDestroy {
180186
$set:
181187
{
182188
profile: {
183-
first_name: this._userForm.value.first_name,
184-
last_name: this._userForm.value.last_name,
185-
language_code: this._userForm.value.language_code
189+
//first_name: this._userForm.value.first_name,
190+
//last_name: this._userForm.value.last_name,
191+
full_name: this._userForm.value.full_name,
192+
language_code: this._userForm.value.language_code,
193+
gender: this._userForm.value.gender
186194
}
187195
}
188196
});

i4t_mobile/src/pages/customer/orders/order-confirm/order-confirm.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import { Options } from 'i4t_web/both/collections/menu/option.collection';
2020
import { OptionValue } from 'i4t_web/both/models/menu/option-value.model';
2121
import { OptionValues } from 'i4t_web/both/collections/menu/option-value.collection';
2222
import { Network } from '@ionic-native/network';
23-
23+
import { EstablishmentPoint } from 'i4t_web/both/models/points/establishment-point.model';
24+
import { EstablishmentPoints } from 'i4t_web/both/collections/points/establishment-points.collection';
25+
import { NegativePoint } from 'i4t_web/both/models/points/negative-point.model';
26+
import { NegativePoints } from 'i4t_web/both/collections/points/negative-points.collection';
2427

2528
@Component({
2629
selector: 'order-confirm',
@@ -37,6 +40,8 @@ export class OrderConfirmPage implements OnInit, OnDestroy {
3740
private _rewardPointsSub: Subscription;
3841
private _optionSub: Subscription;
3942
private _optionValuesSub: Subscription;
43+
private _establishmentPointsSub: Subscription;
44+
private _negativePointsSub: Subscription;
4045
private ngUnsubscribe: Subject<void> = new Subject<void>();
4146

4247
private _orders: Observable<Order[]>;
@@ -107,6 +112,8 @@ export class OrderConfirmPage implements OnInit, OnDestroy {
107112
});
108113
});
109114
});
115+
this._establishmentPointsSub = MeteorObservable.subscribe('getEstablishmentPointsByIds',[this._res_code]).takeUntil(this.ngUnsubscribe).subscribe();
116+
this._negativePointsSub = MeteorObservable.subscribe('getNegativePointsByEstablishmentId', this._res_code).takeUntil(this.ngUnsubscribe).subscribe();
110117
}
111118
});
112119
});
@@ -360,6 +367,22 @@ export class OrderConfirmPage implements OnInit, OnDestroy {
360367
}
361368
}
362369
});
370+
371+
let _establishmentPoints: EstablishmentPoint = EstablishmentPoints.findOne({ establishment_id: _order.establishment_id });
372+
let _negativePoints: NegativePoint = NegativePoints.findOne({ establishment_id: _order.establishment_id, order_id: _order._id, user_id: _order.creation_user });
373+
374+
if (_negativePoints) {
375+
NegativePoints.update({ _id: _negativePoints._id }, { $set: { was_cancelled: true } });
376+
let _newPoints: number = Number.parseInt(_establishmentPoints.current_points.toString()) + Number.parseInt(_negativePoints.redeemed_points.toString());
377+
if (_newPoints >= 0) {
378+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _newPoints, negative_balance: false } });
379+
} else {
380+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _newPoints, negative_balance: true } });
381+
}
382+
} else {
383+
let _pointsResult: number = Number.parseInt(_establishmentPoints.current_points.toString()) + Number.parseInt(item.redeemed_points.toString());
384+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _pointsResult, negative_balance: false } });
385+
}
363386
}
364387
});
365388

i4t_mobile/src/pages/customer/orders/orders.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import { Options } from 'i4t_web/both/collections/menu/option.collection';
3131
import { OptionValue } from 'i4t_web/both/models/menu/option-value.model';
3232
import { OptionValues } from 'i4t_web/both/collections/menu/option-value.collection';
3333
import { Network } from '@ionic-native/network';
34+
import { EstablishmentPoint } from 'i4t_web/both/models/points/establishment-point.model';
35+
import { EstablishmentPoints } from 'i4t_web/both/collections/points/establishment-points.collection';
36+
import { NegativePoint } from 'i4t_web/both/models/points/negative-point.model';
37+
import { NegativePoints } from 'i4t_web/both/collections/points/negative-points.collection';
3438

3539
@Component({
3640
selector: 'page-orders',
@@ -51,6 +55,8 @@ export class OrdersPage implements OnInit, OnDestroy {
5155
private _otherUSerDetailSub: Subscription;
5256
private _optionSub: Subscription;
5357
private _optionValuesSub: Subscription;
58+
private _establishmentPointsSub: Subscription;
59+
private _negativePointsSub: Subscription;
5460
private ngUnsubscribe: Subject<void> = new Subject<void>();
5561

5662
private _userLang: string;
@@ -166,6 +172,8 @@ export class OrdersPage implements OnInit, OnDestroy {
166172
});
167173
});
168174
});
175+
this._establishmentPointsSub = MeteorObservable.subscribe('getEstablishmentPointsByIds',[this._res_code]).takeUntil(this.ngUnsubscribe).subscribe();
176+
this._negativePointsSub = MeteorObservable.subscribe('getNegativePointsByEstablishmentId', this._res_code).takeUntil(this.ngUnsubscribe).subscribe();
169177
}
170178

171179
this._usersSub = MeteorObservable.subscribe('getUserByTableId', this._userDetail.current_establishment, this._userDetail.current_table).takeUntil(this.ngUnsubscribe).subscribe();
@@ -334,6 +342,22 @@ export class OrdersPage implements OnInit, OnDestroy {
334342
}
335343
}
336344
});
345+
346+
let _establishmentPoints: EstablishmentPoint = EstablishmentPoints.findOne({ establishment_id: _order.establishment_id });
347+
let _negativePoints: NegativePoint = NegativePoints.findOne({ establishment_id: _order.establishment_id, order_id: _order._id, user_id: _order.creation_user });
348+
349+
if (_negativePoints) {
350+
NegativePoints.update({ _id: _negativePoints._id }, { $set: { was_cancelled: true } });
351+
let _newPoints: number = Number.parseInt(_establishmentPoints.current_points.toString()) + Number.parseInt(_negativePoints.redeemed_points.toString());
352+
if (_newPoints >= 0) {
353+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _newPoints, negative_balance: false } });
354+
} else {
355+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _newPoints, negative_balance: true } });
356+
}
357+
} else {
358+
let _pointsResult: number = Number.parseInt(_establishmentPoints.current_points.toString()) + Number.parseInt(item.redeemed_points.toString());
359+
EstablishmentPoints.update({ _id: _establishmentPoints._id }, { $set: { current_points: _pointsResult, negative_balance: false } });
360+
}
337361
}
338362
});
339363

i4t_web/.meteor/packages

100755100644
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
# 'meteor add' and 'meteor remove' will edit this file for you,
55
# but you can also edit it by hand.
66

7-
meteor-base@1.2.0 # Packages every Meteor app needs to have
7+
meteor-base@1.3.0 # Packages every Meteor app needs to have
88
mobile-experience@1.0.5 # Packages for a great mobile UX
9-
mongo@1.3.1 # The database Meteor supports right now
9+
mongo@1.4.2 # The database Meteor supports right now
1010
reactive-var@1.0.11 # Reactive variable for tracker
1111
tracker@1.1.3 # Meteor's client-side reactive programming library
1212

13-
standard-minifier-css@1.3.5 # CSS minifier run for production mode
14-
standard-minifier-js@2.2.0 # JS minifier run for production mode
15-
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers
16-
ecmascript@0.9.0 # Enable ECMAScript2015+ syntax in app code
17-
shell-server@0.3.0 # Server-side component of the `meteor shell` command
13+
standard-minifier-css@1.4.0 # CSS minifier run for production mode
14+
standard-minifier-js@2.3.1 # JS minifier run for production mode
15+
es5-shim@4.7.0 # ECMAScript 5 compatibility for older browsers
16+
ecmascript@0.10.0 # Enable ECMAScript2015+ syntax in app code
17+
shell-server@0.3.1 # Server-side component of the `meteor shell` command
1818

1919
angular-compilers
2020
accounts-password@1.5.0
21-
accounts-ui@1.2.0
22-
accounts-twitter@1.4.0
23-
accounts-google@1.3.0
24-
check@1.2.5
21+
accounts-ui@1.3.0
22+
accounts-twitter@1.4.1
23+
accounts-google@1.3.1
24+
check@1.3.0
2525
email@1.2.3
2626
astrocoders:one-signal
2727
vsivsi:job-collection

i4t_web/.meteor/release

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
METEOR@1.6.0.1
1+
METEOR@1.6.1

0 commit comments

Comments
 (0)