diff --git a/ng-seed/package-lock.json b/ng-seed/package-lock.json index 17a43eb..f55e94e 100644 --- a/ng-seed/package-lock.json +++ b/ng-seed/package-lock.json @@ -1,7 +1,7 @@ { "name": "optima", "version": "3.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, "dependencies": { "@agm/core": { @@ -6203,7 +6203,6 @@ "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", - "devOptional": true, "requires": { "prr": "~1.0.1" } @@ -7182,8 +7181,7 @@ "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "devOptional": true + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "hammerjs": { "version": "2.0.8", @@ -9015,7 +9013,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "devOptional": true, "requires": { "pify": "^4.0.1", "semver": "^5.6.0" @@ -9253,8 +9250,7 @@ "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "devOptional": true + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { "version": "1.52.0", @@ -9716,6 +9712,14 @@ } } }, + "ngx-spinner": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ngx-spinner/-/ngx-spinner-10.0.1.tgz", + "integrity": "sha512-3fkzS4t+oKg1jobUmWxeGD3zLymdIOMijib517tgrDnW4Q2fKKwZPVCfTR5ztm9G0/l9G/DRoOoBcHPPupUBdg==", + "requires": { + "tslib": "^2.0.0" + } + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -10845,8 +10849,7 @@ "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "devOptional": true + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, "pinkie": { "version": "2.0.4", @@ -11717,8 +11720,7 @@ "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", - "devOptional": true + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==" }, "psl": { "version": "1.9.0", @@ -13733,15 +13735,6 @@ } } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -13752,6 +13745,15 @@ "strip-ansi": "^6.0.1" } }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -15761,15 +15763,6 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -15798,6 +15791,15 @@ } } }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", diff --git a/ng-seed/package.json b/ng-seed/package.json index e1f6e68..f811200 100644 --- a/ng-seed/package.json +++ b/ng-seed/package.json @@ -53,6 +53,7 @@ "ngx-perfect-scrollbar": "10.1.0", "ngx-scrollbar": "^7.5.6", "ngx-sortablejs": "^3.1.4", + "ngx-spinner": "^10.0.1", "ornamentum": "^8.1.4", "perfect-scrollbar": "^1.5.0", "primeflex": "^3.3.0", diff --git a/ng-seed/src/app/app.component.html b/ng-seed/src/app/app.component.html index b6931b5..37460b0 100644 --- a/ng-seed/src/app/app.component.html +++ b/ng-seed/src/app/app.component.html @@ -1,3 +1,5 @@

{{title}}

