camera fix

This commit is contained in:
Venba 2023-12-18 17:44:35 +05:30
parent 24330999bd
commit 154e6b0f99
27 changed files with 710 additions and 303 deletions

View File

@ -9,8 +9,10 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':aparajita-capacitor-biometric-auth')
implementation project(':capacitor-app')
implementation project(':capacitor-camera')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-geolocation')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')

View File

@ -39,7 +39,11 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</manifest>

View File

@ -2,12 +2,18 @@
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':aparajita-capacitor-biometric-auth'
project(':aparajita-capacitor-biometric-auth').projectDir = new File('../node_modules/@aparajita/capacitor-biometric-auth/android')
include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
include ':capacitor-camera'
project(':capacitor-camera').projectDir = new File('../node_modules/@capacitor/camera/android')
include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android')
include ':capacitor-geolocation'
project(':capacitor-geolocation').projectDir = new File('../node_modules/@capacitor/geolocation/android')

View File

@ -2,6 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSFaceIDUsageDescription</key>
<key>CFBundleURLTypes</key>
<array>
<dict>

View File

@ -11,8 +11,10 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'AparajitaCapacitorBiometricAuth', :path => '../../node_modules/@aparajita/capacitor-biometric-auth'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorGeolocation', :path => '../../node_modules/@capacitor/geolocation'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'

153
package-lock.json generated
View File

