123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import { InternalPageService } from './../../shared/internal-page.service';
- import { AuthServiceService } from './../../shared/auth-service.service';
- import { Component, OnInit } from '@angular/core';
- import { NgxSpinnerService } from 'ngx-spinner';
- @Component({
- selector: 'app-circulars-page',
- templateUrl: './circulars-page.component.html',
- styleUrls: ['./circulars-page.component.css']
- })
- export class CircularsPageComponent implements OnInit {
- constructor(private authSer: AuthServiceService,
- private spinner: NgxSpinnerService,
- private internalService: InternalPageService) { }
-
- count: number;
- perPagePagenation: number = 10;
- dataTableNumber:number = 5;
- data = [];
- //p: number[] = [];
- currentPage:number = 1;
- typeCircu:number = 0;
-
- ngOnInit() {
- this.spinner.show();
- this.internalService.getCircularsData(this.currentPage, this.perPagePagenation, 0).subscribe(
- (responce) => {
- console.log(responce);
- this.data = responce['tabs'];
- this.count = responce['count'];
- this.perPagePagenation = responce['per_page'];
- this.spinner.hide();
- },
- (error) => {
- console.log(error);
- }
- )
- };
- // /change page
- onPageChange(pagenationNumber) {
- this.spinner.show();
- this.currentPage = pagenationNumber;
- this.data = [];
- //console.log(pagenationNumber);
- //console.log(this.pageId);
- this.internalService.getCircularsData(this.currentPage, this.perPagePagenation, this.typeCircu).subscribe(
- (responce) => {
- console.log(responce);
- this.data = responce['tabs'];
- this.count = responce['count'];
- this.perPagePagenation = responce['per_page'];
- //console.log(this.tabsList);
- this.spinner.hide();
- },
- (error) => {
- console.log(error);
- this.spinner.hide();
- }
- );
- };
- onGetData(id) {
- this.spinner.show();
- this.typeCircu = id;
- this.internalService.getCircularsData(this.currentPage, this.perPagePagenation, id).subscribe(
- (responce) => {
- console.log(responce);
- this.data = responce['tabs'];
- this.count = responce['count'];
- this.perPagePagenation = responce['per_page'];
- this.spinner.hide();
- },
- (error) => {
- console.log(error);
- this.spinner.hide();
- }
- );
- }
- //determine the list count from select element
- onGetValue(event) {
- this.spinner.show();
- this.data = [];
- this.dataTableNumber = event.target.value;
- this.internalService.getCircularsData(this.currentPage, this.perPagePagenation, this.typeCircu).subscribe(
- (responce) => {
- console.log(responce);
- this.data = responce['tabs'];
- this.count = responce['count'];
- this.perPagePagenation = responce['per_page'];
- this.spinner.hide();
- },
- (error) => {
- console.log(error);
- this.spinner.hide();
- }
- );
- }
- }
|