Built files from Bizgaze WebServer
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

meetingaddress.js 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Communications;
  6. (function (Communications) {
  7. let Meetings;
  8. (function (Meetings) {
  9. let Components;
  10. (function (Components) {
  11. class MeetingAddress extends Unibase.Platform.Core.BaseComponent {
  12. cssFiles() {
  13. return [];
  14. }
  15. jsFiles() {
  16. return ["apps/communications/meetings/managers/meetingmanager.js"];
  17. }
  18. html(id, containerid) {
  19. var html = `<div class="card">
  20. <div class="card-title">
  21. <a class="btn btn_Listsearch_angle">
  22. <i class="fa fa-angle-down hidden"></i>
  23. <span id="hf_widget_title_MeetingAddress">Meeting Address</span>
  24. </a>
  25. <div class="" style="padding-bottom:10px"></div>
  26. <div id="meetingAddressMap" class="text-center b-a" style="height: 250px;">
  27. </div>
  28. <div class="" style="padding-bottom:10px"></div>
  29. <div class="wrapper-sm">
  30. <label id="mapaddress" style="padding-left:10px"></label>
  31. </div>
  32. </div>
  33. </div>`;
  34. return html;
  35. }
  36. load(id, containerid, callback) {
  37. id = Unibase.Themes.Providers.DetailHelper.recordId;
  38. let instance = this;
  39. instance.MeetingAddress(id);
  40. }
  41. init(containerid) {
  42. var instance = this;
  43. instance.fileCacheHelper.loadJsFiles(["apps/communications/meetings/components/meetingaddress.js", "apps/communications/meetings/managers/meetingmanager.js"], function () {
  44. instance.navigationHelper.loadSection(0, containerid, Bizgaze.Apps.Communications.Meetings.Components.MeetingAddress.Instance(), null, null);
  45. });
  46. }
  47. MeetingAddress(id) {
  48. var instance = this;
  49. Bizgaze.Apps.Communications.Meetings.Managers.MeetingManager.Instance().getMeeting(id).then(function (response) {
  50. if (response.result.MeetingLatId == "") {
  51. $("#meetingAddressMap").append("<li id='hours' class='list-group-item no-borders pa-5'></span>");
  52. $("#hours").append("<li id='hours' class='alert alert-info ma-0'>There is no Data</span>");
  53. }
  54. else if (response.result != null) {
  55. var latd = response.result.MeetingLatId;
  56. var lgtd = response.result.MeetingLngId;
  57. var myLatlng = new google.maps.LatLng(latd, lgtd);
  58. var mapOptions = {
  59. zoom: 8,
  60. center: myLatlng,
  61. };
  62. var map = new google.maps.Map(document.getElementById("meetingAddressMap"), mapOptions);
  63. var marker = new google.maps.Marker({
  64. position: myLatlng,
  65. title: "Hello World!",
  66. });
  67. marker.setMap(map);
  68. var url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + latd + "," + lgtd + "&key=" + _mapsettings.key() + "&sensor=false";
  69. var xhr = instance.createCORSRequest1('Get', url);
  70. if (!xhr) {
  71. bootbox.alert('CORS not supported');
  72. return;
  73. }
  74. xhr.onload = function () {
  75. var text = xhr.responseText;
  76. var json = JSON.parse(text);
  77. $("#mapaddress").text(json.results[0].formatted_address);
  78. };
  79. xhr.onerror = function () {
  80. bootbox.alert('Woops, there was an error making the request.');
  81. };
  82. xhr.send();
  83. }
  84. });
  85. }
  86. createCORSRequest1(method, url) {
  87. let XDomainRequest;
  88. var xhr = new XMLHttpRequest();
  89. if ("withCredentials" in xhr) {
  90. xhr.open(method, url, true);
  91. }
  92. else if (typeof XDomainRequest != "undefined") {
  93. xhr = new XDomainRequest();
  94. xhr.open(method, url);
  95. }
  96. else {
  97. xhr = null;
  98. }
  99. return xhr;
  100. }
  101. static Instance() {
  102. if (this.instance === undefined) {
  103. this.instance = new MeetingAddress();
  104. }
  105. return this.instance;
  106. }
  107. }
  108. Components.MeetingAddress = MeetingAddress;
  109. })(Components = Meetings.Components || (Meetings.Components = {}));
  110. })(Meetings = Communications.Meetings || (Communications.Meetings = {}));
  111. })(Communications = Apps.Communications || (Apps.Communications = {}));
  112. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  113. })(Bizgaze || (Bizgaze = {}));