Initial commit

This commit is contained in:
Venba 2023-11-03 11:14:51 +05:30
parent 2d305dba36
commit eb62d11088
133 changed files with 5644 additions and 2119 deletions

View File

@ -31,7 +31,11 @@
"output": "./svg"
}
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"styles": [
"@angular/material/prebuilt-themes/purple-green.css",
"src/theme/variables.scss",
"src/global.scss"
],
"scripts": []
},
"configurations": {
@ -111,7 +115,11 @@
"output": "./svg"
}
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"styles": [
"@angular/material/prebuilt-themes/purple-green.css",
"src/theme/variables.scss",
"src/global.scss"
],
"scripts": []
},
"configurations": {
@ -129,6 +137,30 @@
"src/**/*.html"
]
}
},
"ionic-cordova-serve": {
"builder": "@ionic/cordova-builders:cordova-serve",
"options": {
"cordovaBuildTarget": "app:ionic-cordova-build",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"cordovaBuildTarget": "app:ionic-cordova-build:production",
"devServerTarget": "app:serve:production"
}
}
},
"ionic-cordova-build": {
"builder": "@ionic/cordova-builders:cordova-build",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
}
}
}
@ -146,4 +178,4 @@
"styleext": "scss"
}
}
}
}

101
config.xml Normal file
View File

@ -0,0 +1,101 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<preference name="Scheme" value="http" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
<icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
<icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
<icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
<icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
<icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^5.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
</widget>

View File

@ -1,7 +1,10 @@
{
"name": "sineedgelenderapp2.0",
"integrations": {
"capacitor": {}
"capacitor": {
"enabled": false
},
"cordova": {}
},
"type": "angular"
}

8
local.properties Normal file
View File

@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Oct 31 10:07:55 IST 2023
sdk.dir=/home/venba/.jdks/openjdk-21.0.1

5888
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,12 @@
"private": true,
"dependencies": {
"@angular/animations": "^16.0.0",
"@angular/cdk": "^16.2.10",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/core": "^16.2.11",
"@angular/forms": "^16.0.0",
"@angular/material": "^16.2.10",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
@ -26,9 +28,13 @@
"@capacitor/haptics": "5.0.6",
"@capacitor/keyboard": "5.0.6",
"@capacitor/status-bar": "5.0.6",
"@ionic/angular": "^7.0.0",
"@ionic-native/core": "^5.0.0",
"@ionic/angular": "^7.5.2",
"@ionic/cordova-builders": "^10.0.0",
"@ionic/storage-angular": "^4.0.0",
"amazon-cognito-identity-js": "^6.3.6",
"ionicons": "^7.0.0",
"rxjs": "~7.8.0",
"rxjs": "^7.8.1",
"tslib": "^2.3.0",
"zone.js": "~0.13.0"
},
@ -48,6 +54,14 @@
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"cordova-android": "^12.0.1",
"cordova-plugin-camera": "^7.0.0",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"eslint": "^7.26.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
@ -63,5 +77,21 @@
"ts-node": "^8.3.0",
"typescript": "~5.0.2"
},
"description": "An Ionic project"
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-camera": {
"ANDROIDX_CORE_VERSION": "1.6.+"
},
"cordova-plugin-network-information": {}
},
"platforms": [
"android"
]
}
}

8
resources/README.md Normal file
View File

@ -0,0 +1,8 @@
These are Cordova resources. You can replace icon.png and splash.png and run
`ionic cordova resources` to generate custom icons and splash screens for your
app. See `ionic cordova resources --help` for details.
Cordova reference documentation:
- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html
- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>

BIN
resources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
resources/ios/icon/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
resources/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -4,12 +4,18 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: 'folder/Inbox',
redirectTo: 'auth',
pathMatch: 'full'
},
{
path: 'folder/:id',
loadChildren: () => import('./folder/folder.module').then( m => m.FolderPageModule)
path: 'auth',
loadChildren: () => import('./authencation/authencation.module').then( m => m.AuthencationModule),
data: { disableMenu: true }, // Add this line to disable the menu
},
{
path: 'pages',
loadChildren: () => import('./pages/page.module').then( m => m.PageModule),
data: { disableMenu: true }, // Add this line to disable the menu
}
];

