diff --git a/client/salix/src/components/app/style.scss b/client/salix/src/components/app/style.scss
index fabe3dcca..6c0600691 100644
--- a/client/salix/src/components/app/style.scss
+++ b/client/salix/src/components/app/style.scss
@@ -14,7 +14,7 @@ vn-app {
}
vn-spinner {
float: left;
- padding: .4em;
+ padding: 1em .4em;
}
}
.main-view {
diff --git a/client/salix/src/components/home/style.scss b/client/salix/src/components/home/style.scss
index b44afdab8..6d8d3fa4a 100644
--- a/client/salix/src/components/home/style.scss
+++ b/client/salix/src/components/home/style.scss
@@ -1,4 +1,4 @@
-@import "colors";
+@import "effects";
vn-home {
padding: 2em;
@@ -17,6 +17,7 @@ vn-home {
flex-wrap: wrap;
& > a {
+ @extend %clickable-light;
overflow:hidden;
border-radius: 6px;
background-color: $main-01;
@@ -29,11 +30,6 @@ vn-home {
padding: 1em;
justify-content: center;
- transition: opacity 250ms ease-out;
-
- &:hover {
- background-color: $hover;
- }
& > vn-icon {
font-size: 4em;
}
diff --git a/client/salix/src/components/index.js b/client/salix/src/components/index.js
index ab105ffff..afd469e89 100644
--- a/client/salix/src/components/index.js
+++ b/client/salix/src/components/index.js
@@ -4,4 +4,3 @@ import './main-menu/main-menu';
import './left-menu/left-menu';
import './left-menu/menu-item';
import './topbar/topbar';
-import './searchbar/searchbar';
diff --git a/client/salix/src/components/left-menu/style.scss b/client/salix/src/components/left-menu/style.scss
index a029594e6..311d94fcc 100644
--- a/client/salix/src/components/left-menu/style.scss
+++ b/client/salix/src/components/left-menu/style.scss
@@ -1,8 +1,12 @@
-@import "colors";
+@import "effects";
vn-menu-item {
- & > li.active {
- background-color: $main-header;
- color: white;
+ & > li {
+ @extend %clickable;
+
+ &.active {
+ background-color: $main-header;
+ color: white;
+ }
}
}
diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html
index 0a7947705..f7eb343ba 100644
--- a/client/salix/src/components/main-menu/main-menu.html
+++ b/client/salix/src/components/main-menu/main-menu.html
@@ -35,9 +35,9 @@
-
- {{::lang}}
+ name="{{::lang.code}}"
+ ng-click="$ctrl.onChangeLangClick(lang.code)">
+ {{::lang.name}}
diff --git a/client/salix/src/components/main-menu/main-menu.js b/client/salix/src/components/main-menu/main-menu.js
index 33992ce1b..ee2727f39 100644
--- a/client/salix/src/components/main-menu/main-menu.js
+++ b/client/salix/src/components/main-menu/main-menu.js
@@ -1,6 +1,16 @@
import ngModule from '../../module';
import './style.scss';
+let languages = {
+ es: 'Español',
+ en: 'English',
+ ca: 'Català',
+ pt: 'Português',
+ fr: 'Français',
+ nl: 'Nederlands',
+ mn: 'Монгол хэл'
+};
+
export default class MainMenu {
constructor($translate, $scope, $http, $window, modulesFactory) {
this.$ = $scope;
@@ -8,8 +18,15 @@ export default class MainMenu {
this.$translate = $translate;
this.$window = $window;
this.modules = modulesFactory.getModules();
- this.langs = $translate.getAvailableLanguageKeys();
+ this.langs = [];
+
+ for (var code of $translate.getAvailableLanguageKeys())
+ this.langs.push({
+ code: code,
+ name: languages[code] ? languages[code] : code
+ });
}
+
getCurrentUserName() {
this.$http.get('/auth/api/Accounts/getCurrentUserName')
.then(json => {
@@ -20,9 +37,11 @@ export default class MainMenu {
onLogoutClick() {
this.$window.location = '/logout';
}
+
onChangeLangClick(lang) {
this.$translate.use(lang);
}
+
$onInit() {
this.getCurrentUserName();
}
diff --git a/client/salix/src/components/main-menu/style.scss b/client/salix/src/components/main-menu/style.scss
index eddeb2677..88eaf3105 100644
--- a/client/salix/src/components/main-menu/style.scss
+++ b/client/salix/src/components/main-menu/style.scss
@@ -1,4 +1,4 @@
-@import "colors";
+@import "effects";
vn-main-menu {
#user {
@@ -25,9 +25,9 @@ vn-main-menu {
color: white;
li {
+ @extend %clickable-light;
background-color: $main-01;
margin-bottom: .6em;
- cursor: pointer;
padding: .8em;
border-radius: .1em;
min-width: 8em;
@@ -36,9 +36,6 @@ vn-main-menu {
padding-right: .3em;
vertical-align: middle;
}
- &:hover {
- background-color: $hover;
- }
&:last-child {
margin-bottom: 0;
}
diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js
deleted file mode 100644
index 6ff9a8072..000000000
--- a/client/salix/src/components/searchbar/searchbar.js
+++ /dev/null
@@ -1,160 +0,0 @@
-import ngModule from '../../module';
-import './style.scss';
-
-export default class Controller {
- constructor($element, $scope, $compile, $timeout, $state, $transitions) {
- this.element = $element[0];
- this.$ = $scope;
- this.$compile = $compile;
- this.$timeout = $timeout;
- this.stringSearch = '';
- this.$state = $state;
- this.deregisterCallback = $transitions.onStart({},
- transition => this.changeState(transition));
- }
-
- clearFilter() {
- this.index.filter = {
- page: 1,
- size: 20
- };
- }
-
- setFilter(filterObject) {
- this.clearFilter();
- Object.assign(this.index.filter, filterObject);
- }
-
- getFiltersFromString(stringSearch) {
- let result = {};
- if (stringSearch) {
- // find pattern key:value or key:(extra value) and returns array
- let findPattern = stringSearch.match(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi);
- let remnantString = (stringSearch.replace(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi, '')).trim();
- if (findPattern) {
- for (let i = 0; i < findPattern.length; i++) {
- let aux = findPattern[i].split(':');
- let property = aux[0];
- let value = aux[1].replace(/\(|\)/g, '');
- result[property] = value.trim();
- }
- }
- if (remnantString) {
- result.search = remnantString;
- }
- }
- return result;
- }
-
- createStringFromObject(filterObject) {
- let search = [];
- let keys = Object.keys(filterObject);
- if (keys.length) {
- keys.forEach(k => {
- let ignore = (this.ignoreKeys && this.ignoreKeys instanceof Array && this.ignoreKeys.indexOf(k) !== -1);
- if (!ignore) {
- let value = filterObject[k];
-
- if (typeof value === 'string' && value.indexOf(' ') !== -1) {
- search.push(`${k}:(${value})`);
- } else if (typeof value !== 'object') {
- search.push(`${k}:${value}`);
- }
- }
- });
-
- if (filterObject.search)
- search.unshift(filterObject.search);
- }
- return (search.length) ? search.join(' ') : '';
- }
-
- changeState(transition) {
- return !(transition._targetState._identifier.name === this.$state.current.name);
- }
-
- pushFiltersToState(filters) {
- let history = window.history || {pushState: () => {
- console.error('Error in history.pushState(): Browser incompatibility error');
- }};
- let aux = window.location.hash.split('?q=');
- if (Object.keys(filters).length)
- history.pushState({}, null, `${aux[0]}?q=${encodeURIComponent(JSON.stringify(filters))}`);
- else
- history.pushState({}, null, aux[0]);
- }
-
- onpenFilters(event) {
- let filter = {};
- if (this.stringSearch) {
- filter = this.getFiltersFromString(this.stringSearch);
- }
-
- this.$child = this.$compile(`<${this.popover}/>`)(this.$.$new());
-
- var childCtrl = this.$child.isolateScope().$ctrl;
- childCtrl.filter = Object.assign({}, filter);
- childCtrl.onSubmit = filter => this.onChildSubmit(filter);
- if (this.data)
- childCtrl.data = Object.assign({}, this.data);
-
- event.preventDefault();
-
- this.$.popover.parent = this.element;
- this.$.popover.child = this.$child[0];
- this.$.popover.show();
- }
-
- onPopoverClose() {
- this.$child.scope().$destroy();
- this.$child.remove();
- this.$child = null;
- }
-
- onChildSubmit(filter) {
- this.$.popover.hide();
- this.stringSearch = this.createStringFromObject(filter);
- this.clearFilter();
- this.$timeout(() => this.onSubmit());
- }
-
- onSubmit() {
- let filter = {};
- if (this.stringSearch) {
- filter = this.getFiltersFromString(this.stringSearch);
- }
- this.setFilter(filter);
-
- if (this.onSearch)
- this.onSearch();
-
- this.pushFiltersToState(filter);
- }
-
- $onDestroy() {
- this.clearFilter();
- this.deregisterCallback();
- }
-
- $onInit() {
- if (this.$state.params.q) {
- let filter = JSON.parse(decodeURIComponent(this.$state.params.q));
- this.stringSearch = this.createStringFromObject(filter);
- }
- this.$timeout(() => this.onSubmit());
- }
-}
-Controller.$inject = ['$element', '$scope', '$compile', '$timeout', '$state', '$transitions'];
-
-ngModule.component('vnSearchbar', {
- template: require('./searchbar.html'),
- bindings: {
- index: '<',
- onSearch: '&',
- advanced: '=',
- popover: '@',
- ignoreKeys: '',
- data: ''
- },
- controller: Controller
-});
diff --git a/client/salix/src/locale/es.yml b/client/salix/src/locale/es.yml
index 8dae406e4..70baa3f2c 100644
--- a/client/salix/src/locale/es.yml
+++ b/client/salix/src/locale/es.yml
@@ -16,7 +16,7 @@ Logout: Cerrar sesión
Modules access : Acceso a módulos
Notifications: Notificaciones
name: Nombre
-Orders: Catálogo
+Orders: Pedidos
phone: Teléfono
Preview: Vista previa
Production : Producción
diff --git a/client/salix/src/module.js b/client/salix/src/module.js
index 3431a62c3..daa515e66 100644
--- a/client/salix/src/module.js
+++ b/client/salix/src/module.js
@@ -6,29 +6,6 @@ export const appName = 'salix';
const ngModule = ng.module('salix', ['vnCore']);
export default ngModule;
-config.$inject = ['$translatePartialLoaderProvider', '$httpProvider', '$qProvider'];
-export function config($translatePartialLoaderProvider, $httpProvider, $qProvider) {
- $translatePartialLoaderProvider.addPart(appName);
- $httpProvider.interceptors.push('vnInterceptor');
-
- // TODO: Handle or remove unhandled rejections
- // $qProvider.errorOnUnhandledRejections(false);
-}
-ngModule.config(config);
-
-/*
-// FIXME: Handle unhandled exceptions
-exceptionHandler.$inject = ['vnApp'];
-function exceptionHandler(vnApp) {
- return function(exception, cause) {
- console.error(exception);
- };
-}
-ngModule.factory('$exceptionHandler', exceptionHandler);
-*/
-
-const HOOK_ABORTED_TRANSITION = 3;
-
run.$inject = ['$window', '$rootScope', 'vnApp', '$state'];
export function run($window, $rootScope, vnApp, $state) {
$window.validations = {};
@@ -37,8 +14,56 @@ export function run($window, $rootScope, vnApp, $state) {
$rootScope.$on('$viewContentLoaded', () => {});
window.myAppErrorLog = [];
$state.defaultErrorHandler(function(error) {
- if (error.type === HOOK_ABORTED_TRANSITION)
+ if (error.type === 3) // ABORTED_TRANSITION
window.myAppErrorLog.push(error);
});
}
ngModule.run(run);
+
+config.$inject = ['$translatePartialLoaderProvider', '$httpProvider'];
+export function config($translatePartialLoaderProvider, $httpProvider) {
+ $translatePartialLoaderProvider.addPart(appName);
+ $httpProvider.interceptors.push('vnInterceptor');
+}
+ngModule.config(config);
+
+// Unhandled exceptions
+
+$exceptionHandler.$inject = ['vnApp', '$window'];
+function $exceptionHandler(vnApp, $window) {
+ return function(exception, cause) {
+ let message;
+
+ if (exception.name == 'HttpError') {
+ switch (exception.xhrStatus) {
+ case 'timeout':
+ case 'abort':
+ return;
+ }
+
+ let data = exception.data;
+
+ if (data && data.error instanceof Object)
+ message = data.error.message;
+ else if (exception.status === -1)
+ message = `Can't contact with server`;
+ else
+ message = `${exception.status}: ${exception.statusText}`;
+
+ if (exception.status === 401) {
+ let location = $window.location;
+ let continueUrl = location.pathname + location.search + location.hash;
+ continueUrl = encodeURIComponent(continueUrl);
+ $window.location = `/auth/?apiKey=${vnApp.name}&continue=${continueUrl}`;
+ }
+ } else if (exception.name == 'UserError') {
+ message = exception.message;
+ } else {
+ message = 'Ups! Something went wrong';
+ console.error(exception);
+ }
+
+ vnApp.showError(message);
+ };
+}
+ngModule.factory('$exceptionHandler', $exceptionHandler);
diff --git a/client/salix/src/styles/colors.scss b/client/salix/src/styles/colors.scss
index 3a9cea1c6..daedb7100 100644
--- a/client/salix/src/styles/colors.scss
+++ b/client/salix/src/styles/colors.scss
@@ -1,7 +1,8 @@
$main-font-color :#222222;
$secondary-font-color: #9b9b9b;
$main-header: #3d3d3d;
-$hover: #c4c4c4;
+$hover: rgba(0, 0, 0, 0.1);
+$hover-opacity: .7;
$main-bg: #e5e5e5;
$main-01: #f7931e;
$main-01-05: rgba($main-01, 0.5);
@@ -9,6 +10,7 @@ $main-01-03: rgba($main-01, 0.3);
$main-02: #a3d131;
$main-02-05: rgba($main-02, 0.5);
$main-02-03: rgba($main-02, 0.3);
+$lines: #9b9b9b;
$color-green: #a3d131;
$color-orange: #f7931e;
diff --git a/client/salix/src/styles/effects.scss b/client/salix/src/styles/effects.scss
new file mode 100644
index 000000000..6c1b6ffa3
--- /dev/null
+++ b/client/salix/src/styles/effects.scss
@@ -0,0 +1,20 @@
+
+@import "./colors";
+
+%clickable {
+ cursor: pointer;
+ transition: background-color 250ms ease-out;
+
+ &:hover {
+ background-color: $hover;
+ }
+}
+
+%clickable-light {
+ cursor: pointer;
+ transition: opacity 250ms ease-out;
+
+ &:hover {
+ opacity: $hover-opacity;
+ }
+}
\ No newline at end of file
diff --git a/client/salix/src/styles/font-style.scss b/client/salix/src/styles/font-style.scss
index a33df7a6a..462023eca 100644
--- a/client/salix/src/styles/font-style.scss
+++ b/client/salix/src/styles/font-style.scss
@@ -1,7 +1,6 @@
@import "colors";
@import "font-family";
-
body {
color: $main-font-color;
font-family: vn-font;
diff --git a/client/salix/src/styles/index.js b/client/salix/src/styles/index.js
index 31ef9c863..eaa0463b8 100644
--- a/client/salix/src/styles/index.js
+++ b/client/salix/src/styles/index.js
@@ -9,3 +9,4 @@ import './font-style.scss';
import './misc.scss';
import './summary.scss';
import './colors.scss';
+import './effects.scss';
diff --git a/client/salix/src/styles/layout.scss b/client/salix/src/styles/layout.scss
index c952abe37..75a7d603c 100644
--- a/client/salix/src/styles/layout.scss
+++ b/client/salix/src/styles/layout.scss
@@ -64,7 +64,6 @@ html [vn-auto], vn-auto, .vn-auto {
flex-basis: auto;
}
html [vn-none], vn-none, .vn-none {
- flex: 1;
flex: none;
}
html [vn-one], vn-one, .vn-one {
diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss
index 2f23a655b..cd285bd0e 100644
--- a/client/salix/src/styles/misc.scss
+++ b/client/salix/src/styles/misc.scss
@@ -1,8 +1,8 @@
-@import "padding";
-@import "margin";
-@import "colors";
-@import "border";
-
+@import "./padding";
+@import "./margin";
+@import "./colors";
+@import "./border";
+@import "./effects";
a:focus,
input:focus,
@@ -64,7 +64,7 @@ html [vn-center], .vn-center{
.list-element{
padding: 8px 0 0 0;
- border-bottom: 1px solid $main-header;
+ border-bottom: 1px solid $lines;
i {
color: $main-01;
}
@@ -81,7 +81,7 @@ html [vn-center], .vn-center{
}
.list-footer{
font-family: vn-font-bold;
- border-top: 3px solid $main-header;
+ border-top: 3px solid $lines;
}
.list-element.warning{
background-color: $color-medium-orange;
@@ -116,17 +116,8 @@ a {
}
}
-.vn-clickable {
- cursor: pointer;
- transition: background-color 250ms ease-out;
-
- &:hover {
- background-color: $hover;
- }
-}
-
button {
- @extend .vn-clickable;
+ @extend %clickable;
}
vn-button-bar {
@@ -168,14 +159,12 @@ vn-main-block {
font-size: 2.5em;
}
& > a {
- @extend .vn-clickable;
-
+ @extend %clickable;
display: flex;
align-items: center;
padding: .5em;
color: white;
text-decoration: none;
- transition: background-color 250ms ease-out;
& > vn-icon {
font-size: 1.8em;
@@ -205,7 +194,7 @@ vn-main-block {
.vn-list-item {
@extend .pad-medium;
@extend .border-solid-bottom;
- @extend .vn-clickable;
+ @extend %clickable;
display: block;
text-decoration: none;
@@ -220,21 +209,28 @@ vn-main-block {
margin-left: .5em;
transition: opacity 250ms ease-out;
font-size: 2em;
+
&:hover {
opacity: 1;
}
}
}
}
+
/** START - FORM ELEMENTS DISABLED **/
-fieldset[disabled] .mdl-textfield .mdl-textfield__input, .mdl-textfield.is-disabled .mdl-textfield__input,
-fieldset[disabled] .mdl-checkbox .mdl-checkbox__label, .mdl-checkbox.is-disabled .mdl-checkbox__label {
+
+fieldset[disabled] .mdl-textfield .mdl-textfield__input,
+fieldset[disabled] .mdl-checkbox .mdl-checkbox__label,
+.mdl-textfield.is-disabled .mdl-textfield__input,
+.mdl-checkbox.is-disabled .mdl-checkbox__label {
border: none !important;
color: inherit !important;
}
-fieldset[disabled] .mdl-textfield .mdl-textfield__label, .mdl-textfield.is-disabled.is-disabled .mdl-textfield__label {
+fieldset[disabled] .mdl-textfield .mdl-textfield__label,
+.mdl-textfield.is-disabled.is-disabled .mdl-textfield__label {
color: $main-01 !important;
}
+
/** END - FORM ELEMENTS DISABLED **/
.ellipsize {
diff --git a/client/ticket/src/card/index.js b/client/ticket/src/card/index.js
index 22c126960..5bfb31b7b 100644
--- a/client/ticket/src/card/index.js
+++ b/client/ticket/src/card/index.js
@@ -4,11 +4,9 @@ class Controller {
constructor($http, $state) {
this.$http = $http;
this.$state = $state;
-
- this.ticket = null;
}
- _getTicket() {
+ getTicket() {
let filter = {
include: [
{relation: 'warehouse', scope: {fields: ['name']}},
@@ -16,7 +14,7 @@ class Controller {
{
relation: 'client',
scope: {
- fields: ['salesPersonFk', 'name'],
+ fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
include: {
relation: 'salesPerson',
fields: ['firstName', 'name']
@@ -35,21 +33,21 @@ class Controller {
}
]
};
+
let json = encodeURIComponent(JSON.stringify(filter));
- this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`)
- .then(res => {
- if (res.data)
- this.ticket = res.data;
- }
- );
+ let query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
+ this.$http.get(query).then(res => {
+ if (res.data)
+ this.ticket = res.data;
+ });
}
$onInit() {
- this._getTicket();
+ this.getTicket();
}
-
+
reload() {
- this._getTicket();
+ this.getTicket();
}
}
diff --git a/client/ticket/src/component/index.html b/client/ticket/src/component/index.html
index 15aa71f43..11d600bb7 100644
--- a/client/ticket/src/component/index.html
+++ b/client/ticket/src/component/index.html
@@ -36,7 +36,8 @@
{{::sale.itemFk}} |
+ }}" number pointer
+ ng-click="$ctrl.showDescriptor($event, sale.itemFk)">{{::sale.itemFk}}
|
@@ -69,3 +70,4 @@
+
diff --git a/client/ticket/src/component/index.js b/client/ticket/src/component/index.js
index 4eb51fe70..2c912c33c 100644
--- a/client/ticket/src/component/index.js
+++ b/client/ticket/src/component/index.js
@@ -43,6 +43,16 @@ class Controller extends FilterTicketList {
}
return sum;
}
+
+ showDescriptor(event, itemFk) {
+ this.$scope.descriptor.itemFk = itemFk;
+ this.$scope.descriptor.parent = event.target;
+ this.$scope.descriptor.show();
+ }
+
+ onDescriptorLoad() {
+ this.$scope.popover.relocate();
+ }
}
Controller.$inject = ['$scope', '$timeout', '$state'];
diff --git a/client/ticket/src/component/style.scss b/client/ticket/src/component/style.scss
index a08ba23a5..08a16c8f0 100644
--- a/client/ticket/src/component/style.scss
+++ b/client/ticket/src/component/style.scss
@@ -1,27 +1,41 @@
-vn-ticket-components .vn-grid {
- tbody:not(:last-child) {
- border-bottom: none;
- }
+vn-ticket-components {
+ vn-fetched-tags {
+ & vn-horizontal {
+ flex-direction: column;
+ text-align: center;
- tfoot tr:first-child td {
- padding-top: 10px !important;
+ & .inline-tag {
+ display: inline-block;
+ float: none
+ }
+ }
}
- tr {
- td {
- padding-top: .1em !important;
- padding-bottom: .1em !important;
+ .vn-grid {
+ tbody:not(:last-child) {
+ border-bottom: none;
}
- td.first {
+ tfoot tr:first-child td {
padding-top: 10px !important;
}
+
+ tr {
+ td {
+ padding-top: .1em !important;
+ padding-bottom: .1em !important;
+ }
- td.last {
- padding-bottom: 10px !important;
+ td.first {
+ padding-top: 10px !important;
+ }
+
+ td.last {
+ padding-bottom: 10px !important;
+ }
+ }
+ tr:not(:first-child):not(:last-child), {
+ border-bottom: none;
}
}
- tr:not(:first-child):not(:last-child), {
- border-bottom: none;
- }
}
\ No newline at end of file
diff --git a/client/ticket/src/data/step-one/index.js b/client/ticket/src/data/step-one/index.js
index f74a64c54..7e96eb40a 100644
--- a/client/ticket/src/data/step-one/index.js
+++ b/client/ticket/src/data/step-one/index.js
@@ -33,16 +33,16 @@ class Controller {
let data = {
landed: toJsonDate(this.ticket.landed),
addressFk: this.ticket.addressFk,
- agencyModeFk: this.ticket.agencyModeFk
+ agencyModeFk: this.ticket.agencyModeFk,
+ warehouseFk: this.ticket.warehouseFk
};
-
+
return this.$http.post(query, data).then(res => {
if (res.data)
this.ticket.sale = res.data;
return true;
}, res => {
- console.log(res);
if (res.data.error.message === 'NO_AGENCY_AVAILABLE')
this.vnApp.showError(
this.$translate.instant(`There's no available agency for this landing date`)
diff --git a/client/ticket/src/data/step-one/step-one.spec.js b/client/ticket/src/data/step-one/step-one.spec.js
index f00198308..625c90e90 100644
--- a/client/ticket/src/data/step-one/step-one.spec.js
+++ b/client/ticket/src/data/step-one/step-one.spec.js
@@ -15,6 +15,7 @@ describe('ticket', () => {
$componentController = _$componentController_;
$state = _$state_;
$httpBackend = _$httpBackend_;
+ $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
controller = $componentController('vnTicketDataStepOne', {$state: $state});
}));
@@ -25,6 +26,7 @@ describe('ticket', () => {
addressFk: 121,
agencyModeFk: 1,
companyFk: 442,
+ warehouseFk: 1,
shipped: new Date(),
landed: new Date()
};
@@ -36,28 +38,27 @@ describe('ticket', () => {
describe('onStepChange()', () => {
it('should call onStepChange method and return a NO_AGENCY_AVAILABLE signal error', async () => {
+ let landed = new Date();
+ landed.setHours(0, 0, 0, 0);
+
controller.ticket = {
id: 1,
clientFk: 1,
addressFk: 121,
agencyModeFk: 1,
companyFk: 442,
+ warehouseFk: 1,
shipped: new Date(),
- landed: new Date()
+ landed: landed
};
- let data = {
- addressFk: 121,
- agencyModeFk: 1,
- landed: new Date()
- };
- let response = {data: {error: new Error('NO_AGENCY_AVAILABLE')}};
+ let response = {error: new Error('NO_AGENCY_AVAILABLE')};
- $httpBackend.whenPOST(`/ticket/api/sales/1/priceDifference`, data).respond(400, response);
- $httpBackend.expectPOST(`/ticket/api/sales/1/priceDifference`, data);
- await controller.onStepChange();
+ $httpBackend.whenPOST(`/ticket/api/sales/1/priceDifference`).respond(400, response);
+ $httpBackend.expectPOST(`/ticket/api/sales/1/priceDifference`);
+ controller.onStepChange();
$httpBackend.flush();
});
});
});
-});
\ No newline at end of file
+});
diff --git a/client/ticket/src/data/step-three/index.html b/client/ticket/src/data/step-three/index.html
index e3d762ded..bcd26b357 100644
--- a/client/ticket/src/data/step-three/index.html
+++ b/client/ticket/src/data/step-three/index.html
@@ -11,5 +11,12 @@
initial-data="$ctrl.ticket.option">
+
+
+
+
diff --git a/client/ticket/src/data/step-three/index.js b/client/ticket/src/data/step-three/index.js
index f98aaa5bf..dcde1e838 100644
--- a/client/ticket/src/data/step-three/index.js
+++ b/client/ticket/src/data/step-three/index.js
@@ -15,6 +15,7 @@ class Controller {
$onChanges() {
this.ticket.option = 1;
+ this.ticket.hasToBeUnrouted = true;
}
onStepChange(state) {
@@ -29,12 +30,14 @@ class Controller {
let query = `/ticket/api/tickets/${this.ticket.id}/componentUpdate`;
let data = {
+ clientFk: this.ticket.clientFk,
agencyModeFk: this.ticket.agencyModeFk,
addressFk: this.ticket.addressFk,
warehouseFk: this.ticket.warehouseFk,
shipped: this.ticket.shipped,
landed: this.ticket.landed,
isDeleted: this.ticket.isDeleted,
+ hasToBeUnrouted: this.ticket.hasToBeUnrouted,
option: this.ticket.option
};
diff --git a/client/ticket/src/data/step-three/locale/es.yml b/client/ticket/src/data/step-three/locale/es.yml
index d2c21e5ef..f2b78c77f 100644
--- a/client/ticket/src/data/step-three/locale/es.yml
+++ b/client/ticket/src/data/step-three/locale/es.yml
@@ -1,3 +1,4 @@
Charge: Cargo
Choose an option: Selecciona una opción
-Charge difference to: Diferencia a cargo de
\ No newline at end of file
+Charge difference to: Diferencia a cargo de
+Remove from route: Sacar de la ruta
\ No newline at end of file
diff --git a/client/ticket/src/descriptor/index.html b/client/ticket/src/descriptor/index.html
index 2f00e811a..2b09180fc 100644
--- a/client/ticket/src/descriptor/index.html
+++ b/client/ticket/src/descriptor/index.html
@@ -8,31 +8,53 @@
-
-
{{$ctrl.client.name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
{{$ctrl.client.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/ticket/src/descriptor/index.js b/client/ticket/src/descriptor/index.js
index ee40fdd94..a1364bda8 100644
--- a/client/ticket/src/descriptor/index.js
+++ b/client/ticket/src/descriptor/index.js
@@ -1,8 +1,29 @@
import ngModule from '../module';
+class Controller {
+
+ constructor($http) {
+ this.$http = $http;
+ }
+
+ getClientDebt(clientFk) {
+ this.$http.get(`/client/api/Clients/${clientFk}/getDebt`).then(response => {
+ this.clientDebt = response.data.debt;
+ });
+ }
+
+ $onChanges() {
+ if (this.ticket)
+ this.getClientDebt(this.ticket.clientFk);
+ }
+}
+
+Controller.$inject = ['$http'];
+
ngModule.component('vnTicketDescriptor', {
template: require('./index.html'),
bindings: {
ticket: '<'
- }
+ },
+ controller: Controller
});
diff --git a/client/ticket/src/expedition/index.html b/client/ticket/src/expedition/index.html
index cc4e3ebb4..8da3bbfb5 100644
--- a/client/ticket/src/expedition/index.html
+++ b/client/ticket/src/expedition/index.html
@@ -25,7 +25,8 @@
vn-tooltip="delete expedition"
ng-click="$ctrl.deleteExpedition(expedition)">delete
- {{::expedition.itemFk}}
+ {{::expedition.itemFk}}
{{::expedition.item.name}}
{{::expedition.package.name}}
{{::expedition.counter}}
@@ -41,3 +42,4 @@
+
diff --git a/client/ticket/src/expedition/index.js b/client/ticket/src/expedition/index.js
index 4eb91af50..e4f980306 100644
--- a/client/ticket/src/expedition/index.js
+++ b/client/ticket/src/expedition/index.js
@@ -4,6 +4,7 @@ import FilterTicketList from '../filter-ticket-list';
class Controller extends FilterTicketList {
constructor($scope, $timeout, $stateParams, $http) {
super($scope, $timeout, $stateParams);
+ this.$scope = $scope;
this.params = $stateParams;
this.$http = $http;
}
@@ -13,6 +14,16 @@ class Controller extends FilterTicketList {
() => this.$.index.accept()
);
}
+
+ showDescriptor(event, itemFk) {
+ this.$scope.descriptor.itemFk = itemFk;
+ this.$scope.descriptor.parent = event.target;
+ this.$scope.descriptor.show();
+ }
+
+ onDescriptorLoad() {
+ this.$scope.popover.relocate();
+ }
}
Controller.$inject = ['$scope', '$timeout', '$state', '$http'];
diff --git a/client/ticket/src/fetched-tags/index.html b/client/ticket/src/fetched-tags/index.html
index d9b47107b..4a3c679a7 100644
--- a/client/ticket/src/fetched-tags/index.html
+++ b/client/ticket/src/fetched-tags/index.html
@@ -1,8 +1,11 @@
-
+
{{::$ctrl.sale.concept}}
-
-
- {{::fetchedTag.tag.name}} {{::fetchedTag.value}}
-
+
+
+ {{::fetchedTag.value}}
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/client/ticket/src/fetched-tags/index.js b/client/ticket/src/fetched-tags/index.js
index 1b8341bdc..7e9455060 100644
--- a/client/ticket/src/fetched-tags/index.js
+++ b/client/ticket/src/fetched-tags/index.js
@@ -1,4 +1,5 @@
import ngModule from '../module';
+import './style.scss';
ngModule.component('vnFetchedTags', {
template: require('./index.html'),
diff --git a/client/ticket/src/fetched-tags/style.scss b/client/ticket/src/fetched-tags/style.scss
new file mode 100644
index 000000000..6abfd33d5
--- /dev/null
+++ b/client/ticket/src/fetched-tags/style.scss
@@ -0,0 +1,42 @@
+@import "colors";
+
+vn-fetched-tags {
+ @media screen and (max-width: 1700px){
+ & vn-horizontal {
+ flex-direction: column;
+ text-align: center;
+
+ & .inline-tag {
+ display: inline-block;
+ float: none
+ }
+ }
+ }
+
+ & vn-one:first-child {
+ padding-top: 0.36em
+ }
+
+ & .inline-tag {
+ background-color: $secondary-font-color;
+ margin: 0.4em 0.4em 0 0;
+ color: $color-white;
+ text-align: center;
+ font-size: 0.8em;
+ height: 1.25em;
+ padding: 0.4em;
+ float: left;
+ width: 5em
+ }
+
+ & .inline-tag.empty {
+ background-color: $main-bg
+ }
+
+ & .inline-tag.empty:after {
+ overflow: hidden;
+ display: block;
+ content: ' ';
+ clear: both
+ }
+}
\ No newline at end of file
diff --git a/client/ticket/src/index/index.html b/client/ticket/src/index/index.html
index 405e4dfef..e04c85854 100644
--- a/client/ticket/src/index/index.html
+++ b/client/ticket/src/index/index.html
@@ -1,70 +1,69 @@
-
-
-
-
- TICKETS
-
-
-
-
-
-
-
-
- |
- ID Ticket |
- Comercial |
- Date |
- Hora |
- Alias |
- Provincia |
- Estado |
- Agencia |
- Almacen |
- Factura |
- Ruta |
- |
-
-
-
-
-
-
- |
- {{::ticket.id}} |
- {{::ticket.client.salesPerson.name | dashIfEmpty}} |
- {{::ticket.shipped | date:'dd/MM/yyyy'}} |
- {{::ticket.shipped | date:'HH:MM'}} |
- {{::ticket.nickname}} |
- {{::ticket.address.province.name}} |
- {{::ticket.tracking.state.name}} |
- {{::ticket.agencyMode.name}} |
- {{::ticket.warehouse.name}} |
- {{::ticket.refFk | dashIfEmpty}} |
- {{::ticket.routeFk | dashIfEmpty}} |
-
-
-
- |
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+ Id |
+ Salesperson |
+ Date |
+ Hour |
+ Alias |
+ Province |
+ State |
+ Agency |
+ Warehouse |
+ Invoice |
+ Route |
+ |
+
+
+
+
+ {{::ticket.id}} |
+ {{::ticket.client.salesPerson.name | dashIfEmpty}} |
+ {{::ticket.shipped | date:'dd/MM/yyyy'}} |
+ {{::ticket.shipped | date:'HH:MM'}} |
+ {{::ticket.nickname}} |
+ {{::ticket.address.province.name}} |
+ {{::ticket.tracking.state.name}} |
+ {{::ticket.agencyMode.name}} |
+ {{::ticket.warehouse.name}} |
+ {{::ticket.refFk | dashIfEmpty}} |
+ {{::ticket.routeFk | dashIfEmpty}} |
+
+
+
+ |
+
+
+
+
+
+
diff --git a/client/ticket/src/index/index.js b/client/ticket/src/index/index.js
index fe75368e3..813165403 100644
--- a/client/ticket/src/index/index.js
+++ b/client/ticket/src/index/index.js
@@ -1,11 +1,82 @@
import ngModule from '../module';
-import './ticket-item';
-import './style.scss';
export default class Controller {
constructor($scope) {
- this.$scope = $scope;
+ this.$ = $scope;
this.ticketSelected = null;
+
+ this.filter = {
+ include: [
+ {
+ relation: 'address',
+ scope: {
+ fields: ['provinceFk'],
+ include: {
+ relation: 'province',
+ scope: {
+ fields: ['name']
+ }
+ }
+ }
+ }, {
+ relation: 'warehouse',
+ scope: {
+ fields: ['name']
+ }
+ }, {
+ relation: 'agencyMode',
+ scope: {
+ fields: ['name']
+ }
+ }, {
+ relation: 'tracking',
+ scope: {
+ fields: ['stateFk'],
+ include: {
+ relation: 'state',
+ scope: {
+ fields: ['name']
+ }
+ }
+ }
+ }, {
+ relation: 'client',
+ scope: {
+ fields: ['salesPersonFk'],
+ include: {
+ relation: 'salesPerson',
+ scope: {
+ fields: ['name']
+ }
+ }
+ }
+ }
+ ],
+ order: 'shipped DESC'
+ };
+ }
+
+ exprBuilder(param, value) {
+ switch (param) {
+ case 'search':
+ return {
+ or: [
+ {id: value},
+ {nickname: {regexp: value}}
+ ]
+ };
+ case 'from':
+ return {shipped: {gte: value}};
+ case 'to':
+ return {shipped: {lte: value}};
+ case 'nickname':
+ return {[param]: {regexp: value}};
+ case 'id':
+ case 'clientFk':
+ case 'agencyModeFk':
+ case 'warehouseFk':
+ return {[param]: value};
+ }
}
compareDate(date) {
@@ -26,17 +97,9 @@ export default class Controller {
preview(event, ticket) {
event.preventDefault();
event.stopImmediatePropagation();
- this.$scope.dialogSummaryTicket.show();
+ this.$.dialogSummaryTicket.show();
this.ticketSelected = ticket;
}
-
- search(index) {
- index.accept();
- /* this.tickets = [];
- index.accept().then(res => {
- this.tickets = res.instances;
- }); */
- }
}
Controller.$inject = ['$scope'];
diff --git a/client/ticket/src/index/ticket-index.spec.js b/client/ticket/src/index/index.spec.js
similarity index 86%
rename from client/ticket/src/index/ticket-index.spec.js
rename to client/ticket/src/index/index.spec.js
index f6a004948..a6cd7d18c 100644
--- a/client/ticket/src/index/ticket-index.spec.js
+++ b/client/ticket/src/index/index.spec.js
@@ -34,14 +34,14 @@ describe('ticket', () => {
it('should call preventDefault and stopImmediatePropagation from event and show', () => {
let event = jasmine.createSpyObj('event', ['preventDefault', 'stopImmediatePropagation']);
- controller.$scope = {dialogSummaryTicket: {show: () => {}}};
- spyOn(controller.$scope.dialogSummaryTicket, 'show');
+ controller.$ = {dialogSummaryTicket: {show: () => {}}};
+ spyOn(controller.$.dialogSummaryTicket, 'show');
let ticket = {};
controller.preview(event, ticket);
expect(event.preventDefault).toHaveBeenCalledWith();
expect(event.stopImmediatePropagation).toHaveBeenCalledWith();
- expect(controller.$scope.dialogSummaryTicket.show).toHaveBeenCalledWith();
+ expect(controller.$.dialogSummaryTicket.show).toHaveBeenCalledWith();
});
});
});
diff --git a/client/ticket/src/index/style.scss b/client/ticket/src/index/style.scss
deleted file mode 100644
index eb363a9a7..000000000
--- a/client/ticket/src/index/style.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-vn-ticket-item {
- display: block;
-}
\ No newline at end of file
diff --git a/client/ticket/src/index/ticket-item.html b/client/ticket/src/index/ticket-item.html
deleted file mode 100644
index 9b9d25440..000000000
--- a/client/ticket/src/index/ticket-item.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- {{::$ctrl.ticket.nickname}}
-
-
-
-
-
-
-
-
-
diff --git a/client/ticket/src/index/ticket-item.js b/client/ticket/src/index/ticket-item.js
deleted file mode 100644
index c62a989d9..000000000
--- a/client/ticket/src/index/ticket-item.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import ngModule from '../module';
-
-class Controller {
- onClick(event) {
- if (event.defaultPrevented)
- event.stopImmediatePropagation();
- }
-
- preview(event) {
- event.preventDefault();
- this.index.openSummary(this.ticket);
- }
-}
-
-ngModule.component('vnTicketItem', {
- controller: Controller,
- template: require('./ticket-item.html'),
- bindings: {
- ticket: '<'
- },
- require: {
- index: '^vnTicketIndex'
- }
-});
diff --git a/client/ticket/src/note/index.js b/client/ticket/src/note/index.js
index e682b5514..8c2c602c9 100644
--- a/client/ticket/src/note/index.js
+++ b/client/ticket/src/note/index.js
@@ -119,6 +119,7 @@ class Controller {
return this.$http.post(`/ticket/api/TicketObservations/crudTicketObservation`, observationsObj).then(() => {
this.getObservations();
this._unsetDirtyForm();
+ this.$scope.watcher.notifySaved();
});
}
this.vnApp.showMessage(this.$translate.instant('No changes to save'));
diff --git a/client/ticket/src/note/ticket-observation.spec.js b/client/ticket/src/note/ticket-observation.spec.js
index 7d58abd81..f1bbbdd0b 100644
--- a/client/ticket/src/note/ticket-observation.spec.js
+++ b/client/ticket/src/note/ticket-observation.spec.js
@@ -15,7 +15,11 @@ describe('ticket', () => {
$componentController = _$componentController_;
$state = _$state_;
$httpBackend = _$httpBackend_;
+ $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
controller = $componentController('vnTicketObservation', {$state: $state});
+ controller.$scope.watcher = {
+ notifySaved: () => {}
+ };
}));
describe('add / remove observation', () => {
diff --git a/client/ticket/src/package/package.spec.js b/client/ticket/src/package/package.spec.js
index 81bddc9f6..f9d0ec606 100644
--- a/client/ticket/src/package/package.spec.js
+++ b/client/ticket/src/package/package.spec.js
@@ -14,6 +14,7 @@ describe('Ticket', () => {
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_, $rootScope) => {
$componentController = _$componentController_;
$httpBackend = _$httpBackend_;
+ $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
$scope = {
index: {
accept: function() {}
@@ -35,11 +36,6 @@ describe('Ticket', () => {
describe('submit()', () => {
it('should perform a post', () => {
spyOn(controller.$.index, 'accept');
- let packagesObj = {
- delete: controller.removedPackages,
- create: [],
- update: []
- };
let query = '/ticket/api/TicketPackagings/crudTicketPackaging';
controller.removedPackages = [];
controller.oldPackages = [];
diff --git a/client/ticket/src/sale-checked/index.html b/client/ticket/src/sale-checked/index.html
index 8337c22f1..00de7cec2 100644
--- a/client/ticket/src/sale-checked/index.html
+++ b/client/ticket/src/sale-checked/index.html
@@ -8,7 +8,7 @@
Is checked |
Item |
- Description |
+ Description |
Quantity |
@@ -20,7 +20,8 @@
disabled="true">
- {{::sale.itemFk}} |
+ {{::sale.itemFk}} |
|
{{::sale.quantity}} |
@@ -34,3 +35,4 @@
+