pd changes
This commit is contained in:
parent
6428969354
commit
c9ed6d410c
@ -134,7 +134,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Email" formControlName="email" type="email" required>
|
||||
<mat-error *ngIf="pdMain.email.hasError('required')">Email number is required.</mat-error>
|
||||
<mat-error *ngIf="pdMain.email.hasError('required')">Email is required.</mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
@ -204,7 +204,9 @@
|
||||
<input type="file" title="Browse Document" (change)="fileSelectionEvent($event,d)" formControlName="documentFile">
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<button mat-button color="accent" (click)="removeItem(d)" type="button">Remove</button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="removeItem(d)"
|
||||
(click)="loadPdListCompoent()"><mat-icon>delete</mat-icon></button>
|
||||
<!-- <button mat-button color="accent" (click)="removeItem(d)" type="button">Remove</button> -->
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</mat-card>
|
||||
@ -225,4 +227,4 @@
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
@ -70,4 +70,5 @@
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
@ -115,3 +115,4 @@
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
@ -21,7 +21,7 @@ export class EditPdMasterComponent implements OnInit {
|
||||
@Input() masterChild: any;
|
||||
@Output() loadPdView = new EventEmitter<string>();
|
||||
public _EditPDtriggerForm:FormGroup;
|
||||
public notifier: NotifierService;
|
||||
private notifier: NotifierService;
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, notifier: NotifierService,) {
|
||||
this.notifier=notifier
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
<mat-tab-group>
|
||||
<mat-tab>
|
||||
<ng-template mat-tab-label>All PD Details</ng-template>
|
||||
<mat-card-content>
|
||||
<div class="card-comment-widget">
|
||||
<mat-list *ngIf="pdList.length > 0">
|
||||
<mat-list-item *ngFor="let details of dataSource.connect() | async">
|
||||
@ -29,21 +28,21 @@
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list-item>
|
||||
<hr>
|
||||
|
||||
</mat-list>
|
||||
<mat-list *ngIf="recordStatus">
|
||||
<mat-list-item>
|
||||
<p mat-line>No Record Found ...</p>
|
||||
|
||||
</mat-list-item>
|
||||
|
||||
</mat-list>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-actions *ngIf="!recordStatus">
|
||||
<mat-paginator #paginator class="mat-elevation-z1" [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
|
||||
<mat-paginator #paginator [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
|
||||
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
|
||||
</mat-paginator>
|
||||
</mat-card-actions>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Component, ViewChild, OnInit, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
||||
import { PdTrigerService } from '../pd-service/pd-triger.service';
|
||||
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
|
||||
import { PdTrigerService } from '../pd-service/pd-triger.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-pd',
|
||||
@ -109,6 +109,9 @@ export class ListPdComponent implements OnInit {
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
}
|
||||
addPdDetails(){
|
||||
this.showParentComponent=false
|
||||
this.showEditComponent=false
|
||||
@ -149,6 +152,7 @@ export class ListPdComponent implements OnInit {
|
||||
this.pdListData = data.records;
|
||||
this.dataLength = data.records.length;
|
||||
this.dataSource.data = this.pdListData;
|
||||
this.recordStatus=false;
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{pageTitle}}</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
|
||||
<form [formGroup]="_pdAllocationForm" (submit)="onSubmit()">
|
||||
<!--<div class="form-group">-->
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<mat-select placeholder="Select Name" formControlName="allocation_id">
|
||||
<mat-option *ngFor="let ct of pdOfficerList" [value]="ct">{{ ct.categroy_name }}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="readForm.allocation_id.hasError('required')" class="mat-text-warn">Select name.</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row" style="text-align:right;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
|
||||
(click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
</form>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PdAllocationComponent } from './pd-allocation.component';
|
||||
|
||||
describe('PdAllocationComponent', () => {
|
||||
let component: PdAllocationComponent;
|
||||
let fixture: ComponentFixture<PdAllocationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PdAllocationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PdAllocationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,85 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { PdTrigerService } from '../pd-service/pd-triger.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-allocation',
|
||||
templateUrl: './pd-allocation.component.html',
|
||||
styleUrls: ['./pd-allocation.component.scss']
|
||||
})
|
||||
export class PdAllocationComponent implements OnInit {
|
||||
public pageTitle: string = "PD Allocation To";
|
||||
public _pdAllocationForm: FormGroup;
|
||||
public pdOfficerList: any = [];
|
||||
errorMessage: any;
|
||||
notifier : NotifierService;
|
||||
constructor( notifier: NotifierService,
|
||||
private _fb: FormBuilder,
|
||||
private dialogRef: MatDialogRef<PdAllocationComponent>,
|
||||
private _pd: PdTrigerService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.notifier=notifier;
|
||||
console.log(this.data)
|
||||
this.getPDOfficerList();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._pdAllocationForm = this._fb.group({
|
||||
pd_primary_id: [null],
|
||||
allocation_id: [null, Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
|
||||
// convenience getter for easy access to form fields
|
||||
get readForm() { return this._pdAllocationForm.controls; }
|
||||
|
||||
// pd officer list
|
||||
getPDOfficerList(){
|
||||
this._pd.getPdOfficerList().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.pdOfficerList=data.records.pd_master_details;
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
|
||||
}
|
||||
/** To Save/Edited Popup Data */
|
||||
onSubmit() {
|
||||
// stop here if form is invalid
|
||||
if (this._pdAllocationForm.invalid) {
|
||||
this.errorMessage = "Please Fill All Mandate Fields.";
|
||||
return;
|
||||
} else {
|
||||
var updateData = this._pdAllocationForm.value;
|
||||
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(updateData).forEach((key) => (updateData[key] == null) && delete updateData[key]);
|
||||
|
||||
//Add BRANCH data with help Service File
|
||||
this._pd.updatePdOfficer(updateData).subscribe(
|
||||
result => {
|
||||
if (result.status == 200) {
|
||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||
this.dialogRef.close();
|
||||
}
|
||||
else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
this.errorMessage = "Something Wents Wrong Try Again.!";
|
||||
}
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||
this.dialogRef.close();
|
||||
});
|
||||
//After Saving the BRANCH data then popup close
|
||||
// this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
/** For Popup Close Button */
|
||||
closeAllocationComponent(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,7 @@ export interface Master {
|
||||
export class PdTrigerService {
|
||||
|
||||
private apiUrl = "http://ssa.sineedge.com/sparqapi/api/";
|
||||
//private apiUrl = "http://192.168.0.17:9999/AWSEC2/sparqapi/api/";
|
||||
//private apiUrl = "http://192.168.15.5:9999/AWSEC2/sparqapi/api/";
|
||||
|
||||
|
||||
|
||||
@ -113,7 +113,6 @@ export class PdTrigerService {
|
||||
updatePdApplicant(editData:any):Observable<any>{
|
||||
// editData.fk_updatedby = this._aws.getlocale();
|
||||
// editData.updatedon = currentdate;
|
||||
console.log(editData)
|
||||
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":editData})
|
||||
|
||||
.pipe(
|
||||
@ -121,10 +120,24 @@ export class PdTrigerService {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private handleError<T>(operation = 'operation', result?: T) {
|
||||
return (error: any): Observable<T> => {
|
||||
return of(result as T);
|
||||
};
|
||||
}
|
||||
// get pd allocation to details
|
||||
getPdOfficerList(): Observable<any> {
|
||||
return this._http.get<any>(this.apiUrl+"getListPDOfficers")
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
// update pd officer
|
||||
updatePdOfficer(updateData: any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":updateData})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
|
||||
private handleError<T>(operation = 'operation', result?: T) {
|
||||
return (error: any): Observable<T> => {
|
||||
return of(result as T);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
|
||||
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
||||
import { NotifierModule, NotifierOptions } from 'angular-notifier';
|
||||
import {MatDatepickerModule} from '@angular/material/datepicker';
|
||||
|
||||
|
||||
import 'hammerjs';
|
||||
import { PdTrigerRoutes } from './pd-triger-routing.module';
|
||||
@ -29,10 +31,11 @@ import { EditPdComponent } from './edit-pd/edit-pd.component';
|
||||
import { ViewPdComponent } from './view-pd/view-pd.component';
|
||||
import { EditPdMasterComponent } from './edit-pd-master/edit-pd-master.component';
|
||||
import { EditPdApplicantComponent } from './edit-pd-applicant/edit-pd-applicant.component';
|
||||
import { PdAllocationComponent } from './pd-allocation/pd-allocation.component';
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
*/
|
||||
const pdCustomNotifierOptions: NotifierOptions = {
|
||||
const customNotifierOptions: NotifierOptions = {
|
||||
position: {
|
||||
horizontal: {
|
||||
position: 'right',
|
||||
@ -76,7 +79,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(PdTrigerRoutes),
|
||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||
NotifierModule.withConfig(customNotifierOptions),
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
@ -94,9 +97,10 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
FileUploadModule,
|
||||
TreeModule,
|
||||
MatDialogModule,MatSortModule,
|
||||
NgxMatSelectSearchModule,MatTooltipModule,
|
||||
NgxMatSelectSearchModule,MatTooltipModule, MatDatepickerModule,
|
||||
],
|
||||
declarations: [AddPdComponent, ListPdComponent, EditPdComponent, ViewPdComponent, EditPdMasterComponent, EditPdApplicantComponent],
|
||||
declarations: [AddPdComponent, ListPdComponent, EditPdComponent, ViewPdComponent, EditPdMasterComponent, EditPdApplicantComponent, PdAllocationComponent],
|
||||
entryComponents: [PdAllocationComponent],
|
||||
providers: [PdTrigerService]
|
||||
})
|
||||
export class PdTrigerModule { }
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
<!-- <pre>{{pdMasterData | json}}</pre>
|
||||
<pre>{{pdApplicantData | json}}</pre>
|
||||
<pre>{{pdDocumentsData | json}}</pre>
|
||||
<pre>{{pdLogsData | json}}</pre> -->
|
||||
<!-- pd master card -->
|
||||
<div class="row" style="text-align:left;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
|
||||
<div class="row" style="text-align:left;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
|
||||
|
||||
</div>
|
||||
<div *ngIf="!showEditMasterComponent">
|
||||
<mat-card *ngFor="let master of pdMasterData">
|
||||
<div class="cardEdit">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"><mat-icon>schedule</mat-icon></button>
|
||||
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)"><mat-icon>edit</mat-icon></button>
|
||||
</div>
|
||||
<mat-card-header>
|
||||
@ -18,6 +17,7 @@
|
||||
<mat-card-subtitle class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> <span>{{master.city_name}} / {{master.state_name}}-{{master.pincode}}</span></mat-card-subtitle>
|
||||
|
||||
</mat-card-header>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card-content>
|
||||
<p>{{master.product_name}} / {{master.subproduct_name}}</p>
|
||||
<p><span>{{master.pd_type_name}} {{master.pd_allocation_type_name}} {{master.pd_allocated_to}}</span></p>
|
||||
@ -40,7 +40,7 @@
|
||||
<mat-card-header>
|
||||
<mat-card-title>Applicants</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-list *ngFor="let applicant of pdApplicantData">
|
||||
<mat-list-item>
|
||||
<p><span *ngIf="applicant.applicant_name!=null" class="mb-2 text-center hover-icon">
|
||||
@ -53,31 +53,31 @@
|
||||
|
||||
|
||||
</mat-list-item>
|
||||
|
||||
</mat-list>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
<app-edit-pd-applicant *ngIf="showEditApplicantComponent" [applicantChild]="editApplicantData" (loadPdView)="updateViewComponent($event)"></app-edit-pd-applicant>
|
||||
<!-- pd documents details -->
|
||||
<mat-card>
|
||||
<div class="cardEdit">
|
||||
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon"><mat-icon>edit</mat-icon></button>
|
||||
</div>
|
||||
<!-- <div class="cardEdit">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"><mat-icon>edit</mat-icon></button>
|
||||
</div> -->
|
||||
<mat-card-header>
|
||||
<mat-card-title>Documents</mat-card-title>
|
||||
<!-- <mat-card-subtitle><i class="fa-1x fa fa-map-marker"> </i> {{master.city_name}} / {{master.state_name}}-{{master.pincode}}</mat-card-subtitle> -->
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-list *ngFor="let documents of pdDocumentsData">
|
||||
<mat-list-item>
|
||||
<p><span>
|
||||
{{documents.pd_document_title}} </span> <span class="mb-2 text-center hover-icon">
|
||||
<i class="fa-1x fa fa-file"></i>
|
||||
{{documents.pd_document_name}} </span>
|
||||
</p>
|
||||
</mat-list-item>
|
||||
|
||||
</mat-list>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-card>
|
||||
<!-- pd logs card -->
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
@ -86,4 +86,11 @@
|
||||
<mat-card-content>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
<!-- <mat-form-field>
|
||||
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker></mat-datepicker>
|
||||
</mat-form-field> -->
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { PdTrigerService } from '../pd-service/pd-triger.service';
|
||||
import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component';
|
||||
@Component({
|
||||
selector: 'app-view-pd',
|
||||
templateUrl: './view-pd.component.html',
|
||||
@ -25,7 +26,7 @@ export class ViewPdComponent implements OnInit {
|
||||
@Output() loadParent = new EventEmitter<string>();
|
||||
public _EditPDtriggerForm:FormGroup;
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, notifier:NotifierService) {
|
||||
private _pd: PdTrigerService, notifier:NotifierService, private dialog: MatDialog,) {
|
||||
this.notifier=notifier
|
||||
}
|
||||
|
||||
@ -42,6 +43,7 @@ export class ViewPdComponent implements OnInit {
|
||||
if (data.status == 200) {
|
||||
this.pdMasterData=data.records.pd_master_details;
|
||||
this.pdApplicantData= data.records.applicants_details;
|
||||
this.pdDocumentsData=data.records.pd_documnets;
|
||||
this.pdLogsData=data.records.pd_logs;
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
@ -59,6 +61,18 @@ export class ViewPdComponent implements OnInit {
|
||||
this.editApplicantData=applicantData;
|
||||
this.showEditApplicantComponent=!this.showEditApplicantComponent;
|
||||
}
|
||||
// pd allocation to
|
||||
// edit questions master details popup model
|
||||
pdAllocationTo(pdID:any) {
|
||||
const dialogRef = this.dialog.open(PdAllocationComponent, {
|
||||
data: pdID,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
//this.getQuestionsMasters();
|
||||
});
|
||||
}
|
||||
updateViewComponent(editBack:string) {
|
||||
|
||||
if(editBack=='1'){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user