Forms Validation : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-11-19 18:24:46 +05:30
parent f43026e7c5
commit 529f5c6a2c
15 changed files with 291 additions and 240 deletions

View File

@ -43,12 +43,13 @@
</mat-form-field> </mat-form-field>
</div> </div>
</mat-card-title> </mat-card-title>
<!-- <pre> Full - {{doughnutChartDataForFullPD}} Smart -{{doughnutChartDataForSmartPD}} TELE -{{doughnutChartDataForTelePD}} </pre> -->
<mat-card-content> <mat-card-content>
<div fxLayout="row"> <div fxLayout="row">
<div fxFlex.gt-sm="30" fxFlex="100"> <div fxFlex.gt-sm="30" fxFlex="100">
<canvas baseChart class="chart" <canvas baseChart class="chart" id="FullCanvas" name="FullCanvas"
height="280px" width="280px" height="280px" width="280px"
[data]="doughnutChartDataForFullPD" [data]="doughnutChartDataForFullPD"
[labels]="doughnutChartLabels" [labels]="doughnutChartLabels"
@ -61,7 +62,7 @@
<div fxFlex.gt-sm="5" fxFlex="100"> <div fxFlex.gt-sm="5" fxFlex="100">
</div> </div>
<div fxFlex.gt-sm="30" fxFlex="100"> <div fxFlex.gt-sm="30" fxFlex="100">
<canvas baseChart class="chart" <canvas baseChart class="chart" id="SmartCanvas" name="SmartCanvas"
height="280px" width="280px" height="280px" width="280px"
[data]="doughnutChartDataForSmartPD" [data]="doughnutChartDataForSmartPD"
[labels]="doughnutChartLabels" [labels]="doughnutChartLabels"
@ -74,7 +75,7 @@
<div fxFlex.gt-sm="5" fxFlex="100"> <div fxFlex.gt-sm="5" fxFlex="100">
</div> </div>
<div fxFlex.gt-sm="30" fxFlex="100"> <div fxFlex.gt-sm="30" fxFlex="100">
<canvas baseChart class="chart" <canvas baseChart class="chart" id="TeleCanvas" name="TeleCanvas"
height="280px" width="280px" height="280px" width="280px"
[data]="doughnutChartDataForTelePD" [data]="doughnutChartDataForTelePD"
[labels]="doughnutChartLabels" [labels]="doughnutChartLabels"
@ -105,4 +106,4 @@
</mat-card> </mat-card>
</div> </div>
</div> </div>

View File

