diff --git a/client/core/src/date-picker/date-picker.js b/client/core/src/date-picker/date-picker.js index 9f4a1647bb..b60f204094 100644 --- a/client/core/src/date-picker/date-picker.js +++ b/client/core/src/date-picker/date-picker.js @@ -7,8 +7,8 @@ import Flatpickr from 'vendor/src/flatpickr'; const _NAME = 'datePicker'; export const NAME = util.getName(_NAME); -directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate']; -export function directive(resolve, normalizer, $translate) { +directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate', '$document', '$transitions']; +export function directive(resolve, normalizer, $translate, $document, $transitions) { return { restrict: 'E', template: function(_, attrs) { @@ -32,6 +32,13 @@ export function directive(resolve, normalizer, $translate) { if (input) vp = new Flatpickr(input, initOptions); + scope.$watch(attrs.model, () => { + let mdlField = element[0].firstChild.MaterialCheckbox; + if (mdlField) + mdlField.updateClasses_(); + }); + componentHandler.upgradeElement(element[0].firstChild); + element.on('$destroy', function() { vp.destroy(); }); diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index f04cb3d090..46e772681c 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -21,6 +21,7 @@ export class Popover { this.$compile = $compile; } show(childElement, parent) { + this.childElement = childElement; let popover = this.document.createElement('div'); popover.className = 'vn-popover'; popover.addEventListener('mousedown', @@ -81,6 +82,7 @@ export class Popover { let childElement = this.document.createElement(childComponent); this.$compile(childElement)($scope); this.show(childElement, parent); + return childElement; } hide() { if (!this.popover) return; @@ -91,6 +93,7 @@ export class Popover { this.lastEvent = null; this.docMouseDownHandler = null; this.docKeyDownHandler = null; + angular.element(this.childElement).remove(); } onDocMouseDown(event) { if (event != this.lastEvent) diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js index 1ea5df24a2..d7620e41c2 100644 --- a/client/core/src/tooltip/tooltip.js +++ b/client/core/src/tooltip/tooltip.js @@ -52,15 +52,15 @@ function tooltip($document, $compile) { tip.css('left', offset.left + 'px'); }); - element.bind('mouseout', function() { + element.on('mouseout', function() { tip.removeClass(tipActiveClassName); }); - tip.bind('mouseover', function() { + tip.on('mouseover', function() { tip.addClass(tipActiveClassName); }); - tip.bind('mouseout', function() { + tip.on('mouseout', function() { tip.removeClass(tipActiveClassName); }); diff --git a/client/production/src/filter-panel/filter-panel.html b/client/production/src/filter-panel/filter-panel.html index aa47f90665..8ee87823c1 100644 --- a/client/production/src/filter-panel/filter-panel.html +++ b/client/production/src/filter-panel/filter-panel.html @@ -13,11 +13,19 @@ value-field="id" label="Provincia"> - + + + + + + + + + \ No newline at end of file diff --git a/client/production/src/filter-panel/filter-panel.js b/client/production/src/filter-panel/filter-panel.js index c432b3b08f..907df7f145 100644 --- a/client/production/src/filter-panel/filter-panel.js +++ b/client/production/src/filter-panel/filter-panel.js @@ -1,20 +1,24 @@ import ngModule from '../module'; +import './style.scss'; export default class Controller { constructor($window) { this.$window = $window; } + /* $onDestroy() { + console.log('panel destruido'); + }*/ onSearch() { this.setStorageValue(); this.onSubmit(this.filter); } $onChanges() { - var value = JSON.parse(this.$window.sessionStorage.getItem('production')); + var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); if (value !== undefined) this.filter = value; } setStorageValue() { - this.$window.sessionStorage.setItem('production', JSON.stringify(this.filter)); + this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); } } Controller.$inject = ['$window']; diff --git a/client/production/src/filter-panel/style.scss b/client/production/src/filter-panel/style.scss new file mode 100644 index 0000000000..f943570873 --- /dev/null +++ b/client/production/src/filter-panel/style.scss @@ -0,0 +1,6 @@ +vn-production-filter-panel { + button { + color: #ffa410 !important; + background-color: white !important; + } +} \ No newline at end of file diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 49c24f3bf9..b768aab801 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,13 +1,13 @@ + - Localizador @@ -18,9 +18,7 @@ url="/client/api/ContactChannels" label="Almacen"> - - - + @@ -58,7 +56,7 @@ {{ticket.id}} - {{ticket.agency.id}} + {{ticket.agency.name}} {{ticket.employee.name}} {{ticket.hour}} {{ticket.state.name}} @@ -77,8 +75,8 @@ - - + {{$ctrl.lines}} + {{$ctrl.meters}} diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index a901c863c9..97c5c1d5c0 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -2,16 +2,63 @@ import ngModule from '../module'; import './style.scss'; export default class ProductionIndex { - constructor() { - this.model = {}; - this.checkAll = false; + constructor($element, $scope) { + this.$element = $element; + this.$ = $scope; + this.filter = {}; + this._checkAll = false; this.tickets = []; + this.lines = 0; + this.meters = 0; } - search(index) { - index.filter.search = this.model.search; - index.accept(); + get checkAll() { + return this._checkAll; + } + set checkAll(value) { + this._checkAll = value; + this.switchChecks(); + } + switchChecks() { + let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]'); + checks.forEach( + (el, i) => { + el.checked = this._checkAll; + this.tickets[i].cheched = this._checkAll; + } + ); + } + doAction(action) { + let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]:checked'); + if (checks.length) { + let ids = []; + checks.forEach( + (_, i) => { + ids.push(this.tickets[i].id); + } + ); + // TODO: call action -> endPoint with tickets's Ids + } else { + // TODO: dialog with no items selected + } + } + sumTickets() { + let lines = 0; + let meters = 0; + this.tickets.forEach( + val => { + lines += parseFloat(val.lines); + meters += parseFloat(val.meters); + } + ); + this.lines = lines; + this.meters = meters.toFixed(2); + } + onSearch() { + this.$.index.filter = this.filter; + this.$.index.accept(); } } +ProductionIndex.$inject = ['$element', '$scope']; ngModule.component('vnProductionIndex', { template: require('./index.html'), diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index 0571afb44e..13bd38bbfb 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -3,6 +3,17 @@ vn-production-index { height: 20px; padding: 0 6px; } + vn-searchbar { + vn-icon{ + padding-top: 20px; + } + vn-icon-button{ + padding-top: 10px; + } + } + [pad-ten-top] { + padding-top: 10px; + } .icon-square{ height: 36px; } diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 081f566f18..aac912788c 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -10,9 +10,7 @@ export default class Controller { this.$window = $window; } onClick(event) { - var child = this.$document[0].createElement(this.popover); - this.$compile(child)(this.$scope); - this.vnPopover.show(child, this.element); + var child = this.vnPopover.showComponent(this.popover, this.$scope, this.element); // XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente? var childCtrl = angular.element(child).isolateScope().$ctrl; diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 1146d9c0fd..c3712646e6 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -29,4 +29,10 @@ vn-button-bar { } html [text-center], .text-center { text-align: center; +} +html [vn-right], .vn-right{ + float: right; +} +html [vn-left], .vn-left{ + float: left; } \ No newline at end of file