diff --git a/@salix/app/src/components/searchbar/searchbar.html b/@salix/app/src/components/searchbar/searchbar.html index 4f376c400..e6afb9b59 100644 --- a/@salix/app/src/components/searchbar/searchbar.html +++ b/@salix/app/src/components/searchbar/searchbar.html @@ -1,6 +1,6 @@ - keyboard_arrow_down - + keyboard_arrow_down + \ No newline at end of file diff --git a/@salix/core/src/icon-button/icon-button.mdl.html b/@salix/core/src/icon-button/icon-button.mdl.html index 5335a59c8..89b695f27 100644 --- a/@salix/core/src/icon-button/icon-button.mdl.html +++ b/@salix/core/src/icon-button/icon-button.mdl.html @@ -1,3 +1,3 @@ - \ No newline at end of file diff --git a/@salix/core/src/icon-button/icon-button.mdl.js b/@salix/core/src/icon-button/icon-button.mdl.js index 4ef6d0084..4164d5d99 100644 --- a/@salix/core/src/icon-button/icon-button.mdl.js +++ b/@salix/core/src/icon-button/icon-button.mdl.js @@ -9,6 +9,7 @@ export function factory() { enabled: 'true', typeName: 'button', icon: '', + label: '', } } } diff --git a/@salix/core/src/mdl-override.css b/@salix/core/src/mdl-override.css index d0e7b8f4d..fedc64395 100644 --- a/@salix/core/src/mdl-override.css +++ b/@salix/core/src/mdl-override.css @@ -7,6 +7,16 @@ font-weight: bolder; color: white; } + +.mdl-button--icon { + background-color: #ff9400; + font-weight: bolder; + color: white; +} +.mdl-button--icon:hover { + background-color: #ffa410; +} + .mdl-button--raised:hover { background-color: #ffa410; } \ No newline at end of file diff --git a/@salix/crud/src/client/basic-data/index.html b/@salix/crud/src/client/basic-data/index.html index a9ae55985..c80ab62f5 100644 --- a/@salix/crud/src/client/basic-data/index.html +++ b/@salix/crud/src/client/basic-data/index.html @@ -1,23 +1,21 @@
Datos básicos - - + + - - + + - - - - + + + - - - + + diff --git a/@salix/crud/src/client/basic-data/index.js b/@salix/crud/src/client/basic-data/index.js index c26858545..744647225 100644 --- a/@salix/crud/src/client/basic-data/index.js +++ b/@salix/crud/src/client/basic-data/index.js @@ -9,14 +9,20 @@ export const COMPONENT = { client: '<' }, controller: function($http) { + $http.get('/client/api/SalesPeople').then( + json => { + this.sales = json.data; + console.log(this.sales); + }, + json => console.error(json.data.error.message) + ); this.submit = function() { - $http.post('/client/api/Clients', this.model).then( + $http.put('/client/api/Clients', this.client).then( json => console.log(json.statusText), json => console.error(json.data.error.message) ); }; - }, - controllerAs: 'client' + } }; COMPONENT.controller.$inject = ['$http']; module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/client.js b/@salix/crud/src/client/client.js index ee32f09fd..386b49a9e 100644 --- a/@salix/crud/src/client/client.js +++ b/@salix/crud/src/client/client.js @@ -17,4 +17,6 @@ export {NAME as CLIENT_NOTES, export {NAME as CLIENT_SEARCH_PANEL, COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel'; export {NAME as CLIENT_ITEM, - COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client'; \ No newline at end of file + COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client'; +export {NAME as CLIENT_CREATE, + COMPONENT as CLIENT_CREATE_COMPONENT} from './create/index'; \ No newline at end of file diff --git a/@salix/crud/src/client/create/index.html b/@salix/crud/src/client/create/index.html new file mode 100644 index 000000000..60bfd59ed --- /dev/null +++ b/@salix/crud/src/client/create/index.html @@ -0,0 +1,16 @@ + + Crear Cliente + + + + + + + + + + + + + + \ No newline at end of file diff --git a/@salix/crud/src/client/create/index.js b/@salix/crud/src/client/create/index.js new file mode 100644 index 000000000..138116147 --- /dev/null +++ b/@salix/crud/src/client/create/index.js @@ -0,0 +1,18 @@ +import template from './index.html'; +import {module} from '../../module'; + +export const NAME = "vnClientCreate"; +export const COMPONENT = { + template: template, + controllerAs: "create", + controller: function($http, $state){ + this.submit = function(){ + $http.post('/client/api/Clients', this.model).then( + json => $state.go('clientCard.basicData',{id: json.data.id}), + json => console.error(json.data.error.message) + ); + }; + } +}; +COMPONENT.controller.$inject = ["$http", "$state"]; +module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/index/index.html b/@salix/crud/src/client/index/index.html index deb5fb19f..590843163 100644 --- a/@salix/crud/src/client/index/index.html +++ b/@salix/crud/src/client/index/index.html @@ -1,16 +1,23 @@ - - - - - - - - - - - - - - - \ No newline at end of file + +
+ + + + + + + + + + + + + + + + + + +
+ diff --git a/@salix/crud/src/client/index/index.js b/@salix/crud/src/client/index/index.js index 1938dc461..768656953 100644 --- a/@salix/crud/src/client/index/index.js +++ b/@salix/crud/src/client/index/index.js @@ -15,12 +15,13 @@ export const COMPONENT = { json => console.error(json.data.error.message) ); - this.submit = function() { - var query = {where: this.model, fields: {id: true}}; + var query = {where: model}; + var self = this; $http.get(`/client/api/Clients/findOne?filter=${JSON.stringify(query)}`).then( function(response) { - console.log(response); + self.clients = []; + self.clients.push(response.data); }, function(response) { console.log(response); diff --git a/@salix/crud/src/client/index/item-client.html b/@salix/crud/src/client/index/item-client.html index 6c4fb9521..9221e3f21 100644 --- a/@salix/crud/src/client/index/item-client.html +++ b/@salix/crud/src/client/index/item-client.html @@ -6,7 +6,7 @@
{{itemClient.client.phone}}, {{itemClient.client.contact}}
- + edit
\ No newline at end of file diff --git a/@salix/crud/src/client/routes.js b/@salix/crud/src/client/routes.js index fafd52143..e880fbc06 100644 --- a/@salix/crud/src/client/routes.js +++ b/@salix/crud/src/client/routes.js @@ -1,45 +1,58 @@ { module: "crud", - routes: [{ - url: "/clients", - state: "clients", - component: "vn-client-index" - },{ - url: "/clients/:id", - state: "clientCard", - component: "vn-client-card" - },{ - url: "/basic-data", - state: "clientCard.basicData", - component: "vn-client-basic-data", - params: { - client: "card.client" + routes: [ + { + url: "/clients", + state: "clients", + component: "vn-client-index" }, - description: "Datos básicos", - icon: "person" - },{ - url: "/fiscal-data", - state: "clientCard.fiscalData", - component: "vn-client-fiscal-data", - description: "Datos facturación", - icon: "assignment" - },{ - url: "/addresses", - state: "clientCard.addresses", - component: "vn-client-addresses", - description: "Consignatarios", - icon: "local_shipping" - },{ - url: "/web-access", - state: "clientCard.webAccess", - component: "vn-client-web-access", - description: "Acceso web", - icon: "language" - },{ - url: "/notes", - state: "clientCard.notes", - component: "vn-client-notes", - description: "Notas", - icon: "insert_drive_file" - }] + { + url: "/clients/:id", + state: "clientCard", + component: "vn-client-card" + }, + { + url: "/basic-data", + state: "clientCard.basicData", + component: "vn-client-basic-data", + params: { + client: "card.client" + }, + description: "Datos básicos", + icon: "person" + } + ,{ + url: "/fiscal-data", + state: "clientCard.fiscalData", + component: "vn-client-fiscal-data", + description: "Datos facturación", + icon: "assignment" + }, + { + url: "/addresses", + state: "clientCard.addresses", + component: "vn-client-addresses", + description: "Consignatarios", + icon: "local_shipping" + }, + { + url: "/web-access", + state: "clientCard.webAccess", + component: "vn-client-web-access", + description: "Acceso web", + icon: "language" + }, + { + url: "/notes", + state: "clientCard.notes", + component: "vn-client-notes", + description: "Notas", + icon: "insert_drive_file" + }, + { + url: "/create", + state: "create", + component: "vn-client-create", + } + ] } \ No newline at end of file diff --git a/db.json b/db.json index 4a58b0ac2..80c1bb7bb 100644 --- a/db.json +++ b/db.json @@ -2,7 +2,9 @@ "ids": { "User": 2, "AccessToken": 2, - "Client": 3 + "Client": 15, + "PaymentMethod": 4, + "SalesPerson": 4 }, "models": { "User": { @@ -12,8 +14,18 @@ "NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue": "{\"id\":\"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue\",\"ttl\":1209600,\"created\":\"2016-11-21T11:06:11.113Z\",\"userId\":1}" }, "Client": { - "1": "{\"name\":\"Cliente1 SL\",\"salesPerson\":1,\"fi\":\"123456789\",\"registerDate\":\"29/11/2016\",\"contact\":\"a@a.com\",\"phone\":\"123456789\",\"quality\":\"1\",\"id\":1}", - "2": "{\"name\":\"Cliente2 SL\",\"salesPerson\":1,\"fi\":\"123456788\",\"contact\":\"b@b.com\",\"phone\":\"222222222\",\"quality\":\"1\",\"id\":2}" + "12": "{\"name\":\"Cliente 2\",\"id\":12,\"fi\":\"1111111111\",\"salesPerson\":\"2\"}", + "14": "{\"name\":\"cliente 1\",\"id\":14}" + }, + "PaymentMethod": { + "1": "{\"name\":\"Tarjeta\",\"id\":1}", + "2": "{\"name\":\"Giro Bancario\",\"id\":2}", + "3": "{\"name\":\"Transferencia\",\"id\":3}" + }, + "SalesPerson": { + "1": "{\"id\":1,\"name\":\"Jesus Brocal\"}", + "2": "{\"name\":\"Juan Carlos Lorenzo\",\"id\":2}", + "3": "{\"name\":\"Carlos Zambrano\",\"id\":3}" } } } \ No newline at end of file diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 23169de32..d539a62ee 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -35,9 +35,7 @@ }, "active": { "type": "boolean" - } - - /* + }, "credit": { "type": "Number" }, @@ -61,14 +59,18 @@ "invoiceByEmail": { "type": "boolean", "description": "Send invoices by email" + }, + "relations": { + "salesPerson": { + "type": "belongsTo", + "model": "SalesPerson", + "foreignKey": "salePersonId" + }, + "paymentMethod":{ + "type": "belongsTo", + "model": "PaymentMethod", + "foreingKey": "payId" + } } - - - "salesPerson": { - "type": "Number", - "required": "true" - },*/ - - } } diff --git a/services/client/common/models/PaymentMethod.json b/services/client/common/models/PaymentMethod.json new file mode 100644 index 000000000..8a7f82b85 --- /dev/null +++ b/services/client/common/models/PaymentMethod.json @@ -0,0 +1,15 @@ +{ + "name": "PaymentMethod", + "base": "PersistedModel", + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": "true" + } + } +} diff --git a/services/client/common/models/SalesPerson.json b/services/client/common/models/SalesPerson.json new file mode 100644 index 000000000..07d998b12 --- /dev/null +++ b/services/client/common/models/SalesPerson.json @@ -0,0 +1,15 @@ +{ + "name": "SalesPerson", + "base": "PersistedModel", + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": "true" + } + } +} diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 54776dba3..16701ccfe 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -36,6 +36,14 @@ "dataSource": "db", "public": true }, + "PaymentMethod": { + "dataSource": "db", + "public": true + }, + "SalesPerson": { + "dataSource": "db", + "public": true + }, "Address": { "dataSource": "db", "public": true