Skip to content

Commit 83b4ea3

Browse files
author
Leonardo Espinosa Torres
authored
Merge pull request #72 from RealbindDevTeam/substract-pts-logic
Substract pts logic
2 parents f7d06fb + 910c472 commit 83b4ea3

File tree

13 files changed

+114
-85
lines changed

13 files changed

+114
-85
lines changed

i4t_mobile/meteor-client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__meteor_runtime_config__ = {
22
"meteorEnv": {},
3-
"DDP_DEFAULT_CONNECTION_URL": "http://192.168.0.8:3000/",
4-
"ROOT_URL": "http://192.168.0.8:3000/"
3+
"DDP_DEFAULT_CONNECTION_URL": "http://192.168.0.3:3000/",
4+
"ROOT_URL": "http://192.168.0.3:3000/"
55
};
66

77
//////////////////////////////////////////////////////////////////////////

i4t_web/both/models/points/bag-plan-history.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export interface BagPlanHistory extends CollectionObject {
99
plan_label: string;
1010
value_points: number;
1111
price: PricePoints;
12-
establishment_id: string;
13-
negative_value_points: PricePoints;
12+
establishments_ids: string[];
13+
negative_value_points?: PricePoints;
1414
}

i4t_web/both/models/points/bag-plan.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export interface BagPlan extends CollectionObject {
1717
export interface PricePoints {
1818
country_id: string;
1919
price: number;
20+
currency: string
2021
}

i4t_web/client/imports/app/web/administrator/administration/collaborators/edition/collaborators-edition.component.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@
2525
<tr>
2626
<td colspan="3" style="padding-top: 10px;">
2727
<mat-form-field style="width: 100%">
28-
<input matInput required formControlName="name" placeholder="{{'NAME' | translate}}" minlength="1" maxlength="70" #inputName/>
29-
<mat-hint align="end">{{inputName.value.length}} / 70</mat-hint>
30-
</mat-form-field>
31-
</td>
32-
<td colspan="3" style="padding-top: 10px;">
33-
<mat-form-field style="width: 100%">
34-
<input matInput required formControlName="last_name" placeholder="{{'LAST_NAME' | translate}}" minlength="1" maxlength="70"
35-
#inputAddress/>
36-
<mat-hint align="end">{{inputAddress.value.length}} / 70</mat-hint>
28+
<input matInput required formControlName="fullName" placeholder="{{'NAME' | translate}}" minlength="1" maxlength="70" #inputName/>
29+
<mat-hint align="end">{{inputName.value.length}} / 50</mat-hint>
3730
</mat-form-field>
3831
</td>
3932
</tr>

i4t_web/client/imports/app/web/administrator/administration/collaborators/edition/collaborators-edition.component.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ export class CollaboratorsEditionComponent implements OnInit, OnDestroy {
8282
this.removeSubscriptions();
8383
this.validateWaiterRole(this.selectUserDetail.role_id);
8484
this._collaboratorEditionForm = this._formBuilder.group({
85-
name: [this.selectUser.profile.first_name, [Validators.required, Validators.minLength(1), Validators.maxLength(70)]],
86-
last_name: [this.selectUser.profile.last_name, [Validators.required, Validators.minLength(1), Validators.maxLength(70)]],
85+
//name: [this.selectUser.profile.first_name, [Validators.required, Validators.minLength(1), Validators.maxLength(70)]],
86+
//last_name: [this.selectUser.profile.last_name, [Validators.required, Validators.minLength(1), Validators.maxLength(70)]],
87+
fullName: [this.selectUser.profile.full_name, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
8788
birthdate: [this.selectUserDetail.birthdate, [Validators.required]],
8889
establishment_work: [this.selectUserDetail.establishment_work],
8990
role: [this.selectUserDetail.role_id],
@@ -176,10 +177,12 @@ export class CollaboratorsEditionComponent implements OnInit, OnDestroy {
176177
Users.update({ _id: this.selectUser._id }, {
177178
$set: {
178179
profile: {
179-
first_name: this._collaboratorEditionForm.value.name,
180-
last_name: this._collaboratorEditionForm.value.last_name,
180+
//first_name: this._collaboratorEditionForm.value.name,
181+
//last_name: this._collaboratorEditionForm.value.last_name,
182+
full_name: this._collaboratorEditionForm.value.fullName,
181183
language_code: this.selectUser.profile.language_code,
182-
image: this.selectUser.profile.image
184+
image: this.selectUser.profile.image,
185+
gender: this.selectUser.profile.gender
183186
}
184187
}
185188
});
@@ -236,8 +239,7 @@ export class CollaboratorsEditionComponent implements OnInit, OnDestroy {
236239
* Form reset
237240
*/
238241
cancel() {
239-
this._collaboratorEditionForm.controls['name'].reset();
240-
this._collaboratorEditionForm.controls['last_name'].reset();
242+
this._collaboratorEditionForm.controls['fullName'].reset();
241243
this._collaboratorEditionForm.controls['birthdate'].reset();
242244
this._collaboratorEditionForm.controls['establishment_work'].reset();
243245
this._collaboratorEditionForm.controls['phone'].reset();

i4t_web/client/imports/app/web/administrator/administration/collaborators/register/collaborators-register.component.html

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,38 @@
2929
<tr>
3030
<td colspan="3" style="padding-top: 10px;">
3131
<mat-form-field style="width: 100%">
32-
<input matInput required formControlName="name" placeholder="{{'NAME' | translate}}" minlength="1" maxlength="70" #inputName/>
33-
<mat-hint align="end">{{inputName.value.length}} / 70</mat-hint>
32+
<input matInput required formControlName="fullName" placeholder="{{'NAME' | translate}}" minlength="1" maxlength="50" #inputName/>
33+
<mat-hint align="end">{{inputName.value.length}} / 50</mat-hint>
3434
</mat-form-field>
3535
</td>
3636
<td colspan="3" style="padding-top: 10px;">
3737
<mat-form-field style="width: 100%">
38-
<input matInput required formControlName="last_name" placeholder="{{'LAST_NAME' | translate}}" minlength="1" maxlength="70"
39-
#inputAddress/>
40-
<mat-hint align="end">{{inputAddress.value.length}} / 70</mat-hint>
38+
<mat-select formControlName="gender" placeholder="{{'SIGNUP.GENDER_LBL' | translate}}">
39+
<mat-option *ngFor="let gender of _genderArray" value="{{gender.value}}">{{gender.label | translate}}</mat-option>
40+
</mat-select>
4141
</mat-form-field>
4242
</td>
4343
</tr>
4444
</table>
4545

4646
<table style="width: 100%" cellspacing="0">
4747
<tr>
48-
<td colspan="3" style="padding-top: 10px;">
49-
<mat-form-field style="width: 100%">
50-
<mat-select formControlName="gender" placeholder="{{'SIGNUP.GENDER_LBL' | translate}}">
51-
<mat-option *ngFor="let gender of _genderArray" value="{{gender.value}}">{{gender.label | translate}}</mat-option>
52-
</mat-select>
53-
</mat-form-field>
54-
</td>
5548
<td colspan="1" style="padding-top: 10px; width: 50%">
5649
<mat-form-field style="width: 100%">
5750
<input matInput [matDatepicker]="picker" placeholder="{{'BIRTHDATE' | translate}}" formControlName="birthdate">
5851
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
5952
<mat-datepicker #picker></mat-datepicker>
6053
</mat-form-field>
6154
</td>
62-
</tr>
63-
</table>
64-
<table style="width: 100%" cellspacing="0">
65-
<tr>
6655
<td colspan="2" style="padding-top: 10px;">
67-
<mat-form-field style="width: 50%">
68-
<input matInput formControlName="phone" placeholder="{{'PHONE' | translate}}" #inputPhone maxlength="40"/>
56+
<mat-form-field style="width: 100%">
57+
<input matInput formControlName="phone" placeholder="{{'PHONE' | translate}}" #inputPhone maxlength="40" />
6958
<mat-hint align="end">{{inputPhone.value.length}} / 40</mat-hint>
7059
</mat-form-field>
7160
</td>
7261
</tr>
62+
</table>
63+
<table style="width: 100%" cellspacing="0">
7364
<tr *ngIf="_showTablesSelect && _showTablesSelectByRest">
7465
<td colspan="1" style="padding-top: 10px; width: 50%">
7566
<mat-checkbox class="checkbox" (change)="pushSelectArray($event)">{{'COLLABORATORS_REGISTER.TABLES_ASSIGNMENT' | translate}}</mat-checkbox>

i4t_web/client/imports/app/web/administrator/administration/collaborators/register/collaborators-register.component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ export class CollaboratorsRegisterComponent implements OnInit, OnDestroy {
8181
ngOnInit() {
8282
this.removeSubscriptions();
8383
this._collaboratorRegisterForm = new FormGroup({
84-
name: new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(70)]),
85-
last_name: new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(70)]),
84+
//name: new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(70)]),
85+
//last_name: new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(70)]),
8686
birthdate: new FormControl('', [Validators.required]),
8787
establishment_work: new FormControl('', [Validators.required]),
8888
role: new FormControl('', [Validators.required]),
@@ -93,7 +93,8 @@ export class CollaboratorsRegisterComponent implements OnInit, OnDestroy {
9393
confirmPassword: new FormControl('', [Validators.required, Validators.minLength(8), Validators.maxLength(20)]),
9494
table_init: new FormControl(0),
9595
table_end: new FormControl(0),
96-
gender: new FormControl('', [Validators.required])
96+
gender: new FormControl('', [Validators.required]),
97+
fullName: new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(50)])
9798
});
9899
this._establishments = Establishments.find({}).zone();
99100
this._establishmentSub = MeteorObservable.subscribe('establishments', Meteor.userId()).takeUntil(this._ngUnsubscribe).subscribe();
@@ -173,8 +174,7 @@ export class CollaboratorsRegisterComponent implements OnInit, OnDestroy {
173174
case 0:
174175
return true;
175176
case 1:
176-
if (this._collaboratorRegisterForm.controls['name'].valid
177-
&& this._collaboratorRegisterForm.controls['last_name'].valid
177+
if (this._collaboratorRegisterForm.controls['fullName'].valid
178178
&& this._collaboratorRegisterForm.controls['establishment_work'].valid
179179
&& this._collaboratorRegisterForm.controls['role'].valid
180180
&& this._collaboratorRegisterForm.controls['birthdate'].valid) {
@@ -222,8 +222,9 @@ export class CollaboratorsRegisterComponent implements OnInit, OnDestroy {
222222
if (Meteor.userId()) {
223223
if (this._collaboratorRegisterForm.valid) {
224224
if (this._collaboratorRegisterForm.value.password == this._collaboratorRegisterForm.value.confirmPassword) {
225-
this._userProfile.first_name = this._collaboratorRegisterForm.value.name;
226-
this._userProfile.last_name = this._collaboratorRegisterForm.value.last_name;
225+
//this._userProfile.first_name = this._collaboratorRegisterForm.value.name;
226+
//this._userProfile.last_name = this._collaboratorRegisterForm.value.last_name;
227+
this._userProfile.full_name = this._collaboratorRegisterForm.value.fullName;
227228
this._userProfile.language_code = this._userLang;
228229
this._userProfile.gender = this._collaboratorRegisterForm.value.gender;
229230

@@ -318,8 +319,7 @@ export class CollaboratorsRegisterComponent implements OnInit, OnDestroy {
318319
* Reset register form
319320
*/
320321
cancel() {
321-
this._collaboratorRegisterForm.controls['name'].reset();
322-
this._collaboratorRegisterForm.controls['last_name'].reset();
322+
this._collaboratorRegisterForm.controls['fullName'].reset();
323323
this._collaboratorRegisterForm.controls['birthdate'].reset();
324324
this._collaboratorRegisterForm.controls['establishment_work'].reset();
325325
this._collaboratorRegisterForm.controls['phone'].reset();

i4t_web/client/imports/app/web/administrator/administration/establishment/register/create-confirm/create-confirm.component.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
<mat-card-title>{{ 'RESTAURANT_REGISTER.RESTAURANT_CREATION' | translate }}</mat-card-title>
33
<mat-card-content>
44
<div style="width: 450px; margin-bottom: 15px">
5-
<span style="color:red">* </span>{{ 'ADMIN_SIGNUP.PAYMENT_PLAN_INFO.BAG_PLAN_INFO' | translate }}
5+
<span style="color:red">* </span>{{'RESTAURANT_REGISTER.DIALOG_SENTENCE_1A' | translate}} {{getValuePoints()}}
6+
{{'RESTAURANT_REGISTER.DIALOG_SENTENCE_1B' | translate}} {{getBagPlanLabel() | translate}}
7+
</div>
8+
9+
<div style="width: 450px; margin-bottom: 15px">
10+
<span style="color:red">* </span>{{'RESTAURANT_REGISTER.DIALOG_SENTENCE_2' | translate}}
11+
</div>
12+
13+
<div style="width: 450px; margin-bottom: 15px">
14+
{{ 'RESTAURANT_REGISTER.DIALOG_SENTENCE_3' | translate }}
615
</div>
716
</mat-card-content>
817
<mat-card-actions align="end">

i4t_web/client/imports/app/web/administrator/administration/establishment/register/create-confirm/create-confirm.component.ts

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component, NgZone, OnInit, OnDestroy } from '@angular/core';
22
import { MatDialogRef } from '@angular/material';
33
import { MeteorObservable } from "meteor-rxjs";
44
import { Observable, Subscription, Subject } from 'rxjs';
5-
import { Parameter } from '../../../../../../../../../both/models/general/parameter.model';
6-
import { Parameters } from '../../../../../../../../../both/collections/general/parameter.collection';
5+
import { BagPlan } from '../../../../../../../../../both/models/points/bag-plan.model';
6+
import { BagPlans } from '../../../../../../../../../both/collections/points/bag-plans.collection';
77

88
@Component({
99
selector: 'create-confirm',
@@ -27,32 +27,20 @@ export class CreateConfirmComponent implements OnInit, OnDestroy {
2727
* ngOnInit Implementation
2828
*/
2929
ngOnInit() {
30-
this.removeSubscriptions();
31-
this._parameterSub = MeteorObservable.subscribe('getParameters').takeUntil(this._ngUnsubscribe).subscribe();
32-
}
3330

34-
/**
35-
* Remove all Subscriptions
36-
*/
37-
removeSubscriptions(): void {
38-
this._ngUnsubscribe.next();
39-
this._ngUnsubscribe.complete();
4031
}
4132

42-
getDiscountPercent() {
43-
let discount = Parameters.findOne({ name: 'first_pay_discount' });
44-
if (discount) {
45-
return discount.value;
33+
getValuePoints(): number {
34+
let _lBagPlan: BagPlan = BagPlans.findOne({ _id: "100" });
35+
if (_lBagPlan) {
36+
return _lBagPlan.value_points;
4637
}
4738
}
4839

49-
/**
50-
* Function to gets de first day of charge
51-
*/
52-
getFirstDay(): string {
53-
let firstDay = Parameters.findOne({ name: 'start_payment_day' });
54-
if (firstDay) {
55-
return firstDay.value;
40+
getBagPlanLabel(): string {
41+
let _lBagPlan: BagPlan = BagPlans.findOne({ _id: "100" });
42+
if (_lBagPlan) {
43+
return _lBagPlan.label;
5644
}
5745
}
5846

@@ -74,6 +62,5 @@ export class CreateConfirmComponent implements OnInit, OnDestroy {
7462
* ngOnDestroy Implementation
7563
*/
7664
ngOnDestroy() {
77-
this.removeSubscriptions();
7865
}
7966
}

0 commit comments

Comments
 (0)