parent
440e9705d2
commit
6eca92afcc
|
@ -1,6 +1,6 @@
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="search"></vn-textfield>
|
<vn-textfield vn-one label="search"></vn-textfield>
|
||||||
<i class="material-icons" id="down_menu">keyboard_arrow_down</i>
|
<i class="material-icons">keyboard_arrow_down</i>
|
||||||
<vn-icon-button icon="search"></vn-icon-button>
|
<vn-icon-button icon="search" margin-small-top></vn-icon-button>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<button type="*[typeName]*" class="mdl-button mdl-js-button mdl-button--icon *[className]*">
|
<button type="*[typeName]*" class="mdl-button mdl-js-button mdl-button--raised *[className]*">
|
||||||
<i class="material-icons">*[icon]*</i>
|
<i class="material-icons">*[icon]*</i>*[label]*
|
||||||
</button>
|
</button>
|
|
@ -9,6 +9,7 @@ export function factory() {
|
||||||
enabled: 'true',
|
enabled: 'true',
|
||||||
typeName: 'button',
|
typeName: 'button',
|
||||||
icon: '',
|
icon: '',
|
||||||
|
label: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,16 @@
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mdl-button--icon {
|
||||||
|
background-color: #ff9400;
|
||||||
|
font-weight: bolder;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.mdl-button--icon:hover {
|
||||||
|
background-color: #ffa410;
|
||||||
|
}
|
||||||
|
|
||||||
.mdl-button--raised:hover {
|
.mdl-button--raised:hover {
|
||||||
background-color: #ffa410;
|
background-color: #ffa410;
|
||||||
}
|
}
|
|
@ -1,23 +1,21 @@
|
||||||
<form ng-submit="basicData.submit()" pad-large>
|
<form ng-submit="basicData.submit()" pad-large>
|
||||||
<vn-title>Datos básicos</vn-title>
|
<vn-title>Datos básicos</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Nombre" name="name" entity="client"></vn-textfield>
|
<vn-textfield vn-one label="Nombre" model="basicData.client.name" entity="basicData"></vn-textfield>
|
||||||
<vn-textfield vn-one label="NIF/CIF" name="fi" entity="client"></vn-textfield>
|
<vn-textfield vn-one label="NIF/CIF" model="basicData.client.fi" entity="basicData"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield autofocus vn-one label="Razón social" field="socialName" entity="client"></vn-textfield>
|
<vn-textfield autofocus vn-one label="Razón social" model="basicData.client.socialName" entity="basicData"></vn-textfield>
|
||||||
<vn-date-picker vn-one label="Fecha alta" field="dischargeDate" entity="client"></vn-date-picker>
|
<vn-date-picker vn-one label="Fecha alta" model="basicData.client.dischargeDate" entity="basicData"></vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<!--<vn-textfield vn-one label="Contacto" name="contact" model="basicData.client"></vn-textfield>-->
|
<vn-textfield vn-one label="Teléfono" model="basicData.client.telefono" entity="basicData"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Teléfono" name="telefono" entity="client"></vn-textfield>
|
<vn-textfield vn-one label="Fax" model="basicData.client.fax" entity="basicData"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Fax" name="fax" entity="client"></vn-textfield>
|
<vn-textfield vn-one label="Email" fiemodelld="basicData.client.email" entity="basicData"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Email" name="email" entity="client"></vn-textfield>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-combo vn-one label="Comercial" name="salesPerson" entity="client">
|
<vn-combo vn-one label="Comercial" model="basicData.client.salesPerson" entity="basicData">
|
||||||
<option value="1">Comercial 1</option>
|
<option ng-repeat="p in basicData.sales" value="{{p.id}}">{{p.name}}</ng-repeat>
|
||||||
<option value="2">Comercial 2</option>
|
|
||||||
</vn-combo>
|
</vn-combo>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -9,14 +9,20 @@ export const COMPONENT = {
|
||||||
client: '<'
|
client: '<'
|
||||||
},
|
},
|
||||||
controller: function($http) {
|
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() {
|
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.log(json.statusText),
|
||||||
json => console.error(json.data.error.message)
|
json => console.error(json.data.error.message)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
controllerAs: 'client'
|
|
||||||
};
|
};
|
||||||
COMPONENT.controller.$inject = ['$http'];
|
COMPONENT.controller.$inject = ['$http'];
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
|
@ -17,4 +17,6 @@ export {NAME as CLIENT_NOTES,
|
||||||
export {NAME as CLIENT_SEARCH_PANEL,
|
export {NAME as CLIENT_SEARCH_PANEL,
|
||||||
COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel';
|
COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel';
|
||||||
export {NAME as CLIENT_ITEM,
|
export {NAME as CLIENT_ITEM,
|
||||||
COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client';
|
COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client';
|
||||||
|
export {NAME as CLIENT_CREATE,
|
||||||
|
COMPONENT as CLIENT_CREATE_COMPONENT} from './create/index';
|
|
@ -0,0 +1,16 @@
|
||||||
|
<form ng-submit="create.submit()" pad-large>
|
||||||
|
<vn-title>Crear Cliente</vn-title>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield vn-one label="Nombre" field="name" entity="create"></vn-textfield>
|
||||||
|
<vn-textfield vn-one label="NIF/CIF" field="fi" entity="create"></vn-textfield>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield autofocus vn-one label="Razón social" field="socialName" entity="create"></vn-textfield>
|
||||||
|
<vn-one></vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-one>
|
||||||
|
<vn-submit label="Crear" id="create"></vn-submit>
|
||||||
|
</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</form>
|
|
@ -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);
|
|
@ -1,16 +1,23 @@
|
||||||
<vn-vertical class="full-height">
|
<vn-vertical class="full-height">
|
||||||
<vn-topbar></vn-topbar>
|
<vn-topbar></vn-topbar>
|
||||||
<vn-horizontal>
|
<form ng-submit="search.submit()" pad-large>
|
||||||
<vn-four></vn-four>
|
<vn-horizontal>
|
||||||
<vn-searchbar vn-four id="searchbar"></vn-searchbar>
|
<vn-four></vn-four>
|
||||||
<vn-search-panel ></vn-search-panel>
|
<vn-searchbar vn-four></vn-searchbar>
|
||||||
<vn-four></vn-four>
|
<vn-four></vn-four>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-three></vn-three>
|
<vn-four></vn-four>
|
||||||
<vn-vertical>
|
<a vn-two ui-sref="create"><vn-button label="Create client"></vn-button></a>
|
||||||
<vn-item-client ng-repeat="client in search.clients" client="client" vn-six></vn-item-client>
|
<vn-submit vn-two label="Buscar"></vn-submit>
|
||||||
</vn-vertical>
|
<vn-four></vn-four>
|
||||||
<vn-three></vn-three>
|
</vn-horizontal>
|
||||||
</vn-horizontal>
|
<vn-horizontal>
|
||||||
</vn-vertical>
|
<vn-three></vn-three>
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-item-client ng-repeat="client in search.clients" client="client" vn-six></vn-item-client>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-three></vn-three>
|
||||||
|
</vn-horizontal>
|
||||||
|
</form>
|
||||||
|
</vn-vertical>
|
||||||
|
|
|
@ -15,12 +15,13 @@ export const COMPONENT = {
|
||||||
json => console.error(json.data.error.message)
|
json => console.error(json.data.error.message)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
this.submit = function() {
|
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(
|
$http.get(`/client/api/Clients/findOne?filter=${JSON.stringify(query)}`).then(
|
||||||
function(response) {
|
function(response) {
|
||||||
console.log(response);
|
self.clients = [];
|
||||||
|
self.clients.push(response.data);
|
||||||
},
|
},
|
||||||
function(response) {
|
function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div>{{itemClient.client.phone}}, {{itemClient.client.contact}}</div>
|
<div>{{itemClient.client.phone}}, {{itemClient.client.contact}}</div>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-empty>
|
<vn-empty>
|
||||||
<a ui-sref="clientCard.basicData({ id: {{itemClient.client.id}} })"><vn-icon-button icon="edit"></vn-icon-button></a>
|
<a ui-sref="clientCard.basicData({ id: {{itemClient.client.id}} })"><i class="material-icons">edit</i></a>
|
||||||
</vn-empty>
|
</vn-empty>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-auto>
|
</vn-auto>
|
|
@ -1,45 +1,58 @@
|
||||||
{
|
{
|
||||||
module: "crud",
|
module: "crud",
|
||||||
routes: [{
|
routes: [
|
||||||
url: "/clients",
|
{
|
||||||
state: "clients",
|
url: "/clients",
|
||||||
component: "vn-client-index"
|
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"
|
|
||||||
},
|
},
|
||||||
description: "Datos básicos",
|
{
|
||||||
icon: "person"
|
url: "/clients/:id",
|
||||||
},{
|
state: "clientCard",
|
||||||
url: "/fiscal-data",
|
component: "vn-client-card"
|
||||||
state: "clientCard.fiscalData",
|
},
|
||||||
component: "vn-client-fiscal-data",
|
{
|
||||||
description: "Datos facturación",
|
url: "/basic-data",
|
||||||
icon: "assignment"
|
state: "clientCard.basicData",
|
||||||
},{
|
component: "vn-client-basic-data",
|
||||||
url: "/addresses",
|
params: {
|
||||||
state: "clientCard.addresses",
|
client: "card.client"
|
||||||
component: "vn-client-addresses",
|
},
|
||||||
description: "Consignatarios",
|
description: "Datos básicos",
|
||||||
icon: "local_shipping"
|
icon: "person"
|
||||||
},{
|
}
|
||||||
url: "/web-access",
|
,{
|
||||||
state: "clientCard.webAccess",
|
url: "/fiscal-data",
|
||||||
component: "vn-client-web-access",
|
state: "clientCard.fiscalData",
|
||||||
description: "Acceso web",
|
component: "vn-client-fiscal-data",
|
||||||
icon: "language"
|
description: "Datos facturación",
|
||||||
},{
|
icon: "assignment"
|
||||||
url: "/notes",
|
},
|
||||||
state: "clientCard.notes",
|
{
|
||||||
component: "vn-client-notes",
|
url: "/addresses",
|
||||||
description: "Notas",
|
state: "clientCard.addresses",
|
||||||
icon: "insert_drive_file"
|
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",
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
18
db.json
18
db.json
|
@ -2,7 +2,9 @@
|
||||||
"ids": {
|
"ids": {
|
||||||
"User": 2,
|
"User": 2,
|
||||||
"AccessToken": 2,
|
"AccessToken": 2,
|
||||||
"Client": 3
|
"Client": 15,
|
||||||
|
"PaymentMethod": 4,
|
||||||
|
"SalesPerson": 4
|
||||||
},
|
},
|
||||||
"models": {
|
"models": {
|
||||||
"User": {
|
"User": {
|
||||||
|
@ -12,8 +14,18 @@
|
||||||
"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue": "{\"id\":\"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue\",\"ttl\":1209600,\"created\":\"2016-11-21T11:06:11.113Z\",\"userId\":1}"
|
"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue": "{\"id\":\"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue\",\"ttl\":1209600,\"created\":\"2016-11-21T11:06:11.113Z\",\"userId\":1}"
|
||||||
},
|
},
|
||||||
"Client": {
|
"Client": {
|
||||||
"1": "{\"name\":\"Cliente1 SL\",\"salesPerson\":1,\"fi\":\"123456789\",\"registerDate\":\"29/11/2016\",\"contact\":\"a@a.com\",\"phone\":\"123456789\",\"quality\":\"1\",\"id\":1}",
|
"12": "{\"name\":\"Cliente 2\",\"id\":12,\"fi\":\"1111111111\",\"salesPerson\":\"2\"}",
|
||||||
"2": "{\"name\":\"Cliente2 SL\",\"salesPerson\":1,\"fi\":\"123456788\",\"contact\":\"b@b.com\",\"phone\":\"222222222\",\"quality\":\"1\",\"id\":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}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,9 +35,7 @@
|
||||||
},
|
},
|
||||||
"active": {
|
"active": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
"credit": {
|
"credit": {
|
||||||
"type": "Number"
|
"type": "Number"
|
||||||
},
|
},
|
||||||
|
@ -61,14 +59,18 @@
|
||||||
"invoiceByEmail": {
|
"invoiceByEmail": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Send invoices by email"
|
"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"
|
|
||||||
},*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "PaymentMethod",
|
||||||
|
"base": "PersistedModel",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "SalesPerson",
|
||||||
|
"base": "PersistedModel",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,14 @@
|
||||||
"dataSource": "db",
|
"dataSource": "db",
|
||||||
"public": true
|
"public": true
|
||||||
},
|
},
|
||||||
|
"PaymentMethod": {
|
||||||
|
"dataSource": "db",
|
||||||
|
"public": true
|
||||||
|
},
|
||||||
|
"SalesPerson": {
|
||||||
|
"dataSource": "db",
|
||||||
|
"public": true
|
||||||
|
},
|
||||||
"Address": {
|
"Address": {
|
||||||
"dataSource": "db",
|
"dataSource": "db",
|
||||||
"public": true
|
"public": true
|
||||||
|
|
Loading…
Reference in New Issue