@ -17,11 +17,13 @@
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"@aparajita/capacitor-biometric-auth": "^6.0.0",
"@awesome-cordova-plugins/core": "6.4.0",
"@capacitor/android": "5.5.1",
"@capacitor/app": "^5.0.6",
"@capacitor/camera": "^5.0.7",
"@capacitor/core": "^5.5.1",
"@capacitor/core": "^5.6.0",
"@capacitor/filesystem": "^5.1.4",
"@capacitor/geolocation": "^5.0.6",
"@capacitor/haptics": "5.0.6",
"@capacitor/ios": "5.5.1",
@ -39,6 +41,7 @@
"ionicons": "^7.0.0",
"ng2-pdf-viewer": "^10.0.0",
"ngx-image-compress": "^15.1.6",
"ngx-ionic-image-viewer": "^0.7.4",
"rxjs": "^7.8.1",
"tslib": "^2.3.0",
"watermarkjs": "^2.1.1",
@ -67,6 +70,7 @@
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~4.6.0",
"jasmine-spec-reporter": "~5.0.0",
"jeep-photoviewer": "^1.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
@ -856,6 +860,20 @@
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@aparajita/capacitor-biometric-auth": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@aparajita/capacitor-biometric-auth/-/capacitor-biometric-auth-6.0.0.tgz",
"integrity": "sha512-9ASoFywLRNZIpqlI0E3Iow5fiZe8YyCTzsSSATpRlALvnUFGzJf9s/RGl1D89t8Eidu4M1Hb/lsXWaS3IiC0rA==",
"dependencies": {
"@capacitor/android": "^5.5.1",
"@capacitor/app": "^5.0.6",
"@capacitor/core": "^5.5.1",
"@capacitor/ios": "^5.5.1"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@assemblyscript/loader": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz",
@ -2914,13 +2932,21 @@
}
},
"node_modules/@capacitor/core": {
"version": "5.5.1",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-5.5.1.tgz",
"integrity": "sha512-VG6Iv8Q7ZAbvjodxpvjcSe0jfxUwZXnvjbi93ehuJ6eYP8U926qLSXyrT/DToZq+F6v/HyGyVgn3mrE/9jW2Tg==",
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-5.6.0.tgz",
"integrity": "sha512-xJhCOUGPHw0QYDA3YH+CmL6qiV9DH4Ij3yPxSenymjrtLuXI197u9ddCZwGEwgVIkh9kGZBBKzsNkn89SZ2gdQ==",
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/@capacitor/filesystem": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/@capacitor/filesystem/-/filesystem-5.1.4.tgz",
"integrity": "sha512-10EM1KvFMs+pTzxkcflspzxBWcX9sOnS9nTP5Afjr5hn4OxLrwTFySw2Z12Uv6jdN4OnhY3jXtDKXPljXvXILg==",
"peerDependencies": {
"@capacitor/core": "^5.1.1"
}
},
"node_modules/@capacitor/geolocation": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/@capacitor/geolocation/-/geolocation-5.0.6.tgz",
@ -3542,11 +3568,11 @@
}
},
"node_modules/@ionic/angular": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-7.5.2.tgz",
"integrity": "sha512-VFgoFw1+9jbcbh2Pm7RLd/Dsf1u6ZxdLbdWhHKY79Xh6hNKVLms+YCvbs08ppCZ0wpBaogJP/5xPVMJ/yjYtRg==",
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-7.6.1.tgz",
"integrity": "sha512-Eh//g/bAL9se4PD6C19NqymgQbqKp4W+Ffbjo8Qnqwk02jGMs/jcMP0WVEcLNiEws2m67kIiWItrUhJjb8pplA==",
"dependencies": {
"@ionic/core": "7.5.2",
"@ionic/core": "7.6.1",
"ionicons": "^7.0.0",
"jsonc-parser": "^3.0.0",
"tslib": "^2.3.0"
@ -3675,11 +3701,11 @@
}
},
"node_modules/@ionic/core": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.5.2.tgz",
"integrity": "sha512-0O8YgaE7CzrhDLGpnNq2Ia4bR+qFE1uHJHafoNWhoTXkydNnqSMZlxMCvtSetfv9bwLic93lcXYNoZ8I8zV3XA==",
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.6.1.tgz",
"integrity": "sha512-o4PSRxokfRB5H3E5DAM7xivG8XFXaXD3+U/tha0QKemiMSntqgPqy0FYX0pNEwIrV3llRzFbAGNqyvB1+BG97Q==",
"dependencies": {
"@stencil/core": "^4.6.0",
"@stencil/core": "^4.8.2",
"ionicons": "^7.2.1",
"tslib": "^2.1.0"
}
@ -5544,9 +5570,9 @@
"dev": true
},
"node_modules/@stencil/core": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz",
"integrity": "sha512-5Y6/fP28aspPDRB+Tz5GuB1jRVGuUEk5/rnyE8ACGcuzEOG+zR0A/IHRJSU3XmCxUlVDKfKoO6St5W84oUCVMA==",
"version": "4.8.2",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.8.2.tgz",
"integrity": "sha512-KdZEAtz9VnqMtXOkf51+8mphyRt0fN/LYgtj5M8gnveGspG8KzoyTDzlWt0wsstWIsJJ21RA1yd3AgMMZiu3MA==",
"bin": {
"stencil": "bin/stencil"
},
@ -13073,6 +13099,15 @@
"colors": "1.4.0"
}
},
"node_modules/jeep-photoviewer": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/jeep-photoviewer/-/jeep-photoviewer-1.2.0.tgz",
"integrity": "sha512-T/vvCtH5IXZ1ZJPDxy2Mg57Fn8BzwAG2MtdUJxNIfLtP7r5QtL2gJKyP9kgbSBUOkAEjRTluX8YM4NDhaYfJAA==",
"dev": true,
"dependencies": {
"@stencil/core": "^4.0.0"
}
},
"node_modules/jest-worker": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",
@ -15068,6 +15103,25 @@
"@angular/core": "x.x.x"
}
},
"node_modules/ngx-ionic-image-viewer": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/ngx-ionic-image-viewer/-/ngx-ionic-image-viewer-0.7.5.tgz",
"integrity": "sha512-GZ13aRGqEAww+5qjOfb5EJDIrxe3SD/V+2zoKo7YAQqa/BLMRKkWRgRTw0gxZxcFrzkEd89ge1WaAWLbNwp6vg==",
"deprecated": "This package is deprecated and no longer maintained.",
"dependencies": {
"tslib": "^1.9.0"
},
"peerDependencies": {
"@angular/common": ">=8.2.13",
"@angular/core": ">=8.2.13",
"@ionic/angular": ">=4.0.0"
}
},
"node_modules/ngx-ionic-image-viewer/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/nice-napi": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz",
@ -21492,6 +21546,17 @@
"tslib": "^2.3.0"
}
},
"@aparajita/capacitor-biometric-auth": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@aparajita/capacitor-biometric-auth/-/capacitor-biometric-auth-6.0.0.tgz",
"integrity": "sha512-9ASoFywLRNZIpqlI0E3Iow5fiZe8YyCTzsSSATpRlALvnUFGzJf9s/RGl1D89t8Eidu4M1Hb/lsXWaS3IiC0rA==",
"requires": {
"@capacitor/android": "^5.5.1",
"@capacitor/app": "^5.0.6",
"@capacitor/core": "^5.5.1",
"@capacitor/ios": "^5.5.1"
}
},
"@assemblyscript/loader": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz",
@ -22960,13 +23025,19 @@
}
},
"@capacitor/core": {
"version": "5.5.1",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-5.5.1.tgz",
"integrity": "sha512-VG6Iv8Q7ZAbvjodxpvjcSe0jfxUwZXnvjbi93ehuJ6eYP8U926qLSXyrT/DToZq+F6v/HyGyVgn3mrE/9jW2Tg==",
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-5.6.0.tgz",
"integrity": "sha512-xJhCOUGPHw0QYDA3YH+CmL6qiV9DH4Ij3yPxSenymjrtLuXI197u9ddCZwGEwgVIkh9kGZBBKzsNkn89SZ2gdQ==",
"requires": {
"tslib": "^2.1.0"
}
},
"@capacitor/filesystem": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/@capacitor/filesystem/-/filesystem-5.1.4.tgz",
"integrity": "sha512-10EM1KvFMs+pTzxkcflspzxBWcX9sOnS9nTP5Afjr5hn4OxLrwTFySw2Z12Uv6jdN4OnhY3jXtDKXPljXvXILg==",
"requires": {}
},
"@capacitor/geolocation": {
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/@capacitor/geolocation/-/geolocation-5.0.6.tgz",
@ -23324,11 +23395,11 @@
}
},
"@ionic/angular": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-7.5.2.tgz",
"integrity": "sha512-VFgoFw1+9jbcbh2Pm7RLd/Dsf1u6ZxdLbdWhHKY79Xh6hNKVLms+YCvbs08ppCZ0wpBaogJP/5xPVMJ/yjYtRg==",
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-7.6.1.tgz",
"integrity": "sha512-Eh//g/bAL9se4PD6C19NqymgQbqKp4W+Ffbjo8Qnqwk02jGMs/jcMP0WVEcLNiEws2m67kIiWItrUhJjb8pplA==",
"requires": {
"@ionic/core": "7.5.2",
"@ionic/core": "7.6.1",
"ionicons": "^7.0.0",
"jsonc-parser": "^3.0.0",
"tslib": "^2.3.0"
@ -23420,11 +23491,11 @@
}
},
"@ionic/core": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.5.2.tgz",
"integrity": "sha512-0O8YgaE7CzrhDLGpnNq2Ia4bR+qFE1uHJHafoNWhoTXkydNnqSMZlxMCvtSetfv9bwLic93lcXYNoZ8I8zV3XA==",
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.6.1.tgz",
"integrity": "sha512-o4PSRxokfRB5H3E5DAM7xivG8XFXaXD3+U/tha0QKemiMSntqgPqy0FYX0pNEwIrV3llRzFbAGNqyvB1+BG97Q==",
"requires": {
"@stencil/core": "^4.6.0",
"@stencil/core": "^4.8.2",
"ionicons": "^7.2.1",
"tslib": "^2.1.0"
}
@ -24981,9 +25052,9 @@
"dev": true
},
"@stencil/core": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz",
"integrity": "sha512-5Y6/fP28aspPDRB+Tz5GuB1jRVGuUEk5/rnyE8ACGcuzEOG+zR0A/IHRJSU3XmCxUlVDKfKoO6St5W84oUCVMA=="
"version": "4.8.2",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.8.2.tgz",
"integrity": "sha512-KdZEAtz9VnqMtXOkf51+8mphyRt0fN/LYgtj5M8gnveGspG8KzoyTDzlWt0wsstWIsJJ21RA1yd3AgMMZiu3MA=="
},
"@tootallnate/once": {
"version": "1.1.2",
@ -30730,6 +30801,15 @@
"colors": "1.4.0"
}
},
"jeep-photoviewer": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/jeep-photoviewer/-/jeep-photoviewer-1.2.0.tgz",
"integrity": "sha512-T/vvCtH5IXZ1ZJPDxy2Mg57Fn8BzwAG2MtdUJxNIfLtP7r5QtL2gJKyP9kgbSBUOkAEjRTluX8YM4NDhaYfJAA==",
"dev": true,
"requires": {
"@stencil/core": "^4.0.0"
}
},
"jest-worker": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",
@ -32275,6 +32355,21 @@
"tslib": "^2.5.0"
}
},
"ngx-ionic-image-viewer": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/ngx-ionic-image-viewer/-/ngx-ionic-image-viewer-0.7.5.tgz",
"integrity": "sha512-GZ13aRGqEAww+5qjOfb5EJDIrxe3SD/V+2zoKo7YAQqa/BLMRKkWRgRTw0gxZxcFrzkEd89ge1WaAWLbNwp6vg==",
"requires": {
"tslib": "^1.9.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}
}
},
"nice-napi": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz",

View File