@ -32,10 +32,12 @@ export class DashboardComponent {
dashboardTitle = 'PD Status'; dashboardTitle = 'PD Status';
/** Declaration Part Of Doughnut Chart */ /** Declaration Part Of Doughnut Chart */
@ViewChild('mycanvas') canvas:ElementRef; //@ViewChild('BaseChartDirective') canvas ;
@ViewChild(BaseChartDirective) FullCanvas: BaseChartDirective;
@ViewChild(BaseChartDirective) TeleCanvas: BaseChartDirective;
@ViewChild(BaseChartDirective) SmartCanvas: BaseChartDirective;
//myChart: BaseChartDirective; //myChart: BaseChartDirective;
doughnutChartType = 'doughnut'; doughnutChartType = 'doughnut';
doughnutChartLabels: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed']; doughnutChartLabels: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed'];
@ -74,8 +76,6 @@ export class DashboardComponent {
/** Declaration Part Of SubCard Section */ /** Declaration Part Of SubCard Section */
cityWisePD : any=[];
lenderWisePD :any=[];
alertMessage : any=[]; alertMessage : any=[];
selectedCity : any=[]; selectedCity : any=[];
@ -117,9 +117,9 @@ export class DashboardComponent {
ngOnInit(){ ngOnInit(){
this.getDoughnutChartData();
this.getDoughnutChartData();
const today = new Date(); const today = new Date();
const fromMin = new Date(today.getFullYear(), today.getMonth()-2, 1); const fromMin = new Date(today.getFullYear(), today.getMonth()-2, 1);
const fromMax = new Date(today.getFullYear(), today.getMonth()+1, 0); const fromMax = new Date(today.getFullYear(), today.getMonth()+1, 0);
@ -144,7 +144,7 @@ export class DashboardComponent {
this.options = { this.options = {
presets: this.presets, presets: this.presets,
format: 'mediumDate', format: 'mediumDate',
range: {fromDate:toMin, toDate: fromMax}, range: {fromDate:FirstDateForPreMonth, toDate: LastDateForPreMonth},
applyLabel: "Submit", applyLabel: "Submit",
calendarOverlayConfig: { calendarOverlayConfig: {
shouldCloseOnBackdropClick: false, shouldCloseOnBackdropClick: false,
@ -227,9 +227,8 @@ getDoughnutChartData(){
if(DraftFullPDvalue.length != '0'){ if(DraftFullPDvalue.length != '0'){
//console.log('console triggered value',TriggerFullPDvalue); //console.log('console triggered value',TriggerFullPDvalue);
for(let FPD of DraftFullPDvalue){ for(let FPD of DraftFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[DraftIndexvalue] = +FPD.count;
this.tempDataFullPD[DraftIndexvalue] = y;
} }
} }
else{ else{
@ -238,11 +237,10 @@ getDoughnutChartData(){
let TriggerFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'TRIGGERED'); let TriggerFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'TRIGGERED');
if(TriggerFullPDvalue.length != '0'){ if(TriggerFullPDvalue.length != '0'){
//console.log('console triggered value',TriggerFullPDvalue);
for(let FPD of TriggerFullPDvalue){ for(let FPD of TriggerFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[TriggedIndexvalue] = +FPD.count;
this.tempDataFullPD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -252,9 +250,8 @@ getDoughnutChartData(){
let AllocatedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedFullPDvalue.length != '0'){ if(AllocatedFullPDvalue.length != '0'){
for(let FPD of AllocatedFullPDvalue){ for(let FPD of AllocatedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[AllocatedIndexvalue] = +FPD.count;
this.tempDataFullPD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -264,11 +261,10 @@ getDoughnutChartData(){
let ScheduledFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledFullPDvalue.length != '0'){ if(ScheduledFullPDvalue.length != '0'){
for(let FPD of ScheduledFullPDvalue){ for(let FPD of ScheduledFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[ScheduledIndexvalue] = +FPD.count;
this.tempDataFullPD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count;
} }
else{ else{
@ -278,9 +274,8 @@ getDoughnutChartData(){
let InProgressFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressFullPDvalue.length != '0'){ if(InProgressFullPDvalue.length != '0'){
for(let FPD of InProgressFullPDvalue){ for(let FPD of InProgressFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[InProgressIndexvalue] = +FPD.count;
this.tempDataFullPD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -292,9 +287,8 @@ getDoughnutChartData(){
let CompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedFullPDvalue.length != '0'){ if(CompletedFullPDvalue.length != '0'){
for(let FPD of CompletedFullPDvalue){ for(let FPD of CompletedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[CompletedIndexvalue] = +FPD.count;
this.tempDataFullPD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -306,9 +300,8 @@ getDoughnutChartData(){
let QCCompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedFullPDvalue.length != '0'){ if(QCCompletedFullPDvalue.length != '0'){
for(let FPD of QCCompletedFullPDvalue){ for(let FPD of QCCompletedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataFullPD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -321,9 +314,8 @@ getDoughnutChartData(){
if(DraftSmartPDvalue.length != '0'){ if(DraftSmartPDvalue.length != '0'){
//console.log('console triggered value',TriggerFullPDvalue); //console.log('console triggered value',TriggerFullPDvalue);
for(let FPD of DraftSmartPDvalue){ for(let FPD of DraftSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[DraftIndexvalue] = +FPD.count;
this.tempDataSmartPD[DraftIndexvalue] = y;
} }
} }
else{ else{
@ -334,9 +326,7 @@ getDoughnutChartData(){
if(TriggerSmartPDvalue.length != '0'){ if(TriggerSmartPDvalue.length != '0'){
for(let FPD of TriggerSmartPDvalue){ for(let FPD of TriggerSmartPDvalue){
let y = +FPD.count; this.tempDataSmartPD[TriggedIndexvalue] = +FPD.count;
this.total2 = this.total2+y;
this.tempDataSmartPD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -346,9 +336,8 @@ getDoughnutChartData(){
let AllocatedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedSmartPDvalue.length != '0'){ if(AllocatedSmartPDvalue.length != '0'){
for(let FPD of AllocatedSmartPDvalue){ for(let FPD of AllocatedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[AllocatedIndexvalue] = +FPD.count;
this.tempDataSmartPD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -358,9 +347,8 @@ getDoughnutChartData(){
let ScheduledSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledSmartPDvalue.length != '0'){ if(ScheduledSmartPDvalue.length != '0'){
for(let FPD of ScheduledSmartPDvalue){ for(let FPD of ScheduledSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[ScheduledIndexvalue] = +FPD.count;
this.tempDataSmartPD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count; //let y = +ScheduledFullPDvalue.count;
@ -372,9 +360,8 @@ getDoughnutChartData(){
let InProgressSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressSmartPDvalue.length != '0'){ if(InProgressSmartPDvalue.length != '0'){
for(let FPD of InProgressSmartPDvalue){ for(let FPD of InProgressSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[InProgressIndexvalue] = +FPD.count;
this.tempDataSmartPD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -386,9 +373,8 @@ getDoughnutChartData(){
let CompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedSmartPDvalue.length != '0'){ if(CompletedSmartPDvalue.length != '0'){
for(let FPD of CompletedSmartPDvalue){ for(let FPD of CompletedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[CompletedIndexvalue] = +FPD.count;
this.tempDataSmartPD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -400,9 +386,8 @@ getDoughnutChartData(){
let QCCompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedSmartPDvalue.length != '0'){ if(QCCompletedSmartPDvalue.length != '0'){
for(let FPD of QCCompletedSmartPDvalue){ for(let FPD of QCCompletedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataSmartPD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -416,9 +401,8 @@ getDoughnutChartData(){
if(DraftTelePDvalue.length != '0'){ if(DraftTelePDvalue.length != '0'){
for(let FPD of DraftTelePDvalue){ for(let FPD of DraftTelePDvalue){
let y = +FPD.count;
this.total1 = this.total3+y; this.tempDataTelePD[DraftIndexvalue] = +FPD.count;
this.tempDataTelePD[DraftIndexvalue] = y;
} }
} }
else{ else{
@ -429,9 +413,8 @@ getDoughnutChartData(){
if(TriggerTelePDvalue.length != '0'){ if(TriggerTelePDvalue.length != '0'){
//console.log('console triggered value',TriggerTelePDvalue); //console.log('console triggered value',TriggerTelePDvalue);
for(let FPD of TriggerTelePDvalue){ for(let FPD of TriggerTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[TriggedIndexvalue] = +FPD.count;
this.tempDataTelePD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -441,9 +424,8 @@ getDoughnutChartData(){
let AllocatedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedTelePDvalue.length != '0'){ if(AllocatedTelePDvalue.length != '0'){
for(let FPD of AllocatedTelePDvalue){ for(let FPD of AllocatedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[AllocatedIndexvalue] = +FPD.count;
this.tempDataTelePD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -453,9 +435,8 @@ getDoughnutChartData(){
let ScheduledTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledTelePDvalue.length != '0'){ if(ScheduledTelePDvalue.length != '0'){
for(let FPD of ScheduledTelePDvalue){ for(let FPD of ScheduledTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[ScheduledIndexvalue] = +FPD.count;
this.tempDataTelePD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count; //let y = +ScheduledFullPDvalue.count;
@ -467,9 +448,8 @@ getDoughnutChartData(){
let InProgressTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressTelePDvalue.length != '0'){ if(InProgressTelePDvalue.length != '0'){
for(let FPD of InProgressTelePDvalue){ for(let FPD of InProgressTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[InProgressIndexvalue] = +FPD.count;
this.tempDataTelePD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -481,9 +461,8 @@ getDoughnutChartData(){
let CompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedTelePDvalue.length != '0'){ if(CompletedTelePDvalue.length != '0'){
for(let FPD of CompletedTelePDvalue){ for(let FPD of CompletedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[CompletedIndexvalue] = +FPD.count;
this.tempDataTelePD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -495,9 +474,8 @@ getDoughnutChartData(){
let QCCompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedTelePDvalue.length != '0'){ if(QCCompletedTelePDvalue.length != '0'){
for(let FPD of QCCompletedTelePDvalue){ for(let FPD of QCCompletedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataTelePD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -513,6 +491,9 @@ getDoughnutChartData(){
this.doughnutChartDataForFullPD = this.tempDataFullPD; this.doughnutChartDataForFullPD = this.tempDataFullPD;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0);
this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0);
this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0);
console.log('Final full Data Completed',this.doughnutChartDataForFullPD); console.log('Final full Data Completed',this.doughnutChartDataForFullPD);
console.log('temp full Data',this.tempDataFullPD); console.log('temp full Data',this.tempDataFullPD);
@ -538,7 +519,14 @@ doughnutOptions: any = Object.assign({
centertext:'One' centertext:'One'
},this.globalChartOptions); },this.globalChartOptions);
// ngOnChanges(){
// // this.barChartData=this.chartData;
// this.barChartLabel=this.chartLabel;
// }
onChange(e :any,flag: any) { onChange(e :any,flag: any) {
let fromdate; let fromdate;
let todate; let todate;
console.log('flag',flag); console.log('flag',flag);
@ -553,7 +541,7 @@ onChange(e :any,flag: any) {
let data = e.source.value.city_id; let data = e.source.value.city_id;
e.source._selected == true ? this.selectedCity.push(data) e.source._selected == true ? this.selectedCity.push(data)
: this.selectedCity.splice(this.selectedCity.indexOf(data),1); : this.selectedCity.splice(this.selectedCity.indexOf(data),1);
console.log(this.selectedCity);
} }
if(flag == 3){ if(flag == 3){
@ -561,14 +549,19 @@ onChange(e :any,flag: any) {
e.source._selected == true ? this.selectedLender.push(data) e.source._selected == true ? this.selectedLender.push(data)
: this.selectedLender.splice(this.selectedLender.indexOf(data),1); : this.selectedLender.splice(this.selectedLender.indexOf(data),1);
console.log(this.selectedLender);
} }
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedLender,this.selectedCity).subscribe(data => { // console.log('fromdate',fromdate);
// console.log('todate',todate);
// console.log('lenderarr',this.selectedLender);
// console.log('cityarr',this.selectedCity);
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedLender,this.selectedCity).subscribe(data => {
console.log(' *****Updated Date Doughnut Chart Data *****'); console.log(' *****Updated Date Doughnut Chart Data *****');
console.log('Whole Data',data); console.log('Whole Data',data);
if(data.records.current_month.length != 0){ if(data.records.current_month.length != 0){
@ -576,9 +569,13 @@ onChange(e :any,flag: any) {
this.total2 = 0; this.total2 = 0;
this.total3 = 0; this.total3 = 0;
} }
this.doughnutChartDataForFullPD = []; this.doughnutChartDataForFullPD = [];
this.doughnutChartDataForSmartPD = []; this.doughnutChartDataForSmartPD = [];
this.doughnutChartDataForTelePD = []; this.doughnutChartDataForTelePD = [];
this.tempDataFullPD = [];
this.tempDataSmartPD =[];
this.tempDataTelePD = [];
let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft');
@ -614,9 +611,8 @@ onChange(e :any,flag: any) {
if(TriggerFullPDvalue.length != '0'){ if(TriggerFullPDvalue.length != '0'){
for(let FPD of TriggerFullPDvalue){ for(let FPD of TriggerFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[TriggedIndexvalue] = +FPD.count;
this.tempDataFullPD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -626,9 +622,8 @@ onChange(e :any,flag: any) {
let AllocatedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedFullPDvalue.length != '0'){ if(AllocatedFullPDvalue.length != '0'){
for(let FPD of AllocatedFullPDvalue){ for(let FPD of AllocatedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[AllocatedIndexvalue] = +FPD.count;
this.tempDataFullPD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -638,9 +633,8 @@ onChange(e :any,flag: any) {
let ScheduledFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledFullPDvalue.length != '0'){ if(ScheduledFullPDvalue.length != '0'){
for(let FPD of ScheduledFullPDvalue){ for(let FPD of ScheduledFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[ScheduledIndexvalue] = +FPD.count;
this.tempDataFullPD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count; //let y = +ScheduledFullPDvalue.count;
@ -652,9 +646,8 @@ onChange(e :any,flag: any) {
let InProgressFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressFullPDvalue.length != '0'){ if(InProgressFullPDvalue.length != '0'){
for(let FPD of InProgressFullPDvalue){ for(let FPD of InProgressFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[InProgressIndexvalue] = +FPD.count;
this.tempDataFullPD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -666,9 +659,8 @@ onChange(e :any,flag: any) {
let CompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedFullPDvalue.length != '0'){ if(CompletedFullPDvalue.length != '0'){
for(let FPD of CompletedFullPDvalue){ for(let FPD of CompletedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[CompletedIndexvalue] = +FPD.count;
this.tempDataFullPD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -680,9 +672,8 @@ onChange(e :any,flag: any) {
let QCCompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedFullPDvalue.length != '0'){ if(QCCompletedFullPDvalue.length != '0'){
for(let FPD of QCCompletedFullPDvalue){ for(let FPD of QCCompletedFullPDvalue){
let y = +FPD.count;
this.total1 = this.total1+y; this.tempDataFullPD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataFullPD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -695,9 +686,8 @@ onChange(e :any,flag: any) {
if(DraftSmartPDvalue.length != '0'){ if(DraftSmartPDvalue.length != '0'){
//console.log('console triggered value',TriggerFullPDvalue); //console.log('console triggered value',TriggerFullPDvalue);
for(let FPD of DraftSmartPDvalue){ for(let FPD of DraftSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[DraftIndexvalue] = +FPD.count;
this.tempDataSmartPD[DraftIndexvalue] = y;
} }
} }
else{ else{
@ -708,9 +698,8 @@ onChange(e :any,flag: any) {
if(TriggerSmartPDvalue.length != '0'){ if(TriggerSmartPDvalue.length != '0'){
for(let FPD of TriggerSmartPDvalue){ for(let FPD of TriggerSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[TriggedIndexvalue] = +FPD.count;
this.tempDataSmartPD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -720,9 +709,8 @@ onChange(e :any,flag: any) {
let AllocatedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedSmartPDvalue.length != '0'){ if(AllocatedSmartPDvalue.length != '0'){
for(let FPD of AllocatedSmartPDvalue){ for(let FPD of AllocatedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[AllocatedIndexvalue] = +FPD.count;
this.tempDataSmartPD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -732,9 +720,8 @@ onChange(e :any,flag: any) {
let ScheduledSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledSmartPDvalue.length != '0'){ if(ScheduledSmartPDvalue.length != '0'){
for(let FPD of ScheduledSmartPDvalue){ for(let FPD of ScheduledSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[ScheduledIndexvalue] = +FPD.count;
this.tempDataSmartPD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count; //let y = +ScheduledFullPDvalue.count;
@ -746,9 +733,8 @@ onChange(e :any,flag: any) {
let InProgressSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressSmartPDvalue.length != '0'){ if(InProgressSmartPDvalue.length != '0'){
for(let FPD of InProgressSmartPDvalue){ for(let FPD of InProgressSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[InProgressIndexvalue] = +FPD.count;
this.tempDataSmartPD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -760,9 +746,8 @@ onChange(e :any,flag: any) {
let CompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedSmartPDvalue.length != '0'){ if(CompletedSmartPDvalue.length != '0'){
for(let FPD of CompletedSmartPDvalue){ for(let FPD of CompletedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[CompletedIndexvalue] = +FPD.count;
this.tempDataSmartPD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -774,9 +759,8 @@ onChange(e :any,flag: any) {
let QCCompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedSmartPDvalue.length != '0'){ if(QCCompletedSmartPDvalue.length != '0'){
for(let FPD of QCCompletedSmartPDvalue){ for(let FPD of QCCompletedSmartPDvalue){
let y = +FPD.count;
this.total2 = this.total2+y; this.tempDataSmartPD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataSmartPD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -790,9 +774,8 @@ onChange(e :any,flag: any) {
if(DraftTelePDvalue.length != '0'){ if(DraftTelePDvalue.length != '0'){
for(let FPD of DraftTelePDvalue){ for(let FPD of DraftTelePDvalue){
let y = +FPD.count;
this.total1 = this.total3+y; this.tempDataTelePD[DraftIndexvalue] = +FPD.count;
this.tempDataTelePD[DraftIndexvalue] = y;
} }
} }
else{ else{
@ -803,9 +786,8 @@ onChange(e :any,flag: any) {
if(TriggerTelePDvalue.length != '0'){ if(TriggerTelePDvalue.length != '0'){
//console.log('console triggered value',TriggerTelePDvalue); //console.log('console triggered value',TriggerTelePDvalue);
for(let FPD of TriggerTelePDvalue){ for(let FPD of TriggerTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[TriggedIndexvalue] = +FPD.count;
this.tempDataTelePD[TriggedIndexvalue] = y;
} }
} }
else{ else{
@ -815,9 +797,8 @@ onChange(e :any,flag: any) {
let AllocatedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); let AllocatedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'ALLOCATED');
if(AllocatedTelePDvalue.length != '0'){ if(AllocatedTelePDvalue.length != '0'){
for(let FPD of AllocatedTelePDvalue){ for(let FPD of AllocatedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[AllocatedIndexvalue] = +FPD.count;
this.tempDataTelePD[AllocatedIndexvalue] = y;
} }
} }
else{ else{
@ -827,9 +808,8 @@ onChange(e :any,flag: any) {
let ScheduledTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); let ScheduledTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'SCHEDULED');
if(ScheduledTelePDvalue.length != '0'){ if(ScheduledTelePDvalue.length != '0'){
for(let FPD of ScheduledTelePDvalue){ for(let FPD of ScheduledTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[ScheduledIndexvalue] = +FPD.count;
this.tempDataTelePD[ScheduledIndexvalue] = y;
} }
//let y = +ScheduledFullPDvalue.count; //let y = +ScheduledFullPDvalue.count;
@ -841,9 +821,8 @@ onChange(e :any,flag: any) {
let InProgressTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); let InProgressTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'INPROGRESS');
if(InProgressTelePDvalue.length != '0'){ if(InProgressTelePDvalue.length != '0'){
for(let FPD of InProgressTelePDvalue){ for(let FPD of InProgressTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[InProgressIndexvalue] = +FPD.count;
this.tempDataTelePD[InProgressIndexvalue] = y;
} }
//let y = +InProgressFullPDvalue.count; //let y = +InProgressFullPDvalue.count;
@ -855,9 +834,8 @@ onChange(e :any,flag: any) {
let CompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'COMPLETED'); let CompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'COMPLETED');
if(CompletedTelePDvalue.length != '0'){ if(CompletedTelePDvalue.length != '0'){
for(let FPD of CompletedTelePDvalue){ for(let FPD of CompletedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[CompletedIndexvalue] = +FPD.count;
this.tempDataTelePD[CompletedIndexvalue] = y;
} }
//let y = +CompletedFullPDvalue.count; //let y = +CompletedFullPDvalue.count;
@ -869,9 +847,8 @@ onChange(e :any,flag: any) {
let QCCompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); let QCCompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == "QC_COMPLETED");
if(QCCompletedTelePDvalue.length != '0'){ if(QCCompletedTelePDvalue.length != '0'){
for(let FPD of QCCompletedTelePDvalue){ for(let FPD of QCCompletedTelePDvalue){
let y = +FPD.count;
this.total3 = this.total3+y; this.tempDataTelePD[QCCompletedIndexvalue] = +FPD.count;
this.tempDataTelePD[QCCompletedIndexvalue] = y;
} }
//let y = +QCCompletedFullPDvalue.count; //let y = +QCCompletedFullPDvalue.count;
@ -884,22 +861,34 @@ onChange(e :any,flag: any) {
else{ else{
//console.log('Else Condition month'); //console.log('Else Condition month');
} }
this.doughnutChartDataForFullPD = this.tempDataFullPD;
this.doughnutChartDataForFullPD= this.tempDataFullPD;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
this.doughnutChartLabels = this.doughnutChartLabels;
this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0);
this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0);
this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0);
console.log('Canvas Full',this.FullCanvas) ;
console.log('Canvas Smart',this.SmartCanvas);
console.log('Canvas Tele',this.TeleCanvas);
this.FullCanvas.chart.update();
this.SmartCanvas.chart.update();
this.TeleCanvas.chart.update();
//: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed'];
console.log('Final full Data Completed',this.doughnutChartDataForFullPD); console.log('Final full Data Completed',this.doughnutChartDataForFullPD);
console.log('temp full Data',this.tempDataFullPD); console.log('temp full Data',this.tempDataFullPD);
console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD); console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD);
console.log('temp Smart Data',this.tempDataSmartPD); console.log('temp Smart Data',this.tempDataSmartPD);
console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD); console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD);
console.log('temp Tele Data',this.tempDataTelePD); console.log('temp Tele Data',this.tempDataTelePD);
console.log('total3',this.total3); console.log('total3',this.total3);
console.log('total2',this.total2); console.log('total2',this.total2);
console.log('total1',this.total1); console.log('total1',this.total1);
}) })
} }
} }

View File

@ -12,7 +12,7 @@
<div [formGroupName]="i"> <div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Assets Type" formControlName="assets_mode"> <mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Assets Type" formControlName="assets_mode" requried>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option> <mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -26,7 +26,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select placeholder="Property" formControlName="property_type"> <mat-select placeholder="Property" formControlName="property_type" required>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option> <mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -42,7 +42,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler"> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -56,7 +56,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler"> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -84,7 +84,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="consumer_durable_description"> <input matInput placeholder="Description" formControlName="consumer_durable_description" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -99,19 +99,19 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Type" formControlName="insurance_type"> <mat-select placeholder="Type" formControlName="insurance_type" required>
<mat-option *ngFor="let ins_type of m_insuranceType" [value]="ins_type.id">{{ ins_type.name }}</mat-option> <mat-option *ngFor="let ins_type of m_insuranceType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Premium Paid" formControlName="premium_paid"> <input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Frequency" formControlName="frequency_mode"> <mat-select placeholder="Frequency" formControlName="frequency_mode" required>
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option> <mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -120,12 +120,12 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Sum Assured" formControlName="sum_assured"> <input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Members Covered" formControlName="members_coverd"> <input matInput placeholder="Members Covered" formControlName="members_coverd" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -141,19 +141,19 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Type" formControlName="investments_type"> <mat-select placeholder="Type" formControlName="investments_type" required>
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option> <mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest"> <input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Bank Name" formControlName="bank_name"> <input matInput placeholder="Bank Name" formControlName="bank_name" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -168,7 +168,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets"> <input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -181,7 +181,7 @@
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4"> <div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value"> <input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -217,7 +217,7 @@
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="EMI Paid" formControlName="emi_paid"> <input matInput placeholder="EMI Paid" formControlName="emi_paid" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">

View File

@ -640,6 +640,15 @@ public m_investmentType = [];
arr.controls.splice(0); arr.controls.splice(0);
this.getPdSupplierFormDetails(); this.getPdSupplierFormDetails();
} }
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9\-\.\ ]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
// { // {
// 'main_raw_materials': 'sdkjfal', // 'main_raw_materials': 'sdkjfal',
// 'supplier_details' ; [ // 'supplier_details' ; [

View File

@ -2,25 +2,25 @@
<p>Business Details</p> <p>Business Details</p>
<form [formGroup]="businessForm" class="address"> <form [formGroup]="businessForm" class="address">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Name of Business / Profession" formControlName="profession_name"> <input matInput placeholder="Name of Business / Profession" formControlName="profession_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="How many years in business" formControlName="business_years"> <input matInput placeholder="How many years in business" formControlName="business_years" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Industry" <mat-select placeholder="Industry"
formControlName="industry"> formControlName="industry" required>
<mat-option value="{{list.industry_classification_id}}" *ngFor="let list of industryData">{{list.name}}</mat-option> <mat-option value="{{list.industry_classification_id}}" *ngFor="let list of industryData">{{list.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Type of Activity" <mat-select placeholder="Type of Activity"
formControlName="type_of_activity"> formControlName="type_of_activity" requried>
<mat-option value="{{type.type_of_activity_id}}" *ngFor="let type of activityData">{{type.name}}</mat-option> <mat-option value="{{type.type_of_activity_id}}" *ngFor="let type of activityData">{{type.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Seasonality" formControlName="seasonality"> <input matInput placeholder="Seasonality" formControlName="seasonality" required>
</mat-form-field> </mat-form-field>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -32,10 +32,10 @@
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="card"> <mat-card-content class="card">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Name" formControlName="sec_name"> <input matInput placeholder="Name" formControlName="sec_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Designation" formControlName="sec_designation"> <input matInput placeholder="Designation" formControlName="sec_designation" required>
</mat-form-field> </mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addDesignation()" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addDesignation()"
matTooltip="Add More Designation" matTooltipPosition="above" color="primary" *ngIf="i==0"> matTooltip="Add More Designation" matTooltipPosition="above" color="primary" *ngIf="i==0">
@ -51,14 +51,14 @@
</mat-card> </mat-card>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Who started the business / professions" <mat-select placeholder="Who started the business / professions"
formControlName="who_started"> formControlName="who_started" required>
<mat-option value="applicant">Started by Applicant</mat-option> <mat-option value="applicant">Started by Applicant</mat-option>
<mat-option value="family_business">Family Business</mat-option> <mat-option value="family_business">Family Business</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Main person running the businesss" <mat-select placeholder="Main person running the businesss"
formControlName="main_person"> formControlName="main_person" required>
<mat-option value="applicants">One of the applicants</mat-option> <mat-option value="applicants">One of the applicants</mat-option>
<mat-option value="Relative">Relative of an applicant</mat-option> <mat-option value="Relative">Relative of an applicant</mat-option>
<mat-option value="Others">Others</mat-option> <mat-option value="Others">Others</mat-option>
@ -70,17 +70,17 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select multiple placeholder="Other family members invovled" <mat-select multiple placeholder="Other family members invovled"
formControlName="family_members_involved" (selectionChange)="relationChanged($event)"> formControlName="family_members_involved" (selectionChange)="relationChanged($event)" required>
<mat-option value="{{member.relationship_id}}" *ngFor="let member of relationData">{{member.name}}</mat-option> <mat-option value="{{member.relationship_id}}" *ngFor="let member of relationData">{{member.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Any other business before" <input matInput placeholder="Any other business before"
formControlName="before_business"> formControlName="before_business" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Any delays" <input matInput placeholder="Any delays"
formControlName="any_delays"> formControlName="any_delays" required>
</mat-form-field> </mat-form-field>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -93,19 +93,19 @@
<mat-card-content class="card"> <mat-card-content class="card">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Name" <input matInput placeholder="Name"
formControlName="partner_name"> formControlName="partner_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Share of Profit / Shareholding" <input matInput placeholder="Share of Profit / Shareholding"
formControlName="shareholding"> formControlName="shareholding" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="No. of yrs in this business" <input matInput placeholder="No. of yrs in this business"
formControlName="current_business_experiance"> formControlName="current_business_experiance" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Total Business Experience" <input matInput placeholder="Total Business Experience"
formControlName="total_business_experiance"> formControlName="total_business_experiance" required>
</mat-form-field> </mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addPartnerDetails()" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addPartnerDetails()"
matTooltip="Add More Partners / Directors / Shareholders" matTooltipPosition="above" color="primary" *ngIf="i==0"> matTooltip="Add More Partners / Directors / Shareholders" matTooltipPosition="above" color="primary" *ngIf="i==0">
@ -127,15 +127,15 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Total" <input matInput placeholder="Total"
formControlName="employees_total"> formControlName="employees_total" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Permanent" <input matInput placeholder="Permanent"
formControlName="employees_permanent"> formControlName="employees_permanent" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Temporary" <input matInput placeholder="Temporary"
formControlName="employees_temporary"> formControlName="employees_temporary" required>
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
@ -147,15 +147,15 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Total" <input matInput placeholder="Total"
formControlName="officer_total"> formControlName="officer_total" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Permanent" <input matInput placeholder="Permanent"
formControlName="officer_permanent"> formControlName="officer_permanent" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Temporary" <input matInput placeholder="Temporary"
formControlName="officer_temporary"> formControlName="officer_temporary" required>
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
@ -167,11 +167,11 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Amount Invested by Applicant" <input matInput placeholder="Amount Invested by Applicant"
formControlName="invested_amount"> formControlName="invested_amount" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Monthly Working Capital Needed" <input matInput placeholder="Monthly Working Capital Needed"
formControlName="working_capital"> formControlName="working_capital" required>
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
@ -184,7 +184,7 @@
<mat-form-field> <mat-form-field>
<mat-select <mat-select
placeholder="Is the location of the business / profession suited to the nature of business / service provided? " placeholder="Is the location of the business / profession suited to the nature of business / service provided? "
formControlName="is_service_provided"> formControlName="is_service_provided" required>
<mat-option value="well_suited.">Well Suited.</mat-option> <mat-option value="well_suited.">Well Suited.</mat-option>
<mat-option value="fairly_suited">Fairly Suited</mat-option> <mat-option value="fairly_suited">Fairly Suited</mat-option>
<mat-option value="not_suited">Not Suited</mat-option> <mat-option value="not_suited">Not Suited</mat-option>
@ -200,7 +200,7 @@
<mat-card-content class="matcards"> <mat-card-content class="matcards">
<mat-form-field> <mat-form-field>
<mat-select placeholder="What is the ownership of the setup ?" <mat-select placeholder="What is the ownership of the setup ?"
formControlName="ownership_setup"> formControlName="ownership_setup" required>
<mat-option value="self_owned">self owned</mat-option> <mat-option value="self_owned">self owned</mat-option>
<mat-option value="rented">Rented</mat-option> <mat-option value="rented">Rented</mat-option>
<mat-option value="family_owned">Family Owned</mat-option> <mat-option value="family_owned">Family Owned</mat-option>
@ -213,7 +213,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="businessForm.controls['ownership_setup'].value == 'rented'"> <mat-form-field *ngIf="businessForm.controls['ownership_setup'].value == 'rented'">
<input matInput placeholder="Provide Rent Paid?" <input matInput placeholder="Provide Rent Paid?"
formControlName="rent_paid"> formControlName="rent_paid" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
@ -225,56 +225,56 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Shop and Eat Act Cert" <mat-select placeholder="Shop and Eat Act Cert"
formControlName="shop_eat_act_cert"> formControlName="shop_eat_act_cert" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="GST Regn Cert" <mat-select placeholder="GST Regn Cert"
formControlName="gst_Regn_cert"> formControlName="gst_Regn_cert" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Export / Import cert" <mat-select placeholder="Export / Import cert"
formControlName="export_import_cert"> formControlName="export_import_cert" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Factory Cert" <mat-select placeholder="Factory Cert"
formControlName="factory_cert"> formControlName="factory_cert" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Cert of Practice" <mat-select placeholder="Cert of Practice"
formControlName="practice_cert"> formControlName="practice_cert" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="PF Regn" <mat-select placeholder="PF Regn"
formControlName="pf_regn"> formControlName="pf_regn" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="ESIC Regn" <mat-select placeholder="ESIC Regn"
formControlName="esic_regn"> formControlName="esic_regn" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Do you want to add other documents?" <mat-select placeholder="Do you want to add other documents?"
formControlName="other_documents"> formControlName="other_documents" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
@ -302,7 +302,7 @@
<div fxFlex="60" class="pb-0 text-sm-left"> <div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="business_remarks"></textarea> <textarea matInput placeholder="Remarks" formControlName="business_remarks" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>

View File

@ -293,4 +293,15 @@ export class BusinessInfoComponent implements OnInit {
} }
}); });
} }
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
} }

View File

@ -9,34 +9,36 @@
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Client Name" formControlName="client_name"> <input matInput placeholder="Client Name" formControlName="client_name" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Person Name" formControlName="contact_person"> <input matInput placeholder="Contact Person Name" formControlName="contact_person" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Mobile Number" formControlName="mobile_number"> <input matInput placeholder="Contact Mobile Number" formControlName="mobile_number" (keypress)="keyPress($event)" minlength=10 maxlength=10 required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!-- <mat-error *ngIf="sup.controls['mobile_number'].hasError('requried') && sup.controls['mobile_number'].touched" class="mat-text-warn">Mobile Number Requried</mat-error> -->
<mat-error *ngIf="sup.controls['mobile_number'].hasError('minlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
<mat-error *ngIf="sup.controls['mobile_number'].hasError('maxlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div> <div>
<mat-form-field> <mat-form-field>
<mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode"> <mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode" required>
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option> <mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3"> <div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment"> <input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment" type="number" min="0">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
@ -50,7 +52,7 @@
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div> <div>
<mat-form-field> <mat-form-field>
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase"> <mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase" required>
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option> <mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>

View File

@ -177,7 +177,7 @@ apiLoadFinish: boolean = false;
return this._formBuilder.group({ return this._formBuilder.group({
client_name: ['', Validators.compose([Validators.required])], client_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])], contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required])], mobile_number: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: ['', Validators.compose([Validators.required])], payment_mode: ['', Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[''], per_of_immediate_advance_payment:[''],
credit_period:[''], credit_period:[''],
@ -190,7 +190,7 @@ apiLoadFinish: boolean = false;
return this._formBuilder.group({ return this._formBuilder.group({
client_name: [data.client_name, Validators.compose([Validators.required])], client_name: [data.client_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])], contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required])], mobile_number: [data.mobile_number, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])], payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''], per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''],
credit_period:[data.credit_period || ''], credit_period:[data.credit_period || ''],
@ -280,6 +280,15 @@ var result = Object.keys(supp_data).map(function(key) {
onReset() { onReset() {
// this._addQuesFrom.reset(); // this._addQuesFrom.reset();
} }
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
// { // {
// 'main_raw_materials': 'sdkjfal', // 'main_raw_materials': 'sdkjfal',

View File

@ -4,7 +4,7 @@
<p>Family Details</p> <p>Family Details</p>
<form class="address" [formGroup]="familyForm"> <form class="address" [formGroup]="familyForm">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Person Met" formControlName="person"> <mat-select placeholder="Person Met" formControlName="person" required>
<mat-option *ngFor="let personMet of personMetData" [value]="personMet.person_met_id"> <mat-option *ngFor="let personMet of personMetData" [value]="personMet.person_met_id">
{{personMet.person_met_name}} {{personMet.person_met_name}}
</mat-option> </mat-option>
@ -14,7 +14,7 @@
<input matInput placeholder="Enter the relationship" formControlName="personOther"> <input matInput placeholder="Enter the relationship" formControlName="personOther">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="No. Of Family Members" formControlName="members"> <input matInput placeholder="No. Of Family Members" formControlName="members" required>
</mat-form-field> </mat-form-field>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -111,13 +111,13 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Residence Address" <input matInput placeholder="Residence Address"
formControlName="residence"> formControlName="residence" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="No.of yrs" formControlName="years"> <input matInput placeholder="No.of yrs" formControlName="years" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Ownership" formControlName="ownership"> <mat-select placeholder="Ownership" formControlName="ownership" required>
<mat-option value="{{ownerShip.id}}" <mat-option value="{{ownerShip.id}}"
*ngFor="let ownerShip of ownerShipData"> *ngFor="let ownerShip of ownerShipData">
{{ownerShip.name}} {{ownerShip.name}}

View File

@ -10,22 +10,22 @@
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year"> <input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number"> <input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number"> <input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Margin" formControlName="financial_margin"> <input matInput placeholder="Margin" formControlName="financial_margin" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="i != 0"> <mat-form-field *ngIf="i != 0">
<input matInput [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation"> <input matInput [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Reason For Major Difference" formControlName="financial_reason"> <input matInput placeholder="Reason For Major Difference" formControlName="financial_reason" required>
</mat-form-field> </mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addDate()" <button type="button" mat-raised-button mat-icon-button (click)="addDate()"
@ -49,22 +49,22 @@
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year"> <input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" type="number"> <input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" type="number" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit / Loss" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" type="number"> <input matInput placeholder="Net Profit / Loss" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" type="number" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput disabled placeholder="Margin" formControlName="estimate_margin"> <input matInput disabled placeholder="Margin" formControlName="estimate_margin" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="i != 0"> <mat-form-field *ngIf="i != 0">
<input matInput [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year" formControlName="estimate_variation"> <input matInput [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year" formControlName="estimate_variation" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Reason For Major Difference" formControlName="estimate_reason"> <input matInput placeholder="Reason For Major Difference" formControlName="estimate_reason" required>
</mat-form-field> </mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addGoods()" <button type="button" mat-raised-button mat-icon-button (click)="addGoods()"
matTooltip="Add More Estimated Value" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0"> matTooltip="Add More Estimated Value" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
@ -82,7 +82,7 @@
<div fxFlex="60" class="pb-0 text-sm-left"> <div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="financial_remarks"></textarea> <textarea matInput placeholder="Remarks" formControlName="financial_remarks" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>

View File

@ -191,4 +191,14 @@ export class FinancialInfoComponent implements OnInit {
} }
}); });
} }
/** On Key Press Event For Input Field */
keyPress(event: any) {
const pattern = /[0-9\-\.\ ]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
} }

View File

@ -21,7 +21,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<input matInput placeholder="Age" formControlName="age_ans" type="text" required> <input matInput placeholder="Age" formControlName="age_ans" type="text" required (keypress)="keyPress($event)">
<mat-error *ngIf="mainDetails['controls'].age_ans.hasError('pattern') || mainDetails['controls'].age_ans.hasError('maxlength') || mainDetails['controls'].age_ans.hasError('minlength')">Enter Valid Age. </mat-error> <mat-error *ngIf="mainDetails['controls'].age_ans.hasError('pattern') || mainDetails['controls'].age_ans.hasError('maxlength') || mainDetails['controls'].age_ans.hasError('minlength')">Enter Valid Age. </mat-error>
</mat-form-field> </mat-form-field>

View File

@ -292,5 +292,14 @@ validateAllFormFields(formGroup: any) {
}); });
} }
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
} }

View File

@ -19,56 +19,57 @@
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="30"> <div fxFlex="30">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Supplier Name" formControlName="supplier_name"> <input matInput placeholder="Supplier Name" formControlName="supplier_name" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!-- <mat-error *ngIf="sup.controls['supplier_name'].hasError('required') && sup.controls['supplier_name'].touched" class="mat-text-warn">Supplier Name Required.</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="30"> <div fxFlex="30">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Person Name" formControlName="contact_person"> <input matInput placeholder="Contact Person Name" formControlName="contact_person" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!-- <mat-error *ngIf="sup.controls['contact_person'].hasError('required') && sup.controls['contact_person'].touched" class="mat-text-warn">Contact Person Name Required.</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="30"> <div fxFlex="30">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Mobile Number" formControlName="mobile_number"> <input matInput placeholder="Contact Mobile Number" formControlName="mobile_number" (keypress)="keyPress($event)" minlength=10 maxlength=10 required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!-- <mat-error *ngIf="sup.controls['mobile_number'].hasError('requried') && sup.controls['mobile_number'].touched" class="mat-text-warn">Mobile Number Requried</mat-error> -->
<mat-error *ngIf="sup.controls['mobile_number'].hasError('minlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
<mat-error *ngIf="sup.controls['mobile_number'].hasError('maxlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Vaild Mobile Number Requried</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="14px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="14px" fxLayoutAlign="start none">
<div fxFlex="30"> <div fxFlex="30">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode"> <mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode" required>
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option> <mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3" fxFlex="30"> <div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3" fxFlex="30">
<mat-form-field class="ml-xs example-full-width" > <mat-form-field class="ml-xs example-full-width" >
<input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment"> <input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment" type="number" min="0">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('payment_mode').value == 2 || sup.get('payment_mode').value == 3" fxFlex="30"> <div *ngIf="sup.get('payment_mode').value == 2 || sup.get('payment_mode').value == 3" fxFlex="30">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Credit Period" formControlName="credit_period"> <input matInput placeholder="Credit Period" formControlName="credit_period">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutGap="14px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="14px" fxLayoutAlign="start none">
<div fxFlex="30"> <div fxFlex="30">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase"> <mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase" required>
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option> <mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
</mat-select> </mat-select>
<!-- <mat-error *ngIf="sup.controls['frequency_of_purchase'].hasError('required') && sup.controls['frequency_of_purchase'].touched" class="mat-text-warn">PaymentMode Type Required.</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('frequency_of_purchase').value == 8" fxFlex="30"> <div *ngIf="sup.get('frequency_of_purchase').value == 8" fxFlex="30">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value"> <input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field> </mat-form-field>
</div> </div>

View File

@ -179,7 +179,7 @@ apiLoadFinish: boolean = false;
return this._formBuilder.group({ return this._formBuilder.group({
supplier_name: ['', Validators.compose([Validators.required])], supplier_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])], contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required])], mobile_number: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: ['', Validators.compose([Validators.required])], payment_mode: ['', Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[''], per_of_immediate_advance_payment:[''],
credit_period:[''], credit_period:[''],
@ -192,7 +192,7 @@ apiLoadFinish: boolean = false;
return this._formBuilder.group({ return this._formBuilder.group({
supplier_name: [data.supplier_name, Validators.compose([Validators.required])], supplier_name: [data.supplier_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])], contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required])], mobile_number: [data.mobile_number, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])], payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''], per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''],
credit_period:[data.credit_period || ''], credit_period:[data.credit_period || ''],
@ -284,6 +284,16 @@ apiLoadFinish: boolean = false;
// this._addQuesFrom.reset(); // this._addQuesFrom.reset();
} }
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
// { // {
// 'main_raw_materials': 'sdkjfal', // 'main_raw_materials': 'sdkjfal',
// 'supplier_details' ; [ // 'supplier_details' ; [