This commit is contained in:
Javi Gallego 2017-01-16 11:48:54 +01:00
commit c2e91a63c6
15 changed files with 182 additions and 44 deletions

View File

@ -30,3 +30,7 @@ html [bg-dark-menu], .bg-dark-menu {
background-color: $bg-dark-bar; background-color: $bg-dark-bar;
color: $color-white; color: $color-white;
} }
/* utilizado para mostrar el color inactivo en el consignatario */
.bg-opacity-item{
opacity: 0.6;
}

View File

@ -0,0 +1,19 @@
import {module as _module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
import * as util from '../util';
const _NAME = 'textarea';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME];
export function directive(resolve) {
return {
require: 'E',
template: function(_, attr) {
return resolve.getTemplate(_NAME, attr);
}
};
}
_module.directive(NAME, directive);

View File

@ -0,0 +1,2 @@
<!-- por definir -->

View File

@ -0,0 +1,20 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './textarea.mdl.html';
const _NAME = 'textarea';
const DEFAULT_CLASS = '';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
className: DEFAULT_CLASS,
}
}
}
_module.factory(NAME, factory);

View File

@ -5,7 +5,7 @@
<vn-title vn-one>Consignatario</vn-title> <vn-title vn-one>Consignatario</vn-title>
</vn-horizontal> </vn-horizontal>
<vn-horizontal ng-repeat="i in address.addresses" class="pad-medium-top" style="align-items: center;"> <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" ng-class="{'bg-dark-item': i.default}"> <vn-auto style="border-radius: .5em;" class="pad-small border-solid" ng-class="{'bg-dark-item': i.default,'bg-opacity-item': !i.enabled && !i.default}">
<vn-horizontal style="align-items: center;"> <vn-horizontal style="align-items: center;">
<vn-auto> <vn-auto>
<div><b>{{i.consignee}}</b></div> <div><b>{{i.consignee}}</b></div>

View File

@ -8,14 +8,14 @@ export const COMPONENT = {
bindings: { bindings: {
client: '<' client: '<'
}, },
controller: function($http, copyObject, equalsObject, $transitions, $state, $element) { controller: function($http, copyObject, equalsObject, $transitions, $element) {
var self = this;
var self = this;
var deregister = $transitions.onStart({ }, callback); var deregister = $transitions.onStart({ }, callback);
this.$onChanges = function(changes) { this.$onChanges = function(changes) {
if (this.client) { if (this.client) {
this.clientOld = copyObject(this.client); this.copyClient();
} }
}; };
@ -41,10 +41,21 @@ export const COMPONENT = {
this.submit = function() { this.submit = function() {
if (!equalsObject(this.client, this.clientOld)) { if (!equalsObject(this.client, this.clientOld)) {
this.client.modify = "BasicData"; this.client.modify = "BasicData";
$http.put('/client/api/Clients', this.client); $http.put('/client/api/Clients', this.client).then(
json => {
this.client = json.data;
this.copyClient();
}
);
} }
}; };
this.copyClient = function() {
this.clientOld = {};
copyObject(this.client, this.clientOld);
};
} }
}; };
COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$state', '$element'];
COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -1,11 +1,11 @@
<dialog class="mdl-dialog"> <dialog class="mdl-dialog">
<div class="mdl-dialog__content"> <div class="mdl-dialog__content">
<p> <p>
Allow this site to collect usage data to improve your experience? ¿Desea salir sin guardar los cambios?
</p> </p>
</div> </div>
<div class="mdl-dialog__actions mdl-dialog__actions--full-width"> <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" ng-click="clientConfirm.accept()">Aceptar</button>
<button type="button" class="mdl-button close" ng-click="clientConfirm.cancel()">Disagree</button> <button type="button" class="mdl-button close" ng-click="clientConfirm.cancel()">Cancelar</button>
</div> </div>
</dialog> </dialog>

View File

@ -1,20 +1,21 @@
<form ng-submit="create.submit()" pad-large style="max-width: 67em; margin: 0 auto;"> <form ng-submit="create.submit()" pad-large style="max-width: 67em; margin: 0 auto;">
<vn-card> <vn-card>
<vn-vertical pad-large> <vn-vertical pad-large>
<vn-title>Crear Cliente</vn-title> <vn-title>Crear Cliente</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Nombre" field="create.model.name" focus></vn-textfield> <vn-textfield vn-one label="Nombre" field="create.model.name" focus></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="create.model.fi"></vn-textfield> <vn-textfield vn-one label="NIF/CIF" field="create.model.fi"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Razón social" field="create.model.socialName"></vn-textfield> <vn-textfield vn-one label="Razón social" field="create.model.socialName"></vn-textfield>
<vn-one></vn-one> <vn-one></vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-one margin-large-top> <vn-one margin-large-top>
<vn-submit label="Crear" id="create"></vn-submit> <vn-submit label="Crear" id="create"></vn-submit>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
</form> </form>
<vn-confirm-client client="create.model" client-old="create.model" state="create.state"></vn-confirm-client>

View File

