diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json index 6ad57c9..e3fa4cf 100755 --- a/ng6-seed/package-lock.json +++ b/ng6-seed/package-lock.json @@ -4048,6 +4048,11 @@ } } }, + "exifr": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/exifr/-/exifr-4.3.5.tgz", + "integrity": "sha512-ir36aoochREnTekiEOqY0yuUjmj4oPWMDE3NTKJoz9Yuz/m5V9nWu1p4UStOOuhJI4Wz+p0nRpuqZNKeAIkhQw==" + }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -5473,6 +5478,11 @@ } } }, + "glur": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/glur/-/glur-1.1.2.tgz", + "integrity": "sha1-8g6jbbEDv8KSNDkh8fkeg8NGdok=" + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -7643,6 +7653,15 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "dev": true }, + "multimath": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/multimath/-/multimath-2.0.0.tgz", + "integrity": "sha512-toRx66cAMJ+Ccz7pMIg38xSIrtnbozk0dchXezwQDMgQmbGpfxjtv68H+L00iFL8hxDaVjrmwAFSb3I6bg8Q2g==", + "requires": { + "glur": "^1.1.2", + "object-assign": "^4.1.1" + } + }, "nan": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", @@ -7712,6 +7731,15 @@ "resolved": "https://registry.npmjs.org/ng2-file-upload/-/ng2-file-upload-1.2.1.tgz", "integrity": "sha1-VWPF39b0P7++gVwgbjQ0ZKCmoZc=" }, + "ng2-img-max": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/ng2-img-max/-/ng2-img-max-2.2.4.tgz", + "integrity": "sha512-pcbQJT3N6YEv3Zn4gfTwFEkPFLFuznc6IQAyddTjVSiJV0ilxF+QZ5CkyQEhaY7zw4gFALh54R8ZQjv97njlFw==", + "requires": { + "exifr": "^4.3.4", + "ng2-pica": "^1.3.1" + } + }, "ng2-pdf-viewer": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ng2-pdf-viewer/-/ng2-pdf-viewer-5.2.4.tgz", @@ -7721,6 +7749,15 @@ "pdfjs-dist": "2.0.943" } }, + "ng2-pica": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/ng2-pica/-/ng2-pica-1.3.1.tgz", + "integrity": "sha512-NkvJJM8QAtgkwGYy+WNl3Pzzc0Gfs573tHLemCKmN8DmVQ7onXvhuxzAkTqs6rDYILOTULBI5m0KbCLJLfNiaQ==", + "requires": { + "exifr": "^4.3.4", + "pica": ">=4.0.1" + } + }, "ng2-toastr": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/ng2-toastr/-/ng2-toastr-4.1.2.tgz", @@ -8700,6 +8737,17 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pica": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/pica/-/pica-6.1.1.tgz", + "integrity": "sha512-dmjQheDGFOl+30rQhN3NM3MyDNjeOZvco6IL3ZVYgyVDmhgvcSCGOAsydRCIaZ36mcXO7ci0XFeD+h6unEcBvA==", + "requires": { + "inherits": "^2.0.3", + "multimath": "^2.0.0", + "object-assign": "^4.1.1", + "webworkify": "^1.5.0" + } + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -11583,6 +11631,11 @@ "neo-async": "^2.5.0" } }, + "watermarkjs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/watermarkjs/-/watermarkjs-2.1.1.tgz", + "integrity": "sha512-HDabpga8Fz5d61Z7gBkKO2cDsfViAU/mO5qIoWmDX92wJZLb7Dv4L+CwoHAqS4XkqWcYVGy/AF035BD1EN3v/g==" + }, "wbuf": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", @@ -12080,6 +12133,11 @@ "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", "dev": true }, + "webworkify": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/webworkify/-/webworkify-1.5.0.tgz", + "integrity": "sha512-AMcUeyXAhbACL8S2hqqdqOLqvJ8ylmIbNwUIqQujRSouf4+eUFaXbG6F1Rbu+srlJMmxQWsiU7mOJi0nMBfM1g==" + }, "when": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/when/-/when-3.6.4.tgz", diff --git a/ng6-seed/package.json b/ng6-seed/package.json index 7d623fb..23e8aef 100755 --- a/ng6-seed/package.json +++ b/ng6-seed/package.json @@ -56,6 +56,7 @@ "ng2-ckeditor": "^1.2.2", "ng2-dragula": "1.3.1", "ng2-file-upload": "1.2.1", + "ng2-img-max": "^2.2.4", "ng2-pdf-viewer": "^5.2.4", "ng2-toastr": "^4.1.2", "ng2-validation": "4.2.0", @@ -75,6 +76,7 @@ "sweetalert2": "^7.33.1", "tether": "^1.4.6", "viewerjs": "^1.3.3", + "watermarkjs": "^2.1.1", "xlsx": "^0.14.2", "zone.js": "^0.8.29" }, diff --git a/ng6-seed/src/app/personal-discussion/camera-service/camera.service.spec.ts b/ng6-seed/src/app/personal-discussion/camera-service/camera.service.spec.ts new file mode 100644 index 0000000..0ca160e --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/camera-service/camera.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { CameraService } from './camera.service'; + +describe('CameraService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: CameraService = TestBed.get(CameraService); + expect(service).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/camera-service/camera.service.ts b/ng6-seed/src/app/personal-discussion/camera-service/camera.service.ts new file mode 100644 index 0000000..8476bcf --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/camera-service/camera.service.ts @@ -0,0 +1,111 @@ +import { Injectable } from '@angular/core'; +import { DatePipe } from '@angular/common'; +import * as watermark from 'watermarkjs'; + +@Injectable({ + providedIn: 'root' +}) +export class CameraService { + + pipe = new DatePipe('en-US') + constructor() { + setTimeout(()=>{ + this.getPosition().then(res=>{ + console.log("geolocation",res) + },err=>{ + console.log("Error in geo",err); + }) + },2000) + } + addWatermarks(base64Img,geoCords?) { + + return new Promise((resolve, reject) => { + + // this.constant.getGeoTag().then(geoCoordinates => { + // this.getPosition().then(geoCords=>{ + // console.log(geoCords); + // this.geoCords = geoCoordinates + // }); + // this.geoCords=localStorage.getItem('current_coordinates') + // console.log("corrds",this.geoCords) + let raw_img = base64Img + var today = new Date(); + // let today_loc = today.toLocaleString('en-US', { timeZone: "Asia/Kolkata" }) + let today_loc=this.pipe.transform(today, 'yyyy-MM-dd, h:mm a') + var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate(); + // var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); + var dateTime = 'Date : ' + today_loc; + + console.log(date) + + // fetch(raw_img) + // .then(res => res.blob()) + // .then(blob => { + watermark([raw_img, 'assets/images/PD_watermark.png']) + .image(watermark.image.upperRight()) + .then(img => { + raw_img = img.src; + + let text = watermark.text + watermark([raw_img]) + .image(text.upperLeft(dateTime, '19px sans-serif', '#ff0000', 1.0)) + // .image(text.upperLeft(dateTime, '20px sans-serif', '#ff0000', 1.0)) + .then(img => { + raw_img = img.src; + console.log("2d", raw_img) + // resolve(img.src) + console.log(geoCords) + // let geoCoordinates = geoCords ? geoCords : '-' + if(geoCords) { + let Location = `Location : ` + geoCords + watermark([raw_img]) + .image(text.upperLeft(Location, '19px sans-serif', '#ff0000', 1.0, 40 )) + .then(img => { + raw_img = img.src + console.log("3rd", raw_img) + resolve(img.src) + // localStorage.removeItem('current_coordinates') + }); + } + else { + resolve(img.src) + } + }); + }); + + + // },err=>{ + // console.log("Error in geo",err); + // switch(err.code) { + // case 1: + // alert("Geolocation permission is denied. Please allow the permission to capture"); + // break; + // case 2: + // alert("Do not get the geolocation of your place"); + // break; + // case 2: + // alert("Something went wrong"); + // break; + // } + // reject(err); + // }) + }) + // }); + } + getPosition(): Promise + { + return new Promise((resolve, reject) => { + + navigator.geolocation.getCurrentPosition(resp => { + console.log("Geo",resp.coords); + let latLong:string = resp.coords.latitude+', '+resp.coords.longitude + // resolve({lng: resp.coords.longitude, lat: resp.coords.latitude}); + resolve(latLong) + }, + err => { + resolve('error'); + }); + }); + + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.html new file mode 100644 index 0000000..f7dad11 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.html @@ -0,0 +1,30 @@ +

