Loader issue fix
This commit is contained in:
parent
1ecbc0c1b6
commit
f4c7b2a145
@ -438,8 +438,34 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
<!-- <div *ngIf="roleID != 30">
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon> {{submit_btn ? 'Complete' : 'Save'}} </button>
|
||||
</form>
|
||||
</div>
|
||||
<div *ngIf="roleID == 30">
|
||||
<div *ngIf="local_ques_JSON.section_id != '9' && pdstatus != 'COMPLETED'">
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon> {{submit_btn ? 'Complete' : 'Save'}} </button>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div *ngIf="roleID == 30">
|
||||
<div *ngIf="local_ques_JSON.section_id != 9">
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon> {{submit_btn ? 'Complete' : 'Save'}} </button>
|
||||
</div>
|
||||
<div *ngIf="local_ques_JSON.section_id == 9 && pdstatus != 'COMPLETED'">
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon> {{submit_btn ? 'Complete' : 'Save'}} </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div *ngIf="roleID != 30">
|
||||
<button style="float: right;" type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button color="warn" matTooltip="Submit"
|
||||
matTooltipPosition="above" (click)="onSubmit(1)"><mat-icon>play_circle_filled</mat-icon> {{submit_btn ? 'Complete' : 'Save'}} </button>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@ -80,6 +80,8 @@ export class QuesTemplateComponent {
|
||||
image_question_name:any =[]
|
||||
tmp_control: QuestionServiceService;
|
||||
tmp:any =[];
|
||||
roleID: string;
|
||||
pdstatus: string;
|
||||
constructor( private cameraService: CameraService,public dialogRef: MatDialogRef<SectionListComponent>,private route: ActivatedRoute,private router: Router,private dialog:MatDialog,private _fb:FormBuilder,private questionService:QuestionServiceService,private SalesPdService:SalesPdService,notifier: NotifierService,private loaderService:LoaderService) {
|
||||
console.log('Hello QuesTemplateComponent Component');
|
||||
this.text = 'Hello World';
|
||||
@ -87,8 +89,10 @@ export class QuesTemplateComponent {
|
||||
//this.cameraProvider.checkGPSPermission();
|
||||
//alert('abi1');
|
||||
//this.ngOnChanges()
|
||||
|
||||
}
|
||||
ngOnChanges(){
|
||||
|
||||
//alert('abi');
|
||||
this.loaderService.showMatSpinnerDialog('Fetching Data...')
|
||||
//this.loadingProvider.pdloader("Fetching Data...")
|
||||
@ -160,8 +164,16 @@ export class QuesTemplateComponent {
|
||||
}
|
||||
}
|
||||
this.sales_pd_type = localStorage.getItem('sales_pd_type')
|
||||
|
||||
}
|
||||
getSalesPDSectionFromApi(sales_pd_id){
|
||||
this.roleID = localStorage.getItem('user_role')
|
||||
console.log(this.roleID)
|
||||
let completed = localStorage.getItem('completedPD')
|
||||
let status = JSON.parse(completed)
|
||||
console.log(status)
|
||||
this.pdstatus = status.status
|
||||
console.log(this.pdstatus)
|
||||
// alert('pass');
|
||||
console.log(sales_pd_id)
|
||||
// this.loaderService.showMatSpinnerDialog('Fetching Data...')
|
||||
@ -795,7 +807,7 @@ this.proceedonChangeProperty(modified)
|
||||
};
|
||||
}
|
||||
addData(group_index, parent_index, data, event, options?: any, single_ques?) {
|
||||
console.clear();
|
||||
// console.clear();
|
||||
data=data.filter(group_indi=>!group_indi.hasOwnProperty('additional_field') && group_indi.additional_field != 1 )
|
||||
|
||||
if (options == 'camera') {
|
||||
@ -1536,7 +1548,7 @@ this.proceedonChangeProperty(modified)
|
||||
}
|
||||
// CHECKING THE SAVE IMAGE REQUEST IS STILL PENDING
|
||||
if(this.submit_btn == true && this.emittedFormGroup != null){
|
||||
console.clear();
|
||||
// console.clear();
|
||||
console.log(this.quesAnsForm.dirty);
|
||||
let form_structure=this.quesAnsForm.getRawValue().questions
|
||||
// form_structure.forEach(parent_ques=>{
|
||||
@ -1645,9 +1657,11 @@ this.proceedonChangeProperty(modified)
|
||||
// }
|
||||
}
|
||||
sendSectiontoApi(params){
|
||||
// setTimeout(()=>{
|
||||
// this.loaderService.showMatSpinnerDialog('Please wait...')
|
||||
// },1200)
|
||||
if(params.section_id != 9){
|
||||
setTimeout(()=>{
|
||||
this.loaderService.showMatSpinnerDialog('Please wait...')
|
||||
},1200)
|
||||
}
|
||||
// alert('lastsave');
|
||||
console.log('lastsave');
|
||||
console.log(params);
|
||||
@ -1672,6 +1686,7 @@ this.proceedonChangeProperty(modified)
|
||||
}
|
||||
}
|
||||
},err=>this.loaderService.closeMatSpinnerDialog())
|
||||
// this.loaderService.closeMatSpinnerDialog()
|
||||
}
|
||||
sendDatatoApi(section_data?){
|
||||
// alert('a');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatIconModule, MatInputModule, MatTableModule, MatListModule, MatToolbarModule, MatFormFieldModule, MatTabsModule, MatCardModule, MatPaginatorModule, MatButtonModule, MatExpansionModule, MatProgressBarModule, MatProgressSpinnerModule, MatDatepickerModule, MatSelectModule, MatRadioModule, MatCheckboxModule, MatTooltipModule } from '@angular/material';
|
||||
import { MatIconModule, MatInputModule, MatTableModule, MatListModule, MatToolbarModule, MatFormFieldModule, MatTabsModule, MatCardModule, MatPaginatorModule, MatButtonModule, MatExpansionModule, MatProgressBarModule, MatProgressSpinnerModule, MatDatepickerModule, MatSelectModule, MatRadioModule, MatCheckboxModule, MatTooltipModule, MatMenuModule } from '@angular/material';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
//import { MatTableExporterModule } from '@angular/mat-table-exporter';
|
||||
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||
@ -55,6 +55,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
MatSelectModule,
|
||||
MatIconModule,
|
||||
MatTableModule,
|
||||
MatMenuModule,
|
||||
MatListModule,
|
||||
MatTooltipModule,
|
||||
MatToolbarModule,
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
|
||||
<h2 mat-dialog-title> {{title}}</h2>
|
||||
<mat-dialog-content>
|
||||
<div fxFlex="100">
|
||||
<p align="center">
|
||||
{{question}}
|
||||
</p>
|
||||
|
||||
|
||||
<div align="center" *ngIf="option == 'location'">
|
||||
<mat-form-field appearance="outline" style="width: 100%;">
|
||||
<mat-label>Location</mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Geolocation" type="text" [formControl] = "geolocation"></textarea>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end" *ngIf="option == 'location'">
|
||||
<button mat-raised-button color="primary" (click)="submit(this.data.pdid,this.data.option)"><strong>Save</strong></button>
|
||||
<button mat-raised-button mat-dialog-close><strong> Cancel </strong></button>
|
||||
</mat-dialog-actions>
|
||||
<mat-dialog-actions align="end" *ngIf="option != 'location'">
|
||||
<button mat-raised-button color="primary" (click)="submit(this.data.pdid,this.data.option)"><strong>Yes</strong></button>
|
||||
<button mat-raised-button mat-dialog-close><strong> No </strong></button>
|
||||
</mat-dialog-actions>
|
||||
<!--<mat-dialog-actions align="end" >
|
||||
<button mat-raised-button color="primary" (click)="overwritten_pd()"
|
||||
> <strong>Complete anyway </strong></button>
|
||||
<button mat-raised-button mat-dialog-close><strong> Ok </strong></button>
|
||||
</mat-dialog-actions>-->
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ReGenerateReportComponent } from './re-generate-report.component';
|
||||
|
||||
describe('ReGenerateReportComponent', () => {
|
||||
let component: ReGenerateReportComponent;
|
||||
let fixture: ComponentFixture<ReGenerateReportComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ReGenerateReportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ReGenerateReportComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,118 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { FormControl, Validators } from '@angular/forms';
|
||||
import { SalesPdService } from 'app/sales-pd/services/sales-pd.service';
|
||||
import { LoaderService } from 'app/shared/loaderService/loader.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-re-generate-report',
|
||||
templateUrl: './re-generate-report.component.html',
|
||||
styleUrls: ['./re-generate-report.component.scss']
|
||||
})
|
||||
export class ReGenerateReportComponent implements OnInit {
|
||||
private notifier: NotifierService;
|
||||
errorMessage:any[]=[];
|
||||
option: any;
|
||||
title:any;
|
||||
question:any;
|
||||
geolocation:FormControl = new FormControl('',Validators.compose([Validators.required]))
|
||||
constructor(private loaderService:LoaderService,notifier: NotifierService,private SalesPDService:SalesPdService,private dialogRef: MatDialogRef<ReGenerateReportComponent>,@Inject(MAT_DIALOG_DATA) public data: any) { this.notifier = notifier; }
|
||||
|
||||
ngOnInit() {
|
||||
this.option=this.data.option;
|
||||
if(this.option=='report')
|
||||
{
|
||||
this.title='Re-Generate the Report';
|
||||
this.question='Do you want to Re-Generate the Report';
|
||||
}
|
||||
else if(this.option=='mail')
|
||||
{
|
||||
this.title='Re-Sent the Email'
|
||||
this.question='Do you want to Re-Sent the Email';
|
||||
}
|
||||
else
|
||||
{
|
||||
this.title='Geolocation'
|
||||
this.question='Enter the Geolocation';
|
||||
}
|
||||
}
|
||||
submit(pdid,option)
|
||||
{
|
||||
this.loaderService.showMatSpinnerDialog('Please wait...')
|
||||
if(option=='report')
|
||||
{
|
||||
this.SalesPDService.generatesalereport(pdid)
|
||||
.subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.loaderService.closeMatSpinnerDialog()
|
||||
this.dialogRef.close();
|
||||
|
||||
alert('generate report succussfully');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
}
|
||||
else if(option=='mail')
|
||||
{
|
||||
this.SalesPDService.generatemail(pdid)
|
||||
.subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.loaderService.closeMatSpinnerDialog()
|
||||
this.dialogRef.close();
|
||||
alert('mail sent succussfully');
|
||||
this.notifier.notify('error','error');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
let geolocation:any = {
|
||||
"sales_pd_id":pdid,
|
||||
"geo_location":this.geolocation.value
|
||||
};
|
||||
|
||||
|
||||
this.SalesPDService.generatesateliteimage(geolocation)
|
||||
.subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.loaderService.closeMatSpinnerDialog()
|
||||
this.dialogRef.close();
|
||||
alert('Saved succussfully');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -99,28 +99,64 @@
|
||||
<div fxFlex.xs="10" fxFlex.sm="10" fxFlex.md="12" fxFlex.lg="12" fxFlex.xl="12" class="center no-pad cell" style="justify-content:flex-end">
|
||||
<small mat-line>{{details.createdon | date: 'dd/MM/yyyy'}}</small>
|
||||
</div>
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="16.66" fxFlex.lg="16.66" fxFlex.xl="16.66" class="cell center" style="justify-content:flex-end" *ngIf="details.pd_status != 'BOUNCED' || details.fk_pd_allocated_to == user_id">
|
||||
<button style="float: right" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PDF Download" [disabled]="details.status != 'COMPLETED'"
|
||||
matTooltipPosition="top" color="primary" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button>
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
|
||||
<div fxFlex="row">
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
|
||||
<button style="float: right" mat-button mat-icon-button class="hover-icon" type="button" matTooltip="PDF Download" [disabled]="details.status != 'COMPLETED'"
|
||||
matTooltipPosition="top" color="primary" (click)="salesPDpdf(details.sales_pd_id)"><mat-icon>file_download</mat-icon></button>
|
||||
</div>
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
|
||||
<div *ngIf="roleID == 30">
|
||||
<button *ngIf="details.status == 'COMPLETED'" mat-button mat-icon-button class="hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top" style="color:rgba(0, 0, 0, 0.26) !important"><mat-icon>visibility</mat-icon></button>
|
||||
<button *ngIf="details.status == 'STARTED'" mat-button mat-icon-button class=" hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top" ><mat-icon>visibility</mat-icon></button>
|
||||
</div>
|
||||
<div *ngIf="roleID != 30">
|
||||
<button [disabled]="details.status === 'COMPLETED'" mat-button mat-icon-button class="hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top"><mat-icon>visibility</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
|
||||
<button mat-button mat-icon-button class="hover-icon" (click)="newPortal()" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
|
||||
</div>
|
||||
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
|
||||
<button *ngIf="roleID == 30" mat-button mat-icon-button class="hover-icon" type="button" matTooltip="ReGenerate"
|
||||
matTooltipPosition="above" color="primary" [matMenuTriggerFor]="menu1"><mat-icon>more_vert</mat-icon></button>
|
||||
<mat-menu #menu1="matMenu">
|
||||
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'report')">
|
||||
|
||||
<mat-icon>autorenew</mat-icon>
|
||||
<span>Re-Generate Report</span>
|
||||
</button>
|
||||
|
||||
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'location')">
|
||||
|
||||
<mat-icon>location_on</mat-icon>
|
||||
<span>Re-Generate Location</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="regeneratereport(details.sales_pd_id,'mail')">
|
||||
|
||||
<mat-icon>email</mat-icon>
|
||||
<span>Resent Mail</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <button [disabled]="((roleID===11)? false:((details.status === 'COMPLETED')?true:false))" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top"><mat-icon>visibility</mat-icon></button> -->
|
||||
<div *ngIf="roleID == 11">
|
||||
<button *ngIf="details.status == 'COMPLETED'" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top" style="color:rgba(0, 0, 0, 0.26) !important"><mat-icon>visibility</mat-icon></button>
|
||||
<button *ngIf="details.status == 'STARTED'" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top" ><mat-icon>visibility</mat-icon></button>
|
||||
</div>
|
||||
<div *ngIf="roleID != 11">
|
||||
<button [disabled]="details.status === 'COMPLETED'" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="editForm(details)"
|
||||
matTooltip="View" matTooltipPosition="top"><mat-icon>visibility</mat-icon></button>
|
||||
</div>
|
||||
|
||||
<!-- <a href={{link}} target={{link}}> -->
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="newPortal()" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
|
||||
|
||||
<!-- </a> -->
|
||||
<!-- <button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" color="primary" (click)="viewPD(details.is_child == 0 ? details.pd_id : details.parent_pd_id,details.random_string)"
|
||||
matTooltip="View" matTooltipPosition="above">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
</button> -->
|
||||
</button> -->
|
||||
<!-- <mat-cell class="cell" fxFlex.xs="10" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="10" style="justify-content: flex-start"> -->
|
||||
|
||||
<!-- </mat-cell> -->
|
||||
</div>
|
||||
<mat-divider></mat-divider>
|
||||
</div>
|
||||
|
||||
@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SalesPdService } from '../services/sales-pd.service';
|
||||
import { ConstantsProvider } from 'app/providers/constants/constants';
|
||||
import { LoaderService } from 'app/shared/loaderService/loader.service';
|
||||
import { ReGenerateReportComponent } from './re-generate-report/re-generate-report.component';
|
||||
@Component({
|
||||
selector: 'app-sales-pd',
|
||||
templateUrl: './sales-pd.component.html',
|
||||
@ -63,7 +64,7 @@ export class SalesPdComponent implements OnInit {
|
||||
this.is_sales_login = false
|
||||
this.getListofPD()
|
||||
}
|
||||
},5000)
|
||||
},4000)
|
||||
|
||||
setTimeout(()=>{
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings'))
|
||||
@ -227,6 +228,8 @@ editForm(value_obj){
|
||||
// alert('abc');
|
||||
console.log('value');
|
||||
console.log(value_obj);
|
||||
let campletedCase = JSON.stringify(value_obj)
|
||||
localStorage.setItem('completedPD',campletedCase)
|
||||
// let product= localStorage.getItem('product_id_salesPD')
|
||||
// storing the sales_pd_id and product id in local storagey
|
||||
let primary_key= 'sales_pd_id'
|
||||
@ -349,6 +352,21 @@ editForm(value_obj){
|
||||
console.log(this.finallink)
|
||||
window.open(this.finallink);
|
||||
}
|
||||
regeneratereport(data,option)
|
||||
{
|
||||
|
||||
const dialogRef = this.dialog.open(ReGenerateReportComponent,{
|
||||
data: {pdid: data,option: option},
|
||||
disableClose: true,
|
||||
minWidth: '30%',
|
||||
maxWidth: '40%',
|
||||
|
||||
})
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
// this.viewPdDetails(this.viewID,this.masterRandomString)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -431,5 +449,7 @@ export class DialogOverviewExampleDialog {
|
||||
// // }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -20,18 +20,22 @@ import { CaptureBtnComponent } from './components/ques-template/capture-btn/capt
|
||||
import { SingleCaptureBtnComponent } from './components/ques-template/single-capture-btn/single-capture-btn.component';
|
||||
import { HomePageModule } from './home/home.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ReGenerateReportComponent } from './sales-pd-list/re-generate-report/re-generate-report.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
SalesPdRoutingModule,
|
||||
MaterialModule,
|
||||
MatMenuModule,
|
||||
SharedModule,
|
||||
StartPdModule,
|
||||
HomePageModule,
|
||||
CommonModule
|
||||
CommonModule,
|
||||
MatDialogModule
|
||||
],
|
||||
declarations: [AlertDialogComponent,SalesPdComponent,AdvanceFilterComponent],
|
||||
entryComponents:[AlertDialogComponent,SalesPdComponent],
|
||||
declarations: [AlertDialogComponent,SalesPdComponent,AdvanceFilterComponent, ReGenerateReportComponent],
|
||||
entryComponents:[AlertDialogComponent,SalesPdComponent,ReGenerateReportComponent],
|
||||
providers:[ConstantsProvider,{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' },{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
|
||||
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},{ provide: MatDialogRef, useValue: {} },{ provide: MAT_DIALOG_DATA, useValue: [] }]
|
||||
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},{ provide: MatDialogRef, useValue: {} },{ provide: MAT_DIALOG_DATA, useValue: [] }],
|
||||
bootstrap: [SalesPdComponent],
|
||||
})
|
||||
export class SalesPdModule { }
|
||||
|
||||
@ -26,9 +26,11 @@ export class SectionListComponent implements OnInit {
|
||||
customer_link_with_text: string;
|
||||
customer_link:string=''
|
||||
is_sync_btn: boolean = false;
|
||||
salesPdData:any[] = [];
|
||||
sales_pd_id: any;
|
||||
all_sections: any;
|
||||
config_expression: any;
|
||||
is_sales_login:boolean = false
|
||||
link: any;
|
||||
constructor(public dialogRef: MatDialogRef<SectionListComponent>,private constantProvider:ConstantsProvider,notifier: NotifierService,private dialog: MatDialog, private fb: FormBuilder, private route: ActivatedRoute,private SalesPDService:SalesPdService,
|
||||
private router: Router,private loaderService:LoaderService ) {
|
||||
@ -279,6 +281,7 @@ export class SectionListComponent implements OnInit {
|
||||
|
||||
merge_saved_status(res){
|
||||
let saved_sections=res['records'].map(val=>{return {'section_id':val.section_id , 'status':val.status,'is_synced':val.is_synced}});
|
||||
|
||||
console.log("saved",saved_sections);
|
||||
const mergeById = (a1, a2) =>
|
||||
a1.map(itm => ({
|
||||
@ -290,6 +293,28 @@ export class SectionListComponent implements OnInit {
|
||||
if(this.section_template.length > 0) {
|
||||
this.is_sync_btn = this.section_template.filter(val=>val.is_synced == false && val.section_id != 'all').length > 0
|
||||
}
|
||||
console.log('entry',saved_sections[0].section_id,saved_sections[0].status)
|
||||
if(saved_sections.length == 1){
|
||||
|
||||
if(saved_sections[0].section_id == '1' && saved_sections[0].status == '1'){
|
||||
console.log('entry')
|
||||
let userDetails = localStorage.getItem('user_details');
|
||||
console.log('userdetails');
|
||||
console.log(userDetails);
|
||||
|
||||
let role= this.constantProvider.takeDecisionRouting(JSON.parse(userDetails))
|
||||
console.log(role)
|
||||
if(role == 'sales'){
|
||||
this.is_sales_login = true
|
||||
this.getListofPD()
|
||||
}
|
||||
else {
|
||||
this.is_sales_login = false
|
||||
this.getListofPD()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// getTemplate() {
|
||||
// console.log(this.product_id,this.sales_pd_type)
|
||||
@ -475,4 +500,43 @@ copyToClipBoard(message,user_msg?) {
|
||||
this.router.navigate(['../../../list-pd'], {relativeTo: this.route});
|
||||
}
|
||||
|
||||
getListofPD() {
|
||||
// this.SalesPDService.getSalesPDList()
|
||||
// .subscribe(
|
||||
// data => {
|
||||
// if (data.status == 200) {
|
||||
|
||||
this.SalesPDService.getSalesPDList(this.is_sales_login).subscribe(res=>{
|
||||
if(res['dataStatus']){
|
||||
|
||||
let user1 = localStorage.getItem('user_details');
|
||||
let user=(JSON.parse(user1))
|
||||
// this.roleID = localStorage.getItem('user_role')
|
||||
|
||||
this.salesPdData = res['records'];
|
||||
console.log(this.salesPdData)
|
||||
console.log(this.salesPdData[0].status)
|
||||
let campletedCase = JSON.stringify(this.salesPdData[0])
|
||||
localStorage.setItem('completedPD',campletedCase)
|
||||
// this.dataLengthTab4 = res['records'].length;
|
||||
// this.dataSourceTab4.data = this.salesPdData;
|
||||
// this.recordStatus=false
|
||||
// this.limitMsg = true
|
||||
|
||||
}
|
||||
else{
|
||||
this.salesPdData=[];
|
||||
// this.dataLengthTab4= null;
|
||||
// this.recordStatus=true;
|
||||
// this.limitMsg = false
|
||||
}
|
||||
}
|
||||
// , error => this.errorMessage = <any> error);
|
||||
,error => {
|
||||
// this.errorMessage.push(error);
|
||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
alert(error.html_format);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -621,4 +621,24 @@ getCityPincode(value){
|
||||
return null;
|
||||
//return this.storage.remove(key)
|
||||
}
|
||||
|
||||
generatesalereport(params :any): Observable<any> {
|
||||
// let httpParams = new HttpParams().set('pdid', countpdid);
|
||||
// httpParams = httpParams.append('random_string',randomString);
|
||||
return this._http.get(api_url + 'regenerateSaleReport?sales_pd_id=' +params)
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
generatemail(params :any): Observable<any> {
|
||||
// let httpParams = new HttpParams().set('pdid', countpdid);
|
||||
// httpParams = httpParams.append('random_string',randomString);
|
||||
return this._http.get(api_url + 'resendSaleReportMail?sales_pd_id=' +params)
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
generatesateliteimage(param:any): Observable<any>{
|
||||
return this._http.post<any>(api_url + 'regenerateSatelliteImg',param )
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user