@ -5,10 +5,10 @@ export const NAME = "vnClientCreate";
export const COMPONENT = { export const COMPONENT = {
template: template, template: template,
controllerAs: "create", controllerAs: "create",
controller: function($http, $state){ controller: function($http, $state) {
this.submit = function(){ this.submit = function() {
$http.post('/client/api/Clients', this.model).then( $http.post('/client/api/Clients', this.model).then(
json => $state.go('clientCard.basicData',{id: json.data.id}) json => $state.go('clientCard.basicData', {id: json.data.id})
); );
}; };
} }

View File

@ -56,8 +56,8 @@
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-vertical>
<vn-submit label="Guardar"></vn-submit>
</vn-vertical>
</form> </form>
<vn-vertical>
<vn-submit label="Guardar"></vn-submit>
</vn-vertical>
<vn-confirm-client client="fiscal.client" client-old="fiscal.clientOld" state="fiscal.state"></vn-confirm-client>

View File

@ -8,22 +8,60 @@ export const COMPONENT = {
bindings: { bindings: {
client: '<' client: '<'
}, },
controller: function($http) { controller: function($http, copyObject, equalsObject, $transitions, $element) {
var self = this;
var deregister = $transitions.onStart({ }, callback);
$http.get('/client/api/Countries').then( $http.get('/client/api/Countries').then(
json => this.countries = json.data json => this.countries = json.data
); );
$http.get('/client/api/Provinces').then( $http.get('/client/api/Provinces').then(
json => this.provinces = json.data json => this.provinces = json.data
); );
$http.get('/client/api/PaymentMethods').then( $http.get('/client/api/PaymentMethods').then(
json => this.payments = json.data json => this.payments = json.data
); );
this.submit = function() { this.submit = function() {
$http.put('/client/api/Clients', this.client); if (!equalsObject(this.client, this.clientOld)) {
this.client.modify = "FiscalData";
$http.put('/client/api/Clients', this.client).then(
json => {
this.client = json.data;
this.copyClient();
}
);
}
};
this.$onChanges = function(changes) {
if (this.client) {
this.copyClient();
}
};
this.$onDestroy = function() {
deregister();
};
function callback(transition) {
if (!equalsObject(self.client, self.clientOld)) {
self.state = transition.to().name;
var dialog = $element[0].querySelector('dialog');
dialog.showModal();
return false;
}
}
this.copyClient = function() {
this.clientOld = {};
copyObject(this.client, this.clientOld);
}; };
} }
}; };
COMPONENT.controller.$inject = ['$http']; COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -1,4 +1,7 @@
<a ui-sref="clientCard.basicData({ id: {{itemClient.client.id}} })" pad-medium border-solid-bottom> <a ui-sref="clientCard.basicData({ id: {{itemClient.client.id}} })" pad-medium border-solid-bottom>
<div class="vn-item-client-name">{{itemClient.client.name}}</div> <div class="vn-item-client-name">{{itemClient.client.name}}</div>
<div>{{itemClient.client.id}}</div> <div>{{itemClient.client.id}}</div>
<div>{{itemClient.client.phone}}</div>
<div>{{itemClient.client.city}}</div>
<div>{{itemClient.client.email}}</div>
</a> </a>

View File

@ -10,3 +10,4 @@
<vn-submit margin-small-top label="Guardar"></vn-submit> <vn-submit margin-small-top label="Guardar"></vn-submit>
</vn-vertical> </vn-vertical>
</form> </form>
<vn-confirm-client client="web.client" client-old="web.clientOld" state="web.state"></vn-confirm-client>

View File

@ -8,11 +8,47 @@ export const COMPONENT = {
bindings: { bindings: {
client: '<' client: '<'
}, },
controller: function($http) { controller: function($http, copyObject, equalsObject, $transitions, $element) {
var self = this;
var deregister = $transitions.onStart({ }, callback);
this.submit = function() { this.submit = function() {
$http.put('/client/api/Clients', this.client); if (!equalsObject(this.client, this.clientOld)) {
this.client.modify = "WebAccess";
$http.put('/client/api/Clients', this.client).then(
json => {
this.client = json.data;
this.copyClient();
}
);
}
};
this.$onChanges = function(changes) {
if (this.client) {
this.copyClient();
}
};
this.$onDestroy = function() {
deregister();
};
function callback(transition) {
if (!equalsObject(self.client, self.clientOld)) {
self.state = transition.to().name;
var dialog = $element[0].querySelector('dialog');
dialog.showModal();
return false;
}
}
this.copyClient = function() {
this.clientOld = {};
copyObject(this.client, this.clientOld);
}; };
} }
}; };
COMPONENT.controller.$inject = ['$http']; COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -48,3 +48,6 @@
2017/01/13 15:01:49 [notice] 4688#4208: signal process started 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:25:59 [notice] 10896#6992: signal process started
2017/01/13 15:29:26 [notice] 2412#10456: signal process started 2017/01/13 15:29:26 [notice] 2412#10456: signal process started
2017/01/13 15:37:25 [notice] 5088#9876: signal process started
2017/01/16 07:49:58 [notice] 9028#8132: signal process started
2017/01/16 08:26:22 [notice] 1256#3772: signal process started