{{data.title}}

+ +
+

+ {{data.msg}} +

+ +
+ +
+ + + + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.spec.ts new file mode 100644 index 0000000..08c4b1f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PdCompleteStatusDialogueComponent } from './pd-complete-status-dialogue.component'; + +describe('PdCompleteStatusDialogueComponent', () => { + let component: PdCompleteStatusDialogueComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdCompleteStatusDialogueComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdCompleteStatusDialogueComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.ts new file mode 100644 index 0000000..5003318 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component.ts @@ -0,0 +1,40 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { NotifierService } from 'angular-notifier'; +import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; + +@Component({ + selector: 'app-pd-complete-status-dialogue', + templateUrl: './pd-complete-status-dialogue.component.html', + styleUrls: ['./pd-complete-status-dialogue.component.scss'] +}) +export class PdCompleteStatusDialogueComponent implements OnInit { + conformation: Boolean = false; + private notifier: NotifierService; + dialoge_title_content: string; + dialoge_content: string; + dialoge_subcontent : any = []; + completeness_message: string; + enableAddonPD : boolean; + CompletenessCheck: boolean; + // addonStatus: string ="ADD_ON_PENDING"; + public Loading: boolean; + + constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data: any) + { + // this.notifier = notifier; + // this.dialoge_title_content = this.data.vendor_status=='INPROGRESS' ? 'Start Discussion' : this.data.vendor_status=='COMPLETED' ? 'Complete Discussion' : 'Change Discussion'; + // this.dialoge_content = this.data.vendor_status=='INPROGRESS' ? 'Are you starting the Discussion ?' : this.data.vendor_status=='COMPLETED' ? 'Please confirm you are completing the Discussion and forwarding for Quality Check ?' : 'Change Discussion'; + // this.enableAddonPD = false; + // this.CompletenessCheck = this.data.vendor_status=='INPROGRESS' ? true : this.data.vendor_status=='COMPLETED' ? false : true; + // this.Loading = this.data.vendor_status=='INPROGRESS' ? false : this.data.vendor_status=='COMPLETED' ? true : false; + } + + ngOnInit() { + + } + + changeCompletePDStatus(){ + this.dialogRef.close('COMPLETED') + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.html new file mode 100644 index 0000000..9aaee10 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.html @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.scss new file mode 100644 index 0000000..cd358f2 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.scss @@ -0,0 +1,10 @@ +.mat-raised-button{ + background-color: #e2412f !important; + padding: 0 !important; + min-width: 60px !important; + line-height: 27px !important; +} +.mat-icon{ + height: 20px !important; + width: 20px !important; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.spec.ts new file mode 100644 index 0000000..509a894 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CaptureBtnComponent } from './capture-btn.component'; + +describe('CaptureBtnComponent', () => { + let component: CaptureBtnComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CaptureBtnComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CaptureBtnComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.ts new file mode 100644 index 0000000..0a41019 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/capture-btn/capture-btn.component.ts @@ -0,0 +1,37 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Ng2ImgMaxService } from 'ng2-img-max'; + +@Component({ + selector: 'app-capture-btn', + templateUrl: './capture-btn.component.html', + styleUrls: ['./capture-btn.component.scss'] +}) +export class CaptureBtnComponent implements OnInit { + + @Input() addMoreBtn; + @Output() imageDataEmitter = new EventEmitter + constructor(private ng2ImgMax:Ng2ImgMaxService) { } + + ngOnInit(): void { + console.log(this.addMoreBtn) + } + capturedImage(event){ + console.log(event); + let imageData= event.target.files[0] + this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe( + result => { + this.imageDataEmitter.emit(result) + }, + error => { + console.log('😢 Oh no!', error); + } + ); + + } + capture(event){ + event.preventDefault(); + let element:HTMLElement = document.getElementById('input-file') as HTMLElement + element.click(); + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.html index 9fbe8c9..bcf0a0d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.html @@ -56,7 +56,9 @@ src="{{applicant.value.is_person_met_pic}}" style="max-width: 70px;max-height: 70px" > - + + + Selfie of the Person Met @@ -66,6 +68,9 @@ + + + @@ -81,29 +86,29 @@
- +
+
Name of Person Met Person Name required - - + Person Met pic is Required -
--> - +
+
@@ -113,7 +118,9 @@ src="{{getQuestionControl().at(0).value.person_met_entered_pic}}" style="max-width: 70px;max-height: 70px" >
- + + + @@ -397,9 +407,9 @@
-
- + src="{{getQuestionControl().at(1).value.pd_location_pic}}" style="max-width: 80px;max-height: 80px;font-size: 13px !important;"> +
+ @@ -560,8 +572,9 @@
+ src = "{{documents.value.document_pic}}" style="max-width: 80px;max-height: 80px;font-size:13px !important;">
+ @@ -602,7 +615,7 @@
-
+
@@ -611,6 +624,8 @@
No Photographs Found
+ + Add More
-
+
@@ -674,7 +689,9 @@
No Photographs Found
- + + Add More + @@ -721,7 +738,9 @@
No Photographs Found
- + + Add More + @@ -984,4 +1003,4 @@
- + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts index e032f62..f6c2bd9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts @@ -8,6 +8,7 @@ import { FormBuilder, FormControl, Validators, FormArray } from '@angular/forms' import { ReplaySubject, Subject } from 'rxjs'; import { DatePipe } from '@angular/common'; import { takeUntil, filter, tap, take } from 'rxjs/operators'; +import { CameraService } from 'app/personal-discussion/camera-service/camera.service'; @Component({ selector: 'app-common-ques', @@ -152,7 +153,7 @@ export class CommonQuesComponent implements OnInit { public filteredcompanyRelationshipList:ReplaySubject = new ReplaySubject(1); public filteredrelationshipList:ReplaySubject = new ReplaySubject(1); - constructor(private actRoute:ActivatedRoute,private quesService:PdTrigerService,private router:Router, + constructor(private actRoute:ActivatedRoute,private quesService:PdTrigerService,private cameraService:CameraService,private router:Router, @Inject(MAT_DIALOG_DATA)public data,private _formBuilder:FormBuilder, notifier:NotifierService,private _awsService:AwsService,private dialogRef:MatDialogRef) { this.notifier=notifier @@ -848,7 +849,7 @@ getQuestionControl() { // END OF GETTING PARTICULAR FORM CONTROLS //START OF ADD OR REMOVE MORE FORMS OR IMAGES -addMoreStockImage(form_id?) { +addMoreStockImage(event?,form_id?) { let formArray = this.firstFormGroup.get('questions') as FormArray; // console.log(formArray); let business_group_ctrl = formArray.at(2).get('business_group') as FormArray @@ -857,7 +858,7 @@ addMoreStockImage(form_id?) { // console.log("stock",stockCtrl); // stockCtrl.push(this.addStockImageControl()) if(form_id) { - // this.capturePic(stockCtrl,'stock_image ',form_id) + this.capturePic(event,stockCtrl,'stock_image ',form_id) } else { stockCtrl.push(this.addStockImageControl()) @@ -865,7 +866,7 @@ addMoreStockImage(form_id?) { } // console.log(this.firstFormGroup.value); } -addMoreBusinessOfficeImage(form_id?) { +addMoreBusinessOfficeImage(event?,form_id?) { let formArray = this.firstFormGroup.get('questions') as FormArray; // console.log(formArray); let business_group_ctrl = formArray.at(2).get('business_group') as FormArray @@ -874,7 +875,7 @@ addMoreBusinessOfficeImage(form_id?) { // console.log("stock",stockCtrl); // stockCtrl.push(this.addStockImageControl()) if(form_id) { - // this.capturePic(officeControl,'office_photograph ',form_id) + this.capturePic(event,officeControl,'office_photograph ',form_id) } else { officeControl.push(this.addStockImageControl()) @@ -882,7 +883,7 @@ addMoreBusinessOfficeImage(form_id?) { } // console.log(this.firstFormGroup.value); } -addMoreBusinessAssetSightImage(form_id?) { +addMoreBusinessAssetSightImage(event?,form_id?) { let formArray = this.firstFormGroup.get('questions') as FormArray; // console.log(formArray); let business_group_ctrl = formArray.at(2).get('business_group') as FormArray @@ -891,7 +892,7 @@ addMoreBusinessAssetSightImage(form_id?) { // console.log("stock",stockCtrl); // stockCtrl.push(this.addStockImageControl()) if(form_id) { - // this.capturePic(stockCtrl,'business_sight_image ',form_id) + this.capturePic(event,stockCtrl,'business_sight_image ',form_id) } else { stockCtrl.push(this.addStockImageControl()) @@ -1027,60 +1028,73 @@ if(Avaliablity == 0){ ChdCtrls.controls.other_organisation_owner.updateValueAndValidity(); } -// capturePic(controls,img_name?:String,form_id?) { -// console.clear(); -// console.log(controls) -// // return; -// // controls.setValue("pic"); +capturePic(event,controls,img_name?:String,form_id?) { + console.clear(); + console.log(controls) + // return; + // controls.setValue("pic"); + + // this.cameraProvider.getpicture().then(res => { + // this.cameraProvider.showImageDialog().then((res:any)=>{ + // console.log("g",res) + var reader = new FileReader(); + // let imagePath = event; + reader.readAsDataURL(event); + reader.onload = (_event) => { + // this.imageData = reader.result; + this.cameraService.getPosition().then(geoCords=>{ + let geoCoordinates + if(geoCords != 'error') { + geoCoordinates = geoCords + } + else { + geoCoordinates = null; + } + console.log(geoCords); + this.cameraService.addWatermarks(reader.result,geoCoordinates).then(watermarkedImage=> { + console.log("image name",img_name,img_name === 'office_photograph ') + if(img_name == 'stock_image ' || img_name == 'office_photograph ' || img_name == 'business_sight_image ') { + console.log("Before") + controls.push(this.addStockImageControl()) + console.log("after") + img_name = img_name+String(controls.length) + controls = controls.at(controls.length-1)['controls'].image + } + console.log("controls",controls); + controls.setValue(watermarkedImage) + let bucket: any = [] + bucket.push({ 'image': watermarkedImage, 'Name': img_name, 'link': geoCoordinates }); + let records: any = { + 'pd_id': this.pdDetails.pd_id, + 'formid': form_id, + 'images': bucket, + 'company_id': null, + } + // For Business Groups + if(form_id == '11' || form_id == '13' || form_id == '22') { + records.company_id = '1' + } + console.log("params savePDImage", records) + this.quesService.savePDImages(records).subscribe(result => { + if(result['dataStatus']) { + controls.setValue(result['uri']) + } + else { + console.log(result); + controls.setValue("") + this.notifier.notify("warning",'Something went wrong!!') + } + },err=>{ + controls.setValue("") + console.log(err) + this.notifier.notify("error",'Network Error !!') + }) + }) + } + // }) + )} +} -// // this.cameraProvider.getpicture().then(res => { -// this.cameraProvider.showImageDialog().then((res:any)=>{ -// console.log("g",res) -// if (res != 'error') { -// let geoCoordinates = localStorage.getItem('current_coordinates') -// // this.cons.getGeoTag().then(geoCoordinates=>{ -// this.cameraProvider.addWatermarks(res).then(watermarkedImage => { -// console.log("image name",img_name,img_name === 'office_photograph ') -// if(img_name == 'stock_image ' || img_name == 'office_photograph ' || img_name == 'business_sight_image ') { -// console.log("Before") -// controls.push(this.addStockImageControl()) -// console.log("after") -// img_name = img_name+String(controls.length) -// controls = controls.at(controls.length-1)['controls'].image -// } -// console.log("controls",controls); -// controls.setValue(watermarkedImage) -// let bucket: any = [] -// bucket.push({ 'image': watermarkedImage, 'Name': img_name, 'link': geoCoordinates }); -// let records: any = { -// 'pd_id': this.pdDetails.pd_id, -// 'formid': form_id, -// 'images': bucket, -// 'company_id': null, -// } -// // For Business Groups -// if(form_id == '11' || form_id == '13' || form_id == '22') { -// records.company_id = '1' -// } -// console.log("params savePDImage", records) -// this.quesService.savePDImages(records).subscribe(result => { -// if(result['dataStatus']) { -// controls.setValue(result['uri']) -// } -// else { -// console.log(result); -// controls.setValue("") -// this.toastProvider.pdTriggerappmessage("Something went wrong!!",'warning'); -// } -// },err=>{ -// controls.setValue("") -// console.log(err) -// this.toastProvider.pdTriggerappmessage("Network Error","danger") -// }) -// }) -// } -// }) -// } compareObjects(o1: any, o2: any) { if(o1.id == o2.id && o1.group_id == o2.group_id) return true; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component.html index 982fa3b..0747f28 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component.html @@ -21,8 +21,8 @@
- - + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/employer-info/employer-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/employer-info/employer-info.component.html index d14bc31..297f53b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/employer-info/employer-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/employer-info/employer-info.component.html @@ -55,7 +55,7 @@ src="{{applicant.value.is_person_met_pic}}" style="max-width: 70px;max-height: 70px" >
- + Selfie of the Person Met @@ -65,6 +65,7 @@
+ @@ -120,7 +121,7 @@ src="{{getQuestionControl().at(0).value.person_met_entered_pic}}" style="max-width: 80px;max-height: 80px">
- + - + Person Met pic is Required
@@ -178,7 +179,7 @@ src="{{getEmployer_details.value.person_met_pic}}" style="max-width: 70px;max-height: 70px"> - + Selfie Photograph with Employer/Manager - + Required
@@ -213,7 +213,7 @@ src="{{getEmployer_details.value.photo_id_card_pic}}" style="max-width: 80px;max-height: 80px">
- + - + Person Met pic is Required @@ -245,7 +245,7 @@ src="{{getEmployer_details.value.visiting_card_pic}}" style="max-width: 80px;max-height: 80px"> - + - + Person Met pic is Required @@ -415,7 +415,7 @@ src="{{getDocsSightedGroup['value'].sal_reg_seen_pic}}" style="max-width: 80px;max-height: 80px"> - + - +Required @@ -447,7 +447,7 @@ src="{{getDocsSightedGroup['value'].attendance_seen_pic}}" style="max-width: 80px;max-height: 80px"> - + - +Required @@ -480,7 +480,7 @@ required> src="{{getDocsSightedGroup['value'].cash_voucher_pic}}" style="max-width: 80px;max-height: 80px"> - + - +Required @@ -513,7 +513,7 @@ required> src="{{getDocsSightedGroup['value'].sal_certificate_pic}}" style="max-width: 80px;max-height: 80px"> - + - +Required @@ -546,6 +546,7 @@ required> src="{{getDocsSightedGroup['value'].sal_slip_pic}}" style="max-width: 80px;max-height: 80px"> + - +Required @@ -584,7 +585,7 @@ required> src="{{getDocsSightedGroup['value'].other_doc_pic}}" style="max-width: 80px;max-height: 80px"> - + - +Required @@ -639,6 +640,8 @@ Image -->
No Photographs Found
+ + Add More
-
+
@@ -674,6 +677,8 @@ Image -->
No Photographs Found
+ + Add More
- + - +
@@ -196,7 +196,7 @@
- +
@@ -259,13 +259,14 @@
-
+
- +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 3e769ec..c48e381 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -21,6 +21,7 @@ import { SchedulePdComponent } from '../schedule-pd/schedule-pd.component'; import { CommonQuesComponent } from '../pd-questions/common-ques/common-ques.component'; import { EmployerInfoComponent } from '../pd-questions/employer-info/employer-info.component'; import { InputDialogComponent } from '../input-dialog/input-dialog.component'; +import { PdCompleteStatusDialogueComponent } from '../pd-complete-status-dialogue/pd-complete-status-dialogue.component'; const currentdate = new Date().toJSON().slice(0,19); @Component({ @@ -525,6 +526,74 @@ export class ViewPdComponent implements OnInit, OnDestroy { } }) } + + completePDAlert() { + + const dialogRef = this.dialog.open(PdCompleteStatusDialogueComponent, { + data: {title:'Complete Discussion',msg:'Please confirm you are completing the Discussion?'}, + disableClose: true, + minWidth: '30%', + maxWidth: '40%', + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if(dataresult == 'COMPLETED'){ + this.completePD('COMPLETED') + } + }); + + } + + completePD(status:string) + { + // let params = { + // 'parent_pdid':this.master.parent_pd_id, + // 'pd_id':this.viewID, + // 'pd_form_id':"25" + // } + // this.quesService.retiverForm(params).subscribe(form_check=>{ + // if(form_check && form_check['dataStatus'] == false) { + // this.toastProvider.setAlertwithOKButton("Unable to complete the PD","Please complete the form and try again !!"); + // return; + // } + + //alert.present(); + // let users = localStorage.getItem('pd_user_details') + // users=JSON.parse(users).userid + // this.gpsService.getGeoTag().then(geoCords=>{ + let data = {'pd_id':this.viewID,'vendor_status':status,'fk_updatedby':'','updatedon':currentdate,'random_string':this.masterRandomString.random_string,link:''}; + + this._pd.updateStatus(data).subscribe(res=> + { + let updateStatus:any = res; + if(updateStatus.dataStatus == true ) + { + if(updateStatus.status == 200) { + this.notifier.notify("info","Completed Successfully !!!") + this.viewPdDetails(this.viewID) + // this.getNewpdupdate(); + // setTimeout(()=>{ + // this.navCtrl.pop() + // },3000) + } + else if(updateStatus.status == 304) { + let msg = updateStatus.hasOwnProperty('msg') && updateStatus.msg ? updateStatus.msg : "Form not filled yet. Please do this first !!" + Swal(msg); + } + }else + { + } + + }) + // },err=>{ + // console.log("Problem while getting geo location.",err) + // alert("Problem getting geolocation. Make sure the location is turned on") + // }) + // }) + + } + + vendorApproval(pd_info,flag) { // FIA_REJECTED diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 1b22ba8..9bb1924 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -84,6 +84,9 @@ import { ModelEditPdReportComponent } from './list-pd/pd-report/model-edit-pd-re import { NgxViewerModule } from 'ngx-viewer'; import { ResizableModule } from 'angular-resizable-element'; +//img capture +import { Ng2ImgMaxModule } from 'ng2-img-max'; + // import { FinalRemarksComponent } from './list-pd/start-pd/forms/final-remarks/final-remarks.component'; // import { BusinessOtherFamilyMemberComponent } from './list-pd/start-pd/forms/dialogue/business-other-family-member/business-other-family-member.component'; @@ -127,6 +130,8 @@ import { CommonQuesComponent } from './list-pd/pd-questions/common-ques/common-q import { EmployerInfoComponent } from './list-pd/pd-questions/employer-info/employer-info.component'; import { DynamicDocsFormComponent } from './list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component'; import { InputDialogComponent } from './list-pd/input-dialog/input-dialog.component'; +import { PdCompleteStatusDialogueComponent } from './list-pd/pd-complete-status-dialogue/pd-complete-status-dialogue.component'; +import { CaptureBtnComponent } from './list-pd/pd-questions/capture-btn/capture-btn.component'; /** * Custom angular notifier options @@ -173,8 +178,8 @@ const pdCustomNotifierOptions: NotifierOptions = { }; @NgModule({ - declarations: [SchedulePdComponent,PdAllocationComponent,TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, - CommonQuesComponent,EmployerInfoComponent,DynamicDocsFormComponent, InputDialogComponent + declarations: [CaptureBtnComponent,PdCompleteStatusDialogueComponent,SchedulePdComponent,PdAllocationComponent,TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, + CommonQuesComponent,EmployerInfoComponent,DynamicDocsFormComponent, InputDialogComponent, PdCompleteStatusDialogueComponent ], imports: [ CommonModule, @@ -196,6 +201,7 @@ const pdCustomNotifierOptions: NotifierOptions = { MatToolbarModule, FlexLayoutModule, NgxDatatableModule, + Ng2ImgMaxModule, MatChipsModule,MatProgressSpinnerModule, FormsModule,MatSlideToggleModule, MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule,MatStepperModule,MatSidenavModule ,MatMenuModule, MatButtonToggleModule, @@ -215,7 +221,7 @@ const pdCustomNotifierOptions: NotifierOptions = { {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective], - entryComponents: [SchedulePdComponent,PdAllocationComponent,SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, + entryComponents: [PdCompleteStatusDialogueComponent,SchedulePdComponent,PdAllocationComponent,SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, CommonQuesComponent,EmployerInfoComponent,InputDialogComponent], }) export class ManagePdModule { 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 e819bdf..ab51e57 100755 --- 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 @@ -308,6 +308,16 @@ export class PdTrigerService { ) } + savePDImages(imagesDetails) + { + console.log('savepdimg',imagesDetails); + let record = {'records':imagesDetails}; + return this._http.post(this.apiUrl+'savePDPhotos',record) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + // load PD question answers // getAnswersForPD(list: any): Observable { // let httpParams = new HttpParams(); @@ -383,6 +393,7 @@ export class PdTrigerService { ) } + // save pd answers // savePDQuestions(saveData: any): Observable { // saveData.createdby = this._aws.getlocale();