View File

@ -6,10 +6,29 @@ import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AuthService } from './authencation/auth-service/auth.service';
import { CognitoService } from './authencation/auth-service/cognito.service';
import { PageModule } from './pages/page.module';
import { PageRoutingModule } from './pages/page-routing.module';
import { IonicStorageModule } from '@ionic/storage-angular';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
ReactiveFormsModule,
HttpClientModule,
FormsModule,
BrowserAnimationsModule,
PageModule,
PageRoutingModule,
IonicStorageModule.forRoot(),
],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
})

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { AuthService } from './auth.service';
describe('AuthService', () => {
let service: AuthService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AuthService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,156 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { HttpClient } from '@angular/common/http'
import { Observable, catchError, map } from 'rxjs';
import { AuthenticationDetails, CognitoUser, CognitoUserPool, CognitoUserSession } from 'amazon-cognito-identity-js';
import { IonicStorageService } from 'src/providers/ionic-storage/ionic-storage.service';
import { CognitoService } from './cognito.service';
@Injectable({
providedIn: 'root'
})
export class AuthService {
apiurl: any
lenderUserPool: any;
constructor(private http:HttpClient,public shared:CognitoService,private ionicStorageProvider:IonicStorageService) {
this.apiurl = environment
const lender_poolData = {
UserPoolId:this.apiurl.lenUserPoolId, // Username :SPARQ_LENDER_DEV
ClientId: this.apiurl.lenClientId // ClientName:LENDER_DEV_WEB
};
this.lenderUserPool = new CognitoUserPool(lender_poolData);
}
takeDecisionRouting(userDetails:any){
let role_name=userDetails.role_name.toLowerCase()
console.log("e",role_name)
if(role_name.includes('sales')){
return 'sales'
}
else{
// this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
return 'credit'
}
}
async getBase64ImageFromUrl(imageUrl:any) {
var res = await fetch(imageUrl);
var blob = await res.blob();
return new Promise((resolve, reject) => {
var reader = new FileReader();
reader.addEventListener("load", function () {
resolve(reader.result);
}, false);
reader.onerror = () => {
return reject(this);
};
reader.readAsDataURL(blob);
})
}
dologin(authenticationData:any) {
console.log(authenticationData)
// alert();
//(authenticationData);
const authenticationDetails = new AuthenticationDetails(authenticationData);
console.log(authenticationDetails)
let Newpassword = authenticationData.Password;
console.log(Newpassword)
let attributesData:any = [];
const userData = {
Username: authenticationData.Username, // User email id
Pool: this.lenderUserPool // user Pool ID
};
console.log(userData)
let cognitoUser = new CognitoUser(userData);
console.log(cognitoUser)
return Observable.create((observer: any) => {
cognitoUser.authenticateUser(authenticationDetails, {
newPasswordRequired: (userAttributes: any, requiredAttributes: any) => {
cognitoUser.completeNewPasswordChallenge(
Newpassword,
attributesData,
{
onSuccess: function (result: any) {
observer.next(result);
observer.complete();
},
onFailure: function (err: any) {
observer.error(err);
},
},
requiredAttributes // Make sure to include the required attributes
);
},
onSuccess: function (result: any) {
console.log(result)
observer.next(result);
observer.complete();
// this.shared.isloggin = true;
},
onFailure: function (err: any) {
observer.error(err);
},
});
});
}
getlocale() {
console.log('222');
let session: any = this.shared.getToken() || null;
console.log(session, '222');
let userid = '';
if (session && session.idToken && session.idToken.payload && session.idToken.payload.locale) {
userid = session.idToken.payload.locale;
console.log(userid)
}
return userid;
}
getUserProfile(userid: any): Observable<any> {
alert();
const roles = { 'userid': userid };
console.log(userid)
return this.http.post(this.apiurl.url + 'getUsersDetails', roles)
.pipe(
map((result: any) => {
this.ionicStorageProvider.checkAndInsertApiDataLocally(result, { 'userid': userid }, 'getUsersDetails','');
return result;
}),
catchError((error: any) => {
return this.ionicStorageProvider.getApiDataFromLocally({ 'userid': userid }, 'getUsersDetails');
})
);
}
logout(){
return Observable.create((observe:any)=>{
this.shared.getCurrentUser().signOut();
observe.next();
observe.complete();
});
}
generateotp(email:any): Observable<any> {
return this.http.post(this.apiurl.url + 'generateOTP', { "records":{ "email":email}})
// .pipe(
// catchError(this.handleError('role', []))
// )
}
resetpassword(data:any,otp:any): Observable<any> {
return this.http.post(this.apiurl.url + 'verifyOTP', { "records":{ "email":data,"OTP":otp}})
// .pipe(
// catchError(this.handleError('role', []))
// )
}
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { CognitoService } from './cognito.service';
describe('CognitoService', () => {
let service: CognitoService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CognitoService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,139 @@
import { Injectable } from '@angular/core';
import { CognitoUserPool } from 'amazon-cognito-identity-js';
import { Observable, of } from 'rxjs';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class CognitoService {
apiUrl:any
lenderUserPool: any;
public loggedIn :boolean = false;
isloggin:any = false;
constructor() {
this.apiUrl= environment
const lender_poolData = {
UserPoolId: this.apiUrl.lenUserPoolId, // Username :SPARQ_LENDER_DEV
ClientId: this.apiUrl.lenClientId // ClientName:LENDER_DEV_WEB
};
this.lenderUserPool = new CognitoUserPool(lender_poolData);
}
getCurrentUser() {
console.log(this.lenderUserPool.getCurrentUser());
return this.lenderUserPool.getCurrentUser();
}
isLoggedIn() {
if(this.lenderUserPool.getCurrentUser() !=null){
this.loggedIn = true;
}else{
this.loggedIn = false;
}
return this.loggedIn; // {2}
}
refresh() {
let tokenexp:boolean;
return Observable.create((observer:any)=>{
if(this.getCurrentUser() !=null){
this.getCurrentUser().getSession(function (err:any, session:any) {
if (err) {
console.log("CognitoUtil: Can't set the credentials:" + err);
}
else {
if (session.isValid()) {
tokenexp = session.isValid();
of(tokenexp)
console.log("CognitoUtil: refreshed successfully");
} else {
tokenexp = session.isValid();
console.log("CognitoUtil: refreshed but session is still not valid");
}
console.log("Else Part End");
}
observer.next(tokenexp)
observer.complete()
return tokenexp;
// resolve(tokenexp)
},(err: any)=>{
console.log("cognito refresh error",err)
});
}else{
console.log("Cognito refresh error getCurrentUser()")
this.loggedIn = false;
// return this.loggedIn
}
// })
})
}
getAccessToken(){
this.refresh();
return new Promise((resolve, reject) => {
let jwttoken = '';
if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser()));
// console.log('76 if');
this.getCurrentUser().getSession(function (err:any, session:any) {
if (err) {
console.log("CognitoUtil: Can't set the credentials:" + err);
jwttoken ='';
// console.log('81 if')
reject(err);
}
else {
if (session.isValid()) {
// console.log('85 else if');
jwttoken = session;
resolve(null);
} else {
}
}
});
}
else {
//console.log("else");
reject();
}
});
}
getToken(): any {
let isLogging = false;
let jwtToken = '';
if (this.getCurrentUser() != null) {
this.getCurrentUser().getSession((err:any, session:any) => {
if (err) {
console.error('getToken Error', err);
isLogging = false;
} else {
console.log('Session', session);
if (session.isValid()) {
console.log('Session is valid');
jwtToken = session.getIdToken().getJwtToken();
isLogging = true;
} else {
isLogging = false;
}
}
});
} else {
console.log('User not logged in');
isLogging = false;
}
return jwtToken;
}
}

View File

@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { PinLockComponent } from './pin-lock/pin-lock.component';
import { PasswordComponent } from './password/password/password.component';
import { OtpComponent } from './otp/otp/otp.component';
const routes: Routes = [
{
path: '',
component: LoginComponent
},
{
path: 'pin-lock',
component: PinLockComponent
},
{
path: 'password',
component: PasswordComponent
},
{
path: 'otp',
component: OtpComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class AuthencationRoutingModule { }

View File

@ -0,0 +1,30 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AuthencationRoutingModule } from './authencation-routing.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { LoginComponent } from './login/login.component';
import { SharedModule } from 'src/shared/shared.module';
import { AuthService } from './auth-service/auth.service';
import { CognitoService } from './auth-service/cognito.service';
import { IonicStorageModule } from '@ionic/storage-angular';
import { PinLockComponent } from './pin-lock/pin-lock.component';
import { PasswordComponent } from './password/password/password.component';
import { OtpComponent } from './otp/otp/otp.component';
@NgModule({
imports: [
CommonModule,
SharedModule,
FormsModule,
IonicModule,
AuthencationRoutingModule,
ReactiveFormsModule,
IonicStorageModule
],
declarations: [LoginComponent,PinLockComponent,PasswordComponent,OtpComponent],
providers:[AuthService,CognitoService]
})
export class AuthencationModule { }

View File

@ -0,0 +1,108 @@
<ion-content [fullscreen]="true" class="login-bg">
<ion-row class="topspace" style="margin-top: 30%;">
<ion-col></ion-col>
<ion-col size="10">
<mat-card class="cardUI">
<div class="container" *ngIf="screen == 'signin'">
<ion-row class="topspace">
<ion-col></ion-col>
<ion-col size="8"><img src="../../assets/img/PD_Genie_TM1_nobg.png" style="width: auto;height: auto;" alt="SineEdge"></ion-col>
<ion-col></ion-col>
</ion-row>
<form [formGroup]="loginForm" (ngSubmit)="login()">
<!-- <ion-item lines="none" class="ion-item"> -->
<mat-form-field style="width: 100%;">
<input matInput placeholder="Email" formControlName="email">
<mat-error *ngIf="!loginForm.get('email')?.errors?.required && (loginForm.get('email')?.errors?.pattern)">
Please enter a valid email address
</mat-error>
<mat-error *ngIf="loginForm.get('email')?.invalid && (loginForm.get('email')?.dirty || loginForm.get('email')?.touched) && loginForm.get('email')?.errors?.required">
Email is required
</mat-error>
</mat-form-field>
<!-- <fieldset class="input-item">
<legend>Email Id</legend>
<ion-input formControlName="email" type="email" placeholder="name@domain.com"></ion-input>
</fieldset> -->
<!-- </ion-item> -->
<!-- <ion-item lines="none" class="ion-item"> -->
<mat-form-field style="width: 100%;">
<input matInput type="password" placeholder="Password" formControlName="password" [type]="hide ? 'password' : 'text'" name="password">
<mat-icon class="passwordIcon" matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
<mat-error *ngIf="!loginForm.get('password')?.errors?.required">
Password length must be greater than or equal to 8 and password must contain one or more uppercase , lowercase , numeric and special characters
</mat-error>
<mat-error *ngIf="loginForm.get('password')?.invalid && (loginForm.get('password')?.dirty || loginForm.get('password')?.touched) && loginForm.get('password')?.errors?.required">
Password is required
</mat-error>
</mat-form-field>
<!-- <fieldset class="input-item">
<legend>Password</legend>
<ion-input formControlName="password" type="password" placeholder="*******"></ion-input>
</fieldset> -->
<!-- </ion-item> -->
<!-- <p class="forget-text"><a (click)="change('forget')">Forgot Password?</a></p> -->
<!-- <p class="signup-text">I'm a new user&nbsp;<a (click)="change('signup')">Sign Up?</a></p> -->
<ion-button type="onSubmit" class="login-button" [disabled]="!loginForm.valid || isFormEmpty()" expand="block">Sign In</ion-button>
<!-- <ion-button class="google-button" expand="block" color="light"><ion-icon name="logo-google"></ion-icon>&nbsp;&nbsp;Google Signin</ion-button> -->
</form>
</div>
</mat-card>
</ion-col>
<ion-col></ion-col>
</ion-row>
<!-- Login Page -->
<!-- Sign up page -->
<!-- <div class="container" *ngIf="screen == 'signup'">
<h1 class="heading">🚀 Create Account<br><br></h1>
<p class="para">Sign up to get started!</p>
<form [formGroup]="formData">
<ion-item lines="none" class="ion-item">
<fieldset class="input-item">
<legend>Full Name</legend>
<ion-input formControlName="name" type="text" placeholder="John Doe"></ion-input>
</fieldset>
</ion-item>
<ion-item lines="none" class="ion-item">
<fieldset class="input-item">
<legend>Email Id</legend>
<ion-input formControlName="email" type="email" placeholder="john@doe.com"></ion-input>
</fieldset>
</ion-item>
<ion-item lines="none" class="ion-item">
<fieldset class="input-item">
<legend>Password</legend>
<ion-input formControlName="password" type="password" placeholder="*******"></ion-input>
</fieldset>
</ion-item>
<p class="signup-text">I'm already a member&nbsp;<a (click)="change('signin')">Sign In?</a></p>
<ion-button class="login-button" (click)="register()" expand="block">Sign Up</ion-button>
<ion-button class="google-button" expand="block" color="light"><ion-icon name="logo-google"></ion-icon>&nbsp;&nbsp;Google Signin</ion-button>
</form>
</div> -->
<!-- Forget password page -->
<!-- <div class="container" *ngIf="screen == 'forget'">
<h1 class="heading">Forget Password?<br><br></h1>
<p class="para">Enter email to reset</p>
<ion-item lines="none" class="ion-item">
<fieldset class="input-item">
<legend>Email Id</legend>
<ion-input type="email" placeholder="name@domain.com"></ion-input>
</fieldset>
</ion-item>
<p class="signup-text">Rememberd Password&nbsp;<a (click)="change('signin')">Sign In?</a></p>
<ion-button class="login-button" expand="block">Reset Password</ion-button>
</div> -->
</ion-content>
<!-- <ion-footer color="white">
<ion-toolbar>
<p class="copyright">Crafted in ❤️ by&nbsp;<a>Adenwalla</a></p>
</ion-toolbar>
</ion-footer> -->

View File

@ -0,0 +1,100 @@
::ng-deep .login-bg {
--background: none; /* Set it to none to clear the background */
background: url('../../../assets/img/misc/login3.jpg') no-repeat center center fixed !important;
background-size: cover !important;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.heading{
font-size: 32px;
font-weight: bold;
padding-left: 20px;
margin-top: 70px;
margin-bottom: -60px;
}
.para{
font-size: 22px;
font-weight: 500;
padding-left: 20px;
margin-bottom: 70px;
color: #A6ABB1;
}
.input-item{
padding-left: 20px;
width: 100%;
border-radius: 12px;
border: 2px solid #e2e2e2;
height: 70px;
ion-input{
margin-top: -12px;
}
}
.ion-item{
margin-top: 20px;
}
.forget-text{
a{
text-decoration: none;
color: black;
}
text-align: end;
margin-bottom: -10px;
padding-right: 20px;
}
.login-button{
padding-left: 50px;
padding-right: 50px;
height: 40px;
--border-radius: 30px;
--box-shadow: none;
margin-top: 25px;
}
::ng-deep .button-native{
background: #f44336 !important;
}
.google-button{
padding-left: 20px;
padding-right: 20px;
height: 50px;
--border-radius: 12px;
margin-top: 20px;
margin-bottom: 40px;
--box-shadow: none;
}
.signup-text{
a{
text-decoration: none;
color: var(--ion-color-primary);
}
padding-right: 20px;
text-align: end;
}
ion-footer {
display: block;
// position: relative;
-ms-flex-order: 1;
order: 1;
width: 100%;
z-index: 10;
}
.copyright{
text-align: center;
}
.topSpace{
margin-top: 5rem;
}
.ionCon{
background: #29abc1 !important;
}
.cardUI{
padding: 1rem;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
background-color: #ffffff61;
border-radius: 10px;
}
::ng-deep .mdc-text-field--filled:not(.mdc-text-field--disabled) {
background-color: unset !important;
}

View File

@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,201 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { LoadingController, MenuController, ModalController, NavController, NavParams } from '@ionic/angular';
import { AuthService } from '../auth-service/auth.service';
import { ActivatedRoute, Router } from '@angular/router';
import { PdtriggerService } from 'src/providers/pdtrigger/pdtrigger.service';
import { environment } from 'src/environments/environment';
import { ToastService } from 'src/providers/common-provider/toast.service';
import { OtpComponent } from '../otp/otp/otp.component';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
export class LoginComponent implements OnInit {
screen: any = 'signin';
loginForm: FormGroup | any;
isLoading: boolean = false;
hide: boolean = true;
userDetails: any = [];
forgetpin: any;
commonDetails: any;
private env = environment
constructor(private modalController: ModalController,private toast:ToastService,private route: ActivatedRoute,private router:Router,private fb:FormBuilder, private auth:AuthService,public Menu:MenuController,private loadingController: LoadingController,public navCtrl:NavController,private pdtrigger:PdtriggerService) {
this.loginForm = new FormGroup({
email: new FormControl('', [Validators.required, Validators.email,Validators.pattern(
'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
),]),
password: new FormControl('', null)
// password: new FormControl('', [Validators.required,Validators.pattern(
// '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,12}$'
// )])
});
}
ngOnInit() {
// this.hide = true;
}
ionViewDidEnter(){
this.Menu.enable(false);
}
ionViewWillLeave(){
this.Menu.enable(true);
}
change(event:any){
this.screen = event;
}
async presentLoading() {
const loading = await this.loadingController.create({
message: 'Please wait...',
duration: 8000,
spinner: 'dots', // You can choose a spinner style
translucent: true, // Make the background slightly translucent
cssClass: 'custom-loading-class', // Add your own CSS class for styling
});
await loading.present();
}
login() {
// Get form values
const email = this.loginForm.get('email').value;
const password = this.loginForm.get('password').value;
if (email && password) {
const mailid = email.split(/\s/).join('');
const pwd = password.split(/\s/).join('');
const auth = {'Username': mailid,'Password': pwd };
// Assuming this.aws.dologin(auth) returns an Observable
this.auth.dologin(auth).subscribe((awsres:any) => {
console.log('awsres',awsres)
this.presentLoading();
// setTimeout(() => {
this.getlenderpddetails();
this.getCommonSettings();
// this.navCtrl.setRoot(PdListPage);
// }, 1000);
},
(err:any) => {
console.error(err, JSON.stringify(err.message));
if (err.message === 'New password is required.') {
this.getCommonSettings();
// this.navCtrl.setRoot(PasswordPage,{'Username':this.email,'Password':this.password});
this.navCtrl.navigateRoot('/password',{queryParams: {'Username':this.loginForm.get('email').value,'Password':this.loginForm.get('password').value}});
} else {
console.error(JSON.stringify(err.message));
this.toast.lenderappmessage(JSON.stringify(err.message));
}
}
);
} else {
this.toast.lenderappmessage('Enter Email or Password');
}
}
getlenderpddetails() {
const userid = this.auth.getlocale();
console.log(userid)
this.auth.getUserProfile(userid).subscribe((res) => {
this.userDetails = res;
if (this.userDetails.dataStatus === true) {
this.userDetails = this.userDetails.records[0];
localStorage.setItem('user_details', JSON.stringify(this.userDetails));
// this.events.publish('len_user_name', this.userDetails);
let role = this.auth.takeDecisionRouting(this.userDetails);
// Use ActivatedRoute to get the 'resetlogin' parameter
this.route.queryParams.subscribe((params) => {
this.forgetpin = params['resetlogin'];
if (this.forgetpin === 'true') {
this.navCtrl.navigateRoot('/pin-lock', { queryParams: { resetpin: this.forgetpin } });
} else if (role === 'sales') {
this.pdtrigger.initiateMasterApis('sales');
this.navCtrl.navigateRoot('/sales-pd-list');
} else {
// this.navCtrl.navigateRoot('/pd-list', { queryParams: { userDetails: this.userDetails } });
}
});
}
});
}
getCommonSettings(){
// getCommonConfig
this.pdtrigger.getCommonSettingsConfig().subscribe(res=>{
this.commonDetails = res;
if(this.commonDetails.dataStatus == true){
localStorage.setItem("commonSettings",JSON.stringify(this.commonDetails.records));
}
})
// storing the pin screen lock image locally
this.auth.getBase64ImageFromUrl(this.env.commonimage).then((base64LockImg:any)=>{
if(base64LockImg) {
localStorage.setItem('pinLockImage',base64LockImg);
}
})
}
async forgotpassword() {
const email = this.loginForm.get('email').value;
// Ensure you have 'this.email' defined properly.
const mailid = email.split(/\s/).join('');
const res = await this.auth.generateotp(mailid).toPromise();
if (res.status === 200) {
const modal = await this.modalController.create({
component: OtpComponent,
componentProps: { drop_down_datas: email },
cssClass: 'optModal'
});
await modal.present();
const { data } = await modal.onWillDismiss();
if (data === true) {
this.getCommonSettings();
this.navCtrl.navigateRoot('/password', {
queryParams: { Username: email, Password: 'temp1234' }
});
}
} else {
alert(res.msg);
}
}
// loggedInCheck(){
// //alert(this.shared.isLoggedIn);
// if(this.shared.isLoggedIn){
// alert("if");
// // this.router.navigate(['/home']);
// return false;
// }else{
// alert("else");
// return true;
// }
// }
isFormEmpty(): boolean {
const email = this.loginForm.get('email').value;
const password = this.loginForm.get('password').value;
return !email && !password;
}
}

View File

@ -0,0 +1,3 @@
<p>
otp works!
</p>

View File

@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { OtpComponent } from './otp.component';
describe('OtpComponent', () => {
let component: OtpComponent;
let fixture: ComponentFixture<OtpComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ OtpComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(OtpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,14 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-otp',
templateUrl: './otp.component.html',
styleUrls: ['./otp.component.scss'],
})
export class OtpComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

View File

@ -0,0 +1,3 @@
<p>
password works!
</p>

View File

@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PasswordComponent } from './password.component';
describe('PasswordComponent', () => {
let component: PasswordComponent;
let fixture: ComponentFixture<PasswordComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PasswordComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PasswordComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,14 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.scss'],
})
export class PasswordComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

View File

@ -0,0 +1,3 @@
<p>
pin-lock works!
</p>

View File

@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PinLockComponent } from './pin-lock.component';
describe('PinLockComponent', () => {
let component: PinLockComponent;
let fixture: ComponentFixture<PinLockComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PinLockComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PinLockComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,14 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-pin-lock',
templateUrl: './pin-lock.component.html',
styleUrls: ['./pin-lock.component.scss'],
})
export class PinLockComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PdListComponent } from './pd-list/pd-list.component';
const routes: Routes = [
{
path: 'sales-pd-list',
component: PdListComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PageRoutingModule { }

View File

@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PageRoutingModule } from './page-routing.module';
import { PdListComponent } from './pd-list/pd-list.component';
@NgModule({
declarations: [PdListComponent],
imports: [
CommonModule,
PageRoutingModule
]
})
export class PageModule { }

View File

@ -0,0 +1,3 @@
<p>
pd-list works!
</p>

Some files were not shown because too many files have changed in this diff Show More