Skip to content

Commit

Permalink
feat(ever-merchant): validated payments component
Browse files Browse the repository at this point in the history
  • Loading branch information
AlishMekliov931 committed Jul 30, 2019
1 parent 0746cb7 commit e4de4bc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Expand Up @@ -6,13 +6,16 @@
</ion-label>
<ion-checkbox
slot="start"
#isPaymentEnabled="ngModel"
(click)="hasChanged = true"
[(ngModel)]="currWarehouse.isPaymentEnabled"
>
</ion-checkbox>
</ion-item>
</ion-col>
<ion-col class="col-3">
<ion-col
*ngIf="currWarehouse.isPaymentEnabled && showPaymentsGateways"
class="col-3"
>
<ng-select
[items]="myPaymentsGateways"
[clearable]="false"
Expand Down Expand Up @@ -47,7 +50,10 @@
</ng-template>
</ng-select>
</ion-col>
<ion-col class="col-3">
<ion-col
*ngIf="currWarehouse.isPaymentEnabled && showPaymentsGateways"
class="col-3"
>
<ng-select
[items]="paymentsGateways"
[clearable]="false"
Expand Down
Expand Up @@ -13,9 +13,8 @@ export class SettingsPaymentsComponent implements OnInit {
@Input()
currWarehouse: Warehouse;

@ViewChild('isPaymentEnabled', { static: false })
isPaymentEnabled: ElementRef;

showPaymentsGateways: boolean;
hasChanged: boolean;
myPaymentsGateways = [];
paymentsGateways = [];
selectedMyPaymentsGateways: PaymentGateways[];
Expand All @@ -38,6 +37,8 @@ export class SettingsPaymentsComponent implements OnInit {
this.paymentsGateways = allPaymentGateways.filter(
(pg) => !this.myPaymentsGateways.includes(pg)
);

this.showPaymentsGateways = true;
}

getPaymentName(p: PaymentGateways) {
Expand Down
Expand Up @@ -44,7 +44,6 @@ <h4 class="row-title">
<merchant-payments-settings
[currWarehouse]="currWarehouse"
#paymentsSettings
*ngIf="showPayments"
>
</merchant-payments-settings>

Expand Down Expand Up @@ -116,7 +115,7 @@ <h4 class="row-title">
<ion-button
[disabled]="
hasChanges(
paymentsSettings?.isPaymentEnabled.dirty,
paymentsSettings.hasChanged,
productsDelivery.dirty,
productsTakeaway.dirty,
orderBarcodeType.dirty,
Expand All @@ -127,8 +126,7 @@ <h4 class="row-title">
(click)="saveChanges()"
color="success"
>
{{ paymentsSettings | json }} {{
'SETTINGS_VIEW.SAVE_CHANGES' | translate }}
{{ 'SETTINGS_VIEW.SAVE_CHANGES' | translate }}
</ion-button>
</ion-col>
</ion-row>
Expand Down
@@ -1,4 +1,4 @@
import { Component, Input, AfterViewInit } from '@angular/core';
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
import Warehouse from '@modules/server.common/entities/Warehouse';
import OrderBarcodeTypes, {
orderBarcodeTypesToString
Expand Down Expand Up @@ -26,8 +26,6 @@ export class SettingsComponent implements AfterViewInit {
OrderBarcodeTypes.pharmacode
];

// TODO
// paymentsEnabled: boolean;
selectedOrderBarcodeType: OrderBarcodeTypes;
barcodetDataUrl: string;
hasScanCode: boolean;
Expand Down

0 comments on commit e4de4bc

Please sign in to comment.