business table
This commit is contained in:
parent
5bdb915cce
commit
db3044d4c6
@ -1,7 +1,7 @@
|
||||
<h3>Business Details</h3>
|
||||
<mat-form-field>
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event)" placeholder="Ex. Mia" #input>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Ex. Mia" #input>
|
||||
</mat-form-field>
|
||||
<button mat-button (click)="openDialog('Add',{})" class="button">Add Business</button>
|
||||
<mat-sidenav-container class="app-inner background-none shadow-none mail-db">
|
||||
@ -12,66 +12,76 @@
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header >
|
||||
<div class="example-container mat-elevation-z8 ">
|
||||
<table mat-table [dataSource]="businessList" #mytable class="my-table mat-elevation-z8 len-table">
|
||||
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th>
|
||||
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="logo">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th>
|
||||
<td mat-cell *matCellDef="let element"> <img [src]="element.logo" /> </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Name </th>
|
||||
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.busName}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="email">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Email </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.email}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="phone">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Phone </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.contactNo}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="address">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Address </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.address}} <br> {{element.city}} <br> {{element.state}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- <ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> State </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.state}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="city">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> City </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.city}} </td>
|
||||
</ng-container> -->
|
||||
|
||||
<ng-container matColumnDef="action">
|
||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Action </th>
|
||||
<td mat-cell *matCellDef="let element" class="action-link">
|
||||
<a (click)="openDialog('Update',element)"><span class="material-icons edit-color">edit</span></a>
|
||||
<a (click)="confirmBox('Delete',element)"><span class="material-icons edit-color delete">delete</span></a>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<table mat-table [dataSource]="businessListSource" matSort *ngIf="businessListLength > 0" class="my-table mat-elevation-z8 len-table">
|
||||
|
||||
<!-- ID Column -->
|
||||
<ng-container matColumnDef="id">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.id}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Progress Column -->
|
||||
<ng-container matColumnDef="logo">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Logo </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.logo}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.busName}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Color Column -->
|
||||
<ng-container matColumnDef="email">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Email </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" > {{row.email}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Color Column -->
|
||||
<ng-container matColumnDef="phone">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Mobile No </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" > {{row.contactNo}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Color Column -->
|
||||
<ng-container matColumnDef="address">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Address </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"> {{row.address}} <br> {{row.city}} <br> {{row.state}} </mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Color Column -->
|
||||
<ng-container matColumnDef="action">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header> Action </mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">
|
||||
<a (click)="openDialog('Update',element)"><span class="material-icons edit-color">edit</span></a>
|
||||
<a (click)="confirmBox('Delete',element)"><span class="material-icons edit-color delete">delete</span></a>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;">
|
||||
</mat-row>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page of users"></mat-paginator>
|
||||
<div [hidden]="recordStatus">
|
||||
<mat-paginator #paginator class="mat-elevation-z1" [length]="businessListLength" [pageIndex]="pageIndex" [pageSize]="pageSize"
|
||||
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
|
||||
</mat-paginator>
|
||||
</div>
|
||||
<mat-card-content *ngIf="recordStatus">
|
||||
<h5 align="center" style="font-weight: bold;
|
||||
color: brown;">No Data Available</h5>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-sidenav-container>
|
||||
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
@ -1,8 +1,8 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, SimpleChanges, 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 { MatTable ,MatTableDataSource,_MatTableDataSource} from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { DialogBoxComponent } from 'app/appoinment/appoinments/dialog-box/dialog-box.component';
|
||||
@ -10,30 +10,6 @@ import Swal from 'sweetalert2/dist/sweetalert2.js';
|
||||
import { AddBusinessComponent } from '../add-business/add-business.component';
|
||||
import { BusinessService } from '../business-service/business.service';
|
||||
|
||||
|
||||
export interface UsersData {
|
||||
id: number;
|
||||
logo: string;
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
address: string;
|
||||
city: string;
|
||||
state: string;
|
||||
}
|
||||
const ELEMENT_DATA: UsersData[] = [
|
||||
{id: 1, logo: 'assets/images/1.jpg', name: 'school management system ', email: 'management@gmail.com', phone: '8756453456', address:'14-20b/19 Vasantham Colony, Sangakiri.', state: 'Tamil Nadu', city: 'salem', },
|
||||
{id: 2, logo: 'assets/images/2.jpg', name: 'Sample', email: 'sample@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 3, logo: 'assets/images/3.jpg', name: 'Test', email: 'test@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 4, logo: 'assets/images/4.jpg', name: 'Sample', email: 'sample@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 5, logo: 'assets/images/1.jpg', name: 'Test', email: 'test@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 6, logo: 'assets/images/2.jpg', name: 'Sample', email: 'sample@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 7, logo: 'assets/images/3.jpg', name: 'Test', email: 'test@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 8, logo: 'assets/images/4.jpg', name: 'Sample', email: 'sample@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 9, logo: 'assets/images/1.jpg', name: 'Test', email: 'test@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
{id: 10, logo: 'assets/images/2.jpg', name: 'Sample', email: 'sample@gmail.com', phone: '8756453456', address:'sankagiri', city: 'salem', state: 'Tamil Nadu'},
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'app-business-list',
|
||||
templateUrl: './business-list.component.html',
|
||||
@ -41,27 +17,59 @@ const ELEMENT_DATA: UsersData[] = [
|
||||
})
|
||||
export class BusinessListComponent implements OnInit {
|
||||
push: any;
|
||||
public businessListLength: number;
|
||||
public businessListSource = new MatTableDataSource();
|
||||
displayedColumns: string[] = ['id','logo', 'name', 'email','phone', 'address', 'action'];
|
||||
dataSource: any;
|
||||
// dataSource: any = new MatTableDataSource(ELEMENT_DATA);
|
||||
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
businessList: any;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
recordStatus: boolean;
|
||||
@ViewChild(MatTable,{static:true}) table: MatTable<any>
|
||||
// pagination variable details
|
||||
length = 5;
|
||||
pageIndex = 0;
|
||||
pageSize = 5;
|
||||
pageEvent: PageEvent;
|
||||
businessList: any[] = [];
|
||||
|
||||
|
||||
constructor(private notifierService: NotifierService,private router:Router,public dialog: MatDialog,public _bus:BusinessService) {}
|
||||
constructor(private notifierService: NotifierService,private router:Router,public dialog: MatDialog,public _bus:BusinessService) {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.recordStatus=false;
|
||||
this.getBusinessList()
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.businessListSource.paginator = this.paginator;
|
||||
console.log(this.businessListSource,this.paginator)
|
||||
this.businessListSource.sort = this.sort;
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
filterValue = filterValue.trim(); // Remove whitespace
|
||||
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
|
||||
this.businessListSource.filter = filterValue;
|
||||
}
|
||||
|
||||
getBusinessList() {
|
||||
//this._pd.getTabStatusPdDetails(this.tabStatus)
|
||||
this._bus.getBusinessListDetails().subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this.businessList = res.data;
|
||||
if (res.status == 200) {
|
||||
this.businessList = res.data;
|
||||
console.log(this.businessList)
|
||||
this.businessListLength = res.data.length;
|
||||
console.log(this.businessListLength)
|
||||
this.businessListSource['data'] = this.businessList;
|
||||
console.log(this.businessListSource)
|
||||
this.recordStatus=false;
|
||||
}
|
||||
else{
|
||||
this.businessList=[];
|
||||
this.businessListLength= null;
|
||||
this.recordStatus=true;
|
||||
}
|
||||
}
|
||||
// , error => {this.errorMessage = <any> error});
|
||||
,error => {
|
||||
@ -71,17 +79,22 @@ export class BusinessListComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
// ngAfterViewInit() {
|
||||
// this.businessList.paginator = this.paginator;
|
||||
// }
|
||||
applyFilter(event: Event) {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.businessList.filter = filterValue.trim().toLowerCase();
|
||||
if (this.businessList.paginator) {
|
||||
this.businessList.paginator.firstPage();
|
||||
}
|
||||
|
||||
|
||||
pageChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
|
||||
// get changes for filter from parent componnet filter
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
// let filteredText = changes.bindFilterValue.currentValue;
|
||||
let filteredText = changes.bindFilterValue.currentValue ? changes.bindFilterValue.currentValue.trim() : changes.bindFilterValue.currentValue;
|
||||
// filteredText = filteredText ? filteredText.trim() : filteredText;
|
||||
filteredText = filteredText ? filteredText.toLowerCase() : filteredText;
|
||||
this.businessListSource.filter = filteredText;
|
||||
}
|
||||
|
||||
confirmBox(event,element){
|
||||
console.log(event,element)
|
||||
Swal.fire({
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
</div>
|
||||
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
|
||||
<div class="menu-links">
|
||||
<button appToggleFullscreen mat-icon-button>
|
||||
<!-- <button appToggleFullscreen mat-icon-button>
|
||||
<mat-icon>fullscreen</mat-icon>
|
||||
</button>
|
||||
<button [mat-menu-trigger-for]="user2" mat-icon-button class="ml-xs overflow-visible">
|
||||
@ -162,9 +162,9 @@
|
||||
</button>
|
||||
<button [mat-menu-trigger-for]="user" mat-icon-button class="ml-xs">
|
||||
<mat-icon>person</mat-icon>
|
||||
</button>
|
||||
</button> -->
|
||||
<mat-menu #user="matMenu" class="opt-menu" x-position="before">
|
||||
<div mat-menu-item class="head-menu grad-blue">
|
||||
<!-- <div mat-menu-item class="head-menu grad-blue">
|
||||
Settings
|
||||
</div>
|
||||
<button mat-menu-item>
|
||||
@ -178,7 +178,7 @@
|
||||
<button mat-menu-item>
|
||||
<mat-icon>notifications_off</mat-icon>
|
||||
Disable notifications
|
||||
</button>
|
||||
</button> -->
|
||||
<button mat-menu-item (click)="logout()">
|
||||
<mat-icon>exit_to_app</mat-icon>
|
||||
Sign Out
|
||||
|
||||
@ -184,17 +184,17 @@
|
||||
padding: 0 !important;
|
||||
background: $main-content;
|
||||
display: flex;
|
||||
background: #f2f4f8;
|
||||
// background: #f2f4f8;
|
||||
}
|
||||
|
||||
.body-container {
|
||||
height: calc(100% - 64px);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
// overflow-x: hidden;
|
||||
// overflow-y: auto;
|
||||
position: relative;
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
background: #f2f4f8;
|
||||
// background: #f2f4f8;
|
||||
}
|
||||
|
||||
@media(max-width:991px) {
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
environmentName: 'Testing Environment',//Localhost Environment.
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
apiEndpoint:'http://192.168.1.20:8080/api/',
|
||||
apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
// apiEndpoint:'http://192.168.1.20:8080/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
|
||||
firebase: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user