@ -22,11 +22,13 @@
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"@aparajita/capacitor-biometric-auth": "^6.0.0",
"@awesome-cordova-plugins/core": "6.4.0",
"@capacitor/android": "5.5.1",
"@capacitor/app": "^5.0.6",
"@capacitor/camera": "^5.0.7",
"@capacitor/core": "^5.5.1",
"@capacitor/core": "^5.6.0",
"@capacitor/filesystem": "^5.1.4",
"@capacitor/geolocation": "^5.0.6",
"@capacitor/haptics": "5.0.6",
"@capacitor/ios": "5.5.1",
@ -44,6 +46,7 @@
"ionicons": "^7.0.0",
"ng2-pdf-viewer": "^10.0.0",
"ngx-image-compress": "^15.1.6",
"ngx-ionic-image-viewer": "^0.7.4",
"rxjs": "^7.8.1",
"tslib": "^2.3.0",
"watermarkjs": "^2.1.1",
@ -72,6 +75,7 @@
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~4.6.0",
"jasmine-spec-reporter": "~5.0.0",
"jeep-photoviewer": "^1.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",

View File

@ -1 +1,5 @@
<ion-router-outlet></ion-router-outlet>
<!-- <ion-router-outlet></ion-router-outlet> -->
<ion-app>
<ion-router-outlet [swipeGesture]="false"></ion-router-outlet>
</ion-app>

View File

