configuration.controller.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. angular.module('odoo')
  2. /**
  3. *
  4. */
  5. .controller('ConfigurationController', function (
  6. $scope,
  7. $state,
  8. $ionicLoading,
  9. $ionicPopup,
  10. $localStorage,
  11. odooFactory,
  12. databaseFactory
  13. ) {
  14. $scope.loading = false;
  15. $scope.configuration = $localStorage.$default({
  16. host: '192.168.2.105',
  17. port: 8069,
  18. database: 'odoo',
  19. username: 'admin',
  20. password: 'admin',
  21. id: null
  22. });
  23. /**
  24. *
  25. */
  26. $scope.auth = function () {
  27. $scope.loading = true;
  28. odooFactory.auth($scope.configuration, function (id) {
  29. $scope.configuration.id = id;
  30. databaseFactory.initTables(function (result) {
  31. $scope.loading = false;
  32. $state.go('app.main');
  33. }, function (err) {
  34. $scope.loading = false;
  35. console.log(err);
  36. });
  37. }, function (err) {
  38. $scope.loading = false;
  39. console.log(err);
  40. });
  41. }
  42. });