diff --git a/@salix/app/src/components/main-menu/main-menu.html b/@salix/app/src/components/main-menu/main-menu.html index d629dca34..493887e94 100644 --- a/@salix/app/src/components/main-menu/main-menu.html +++ b/@salix/app/src/components/main-menu/main-menu.html @@ -1,7 +1,7 @@
- + - +
+ + +
\ No newline at end of file diff --git a/@salix/core/src/textarea/textarea.mdl.js b/@salix/core/src/textarea/textarea.mdl.js index 901ce2117..2cc5bf36a 100644 --- a/@salix/core/src/textarea/textarea.mdl.js +++ b/@salix/core/src/textarea/textarea.mdl.js @@ -4,7 +4,9 @@ import * as constant from '../constants'; import template from './textarea.mdl.html'; const _NAME = 'textarea'; -const DEFAULT_CLASS = ''; +const DEFAULT_LABEL = 'textarea'; +const DEFAULT_ROWS = 3; + export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK); @@ -12,9 +14,10 @@ export function factory() { return { template: template, default: { - className: DEFAULT_CLASS, + label: DEFAULT_LABEL, + rows: DEFAULT_ROWS } - } + }; } _module.factory(NAME, factory); diff --git a/@salix/crud/src/client/addresses-data-edit/index.js b/@salix/crud/src/client/addresses-data-edit/index.js index 53f4c0622..0e35bddf6 100644 --- a/@salix/crud/src/client/addresses-data-edit/index.js +++ b/@salix/crud/src/client/addresses-data-edit/index.js @@ -5,8 +5,7 @@ export const NAME = 'vnClientAddressesDataEdit'; export const COMPONENT = { template: template, controllerAs: 'addressData', - controller: function($http,$stateParams) - { + controller: function($http, $stateParams) { this.address = {}; $http.get(`/client/api/Addresses/${$stateParams.addressId}`).then( json => this.address = json.data @@ -17,12 +16,12 @@ export const COMPONENT = { $http.get('/client/api/Provinces').then( json => this.provinces = json.data ); - - this.submit = function(){ - $http.put('/client/api/Addresses', this.address); - } - } -} -COMPONENT.controller.$inject = ['$http' , '$stateParams']; + this.submit = function() { + $http.put('/client/api/Addresses', this.address); + }; + } +}; + +COMPONENT.controller.$inject = ['$http', '$stateParams']; module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/notes/index.html b/@salix/crud/src/client/notes/index.html index 3c7c78338..980911691 100644 --- a/@salix/crud/src/client/notes/index.html +++ b/@salix/crud/src/client/notes/index.html @@ -2,13 +2,17 @@ Notas - + - - - - - +
+ +
+ +
+

{{n.date}}

+

>{{n.text}}

+
+
{{notes.client.notes}}
\ No newline at end of file diff --git a/@salix/crud/src/client/notes/index.js b/@salix/crud/src/client/notes/index.js index c362fba22..c8d51e132 100644 --- a/@salix/crud/src/client/notes/index.js +++ b/@salix/crud/src/client/notes/index.js @@ -9,10 +9,18 @@ export const COMPONENT = { client: '<' }, controller: function($http) { + this.notes = []; this.submit = function() { - $http.put('/client/api/Clients', this.client); + this.notes.push({ + text: this.newNote, + salesPerson: 'user' + }); + + $http.put('/client/api/ClientObservation', this.client).then(() => { + this.newNote = ""; + }); }; } }; COMPONENT.controller.$inject = ['$http']; -module.component(NAME, COMPONENT); \ No newline at end of file +module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/routes.js b/@salix/crud/src/client/routes.js index c3ae069f6..23dd0d3f1 100644 --- a/@salix/crud/src/client/routes.js +++ b/@salix/crud/src/client/routes.js @@ -46,6 +46,9 @@ url: "/notes", state: "clientCard.notes", component: "vn-client-notes", + params: { + client: "card.client" + }, description: "Notas", icon: "insert_drive_file" }, { diff --git a/@salix/crud/src/client/web-access/index.html b/@salix/crud/src/client/web-access/index.html index 7e8e97433..540ee47e7 100644 --- a/@salix/crud/src/client/web-access/index.html +++ b/@salix/crud/src/client/web-access/index.html @@ -6,8 +6,8 @@
- - + + diff --git a/@salix/login/src/login/login.js b/@salix/login/src/login/login.js index 6d71a1312..ea19de4af 100644 --- a/@salix/login/src/login/login.js +++ b/@salix/login/src/login/login.js @@ -1,65 +1,65 @@ -import {module} from '../module' -import template from './login.html' -import style from './login.scss' +import {module} from '../module'; +import template from './login.html'; +import style from './login.scss'; export const COMPONENT = -{ - template: template, - controller: controller, - controllerAs: 'login' -}; + { + template: template, + controller: controller, + controllerAs: 'login' + }; module.component('vnLogin', COMPONENT); controller.$inject = ['$http', '$element']; function controller($http, $element) { - var self = this; - this.submit = function() { - let model = this.model; + var self = this; + this.submit = function() { + let model = this.model; - if(!(model && model.email && model.password)) { - showMessage('Please insert your email and password'); - return; - } - - this.loading = true; - model.appId = window.location.href; - $http.post('/account', this.model).then ( + if (!(model && model.email && model.password)) { + showMessage('Please insert your email and password'); + return; + } + + this.loading = true; + model.appId = window.location.href; + $http.post('/account', this.model).then( onLoginOk, onLoginErr ); - }; - function onLoginOk (response) { - self.loading = false; - window.location = response.data.location +'?access_token='+ response.data.accessToken; - } - function onLoginErr(response) { - self.loading = false; - self.model.password = ''; + }; + function onLoginOk(response) { + self.loading = false; + window.location = response.data.location + '?access_token=' + response.data.accessToken; + } + function onLoginErr(response) { + self.loading = false; + self.model.password = ''; - let message; + let message; - switch(response.status) { - case 401: - message = 'Invalid credentials'; - break; - case -1: - message = 'Can\'t contact with server'; - break; - default: - message = 'Something went wrong'; - } - - showMessage(message); - } - function showMessage(message) { - let snackbar = $element.find('vn-snackbar').controller('vnSnackbar'); - snackbar.show({message: message}); - } + switch (response.status) { + case 401: + message = 'Invalid credentials'; + break; + case -1: + message = 'Can\'t contact with server'; + break; + default: + message = 'Something went wrong'; + } + + showMessage(message); + } + function showMessage(message) { + let snackbar = $element.find('vn-snackbar').controller('vnSnackbar'); + snackbar.show({message: message}); + } } module.config(['$httpProvider', function($httpProvider) { - $httpProvider.defaults.useXDomain = true; - delete $httpProvider.defaults.headers.common['X-Requested-With']; - } + $httpProvider.defaults.useXDomain = true; + delete $httpProvider.defaults.headers.common['X-Requested-With']; +} ]); diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json new file mode 100644 index 000000000..380c752d5 --- /dev/null +++ b/services/client/common/models/ClientObservation.json @@ -0,0 +1,33 @@ +{ + "name": "ClientObservation", + "description": "Notas de los clientes.", + "base": "PersistedModel", + "validateUpsert": true, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "text": { + "type": "string", + "description": "Fiscal indetifier" + }, + "creationDate": { + "type": "date", + "description": "Fiscal indetifier" + }, + "relations": { + "salesPerson": { + "type": "belongsTo", + "model": "SalesPerson", + "foreignKey": "salePersonId" + }, + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientId" + } + } + } +} diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 3990548e5..cdeb2a719 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -59,5 +59,9 @@ "Country": { "dataSource": "db", "public": true + }, + "ClientObservation": { + "dataSource": "db", + "public": true } } \ No newline at end of file