added recurring purchase inputs
This commit is contained in:
parent
db5a712a5d
commit
45d016c897
2 changed files with 59 additions and 13 deletions
|
@ -33,30 +33,69 @@
|
||||||
<span class="help-block">Tick if the purchase is deemed an essential purchase for budgeting purposes.</span>
|
<span class="help-block">Tick if the purchase is deemed an essential purchase for budgeting purposes.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-3 form-control-label" for="text-input">Recurring Purchase</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="checkbox" class="mr-auto" [(ngModel)]="recurringPurchase" (ngModelChange)="transactionFormValidate()">
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Tick if the purchase frequently recurs, such as monthly.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="recurringPurchase" class="form-group row">
|
||||||
|
<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">
|
||||||
|
<label>Daily</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input value="weekly" type="radio" name="weekly" [(ngModel)]="recurringType">
|
||||||
|
<label>Weekly</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input value="fortnightly" type="radio" name="fortnightly" [(ngModel)]="recurringType">
|
||||||
|
<label>Fortnightly</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div>
|
||||||
|
<input value="monthly" type="radio" name="monthly" [(ngModel)]="recurringType">
|
||||||
|
<label>Monthly</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input value="monthly" type="radio" name="monthly" [(ngModel)]="recurringType">
|
||||||
|
<label>Monthly</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input value="quarterly" type="radio" name="quarterly" [(ngModel)]="recurringType">
|
||||||
|
<label>Quarterly</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Please give the period of time the purchase will recur from "Time of Transaction".</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-3 form-control-label" for="text-input">Budget Type</label>
|
<label class="col-md-3 form-control-label" for="text-input">Budget Type</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<input value="" type="radio" name="radios" [(ngModel)]="categoryId">
|
||||||
<input value="" type="radio" name="radios" [(ngModel)]="categoryId">
|
<label>Uncategorised</label>
|
||||||
Uncategorised
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="radio" *ngFor="let category of leftCategoryIdList, let i=index">
|
<div class="radio" *ngFor="let category of leftCategoryIdList, let i=index">
|
||||||
<label>
|
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
|
||||||
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
|
<label>{{ categoryNameList[i] }}</label>
|
||||||
{{ categoryNameList[i] }}
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index">
|
<div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index">
|
||||||
<label>
|
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
|
||||||
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
|
<label>{{ categoryNameList[category2 - 1] }}</label>
|
||||||
{{ categoryNameList[category2 - 1] }}
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -33,6 +33,8 @@ export class AddDataComponent implements OnInit {
|
||||||
// Assumes Groceries is 1st category
|
// Assumes Groceries is 1st category
|
||||||
categoryId: number = 1;
|
categoryId: number = 1;
|
||||||
essentialPurchase = false;
|
essentialPurchase = false;
|
||||||
|
recurringPurchase = false;
|
||||||
|
recurringType: string;
|
||||||
transactionAdditionType = 1;
|
transactionAdditionType = 1;
|
||||||
storeList = [];
|
storeList = [];
|
||||||
showAddStore = false;
|
showAddStore = false;
|
||||||
|
@ -174,7 +176,9 @@ export class AddDataComponent implements OnInit {
|
||||||
transactionFormValidate() {
|
transactionFormValidate() {
|
||||||
if (this.submitOrg.name.length === 0 ||
|
if (this.submitOrg.name.length === 0 ||
|
||||||
this.submitOrg.town.length === 0 ||
|
this.submitOrg.town.length === 0 ||
|
||||||
this.amount === 0 ) {
|
this.amount === 0 ||
|
||||||
|
this.recurringPurchase &&
|
||||||
|
this.recurringType === 0) {
|
||||||
this.transactionFormInvalid = true;
|
this.transactionFormInvalid = true;
|
||||||
} else {
|
} else {
|
||||||
this.transactionFormInvalid = false;
|
this.transactionFormInvalid = false;
|
||||||
|
@ -195,6 +199,7 @@ export class AddDataComponent implements OnInit {
|
||||||
organisation_id : this.organisationId,
|
organisation_id : this.organisationId,
|
||||||
category : this.categoryId,
|
category : this.categoryId,
|
||||||
essential : this.essentialPurchase,
|
essential : this.essentialPurchase,
|
||||||
|
recurring : this.recurringPurchase,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -204,6 +209,7 @@ export class AddDataComponent implements OnInit {
|
||||||
purchase_time : purchaseTime,
|
purchase_time : purchaseTime,
|
||||||
organisation_id : this.organisationId,
|
organisation_id : this.organisationId,
|
||||||
essential : this.essentialPurchase,
|
essential : this.essentialPurchase,
|
||||||
|
recurring : this.recurringPurchase,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -216,6 +222,7 @@ export class AddDataComponent implements OnInit {
|
||||||
town : this.submitOrg.town,
|
town : this.submitOrg.town,
|
||||||
postcode : this.submitOrg.postcode,
|
postcode : this.submitOrg.postcode,
|
||||||
essential : this.essentialPurchase,
|
essential : this.essentialPurchase,
|
||||||
|
recurring : this.recurringPurchase,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue