This commit is contained in:
Juan Ferrer Toribio 2017-01-13 15:56:42 +01:00
commit cbb436788a
16 changed files with 165 additions and 44 deletions

View File

@ -4,4 +4,4 @@ export {NAME as ACTIONS, COMPONENT as ACTIONS_COMPONENT} from './components/left
export {NAME as LEFT_MENU, COMPONENT as LEFTMENU_COMPONENT} from './components/left-menu/left-menu';
export {NAME as MENU_ITEM, COMPONENT as MENU_ITEM_COMPONENT} from './components/left-menu/menu-item';
export {NAME as TOPBAR, COMPONENT as TOPBAR_COMPONENT} from './components/topbar/topbar';
export {NAME as SEARCHBAR, COMPONENT as SEARCHBAR_COMPONENT} from './components/searchbar/searchbar';
export {NAME as SEARCHBAR, COMPONENT as SEARCHBAR_COMPONENT} from './components/searchbar/searchbar';

View File

@ -25,3 +25,8 @@ html [bg-dark-bar], .bg-dark-bar {
html [bg-dark-menu], .bg-dark-menu {
background-color: darken($bg-dark-menu, 35%);
}
/* utilizado para mostrar el color default en el consignatario */
.bg-dark-item{
background-color: $bg-dark-bar;
color: $color-white;
}

View File

@ -1,3 +1,3 @@
.display-block{
display: block;
}
}

View File

@ -0,0 +1,31 @@
<form name="form" ng-submit="form.$valid && addressData.submit()" pad-medium>
<vn-card >
<vn-vertical pad-large>
<vn-title>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>
</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 @@
<form name="form" ng-submit="form.$valid && addressData.submit()" pad-medium>
<vn-card>
<vn-vertical pad-large>
<vn-title vn-one>Consignatario</vn-title>
<vn-title>Consignatario</vn-title>
<vn-horizontal>
<vn-check vn-one label="Activo" field="addressData.address.enabled"></vn-check>
<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="Consignatario" field="addressData.address.consignee"></vn-textfield>
<vn-textfield vn-one label="Domicilio" field="addressData.address.street"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
@ -24,9 +24,9 @@
<option ng-repeat="a in addressData.agencies | orderBy:'name'" value="{{a.id}}">{{a.name}}</ng-repeat>
</vn-combo>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-empty margin-large-top>
<vn-submit label="Guardar" id="save"></vn-submit>
</vn-horizontal>
</vn-empty>
</vn-vertical>
</vn-card>
</form>

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

@ -6,23 +6,22 @@
</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">
<vn-horizontal style="align-items: center;">
<vn-horizontal style="align-items: center;" ng-class="{'bg-dark-item': i.default}">
<vn-auto>
<div><b>{{i.consignee}}</b></div>
<div>{{i.street}}</div>
<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-horizontal margin-large-top>
<vn-one>
<a ui-sref="clientCard.addressCreate"><vn-button label="Nuevo"></vn-button></a>
<a ui-sref="clientCard.addressDataCreate"><vn-button label="Nuevo"></vn-button></a>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-card>
</vn-vertical>
</vn-vertical>

View File

@ -23,6 +23,7 @@
<vn-submit label="Guardar" id="save"></vn-submit>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-vertical>
</vn-card>
</form>
</form>
<vn-confirm-client client="basicData.client" state="basicData.state"></vn-confirm-client>

View File

