Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
4a66e305c0
@ -21,6 +21,7 @@ export class MapPdViewComponent implements OnInit, OnDestroy {
|
||||
lng:string
|
||||
mapDetails:any[] = [];
|
||||
recordStatus: boolean;
|
||||
noRecordFound: boolean = true;
|
||||
errorMessage: any;
|
||||
// pagination variable details
|
||||
length = 50;
|
||||
|
||||
@ -13,14 +13,16 @@
|
||||
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
|
||||
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
|
||||
<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 fxFlex="0 1 auto" class="ml-xs">
|
||||
<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-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>
|
||||
</div>
|
||||
|
||||
@ -30,7 +32,8 @@
|
||||
<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-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>
|
||||
<span fxFlex="0 1 auto" class="ml-xs">
|
||||
<h6> The Selected Cities are., </h6>
|
||||
@ -49,7 +52,8 @@
|
||||
<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-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>
|
||||
<span fxFlex="0 1 auto" class="ml-xs">
|
||||
<h6> The Selected Products are., </h6>
|
||||
@ -66,7 +70,9 @@
|
||||
<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-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>
|
||||
<span fxFlex="0 1 auto" class="ml-xs">
|
||||
<h6> The Selected Customer segment are., </h6>
|
||||
@ -78,7 +84,7 @@
|
||||
|
||||
<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="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>
|
||||
</mat-card>
|
||||
</form>
|
||||
|
||||
@ -15,7 +15,6 @@ import { Router } from '@angular/router';
|
||||
import { empty } from 'rxjs';
|
||||
/**sweet alert */
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-team-add',
|
||||
templateUrl: './pd-team-add.component.html',
|
||||
@ -25,7 +24,7 @@ export class PdTeamAddComponent implements OnInit {
|
||||
|
||||
public _pdTeamForm: FormGroup;
|
||||
private notifier: NotifierService;
|
||||
public submitted = false;
|
||||
//public submitted = false;
|
||||
color = 'primary';
|
||||
errorMessage:string;
|
||||
|
||||
@ -46,12 +45,12 @@ selectedProductDatas : any=[];
|
||||
selectedSegmentDatas : any=[];
|
||||
|
||||
constructor(private _formBuilder: FormBuilder,
|
||||
private _notifier: NotifierService,
|
||||
notifier: NotifierService,
|
||||
private _pdTeamService: PdTeamService,
|
||||
private _router: Router,
|
||||
private _masterService: MastersService)
|
||||
{
|
||||
this.notifier = _notifier;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +109,7 @@ this._masterService.getAllMasterData('CUSTOMERSEGMENT').subscribe(
|
||||
/** Pd Team Form Datas */
|
||||
PdTeamFormDatas(){
|
||||
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])],
|
||||
fk_lender: [null, Validators.compose([Validators.required])],
|
||||
fk_city: [null, Validators.compose([Validators.required])],
|
||||
@ -131,29 +130,25 @@ onNoClick(): void {
|
||||
|
||||
/** To Save/Edited Popup Data */
|
||||
onSubmit() {
|
||||
this.submitted = true;
|
||||
var pdTeamFormValues = this._pdTeamForm.value;
|
||||
Object.keys(pdTeamFormValues).forEach(
|
||||
(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 {
|
||||
|
||||
|
||||
|
||||
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(
|
||||
(key) => ( pdTeamFormValues[key] == null) && delete pdTeamFormValues[key]);
|
||||
|
||||
//To Remove The "Null" With Key also
|
||||
|
||||
this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe(
|
||||
dataresult => {
|
||||
if (dataresult.status == 200) {
|
||||
|
||||
this.notifier.notify('success', 'Record Edited Successfully.!');
|
||||
Swal('Success.!');
|
||||
this._router.navigate(['/setting/pdteam/pdteamlist']);
|
||||
//this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||
Swal('Record Saved Successfully.!','success');
|
||||
this._pdTeamForm.reset();
|
||||
this._router.navigate(['/setting/pdteam/pdteamlist']);
|
||||
}
|
||||
else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
@ -162,7 +157,7 @@ onSubmit() {
|
||||
//this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -197,7 +192,7 @@ onChangeCityDatas($event){
|
||||
for(let data of dup_cityname){
|
||||
|
||||
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;
|
||||
mycheck++;
|
||||
}
|
||||
|
||||
@ -51,22 +51,13 @@
|
||||
<ng-container matColumnDef="isactive">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Active </mat-header-cell>
|
||||
<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
|
||||
class="example-margin"
|
||||
matTooltip="Inactive" matTooltipPosition="above"
|
||||
checked="false" [color]="color"
|
||||
(change)="isactivePdTeam(row.pdteam_id,row.isactive)"
|
||||
(click)="active()">
|
||||
</mat-slide-toggle></ng-template>
|
||||
|
||||
class="example-margin" [color]="color"
|
||||
[checked] ="row.isactive==1?true:false"
|
||||
[matTooltip]="row.isactive==1?'Active':'Inactive'"
|
||||
matTooltipPosition="above"
|
||||
(click)="isactivePdTeam(row.pdteam_id,row.isactive)">
|
||||
</mat-slide-toggle>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
@ -86,6 +77,10 @@
|
||||
|
||||
<mat-paginator *ngIf="!noRecordFound" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
@ -30,6 +30,8 @@ export class PdTeamListComponent implements OnInit {
|
||||
//Variable Declaration part
|
||||
isPopupOpened: boolean = true;
|
||||
loader: boolean = false;
|
||||
SwalButtonText: string;
|
||||
SwalMessage: string;
|
||||
PdTeamList: any = [];
|
||||
color = 'primary';
|
||||
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': '0'}
|
||||
|
||||
this._MasterService.editMasterDetails(ActiveDatas,'PDTEAM')
|
||||
.subscribe(dataresult=>{
|
||||
if (dataresult.dataStatus == true){
|
||||
//alert("my check");
|
||||
this.getPdTeam();
|
||||
}
|
||||
else{
|
||||
alert("SomeThing Wents Wrong Try Again !");
|
||||
}
|
||||
});
|
||||
}
|
||||
//Sweetalert2 for active and deactive
|
||||
active(){
|
||||
//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: 'Yes, activate it!'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
Swal(
|
||||
'Activated!',
|
||||
'success'
|
||||
)
|
||||
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')
|
||||
.subscribe(dataresult=>{
|
||||
if (dataresult.dataStatus == true){
|
||||
Swal(this.SwalMessage,'success');
|
||||
this.getPdTeam();
|
||||
}
|
||||
else{
|
||||
Swal("Sorry Try Again !");
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.getPdTeam();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
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 */
|
||||
ngAfterViewInit() {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
<!--<div class="form-group">-->
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
<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-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>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
|
||||
@ -61,7 +61,7 @@ export class AddComponent implements OnInit {
|
||||
this._addQuesFrom = this._formBuilder.group({
|
||||
question: [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])],
|
||||
answers: this._formBuilder.array([
|
||||
this.initAnswers(),
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
<!--<div class="form-group">-->
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
<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-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>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
|
||||
@ -90,7 +90,7 @@ export class EditComponent implements OnInit {
|
||||
question_id: [this.data.question_id],
|
||||
question: [this.data.question, 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])],
|
||||
isactive: [this.data.isactive],
|
||||
answers: this._formBuilder.array([
|
||||
|
||||
Loading…
Reference in New Issue
Block a user