Enable settings for tips and taxes

This commit is contained in:
Rene Vergara 2023-10-20 08:26:37 -05:00
parent 4f498c4c49
commit 91110e2d89
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
15 changed files with 92 additions and 23 deletions

View File

@ -62,7 +62,8 @@ export class BusinessComponent implements OnInit {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
}
public countriesUpdate: Observable<Country[]>;
public ownerUpdate: Observable<Owner>;

View File

@ -39,7 +39,8 @@ export class DbExportComponent implements OnInit {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
_ordersOk = false;

View File

@ -40,7 +40,8 @@ export class FullnodeService{
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
constructor(private http: HttpClient, public userService: UserService){

View File

@ -34,7 +34,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
public heightUpdate: Observable<number>;
public ownerUpdate: Observable<Owner>;

View File

@ -47,7 +47,8 @@ export class ItemListComponent implements OnInit{
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
public ownerUpdate: Observable<Owner>;

View File

@ -60,7 +60,8 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
zecPrice: number = 1;
nodeAddress: string = '';

View File

@ -49,7 +49,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
private FullnodeSub: Subscription = new Subscription();
private UserSub: Subscription = new Subscription();

View File

@ -41,7 +41,8 @@ export class OrderService {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
},
order: {
address: '',

View File

@ -14,4 +14,5 @@ export interface Owner {
payconf: boolean;
crmToken: string;
viewkey: string;
tips: boolean;
}

View File

@ -31,7 +31,8 @@ export class ReceiptService {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
},
order: {
address: '',

View File

@ -46,14 +46,46 @@
formControlName="vKey">
</textarea>
</mat-form-field>
<!--
<pre></pre>
<mat-slide-toggle formControlName="proVersion"
class="settings-toggle"
(change)="onChangeProVersion($event)">
Enable Integrations
</mat-slide-toggle>
-->
<table cellspacing="0" style="width: 100%">
<colgroup>
<col span="1" style="width: 20%;">
<col span="1" style="width: 40%;">
<col span="1" style="width: 40%;">
</colgroup>
<tr>
<td>
<mat-slide-toggle formControlName="useTips" class="settings-toggle" (change)="onChangeTips($event)">
Use Tips?
</mat-slide-toggle>
</td>
<td align="center">
<mat-slide-toggle formControlName="useTax" class="settings-toggle" (change)="onChangeTax($event)">
Use Sales Tax?
</mat-slide-toggle>
<br>
<mat-form-field *ngIf="useTax" class="settings-field" [style.width.%]="100">
<mat-label>Sales Tax Rate (%)</mat-label>
<input matInput
type="number"
placeholder="Sales Tax Rate (%)"
formControlName="taxRate">
</mat-form-field>
</td>
<td align="center">
<mat-slide-toggle formControlName="useVat" class="settings-toggle" (change)="onChangeVat($event)">
Use VAT?
</mat-slide-toggle>
<br>
<mat-form-field *ngIf="useVat" class="settings-field" [style.width.%]="100">
<mat-label>Value-Added Tax Rate (%)</mat-label>
<input matInput
type="number"
placeholder="Value-Added Tax Rate (%)"
formControlName="vatRate">
</mat-form-field>
</td>
</tr>
</table>
</mat-dialog-content>
</div>

View File

@ -28,6 +28,9 @@ export class SettingsComponent implements OnInit {
accCodForm: UntypedFormGroup;
owner: Owner;
useZats: boolean;
useTax: boolean;
useVat: boolean;
useTips: boolean;
proVersion: boolean = false;
linkMsg: string = '';
xeroAccCod: string = '';
@ -128,12 +131,20 @@ export class SettingsComponent implements OnInit {
private dialogRef: MatDialogRef<SettingsComponent>,
@Inject(MAT_DIALOG_DATA) public data: {o: Owner}) {
this.useZats = data.o.zats;
this.useTax = data.o.tax;
this.useVat = data.o.vat;
this.useTips = data.o.tips;
this.settingsForm = fb.group({
name: [data.o.name, Validators.required],
currency: [data.o.currency, Validators.required],
useZats: [data.o.zats, Validators.required],
useVKey: [data.o.payconf, Validators.required],
vKey: [data.o.viewkey]
vKey: [data.o.viewkey],
useTips: [data.o.tips, Validators.required],
useTax: [data.o.tax, Validators.required],
taxRate: [data.o.taxValue],
useVat: [data.o.vat, Validators.required],
vatRate: [data.o.vatValue]
});
this.accCodForm = fb.group ({
xAcc: [this.xeroAccCod]
@ -224,6 +235,11 @@ export class SettingsComponent implements OnInit {
this.owner.zats = this.settingsForm.value.useZats;
this.owner.payconf = this.settingsForm.value.useVKey;
this.owner.viewkey = this.settingsForm.value.vKey;
this.owner.tax = this.settingsForm.value.useTax;
this.owner.taxValue = this.settingsForm.value.taxRate;
this.owner.vat = this.settingsForm.value.useVat;
this.owner.vatValue = this.settingsForm.value.vatRate;
this.owner.tips = this.settingsForm.value.useTips;
//console.log('Settings component key: ' + this.owner.viewkey);
this.dialogRef.close(this.owner);
}
@ -232,8 +248,16 @@ export class SettingsComponent implements OnInit {
this.useZats = ob.checked;
}
onChangeProVersion(ob: MatSlideToggleChange) {
this.proVersion = ob.checked;
onChangeTax(ob: MatSlideToggleChange) {
this.useTax = ob.checked;
}
onChangeVat(ob: MatSlideToggleChange) {
this.useVat = ob.checked;
}
onChangeTips(ob: MatSlideToggleChange) {
this.useTips = ob.checked;
}
onChangeVKeyOn(ob: MatSlideToggleChange) {

View File

@ -39,7 +39,8 @@ export class UserService{
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
},
countries: []
};

View File

@ -42,7 +42,8 @@ export class ViewerComponent implements OnInit {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
public price: number = 1;
public addrUpdate: Observable<string>;

View File

@ -40,7 +40,8 @@ export class XeroRegComponent implements OnInit {
expiration: new Date(Date.now()).toISOString(),
payconf: false,
crmToken: '',
viewkey: ''
viewkey: '',
tips: false
};
public ownerUpdate:Observable<Owner>;
public flag: boolean = false;