You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apputils.business.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Created by robin on 12/15/16.
  3. */
  4. (function () {
  5. 'use strict';
  6. angular.module('appSdk')
  7. .factory('AppUtilsBusiness', ['$rootScope', '$translate', 'luBusyBusiness', function($rootScope, $translate, luBusyBusiness) {
  8. var AppUtilsBusiness = {};
  9. AppUtilsBusiness.convertOrderBy = function(orderBy)
  10. {
  11. if (orderBy[0] == '-') {
  12. orderBy = orderBy.substr(1) + ":DESC";
  13. }
  14. else {
  15. orderBy = orderBy + ":ASC";
  16. }
  17. return orderBy;
  18. };
  19. AppUtilsBusiness.setTitle = function(title)
  20. {
  21. $rootScope.title = title + ' - ' + AppUtilsBusiness.tr('common.appName');
  22. };
  23. AppUtilsBusiness.setToolbarTitle = function(title)
  24. {
  25. $rootScope.$emit('toolbar.title', {title: title});
  26. };
  27. AppUtilsBusiness.mdTableLabels = function()
  28. {
  29. return {
  30. of: AppUtilsBusiness.tr('common.pagination.of'),
  31. page: AppUtilsBusiness.tr('common.pagination.page'),
  32. rowsPerPage: AppUtilsBusiness.tr('common.pagination.rowsPerPage')
  33. };
  34. };
  35. AppUtilsBusiness.cgBusy = function(luBusyGroup)
  36. {
  37. return {
  38. promise: luBusyBusiness.promise(luBusyGroup),
  39. message: AppUtilsBusiness.tr('common.busyLoading'),
  40. templateUrl:'views/busy-template.html'
  41. };
  42. };
  43. AppUtilsBusiness.tr = function(id, data)
  44. {
  45. return $translate.instant(id, data);
  46. };
  47. return AppUtilsBusiness;
  48. }]);
  49. })();