configuration.controller.js 1.1 KB

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