@ -34,8 +34,19 @@ export class AppComponent {
this.initializeApp();
// this.changeDecision();
console.log('first Open')
this.platform.backButton.subscribeWithPriority(3, () => {
alert('Handler was called!');
this.platform.backButton.subscribeWithPriority(0, () => {
// alert('Handler was called!');
const url = window.location.pathname;
if(url === '/section-list'){
// Handle other pages
// alert('/section-list')
this.router.navigate(['/sales-pd-list']);
} else if(url === '/section9'){
// alert('/section9')
this.router.navigate(['/section-list']);
} else if(url === '/home'){
this.router.navigate(['/sales-pd-list']);
}
});
// // iOS only
// window.addEventListener('statusTap', function () {
@ -106,21 +117,22 @@ export class AppComponent {
App.addListener('backButton', (data) => {
console.log('backButton')
if (this.router.url === '/auth' || this.router.url === '/sales-pd-list' || this.router.url === '/auth/pin-lock') {
const url = window.location.pathname;
if (url === '/auth' || url === '/sales-pd-list' || url === '/auth/pin-lock') {
console.log('backButton')
if (!this.alertShown) {
console.log('presentConfirm')
this.presentConfirm();
}
}
else if(this.router.url === '/section-list'){
// Handle other pages
alert('/section-list')
this.router.navigate(['/sales-pd-list']);
} else if(this.router.url === '/section9'){
alert('/section9')
this.router.navigate(['/section-list']);
}
// else if(url === '/section-list'){
// // Handle other pages
// alert('/section-list')
// this.router.navigate(['/sales-pd-list']);
// } else if(url === '/section9'){
// alert('/section9')
// this.router.navigate(['/section-list']);
// }
});
}

View File

@ -54,7 +54,7 @@
</mat-card-footer>
</mat-card>
<mat-card *ngIf="!mpinaccess">
<mat-card *ngIf="!mpinaccess" style="padding-bottom: 20px;">
<mat-card-header>
</mat-card-header>
<ion-row>
@ -93,14 +93,12 @@
<div align="center" class="text-color">(or)</div>
<h5 align="center" class="text-color">Login Using FingerPrint</h5>
<div align="center" class="text-color" style="font-size: 11px;">Place your finger on fingerprint scanner to login</div>
<!-- <mat-card-actions class="ion-text-center" (click)="checkfingerprint()"> -->
<ion-row>
<ion-row>
<ion-col class="ion-text-center">
<ion-icon (click)="checkfingerprint()" name="finger-print"></ion-icon>
</ion-col>
</ion-row>
<!-- </mat-card-actions> -->
</mat-card-footer>
</mat-card-footer>
</mat-card>
</ion-content>

View File

@ -8,6 +8,7 @@ import { LoadingService } from 'src/providers/common-provider/loading.service';
import { environment } from 'src/environments/environment';
import { ActivatedRoute, Router } from '@angular/router';
import { switchMap } from 'rxjs';
import { BiometricAuth, BiometryError, BiometryErrorType } from '@aparajita/capacitor-biometric-auth';
interface ApiResponse {
dataStatus: boolean;
@ -185,8 +186,62 @@ export class PinLockComponent implements OnInit {
}
}
checkfingerprint(){
// checkfingerprint()
// {
// this.faio.show({
// clientId: 'Fingerprint-Demo',
// clientSecret: 'password', // Only Android
// localizedFallbackTitle: 'Use Pin', // Only iOS
// localizedReason: 'Please authenticate',
// disableBackup:true,
// })
// .then((result: any) => {
// console.log(this.userDetails);
// let role_name=(this.userDetails[0].role_name).toLowerCase()
// console.log("e",role_name)
// if(role_name.includes('sales')){
// this.navCtrl.setRoot(SalesPDlistPage);
// }
// else{
// this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
// }
// })
// .catch((error: any) => {
// this.toast.lenderappmessage('err: '+ error);
// });
// }
async checkfingerprint(): Promise<void> {
try {
await BiometricAuth.authenticate({
reason: 'Please authenticate',
cancelTitle: 'Cancel',
allowDeviceCredential: true,
iosFallbackTitle: 'Use passcode',
androidTitle: 'Biometric login',
androidSubtitle: 'Log in using biometric authentication',
androidConfirmationRequired: false,
})
console.log(this.userDetails);
let role_name=(this.userDetails[0].role_name).toLowerCase()
console.log("e",role_name)
if(role_name.includes('sales')){
console.log('sales-pd-list')
this.router.navigate(['/sales-pd-list']);
}
// else{
// alert('out')
// this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
// }
} catch (error) {
// error is always an instance of BiometryError.
if (error instanceof BiometryError) {
if (error.code !== BiometryErrorType.userCancel) {
// Display the error.
await this.toast.lenderappmessage('err: '+ error.message);
}
}
}
}

View File

@ -1,9 +1,3 @@
<!--
Generated template for the AdvanceFilterPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-toolbar>
<ion-title><ion-icon name="options" style="font-size: 18px;"></ion-icon> &nbsp;Advanced Filter</ion-title>
@ -17,57 +11,42 @@
<ion-content padding>
<div class="scrollable-content">
<!-- <mat-card class="cardUI"> -->
<div class="scrollable-content">
<form [formGroup]="searchForm" fxLayout="row wrap" fxFlex="100%" fxLayoutGap="35px" fxLayoutAlign="flex-start stretch">
<mat-form-field style="width: 100%" *ngIf="from_page != 'complete_list'">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}
<mat-form-field style="width: 100%">
<mat-select multiple formControlName="sales_pd_type" placeholder="PD Type">
<mat-option *ngFor="let item of salesPdTypeList" [value]="item.id">{{item.pd_type_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput [matDatepicker]="picker" [max]="todaydate"
formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate"
formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:100%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.abbr}}</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field style="width:100%">
<mat-select multiple formControlName="pd_city" placeholder="City">
<mat-option *ngFor="let city of CITY" [value]="city.city_id">{{city.name}}</mat-option>
</mat-select>
</mat-form-field> &nbsp; &nbsp; -->
<!-- <mat-form-field style="width:100%">
<mat-select multiple formControlName="pd_lender" placeholder="Lender Name">
<mat-option *ngFor="let ent of ENTITY" [value]="ent.entity_id">{{ent.full_name}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field style="width:100%">
<input matInput type="text" formControlName="pd_applicant_name" placeholder="Applicant Name">
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<input matInput type="text" formControlName="pd_officer" placeholder="PD Officer Name">
</mat-form-field> -->
<!-- <div fxLayout="row wrap">
<div fxFlex.xs="100%" fxFlex.sm="100%" fxFlex="45%">
<mat-checkbox class="example-margin" color="primary" formControlName="is_include_archived">Include Archived</mat-checkbox>
</div>
</div> -->
</form>
</div>
<!-- </mat-card> -->
<mat-form-field style="width: 100%">
<mat-select multiple formControlName="pd_status" placeholder="PD Status">
<mat-option *ngFor="let status of pdStatus" [value]="status.pd_status_name">{{status.pd_status_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput [matDatepicker]="picker" [max]="todaydate"
formControlName="pd_from_date" placeholder="Choose a From date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput [matDatepicker]="picker1" [min]="searchForm.get('pd_from_date').value" [max]="todaydate"
formControlName="pd_to_date" placeholder="Choose a To date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:100%">
<mat-select multiple formControlName="pd_products" placeholder="Products">
<mat-option *ngFor="let pro of PRODUCTS" [value]="pro.product_id">{{pro.abbr}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput type="text" formControlName="pd_applicant_name" placeholder="Company/Firm Name">
</mat-form-field>
</form>
</div>
</ion-content>
<ion-footer>
<ion-row>

View File

@ -1,11 +1,5 @@
@import '../../../../theme/filter-modal.scss';
// @import '../../../../theme/filter-modal.scss';
.header-md{
// background-color: #ff0303 !important;
// color: black !important;
--background: #fff;
--color: black;
}
::ng-deep .toolbar-background{
--background: none; /* Set it to none to clear the background */
border-color: #b2b2b2 ;
@ -15,6 +9,13 @@
.toolbar-title-md{
color: #fff !important;
}
/* Add this to your global styles or component-specific styles */
::ng-deep .mat-option {
z-index: 1000 !important; /* Adjust the value as needed */
}
.cdk-overlay-pane{
z-index: 1018 !important;
}
::ng-deep .filterModal {
--width: 82% !important;
@ -22,6 +23,7 @@
--max-width: 52vh !important;
--max-height: 77vh !important;
--border-radius: 10px;
z-index: 0 !important;
}
.mt{
margin-top: 2rem;
@ -39,7 +41,16 @@
/* your-modal.component.scss */
.scrollable-content {
max-height: 80vh; /* Adjust the max height as needed */
overflow-y: auto;
// max-height: 80vh; /* Adjust the max height as needed */
// overflow-y: auto;
padding: 16px;
}
}
// ::ng-deep .mat-select-panel {
// z-index: 1000; /* Adjust the value as needed */
// }
// ::ng-deep .mat-datepicker-content {
// z-index: 1000; /* Adjust the value as needed */
// }

View File

@ -1,5 +1,5 @@
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ModalController, NavController, NavParams } from '@ionic/angular';
import { AuthService } from 'src/app/authencation/auth-service/auth.service';
@ -16,21 +16,29 @@ export class PdAdvanceFilterComponent implements OnInit {
todaydate: Date;
from_page: any;
drop_down_datas: any;
@Output() filteredlistData = new EventEmitter();
@Output() resetFilter = new EventEmitter();
searchForm:FormGroup | any;
PRODUCTS: any=[];
pdStatus: any;
ENTITY: any=[];
xpandStatus: boolean = false;
pipe=new DatePipe('en-US');
is_sales_login: boolean = false;
salesPdTypeList = [
{
id:'1',
pd_type_name:"Physical PD"
},
{
id:'2',
pd_type_name:"Telephonic PD"
}
]
constructor(private pdTriggerProvider:PdtriggerService,private _fb:FormBuilder,private modalController: ModalController,public navCtrl: NavController, public navParams: NavParams,public aws: AuthService,private toastProvider:ToastService,private loaderProvider:LoadingService) {
this.todaydate = new Date();
this.getDropdown();
this.from_page = this.navParams.get('FormDet');
console.log(this.from_page);
if(this.from_page){
this.from_page =this.from_page.from_page
}
this.getDropdown();
}
ngOnInit() {
@ -38,7 +46,8 @@ export class PdAdvanceFilterComponent implements OnInit {
let local:any = JSON.parse(users);
console.log('local****',local);
this.drop_down_datas = this.navParams.get('drop_down_datas');
console.log(this.drop_down_datas)
this.is_sales_login = this.navParams.get('is_sales_login')
console.log(this.drop_down_datas,this.is_sales_login)
this.setDropDownDatas()
console.log(this.drop_down_datas);
this.searchForm = this._fb.group({
@ -47,12 +56,10 @@ export class PdAdvanceFilterComponent implements OnInit {
pd_to_date:[''],
pd_products:[''],
pd_lender:[local.fk_entity_id],
pd_applicant_name:[''],
// pd_officer:[''],
// pd_officer_id:[''],
// pd_type:[''],
// pd_name:[null],
// pd_applicant_id:[null],
pd_applicant_name:[''],
pd_officer:[''],
sales_pd_type:[''],
sales_pd_officer_id:[this.is_sales_login ? local.userid : '']
})
console.log(this.drop_down_datas)
}
@ -64,6 +71,13 @@ export class PdAdvanceFilterComponent implements OnInit {
this.PRODUCTS = res.records.filter((pro:any)=>pro.isactive==1);
}
});
this.pdTriggerProvider.getAllMasterDatas('ENTITY').subscribe(res=>
{
if(res.dataStatus==true)
{
this.ENTITY = res.records.filter((ent:any)=>ent.isactive==1 && ent.hasOwnProperty('avail_pd_types') && (ent.avail_pd_types == '2' || ent.avail_pd_types == '3' ));
}
});
this.pdTriggerProvider.getAllMasterDatas("PDSTATUS").subscribe((res:any)=>{
if(res.dataStatus==true)
{
@ -107,7 +121,7 @@ export class PdAdvanceFilterComponent implements OnInit {
}
searchItem(){
this.loaderProvider.pdloader('fetching data')
// this.loaderProvider.pdloader('fetching data')
this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd');
this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd');
// console.log(JSON.stringifythis.searchForm.value);
@ -115,23 +129,35 @@ export class PdAdvanceFilterComponent implements OnInit {
this.pdTriggerProvider.advancedFilter(this.searchForm.value).subscribe(res=>{
if(res.dataStatus){
console.log(res);
this.loaderProvider.dismissLoader();
this.modalController.dismiss(res['records']);
// this.loaderProvider.dismissLoader();
let listValue = res['records']
if(listValue && listValue.length > 0) {
if(!this.is_sales_login) {
listValue = listValue.filter((vvd:any)=>vvd.status == 'COMPLETED')
}
this.modalController.dismiss(listValue);
} else {
this.toastProvider.lenderappmessage('No Records Found...!')
}
}
else{
// this.filteredlistData.emit(res)
this.loaderProvider.dismissLoader()
// this.loaderProvider.dismissLoader()
this.toastProvider.lenderappmessage('No Records Found...!')
}
})
}
onReset(){
this.searchForm.reset();
let users:any = localStorage.getItem('user_details')
let local:any = JSON.parse(users);
local=local.fk_entity_id
this.searchForm.controls['pd_lender'].setValue(local);
this.searchForm.reset();
let usr:any = localStorage.getItem('user_details')
let local:any = JSON.parse(usr);
this.searchForm.controls['pd_lender'].setValue(local.fk_entity_id);
this.searchForm.controls['sales_pd_officer_id'].setValue(local.userid);
this.xpandStatus=false
this.resetFilter.emit(true);
}
closeModal() {

View File

@ -76,7 +76,7 @@ export class PdListComponent implements OnInit {
else {
this.is_sales_login = false
}
}
ngOnInit() {}
@ -94,7 +94,7 @@ export class PdListComponent implements OnInit {
this.common = this.common.count + ' ' + this.common.factor;
}
}, 300);
this.cameraProvider.checkAndRequestGPSPermission();
this.cameraProvider.checkAndRequestGPSPermission();
// this.salesPDService.clearLocalData();
}
@ -344,19 +344,6 @@ export class PdListComponent implements OnInit {
}
updateVisibleItems() {
this.visibleItems = this.sales_displayValue.slice(this.startIndex, this.startIndex + this.itemsPerView);
console.log(this.visibleItems)
}
// Calculate the visible range based on user interaction or screen size
onScroll(event: any) {
const scrollTop = event.target.scrollTop;
this.startIndex = Math.floor(scrollTop / 50); // Adjust this value based on your item height
this.updateVisibleItems();
console.log('scroll')
}
goToUrl(url:any){
window.open(url, '_blank');
}
@ -388,7 +375,7 @@ export class PdListComponent implements OnInit {
const modal = await this.modalController.create({
component: PdAdvanceFilterComponent,
componentProps: { 'drop_down_datas': this.filter_drop_down_data },
componentProps: { 'drop_down_datas': this.filter_drop_down_data,is_sales_login:this.is_sales_login },
...modalOption
});
@ -396,65 +383,99 @@ export class PdListComponent implements OnInit {
const { data } = await modal.onDidDismiss();
if (data) {
// this.sales_displayValue = data;
this.filterMsg=false
this.loader_access=false
this.pdlistaccess = true;
this.pdinprogress = data.filter((past:any)=>past.pd_status !="QC_COMPLETED");
this.searchinprogress = this.pdinprogress;
this.pdlistdetails = data.filter((past:any)=>past.pd_status =="QC_COMPLETED");
this.searchpast = this.pdlistdetails;
//FOR SPLITTING THE VALUE OF pd_sno
this.pdinprogress.length >0 ?
this.pdinprogress.forEach((value:any)=>{
let original=value.pd_sno
if(original != null){
value.pd_sno_split={lender_name:original.replace(/[^a-z]/gi, ''),serial_no:original.match(/(\d+)/)[0]}
if(data){
console.log(data)
this.sales_displayValue = data;
console.log(this.sales_displayValue)
this.filterMsg = false
}
if(this.sales_displayValue.length > 0){
let user1:any = localStorage.getItem('user_details');
let user=(JSON.parse(user1))
console.log(this.sales_displayValue);
if(!this.is_sales_login) {
this.sales_displayValue = this.sales_displayValue.filter((vll:any)=>vll.status == 'COMPLETED');
}
this.filterMsg = true
let products:any = []
let lenders:any = []
let pd_status:any = []
this.sales_displayValue.map((val:any)=>{
console.log('vvvaaall');
console.log(val);
// https://gstapp.smcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&PDID=123&Email=manojsahrawat@smcfinance.com
//let link = "http://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U"
// this.apiurl = this.apiurl
console.log(this.apiurl.authorization)
let link
if(this.apiurl.authorization == 'sparqvenba2018'){
console.log(this.apiurl.authorization)
link ="http://salesapp.devopsmcfinance.com/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
}else {
console.log(this.apiurl.authorization)
link ="https://salesapp.smcfinance.com/app/secure?saltkey=VQDa79tyBlpu7ZuKt6U"
}
var string:any = {
EmpName:user.user_first_name,
EmpCode:"",
PDID:val.sales_pd_sno,
//PD_NO:val.sales_pd_sno,
}
//console.log(string);
//var encodedString = btoa(JSON.stringify(string));
//console.log("encode",encodedString); // Outputs: "SGVsbG8gV29ybGQh"
//var decodedString = atob(encodedString);
//console.log("decode",JSON.parse(decodedString));
//let email="mwisesales1@sine.com";
let PDID = val.sales_pd_sno;
// let mail="&Email=manojsahrawat@smcfinance.com"
let finallink = link+"&PDID="+PDID+"&Email="+user.email
console.log('finallink')
console.log(finallink);
val.link = finallink;
if(products.length > 0 ){
if(products.filter((pro:any)=>pro == val.product_id).length == 0 ){
products.push(val.product_id)
}
}
else{
value.pd_sno_split={lender_name:'',serial_no:''}
products.push(val.product_id)
}
}) : this.pdinprogress
this.pdlistdetails.length >0 ?
this.pdlistdetails.forEach((value:any)=>{
let original=value.pd_sno
if(original != null){
value.pd_sno_split={lender_name:original.replace(/[^a-z]/gi, ''),serial_no:original.match(/(\d+)/)[0]}
if(lenders.length > 0 ){
if(lenders.filter((pro:any)=>pro == val.lender_id).length == 0 ){
lenders.push(val.lender_id)
}
}
else{
value.pd_sno_split={lender_name:'',serial_no:''}
lenders.push(val.lender_id)
}
}) : this.pdlistdetails
console.log("ingp",this.pdinprogress);
this.random_bg_color();
this.random_ng_past();
if(pd_status.length > 0 ){
if(pd_status.filter((pro:any)=>pro == val.status).length == 0 ){
pd_status.push(val.status)
}
}
else{
pd_status.push(val.status)
}
if(pd_status.length > 0 ){
if(pd_status.filter((pro:any)=>pro == val.status).length == 0 ){
pd_status.push(val.status)
}
}
//let link='a';
// val.link = finallink;
console.log('val');
console.log(val)
// link.push(val.status)
})
this.filter_drop_down_data = {product_ids:products,lender_ids:lenders,pd_status:pd_status}
console.log(this.sales_displayValue);
}
}
random_bg_color() {
for(let id of this.pdinprogress){
var x = Math.floor(Math.random() * 256);
var y = Math.floor(Math.random() * 256);
var z = Math.floor(Math.random() * 256);
this.bgColor.push("rgb(" + x + "," + y + "," + z + ")");
}
return this.bgColor;
}
random_ng_past(){
for(let id of this.pdlistdetails){
this.status = id.pd_status.replace("_"," ");
var x = Math.floor(Math.random() * 256);
var y = Math.floor(Math.random() * 256);
var z = Math.floor(Math.random() * 256);
this.bgColorPast.push("rgb(" + x + "," + y + "," + z + ")");
}
}
// redirectToAnotherPage() {
// // Navigate to another page when the "List" tab is clicked

View File

@ -5,8 +5,12 @@ import { Geolocation } from '@capacitor/geolocation'
// import watermark from 'watermarkjs';
import { NgxImageCompressService } from 'ngx-image-compress';
import { ToastService } from 'src/providers/common-provider/toast.service';
import * as watermark from 'watermarkjs'
@Injectable({
providedIn: 'root'
})
@ -14,7 +18,7 @@ export class CameraService {
geoCords: any;
pipe: DatePipe;
constructor(private imageCompress: NgxImageCompressService) {
constructor(private toastProvider:ToastService,private imageCompress: NgxImageCompressService) {
console.log('Hello CameraProvider Provider');
this.pipe=new DatePipe('en-US')
}
@ -58,42 +62,59 @@ export class CameraService {
throw err; // Handle the error at the calling location if needed
}
}
async getpicture() {
console.log('getPicture')
try {
console.log('getPicture')
localStorage.removeItem('current_coordinates');
const coordinates = await this.getGeoTag();
this.geoCords = coordinates;
console.log(this.geoCords)
localStorage.setItem('current_coordinates', this.geoCords);
// const image = await Camera.getPhoto({
// quality: 100,
// allowEditing: false,
// resultType: CameraResultType.DataUrl,
// });
// // Here you get the image as result.
// const theActualPicture = image.dataUrl;
const image = await Camera.getPhoto({
quality: 75,
allowEditing: false, // Set to true if you want to enable image editing
resultType: CameraResultType.Base64,
source: CameraSource.Camera,
width: 600,
height: 600,
correctOrientation: true,
});
const base64Image = `data:image/jpeg;base64,${image.base64String}`;
this.imageInfo(base64Image, 'Captured :');
return base64Image;
// const permissionStatus = await Camera.checkPermissions();
// if (permissionStatus.camera === 'granted') {
// GPS permission is granted
const image = await Camera.getPhoto({
quality: 75,
allowEditing: false, // Set to true if you want to enable image editing
resultType: CameraResultType.Base64,
source: CameraSource.Camera,
width: 600,
height: 600,
correctOrientation: true,
});
// this.image = image
// } else {
// // GPS permission is not granted, request it
// const requestResult = await Camera.requestPermissions({ permissions: ['camera'] });
// if (requestResult.camera === 'granted') {
// // User granted GPS permission, proceed to turn on GPS
// const image = await Camera.getPhoto({
// quality: 75,
// allowEditing: false, // Set to true if you want to enable image editing
// resultType: CameraResultType.Base64,
// source: CameraSource.Camera,
// width: 600,
// height: 600,
// correctOrientation: true,
// });
// this.image = image
// } else {
// // User denied GPS permission
// console.error('GPS permission denied');
// }
// }
console.log(image)
const base64Image = `data:image/jpeg;base64,${image.base64String}`;
this.imageInfo(base64Image, 'Captured :');
console.log('getPicture',base64Image)
return base64Image;
} catch (error) {
localStorage.removeItem('current_coordinates');
console.error('CAMERA ERROR ->', error);
@ -113,47 +134,71 @@ export class CameraService {
};
}
async addWatermarks(base64Img: string) {
return new Promise<string>(async (resolve, reject) => {
const geoCords = localStorage.getItem('current_coordinates');
console.log('coords', geoCords);
const today = new Date();
const today_loc = new DatePipe('en-US').transform(today, 'yyyy-MM-dd, h:mm a');
const dateTime = 'Date : ' + today_loc;
try {
// const watermarkedImg = await watermark([base64Img, 'assets/img/PD_watermark.png'])
// .image(watermark.image.upperRight());
// const text = watermark.text;
// const locationText = `Location : ${geoCords}`;
// const watermarkedWithDateTime = await watermark([watermarkedImg.src])
// .image(text.upperLeft(dateTime, '18px sans-serif', '#ff0000', 1.0, 40));
// const finalWatermarkedImg = await watermark([watermarkedWithDateTime.src])
// .image(text.upperLeft(locationText, '18px sans-serif', '#ff0000', 1.0));
const lastWatermarked = base64Img
this.imageInfo(lastWatermarked, 'Watermarked :');
localStorage.removeItem('current_coordinates');
try {
const compressedImg = await this.compressTheImage(lastWatermarked);
this.imageInfo(compressedImg, 'Compressed :');
resolve(compressedImg);
} catch (err) {
console.log(err);
reject();
}
} catch (error) {
console.log('Watermarking Error', error);
resolve(base64Img);
}
});
addWatermarks(base64Img:any) {
return new Promise((resolve, reject) => {
// this.constant.getGeoTag().then(geoCoordinates => {
// 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)
// resolve(raw_img);
// fetch(raw_img)
// .then(res => res.blob())
// .then(blob => {
watermark([raw_img, 'assets/img/PD_watermark.png'])
.image(watermark.image.upperRight())
.then((img:any) => {
raw_img = img.src;
let text = watermark.text
watermark([raw_img])
.image(text.upperLeft(dateTime, '18px sans-serif', '#ff0000', 1.0, 40))
.then((img:any) => {
raw_img = img.src;
// console.log("2d", raw_img)
let Location = `Location : ` + this.geoCords
watermark([raw_img])
.image(text.upperLeft(Location, '18px sans-serif', '#ff0000', 1.0))
.then((img:any) => {
raw_img = img.src
raw_img =raw_img.replace('png;','jpeg;')
let last_water_marked=raw_img
// console.log("3rd", raw_img)
this.imageInfo(last_water_marked,'Watermarked :')
localStorage.removeItem('current_coordinates')
return this.compressTheImage(last_water_marked).then(compressed_img=>{
this.imageInfo(compressed_img,'Compressed :')
console.log(compressed_img)
resolve(compressed_img);
},err=>{
console.log(err);
reject();
})
// resolve(img.src)
});
});
},(err:any)=>{
console.log("Watermarking Error", err)
resolve(raw_img);
});
})
// });
}
compressTheImage(img: string): Promise<string> {
return new Promise((resolve, reject) => {
@ -207,6 +252,31 @@ export class CameraService {
}
}
async checkAndRequestCameraPermission() {
try {
const permissionStatus = await Camera.checkPermissions();
if (permissionStatus.camera === 'granted') {
// GPS permission is granted
return 'Premission granted'
} else {
// GPS permission is not granted, request it
const requestResult = await Camera.requestPermissions();
if (requestResult.camera === 'granted') {
// User granted GPS permission, proceed to turn on GPS
return 'Request Premission granted'
} else {
// User denied GPS permission
console.error('Camera permission denied');
return null; // You might want to handle this case differently
}
}
} catch (error) {
console.error('Error checking or requesting Camera permission', error);
return null;
}
}
}

View File

@ -0,0 +1,5 @@
// watermarkjs.d.ts
declare module 'watermarkjs' {
const watermark: any;
export = watermark;
}

View File

@ -406,10 +406,8 @@ export class OfflineManagerService {
console.log(section_redirect);
const alert:any = this.toastProvider.setAlertWithOkButton(
"<small>Sales PD is incomplete<small>",
"The Following sections are not Saved <b>" +
section_dis_names.join(', ') +
'</b>'
"Sales PD is incomplete",
"The Following sections are not Saved " + section_dis_names.join(', ')
);
alert.present();

View File

@ -401,6 +401,10 @@ callMultipleApisForTemplate(product_arr:any) {
})
}
advancedFilter(params:any): Observable<any>{
return this.http.post(this.apiUrl+'filterSalesPDList',{"records":params})
}
api_post_method(apiName: string, params: any, apiMethod?: string): Observable<any> {
if (this.networkProvider.getCurrentNetworkStatus() === ConnectionStatus.online) {
return new Observable((observer: Observer<any>) => {
@ -527,6 +531,9 @@ callMultipleApisForTemplate(product_arr:any) {
})
}
sendSmsViaLink(params:any): Observable<any> {
return this.http.post(this.apiUrl + 'sendCusLinkViaSMS', params)
}
updateSectionDataLocally(params:any,form_structure:any){
return Observable.create((observer:Observer<any>) => {

View File

@ -16,7 +16,7 @@
autocomplete="off" (change)="onChangeProperty($event,parent_ques,'','',p_i)"
>
<!-- [placeholder]="parent_ques.get('field_type').value == 'num' || parent_ques.get('field_type').value == 'numtoword' ? 'Entert the Number' : 'Enter the Text'" -->
<!-- <mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"&#8377;"}}{{parent_ques.get('answer_value').value | numToWords}}</mat-hint> -->
<mat-hint *ngIf="parent_ques.get('answer_value').value != '' && parent_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 12px;">{{"&#8377;"}}{{parent_ques.get('answer_value').value | numToWords}}</mat-hint>
<!-- <mat-hint align="end" style="font-size: 11.5px;color: gray;" *ngIf="parent_ques.get('is_amt_in_words').value == true">One Lack</mat-hint> -->
<ng-container *ngFor="let validation of parent_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="parent_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
@ -24,7 +24,7 @@
</mat-form-field>
<!-- <mat-form-field> -->
<div class="radio-gap" *ngIf="parent_ques.get('type').value == '2'">
<mat-label>{{parent_ques.get('question').value}}</mat-label><br/>
<h5>{{parent_ques.get('question').value}}</h5><br/>
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,parent_ques,'','',p_i)">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of parent_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
</mat-radio-group>
@ -182,7 +182,7 @@
<input matInput [type]="single_ques.value.hasOwnProperty('field_type') ? single_ques.get('field_type').value == 'num' || single_ques.get('field_type').value == 'numtoword' ? 'number' : single_ques.get('field_type').value == 'string' ? 'text' : single_ques.get('field_type').value: ''" formControlName="answer_value"
[placeholder]="single_ques.value.hasOwnProperty('place_holder') ? single_ques.get('place_holder').value : ''"
autocomplete="off" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
<!-- <mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numToWords}}</mat-hint> -->
<mat-hint *ngIf="single_ques.get('answer_value').value != '' && single_ques.value.hasOwnProperty('field_type') && single_ques.get('field_type').value == 'numtoword'" align="end" style="font-size: 10px;">{{"&#8377;"}}{{single_ques.get('answer_value').value | numToWords}}</mat-hint>
<!-- <mat-error align="end" style="font-style: italic;margin-right: 5px;">Field is Required</mat-error> -->
<ng-container *ngFor="let validation of single_ques.get('validations').value;" ngProjectAs="mat-error">
<mat-error align="end" *ngIf="single_ques.get('answer_value').hasError(validation.name.toLowerCase())">{{validation.message}}</mat-error>
@ -190,7 +190,7 @@
</mat-form-field>
<div class="radio-gap" *ngIf="single_ques.get('type').value == '2'">
<mat-label>{{single_ques.get('question').value}}</mat-label><br/>
<h5>{{single_ques.get('question').value}}</h5><br/>
<mat-radio-group aria-label="Select an option" formControlName="answer_value" (change)="onChangeProperty($event,single_ques,group_ques,2,s_i)">
<mat-radio-button class="radio-btn-gap" *ngFor="let val of single_ques.get('answers').value" [value]="val.hasOwnProperty('answer_id') ? val.answer_id : val.answer">{{val.answer}}</mat-radio-button><br />
</mat-radio-group>

View File

@ -48,6 +48,7 @@ export class QuesTemplateComponent implements OnInit {
console.log('Hello QuesTemplateComponent Component');
this.text = 'Hello World';
this.cameraProvider.checkAndRequestGPSPermission();
this.cameraProvider.checkAndRequestCameraPermission();
}
ngOnInit() {}
@ -350,7 +351,9 @@ export class QuesTemplateComponent implements OnInit {
data = data.filter((group_indi:any) => !group_indi.hasOwnProperty('additional_field') && group_indi.additional_field != 1);
if (options == 'camera') {
console.log('camera')
this.cameraProvider.getpicture().then((res:any) => {
console.log('camera',res)
if (res != 'error') {
this.geoCoordinates = localStorage.getItem('current_coordinates');
this.cameraProvider.addWatermarks(res).then((watermarkedImage:any) => {
@ -439,10 +442,13 @@ export class QuesTemplateComponent implements OnInit {
captureImg(parent_index:any,parent_control:any){
// parent_control.controls.is_image_status.setValue('l')
console.log('camera')
this.cameraProvider.getpicture().then((res:any) => {
console.log('Camera',res)
if (res != 'error') {
this.geoCoordinates=localStorage.getItem('current_coordinates')
this.cameraProvider.addWatermarks(res).then((watermarkedImage:any)=>{
console.log(watermarkedImage)
parent_control.controls.answer_value.setValue(watermarkedImage)
@ -923,32 +929,41 @@ export class QuesTemplateComponent implements OnInit {
console.log(this.fileredSearchValue)
}
public findInvalidControls() {
const questionsControl = this.quesAnsForm.get('questions');
if (questionsControl instanceof FormArray && questionsControl.controls) {
const controls = questionsControl.controls;
console.log(controls);
for (const name in controls) {
if (controls[name].invalid) {
// public findInvalidControls() {
// const questionsArray = this.quesAnsForm.get('questions') as FormArray;
// for (let i = 0; i < questionsArray.length; i++) {
// const parent_ques = questionsArray.at(i) as FormGroup;
// // Iterate through all controls in the FormGroup
// Object.keys(parent_ques.controls).forEach(controlName => {
// const formControl = parent_ques.get(controlName);
// if (formControl && formControl.invalid) {
// formControl.markAsTouched(); // Trigger Angular validation and error messages
// const invalidControlElement = document.getElementById(controlName + '_' + i);
// if (invalidControlElement) {
// invalidControlElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
// // Scroll to the first invalid control and break the loop
// return;
// }
// }
// });
// }
// }
let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid')) as HTMLElement[];
let firstInvalidField:any;
for(let val in invalidFields){
if(invalidFields[val].nodeName == 'MAT-FORM-FIELD'){ //INPUT FOR INPUT FIELD
firstInvalidField=invalidFields[val]
break;
}
}
if(firstInvalidField != undefined){
firstInvalidField.scrollIntoView(true)
}
break;
}
private findInvalidControls(formGroup: FormGroup | FormArray) {
Object.values(formGroup.controls).forEach(control => {
if (control instanceof FormControl) {
control.markAsTouched();
} else if (control instanceof FormGroup || control instanceof FormArray) {
this.findInvalidControls(control);
}
}
// return invalid;
});
}
onSubmit(flag:any){ //1-Submit 0-Draft
if(flag != 0){
@ -961,7 +976,7 @@ export class QuesTemplateComponent implements OnInit {
if(this.matExpansionPanel!= undefined){
this.matExpansionPanel.open()
}
this.findInvalidControls()
this.findInvalidControls(this.quesAnsForm)
return
}
// CHECKING THE SAVE IMAGE REQUEST IS STILL PENDING
@ -1123,7 +1138,7 @@ export class QuesTemplateComponent implements OnInit {
section_dis_names.push(res.sectin_name)
})
}
const alert = this.toastProvider.setAlertWithOkButton("<small>Sales PD is incomplete<small>", "The Following sections are not Saved <b>" + section_dis_names + '</b>');
const alert = this.toastProvider.setAlertWithOkButton("Sales PD is incomplete", "The Following sections are not Saved " + section_dis_names);
alert.then(async (resolvedAlert) => {
await resolvedAlert.present();

View File

@ -112,4 +112,7 @@
--padding-end: 16px; // Adjust as needed
--padding-top: 16px; // Adjust as needed
--padding-bottom: 16px; // Adjust as needed
}
h6{
font-size: 14px;
}

View File

@ -19,6 +19,7 @@
@import "@ionic/angular/css/typography.css";
@import "@ionic/angular/css/display.css";
/* Optional CSS utils that can be commented out */
@import "@ionic/angular/css/padding.css";
@import "@ionic/angular/css/float-elements.css";
@ -41,6 +42,10 @@
// --padding-bottom: 16px; // Adjust as needed
// }
.alert-title.sc-ion-alert-md{
color: black !important;
}

View File

@ -0,0 +1,8 @@
import { NumToWordsPipe } from './num-to-words.pipe';
describe('NumToWordsPipe', () => {
it('create an instance', () => {
const pipe = new NumToWordsPipe();
expect(pipe).toBeTruthy();
});
});

View File

@ -0,0 +1,74 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'numToWords'
})
export class NumToWordsPipe implements PipeTransform {
/**
* Takes a value and makes it lowercase.
*/
a:any = [
'',
'one ',
'two ',
'three ',
'four ',
'five ',
'six ',
'seven ',
'eight ',
'nine ',
'ten ',
'eleven ',
'twelve ',
'thirteen ',
'fourteen ',
'fifteen ',
'sixteen ',
'seventeen ',
'eighteen ',
'nineteen '];
b:any = [
'',
'',
'twenty',
'thirty',
'forty',
'fifty',
'sixty',
'seventy',
'eighty',
'ninety'];
transform(value: any, ...args:any) {
if (value) {
let num: any = Number(value);
if (num) {
if ((num = num.toString()).length > 9) {
// return 'We are not the Iron Bank, you can lower down the stakes :)';
return ''
}
const n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
if (!n) {return ''; }
let str = '';
str += (Number(n[1]) !== 0) ? (this.a[Number(n[1])] || this.b[n[1][0]] + ' ' + this.a[n[1][1]]) + 'crore ' : '';
str += (Number(n[2]) !== 0) ? (this.a[Number(n[2])] || this.b[n[2][0]] + ' ' + this.a[n[2][1]]) + 'lakh ' : '';
str += (Number(n[3]) !== 0) ? (this.a[Number(n[3])] || this.b[n[3][0]] + ' ' + this.a[n[3][1]]) + 'thousand ' : '';
str += (Number(n[4]) !== 0) ? (this.a[Number(n[4])] || this.b[n[4][0]] + ' ' + this.a[n[4][1]]) + 'hundred ' : '';
str += (Number(n[5]) !== 0) ? ((str !== '') ? 'and ' : '') +
(this.a[Number(n[5])] || this.b[n[5][0]] + ' ' +
this.a[n[5][1]]) + 'rupee' : '';
// return str;
return str.charAt(0).toUpperCase() +
str.slice(1);
} else {
return '';
}
} else {
return '';
}
}
}

View File

@ -98,9 +98,9 @@ export class PdtriggerService {
// catchError(this.handleError('role', []))
)
}
advancedFilter(params:any): Observable<any>{
return this.http.post(this.apiUrl+'filterPDList',{"records":params})
return this.http.post(this.apiUrl+'filterSalesPDList',{"records":params})
}
}

View File

@ -16,12 +16,13 @@ import { MatDatepickerModule } from '@angular/material/datepicker'
import { MatSelectModule } from '@angular/material/select'
import { MatRadioModule } from '@angular/material/radio'
import { MatExpansionModule } from '@angular/material/expansion'
import { NumToWordsPipe } from 'src/pipes/num-to-words.pipe';
@NgModule({
declarations: [],
declarations: [NumToWordsPipe],
imports: [
CommonModule,
MatButtonModule,
@ -68,6 +69,7 @@ import { MatExpansionModule } from '@angular/material/expansion'
// FlexModule,
],
exports: [
NumToWordsPipe,
MatButtonModule,
MatCardModule,
MatInputModule,