123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- import { HttpClient } from '@angular/common/http';
- import { Injectable } from '@angular/core';
- import { NgxSpinnerService } from 'ngx-spinner';
- import { ToastrService } from 'ngx-toastr';
- import { AuthServiceService } from './auth-service.service';
- @Injectable({
- providedIn: 'root'
- })
- export class DashboardService {
- constructor(private http: HttpClient,
- private toastr: ToastrService,
- private authService: AuthServiceService,
- private spinner: NgxSpinnerService) { }
- //get hospitals list
- getListData(pageId: number, currentPage: number, dataTableNumber: number){
- this.spinner.show();
- console.log(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
- return this.http.get(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
- }
-
- //get data user from searchBar
- getDataUSerSearchBar(data, pageId, pagenationNumber, dataTableNumber) {
- console.log('url', this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
- return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
- }
-
- //addEvent
- addItem(data, addType) {
- if(addType == 'advertisiment'){
- return this.http.post(this.authService.pathApi + '/add_main_ad' , data);
- } else if(addType == 'internalHospital') {
- return this.http.post(this.authService.pathApi + '/add_hospitals_centers' , data);
- } else if(addType == 'externalHospital') {
- return this.http.post(this.authService.pathApi + '/add_hospitals_centers_ex' , data);
- } else if(addType == 'internalManagement') {
- return this.http.post(this.authService.pathApi + '/add_management' , data);
- } else if(addType == 'externalManagement') {
- return this.http.post(this.authService.pathApi + '/add_management_ex' , data);
- } else if(addType == 'internalMainMenu') {
- return this.http.post(this.authService.pathApi + '/add_menu' , data);
- } else if(addType == 'externalMainMenu') {
- return this.http.post(this.authService.pathApi + '/add_external_menu' , data);
- } else if(addType == 'internalServiceExternalPage') {
- return this.http.post(this.authService.pathApi + '/add_external_service' , data);
- } else if(addType == 'externalServiceExternalPage') {
- return this.http.post(this.authService.pathApi + '/add_external_service_ex' , data);
- } else if(addType == 'internalNews') {
- return this.http.post(this.authService.pathApi + '/add_report' , data);
- } else if(addType == 'externalNews') {
- return this.http.post(this.authService.pathApi + '/add_report_ex' , data);
- } else if(addType == 'internalFooter') {
- return this.http.post(this.authService.pathApi + '/add_footer' , data);
- } else if(addType == 'externalFooter') {
- return this.http.post(this.authService.pathApi + '/add_footer_ex' , data);
- } else if(addType == 'barEvent') {
- return this.http.post(this.authService.pathApi + '/add_event_bar', data);
- } else if(addType == 'visitingTime') {
- return this.http.post(this.authService.pathApi + '/add_visiting_time', data);
- } else if(addType == 'eventCalendar') {
- return this.http.post(this.authService.pathApi + '/add_event_calendar', data);
- } else if(addType == 'externalAchievement') {
- return this.http.post(this.authService.pathApi + "/add_external_achievement", data);
- } else if(addType == 'statistic') {
- return this.http.post(this.authService.pathApi + "/add_statistic", data);
- } else if(addType == 'advertising') {
- return this.http.post(this.authService.pathApi + "/add_advertising_service", data);
- }
- }
-
- //edit event
- editItem(editId,dataEdit,editPageName){
- const editData = dataEdit;
- console.log(editId);
- console.log(editPageName);
- editData['id'] = editId;
- console.log(dataEdit);
- if(editPageName == 'advertisiment') {
- return this.http.post(this.authService.pathApi + '/edit_main_ad', editData);
- } else if(editPageName == 'internalHospital') {
- return this.http.post(this.authService.pathApi + '/edit_hospitals_centers', editData);
- } else if(editPageName == 'externalHospital') {
- return this.http.post(this.authService.pathApi + '/edit_hospitals_centers_ex', editData);
- } else if(editPageName == 'internalManagement') {
- return this.http.post(this.authService.pathApi + '/edit_management' , dataEdit);
- } else if(editPageName == 'externalManagement') {
- return this.http.post(this.authService.pathApi + '/edit_management_ex' , dataEdit);
- } else if(editPageName == 'internalMenu') {
- return this.http.post(this.authService.pathApi + '/edit_menu' , dataEdit);
- } else if(editPageName == 'externalMenu') {
- return this.http.post(this.authService.pathApi + '/edit_external_menu' , dataEdit);
- } else if(editPageName == 'internalServiceExternalPage') {
- return this.http.post(this.authService.pathApi + '/edit_external_service' , dataEdit);
- } else if(editPageName == 'externalServiceExternalPage') {
- return this.http.post(this.authService.pathApi + '/edit_external_service_ex' , dataEdit);
- } else if(editPageName == 'internalNew') {
- return this.http.post(this.authService.pathApi + '/edit_report' , dataEdit);
- } else if(editPageName == 'externalNew') {
- return this.http.post(this.authService.pathApi + '/edit_report_ex' , dataEdit);
- } else if(editPageName == 'internalFooter') {
- return this.http.post(this.authService.pathApi + '/edit_footer', dataEdit);
- } else if(editPageName == 'externalFooter') {
- return this.http.post(this.authService.pathApi + '/edit_footer_ex', dataEdit);
- }else if(editPageName == 'barEvent') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_event_bar', editData);
- } else if(editPageName == 'contactUs') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_contact_us', editData);
- } else if(editPageName == 'visitingTime') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_visiting_time', editData);
- } else if(editPageName == 'eventCalendar') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_event_calendar', editData);
- } else if(editPageName == 'externalAchievement') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_external_achievement', editData);
- } else if(editPageName == 'statistic') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_statistic', editData);
- } else if(editPageName == 'advertising') {
- console.log(editData);
- return this.http.post(this.authService.pathApi + '/edit_advertising_service', editData);
- }
- }
-
- //get event data
- getItemData(pageId: number, typeGetData:string) {
- console.log('wwwwwwwwwwwwwwwwwwwwwwwwwwww', pageId);
- if(typeGetData == 'advertisiment') {
- return this.http.get(this.authService.pathApi + '/get_main_ad/' + pageId);
- } else if(typeGetData == 'hospital') {
- return this.http.get(this.authService.pathApi + '/get_hospitals_centers/' + pageId);
- } else if(typeGetData == 'managament') {
- return this.http.get(this.authService.pathApi + '/get_management/' + pageId);
- } else if(typeGetData == 'mainMenu') {
- return this.http.get(this.authService.pathApi + '/get_menu/' + pageId);
- } else if(typeGetData == 'externalService') {
- return this.http.get(this.authService.pathApi + '/get_external_service/' + pageId);
- } else if(typeGetData == 'news') {
- return this.http.get(this.authService.pathApi + '/get_report/' + pageId);
- } else if(typeGetData == 'footer') {
- return this.http.get(this.authService.pathApi + '/get_footer/' + pageId);
- }else if(typeGetData == 'barEvent') {
- return this.http.get(this.authService.pathApi + '/get_event_bar/' + pageId);
- } else if(typeGetData == 'contactUs') {
- return this.http.get(this.authService.pathApi + '/get_contact_us/' + pageId);
- } else if(typeGetData == 'visitingTime') {
- return this.http.get(this.authService.pathApi + '/get_visiting_time/' + pageId);
- } else if(typeGetData == 'eventCalendar') {
- return this.http.get(this.authService.pathApi + '/get_event_calendar/' + pageId);
- } else if(typeGetData == 'externalAchievement') {
- return this.http.get(this.authService.pathApi + '/get_external_achievement/' + pageId);
- } else if(typeGetData == 'statistic') {
- return this.http.get(this.authService.pathApi + '/get_statistic/' + pageId);
- } else if(typeGetData == 'advertising') {
- return this.http.get(this.authService.pathApi + '/get_advertising_service/' + pageId);
- }
- }
-
- //delete event
- deleteItem(dataIds, pageId) {
-
- console.log(dataIds);
- console.log(pageId);
- if(pageId == 24) {
- return this.http.post(this.authService.pathApi + '/delete_main_ads' , {'ads_id' : dataIds});
- } else if(pageId == 10) {
- return this.http.post(this.authService.pathApi + '/delete_managements' , {'managements_id' : dataIds});
- } else if(pageId == 31) {
- return this.http.post(this.authService.pathApi + '/delete_managements_ex' , {'managements_id' : dataIds});
- } else if(pageId == 6) {
- return this.http.post(this.authService.pathApi + '/delete_hospitals_centers' , {'hospitals_centers_id' : dataIds});
- } else if(pageId == 30) {
- return this.http.post(this.authService.pathApi + '/delete_hospitals_centers_ex' , {'hospitals_centers_id' : dataIds});
- } else if(pageId == 17) {
- return this.http.post(this.authService.pathApi + '/delete_menus' , {'menus_id' : dataIds});
- } else if(pageId == 18) {
- return this.http.post(this.authService.pathApi + '/delete_external_menus' , {'menus_id' : dataIds});
- } else if(pageId == 19) {
- return this.http.post(this.authService.pathApi + '/delete_external_services_ex' , {'external_services_id' : dataIds});
- } else if(pageId == 7) {
- return this.http.post(this.authService.pathApi + '/delete_external_services' , {'external_services_id' : dataIds});
- } else if(pageId == 20) {
- return this.http.post(this.authService.pathApi + '/delete_reports_ex' , {'reports_id' : dataIds});
- } else if(pageId == 13) {
- return this.http.post(this.authService.pathApi + '/delete_reports' , {'reports_id' : dataIds});
- } else if(pageId == 16) {
- return this.http.post(this.authService.pathApi + '/delete_footers' , {'footers_id' : dataIds});
- } else if(pageId == 29) {
- return this.http.post(this.authService.pathApi + '/delete_footers_ex' , {'footers_id' : dataIds});
- } else if (pageId == 21){
- return this.http.post(this.authService.pathApi + '/delete_event_bars' , {'event_bars_id' : dataIds});
- } else if (pageId == 23){
- return this.http.post(this.authService.pathApi + '/delete_visiting_times' , {'visiting_times_id' : dataIds});
- } else if (pageId == 25){
- return this.http.post(this.authService.pathApi + '/delete_event_calendars' , {'event_calendars_id' : dataIds});
- } else if (pageId == 27){
- return this.http.post(this.authService.pathApi + '/delete_external_achievements' , {'external_achievements_id' : dataIds});
- } else if (pageId == 26){
- return this.http.post(this.authService.pathApi + '/delete_statistics' , {'statistics_id' : dataIds});
- } else if (pageId == 22){
- return this.http.post(this.authService.pathApi + '/delete_advertising_services' , {'advertising_services_id' : dataIds});
- }
-
- };
- }
|