|
@@ -10,211 +10,152 @@ angular.module(
|
|
|
]
|
|
|
)
|
|
|
|
|
|
-.run(function(
|
|
|
- $ionicPlatform,
|
|
|
- $state,
|
|
|
- configFactory
|
|
|
-) {
|
|
|
-
|
|
|
- $ionicPlatform.ready(function() {
|
|
|
- if (window.cordova && window.cordova.plugins.Keyboard) {
|
|
|
- cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
|
|
- cordova.plugins.Keyboard.disableScroll(true);
|
|
|
- }
|
|
|
-
|
|
|
- if (window.StatusBar) {
|
|
|
- StatusBar.overlaysWebView(false);
|
|
|
- StatusBar.backgroundColorByHexString('#387ef5');
|
|
|
- }
|
|
|
-
|
|
|
- db = window.sqlitePlugin.openDatabase({ name: 'odoo.db', location: 'default' });
|
|
|
-
|
|
|
- db.executeSql("CREATE TABLE IF NOT EXISTS 'user' (\n\
|
|
|
- 'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
|
|
|
- 'remote_id' INTEGER DEFAULT 0,\n\
|
|
|
- 'host' VARCHAR(35) DEFAULT 0,\n\
|
|
|
- 'port' INTEGER DEFAULT 0,\n\
|
|
|
- 'database' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'username' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'password' VARCHAR(35) DEFAULT NULL)");
|
|
|
-
|
|
|
- db.executeSql("CREATE TABLE IF NOT EXISTS 'partner' (\n\
|
|
|
- 'id' INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT,\n\
|
|
|
- 'remote_id' INTEGER DEFAULT 0,\n\
|
|
|
- 'modified' INTEGER DEFAULT 0,\n\
|
|
|
- 'modifiedDate' TEXT DEFAULT CURRENT_TIMESTAMP,\n\
|
|
|
- 'name' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'city' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'mobile' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'phone' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'fax' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'email' VARCHAR(100) DEFAULT NULL,\n\
|
|
|
- 'street' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'street2' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'image_medium' BLOB DEFAULT NULL,\n\
|
|
|
- 'image_small' BLOB DEFAULT NULL,\n\
|
|
|
- 'comment' VARCHAR(160) DEFAULT NULL,\n\
|
|
|
- 'customer' INTEGER DEFAULT 0,\n\
|
|
|
- 'employee' INTEGER DEFAULT 0,\n\
|
|
|
- 'is_company' INTEGER DEFAULT 0,\n\
|
|
|
- 'debit' INTEGER DEFAULT 0,\n\
|
|
|
- 'debit_limit' INTEGER DEFAULT 0,\n\
|
|
|
- 'opportunity_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'contracts_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'journal_item_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'meeting_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'phonecall_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'sale_order_count' INTEGER DEFAULT NULL,\n\
|
|
|
- 'total_invoiced' INTEGER DEFAULT NULL);");
|
|
|
-
|
|
|
- db.executeSql("CREATE TABLE IF NOT EXISTS 'lead' (\n\
|
|
|
- 'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
|
|
|
- 'remote_id' INTEGER DEFAULT 0,\n\
|
|
|
- 'modified' INTEGER DEFAULT 0,\n\
|
|
|
- 'modifiedDate' TEXT DEFAULT CURRENT_TIMESTAMP,\n\
|
|
|
- 'name' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'description' VARCHAR(100) DEFAULT NULL,\n\
|
|
|
- 'contact_name' VARCHAR(100) DEFAULT NULL,\n\
|
|
|
- 'phone' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'mobile' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'fax' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'street' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'street2' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'meeting_count' INTEGER DEFAULT 0,\n\
|
|
|
- 'message_bounce' INTEGER DEFAULT 0,\n\
|
|
|
- 'planned_cost' INTEGER DEFAULT 0,\n\
|
|
|
- 'planned_revenue' INTEGER DEFAULT 0,\n\
|
|
|
- 'priority' INTEGER DEFAULT 0,\n\
|
|
|
- 'probability' INTEGER DEFAULT 0,\n\
|
|
|
- 'type' VARCHAR(20) DEFAULT NULL,\n\
|
|
|
- 'stage_id' INTEGER DEFAULT NULL,\n\
|
|
|
- 'user_id' INTEGER DEFAULT 0,\n\
|
|
|
- 'partner_id' INTEGER DEFAULT 0);");
|
|
|
-
|
|
|
- db.executeSql("CREATE TABLE IF NOT EXISTS 'crm_stage' (\n\
|
|
|
- 'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n\
|
|
|
- 'remote_id' INTEGER DEFAULT 0,\n\
|
|
|
- 'modified' INTEGER DEFAULT 0,\n\
|
|
|
- 'modified_date' TEXT DEFAULT CURRENT_TIMESTAMP,\n\
|
|
|
- 'name' VARCHAR(35) DEFAULT NULL,\n\
|
|
|
- 'probability' REAL DEFAULT 0,\n\
|
|
|
- 'type' VARCHAR(100) DEFAULT 'both');");
|
|
|
-
|
|
|
- configFactory(function (configuration) {
|
|
|
- if (configuration) {
|
|
|
- $state.go('app.main');
|
|
|
- } else {
|
|
|
- $state.go('configuration');
|
|
|
+ .run(function (
|
|
|
+ $ionicPlatform,
|
|
|
+ $state,
|
|
|
+ $cordovaSQLite,
|
|
|
+ $cordovaFile,
|
|
|
+ configFactory
|
|
|
+ ) {
|
|
|
+
|
|
|
+ $ionicPlatform.ready(function () {
|
|
|
+ if (window.cordova && window.cordova.plugins.Keyboard) {
|
|
|
+ cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
|
|
+ cordova.plugins.Keyboard.disableScroll(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (window.StatusBar) {
|
|
|
+ StatusBar.overlaysWebView(false);
|
|
|
+ StatusBar.backgroundColorByHexString('#387ef5');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (window.sqlitePlugin) {
|
|
|
+ db = sqlitePlugin.openDatabase({ name: 'odoo.db', location: 'default' });
|
|
|
+
|
|
|
+ $cordovaFile.readAsText(cordova.file.applicationDirectory, 'www/init.sql').then(function (query) {
|
|
|
+ db.transaction(function (tx) {
|
|
|
+ tx.executeSql(query);
|
|
|
+ }, function (txErr) {
|
|
|
+ console.log(txErr);
|
|
|
+ ionic.Platform.exitApp();
|
|
|
+ }, function () {
|
|
|
+ console.log('DB ready')
|
|
|
+ });
|
|
|
+ }).catch(function (readErr) {
|
|
|
+ ionic.Platform.exitApp();
|
|
|
+ });
|
|
|
+
|
|
|
+ configFactory(function (configuration) {
|
|
|
+ if (configuration) {
|
|
|
+ $state.go('app.main');
|
|
|
+ } else {
|
|
|
+ $state.go('configuration');
|
|
|
+ }
|
|
|
+ }, function (err) {
|
|
|
+ $state.go('configuration');
|
|
|
+ });
|
|
|
}
|
|
|
- }, function (err) {
|
|
|
- $state.go('configuration');
|
|
|
});
|
|
|
- });
|
|
|
-})
|
|
|
-
|
|
|
-.config(function (
|
|
|
- $stateProvider,
|
|
|
- $urlRouterProvider,
|
|
|
- // $ionicConfigProvider,
|
|
|
- $translateProvider,
|
|
|
- $ionicFilterBarConfigProvider
|
|
|
-) {
|
|
|
-
|
|
|
- $stateProvider
|
|
|
- .state('app', {
|
|
|
- url: '/app',
|
|
|
- abstract: true,
|
|
|
- templateUrl: 'templates/menu.html'
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.main', {
|
|
|
- url: '/main',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/main.html',
|
|
|
- controller: 'MainController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .config(function (
|
|
|
+ $stateProvider,
|
|
|
+ $urlRouterProvider,
|
|
|
+ $ionicConfigProvider,
|
|
|
+ $translateProvider,
|
|
|
+ $ionicFilterBarConfigProvider
|
|
|
+ ) {
|
|
|
+
|
|
|
+ $stateProvider
|
|
|
+ .state('app', {
|
|
|
+ url: '/app',
|
|
|
+ abstract: true,
|
|
|
+ templateUrl: 'templates/menu.html'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.main', {
|
|
|
+ url: '/main',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/main.html',
|
|
|
+ controller: 'MainController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.sales', {
|
|
|
- url: '/sales',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/sales/sales.html',
|
|
|
- controller: 'SaleController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.sales', {
|
|
|
+ url: '/sales',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/sales/sales.html',
|
|
|
+ controller: 'SaleController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.customers', {
|
|
|
- url: '/customers',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/sales/customers.html',
|
|
|
- controller: 'CustomersController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.customers', {
|
|
|
+ url: '/customers',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/sales/customers.html',
|
|
|
+ controller: 'CustomersController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.leads', {
|
|
|
- url: '/leads',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/sales/leads.html',
|
|
|
- controller: 'LeadsController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.leads', {
|
|
|
+ url: '/leads',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/sales/leads.html',
|
|
|
+ controller: 'LeadsController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.opportunities', {
|
|
|
- url: '/opportunities',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/sales/opportunities.html',
|
|
|
- controller: 'OpportunitiesController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.opportunities', {
|
|
|
+ url: '/opportunities',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/sales/opportunities.html',
|
|
|
+ controller: 'OpportunitiesController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('app.preferences', {
|
|
|
- url: '/preferences',
|
|
|
- views: {
|
|
|
- 'content': {
|
|
|
- templateUrl: 'templates/preferences.html',
|
|
|
- controller: 'PreferencesController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('app.preferences', {
|
|
|
+ url: '/preferences',
|
|
|
+ views: {
|
|
|
+ 'content': {
|
|
|
+ templateUrl: 'templates/preferences.html',
|
|
|
+ controller: 'PreferencesController'
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- .state('configuration', {
|
|
|
- url: '/configuration',
|
|
|
- templateUrl: 'templates/configuration.html',
|
|
|
- controller: 'ConfigurationController'
|
|
|
+ })
|
|
|
+
|
|
|
+ .state('configuration', {
|
|
|
+ url: '/configuration',
|
|
|
+ templateUrl: 'templates/configuration.html',
|
|
|
+ controller: 'ConfigurationController'
|
|
|
+ });
|
|
|
+
|
|
|
+ $translateProvider.translations('es', {
|
|
|
+ Opportunities: 'Oportunidades',
|
|
|
+ New: 'Nuevo',
|
|
|
+ Dead: 'Muerto',
|
|
|
+ Qualification: 'Calificación',
|
|
|
+ Proposition: 'Propuesta',
|
|
|
+ Negotiation: 'Negociación',
|
|
|
+ Won: 'Ganado',
|
|
|
+ Lost: 'Perdido'
|
|
|
});
|
|
|
-
|
|
|
- $translateProvider.translations('es', {
|
|
|
- Opportunities: 'Oportunidades',
|
|
|
- New: 'Nuevo',
|
|
|
- Dead: 'Muerto',
|
|
|
- Qualification: 'Calificación',
|
|
|
- Proposition: 'Propuesta',
|
|
|
- Negotiation: 'Negociación',
|
|
|
- Won: 'Ganado',
|
|
|
- Lost: 'Perdido'
|
|
|
- });
|
|
|
-
|
|
|
- // $urlRouterProvider.otherwise('/configuration');
|
|
|
|
|
|
- // $ionicConfigProvider.tabs.position('bottom');
|
|
|
- // $ionicConfigProvider.backButton.icon('ion-chevron-left');
|
|
|
+ $ionicConfigProvider.spinner.icon('ios');
|
|
|
|
|
|
- $ionicFilterBarConfigProvider.theme('positive');
|
|
|
- $ionicFilterBarConfigProvider.placeholder('Buscar');
|
|
|
+ $ionicFilterBarConfigProvider.theme('positive');
|
|
|
+ $ionicFilterBarConfigProvider.placeholder('Buscar');
|
|
|
|
|
|
- // $translateProvider.useSanitizeValueStrategy('sanitize');
|
|
|
- $translateProvider.useSanitizeValueStrategy('escape');
|
|
|
- $translateProvider.preferredLanguage('es');
|
|
|
- $translateProvider.fallbackLanguage('es');
|
|
|
-
|
|
|
-});
|
|
|
+ $translateProvider.useSanitizeValueStrategy('escape');
|
|
|
+ $translateProvider.preferredLanguage('es');
|
|
|
+ $translateProvider.fallbackLanguage('es');
|
|
|
+ });
|