+
diff --git a/src/app/pages/page.module.ts b/src/app/pages/page.module.ts
index 674742f..60f623f 100644
--- a/src/app/pages/page.module.ts
+++ b/src/app/pages/page.module.ts
@@ -3,13 +3,17 @@ import { CommonModule } from '@angular/common';
import { PageRoutingModule } from './page-routing.module';
import { PdListComponent } from './pd-list/pd-list.component';
-
+import { IonicModule } from '@ionic/angular';
+import { SharedModule } from 'src/shared/shared.module';
+
@NgModule({
declarations: [PdListComponent],
imports: [
CommonModule,
- PageRoutingModule
+ PageRoutingModule,
+ SharedModule,
+ IonicModule.forRoot(),
]
})
export class PageModule { }
diff --git a/src/app/pages/pd-list/pd-list.component.html b/src/app/pages/pd-list/pd-list.component.html
index 9d93f21..687cdaa 100644
--- a/src/app/pages/pd-list/pd-list.component.html
+++ b/src/app/pages/pd-list/pd-list.component.html
@@ -1,3 +1,71 @@
-
- pd-list works!
-
+
+
+
+
+
+ Sales PD List
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{val.applicant_name}}
+
+
+ Name Not Given
+
+
+
+
{{val.createdon | date:'dd-MM-yy h:mm:ss a'}}
+
+
+
+
+
+ {{val.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}}
+
+
+
+
+ {{val.abbr}} | {{val.status}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/pd-list/pd-list.component.scss b/src/app/pages/pd-list/pd-list.component.scss
index e69de29..6ed1882 100644
--- a/src/app/pages/pd-list/pd-list.component.scss
+++ b/src/app/pages/pd-list/pd-list.component.scss
@@ -0,0 +1,87 @@
+.header-md{
+ background-color: #ff0303 !important;
+}
+ion-item-sliding{
+ border-bottom: 1px solid #b4b5b9;
+}
+ion-col{
+ padding: 0px !important;
+}
+h1{
+ margin: 2px 0;
+ font-size: 20px !important;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: black;
+}
+p{
+ margin: 0px !important;
+}
+h6{
+ margin: 0px !important;
+}
+::ng-deep .item-native{
+ padding-inline-start: unset !important;
+}
+ion-grid{
+ padding:0px;
+ }
+ .fadeIn {
+ animation-name: fadeIn;
+ animation-duration: 15s;
+ transition: all 0.5s cubic-bezier(.36,-0.64,.34,1.76);
+ }
+ @font-face{
+ font-family: Roboto;
+ src: url('../../../assets/fonts/Roboto-Bold.ttf')!important;
+ }
+ .app_id{
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 12px;
+ color: #473938;
+ }
+ .label-md{
+ margin: 0px;
+ }
+ .item-md h4 {
+ font-size: 10px;
+ }
+ .item-md p{
+ font-size: 12px;
+ }
+ .item-md ion-icon[item-start] + .item-inner{
+ margin-left: 0px;
+ }
+ .applicant_name{
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+
+.action-sheet-md .action-sheet-group:first-child {
+padding-top: 0.8rem;
+border-radius: 15px 15px 0 0;
+}
+.action-sheet-container {
+padding: 0 3% 0 3%;
+font-weight:bold
+}
+
+.action-sheet-md .action-sheet-button {
+// font-weight: 500;
+border-top:1px solid lightgray;
+}
+.action-sheet-md .action-sheet-icon {
+margin: 0 10px 0 0;
+}
+p.note{
+color: gray;
+font-size: 13px;
+font-weight: bold;
+text-align: center;
+border-radius: 10px;
+padding: 10px;
+float: center;
+
+}
diff --git a/src/app/pages/pd-list/pd-list.component.ts b/src/app/pages/pd-list/pd-list.component.ts
index ede1a3f..f245a6a 100644
--- a/src/app/pages/pd-list/pd-list.component.ts
+++ b/src/app/pages/pd-list/pd-list.component.ts
@@ -1,5 +1,13 @@
import { Component, OnInit } from '@angular/core';
+import { ActionSheetController, MenuController, ModalController, NavController } from '@ionic/angular';
+import { AuthService } from 'src/app/authencation/auth-service/auth.service';
+import { LoadingService } from 'src/providers/common-provider/loading.service';
+import { ToastService } from 'src/providers/common-provider/toast.service';
+import { IonicStorageService } from 'src/providers/ionic-storage/ionic-storage.service';
+import { SalesPdService } from '../providers/sales-pd/sales-pd.service';
+import { environment } from 'src/environments/environment';
+const pd_key ='local_sales_PDs'
@Component({
selector: 'app-pd-list',
templateUrl: './pd-list.component.html',
@@ -7,8 +15,287 @@ import { Component, OnInit } from '@angular/core';
})
export class PdListComponent implements OnInit {
- constructor() { }
+ is_sales_login:boolean = false
+ common: any;
+ sales_displayValue: any=[];
+ localPDs: any = [];
+ loader_access:any=true
+ findListIndex: any;
+ filterMsg: boolean = false;
+ apiurl: any
+ filter_drop_down_data: any;
+ visibleItems: any[] = []; // Items to display in the current view
+ itemsPerView = 10; // Number of items to display at a time
+ startIndex = 0; // Start index of the visible range
+
+ constructor(public Menu:MenuController,public aws:AuthService,public actionSheetCtrl: ActionSheetController,public navCtrl: NavController,private toastProvider:ToastService,private loaderProvider:LoadingService,private modalCtrl:ModalController,
+ private ionicStorageService:IonicStorageService,public salesPDService:SalesPdService) {
+
+ let userDetails:any = localStorage.getItem('user_details');
+ console.log('userdetails');
+ console.log(userDetails);
+ let role= this.aws.takeDecisionRouting(JSON.parse(userDetails))
+ if(role == 'sales'){
+ this.is_sales_login = true
+ }
+ else {
+ this.is_sales_login = false
+ }
+
+ }
ngOnInit() {}
+
+
+
+ ionViewWillEnter() {
+ console.log('ionViewWillEnter SalesPDlistPage');
+ setTimeout(() => {
+ let commonData:any = localStorage.getItem('commonSettings')
+ this.common = JSON.parse(commonData);
+ if (this.common) {
+ this.common = this.common.default_pd_list_count;
+ this.common = this.common.count + ' ' + this.common.factor;
+ }
+ }, 300);
+ // this.cameraProvider.checkGPSPermission();
+ // this.salesPDService.clearLocalData();
+ }
+
+ ionViewDidEnter() {
+ this.Menu.enable(false);
+ this.getListofPD();
+ }
+
+ ionViewWillLeave(){
+ this.Menu.enable(true);
+ }
+
+
+ doRefresh(event: CustomEvent) {
+ console.log('refresh', event);
+ this.getListofPD();
+ setTimeout(() => {
+ // console.log('Async operation has ended');
+ event.detail.complete();
+ }, 1000);
+ }
+
+ getListofLocalPD() {
+ return this.ionicStorageService.getLocalDataWithFilter(pd_key, { name: 'local_pd_id', type: 'filter', value: null })
+ .then(result => {
+ console.log(result, this.sales_displayValue);
+ if (result && result.length > 0) {
+ const result_val = result;
+ result_val.sort((a:any, b:any) => 0 - (a > b ? -1 : 1));
+ this.localPDs = result_val;
+ this.sales_displayValue.unshift(...this.localPDs);
+ }
+ this.loader_access = false;
+ })
+ .catch(err => {
+ this.loader_access = false;
+ });
+ }
+
+
+ getListofPD() {
+ return this.ionicStorageService.getLocalDataWithFilter(pd_key, { name: 'sales_pd_id', type: 'filter', value: null })
+ .then(local_res => {
+ console.log('local_res');
+ this.salesPDService.getSalesPDList(this.is_sales_login)
+ .subscribe(res => {
+ if (res.dataStatus) {
+ this.sales_displayValue = res.records;
+
+ console.log(this.sales_displayValue);
+
+ let user1:any = localStorage.getItem('user_details');
+ let user = JSON.parse(user1);
+
+ if (local_res && local_res.length > 0) {
+
+ local_res.forEach((local_obj:any) => {
+ if (local_obj && local_obj.sales_pd_id && local_obj.sales_pd_id !== null) {
+ console.log(local_obj);
+ this.findListIndex = this.sales_displayValue.findIndex((val:any) => val.sales_pd_id === local_obj.sales_pd_id);
+ if (this.sales_displayValue[this.findListIndex]) {
+ this.sales_displayValue[this.findListIndex].is_pd_synced = local_obj.is_pd_synced;
+ this.sales_displayValue[this.findListIndex].is_all_section_synced = local_obj.is_all_section_synced;
+ this.sales_displayValue[this.findListIndex].is_pd_completed = local_obj.is_pd_completed;
+ this.sales_displayValue[this.findListIndex].is_pd_completed_sync = local_obj.is_pd_completed_sync;
+ if (local_obj.hasOwnProperty('status') && local_obj.status) {
+ this.sales_displayValue[this.findListIndex].status = local_obj.status;
+ }
+ }
+ }
+ });
+ }
+
+ if (this.sales_displayValue.length > 0) {
+ 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);
+ this.apiurl = environment
+ 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';
+ }
+ console.log(link);
+ let PDID = val.sales_pd_sno;
+ 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 {
+ products.push(val.product_id);
+ }
+ if (lenders.length > 0) {
+ if (lenders.filter((pro:any) => pro === val.lender_id).length === 0) {
+ lenders.push(val.lender_id);
+ }
+ } else {
+ lenders.push(val.lender_id);
+ }
+ 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);
+ }
+ });
+ this.filter_drop_down_data = { product_ids: products, lender_ids: lenders, pd_status: pd_status };
+ console.log(this.sales_displayValue);
+ }
+ this.getListofLocalPD();
+ } else {
+ this.loader_access = false;
+ this.sales_displayValue = [];
+ this.getListofLocalPD();
+ }
+ }, err => {
+ console.log('Error', err);
+ this.loader_access = false;
+ });
+ });
+ }
+
+ newForm(){
+ this.salesPDService.clear_local_key('sales_pd_id_PRIMARYKEY');
+ localStorage.removeItem('product_id_salesPD')
+ localStorage.removeItem('sales_pd_type')
+ // this.navCtrl.push(HomePage)
+ }
+
+ editForm(valueObj: any) {
+ let primaryKey = 'sales_pd_id';
+
+ if (valueObj.local_pd_id !== null && valueObj.sales_pd_id === null && valueObj.is_pd_synced === false) {
+ primaryKey = 'local_pd_id';
+ }
+
+ this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY', valueObj[primaryKey]).then(() => {
+ this.salesPDService.insertData_Replace('sales_rand_string', valueObj['rand_string']).then(() => {
+ localStorage.setItem('product_id_salesPD', valueObj.product_id);
+
+ if (!valueObj.hasOwnProperty('sales_pd_type') && !valueObj.sales_pd_type) {
+ valueObj.sales_pd_type = '1';
+ }
+
+ localStorage.setItem('sales_pd_type', valueObj.sales_pd_type);
+
+ this.navCtrl.navigateForward('/section-list', {
+ queryParams: {
+ product_id: valueObj.product_id,
+ sales_pd_type: valueObj.sales_pd_type,
+ link: valueObj.link,
+ },
+ });
+ });
+ });
+ }
+
+ presentActionSheet(value_obj:any) {
+ let buttons = [
+ {
+ text: 'View Report',
+ icon: 'eye',
+ role: 'destructive',
+ handler: () => {
+ // this.salesPDpdf(value_obj.sales_pd_id);
+ }
+ },
+ {
+ text: 'Cancel',
+ role: 'cancel',
+ icon: 'arrow-round-back',
+ handler: () => {
+ console.log('Cancel clicked');
+ }
+ }
+ ];
+
+ let actionSheet:any = this.actionSheetCtrl.create({
+ buttons: buttons
+ });
+
+ actionSheet.present();
+ }
+
+ // salesPDpdf(pdfdetail:any){
+ // this.loaderProvider.pdloader("Processing..")
+ // this.salesPDService.getSalesPdpdf(pdfdetail)
+ // .subscribe(data => {
+ // if (data.status == 200) {
+ // let profileModal:any = this.modalCtrl.create(ReportViewer,{'report_link':data.records});
+ // profileModal.present();
+
+ // }
+ // this.loaderProvider.dismissLoader();
+ // },err=>{
+ // this.loaderProvider.dismissLoader()
+ // console.log(err);
+ // let profileModal = this.modalCtrl.create(ReportViewer,{'error_msg':'Please check your internet connection to view PD reports. They are available only if you are connected.'});
+ // profileModal.present();
+ // }
+ // );
+ // }
+
+
+ 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');
+ }
+
}
diff --git a/src/app/pages/providers/sales-pd/sales-pd.service.spec.ts b/src/app/pages/providers/sales-pd/sales-pd.service.spec.ts
new file mode 100644
index 0000000..91906bf
--- /dev/null
+++ b/src/app/pages/providers/sales-pd/sales-pd.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SalesPdService } from './sales-pd.service';
+
+describe('SalesPdService', () => {
+ let service: SalesPdService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(SalesPdService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/providers/sales-pd/sales-pd.service.ts b/src/app/pages/providers/sales-pd/sales-pd.service.ts
new file mode 100644
index 0000000..510dd70
--- /dev/null
+++ b/src/app/pages/providers/sales-pd/sales-pd.service.ts
@@ -0,0 +1,119 @@
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { Observable, forkJoin, tap } from 'rxjs';
+import { environment } from 'src/environments/environment';
+import { IonicStorageService } from 'src/providers/ionic-storage/ionic-storage.service';
+import { Storage } from '@ionic/storage-angular'
+
+
+@Injectable({
+ providedIn: 'root'
+})
+export class SalesPdService {
+ private apiUrl = environment.url
+ constructor(public http: HttpClient, private ionicStorageProvider:IonicStorageService,private storage: Storage) { }
+
+ getSalesPDList(isSalesLogin: boolean): Observable
{
+ let userDetails:any = localStorage.getItem('user_details')
+ const det = JSON.parse(userDetails);
+ const params = { fk_entity_id: det.fk_entity_id, userid: det.userid };
+
+ // if (this.networkProvider.getCurrentNetworkStatus() === ConnectionStatus.online) {
+ let complete_url = this.apiUrl + 'listSalesPD/' + det.fk_entity_id;
+ if (isSalesLogin) {
+ complete_url = complete_url+'/'+det.userid+'/'+det.user_role;
+ }
+ const options = { params: new HttpParams({ fromObject: params }) };
+
+ return this.http.get(complete_url, options).pipe(
+ tap((res: any) => {
+ this.ionicStorageProvider.checkAndInsertApiDataLocally(res, params, 'listSalesPD');
+ })
+ );
+ // } else {
+ return this.ionicStorageProvider.getApiDataFromLocally(params, 'listSalesPD');
+ // }
+ }
+
+ insertData_Replace(key:any,data:any){
+ // console.log(key)
+ return this.storage.set(key,data);
+ }
+
+ getSalesPdpdf(pdfdetail:any): Observable {
+ return this.http.get(this.apiUrl + "downloadSalesPDReport/" + pdfdetail)
+ }
+
+ getAllMasterDatas(TableName: string): Observable {
+ let params = { "master_name": TableName }
+ return new Observable((observer:any)=>{
+ // if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
+ return this.http.post(this.apiUrl + 'getListOfMaster', { "master_name": TableName }).subscribe(result=>{
+ return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,'getListOfMaster',true).then(rr=>{
+ observer.next(result);
+ observer.complete();
+ })
+ })
+ // }
+ // else {
+ // return this.ionicStorageProvider.getApiDataFromLocally(params,'getListOfMaster').subscribe(result=>{
+ // observer.next(result);
+ // observer.complete();
+ // })
+ // }
+ })
+}
+
+getCityPincode(value:any){
+ let params={records:{state_id:value}}
+ return new Observable((observer:any)=>{
+ // if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
+ return this.http.post(this.apiUrl+"getListOfStatesAndCities",params).subscribe(result=>{
+ return this.ionicStorageProvider.checkAndInsertApiDataLocally(result,params,'getListOfStatesAndCities',true).then(res=>{
+ observer.next(result);
+ observer.complete();
+ })
+ })
+ // }
+ // else {
+ // return this.ionicStorageProvider.getApiDataFromLocally(params,'getListOfStatesAndCities').subscribe(result=>{
+ // observer.next(result);
+ // observer.complete();
+ // })
+ // }
+})
+}
+
+callMultipleApisForTemplate(product_arr:any) {
+ let users:any=localStorage.getItem('user_details')
+ users=JSON.parse(users)
+ let arr_call = []
+ for(let val of product_arr) {
+ let params1 = {records:{lender_id:users.fk_entity_id,product_id:val.product_id,sales_pd_type:'1'}}
+ let params2 = {records:{lender_id:users.fk_entity_id,product_id:val.product_id,sales_pd_type:'2'}}
+ let api1= this.http.post(this.apiUrl+'loadSalesPDTemplate',params1)
+ let api2= this.http.post(this.apiUrl+'loadSalesPDTemplate',params2)
+ arr_call.push(api1)
+ arr_call.push(api2)
+ }
+ forkJoin(arr_call).subscribe((res:any)=>{
+ console.log("rrsadfsadf",res)
+ res.forEach((val:any)=>{
+ if(val['dataStatus']) {
+ let params = {records:{lender_id:val.records.lender_id,product_id:val.records.product_id,sales_pd_type:val.records.sales_pd_type}}
+ // this.ionicStorageProvider.checkAndInsertApiDataLocally(val,params,'loadSalesPDTemplate',true).then(rr=>)
+ val.params = params
+ }
+ })
+ console.log("final lksdjfl asdf", res);
+ this.ionicStorageProvider.insertDataWithReplace('loadSalesPDTemplate',res).then(rr=>{})
+ })
+
+}
+
+clear_local_key(key:any){
+ return this.storage.remove(key)
+}
+
+
+}
diff --git a/src/assets/fonts/Roboto-Black.ttf b/src/assets/fonts/Roboto-Black.ttf
new file mode 100755
index 0000000..689fe5c
Binary files /dev/null and b/src/assets/fonts/Roboto-Black.ttf differ
diff --git a/src/assets/fonts/Roboto-BlackItalic.ttf b/src/assets/fonts/Roboto-BlackItalic.ttf
new file mode 100755
index 0000000..0b4e0ee
Binary files /dev/null and b/src/assets/fonts/Roboto-BlackItalic.ttf differ
diff --git a/src/assets/fonts/Roboto-Bold.ttf b/src/assets/fonts/Roboto-Bold.ttf
new file mode 100755
index 0000000..d3f01ad
Binary files /dev/null and b/src/assets/fonts/Roboto-Bold.ttf differ
diff --git a/src/assets/fonts/Roboto-BoldItalic.ttf b/src/assets/fonts/Roboto-BoldItalic.ttf
new file mode 100755
index 0000000..41cc1e7
Binary files /dev/null and b/src/assets/fonts/Roboto-BoldItalic.ttf differ
diff --git a/src/assets/fonts/Roboto-Italic.ttf b/src/assets/fonts/Roboto-Italic.ttf
new file mode 100755
index 0000000..6a1cee5
Binary files /dev/null and b/src/assets/fonts/Roboto-Italic.ttf differ
diff --git a/src/assets/fonts/Roboto-Light.ttf b/src/assets/fonts/Roboto-Light.ttf
new file mode 100755
index 0000000..219063a
Binary files /dev/null and b/src/assets/fonts/Roboto-Light.ttf differ
diff --git a/src/assets/fonts/Roboto-LightItalic.ttf b/src/assets/fonts/Roboto-LightItalic.ttf
new file mode 100755
index 0000000..0e81e87
Binary files /dev/null and b/src/assets/fonts/Roboto-LightItalic.ttf differ
diff --git a/src/assets/fonts/Roboto-Medium.ttf b/src/assets/fonts/Roboto-Medium.ttf
new file mode 100755
index 0000000..1a7f3b0
Binary files /dev/null and b/src/assets/fonts/Roboto-Medium.ttf differ
diff --git a/src/assets/fonts/Roboto-MediumItalic.ttf b/src/assets/fonts/Roboto-MediumItalic.ttf
new file mode 100755
index 0000000..0030295
Binary files /dev/null and b/src/assets/fonts/Roboto-MediumItalic.ttf differ
diff --git a/src/assets/fonts/Roboto-Regular.ttf b/src/assets/fonts/Roboto-Regular.ttf
new file mode 100755
index 0000000..2c97eea
Binary files /dev/null and b/src/assets/fonts/Roboto-Regular.ttf differ
diff --git a/src/assets/fonts/Roboto-Thin.ttf b/src/assets/fonts/Roboto-Thin.ttf
new file mode 100755
index 0000000..b74a4fd
Binary files /dev/null and b/src/assets/fonts/Roboto-Thin.ttf differ
diff --git a/src/assets/fonts/Roboto-ThinItalic.ttf b/src/assets/fonts/Roboto-ThinItalic.ttf
new file mode 100755
index 0000000..dd0ddb8
Binary files /dev/null and b/src/assets/fonts/Roboto-ThinItalic.ttf differ
diff --git a/src/global.scss b/src/global.scss
index dc7dfe1..7a49bef 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -25,3 +25,12 @@
@import "@ionic/angular/css/text-alignment.css";
@import "@ionic/angular/css/text-transformation.css";
@import "@ionic/angular/css/flex-utils.css";
+
+
+
+// ion-content {
+// --padding-start: 16px; // Adjust as needed
+// --padding-end: 16px; // Adjust as needed
+// --padding-top: 16px; // Adjust as needed
+// --padding-bottom: 16px; // Adjust as needed
+// }
\ No newline at end of file
diff --git a/src/providers/_guard/req-token.interceptor.spec.ts b/src/providers/_guard/req-token.interceptor.spec.ts
new file mode 100644
index 0000000..0447d93
--- /dev/null
+++ b/src/providers/_guard/req-token.interceptor.spec.ts
@@ -0,0 +1,17 @@
+import { TestBed } from '@angular/core/testing';
+
+import { ReqTokenInterceptor } from './req-token.interceptor';
+
+describe('ReqTokenInterceptor', () => {
+ beforeEach(() => TestBed.configureTestingModule({
+ providers: [
+ ReqTokenInterceptor
+ ]
+ }));
+
+ it('should be created', () => {
+ console.log("fuck u");
+ const interceptor: ReqTokenInterceptor = TestBed.inject(ReqTokenInterceptor);
+ expect(interceptor).toBeTruthy();
+ });
+});
diff --git a/src/providers/_guard/req-token.interceptor.ts b/src/providers/_guard/req-token.interceptor.ts
new file mode 100644
index 0000000..2c82f54
--- /dev/null
+++ b/src/providers/_guard/req-token.interceptor.ts
@@ -0,0 +1,105 @@
+import { Injectable, Injector } from '@angular/core';
+import {
+ HttpRequest,
+ HttpHandler,
+ HttpEvent,
+ HttpInterceptor,
+ HttpErrorResponse,
+} from '@angular/common/http';
+import { Observable, BehaviorSubject, throwError } from 'rxjs';
+import { catchError, switchMap } from 'rxjs/operators';
+import { NavController } from '@ionic/angular'; // Import NavController from Ionic
+import { environment } from 'src/environments/environment';
+import { CognitoService } from 'src/app/authencation/auth-service/cognito.service';
+import { AuthService } from 'src/app/authencation/auth-service/auth.service';
+import { ToastService } from '../common-provider/toast.service';
+
+@Injectable()
+export class ReqTokenInterceptor implements HttpInterceptor {
+
+ private env = environment
+
+ constructor(public injector: Injector) {}
+
+ isRefreshingToken: boolean = false;
+ tokenSubject: BehaviorSubject = new BehaviorSubject('');
+
+ addToken(req: HttpRequest, token: string): HttpRequest {
+ return req.clone({
+ setHeaders: {
+ 'Authorization': this.env.authorization, // Replace with your authorization header
+ 'Token': token,
+ 'From': '2',
+ },
+ });
+ }
+
+ intercept(req: HttpRequest,next: HttpHandler): Observable> {
+ const cognitoService = this.injector.get(CognitoService);
+ console.log(cognitoService)
+ let token = cognitoService.getToken() || '';
+ console.log(token)
+ console.log('Token From Interceptor >>', cognitoService.getToken());
+ // if (token !== '') {
+ // token = token.getIdToken().getJwtToken();
+ // }
+ // console.log(token)
+ return next.handle(this.addToken(req, token)).pipe(
+ catchError((error) => {
+ if (error instanceof HttpErrorResponse) {
+ if (error.status === 401 && error.error.error.toLowerCase() === 'invalid token!') {
+ return this.handle401Error(req, next, error);
+ } else {
+ return throwError(error);
+ }
+ } else {
+ console.log('Observable error');
+ return throwError(error);
+ }
+ })
+ );
+ }
+
+ handle401Error(req: HttpRequest, next: HttpHandler, err: HttpErrorResponse): Observable {
+ console.log('err', err);
+ const cognitoService = this.injector.get(CognitoService);
+ console.log('entered', this.isRefreshingToken, this.tokenSubject);
+
+ if (err.status === 401 && err.error.error.toLowerCase() === 'invalid token!') {
+ if (!this.isRefreshingToken) {
+ this.isRefreshingToken = true;
+ this.tokenSubject.next('');
+ return cognitoService.refresh().pipe(
+ switchMap((newToken: string) => {
+ if (newToken) {
+ this.isRefreshingToken = false;
+ this.tokenSubject.next(newToken);
+ return next.handle(this.addToken(req, cognitoService.getToken().getIdToken().getJwtToken()));
+ }
+ const awsService = this.injector.get(AuthService);
+ return awsService.logout();
+ })
+ );
+ } else {
+ console.log('Else Part 1201');
+ return next.handle(this.addToken(req, cognitoService.getToken().getIdToken().getJwtToken()));
+ }
+ } else {
+ return this.handleError('', err);
+ }
+ }
+
+ private handleError(operation = 'operation', error?: HttpErrorResponse): Observable> {
+ console.log('Error: ', error);
+ if (error && error.status === 401) {
+ localStorage.clear();
+ const navCtrl = this.injector.get(NavController);
+ navCtrl.navigateRoot('LoginPage'); // Use the correct route to navigate to the login page
+ } else {
+ const toastProvider = this.injector.get(ToastService);
+ toastProvider.lenderappmessage('Network Error');
+ }
+
+ return throwError(error);
+ }
+}
diff --git a/src/providers/ionic-storage/ionic-storage.service.ts b/src/providers/ionic-storage/ionic-storage.service.ts
index c029249..f4a7cdf 100644
--- a/src/providers/ionic-storage/ionic-storage.service.ts
+++ b/src/providers/ionic-storage/ionic-storage.service.ts
@@ -7,7 +7,9 @@ import { Observable, Observer } from 'rxjs';
})
export class IonicStorageService {
- constructor(private ionicStorage: Storage) { }
+ constructor(private ionicStorage: Storage) {
+ this.ionicStorage.create();
+ }
insertDataWithReplace(key: any, value: any): Promise {
return this.ionicStorage.set(key, value);
@@ -137,5 +139,6 @@ export class IonicStorageService {
// return ''
})
}
+
}
diff --git a/src/providers/pdtrigger/pdtrigger.service.ts b/src/providers/pdtrigger/pdtrigger.service.ts
index 5166acf..b00a2b3 100644
--- a/src/providers/pdtrigger/pdtrigger.service.ts
+++ b/src/providers/pdtrigger/pdtrigger.service.ts
@@ -2,32 +2,33 @@ import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { LoadingService } from '../common-provider/loading.service';
import { HttpClient } from '@angular/common/http';
-import { of, switchMap } from 'rxjs';
+import { Observable, map, of, switchMap } from 'rxjs';
import { IonicStorageService } from '../ionic-storage/ionic-storage.service';
+import { SalesPdService } from 'src/app/pages/providers/sales-pd/sales-pd.service';
@Injectable({
providedIn: 'root'
})
export class PdtriggerService {
private apiUrl = environment.url;
- constructor(public http: HttpClient,private loadingProvider:LoadingService,private storage:IonicStorageService) { }
+ constructor(public http: HttpClient,private loadingProvider:LoadingService,private ionicStorageProvider:IonicStorageService,private salesPDProvider:SalesPdService) { }
initiateMasterApis(type:any) {
if(type == 'sales') {
- this.loadingProvider.pdloader('')
+ // this.loadingProvider.pdloader('')
let lender_id:any=localStorage.getItem("user_details")
lender_id=JSON.parse(lender_id).fk_entity_id;
// HARD CODED API PARAMS
- // this.salesPDProvider.getAllMasterDatas('STATE').subscribe(res=>{
- // // FOR MEQ PRODUCTS MASTER API
- // // this.salesPDProvider.getAllMasterDatas('BUSINESSENTITYTYPE').subscribe(res=>{
- // this.salesPDProvider.getAllMasterDatas('COMPANYRELATIONSHIPS').subscribe(res=>{
- // this.salesPDProvider.getAllMasterDatas('SALESEQUIPMENTLIST').subscribe(res=>{
- // this.salesPDProvider.getAllMasterDatas('SALESVENDORLIST').subscribe(res=>{})
- // })
- // })
- // // })
+ this.salesPDProvider.getAllMasterDatas('STATE').subscribe(res=>{
+ // FOR MEQ /PRODUCTS MASTER API
+ // this.salesPDProvider.getAllMasterDatas('BUSINESSENTITYTYPE').subscribe(res=>{
+ this.salesPDProvider.getAllMasterDatas('COMPANYRELATIONSHIPS').subscribe(res=>{
+ this.salesPDProvider.getAllMasterDatas('SALESEQUIPMENTLIST').subscribe(res=>{
+ this.salesPDProvider.getAllMasterDatas('SALESVENDORLIST').subscribe(res=>{})
+ })
+ })
// })
+ })
// SALES PD TEMPLATE FOR WCTL AND LFMP
// this.salesPDProvider.getData('8','1').subscribe(res=>{
// this.salesPDProvider.getData('9','1').subscribe(res=>{
@@ -41,33 +42,45 @@ export class PdtriggerService {
// })
// })
//SALES PD PRODUCTS LIST FOR LENDER MWISE
- // this.getEntityPreferences(lender_id).subscribe(res=>{
- // if(res.dataStatus && res.records && res.records.salespd_products && res.records.salespd_products.length > 0) {
- // // SALES PD TEMPLATE FOR WCTL AND LFMP
- // // this.salesPDProvider.callMultipleApisForTemplate(res.records.salespd_products)
- // }
- // })
- // GETTING CITY AND PINCODE FOR SOME STATES
- // this.salesPDProvider.getCityPincode('5').subscribe(res=>{
- // this.salesPDProvider.getCityPincode('6').subscribe(res=>{
- // this.salesPDProvider.getCityPincode('15').subscribe(res=>{
- // this.salesPDProvider.getCityPincode('27').subscribe(res=>{
- // this.salesPDProvider.getCityPincode('26').subscribe(res=>{
- // this.loadingProvider.dismissLoader();
- // })
- // })
- // })
- // })
- // })
+ this.getEntityPreferences(lender_id).subscribe(res=>{
+ if(res.dataStatus && res.records && res.records.salespd_products && res.records.salespd_products.length > 0) {
+ // SALES PD TEMPLATE FOR WCTL AND LFMP
+ this.salesPDProvider.callMultipleApisForTemplate(res.records.salespd_products)
+ }
+ })
+ //GETTING CITY AND PINCODE FOR SOME STATES
+ this.salesPDProvider.getCityPincode('5').subscribe(res=>{
+ this.salesPDProvider.getCityPincode('6').subscribe(res=>{
+ this.salesPDProvider.getCityPincode('15').subscribe(res=>{
+ this.salesPDProvider.getCityPincode('27').subscribe(res=>{
+ this.salesPDProvider.getCityPincode('26').subscribe(res=>{
+ // this.loadingProvider.dismissLoader();
+ })
+ })
+ })
+ })
+ })
}
}
+ getEntityPreferences(entity_id: any): Observable {
+ const params = { entity_id: entity_id };
+ return this.http.get(`${this.apiUrl}getEntityPreferences/${entity_id}`)
+ .pipe(
+ map((result: any) => {
+ this.ionicStorageProvider.checkAndInsertApiDataLocally(result, params, 'getEntityPreferences');
+ return result;
+ })
+ );
+ }
+
+
getCommonSettingsConfig()
{
// if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) {
return this.http.post(this.apiUrl + 'getCommonConfig', '').pipe(
switchMap((result) => {
- this.storage.checkAndInsertApiDataLocally(result, null, 'getCommonConfig');
+ this.ionicStorageProvider.checkAndInsertApiDataLocally(result, null, 'getCommonConfig');
return of(result);
})
);
diff --git a/src/theme/filter-modal.scss b/src/theme/filter-modal.scss
new file mode 100644
index 0000000..2466134
--- /dev/null
+++ b/src/theme/filter-modal.scss
@@ -0,0 +1,76 @@
+.filterModal{
+ padding: 6.4%;
+ // padding: 30px;
+ background-color: rgba(0, 0, 0, 0.56);
+ // padding: 30px;
+ color:red;
+ // filter:blur(5px);
+ //color:lightcyan;
+ // background-color:gray;
+ .modal-wrapper {
+ // border-radius: 7px;
+ // background: rgba(0, 0, 0, 0.5);
+ // color: gray;
+
+ height: 80% !important;
+ width:100% !important;
+ // margin-top: 13.5%;
+ border-radius: 10px;
+ margin-top:10%;
+
+ mat-card{
+ // background-color:rgb(252, 252, 161);
+ background-color:white;
+ box-shadow: 2px 2px lavender;
+ border-radius: 5px;
+ min-height: 13em;
+ // height: 16.5em;
+ max-height: 16.5em;
+ border:1px solid lavender;
+ }
+ .mat-card-title{
+
+ font-weight: bold;
+ font-size: 16px;
+ color:#e2412f;
+ }
+ mat-card-content{
+ margin-left: 4%;
+ }
+ ion-item{
+ // background-color:rgb(252, 252, 161);
+ background-color: lightcyan;
+ }
+ // margin-right: 15%;
+
+ button{
+ font-size: 12px;
+ // height: 40px;
+ color:#e2412f;
+ // margin-bottom: 10px;
+ position: relative;
+ bottom:0.5em;
+ }
+ // input{
+ // // border:1px solid blueviolet;
+ // }
+ mat-form-field{
+ width: 100%;
+ margin-top: 3%;
+ }
+ mat-radio-button{
+ margin-top: 2%;
+ }
+
+
+ }
+
+ }
+
+
+ .small-popup-modal {
+ --width: 80% !important; /* Adjust as needed */
+ --height: 50% !important; /* Adjust as needed */
+ --max-width: 300px !important; /* Maximum width */
+ --max-height: 400px !important; /* Maximum height */
+}
\ No newline at end of file
diff --git a/src/theme/variables.scss b/src/theme/variables.scss
index 9e7b06c..84bbe62 100644
--- a/src/theme/variables.scss
+++ b/src/theme/variables.scss
@@ -197,13 +197,13 @@
*/
.md body {
- --ion-background-color: #ffffff;
+ --ion-background-color: #ccc;
--ion-background-color-rgb: 18,18,18;
--ion-text-color: #ffffff;
--ion-text-color-rgb: 255,255,255;
- --ion-border-color: #222222;
+ --ion-border-color: #ffffff;
--ion-color-step-50: #1e1e1e;
--ion-color-step-100: #2a2a2a;
@@ -225,11 +225,11 @@
--ion-color-step-900: #e7e7e7;
--ion-color-step-950: #f3f3f3;
- --ion-item-background: #1e1e1e;
+ --ion-item-background: #ffffff;
- --ion-toolbar-background: #1f1f1f;
+ --ion-toolbar-background: #ff0000;
- --ion-tab-bar-background: #1f1f1f;
+ --ion-tab-bar-background: #ff0000;
--ion-card-background: #1e1e1e;
}