customers.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. 'use strict';
  2. angular.module('fehlerberichtApp')
  3. .controller('CustomersCtrl', function ($scope, $http) {
  4. var webservice = 'http://rbs06:8090/fehlerbericht/db.php?';
  5. $scope.info = [];
  6. $scope.error = -1;
  7. $scope.domain = {
  8. 'aktiv': {
  9. '1': 'Aktiv',
  10. '0': 'Inaktiv'
  11. },
  12. 'system': [
  13. '?',
  14. 'Autosys',
  15. 'Autosys-Light',
  16. 'CarIT-Audev',
  17. 'EDS',
  18. 'Filaks',
  19. 'GlobalCube',
  20. 'Navision',
  21. 'Optima',
  22. 'Optima-Light'
  23. ],
  24. 'woche': [
  25. 'Mo-Fr',
  26. 'Mo-Sa',
  27. 'Mo-So',
  28. 'Di-So'
  29. ],
  30. 'bundesland': {
  31. 'AT': 'Österreich',
  32. 'BW': 'Baden-Württemberg',
  33. 'BY': 'Bayern',
  34. 'BE': 'Berlin',
  35. 'BB': 'Brandenburg',
  36. 'HB': 'Bremen',
  37. 'HH': 'Hamburg',
  38. 'HE': 'Hessen',
  39. 'MV': 'Mecklenburg-Vorpommern',
  40. 'NI': 'Niedersachsen',
  41. 'NW': 'Nordrhein-Westfalen',
  42. 'RP': 'Rheinland-Pfalz',
  43. 'SL': 'Saarland',
  44. 'SN': 'Sachsen',
  45. 'ST': 'Sachsen-Anhalt',
  46. 'SH': 'Schleswig-Holstein',
  47. 'TH': 'Thüringen'
  48. }
  49. };
  50. $scope.kunden = [];
  51. $scope.current = {
  52. 'zeile' : {},
  53. 'fehler': {}
  54. };
  55. $scope.Filter = {
  56. 'aktiv': '1',
  57. 'kunde': '',
  58. 'system': ''
  59. };
  60. $scope.removeItem = function (index) {
  61. // Beispiel
  62. $scope.Bestellungen = $scope.Bestellungen.splice(index, 1);
  63. };
  64. $scope.refresh = function () {
  65. $http.get(webservice + 'a=kunden').success(function (data) {
  66. $scope.kunden = data;
  67. });
  68. };
  69. $scope.refresh();
  70. $scope.firstChar = function (t) {
  71. if (t === '') {
  72. return '?';
  73. }
  74. return t.substring(0, 1);
  75. };
  76. $scope.save = function () {
  77. $http.put(webservice + 'a=kunden', $scope.kunden).success(function (data) {
  78. $scope.kunden = data;
  79. });
  80. };
  81. });