@ -8,27 +8,39 @@ export const COMPONENT = {
bindings: {
client: '<'
},
controller: function($http, $rootScope, copyObject, equalsObject, $state) {
controller: function($http, copyObject, equalsObject, $transitions, $state) {
this.currentstate = $state.current;
var self = this;
var deregister = $transitions.onStart({ }, callback);
this.$onChanges = function (changes) {
if(this.client)
if(this.client){
this.clientOld = copyObject(this.client);
this.client.navigate = false;
}
}
$rootScope.$on("$stateChangeStart", function(event, next) {
//if(!equalsObject(self.client, self.clientOld)){
event.preventDefault();
//}
});
this.$onDestroy = function(){
deregister();
}
$http.get('/client/api/SalesPeople').then(
json => this.sales = json.data,
json => console.error(json.data.error.message)
);
function callback(transition) {
if(!equalsObject(self.client, self.clientOld) && !self.client.navigate){
self.state = transition.to().name;
var dialog = document.querySelector('dialog');
dialog.showModal();
return false;
}
else
self.client = copyObject(self.clientOld);
}
this.submit = function() {
if(!equalsObject(this.client, this.clientOld)){
this.client.modify = "BasicData";
@ -40,5 +52,5 @@ export const COMPONENT = {
};
}
};
COMPONENT.controller.$inject = ['$http', '$rootScope', 'copyObject', 'equalsObject', '$state'];
COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$state'];
module.component(NAME, COMPONENT);

View File

@ -20,5 +20,9 @@ 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';
export {NAME as CLIENT_CONFIRM_INDEX,
COMPONENT as CLIENT_CONFIRM_INDEX_COMPONENT} from './confirm/index';

View File

@ -0,0 +1,11 @@
<dialog class="mdl-dialog">
<div class="mdl-dialog__content">
<p>
Allow this site to collect usage data to improve your experience?
</p>
</div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
<button type="button" class="mdl-button" ng-click="clientConfirm.accept()">Agree</button>
<button type="button" class="mdl-button close" ng-click="clientConfirm.cancel()">Disagree</button>
</div>
</dialog>

View File

@ -0,0 +1,28 @@
import template from './index.html';
import {module} from '../../module';
export const NAME = 'vnConfirmClient';
export const COMPONENT = {
template: template,
controllerAs: 'clientConfirm',
bindings: {
state: '<',
client: '='
},
controller: function($state, $element, copyObject){
var dialog = $element.find('dialog')[0]
this.accept = function(){
this.client.navigate = true;
$state.go(this.state);
dialog.close();
}
this.cancel = function(){
dialog.close();
}
}
};
COMPONENT.controller.$inject = ['$state', '$element', 'copyObject'];
module.component(NAME, COMPONENT);

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

@ -5,7 +5,7 @@
"Client": 15,
"PaymentMethod": 4,
"SalesPerson": 4,
"Address": 57,
"Address": 58,
"Country": 3,
"Province": 3,
"Agency": 4
@ -32,8 +32,9 @@
"3": "{\"name\":\"Carlos Zambrano\",\"id\":3}"
},
"Address": {
"63": "{\"street\":\"Avd. Espioca nº 100\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46460\",\"phone\":\"66666666\",\"mobile\":\"989898888\",\"id\":63,\"province\":\"2\",\"agency\":\"2\",\"default\":true,\"enabled\":true}",
"64": "{\"street\":\"Aaa\",\"consignee\":\"aaa\",\"city\":\"aaa\",\"postcode\":\"11111\",\"phone\":\"963242100\",\"mobile\":\"11231241423\",\"id\":64,\"enabled\":true}"
"57": "{\"street\":\"Avda Espioca\",\"consignee\":\"Vicente\",\"city\":\"Silla\",\"postcode\":\"46900\",\"phone\":\"963242100\",\"province\":\"1\",\"agency\":\"3\",\"id\":57,\"enabled\":false,\"default\":false}",
"63": "{\"street\":\"Avd. Espioca nº 100\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46460\",\"phone\":\"66666666\",\"mobile\":\"989898888\",\"id\":63,\"province\":\"2\",\"agency\":\"3\",\"default\":false,\"enabled\":true}",
"64": "{\"street\":\"Aaa\",\"consignee\":\"aaa\",\"city\":\"121212\",\"postcode\":\"11111\",\"phone\":\"963242100\",\"mobile\":\"11231241423\",\"id\":64,\"default\":true,\"province\":\"1\",\"agency\":\"2\",\"enabled\":false}"
},
"Country": {
"1": "{\"id\":1,\"name\":\"Spain\"}",

View File

@ -41,3 +41,10 @@
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
2017/01/13 13:15:39 [notice] 9764#10160: signal process started
2017/01/13 13:15:39 [error] 9764#10160: OpenEvent("Global\ngx_stop_5224") failed (2: FormatMessage() error:(15100))
2017/01/13 15:01:49 [notice] 4688#4208: signal process started
2017/01/13 15:25:59 [notice] 10896#6992: signal process started
2017/01/13 15:29:26 [notice] 2412#10456: signal process started