|
@@ -6,6 +6,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
import {MapsAPILoader} from '@agm/core';
|
|
import {MapsAPILoader} from '@agm/core';
|
|
import * as $ from 'jquery';
|
|
import * as $ from 'jquery';
|
|
import { NgxSpinnerService } from 'ngx-spinner';
|
|
import { NgxSpinnerService } from 'ngx-spinner';
|
|
|
|
+import { HttpClient } from '@angular/common/http';
|
|
|
|
+import { ToastrService } from 'ngx-toastr';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-external-page-content',
|
|
selector: 'app-external-page-content',
|
|
@@ -17,7 +19,9 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy {
|
|
constructor(private externalService: ExternalPageService,
|
|
constructor(private externalService: ExternalPageService,
|
|
private spinner: NgxSpinnerService,
|
|
private spinner: NgxSpinnerService,
|
|
private router: Router,
|
|
private router: Router,
|
|
|
|
+ private http: HttpClient,
|
|
private route: ActivatedRoute,
|
|
private route: ActivatedRoute,
|
|
|
|
+ private toastr: ToastrService,
|
|
private authSer:AuthServiceService) {
|
|
private authSer:AuthServiceService) {
|
|
this.spinner.show();
|
|
this.spinner.show();
|
|
}
|
|
}
|
|
@@ -30,6 +34,9 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy {
|
|
intensiveCare = [];
|
|
intensiveCare = [];
|
|
recordsOfMonth = [];
|
|
recordsOfMonth = [];
|
|
achievements = [];
|
|
achievements = [];
|
|
|
|
+ initialMonthNumber: number;
|
|
|
|
+ checkStatisticShow: boolean = false;
|
|
|
|
+ showSmallSpinner: boolean = false;
|
|
|
|
|
|
title: string = 'My first AGM project';
|
|
title: string = 'My first AGM project';
|
|
|
|
|
|
@@ -80,6 +87,7 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy {
|
|
this.intensiveCare = responce['data'].visiting_times_ic;
|
|
this.intensiveCare = responce['data'].visiting_times_ic;
|
|
this.recordsOfMonth = responce['data']['statistics'];
|
|
this.recordsOfMonth = responce['data']['statistics'];
|
|
this.achievements = responce['data'].external_achievements;
|
|
this.achievements = responce['data'].external_achievements;
|
|
|
|
+ this.initialMonthNumber = responce['data']['statistics'].month_id;
|
|
this.lat = responce['data']['reach_map'].latitude;
|
|
this.lat = responce['data']['reach_map'].latitude;
|
|
this.lng = responce['data']['reach_map'].longitude;
|
|
this.lng = responce['data']['reach_map'].longitude;
|
|
console.log('fiiiiiiiiiiiiiiiiiiiii' , this.firstAdvertisiment);
|
|
console.log('fiiiiiiiiiiiiiiiiiiiii' , this.firstAdvertisiment);
|
|
@@ -93,6 +101,107 @@ export class ExternalPageContentComponent implements OnInit, OnDestroy {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ nextMonth() {
|
|
|
|
+ this.showSmallSpinner = true;
|
|
|
|
+ this.recordsOfMonth = [];
|
|
|
|
+ if(this.initialMonthNumber == 12) {
|
|
|
|
+ this.initialMonthNumber = 12;
|
|
|
|
+ console.log(this.initialMonthNumber);
|
|
|
|
+ this.toastr.warning('أخر شهور العام !');
|
|
|
|
+ this.http.get(this.authSer.pathApi + '/get_statistics_by_month_id/' + 12).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.showSmallSpinner = false;
|
|
|
|
+ this.recordsOfMonth = responce['statistics'];
|
|
|
|
+ if(responce['statistics'].statistics_values.length > 0) {
|
|
|
|
+ this.checkStatisticShow = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.checkStatisticShow = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ this.initialMonthNumber++;
|
|
|
|
+ console.log(this.initialMonthNumber);
|
|
|
|
+ this.http.get(this.authSer.pathApi + '/get_statistics_by_month_id/' + this.initialMonthNumber).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.showSmallSpinner = false;
|
|
|
|
+ this.recordsOfMonth = responce['statistics'];
|
|
|
|
+ if(responce['statistics'].statistics_values.length > 0) {
|
|
|
|
+ this.checkStatisticShow = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.checkStatisticShow = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ prevMonth() {
|
|
|
|
+ this.showSmallSpinner = true;
|
|
|
|
+ this.recordsOfMonth = [];
|
|
|
|
+ console.log(this.initialMonthNumber);
|
|
|
|
+ if(this.initialMonthNumber == 1) {
|
|
|
|
+ this.initialMonthNumber = 1;
|
|
|
|
+ this.toastr.warning('أول شهور العام !');
|
|
|
|
+ this.http.get(this.authSer.pathApi + '/get_statistics_by_month_id/' + 1).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ this.showSmallSpinner = true;
|
|
|
|
+ this.showSmallSpinner = false;
|
|
|
|
+ this.recordsOfMonth = responce['statistics'];
|
|
|
|
+ if(responce['statistics'].statistics_values.length > 0) {
|
|
|
|
+ this.checkStatisticShow = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.checkStatisticShow = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ this.initialMonthNumber--;
|
|
|
|
+ this.http.get(this.authSer.pathApi + '/get_statistics_by_month_id/' + this.initialMonthNumber).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.showSmallSpinner = true;
|
|
|
|
+ this.showSmallSpinner = false;
|
|
|
|
+ this.recordsOfMonth = responce['statistics'];
|
|
|
|
+ if(responce['statistics'].statistics_values.length > 0) {
|
|
|
|
+ this.checkStatisticShow = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.checkStatisticShow = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onGetService(serviceData) {
|
|
|
|
+ console.log(serviceData);
|
|
|
|
+ if(serviceData.type == 'internal') {
|
|
|
|
+ this.router.navigate(['ExternalPage/externalServiceDetails/' + serviceData.id]);
|
|
|
|
+ } else if(serviceData.type == 'external') {
|
|
|
|
+ window.location.href = serviceData.link;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onGetServiceData(serviceData) {
|
|
|
|
+ console.log('service Data' , serviceData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
goPageNew(reprotData) {
|
|
goPageNew(reprotData) {
|
|
console.log(reprotData);
|
|
console.log(reprotData);
|
|
this.router.navigate( ['ExternalPage/newPage/' + reprotData.id]);
|
|
this.router.navigate( ['ExternalPage/newPage/' + reprotData.id]);
|