master changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-10-17 12:03:35 +05:30
parent ac6ddb9896
commit 2476269c52
9 changed files with 86 additions and 99 deletions

View File

@ -21,6 +21,7 @@ export class MapPdViewComponent implements OnInit, OnDestroy {
lng:string lng:string
mapDetails:any[] = []; mapDetails:any[] = [];
recordStatus: boolean; recordStatus: boolean;
noRecordFound: boolean = true;
errorMessage: any; errorMessage: any;
// pagination variable details // pagination variable details
length = 50; length = 50;

View File

@ -13,14 +13,16 @@
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start"> <div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput type="text" placeholder="Team Name" required formControlName="team_name"> <input matInput type="text" placeholder="Team Name" required formControlName="team_name">
<mat-error *ngIf="submitted && f.team_name.hasError('required')" class="mat-text-warn">You must Include Team Name.</mat-error> <!-- <mat-error *ngIf="f.team_name.hasError('required')" class="mat-text-warn">You must Include Team Name.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['team_name'].valid && _pdTeamForm.controls['team_name'].touched" class="mat-text-warn">Team Name Requried.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs"> <mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="Lender" required formControlName="fk_lender"> <mat-select placeholder="Lender" required formControlName="fk_lender">
<mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" >{{ ld.short_name }} {{ ld.full_name }} </mat-option> <mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" >{{ ld.short_name }} {{ ld.full_name }} </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_lender.hasError('required')" class="mat-text-warn">You must Select Lender Name.</mat-error> <!-- <mat-error *ngIf="f.fk_lender.hasError('required')" class="mat-text-warn">You must Select Lender Name.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_lender'].valid && _pdTeamForm.controls['fk_lender'].touched" class="mat-text-warn">Lender Name Requried.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
@ -30,7 +32,8 @@
<mat-select placeholder="City" required formControlName="fk_city" multiple> <mat-select placeholder="City" required formControlName="fk_city" multiple>
<mat-option *ngFor="let cd of citydatas" [value]="cd.city_id" (onSelectionChange)="onChangeCityDatas($event)" >{{ cd.name }} </mat-option> <mat-option *ngFor="let cd of citydatas" [value]="cd.city_id" (onSelectionChange)="onChangeCityDatas($event)" >{{ cd.name }} </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_city.hasError('required')" class="mat-text-warn">You must Select Cities.</mat-error> <!-- <mat-error *ngIf="f.fk_city.hasError('required')" class="mat-text-warn">You must Select Cities.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_city'].valid && _pdTeamForm.controls['fk_city'].touched" class="mat-text-warn">City Name Requried.</mat-error>
</mat-form-field> </mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs"> <span fxFlex="0 1 auto" class="ml-xs">
<h6> The Selected Cities are., </h6> <h6> The Selected Cities are., </h6>
@ -49,7 +52,8 @@
<mat-select placeholder="Product" required formControlName="fk_product" multiple> <mat-select placeholder="Product" required formControlName="fk_product" multiple>
<mat-option *ngFor="let pd of productdatas " [value]="pd.product_id" (onSelectionChange)="onChangeProductDatas($event)" >{{ pd.name }} </mat-option> <mat-option *ngFor="let pd of productdatas " [value]="pd.product_id" (onSelectionChange)="onChangeProductDatas($event)" >{{ pd.name }} </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_product.hasError('required')" class="mat-text-warn">You must Select Product.</mat-error> <!-- <mat-error *ngIf="f.fk_product.hasError('required')" class="mat-text-warn">You must Select Product.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_product'].valid && _pdTeamForm.controls['fk_product'].touched" class="mat-text-warn">Product Name Requried.</mat-error>
</mat-form-field> </mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs"> <span fxFlex="0 1 auto" class="ml-xs">
<h6> The Selected Products are., </h6> <h6> The Selected Products are., </h6>
@ -66,7 +70,9 @@
<mat-select placeholder="Customer Segment" required formControlName="fk_customer_segment" multiple> <mat-select placeholder="Customer Segment" required formControlName="fk_customer_segment" multiple>
<mat-option *ngFor="let csd of customerSegmentdatas" [value]="csd.customer_segment_id" (onSelectionChange)="onChangeCustomerSegmentDatas($event)">{{csd.name}}</mat-option> <mat-option *ngFor="let csd of customerSegmentdatas" [value]="csd.customer_segment_id" (onSelectionChange)="onChangeCustomerSegmentDatas($event)">{{csd.name}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_customer_segment.hasError('required')" class="mat-text-warn">You must Select Customer Segment.</mat-error> <!-- <mat-error *ngIf="f.fk_customer_segment.hasError('required')" class="mat-text-warn">You must Select Customer Segment.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_customer_segment'].valid && _pdTeamForm.controls['fk_customer_segment'].touched" class="mat-text-warn">CustomerSegment Name Requried.</mat-error>
</mat-form-field> </mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs"> <span fxFlex="0 1 auto" class="ml-xs">
<h6> The Selected Customer segment are., </h6> <h6> The Selected Customer segment are., </h6>
@ -78,7 +84,7 @@
<div class="row" style="text-align:right;"> <div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_pdTeamForm.valid"><mat-icon>save</mat-icon></button>
</div> </div>
</mat-card> </mat-card>
</form> </form>

View File

@ -15,7 +15,6 @@ import { Router } from '@angular/router';
import { empty } from 'rxjs'; import { empty } from 'rxjs';
/**sweet alert */ /**sweet alert */
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
@Component({ @Component({
selector: 'app-pd-team-add', selector: 'app-pd-team-add',
templateUrl: './pd-team-add.component.html', templateUrl: './pd-team-add.component.html',
@ -25,7 +24,7 @@ export class PdTeamAddComponent implements OnInit {
public _pdTeamForm: FormGroup; public _pdTeamForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
public submitted = false; //public submitted = false;
color = 'primary'; color = 'primary';
errorMessage:string; errorMessage:string;
@ -46,12 +45,12 @@ selectedProductDatas : any=[];
selectedSegmentDatas : any=[]; selectedSegmentDatas : any=[];
constructor(private _formBuilder: FormBuilder, constructor(private _formBuilder: FormBuilder,
private _notifier: NotifierService, notifier: NotifierService,
private _pdTeamService: PdTeamService, private _pdTeamService: PdTeamService,
private _router: Router, private _router: Router,
private _masterService: MastersService) private _masterService: MastersService)
{ {
this.notifier = _notifier; this.notifier = notifier;
} }
@ -110,7 +109,7 @@ this._masterService.getAllMasterData('CUSTOMERSEGMENT').subscribe(
/** Pd Team Form Datas */ /** Pd Team Form Datas */
PdTeamFormDatas(){ PdTeamFormDatas(){
this._pdTeamForm = this._formBuilder.group({ this._pdTeamForm = this._formBuilder.group({
pdteam_id: [null, Validators.compose([Validators.required])], //pdteam_id: [null, Validators.compose([Validators.required])],
team_name: [null, Validators.compose([Validators.required])], team_name: [null, Validators.compose([Validators.required])],
fk_lender: [null, Validators.compose([Validators.required])], fk_lender: [null, Validators.compose([Validators.required])],
fk_city: [null, Validators.compose([Validators.required])], fk_city: [null, Validators.compose([Validators.required])],
@ -131,29 +130,25 @@ onNoClick(): void {
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true;
var pdTeamFormValues = this._pdTeamForm.value; var pdTeamFormValues = this._pdTeamForm.value;
//stop here if form is invalid
if (pdTeamFormValues.invalid) {
alert('Please Fill All Mandate Fields.');
} else {
Object.keys(pdTeamFormValues).forEach( Object.keys(pdTeamFormValues).forEach(
(key) => ( pdTeamFormValues[key] == null) && delete pdTeamFormValues[key]); (key) => ( pdTeamFormValues[key] == null) && delete pdTeamFormValues[key]);
// stop here if form is invalid
// if (pdTeamFormValues.invalid) {
// // this.errorMessage = "Please Fill All Mandate Fields.";
// // return;
// alert('Please Fill All Mandate Fields.');
// } else {
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe( this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe(
dataresult => { dataresult => {
if (dataresult.status == 200) { if (dataresult.status == 200) {
//this.notifier.notify('success', 'Record Saved Successfully.!');
this.notifier.notify('success', 'Record Edited Successfully.!'); Swal('Record Saved Successfully.!','success');
Swal('Success.!');
this._router.navigate(['/setting/pdteam/pdteamlist']);
this._pdTeamForm.reset(); this._pdTeamForm.reset();
this._router.navigate(['/setting/pdteam/pdteamlist']);
} }
else { else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
@ -162,7 +157,7 @@ onSubmit() {
//this.errorMessage = "Some Thing Wents Wrong Try Again !"; //this.errorMessage = "Some Thing Wents Wrong Try Again !";
} }
}); });
}
} }
@ -197,7 +192,7 @@ onChangeCityDatas($event){
for(let data of dup_cityname){ for(let data of dup_cityname){
if(data.name == cityName.name){ if(data.name == cityName.name){
Swal('<h5>"'+data.name+'" already existing with "'+ teamname +'"</h5>'); alert('"'+data.name+'" Already Existing with "'+ teamname +'"');
$event.source._selected = false; $event.source._selected = false;
mycheck++; mycheck++;
} }

View File

@ -51,22 +51,13 @@
<ng-container matColumnDef="isactive"> <ng-container matColumnDef="isactive">
<mat-header-cell *matHeaderCellDef mat-sort-header> Active </mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header> Active </mat-header-cell>
<mat-cell *matCellDef="let row"><!--{{row.isactive}}--> <mat-cell *matCellDef="let row"><!--{{row.isactive}}-->
<mat-slide-toggle *ngIf="row.isactive == 1;else notactive;"
class="example-margin"
matTooltip="Active" matTooltipPosition="above"
checked="true" [color]="color"
(change)="isactivePdTeam(row.pdteam_id,row.isactive)"
(click)="deactive()">
</mat-slide-toggle>
<ng-template #notactive >
<mat-slide-toggle <mat-slide-toggle
class="example-margin" class="example-margin" [color]="color"
matTooltip="Inactive" matTooltipPosition="above" [checked] ="row.isactive==1?true:false"
checked="false" [color]="color" [matTooltip]="row.isactive==1?'Active':'Inactive'"
(change)="isactivePdTeam(row.pdteam_id,row.isactive)" matTooltipPosition="above"
(click)="active()"> (click)="isactivePdTeam(row.pdteam_id,row.isactive)">
</mat-slide-toggle></ng-template> </mat-slide-toggle>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
@ -86,6 +77,10 @@
<mat-paginator *ngIf="!noRecordFound" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator> <mat-paginator *ngIf="!noRecordFound" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>

View File

@ -30,6 +30,8 @@ export class PdTeamListComponent implements OnInit {
//Variable Declaration part //Variable Declaration part
isPopupOpened: boolean = true; isPopupOpened: boolean = true;
loader: boolean = false; loader: boolean = false;
SwalButtonText: string;
SwalMessage: string;
PdTeamList: any = []; PdTeamList: any = [];
color = 'primary'; color = 'primary';
pageSize = 10; pageSize = 10;
@ -102,61 +104,49 @@ managepdteam(){
} }
}) })
} }
isactivePdTeam(id: number,isactive : number) {
/** For Changing Active States., which means both Changing Active And Inactive alternatively */
isactivePdTeam(id: number,isactive : number) {
let ActiveDatas = isactive == 0 let ActiveDatas = isactive == 0
? { 'pdteam_id':id,'isactive': '1'} ? { 'pdteam_id':id,'isactive': '1'}
: { 'pdteam_id':id,'isactive': '0'} : { 'pdteam_id':id,'isactive': '0'}
//if is active '1' have TO deactive So deactive messages
if(isactive == 1){
this.SwalButtonText = 'Yes, deactivate it!';
this.SwalMessage = 'Deactivated!';
}
else{
this.SwalButtonText = 'Yes, activate it!';
this.SwalMessage = 'Activated!';
}
Swal({
title: 'Are you sure?',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: this.SwalButtonText
}).then((result) => {
if (result.value) {
this._MasterService.editMasterDetails(ActiveDatas,'PDTEAM') this._MasterService.editMasterDetails(ActiveDatas,'PDTEAM')
.subscribe(dataresult=>{ .subscribe(dataresult=>{
if (dataresult.dataStatus == true){ if (dataresult.dataStatus == true){
//alert("my check"); Swal(this.SwalMessage,'success');
this.getPdTeam(); this.getPdTeam();
} }
else{ else{
alert("SomeThing Wents Wrong Try Again !"); Swal("Sorry Try Again !");
} }
}); });
} }
//Sweetalert2 for active and deactive else{
active(){ this.getPdTeam();
Swal({
title: 'Are you sure?',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, activate it!'
}).then((result) => {
if (result.value) {
Swal(
'Activated!',
'success'
)
} }
}) })
}
deactive()
{
Swal({
title: 'Are you sure?',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, deactivate it!'
}).then((result) => {
if (result.value) {
Swal(
'Deactivated!',
'success'
)
} }
})
}
/** For Display Tables Pagination And Sorting */ /** For Display Tables Pagination And Sorting */
ngAfterViewInit() { ngAfterViewInit() {
this.dataSource.paginator = this.paginator; this.dataSource.paginator = this.paginator;

View File

@ -11,10 +11,10 @@
<!--<div class="form-group">--> <!--<div class="form-group">-->
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Select Category" formControlName="fk_question_catagory"> <mat-select placeholder="Select Category" formControlName="fk_question_category">
<mat-option *ngFor="let ct of categories" [value]="ct.question_category_id">{{ ct.category_name }}</mat-option> <mat-option *ngFor="let ct of categories" [value]="ct.question_category_id">{{ ct.category_name }}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_question_catagory.hasError('required')" class="mat-text-warn">You must Select Category.</mat-error> <mat-error *ngIf="submitted && f.fk_question_category.hasError('required')" class="mat-text-warn">You must Select Category.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">

View File

@ -61,7 +61,7 @@ export class AddComponent implements OnInit {
this._addQuesFrom = this._formBuilder.group({ this._addQuesFrom = this._formBuilder.group({
question: [null, Validators.compose([Validators.required])], question: [null, Validators.compose([Validators.required])],
description: [null, Validators.compose([Validators.required])], description: [null, Validators.compose([Validators.required])],
fk_question_catagory: [null, Validators.compose([Validators.required])], fk_question_category: [null, Validators.compose([Validators.required])],
fk_question_answertype: [null, Validators.compose([Validators.required])], fk_question_answertype: [null, Validators.compose([Validators.required])],
answers: this._formBuilder.array([ answers: this._formBuilder.array([
this.initAnswers(), this.initAnswers(),

View File

@ -12,10 +12,10 @@
<!--<div class="form-group">--> <!--<div class="form-group">-->
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Select Category" formControlName="fk_question_catagory"> <mat-select placeholder="Select Category" formControlName="fk_question_category">
<mat-option *ngFor="let ct of categories" [value]="ct.question_category_id">{{ ct.category_name }}</mat-option> <mat-option *ngFor="let ct of categories" [value]="ct.question_category_id">{{ ct.category_name }}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && f.fk_question_catagory.hasError('required')" class="mat-text-warn">You must Select Category.</mat-error> <mat-error *ngIf="submitted && f.fk_question_category.hasError('required')" class="mat-text-warn">You must Select Category.</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">

View File

@ -90,7 +90,7 @@ export class EditComponent implements OnInit {
question_id: [this.data.question_id], question_id: [this.data.question_id],
question: [this.data.question, Validators.compose([Validators.required])], question: [this.data.question, Validators.compose([Validators.required])],
description: [this.data.description, Validators.compose([Validators.required])], description: [this.data.description, Validators.compose([Validators.required])],
fk_question_catagory: [this.data.fk_question_catagory, Validators.compose([Validators.required])], fk_question_category: [this.data.fk_question_category, Validators.compose([Validators.required])],
fk_question_answertype: [this.data.fk_question_answertype, Validators.compose([Validators.required])], fk_question_answertype: [this.data.fk_question_answertype, Validators.compose([Validators.required])],
isactive: [this.data.isactive], isactive: [this.data.isactive],
answers: this._formBuilder.array([ answers: this._formBuilder.array([