|
@@ -1,5 +1,4 @@
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
-import { EventService } from './../../shared/event.service';
|
|
|
import { AuthServiceService } from './../../shared/auth-service.service';
|
|
|
import { UserService } from './../../shared/user.service';
|
|
|
import { ActivatedRoute, Router, Params } from '@angular/router';
|
|
@@ -7,6 +6,7 @@ import { Component, OnInit } from '@angular/core';
|
|
|
import { NgxSpinnerService } from 'ngx-spinner';
|
|
|
import { ToastrService } from 'ngx-toastr';
|
|
|
import { Modal } from 'ngx-modialog/plugins/bootstrap';
|
|
|
+import { DashboardService } from 'src/app/shared/dashboard.service';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-events',
|
|
@@ -22,7 +22,7 @@ export class EventsComponent implements OnInit {
|
|
|
private toastr: ToastrService,
|
|
|
private http: HttpClient,
|
|
|
private modal: Modal,
|
|
|
- private eventService: EventService,
|
|
|
+ private dashboardSer: DashboardService,
|
|
|
private router: Router) { }
|
|
|
|
|
|
pageId: number;
|
|
@@ -97,7 +97,7 @@ export class EventsComponent implements OnInit {
|
|
|
);
|
|
|
|
|
|
//get list data
|
|
|
- this.eventService.getEventsList(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getListData(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.eventsList = responce['events'];
|
|
@@ -135,7 +135,7 @@ export class EventsComponent implements OnInit {
|
|
|
this.currentPage = 1;
|
|
|
console.log('search curent page', this.currentPage);
|
|
|
console.log('search page id', this.pageId);
|
|
|
- this.eventService.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.eventsList = responce['events'];
|
|
@@ -157,7 +157,7 @@ export class EventsComponent implements OnInit {
|
|
|
this.eventsList = [];
|
|
|
//console.log(pagenationNumber);
|
|
|
//console.log(this.pageId);
|
|
|
- this.eventService.getEventsList(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getListData(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.eventsList = responce['events'];
|
|
@@ -182,7 +182,7 @@ export class EventsComponent implements OnInit {
|
|
|
this.http.post(this.authSer.pathApi + '/rank_event', data).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
- this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.count = responce['count'];
|
|
@@ -205,7 +205,7 @@ onGetValue(event) {
|
|
|
this.spinner.show();
|
|
|
this.eventsList = [];
|
|
|
this.dataTableNumber = event.target.value;
|
|
|
- this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.eventsList = responce['events'];
|
|
@@ -244,13 +244,13 @@ onGetValue(event) {
|
|
|
|
|
|
dialogRef.result
|
|
|
.then( result =>
|
|
|
- this.eventService.deleteEvent(this.eventsListIds).subscribe(
|
|
|
+ this.dashboardSer.deleteItem(this.eventsListIds, this.pageId).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.toastr.success('تم الحذف');
|
|
|
this.spinner.show();
|
|
|
this.eventsList = [];
|
|
|
- this.eventService.getEventsList(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
+ this.dashboardSer.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.eventsList = responce['events'];
|