diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
index 7fbdf4049..952ecbda0 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
@@ -1,3 +1,89 @@
-
- supplier-info works!
-
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.scss
index e69de29bb..890847551 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.scss
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.scss
@@ -0,0 +1,3 @@
+.example-full-width{
+ width : 100%;
+}
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
index 8f91281d8..9f52ed182 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
@@ -1,15 +1,206 @@
-import { Component, OnInit } from '@angular/core';
+/** Common Imports */
+import {
+ Component,
+ OnInit,
+ Inject,
+ Input
+} from '@angular/core';
+import {
+ FormBuilder,
+ FormGroup,
+ Validators,
+ FormArray,
+} from '@angular/forms';
+
+import { NotifierService } from 'angular-notifier';
+
+import {
+ MatDialog,
+ MatDialogRef,
+ MAT_DIALOG_DATA
+} from '@angular/material';
+/** Service */
+import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
@Component({
selector: 'app-supplier-info',
templateUrl: './supplier-info.component.html',
styleUrls: ['./supplier-info.component.scss']
})
export class SupplierInfoComponent implements OnInit {
+
+ @Input() pdid: number;
- constructor() { }
+ public _supplierQuesFrom: FormGroup;
+ public submitted = false;
+ public m_paymentModeType= [
+ {
+ 'id': 1,
+ 'name': 'Immediate Or Advanced Payment'
+ },
+ {
+ 'id': 2,
+ 'name': 'Credit'
+ },
+ {
+ 'id': 3,
+ 'name': 'Combination of Both'
+ },
+ ];
+
+ public m_freqOfPurchase= [
+ {
+ 'id': 1,
+ 'name': 'Daily'
+ },
+ {
+ 'id': 2,
+ 'name': 'Weekly'
+ },
+ {
+ 'id': 3,
+ 'name': 'Monthly'
+ },
+ {
+ 'id': 4,
+ 'name': 'Every 3 months'
+ },
+ {
+ 'id': 5,
+ 'name': 'Half yearly'
+ },
+ {
+ 'id': 6,
+ 'name': 'Yearly'
+ },
+ {
+ 'id': 7,
+ 'name': 'As and when required'
+ },
+ {
+ 'id': 8,
+ 'name': 'Others'
+ }
+ ]
+
+ constructor(
+ private _formBuilder: FormBuilder,
+ private pdTrigerService: PdTrigerService) { }
ngOnInit() {
+ this._supplierQuesFrom = this._formBuilder.group({
+ main_raw_materials: [null, Validators.compose([Validators.required])],
+ supplier_details: this._formBuilder.array([
+ this.initDetails(),
+ ])
+ });
+ this.getPdSupplierFormDetails();
}
+ getPdSupplierFormDetails() {
+ this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
+ data => {
+ if (data) {
+ if (data.records) {
+ // this.noRecordFound = false;
+ // this.entityBillingInfoRecord = data.records;
+ } else {
+ // this.noRecordFound = true;
+ }
+ } else {
+ // this.noRecordFound = true;
+ }
+ }
+ );
+ }
+
+ // convenience getter for easy access to form fields
+ get f() { return this._supplierQuesFrom.controls; }
+
+ // Dynamic Form field creation Functionality : START ===>
+ initDetails() {
+ return this._formBuilder.group({
+ supplier_name: ['', Validators.compose([Validators.required])],
+ contact_person: ['', Validators.compose([Validators.required])],
+ mobile_number: ['', Validators.compose([Validators.required])],
+ payment_mode: ['', Validators.compose([Validators.required])],
+ per_of_immediate_advance_payment:[''],
+ credit_period:[''],
+ frequency_of_purchase: ['', Validators.compose([Validators.required])],
+ freq_purchase_others_text_value: ['']
+ });
+ }
+
+ addSupplierDetails(e) {
+ const control = this._supplierQuesFrom.controls['supplier_details'];
+ control.push(this.initDetails());
+ }
+ removeLanguage(i: number) {
+ const control = this._supplierQuesFrom.controls['supplier_details'];
+ control.removeAt(i);
+ }
+
+ public paymentModeTextBox: number;
+ selectedPM(e) {
+ this.paymentModeTextBox = e.value;
+ // this.f.supplier_details.controls.get('payment_mode_value');
+ }
+
+ public freqPurchaseTextBox: number;
+ selectedFreqPurchase(e){
+ this.freqPurchaseTextBox = e.value;
+ }
+
+
+ /** To Save/Edited Popup Data */
+ onSubmit() {
+ this.submitted = true;
+ // stop here if form is invalid
+ if (this._supplierQuesFrom.invalid) {
+ return;
+ } else {
+ var answerFormValues = this._supplierQuesFrom.value;
+
+ //To Remove The "Null" With Key also
+ Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
+ alert(JSON.stringify(answerFormValues));
+ // //Add BRANCH data with help Service File
+ // this.questionsService.addQuestionMasterDetails(answerFormValues).subscribe(
+ // dataresult => {
+ // if (dataresult.status == 200) {
+ // console.log(dataresult);
+ // this.notifier.notify('success', 'Record Saved Successfully.!');
+ // this.dialogRef.close();
+ // // alert("sample alert for Saving");
+ // }
+ // else {
+ // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ // this.errorMessage = "Some Thing Wents Wrong Try Again !";
+ // }
+ // }, error => {
+ // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ // this.errorMessage = "Something Wents Wrong Try Again !";
+ // this.dialogRef.close();
+ // });
+ // //After Saving the BRANCH data then popup close
+ // // this.dialogRef.close();
+ }
+ }
+
+ /** To Reset Popup Data */
+ onReset() {
+ // this._addQuesFrom.reset();
+ }
+
+ // {
+ // 'main_raw_materials': 'sdkjfal',
+ // 'supplier_details' ; [
+ // {
+ // 'supplier_name':'ldskjfalks',
+ // 'payment_mode': '1',
+ // 'payment_mode_value':''
+ // }
+ // ]
+ // }
+
}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
index 1d7761abf..16fcc96b5 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
@@ -377,7 +377,7 @@
- supplier
+
@@ -388,8 +388,7 @@
-
- Personal
+
diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
index 33b989c0c..a9e41f2d6 100644
--- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
+++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
@@ -189,6 +189,14 @@ export class PdTrigerService {
)
}
+// common Pd form details get for the Pd Process
+getPDFormDetailsWithID(pdID, formID ):Observable {
+ return this._http.post(this.apiUrl+"getPDFormDetails",{"pdid":pdID,"pd_form_id" : formID})
+ .pipe(
+ catchError(this.handleError('operation', []))
+ )
+ }
+
// save pd answers
savePDQuestions(saveData: any): Observable {
saveData.createdby = this._aws.getlocale();