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,
    public authService: AuthServiceService,
    private spinner: NgxSpinnerService) { }

     //get hospitals list
      getListUnit( currentPage: number, dataTableNumber: number, housing_complex_id: any,building_type_id: any,building_id: any,unitId: any, pageId: number){
      this.spinner.show();
        console.log('services ', currentPage);
        if(pageId == 67){
        console.log(this.authService.pathApi +'/units_list/'  + currentPage + '/' + dataTableNumber + '/' + housing_complex_id + '/' + building_type_id + '/' + building_id );
        return this.http.get(this.authService.pathApi +'/units_list/'  + currentPage + '/' + dataTableNumber + '/' + housing_complex_id + '/' + building_type_id + '/' + building_id );
      }else if (pageId == 68) {

        return this.http.get(this.authService.pathApi +'/unit_covenants_list/'  + currentPage + '/' + dataTableNumber + '/' + housing_complex_id + '/' + building_type_id + '/' + building_id + '/' + unitId );

      }
    }
    getHousingRequestsList(currentPage: number, dataTableNumber: number, to_whom: any ,status: any){
      console.log(this.authService.pathApi + '/housing_requests_list/'+ currentPage +'/' + dataTableNumber +'/' +'/' +to_whom + '/' + status);
      return this.http.get(this.authService.pathApi + '/housing_requests_list/'+ currentPage +'/' + dataTableNumber  +'/' +to_whom + '/' + status);
    }
    getRequestTypesList(currentPage: number, dataTableNumber: number, require_attachments: any , require_approval: any, require_date:any){
      return this.http.get(this.authService.pathApi + '/request_types_list/'+ currentPage +'/' + dataTableNumber  +'/' +require_attachments + '/' + require_approval + '/' + require_date);

    }
    getViewListOfRequests(currentPage: number, dataTableNumber: number, userId: number , status: any){
      this.spinner.show();

      return this.http.get(this.authService.pathApi + '/female_requests_list/' + currentPage + '/' + dataTableNumber + '/' + userId + '/' + status)
      
    }
    getListData(pageId: number, currentPage: number, dataTableNumber: number){
      this.spinner.show();
        console.log('services ', currentPage);
        console.log(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
        return this.http.get(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/all');
    }
    getListDataNew(pageId: number, currentPage: number, dataTableNumber: number , type: any){
      this.spinner.show();
        console.log('services ', currentPage);
        console.log(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + type);
        return this.http.get(this.authService.pathApi +'/page_list/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/' +type);
    }
     //get data user from searchBar
     getDataUSerSearchBar(data, pageId, pagenationNumber, dataTableNumber) {
      if(pageId == 40) {
        console.log('url', this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/1/' + data);
        return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/1/' + data);
      } else {
        console.log('urrrrrl',this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
        return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + pagenationNumber + '/' + dataTableNumber + '/all/' + data);
      }
    }

    getDataUSerSearchBarUnit(data, currentPage: number, dataTableNumber: number, housing_complex_id: any,building_type_id: any,building_id: any, unitId: any ,pageId: number) {
        if(pageId == 67){
        return this.http.get(this.authService.pathApi +'/units_list/'  + currentPage + '/' + dataTableNumber + '/' + housing_complex_id + '/' + building_type_id + '/' + building_id + '/' + data);
        }else if(pageId == 68){
        return this.http.get(this.authService.pathApi +'/unit_covenants_list/'  + currentPage + '/' + dataTableNumber + '/' + housing_complex_id + '/' + building_type_id + '/' + building_id + '/' + unitId + '/' + data)
        }
    }

    getDataUSerSearchBarhousing(data, currentPage: number, dataTableNumber: number,to_whom: any, status: any){
      return this.http.get(this.authService.pathApi+ '/housing_requests_list/' + currentPage + '/' + dataTableNumber + '/' + to_whom + '/' + status + '/' + data);
    }
    getRequestTypesSearch(data, currentPage: number, dataTableNumber: number, require_attachments: any , require_approval: any, require_date:any ){
      return this.http.get(this.authService.pathApi + '/request_types_list/'+ currentPage +'/' + dataTableNumber  +'/' +require_attachments + '/' + require_approval + '/' + require_date + '/' + data);

    }
    getViewSearchOnRequests( data ,currentPage: number, dataTableNumber: number, userId: number , status: any){
      this.spinner.show();

      return this.http.get(this.authService.pathApi + '/female_requests_list/' + currentPage + '/' + dataTableNumber + '/' + userId + '/' + status + '/' + data)
      
    }
    //if the page has filtter 
    searchFiltterPagenation(pageId: number, currentPage: number, dataTableNumber: number, typeFiltter: string){
      console.log(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/' + typeFiltter)
      return this.http.get(this.authService.pathApi + '/page_list' + '/' + pageId + '/' + currentPage + '/' + dataTableNumber + '/' + typeFiltter);
    }

    //addEvent
    addItem(data, addType) {
      if(addType == 'advertisiment'){
        return this.http.post(this.authService.pathApi + '/add_main_ad' , data);
      } else if(addType == 'role') {
        return this.http.post(this.authService.pathApi + '/add_role' , data);
      } else if(addType == 'department'){
        return this.http.post(this.authService.pathApi + '/add_adminstration' , data);
      } else if(addType == 'section'){
        return this.http.post(this.authService.pathApi + '/add_department' , data);
      } else if(addType == 'tab'){
        return this.http.post(this.authService.pathApi + '/add_tab' , data);
      } else if(addType == 'internalSer'){
        return this.http.post(this.authService.pathApi + '/add_internal_service' , data);
      } else if(addType == 'achiev'){
        return this.http.post(this.authService.pathApi + '/add_achievement' , data);
      } else if(addType == 'lecture'){
        return this.http.post(this.authService.pathApi + '/add_lecture' , 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);
      } else if(addType == 'supervisor') {
        return this.http.post(this.authService.pathApi + "/asign_supervisor_to_department", data);
      } else if(addType == 'absorpation') {
        return this.http.post(this.authService.pathApi + "/add_absorpation_plan", data);
      } else if(addType == 'request') {
        return this.http.post(this.authService.pathApi + "/add_request", data);
      } else if(addType == 'trainee') {
        return this.http.post(this.authService.pathApi + "/add_user", data);
      } else if(addType == 'traineeRequest') {
        return this.http.post(this.authService.pathApi + "/add_request", data);
      } else if(addType == 'vehicle') {
        return this.http.post(this.authService.pathApi + '/add_vehicle_type', data);
      } else if(addType == 'modelVehicle') {
        return this.http.post(this.authService.pathApi + '/add_vehicle_model', data);
      } else if(addType == 'registerVehicle') {
        return this.http.post(this.authService.pathApi + '/add_vehicle_data', data);
      } else if(addType == 'registerMovementVehicle') {
        return this.http.post(this.authService.pathApi + '/add_vehicle_movement', data);
      } else if(addType == 'vehicleMaintenance') {
        return this.http.post(this.authService.pathApi + '/add_vehicle_maintenance', data);
      }else if(addType == 'definitionOfClassification') {
        return this.http.post(this.authService.pathApi + '/add_category', data);
      }else if(addType == 'definitionOfLocation') {
        return this.http.post(this.authService.pathApi + '/add_location', data);
      }else if(addType == 'definitionOfTime') {
        return this.http.post(this.authService.pathApi + '/add_time_period', data);
      }else if(addType == 'livingService') {
        return this.http.post(this.authService.pathApi + '/add_covenant_category', data);
      }else if(addType == 'definitionOfCovenant') {
        return this.http.post(this.authService.pathApi + '/add_covenant', data);
      }else if(addType == 'recordInfoBuilding') {
        return this.http.post(this.authService.pathApi + '/add_housing_complex', data);
      }else if(addType == 'events') {
        return this.http.post(this.authService.pathApi + '/add_event' , data);
      }else if(addType == 'unitsInformation') {
        return this.http.post(this.authService.pathApi + '/add_building_information' , data);
      }else if(addType == 'unitsBuildingInformation') {
        return this.http.post(this.authService.pathApi + '/add_unit_information' , data);
      }else if(addType == 'linkUnitToCovenants') {
        return this.http.post(this.authService.pathApi + '/assign_unit_covenant' , data);
      }else if(addType == 'femalesRequestTypesAdd') {
        return this.http.post(this.authService.pathApi + '/add_request_type' , data);
      }else if(addType == 'addFemaleRequest') {
        return this.http.post(this.authService.pathApi + '/add_female_request' , data);
      }else if(addType == 'addFemaleRequestAdmin') {
        return this.http.post(this.authService.pathApi + '/handle_female_request' , data);
      } else if(addType == 'visitingTime'){
        return this.http.post(this.authService.pathApi + '/add_visiting_time' , data);
      }
    }

    //edit event  add_female_request
    editItem(editId,dataEdit,editPageName){
      const editData = dataEdit;
      console.log(editPageName);
      editData['id'] = editId;
      console.log(editData);

      if(editPageName == 'advertisiment') {
        return this.http.post(this.authService.pathApi + '/edit_main_ad', editData);
      } else if(editPageName == 'role') {
        return this.http.post(this.authService.pathApi + '/edit_role', editData);
      } else if(editPageName == 'department'){
        return this.http.post(this.authService.pathApi + '/edit_adminstration', editData);
      } else if(editPageName == 'section'){
        return this.http.post(this.authService.pathApi + '/edit_adminstration', editData);
      } else if(editPageName == 'tab'){
        return this.http.post(this.authService.pathApi + '/edit_tab', editData);
      } else if(editPageName == 'achiev'){
        return this.http.post(this.authService.pathApi + '/edit_achievement', editData);
      } else if(editPageName == 'lecture') {
        return this.http.post(this.authService.pathApi + '/edit_lecture', editData);
      } else if(editPageName == 'internalSer'){
        return this.http.post(this.authService.pathApi + '/edit_internal_service', 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);
      } else if(editPageName == 'absorpation') {
        return this.http.post(this.authService.pathApi + '/edit_absorpation_plan', editData);
      } else if(editPageName == 'trainee') {
        return this.http.post(this.authService.pathApi + '/edit_user', editData);
      } else if(editPageName == 'request') {
        return this.http.post(this.authService.pathApi + '/edit_request', editData);
      } else if(editPageName == 'vehicle') {
        return this.http.post(this.authService.pathApi + '/edit_vehicle_type', editData);
      } else if(editPageName == 'vehicelModel') {
        return this.http.post(this.authService.pathApi + '/edit_vehicle_model', editData);
      } else if(editPageName == 'registerVehicle') {
        return this.http.post(this.authService.pathApi + '/edit_vehicle_data', editData);
      } else if(editPageName == 'registerMovementVehicle') {
        return this.http.post(this.authService.pathApi + '/edit_vehicle_movement', editData);
      } else if(editPageName == 'vehicleMaintenance') {
        return this.http.post(this.authService.pathApi + '/edit_vehicle_maintenance', editData);
      }else if(editPageName == 'definitionOfClassification') {
        return this.http.post(this.authService.pathApi + '/edit_category', editData);
      }else if(editPageName == 'definitionOfLocation') {
        return this.http.post(this.authService.pathApi + '/edit_location', editData);
      }else if(editPageName == 'definitionOfTime') {
        return this.http.post(this.authService.pathApi + '/edit_time_period', editData);
      }else if(editPageName == 'livingService') {
        return this.http.post(this.authService.pathApi + '/edit_covenant_category', editData);
      }else if(editPageName == 'definitionOfCovenant') {
        return this.http.post(this.authService.pathApi + '/edit_covenant', editData);
      }else if(editPageName == 'recordInfoBuilding') {
        return this.http.post(this.authService.pathApi + '/edit_housing_complex', editData);
      }else if(editPageName == 'events') {
        return this.http.post(this.authService.pathApi + '/edit_event', editData);
      }else if(editPageName == 'unitsInformation') {
        return this.http.post(this.authService.pathApi + '/edit_building_information', editData);
      }else if(editPageName == 'unitsBuildingInformation') {
        return this.http.post(this.authService.pathApi + '/edit_unit_information', editData);
      }else if(editPageName == 'linkUnitToCovenants') {
        return this.http.post(this.authService.pathApi + '/assign_unit_covenant', editData);
      }else if(editPageName == 'femalesRequestTypes') {
        return this.http.post(this.authService.pathApi + '/edit_request_type', editData);
      }else if(editPageName == 'editFemaleRequest') {
        return this.http.post(this.authService.pathApi + '/edit_female_request', editData);
      }
    }
    
    //get item data  add_request_type 
    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 == 'role'){
        return this.http.get(this.authService.pathApi + '/get_role/' + pageId);
      } else if(typeGetData == 'department') {
        return this.http.get(this.authService.pathApi + '/get_adminstration/' + pageId);
      } else if(typeGetData == 'section'){
        return this.http.get(this.authService.pathApi + '/get_department/' + pageId);
      } else if(typeGetData == 'tab'){
        return this.http.get(this.authService.pathApi + '/get_tab/' + pageId);
      } else if(typeGetData == 'internalSer'){
        return this.http.get(this.authService.pathApi + '/get_internal_service/' + pageId);
      } else if(typeGetData == 'lecture') {
        return this.http.get(this.authService.pathApi + '/get_lecture/' + pageId);
      } else if(typeGetData == 'achiev') {
        return this.http.get(this.authService.pathApi + '/get_achievement/' + 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);
      } else if(typeGetData == 'supervisor') {
        return this.http.get(this.authService.pathApi + '/get_department/' + pageId);
      } else if(typeGetData == 'absorpation') {
        return this.http.get(this.authService.pathApi + '/get_absorpation_plan/' + pageId);
      } else if(typeGetData == 'trainee') {
        return this.http.get(this.authService.pathApi + '/get_user/' + pageId);
      } else if(typeGetData == 'traineeRequest') {
        return this.http.get(this.authService.pathApi + '/get_request/' + pageId);
      } else if(typeGetData == 'sectionReviewTrainee') {
        return this.http.get(this.authService.pathApi + '/get_request/' + pageId);
      } else if(typeGetData == 'vehicle') {
        return this.http.get(this.authService.pathApi + '/get_vehicle_type/' + pageId);
      } else if(typeGetData == 'vehicleModel') {
        return this.http.get(this.authService.pathApi + '/get_vehicle_model/' + pageId);
      } else if(typeGetData == 'registerVehicle') {
        return this.http.get(this.authService.pathApi + '/get_vehicle_data/' + pageId);
      } else if(typeGetData == 'registerMovementVehicle') {
        return this.http.get(this.authService.pathApi + '/get_vehicle_movement/' + pageId);
      } else if(typeGetData == 'maintenanceVehicle') {
        return this.http.get(this.authService.pathApi + '/get_vehicle_maintenance/' + pageId);
      }else if(typeGetData == 'definitionOfClassification') {
        return this.http.get(this.authService.pathApi + '/get_category/' + pageId);
      }else if(typeGetData == 'definitionOfLocation') {
        return this.http.get(this.authService.pathApi + '/get_location/' + pageId);
      }else if(typeGetData == 'definitionOfTime') {
        return this.http.get(this.authService.pathApi + '/get_time_period/' + pageId);
      } else if(typeGetData == 'maintenance') {
        return this.http.get(this.authService.pathApi + '/get_communication/' + pageId);
      } else if(typeGetData == 'livingService') {
        return this.http.get(this.authService.pathApi + '/get_covenant_category/' + pageId);
      }else if(typeGetData == 'definitionOfCovenant') {
        return this.http.get(this.authService.pathApi + '/get_covenant/' + pageId);
      }else if(typeGetData == 'recordInfoBuilding') {
        return this.http.get(this.authService.pathApi + '/get_housing_complex/' + pageId);
      }else if(typeGetData == 'events') {
        return this.http.get(this.authService.pathApi + '/get_event/' + pageId);
      }else if(typeGetData == 'unitInformation') {
        return this.http.get(this.authService.pathApi + '/get_building_information/' + pageId);
      }else if(typeGetData == 'unitBuildingInformation') {
        return this.http.get(this.authService.pathApi + '/get_unit_information/' + pageId);
      }else if(typeGetData == 'linkUnitToCovenants') {
        return this.http.get(this.authService.pathApi + '/get_unit_covenant/' + pageId);
      }else if(typeGetData == 'viewRequestsForAdminstrationDetails') {
        return this.http.get(this.authService.pathApi + '/get_housing_request/' + pageId);
      }else if(typeGetData == 'femalesRequestTypes') {
        return this.http.get(this.authService.pathApi + '/get_request_type/' + pageId);
      }else if(typeGetData == 'femalesRequest') {
        return this.http.get(this.authService.pathApi + '/get_female_request/' + pageId);
      }
  }
    //delete event get_request_type
    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 == 2) {
        return this.http.post(this.authService.pathApi + '/delete_role' , {'roles_id' : dataIds});
      } else if(pageId == 3){
        return this.http.post(this.authService.pathApi + '/delete_adminstration' , {'adminstrations_id' : dataIds});
      } else if(pageId == 4){
        return this.http.post(this.authService.pathApi + '/delete_department' , {'departments_id' : dataIds});
      } else if(pageId == 12){
        return this.http.post(this.authService.pathApi + '/delete_tabs' , {'tabs_id' : dataIds});
      } else if(pageId == 15) {
        return this.http.post(this.authService.pathApi + '/delete_lectures' , {'lectures_id' : dataIds});
      } else if(pageId == 11){
        return this.http.post(this.authService.pathApi + '/delete_achievements' , {'achievements_id' : dataIds});
      } else if(pageId == 14){
        return this.http.post(this.authService.pathApi + '/delete_internal_services' , {'internal_services_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});
      } else if(pageId == 33) {
        return this.http.post(this.authService.pathApi + '/un_asign_supervisor_to_department', {'departments_id' : dataIds})
      } else if(pageId == 34) {
        return this.http.post(this.authService.pathApi + '/delete_absorpation_plans', {'absorpation_plans_id' : dataIds});
      } else if(pageId == 40) {
        return this.http.post(this.authService.pathApi + '/delete_user', {'users_id' : dataIds});
      } else if(pageId == 43) {
        return this.http.post(this.authService.pathApi + '/delete_vehicle_type', {'types_id' : dataIds});
      } else if(pageId == 44) {
        return this.http.post(this.authService.pathApi + '/delete_vehicle_model', {'models_id' : dataIds});
      } else if(pageId == 45) {
        return this.http.post(this.authService.pathApi + '/delete_vehicle_data', {'datas_id' : dataIds});
      } else if(pageId == 46) {
        return this.http.post(this.authService.pathApi + '/delete_vehicle_maintenance', {'maintenances_id' : dataIds});
      } else if(pageId == 47) {
        return this.http.post(this.authService.pathApi + '/delete_vehicle_movement', {'movements_id' : dataIds});
      }else if(pageId == 51) {
        return this.http.post(this.authService.pathApi + '/delete_category', {'categories_id' : dataIds});
      }else if(pageId == 52) {
        return this.http.post(this.authService.pathApi + '/delete_location', {'locations_id' : dataIds});
      }else if(pageId == 53) {
        return this.http.post(this.authService.pathApi + '/delete_time_period', {'time_periods_id' : dataIds});
      }else if(pageId == 63) {
        return this.http.post(this.authService.pathApi + '/delete_covenant_category', {'covenant_category_ids' : dataIds});
      }else if(pageId == 64) {
        return this.http.post(this.authService.pathApi + '/delete_covenant', {'covenant_ids' : dataIds});
      }else if(pageId == 65) {
        return this.http.post(this.authService.pathApi + '/delete_housing_complex', {'housing_complex_ids' : dataIds});
      }else if (pageId == 8){
        return this.http.post(this.authService.pathApi + '/delete_events' , {'events_id' : dataIds});
      }else if(pageId == 66) {
        return this.http.post(this.authService.pathApi + '/delete_building_information', {'building_information_ids' : dataIds});
      }else if(pageId == 67) {
        return this.http.post(this.authService.pathApi + '/delete_unit_information', {'unit_information_ids' : dataIds});
      }else if(pageId == 68) {
        return this.http.post(this.authService.pathApi + '/delete_unit_covenant', {'unit_covenant_ids' : dataIds});
      }else if(pageId == 72) {
        return this.http.post(this.authService.pathApi + '/delete_request_type', {'types_ids' : dataIds});
      }else if(pageId == 73) {
        return this.http.post(this.authService.pathApi + '/delete_female_request', {'requests_ids' : dataIds});
      }



    };


    //get permissions list of roles
    getPermissionList() {
      return this.http.get(this.authService.pathApi + '/permissions_list');
    }


    //get report pages inside roles
    get_report_pages_inside_roles(roleId: number) {
      return this.http.get(this.authService.pathApi + '/report_pages_inside_roles/' + roleId);
    }

    //get report of users inside roles
    get_report_users_inside_roles(roleId: number) {
      return this.http.get(this.authService.pathApi + '/report_users_inside_roles/' + roleId);
    }

     //get adminstartion 
     getAdinstration() {
      return this.http.get(this.authService.pathApi + '/adminstrations_list');
    }

      //get parent list 
  getParentList(serviceId: number) {
    if(serviceId == 2){
    console.log(this.authService.pathApi + '/parents_list/' + 1);
    return this.http.get(this.authService.pathApi + '/parents_list/' + 1);
      
    }else if(serviceId == 6){
    return this.http.get(this.authService.pathApi + '/parents_list');
    }
  }


    //get internal pages 
    getInternalPages() {
      return this.http.get(this.authService.pathApi + '/system_pages_list');
    }

    //return seconds inot hh-mm-ss
     secondsToDhms(seconds) {
        seconds = Number(seconds);
        var days = Math.floor(seconds / (3600*24));
        seconds  -= days*3600*24;
        var hrs   = Math.floor(seconds / 3600);
        seconds  -= hrs*3600;
        var mnts = Math.floor(seconds / 60);
        seconds  -= mnts*60;
        return (days + " يوم, " + hrs + " ساعه, " + mnts + " دقيقه, " + seconds + " ثانيه");
      }

}
