Customer discount with prefill discount in sales.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { ToasterService } from '../core/toaster.service';
|
||||
|
||||
import { SettingsService } from './settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
templateUrl: './settings.component.html',
|
||||
styleUrls: ['./settings.component.css'],
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
prefillCustomerDiscount = true;
|
||||
|
||||
version: string;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
public auth: AuthService,
|
||||
private ser: SettingsService,
|
||||
) {
|
||||
this.version = environment.version;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as {
|
||||
prefillCustomerDiscount: boolean;
|
||||
};
|
||||
|
||||
this.prefillCustomerDiscount = data.prefillCustomerDiscount;
|
||||
});
|
||||
}
|
||||
|
||||
togglePrefill() {
|
||||
this.ser.setPrefillCustomerDiscount(!this.prefillCustomerDiscount).subscribe((x) => {
|
||||
this.prefillCustomerDiscount = x;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user