+ + diff --git a/ng-seed/src/app/appoinment/business/add-business/add-business.component.html b/ng-seed/src/app/appoinment/business/add-business/add-business.component.html index 37c3d1f..d6d0829 100644 --- a/ng-seed/src/app/appoinment/business/add-business/add-business.component.html +++ b/ng-seed/src/app/appoinment/business/add-business/add-business.component.html @@ -13,17 +13,20 @@ - + Please enter a valid email address + email is required Email is required - - Contact No is required + + Contact No is required + Invalid Contact No + Contact No must be at least 10 characters Limit exceed @@ -46,8 +49,8 @@ Working Hrs is required Limit exceed --> - - +
+ Add Admin diff --git a/ng-seed/src/app/appoinment/business/add-business/add-business.component.scss b/ng-seed/src/app/appoinment/business/add-business/add-business.component.scss index ad079c5..add3369 100644 --- a/ng-seed/src/app/appoinment/business/add-business/add-business.component.scss +++ b/ng-seed/src/app/appoinment/business/add-business/add-business.component.scss @@ -59,4 +59,20 @@ } :ng-deep .ng-scroll-viewport-wrapper{ right: -25px !important; -} \ No newline at end of file +} + +input[type=file]::file-selector-button { + margin-right: 20px; + border: none; + background: #084cdf; + padding: 10px 20px; + border-radius: 10px; + + color: #fff; + cursor: pointer; + transition: background .2s ease-in-out; + } + + input[type=file]::file-selector-button:hover { + background: #0d45a5; + } \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts b/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts index 4b4942a..bda1e66 100644 --- a/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts +++ b/ng-seed/src/app/appoinment/business/add-business/add-business.component.ts @@ -77,8 +77,8 @@ export class AddBusinessComponent implements OnInit { ngOnInit() { let userrole = localStorage.getItem('user_role') this.form = new FormGroup({ - admin_checked: new FormControl('', [Validators.required]), - workingHrsJson: new FormControl('', [Validators.required]), + admin_checked: new FormControl('',null), + logo: new FormControl('', null), busName: new FormControl('', [Validators.required, Validators.maxLength(20)]), address: new FormControl('', [Validators.required, Validators.maxLength(50)]), @@ -87,7 +87,7 @@ export class AddBusinessComponent implements OnInit { email: new FormControl('', [Validators.required, Validators.email,Validators.pattern( '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$', ),]), - contactNo: new FormControl('', [Validators.required, Validators.maxLength(10)]), + contactNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10), Validators.pattern('^[0-9]{10}$')]), createdBy:new FormControl(userrole,[Validators.required]), }); @@ -101,7 +101,11 @@ export class AddBusinessComponent implements OnInit { submit(){ let tmp = this.form.value tmp.id = this.local_data.id - console.log(tmp) + console.log(tmp,this.form) + if (!this.form.valid) { + console.log("check") + return; + } // this.formData.append('image', this.currentFileUpload); // console.log(this.formData.getAll('image')); if(this.action == 'Update'){ diff --git a/ng-seed/src/app/appoinment/business/business-list/business-list.component.html b/ng-seed/src/app/appoinment/business/business-list/business-list.component.html index d858db6..86a0155 100644 --- a/ng-seed/src/app/appoinment/business/business-list/business-list.component.html +++ b/ng-seed/src/app/appoinment/business/business-list/business-list.component.html @@ -1,24 +1,25 @@

Business Details

- + Filter - + +
- - -
+ + S.No - {{i+1}} + {{row.id}} @@ -55,25 +56,26 @@ Action - edit - delete + edit + delete +
- +
+ +
- - + + -
- - -
+
No Data Available
diff --git a/ng-seed/src/app/appoinment/business/business-list/business-list.component.scss b/ng-seed/src/app/appoinment/business/business-list/business-list.component.scss index 7f0f260..5a04508 100644 --- a/ng-seed/src/app/appoinment/business/business-list/business-list.component.scss +++ b/ng-seed/src/app/appoinment/business/business-list/business-list.component.scss @@ -27,8 +27,8 @@ th.mat-header-cell, td.mat-cell, td.mat-footer-cell { box-shadow: none!important; } img { - width: 30px; - height: 30px; + width: 40px; + height: 40px; border-radius: 50%; } .fullscreen{ @@ -82,4 +82,31 @@ img { /* overflow: auto; */ overflow-x: hidden; overflow-y: auto; - } \ No newline at end of file + } + + .mat-table { + overflow: auto; + max-height: 500px; + } + + .example-container { + display: flex; + flex-direction: column; + min-width: 300px; + } + + .example-header { + min-height: 64px; + padding: 8px 24px 0; + } + + .mat-form-field { + font-size: 14px; + width: 100%; + } + + .mat-table { + overflow: auto; + max-height: 500px; + } + \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/business/business-list/business-list.component.ts b/ng-seed/src/app/appoinment/business/business-list/business-list.component.ts index cf1764d..f5ce091 100644 --- a/ng-seed/src/app/appoinment/business/business-list/business-list.component.ts +++ b/ng-seed/src/app/appoinment/business/business-list/business-list.component.ts @@ -24,6 +24,7 @@ export class BusinessListComponent implements OnInit { @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; recordStatus: boolean; + @ViewChild(MatTable,{static:true}) table: MatTable // pagination variable details length = 5; diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.html b/ng-seed/src/app/appoinment/user/add-user/add-user.component.html index 27ee5f5..0af0936 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.html +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.html @@ -2,16 +2,17 @@
{{action}} Users
- +
- + + + Business -- @@ -19,9 +20,9 @@ {{business.busName}} - role is required + business is required - --> + Role @@ -51,8 +52,10 @@ Phone No - + Contact No is required + Invalid Contact No + Contact No must be at least 10 characters Limit exceed @@ -62,20 +65,21 @@ Limit exceed - + +
-
+ Sure to delete {{local_data.name}}?
diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.scss b/ng-seed/src/app/appoinment/user/add-user/add-user.component.scss index d25aaa5..cb5c7cd 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.scss +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.scss @@ -34,4 +34,21 @@ } .scrollHV { height: calc(100vh - 190px); -} \ No newline at end of file +} + + +input[type=file]::file-selector-button { + margin-right: 20px; + border: none; + background: #084cdf; + padding: 10px 20px; + border-radius: 10px; + + color: #fff; + cursor: pointer; + transition: background .2s ease-in-out; + } + + input[type=file]::file-selector-button:hover { + background: #0d45a5; + } \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts index 3fc573b..5014b90 100644 --- a/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts +++ b/ng-seed/src/app/appoinment/user/add-user/add-user.component.ts @@ -3,6 +3,7 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms' import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { BusinessService } from 'app/appoinment/business/business-service/business.service'; + export interface UsersData { userName: string; id: number; @@ -31,6 +32,7 @@ export class AddUserComponent implements OnInit { @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService) { console.log(data); this.local_data = {...data}; + this.action = this.local_data.action; this.formData= new FormData(); this.getBusinessList() @@ -43,9 +45,12 @@ export class AddUserComponent implements OnInit { let businessFilter = res['data'].filter(val => val.busName) this.businessList = businessFilter; let data = localStorage.getItem('busName') - this.form.controls['businessselect'].setValue(data) + // this.form.controls['businessselect'].setValue(data) console.log(this.businessList) console.log(this.form['value'].businessselect) + this.local_data.businessselect = this.local_data.busId + + this.form.patchValue(this.local_data) } } // , error => {this.errorMessage = error}); @@ -74,7 +79,8 @@ export class AddUserComponent implements OnInit { businessselect: new FormControl('',[Validators.required]), role: new FormControl('', [Validators.required, Validators.maxLength(20)]), userName: new FormControl('', [Validators.required, Validators.maxLength(20)]), - contactNo: new FormControl('', [Validators.required, Validators.maxLength(20)]), + // contactNo: new FormControl('', [Validators.required, Validators.maxLength(20)]), + contactNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10), Validators.pattern('^[0-9]{10}$')]), // lastName: new FormControl('', [Validators.required, Validators.maxLength(20)]), email: new FormControl('', [Validators.required, Validators.email,Validators.pattern( '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$', @@ -84,7 +90,13 @@ export class AddUserComponent implements OnInit { // confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]), createdBy:new FormControl(userrole,[Validators.required]), }); + console.log(this.local_data); + this.local_data.businessselect = this.local_data.busId + this.form.patchValue(this.local_data) + setTimeout(() => { + this.form.patchValue(this.local_data) + }, 500); } public myError = (controlName: string, errorName: string) =>{ return this.form.controls[controlName].hasError(errorName); @@ -113,6 +125,9 @@ export class AddUserComponent implements OnInit { } submit(){ console.log(this.form.value); + if (!this.form.valid) { + return; + } let tmp = this.form.value tmp.id = this.local_data.id console.log(this.formData.getAll('image')); diff --git a/ng-seed/src/app/appoinment/user/user-list/user-list.component.html b/ng-seed/src/app/appoinment/user/user-list/user-list.component.html index 06ca6a4..49302aa 100644 --- a/ng-seed/src/app/appoinment/user/user-list/user-list.component.html +++ b/ng-seed/src/app/appoinment/user/user-list/user-list.component.html @@ -1,26 +1,43 @@ - -

Users Details

- - Filter - - + + Filter + + + + Business + + All + + {{business.busName}} + + + + + + + Role + + All + SADMIN + PRACTITIONER + BADMIN + + + + + + + -
-
-
- - - -
- +
+
+
+ + + +
@@ -35,11 +52,12 @@ - + @@ -86,13 +104,24 @@
S.No {{element.role}} User Name {{element.userName}}
-
-
-
-
- -
-
-
-
- \ No newline at end of file +
+ + +
+ + + + + +
No Data Available
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/user-list/user-list.component.scss b/ng-seed/src/app/appoinment/user/user-list/user-list.component.scss index 4905702..221b1c2 100644 --- a/ng-seed/src/app/appoinment/user/user-list/user-list.component.scss +++ b/ng-seed/src/app/appoinment/user/user-list/user-list.component.scss @@ -85,4 +85,117 @@ img { } .mat-elevation-z8 { box-shadow: none!important; -} \ No newline at end of file +} + +.my-table{ + width: 100%; +} +.button{ + float: right; + background-color: #4caf50; + color: #ffff; +} +th.mat-header-cell, td.mat-cell, td.mat-footer-cell { + padding: 6px; + border-bottom-width: 1px; + border-bottom-style: solid; +} +.mat-expansion-panel-header { + display: inline!important; +} +::ng-deep .mat-drawer-content { + overflow: hidden!important; + background-color: #ffff; +} +// ::ng-deep .body-container { +// overflow-x: hidden; +// overflow-y: hidden; +// background-color: #ffff; +// } +::ng-deep .mat-expansion-panel:not([class*='mat-elevation-z']) { + box-shadow: none!important; +} +img { + width: 40px; + height: 40px; + border-radius: 50%; + } + .fullscreen{ + position: absolute !important; + height: auto !important; + top: 0; + left: 0; + right: 0; + bottom: 0; + } + tr.mat-header-row { + height: 30px!important; +} +.font-color{ + font-weight: 600; + font-size: 14px; +} +.edit-color{ + color: rgba(0, 0, 0, 0.54); +} +.edit-color:hover { + color: #4caf50; + } + .delete:hover { + color:#ff0000; + } +// ::ng-deep .mat-form-field-appearance-legacy .mat-form-field-wrapper { +// width: 180%; +// } + +::ng-deep .mat-content { + display: block!important; + flex: 1; + /* flex-direction: row; */ + /* overflow: hidden; */ + overflow-x: auto!important; + overflow-y: auto!important; +} +::ng-deep .mat-select-arrow { + margin: 0 15px!important; +} +::ng-deep .mat-paginator { + margin-top: -10px!important; +} +::ng-deep body.swal2-height-auto { + height: 100% !important + } + .example-container { + display: block; + height: 348px; + /* overflow: auto; */ + overflow-x: hidden; + overflow-y: auto; + } + + .mat-table { + overflow: auto; + max-height: 500px; + } + + .example-container { + display: flex; + flex-direction: column; + min-width: 300px; + } + + .example-header { + min-height: 64px; + padding: 8px 24px 0; + } + + .mat-form-field { + font-size: 14px; + width: 100%; + } + + .mat-table { + overflow: auto; + max-height: 500px; + } + \ No newline at end of file diff --git a/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts b/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts index 19657db..428a34d 100644 --- a/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts +++ b/ng-seed/src/app/appoinment/user/user-list/user-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { MatPaginator } from '@angular/material/paginator'; +import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { MatTable, MatTableDataSource } from '@angular/material/table'; import { NotifierService } from 'angular-notifier'; @@ -8,6 +8,7 @@ import Swal from 'sweetalert2/dist/sweetalert2.js'; import { AddUserComponent } from '../add-user/add-user.component'; import { UserService } from '../user-service/user.service'; import { environment } from 'environments/environment'; +import { BusinessService } from 'app/appoinment/business/business-service/business.service'; export interface UsersData { id: number; @@ -43,14 +44,23 @@ const ELEMENT_DATA: UsersData[] = [ }) export class UserListComponent implements OnInit { push: any; - displayedColumns: string[] = ['id','logo', 'role', 'Username', 'Password', 'mobile_no', 'email', 'action']; + displayedColumns: string[] = ['id','logo', 'role', 'busId','Username', 'Password', 'mobile_no', 'email', 'action']; dataSource: any; addFormData: any; - public usersList:any = new MatTableDataSource(); + length = 5; + pageIndex = 0; + pageSize = 5; + pageEvent: PageEvent; + public usersList = new MatTableDataSource(); + @ViewChild(MatTable,{static:true}) table: MatTable; + @ViewChild(MatPaginator) paginator: MatPaginator; private apiUrl = environment.apiEndpoint; - constructor(private notifierService: NotifierService,public dialog: MatDialog, public _use:UserService) { + recordStatus: boolean= true; + usersListLength: any=5; + businessList: any; + constructor(private notifierService: NotifierService,public dialog: MatDialog, public _use:UserService,public _bus:BusinessService) { let open_go_admin = localStorage.getItem('go_admin') if(open_go_admin == '0'){ this.openDialog('Add',{}) @@ -62,23 +72,21 @@ export class UserListComponent implements OnInit { ngOnInit(): void { // this.dataSource = new MatTableDataSource(ELEMENT_DATA) this.getUsersList() + this.getBusinessList() } getUsersList() { //this._pd.getTabStatusPdDetails(this.tabStatus) this._use.getUsersListDetails().subscribe(res => { if (res.status == 200) { - this.usersList = res.data; - // console.log(this.usersList) - // this.dataSource = res.data.length; - // console.log(this.dataSource) - // this.dataSource.data = this.usersList; - // console.log(this.dataSource.data) - // this.recordStatus=false; + let usersList = res.data + this.usersList['data'] = usersList; + this.usersListLength = res.data.length; + this.recordStatus=false; } else{ // this.usersList=[]; // this.dataSource = null; - // this.recordStatus=true; + this.recordStatus=true; } } ,error => { @@ -87,16 +95,41 @@ export class UserListComponent implements OnInit { // alert(error.html_format); }); } + getBusinessList() { + //this._pd.getTabStatusPdDetails(this.tabStatus) + this._bus.getBusinessListDetails().subscribe(res => { + if (res.status == 200) { + let businessFilter = res['data'].filter(val => val.busName) + this.businessList = businessFilter; + } + } + // , error => {this.errorMessage = error}); + ,error => { + // this.errorMessage.push(error); + // this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); + // alert(error.html_format); + }) + } ngAfterViewInit() { + console.log(this.usersList,this.paginator) this.usersList.paginator = this.paginator; + + this.usersList.paginator = this.paginator; + console.log(this.usersList,this.paginator) + //this.usersList.sort = this.sort; + } - applyFilter(event: Event) { - const filterValue = (event.target as HTMLInputElement).value; - this.usersList.filter = filterValue.trim().toLowerCase(); - if (this.usersList.paginator) { - this.usersList.paginator.firstPage(); + applyFilter(filterValue: string) { + console.log(filterValue) + if(filterValue == null){ + this.usersList.filter = null; + }else{ + filterValue = filterValue.trim(); // Remove whitespace + filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches + this.usersList.filter = filterValue; } + } pageChange(e) { diff --git a/ng-seed/src/app/layouts/admin/admin-layout.component.html b/ng-seed/src/app/layouts/admin/admin-layout.component.html index ba1e5e0..fcfa162 100644 --- a/ng-seed/src/app/layouts/admin/admin-layout.component.html +++ b/ng-seed/src/app/layouts/admin/admin-layout.component.html @@ -22,7 +22,7 @@
{{getUser}}
-
+
@@ -188,9 +188,9 @@
-