master
drfelfel 2020-10-14 00:28:15 +03:30
parent cce441c446
commit 286c068112
2 changed files with 45 additions and 11 deletions

View File

@ -21,7 +21,12 @@
</button> </button>
</mat-form-field> </mat-form-field>
<div class="flex-space"></div> <div class="flex-space"></div>
<button mat-raised-button color="green" (click)="Get()" *ngIf="this.size > 10"> <button
mat-raised-button
color="green"
(click)="Get()"
*ngIf="this.size > 10"
>
<mat-icon>cloud_download</mat-icon> <mat-icon>cloud_download</mat-icon>
<span>بارگیری صفحات بعدی</span> <span>بارگیری صفحات بعدی</span>
</button> </button>
@ -58,7 +63,9 @@
<td mat-cell *matCellDef="let element" style="width: 25px"> <td mat-cell *matCellDef="let element" style="width: 25px">
<a <a
mat-icon-button mat-icon-button
href="https://kateb.rayda.ir/register?admin=true&uid={{element.uid}}&token=test" href="https://kateb.rayda.ir/register?admin=true&uid={{
element.uid
}}&token={{ element.uuid }}"
target="”_blank”" target="”_blank”"
> >
<mat-icon>arrow_back</mat-icon> <mat-icon>arrow_back</mat-icon>

View File

@ -14,12 +14,39 @@ export class TableComponent implements OnInit {
public data: MatTableDataSource<object> = new MatTableDataSource<object>(); public data: MatTableDataSource<object> = new MatTableDataSource<object>();
public loading: boolean = false; public loading: boolean = false;
public search: string = ''; public search: string = '';
public size=0; public size = 0;
public page=0; public page = 0;
public uuid = "";
constructor(private excel: Excel, private rayconnect: Rayconnect, private cdr: ChangeDetectorRef) { } constructor(private excel: Excel, private rayconnect: Rayconnect, private cdr: ChangeDetectorRef) { }
ngOnInit(): void { ngOnInit(): void {
this.subscribe(); this.subscribe();
this.UUID()
}
async UUID() {
const data = await this.rayconnect.RequestBack({
scope: 'kateb',
uniqueID: 'profile',
TokenID: '*',
address: "volunteers/admin/expert/uuid",
info: {
method: "GET",
data: {
page: 0,
limit: 10
}
}
})
if (data['data']['uuid'])
this.uuid = data['data']['uuid']
} }
subscribe() { subscribe() {
@ -31,8 +58,8 @@ export class TableComponent implements OnInit {
info: { info: {
method: 'SUB', method: 'SUB',
data: { data: {
page:0, page: 0,
limit:10 limit: 10
} }
} }
}).then(res => { }).then(res => {
@ -44,7 +71,7 @@ export class TableComponent implements OnInit {
}, (res => { }, (res => {
let list: object[] = res.data['list']; let list: object[] = res.data['list'];
let rendered = [] let rendered = []
if(res.data['size']){ if (res.data['size']) {
this.size = res.data['size']; this.size = res.data['size'];
} }
for (let i in list) { for (let i in list) {
@ -59,7 +86,7 @@ export class TableComponent implements OnInit {
} }
if(rendered.length > 0){ if (rendered.length > 0) {
this.data.connect().next(rendered) this.data.connect().next(rendered)
} }
})); }));
@ -71,7 +98,7 @@ export class TableComponent implements OnInit {
} }
Get() { Get() {
if(this.size > (this.page+1) * 10){ if (this.size > (this.page + 1) * 10) {
this.page++; this.page++;
this.rayconnect.RequestBack({ this.rayconnect.RequestBack({
scope: 'kateb', scope: 'kateb',
@ -81,8 +108,8 @@ export class TableComponent implements OnInit {
info: { info: {
method: 'SUB', method: 'SUB',
data: { data: {
page:this.page, page: this.page,
limit:10 limit: 10
} }
} }
}) })