123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- angular.module(
- 'odoo',
- [
- 'ionic',
- 'ngCordova',
- 'xml-rpc',
- 'jett.ionic.filter.bar',
- 'ionic-toast',
- 'pascalprecht.translate'
- ]
- )
- .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');
- }
- }, 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'
- }
- }
- })
- .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.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.preferences', {
- url: '/preferences',
- views: {
- 'content': {
- templateUrl: 'templates/preferences.html',
- controller: 'PreferencesController'
- }
- }
- })
- .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'
- });
- // $urlRouterProvider.otherwise('/configuration');
- // $ionicConfigProvider.tabs.position('bottom');
- // $ionicConfigProvider.backButton.icon('ion-chevron-left');
- $ionicFilterBarConfigProvider.theme('positive');
- $ionicFilterBarConfigProvider.placeholder('Buscar');
- // $translateProvider.useSanitizeValueStrategy('sanitize');
- $translateProvider.useSanitizeValueStrategy('escape');
- $translateProvider.preferredLanguage('es');
- $translateProvider.fallbackLanguage('es');
- });
|