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