Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

router copy.js 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. (function($) {
  2. var app = $.sammy('#main', function() {
  3. /*this.around(function(callback) {
  4. if (!isOnline()) {
  5. showMessage(glbAppOffline);
  6. } else {
  7. callback();
  8. }
  9. });*/
  10. this.get('#/', function(context) {
  11. preparePage();
  12. request('/api/login/index', {}, function(ret) {
  13. handlePage(ret);
  14. });
  15. });
  16. /*this.get('#/survey/:survey_code', function(context) {
  17. preparePage();
  18. var data = {code:this.params['survey_code']};
  19. request('/api/survey/index', data, function(ret) {
  20. handlePage(ret);
  21. });
  22. });*/
  23. this.get('#/survey-list/:timestamp/:orderField/:orderDir/:pageNumb', function(context) {
  24. preparePage();
  25. var searchData = null;
  26. var form = $('#form-survey-list');
  27. if (form.length > 0) {
  28. searchData = form.serialize();
  29. }
  30. var data = {orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb'], searchData:searchData};
  31. request('/api/survey/surveyList', data, function(ret) {
  32. handlePage(ret);
  33. });
  34. });
  35. this.get('#/survey-edit/:timestamp/:id', function(context) {
  36. preparePage();
  37. var data = {id:this.params['id']};
  38. request('/api/survey/surveyEdit', data, function(ret) {
  39. handlePage(ret, null, function() {
  40. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  41. });
  42. });
  43. });
  44. this.get('#/auto-login/:autologinToken/:requestId', function(context) {
  45. var data = {autologinToken:this.params['autologinToken'], requestId:this.params['requestId']};
  46. request('/api/login/autoLogin', data, function(ret) {
  47. if (typeof ret.RequestID !== 'undefined') {
  48. gotoDest('requests-edit/'+ret.ts+'/'+ret.RequestID+'/view/hashtag/my/hashtag/created_at/desc/1');
  49. } else {
  50. gotoDest('');
  51. }
  52. });
  53. });
  54. this.get('#/success-login', function(context) {
  55. gotoDest('dashboard');
  56. });
  57. this.get('#/disclaimers-accepted', function(context) {
  58. gotoDest('dashboard');
  59. });
  60. this.get('#/dashboard', function(context) {
  61. preparePage();
  62. request('/api/dashboard/index', {}, function(ret) {
  63. handlePage(ret);
  64. });
  65. });
  66. this.get('#/profile/:timestamp', function(context) {
  67. preparePage();
  68. request('/api/user/index', {}, function(ret) {
  69. handlePage(ret, null, function() {
  70. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  71. loadGlobalVariables(); //Update the localised strings
  72. });
  73. });
  74. });
  75. this.get('#/users/:timestamp/:orderField/:orderDir/:pageNumb', function(context) {
  76. preparePage();
  77. var searchData = null;
  78. var form = $('#table-search-users');
  79. if (form.length > 0) {
  80. searchData = form.serialize();
  81. }
  82. var data = {orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb'], searchData:searchData};
  83. request('/api/user/usersList', data, function(ret) {
  84. handlePage(ret, null, function() {
  85. $('html, body').animate({
  86. scrollTop: 0
  87. }, 500);
  88. });
  89. });
  90. });
  91. this.get('#/users-edit/:timestamp/:userId/:orderField/:orderDir/:pageNumb', function(context) {
  92. preparePage();
  93. var data = {userId:this.params['userId'], orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb']};
  94. request('/api/user/usersEdit', data, function(ret) {
  95. handlePage(ret, null, function() {
  96. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  97. $('html, body').animate({
  98. scrollTop: 0
  99. }, 500);
  100. });
  101. });
  102. });
  103. this.get('#/users-search/:timestamp/:orderField/:orderDir/:pageNumb', function(context) {
  104. preparePage();
  105. var searchData = null;
  106. var form = $('#users-advanced-search');
  107. if (form.length > 0) {
  108. searchData = form.serialize();
  109. }
  110. var data = {orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb'], searchData:searchData};
  111. request('/api/user/usersSearch', data, function(ret) {
  112. handlePage(ret, null, function() {
  113. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  114. $('html, body').animate({
  115. scrollTop: $('#search-scroll-pointer').offset().top
  116. }, 500);
  117. });
  118. });
  119. });
  120. this.get('#/users-sessions/:pageNumb', function(context) {
  121. preparePage();
  122. var data = {pageNumb:this.params['pageNumb']};
  123. request('/api/user/usersSessions', data, function(ret) {
  124. handlePage(ret);
  125. });
  126. });
  127. this.get('#/users-access-logs/:pageNumb', function(context) {
  128. preparePage();
  129. var data = {pageNumb:this.params['pageNumb']};
  130. request('/api/user/usersAccessLogs', data, function(ret) {
  131. handlePage(ret);
  132. });
  133. });
  134. this.get('#/notification-tracker/:timestamp/:notifType/:pageNumb', function(context) {
  135. preparePage();
  136. var data = {pageNumb:this.params['pageNumb'], notifType:this.params['notifType']};
  137. request('/api/user/usersNotificationTracker', data, function(ret) {
  138. handlePage(ret);
  139. });
  140. });
  141. this.get('#/requests/:timestamp/:scope/:orderField/:orderDir/:pageNumb', function(context) {
  142. preparePage();
  143. var searchData = null;
  144. var form = $('#table-search-requests');
  145. if (form.length > 0) {
  146. searchData = form.serialize();
  147. }
  148. var data = {scope:this.params['scope'],orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb'], searchData:searchData};
  149. request('/api/request/index', data, function(ret) {
  150. handlePage(ret);
  151. globalICD10List = []; //Reset the ICD10 list
  152. });
  153. });
  154. this.get('#/requests-edit/:timestamp/:requestID/:viewType/:parentTitle/:parentScope/:parentBaseUri/:orderField/:orderDir/:pageNumb', function(context) {
  155. preparePage();
  156. var searchData = null;
  157. var form = $('#request-edit-form');
  158. if (form.length > 0) {
  159. searchData = form.serialize();
  160. }
  161. var data = {requestID:this.params['requestID'],viewType:this.params['viewType'],parentTitle:this.params['parentTitle'], parentScope:this.params['parentScope'], parentBaseUri:this.params['parentBaseUri'], orderField:this.params['orderField'], orderDir:this.params['orderDir'], pageNumb:this.params['pageNumb'], searchData:searchData};
  162. var viewType = this.params['viewType'];
  163. request('/api/request/requestEdit', data, function(ret) {
  164. handlePage(ret, '#main', function() {
  165. //$('.chosen-select').chosen({no_results_text: glbNothingFound});
  166. //$('[data-toggle="tooltip"]').tooltip();
  167. //$('#chosen_view_request_chosen .chosen-search-input').prop('disabled', true); //Avoid removing and searching
  168. //choosenHideDeleteCross();
  169. if (viewType == 'new-edit') {
  170. //wsConnect();
  171. //setInterval(function() {
  172. wsConnect();
  173. //setInterval(function() {
  174. //wsSend('', false);
  175. //}, 500);
  176. //}, 1000);
  177. console.log('Connection called');
  178. setTimeout(function() {
  179. $('#request_cc').trigger('change');
  180. $('#request_cgprovince').trigger('change');
  181. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  182. $('[data-toggle="tooltip"]').tooltip();
  183. }, 500);
  184. }
  185. if (viewType == 'view') {
  186. $('.tooltipstered').tooltipster();
  187. var wsRequestDataDreamPDF = ret.jsonData.requestDreamPDF;
  188. //if (ret.jsonData.userIsAuthor) {
  189. if (ret.jsonData.hasDreamIntegration && ret.jsonData.userIsAuthor) {
  190. wsConnect();
  191. setTimeout(function() {
  192. var ms = '';
  193. if ($('#medical-specialties-obj').length > 0) {
  194. ms = $('#medical-specialties-obj').val();
  195. }
  196. var attachlink = '';
  197. if ($('#dream-attach-link').length > 0) {
  198. attachlink = $('#dream-attach-link').val();
  199. }
  200. wsSend(JSON.stringify({op:'request-pdf-info', ms:ms, attachlink:attachlink, dataPDF:wsRequestDataDreamPDF}), false);
  201. console.log(wsRequestDataDreamPDF);
  202. console.log('Data sent');
  203. }, 1000)
  204. }
  205. $('#pdf_postponed_date').mask('00/00/0000', {placeholder: "gg/mm/aaaa"});
  206. }
  207. /*setInterval(function() {
  208. wsConnect();
  209. }, 1000);*/
  210. });
  211. });
  212. });
  213. this.get('#/requests/:timestamp/logs', function(context) {
  214. preparePage();
  215. request('/api/request/logs', {}, function(ret) {
  216. handlePage(ret);
  217. });
  218. });
  219. this.get('#/centers/:timestamp', function(context) {
  220. preparePage();
  221. request('/api/center/centersList', {}, function(ret) {
  222. handlePage(ret);
  223. });
  224. });
  225. this.get('#/said/:request_code', function(context) {
  226. preparePage();
  227. var data = {request_code:this.params['request_code']};
  228. request('/api/public/showAttachementsInDream', data, function(ret) {
  229. handlePage(ret);
  230. });
  231. });
  232. this.get('#/centers/:timestamp/:center_id', function(context) {
  233. preparePage();
  234. var searchData = null;
  235. var form = $('#center-form');
  236. if (form.length > 0) {
  237. searchData = form.serialize();
  238. }
  239. var data = {center_id:this.params['center_id']};
  240. request('/api/center/index', data, function(ret) {
  241. handlePage(ret, null, function() {
  242. $('.chosen-select').chosen({no_results_text: glbNothingFound});
  243. });
  244. });
  245. });
  246. });
  247. $(function() {
  248. app.run('#/');
  249. });
  250. })(jQuery);