dynamic form
This commit is contained in:
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
|
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ValidationError } from 'src/app/models/fnd/ValidationError';
|
import { ValidationError } from 'src/app/models/fnd/ValidationError';
|
||||||
import { DynamicformService } from 'src/app/services/fnd/dynamicform.service';
|
import { DynamicformService } from '../services/dynamicform.service';
|
||||||
import { Mapping } from "src/app/models/fnd/Mapping";
|
import { Mapping } from "src/app/models/fnd/Mapping";
|
||||||
import { ToastrService } from 'ngx-toastr';
|
import { ToastrService } from 'ngx-toastr';
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ToastrService } from 'ngx-toastr';
|
import { ToastrService } from 'ngx-toastr';
|
||||||
import { DynamicformService } from '../../../../../services/fnd/dynamicform.service'
|
|
||||||
import { MenumaintanceService } from 'src/app/services/admin/menumaintance.service';
|
import { MenumaintanceService } from 'src/app/services/admin/menumaintance.service';
|
||||||
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
||||||
|
import { DynamicformService } from '../services/dynamicform.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-alldynamicform',
|
selector: 'app-alldynamicform',
|
||||||
templateUrl: './alldynamicform.component.html',
|
templateUrl: './alldynamicform.component.html',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { DynamicformService } from '../../../../../services/fnd/dynamicform.service';
|
import { DynamicformService } from '../services/dynamicform.service';
|
||||||
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
||||||
import { Rn_Forms_Component_Setup } from 'src/app/models/fnd/Rn_Forms_Component_Setup';
|
import { Rn_Forms_Component_Setup } from 'src/app/models/fnd/Rn_Forms_Component_Setup';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { Rn_Forms_Component_Setup } from 'src/app/models/fnd/Rn_Forms_Component_Setup';
|
import { Rn_Forms_Component_Setup } from 'src/app/models/fnd/Rn_Forms_Component_Setup';
|
||||||
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
||||||
import { ValidationError } from 'src/app/models/fnd/ValidationError';
|
import { ValidationError } from 'src/app/models/fnd/ValidationError';
|
||||||
import { DynamicformService } from 'src/app/services/fnd/dynamicform.service';
|
import { DynamicformService } from '../services/dynamicform.service';
|
||||||
import { Mapping } from "src/app/models/fnd/Mapping";
|
import { Mapping } from "src/app/models/fnd/Mapping";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-editdynamicform',
|
selector: 'app-editdynamicform',
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable, ReplaySubject, Subject } from 'rxjs';
|
||||||
|
import { HttpParams } from "@angular/common/http";
|
||||||
|
import { Rn_Forms_Setup } from 'src/app/models/fnd/Rn_Forms_Setup';
|
||||||
|
import { ApiRequestService } from 'src/app/services/api/api-request.service';
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class DynamicformService {
|
||||||
|
private baseURL = 'api/form_setup';
|
||||||
|
private buildDynamicFormURL = 'api/dynamic_form_build';
|
||||||
|
constructor(private apiRequest: ApiRequestService,) { }
|
||||||
|
getAll(page?: number, size?: number): Observable<any> {
|
||||||
|
//Create Request URL params
|
||||||
|
let params: HttpParams = new HttpParams();
|
||||||
|
params = params.append('page', typeof page === "number" ? page.toString() : "0");
|
||||||
|
params = params.append('size', typeof size === "number" ? size.toString() : "1000");
|
||||||
|
//const _http = this.baseURL + '/all';
|
||||||
|
return this.apiRequest.get(this.baseURL, params);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getById(id: number): Observable<Rn_Forms_Setup> {
|
||||||
|
const _http = this.baseURL + '/' + id;
|
||||||
|
return this.apiRequest.get(_http);
|
||||||
|
}
|
||||||
|
|
||||||
|
create(rn_forms_setup: Rn_Forms_Setup): Observable<Rn_Forms_Setup> {
|
||||||
|
return this.apiRequest.post(this.baseURL, rn_forms_setup);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(id: number, rn_forms_setup: Rn_Forms_Setup): Observable<Rn_Forms_Setup> {
|
||||||
|
const _http = this.baseURL + '/' + id;
|
||||||
|
return this.apiRequest.put(_http, rn_forms_setup);
|
||||||
|
}
|
||||||
|
|
||||||
|
buildDynamicForm(form_id?: number): Observable<any> {
|
||||||
|
let params: HttpParams = new HttpParams();
|
||||||
|
params = params.append('form_id', form_id.toString());
|
||||||
|
return this.apiRequest.get(this.buildDynamicFormURL, params);
|
||||||
|
|
||||||
|
}
|
||||||
|
delete(id: number): Observable<any> {
|
||||||
|
const _http = this.baseURL + "/" + id;
|
||||||
|
return this.apiRequest.delete(_http);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DYNAMIC TRANSACTION APIs
|
||||||
|
getTransactionsByFormId(form_id: number): Observable<any> {
|
||||||
|
let params: HttpParams = new HttpParams();
|
||||||
|
params = params.append('form_id', form_id.toString());
|
||||||
|
return this.apiRequest.get('api/dynamic_transaction', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
createTransaction(data: any): Observable<any> {
|
||||||
|
return this.apiRequest.post('api/dynamic_transaction', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTransaction(id: number, form_id: number, data: any): Observable<any> {
|
||||||
|
let params: HttpParams = new HttpParams();
|
||||||
|
params = params.append('form_id', form_id.toString());
|
||||||
|
return this.apiRequest.put('api/dynamic_transaction/' + id, data, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteTransaction(id: number): Observable<any> {
|
||||||
|
return this.apiRequest.delete('api/dynamic_transaction/' + id);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user