componentes consignatarios

This commit is contained in:
Vicente Falco 2017-01-11 14:56:48 +01:00
parent a52ffbc9a3
commit 32b0b0c744
8 changed files with 80 additions and 22 deletions

View File

@ -0,0 +1,33 @@
<form name="form" ng-submit="form.$valid && addressData.submit()" >
<vn-vertical pad-medium>
<vn-card >
<vn-vertical pad-large>
<vn-title vn-one>Consignatario</vn-title>
<vn-horizontal>
<vn-check vn-one label="Predeterminado" field="addressData.address.default"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee" focus></vn-textfield>
<vn-textfield vn-one label="Domicilio" field="addressData.address.street"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Código Postal" field="addressData.address.postcode"></vn-textfield>
<vn-textfield vn-one label="Municipio" field="addressData.address.city"></vn-textfield>
<vn-combo vn-one label="Provincia" field="addressData.address.province">
<option ng-repeat="p in addressData.provinces | orderBy:'name'" value="{{p.id}}">{{p.name}}</ng-repeat>
</vn-combo>
<vn-textfield vn-one label="Teléfono" field="addressData.address.phone"></vn-textfield>
<vn-textfield vn-one label="Móvil" field="addressData.address.mobile"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-combo vn-one label="Agencia" field="addressData.address.agency">
<option ng-repeat="a in addressData.agencies | orderBy:'name'" value="{{a.id}}">{{a.name}}</ng-repeat>
</vn-combo>
</vn-horizontal>
<vn-empty>
<vn-submit label="Guardar" id="save"></vn-submit>
</vn-empty>
</vn-vertical>
</vn-card>
</vn-vertical>
</form>

View File

@ -0,0 +1,32 @@
import template from './index.html';
import {module} from '../../module';
export const NAME = 'vnClientAddressesDataCreate';
export const COMPONENT = {
template: template,
controllerAs: 'addressData',
controller: function($http)
{
this.address = {};
$http.get('/client/api/Agencies').then(
json => this.agencies = json.data,
json => console.error(json.data.error.message)
);
$http.get('/client/api/Provinces').then(
json => this.provinces = json.data,
json => console.error(json.data.error.message)
);
this.submit = function(){
$http.post('/client/api/Addresses', this.address).then(
json => console.log(json.statusText),
json => console.error(json.data.error.message)
);
}
}
}
COMPONENT.controller.$inject = ['$http'];
module.component(NAME, COMPONENT);

View File

@ -1,13 +1,13 @@
import template from './index.html';
import {module} from '../../module';
export const NAME = 'vnClientAddressesData';
export const NAME = 'vnClientAddressesDataEdit';
export const COMPONENT = {
template: template,
controllerAs: 'addressData',
controller: function($http,$stateParams)
{
this.address = {}
this.address = {};
$http.get(`/client/api/Addresses/${$stateParams.addressId}`).then(
json => this.address = json.data,
json => console.error(json.data.error.message)
@ -24,23 +24,13 @@ export const COMPONENT = {
);
this.submit = function(){
if($stateParams.addressId){
$http.put('/client/api/Addresses', this.address).then(
json => console.log(json.statusText),
json => console.error(json.data.error.message)
);
}
else{
$http.post('/client/api/Addresses', this.address).then(
json => console.log(json.statusText),
json => console.error(json.data.error.message)
);
}
};
}
};
COMPONENT.controller.$inject = ['$http' , '$stateParams'];
module.component(NAME, COMPONENT);

View File

@ -3,7 +3,7 @@
<vn-vertical pad-large>
<vn-horizontal>
<vn-title vn-one>Consignatario</vn-title>
<a vn-empty ui-sref="clientCard.addressCreate" style="align-items: right;"><vn-button label="Nuevo"></vn-button></a>
<a vn-empty ui-sref="clientCard.addressDataCreate" style="align-items: right;"><vn-button label="Nuevo"></vn-button></a>
</vn-horizontal>
<vn-horizontal ng-repeat="i in address.addresses" class="pad-medium-top" style="align-items: center;">
<vn-auto style="border-radius: .5em;" class="pad-small border-solid">
@ -14,11 +14,10 @@
<div>{{i.city}}, {{i.province}}</div>
<div>{{i.phone}}, {{i.mobile}}</div>
</vn-auto>
<a vn-empty ui-sref="clientCard.addressEdit({ addressId: {{i.id}} })"><vn-icon-button icon="edit"></vn-icon-button></a>
<a vn-empty ui-sref="clientCard.addressDataEdit({ addressId: {{i.id}} })"><vn-icon-button icon="edit"></vn-icon-button></a>
</vn-horizontal>
</vn-auto>
</vn-horizontal>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -20,5 +20,7 @@ export {NAME as CLIENT_ITEM,
COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client';
export {NAME as CLIENT_CREATE,
COMPONENT as CLIENT_CREATE_COMPONENT} from './create/index';
export {NAME as CLIENT_ADDRESSES_DATA_INDEX,
COMPONENT as CLIENT_ADDRESSES_DATA_INDEX_COMPONENT} from './addresses-data/index';
export {NAME as CLIENT_ADDRESSES_DATA_CREATE_INDEX,
COMPONENT as CLIENT_ADDRESSES_DATA_CREATE_INDEX_COMPONENT} from './addresses-data-create/index';
export {NAME as CLIENT_ADDRESSES_DATA_EDIT_INDEX,
COMPONENT as CLIENT_ADDRESSES_DATA_EDIT_INDEX_COMPONENT} from './addresses-data-edit/index';

View File

@ -62,13 +62,13 @@
},
{
url: "/address/create",
state: "clientCard.addressCreate",
component: "vn-client-addresses-data"
state: "clientCard.addressDataCreate",
component: "vn-client-addresses-data-create"
},
{
url: "/address/:addressId",
state: "clientCard.addressEdit",
component: "vn-client-addresses-data"
state: "clientCard.addressDataEdit",
component: "vn-client-addresses-data-edit"
},
]

View File

@ -41,3 +41,5 @@
2017/01/10 10:51:29 [notice] 7236#9764: signal process started
2017/01/10 10:54:19 [notice] 11368#8376: signal process started
2017/01/10 12:26:32 [notice] 6916#8152: signal process started
2017/01/11 14:07:56 [notice] 9308#5756: signal process started
2017/01/11 14:08:53 [notice] 8600#6600: signal process started