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(), expiration: new Date(Date.now()).toISOString(),
payconf: false, payconf: false,
crmToken: '', crmToken: '',
viewkey: '' viewkey: '',
tips: false
} }
public countriesUpdate: Observable<Country[]>; public countriesUpdate: Observable<Country[]>;
public ownerUpdate: Observable<Owner>; public ownerUpdate: Observable<Owner>;

View file

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

View file

@ -40,7 +40,8 @@ export class FullnodeService{
expiration: new Date(Date.now()).toISOString(), expiration: new Date(Date.now()).toISOString(),
payconf: false, payconf: false,
crmToken: '', crmToken: '',
viewkey: '' viewkey: '',
tips: false
}; };
constructor(private http: HttpClient, public userService: UserService){ 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(), expiration: new Date(Date.now()).toISOString(),
payconf: false, payconf: false,
crmToken: '', crmToken: '',
viewkey: '' viewkey: '',
tips: false
}; };
public heightUpdate: Observable<number>; public heightUpdate: Observable<number>;
public ownerUpdate: Observable<Owner>; public ownerUpdate: Observable<Owner>;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -46,14 +46,46 @@
formControlName="vKey"> formControlName="vKey">
</textarea> </textarea>
</mat-form-field> </mat-form-field>
<!-- <table cellspacing="0" style="width: 100%">
<pre></pre> <colgroup>
<mat-slide-toggle formControlName="proVersion" <col span="1" style="width: 20%;">
class="settings-toggle" <col span="1" style="width: 40%;">
(change)="onChangeProVersion($event)"> <col span="1" style="width: 40%;">
Enable Integrations </colgroup>
<tr>
<td>
<mat-slide-toggle formControlName="useTips" class="settings-toggle" (change)="onChangeTips($event)">
Use Tips?
</mat-slide-toggle> </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> </mat-dialog-content>
</div> </div>

View file

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

View file

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

View file

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

View file

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