Added Org submission API and transaction fixes
This commit is contained in:
parent
65cbea5d5d
commit
1982ce6790
3 changed files with 31 additions and 5 deletions
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<button type="submit" (click)="postTransaction()" [disabled]="TransactionFormInvalid" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i> Submit</button>
|
<button type="submit" (click)="postTransaction()" [disabled]="transactionFormInvalid" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i> Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="accountType == 'organisation'" class="card">
|
<div *ngIf="accountType == 'organisation'" class="card">
|
||||||
|
|
|
@ -158,7 +158,7 @@ export class AddDataComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
transactionFormValidate() {
|
transactionFormValidate() {
|
||||||
if( this.submitOrg.name.length == 0 ||
|
if( this.submitOrg.name.length == 0 &&
|
||||||
this.amount == 0 ) {
|
this.amount == 0 ) {
|
||||||
this.transactionFormInvalid = true;
|
this.transactionFormInvalid = true;
|
||||||
}else{
|
}else{
|
||||||
|
@ -252,7 +252,7 @@ export class AddDataComponent {
|
||||||
console.log(this.payrollForm.value);
|
console.log(this.payrollForm.value);
|
||||||
|
|
||||||
this.api
|
this.api
|
||||||
.login(this.payrollForm.value)
|
.orgPayroll(this.payrollForm.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
|
@ -271,7 +271,7 @@ export class AddDataComponent {
|
||||||
console.log(this.singleSupplierForm.value);
|
console.log(this.singleSupplierForm.value);
|
||||||
|
|
||||||
this.api
|
this.api
|
||||||
.login(this.singleSupplierForm.value)
|
.orgSupplier(this.singleSupplierForm.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
|
@ -290,7 +290,7 @@ export class AddDataComponent {
|
||||||
console.log(this.employeeForm.value);
|
console.log(this.employeeForm.value);
|
||||||
|
|
||||||
this.api
|
this.api
|
||||||
.login(this.employeeForm.value)
|
.orgEmployee(this.employeeForm.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
|
|
|
@ -130,6 +130,32 @@ export class ApiService {
|
||||||
).map( response => response.json() )
|
).map( response => response.json() )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handles Org data added
|
||||||
|
|
||||||
|
public orgPayroll(data) {
|
||||||
|
data.session_key = this.sessionKey;
|
||||||
|
return this.http.post(
|
||||||
|
this.apiUrl + '/org/payroll',
|
||||||
|
data
|
||||||
|
).map( response => response.json() )
|
||||||
|
}
|
||||||
|
|
||||||
|
public orgSupplier(data) {
|
||||||
|
data.session_key = this.sessionKey;
|
||||||
|
return this.http.post(
|
||||||
|
this.apiUrl + '/org/supplier',
|
||||||
|
data
|
||||||
|
).map( response => response.json() )
|
||||||
|
}
|
||||||
|
|
||||||
|
public orgEmployee(data) {
|
||||||
|
data.session_key = this.sessionKey;
|
||||||
|
return this.http.post(
|
||||||
|
this.apiUrl + '/org/employee',
|
||||||
|
data
|
||||||
|
).map( response => response.json() )
|
||||||
|
}
|
||||||
|
|
||||||
// Handles user data interaction
|
// Handles user data interaction
|
||||||
|
|
||||||
// Checks for login status
|
// Checks for login status
|
||||||
|
|
Reference in a new issue