Amended purchase validation and submission
This commit is contained in:
parent
40b0a0088c
commit
f3c6370394
4 changed files with 31 additions and 35 deletions
|
@ -5,6 +5,9 @@
|
|||
# v0.1.5
|
||||
|
||||
* Fixed category viewing on purchase
|
||||
* Changed category view from radio buttons to full label buttons
|
||||
* Amended local validation of submit
|
||||
* Changed recurring purchase selection view
|
||||
|
||||
# v0.1.4
|
||||
|
||||
|
|
|
@ -46,29 +46,22 @@
|
|||
<label class="col-md-3 form-control-label" for="text-input"><strong>Recurring Period</strong></label>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div>
|
||||
<input value="daily" type="radio" name="daily" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
|
||||
<label>Daily</label>
|
||||
</div>
|
||||
<div>
|
||||
<input value="weekly" type="radio" name="weekly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
|
||||
<label>Weekly</label>
|
||||
</div>
|
||||
<div>
|
||||
<input value="fortnightly" type="radio" name="fortnightly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
|
||||
<label>Fortnightly</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div>
|
||||
<input value="monthly" type="radio" name="monthly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
|
||||
<label>Monthly</label>
|
||||
</div>
|
||||
<div>
|
||||
<input value="quarterly" type="radio" name="quarterly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
|
||||
<label>Quarterly</label>
|
||||
</div>
|
||||
<div class="col-md-6 btn-group-vertical">
|
||||
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'daily'">
|
||||
<input value="daily" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Daily
|
||||
</label>
|
||||
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'weekly'">
|
||||
<input value="weekly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Weekly
|
||||
</label>
|
||||
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'fortnightly'">
|
||||
<input value="fortnightly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Fortnightly
|
||||
</label>
|
||||
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'monthly'">
|
||||
<input value="monthly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Monthly
|
||||
</label>
|
||||
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'quarterly'">
|
||||
<input value="quarterly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Quarterly
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<span class="help-block">Please give the period of time the purchase will recur from "Time of Transaction".</span>
|
||||
|
@ -105,21 +98,21 @@
|
|||
<org-table *ngIf="storeList.length > 0" [orgList]="storeList" (onClick)="addStore($event)"></org-table>
|
||||
<div *ngIf="showAddStore">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Street Name</strong></label>
|
||||
<label class="col-md-3 form-control-label" for="text-input">Organisation Street Name</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" placeholder="Which Street?" [(ngModel)]="submitOrg.street_name" (ngModelChange)="transactionFormValidate()">
|
||||
<span class="help-block">Enter the street name where the organisation is located at.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Town</strong></label>
|
||||
<label class="col-md-3 form-control-label" for="text-input">Organisation Town</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" placeholder="Which Town?" [(ngModel)]="submitOrg.town" (ngModelChange)="transactionFormValidate()">
|
||||
<span class="help-block">Enter the name of the town where the organisation is located at.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Postcode</strong></label>
|
||||
<label class="col-md-3 form-control-label" for="text-input">Organisation Postcode</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" placeholder="Postcode if known" [(ngModel)]="submitOrg.postcode" (ngModelChange)="transactionFormValidate()">
|
||||
<span class="help-block">Enter the postcode where the organisation is located at.</span>
|
||||
|
|
|
@ -177,14 +177,15 @@ export class AddDataComponent implements OnInit {
|
|||
}
|
||||
|
||||
transactionFormValidate() {
|
||||
if (this.submitOrg.name.length === 0 ||
|
||||
this.submitOrg.town.length === 0 ||
|
||||
this.amount === 0 ||
|
||||
this.recurringPurchase &&
|
||||
!this.recurringType) {
|
||||
this.transactionFormInvalid = true;
|
||||
} else {
|
||||
if (this.submitOrg.name.length &&
|
||||
this.amount &&
|
||||
(this.recurringPurchase &&
|
||||
this.recurringType ||
|
||||
!this.recurringPurchase &&
|
||||
!this.recurringType)) {
|
||||
this.transactionFormInvalid = false;
|
||||
} else {
|
||||
this.transactionFormInvalid = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ export class TransactionLogComponent implements OnInit {
|
|||
}
|
||||
|
||||
loadTransactions(logPage: number) {
|
||||
console.log(logPage);
|
||||
this.api.transList(logPage).subscribe(
|
||||
result => {
|
||||
if (result.transactions.length > 0) {
|
||||
|
|
Reference in a new issue