external-hospital.component.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { NgxSpinnerService } from 'ngx-spinner';
  2. import { AuthServiceService } from './../../shared/auth-service.service';
  3. import { ExternalPageService } from './../../shared/external-page.service';
  4. import { ActivatedRoute, Params } from '@angular/router';
  5. import { Component, OnInit } from '@angular/core';
  6. @Component({
  7. selector: 'app-external-hospital',
  8. templateUrl: './external-hospital.component.html',
  9. styleUrls: ['./external-hospital.component.css']
  10. })
  11. export class ExternalHospitalComponent implements OnInit {
  12. // customOptions: any = {
  13. // loop: true,
  14. // mouseDrag: false,
  15. // touchDrag: false,
  16. // pullDrag: false,
  17. // dots: false,
  18. // navSpeed: 700,
  19. // navText: [ '<i class="fa-chevron-left"></i>', '<i class="fa-chevron-right></i>"' ],
  20. // responsive: {
  21. // 0: {
  22. // items: 1
  23. // },
  24. // 400: {
  25. // items: 2
  26. // },
  27. // 740: {
  28. // items: 3
  29. // },
  30. // 940: {
  31. // items: 4
  32. // }
  33. // },
  34. // nav: true
  35. // }
  36. // slidesStore=[];
  37. number: number = 1;
  38. numberWidth:number = 6;
  39. typePage: string = '';
  40. data = [];
  41. detailsField = {
  42. title_en: '',
  43. title: '',
  44. description: '',
  45. description_en: '',
  46. }
  47. constructor(private route: ActivatedRoute,
  48. public authSer: AuthServiceService,
  49. private spinner: NgxSpinnerService,
  50. private externalService: ExternalPageService) {
  51. this.spinner.show();
  52. }
  53. ngOnInit() {
  54. this.authSer.homeActivate = false;
  55. // //catch params type from URL
  56. // this.route.params.subscribe(
  57. // (params:Params) => {
  58. // this.typePage = params['type_page'];
  59. // }
  60. // );
  61. // this.slidesStore = [
  62. // {src: '../../../assets/image/avatar.png', alt: 'title', title: 'title' , id: 1},
  63. // {src: '../../../assets/image/avatar.png', alt: 'title', title: 'title', id: 2},
  64. // {src: '../../../assets/image/avatar.png', alt: 'title', title: 'title', id: 3},
  65. // {src: '../../../assets/image/avatar.png', alt: 'title', title: 'title', id: 4}
  66. // ];
  67. //get hospital or managaments data
  68. //to add class active if hospital route activate
  69. this.externalService.getHospitalMangamentsData('hospital').subscribe(
  70. (responce) => {
  71. console.log(responce);
  72. this.data = responce['hospitals_centers'];
  73. console.log('data hospital', this.data);
  74. this.showDescriptionDetails(this.data[0].fields[0]);
  75. this.spinner.hide();
  76. },
  77. (error) => {
  78. console.log(error);
  79. }
  80. );
  81. this.externalService.getHeader().subscribe(
  82. (responce) => {
  83. this.externalService.headerMenus = responce['parents'];
  84. for(let i = 0; i < this.externalService.headerMenus.length; i++) {
  85. if(this.externalService.headerMenus[i].id == 19) {
  86. this.externalService.headerMenus[i].active = 1;
  87. } else {
  88. this.externalService.headerMenus[i].active = 0;
  89. }
  90. }
  91. this.spinner.hide();
  92. },
  93. (error) => {
  94. console.log(error);
  95. }
  96. );
  97. }
  98. //show data of filed if click
  99. showDescriptionDetails(fieldData) {
  100. console.log(fieldData);
  101. this.detailsField = {
  102. title: fieldData.title,
  103. title_en: fieldData.title_en,
  104. description: fieldData.description,
  105. description_en: fieldData.description_en,
  106. }
  107. console.log(this.detailsField);
  108. };
  109. customOptions: any = {
  110. loop: true,
  111. mouseDrag: false,
  112. touchDrag: false,
  113. pullDrag: false,
  114. dots: false,
  115. navSpeed: 700,
  116. navText: ['', ''],
  117. responsive: {
  118. 0: {
  119. items: 1
  120. },
  121. 400: {
  122. items: 2
  123. },
  124. 740: {
  125. items: 3
  126. },
  127. 940: {
  128. items: 4
  129. }
  130. },
  131. nav: true
  132. }
  133. }