diff --git a/modules/monitor/front/index.js b/modules/monitor/front/index.js index 19ea06b5a..a7209a0bd 100644 --- a/modules/monitor/front/index.js +++ b/modules/monitor/front/index.js @@ -1,8 +1,3 @@ export * from './module'; import './main'; -import './index/'; -import './index/tickets'; -import './index/clients'; -import './index/orders'; -import './index/search-panel'; diff --git a/modules/monitor/front/index/clients/index.html b/modules/monitor/front/index/clients/index.html deleted file mode 100644 index c0e3d1b14..000000000 --- a/modules/monitor/front/index/clients/index.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Clients on website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Date - - Hour - - Salesperson - - Client -
- - {{::visit.dated | date:'dd/MM/yy'}} - - - - {{::visit.hour | date: 'HH:mm'}} - - - - {{::visit.salesPerson | dashIfEmpty}} - - - - {{::visit.clientName}} - -
-
- - - - -
-
- - - - diff --git a/modules/monitor/front/index/clients/index.js b/modules/monitor/front/index/clients/index.js deleted file mode 100644 index ac3ce9140..000000000 --- a/modules/monitor/front/index/clients/index.js +++ /dev/null @@ -1,96 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - const date = Date.vnNew(); - this.dateFrom = date; - this.dateTo = date; - this.filter = { - where: { - 'v.stamp': { - between: this.dateRange() - } - } - }; - - this.smartTableOptions = { - activeButtons: { - search: true - }, - columns: [ - { - field: 'clientFk', - autocomplete: { - url: 'Clients', - showField: 'name', - valueField: 'id' - } - }, - { - field: 'salesPersonFk', - autocomplete: { - url: 'Workers/activeWithInheritedRole', - where: `{role: 'salesPerson'}`, - searchFunction: '{firstName: $search}', - showField: 'nickname', - valueField: 'id', - } - }, - { - field: 'dated', - searchable: false - }, - { - field: 'hour', - searchable: false - } - ] - }; - } - - exprBuilder(param, value) { - switch (param) { - case 'clientFk': - return {[`c.id`]: value}; - case 'salesPersonFk': - return {[`c.${param}`]: value}; - } - } - - dateRange() { - let from = this.dateFrom; - let to = this.dateTo; - if (!from) - from = Date.vnNew(); - if (!to) - to = Date.vnNew(); - const minHour = new Date(from); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(to); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } - - addFilterDate() { - this.$.model.filter = { - where: { - 'v.stamp': { - between: this.dateRange() - } - } - }; - this.$.model.refresh(); - } -} - -ngModule.vnComponent('vnMonitorSalesClients', { - template: require('./index.html'), - controller: Controller, - require: { - main: '^vnMonitorIndex' - } -}); diff --git a/modules/monitor/front/index/index.html b/modules/monitor/front/index/index.html deleted file mode 100644 index 85987ac20..000000000 --- a/modules/monitor/front/index/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/monitor/front/index/index.js b/modules/monitor/front/index/index.js deleted file mode 100644 index 72ca9dae9..000000000 --- a/modules/monitor/front/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - const isTopPanelHidden = localStorage.getItem('ticketTopPanelHidden'); - if (isTopPanelHidden === 'true') - this.isTopPanelHidden = true; - } - - toggle() { - const monitor = this.element.querySelector('vn-horizontal'); - const isHidden = monitor.classList.contains('hidden'); - - if (!isHidden) { - monitor.classList.add('hidden'); - localStorage.setItem('ticketTopPanelHidden', true); - } else { - monitor.classList.remove('hidden'); - localStorage.setItem('ticketTopPanelHidden', false); - } - } -} - -ngModule.vnComponent('vnMonitorIndex', { - template: require('./index.html'), - controller: Controller, - require: { - main: '^vnMonitorIndex' - } -}); diff --git a/modules/monitor/front/index/index.spec.js b/modules/monitor/front/index/index.spec.js deleted file mode 100644 index 506e75720..000000000 --- a/modules/monitor/front/index/index.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -import './index.js'; -describe('Component vnMonitorIndex', () => { - let controller; - let $element; - - beforeEach(ngModule('monitor')); - - beforeEach(inject(($compile, $rootScope) => { - $element = $compile('')($rootScope); - controller = $element.controller('vnMonitorIndex'); - })); - - describe('toggle()', () => { - it('should add the hidden class to the horizontal contaning the panel to hide', () => { - controller.toggle(); - - const targetElement = $element[0].querySelector('vn-horizontal'); - const firstClass = targetElement.classList[0]; - - const isTopPanelHidden = localStorage.getItem('ticketTopPanelHidden'); - - expect(firstClass).toEqual('hidden'); - expect(isTopPanelHidden).toEqual('true'); - }); - - it('should remove the hidden class to the horizontal contaning the panel to hide', () => { - const targetElement = $element[0].querySelector('vn-horizontal'); - targetElement.classList.add('hidden'); - controller.toggle(); - const firstClass = targetElement.classList[0]; - - const isTopPanelHidden = localStorage.getItem('ticketTopPanelHidden'); - - expect(firstClass).toBeUndefined(); - expect(isTopPanelHidden).toEqual('false'); - }); - }); -}); diff --git a/modules/monitor/front/index/locale/es.yml b/modules/monitor/front/index/locale/es.yml deleted file mode 100644 index f114a2259..000000000 --- a/modules/monitor/front/index/locale/es.yml +++ /dev/null @@ -1,16 +0,0 @@ -Tickets monitor: Monitor de tickets -Clients on website: Clientes activos en la web -Recent order actions: Acciones recientes en pedidos -Search tickets: Buscar tickets -Delete selected elements: Eliminar los elementos seleccionados -All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar? -Component lack: Faltan componentes -Ticket too little: Ticket demasiado pequeño -Minimize/Maximize: Minimizar/Maximizar -Problems: Problemas -Theoretical: Teórica -Practical: Práctica -Preparation: Preparación -Auto-refresh: Auto-refresco -Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos -Is fragile: Es frágil diff --git a/modules/monitor/front/index/orders/index.html b/modules/monitor/front/index/orders/index.html deleted file mode 100644 index 4d1171185..000000000 --- a/modules/monitor/front/index/orders/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - Recent order actions - - - - - - - - - - - - - - - - - - - Date - Client - SalesPerson - - - - - - - - - - - {{::order.date_send | date: 'dd/MM/yyyy'}} - - - - - {{::order.clientName}} - - - - - {{::order.salesPerson | dashIfEmpty}} - - - - - - - - {{::order.date_make | date: 'dd/MM/yyyy HH:mm'}} - - - - - {{::order.agencyName | dashIfEmpty}} - - - - {{::order.import | currency: 'EUR':2}} - - - - - - - - - - - - - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - - Copy value - - - - - diff --git a/modules/monitor/front/index/orders/index.js b/modules/monitor/front/index/orders/index.js deleted file mode 100644 index 40100b79f..000000000 --- a/modules/monitor/front/index/orders/index.js +++ /dev/null @@ -1,74 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - get checked() { - const rows = this.$.model.data || []; - const checkedRows = []; - for (let row of rows) { - if (row.checked) - checkedRows.push(row.id); - } - - return checkedRows; - } - - get totalChecked() { - return this.checked.length; - } - - onDelete() { - const params = {deletes: this.checked}; - const query = `SalesMonitors/deleteOrders`; - this.$http.post(query, params).then( - () => this.$.model.refresh()); - } - - chipColor(date) { - const today = Date.vnNew(); - today.setHours(0, 0, 0, 0); - - const orderLanded = new Date(date); - orderLanded.setHours(0, 0, 0, 0); - - const difference = today - orderLanded; - - if (difference == 0) - return 'warning'; - if (difference < 0) - return 'success'; - if (difference > 0) - return 'alert'; - } - - exprBuilder(param, value) { - switch (param) { - case 'date_send': - return {[`o.date_send`]: { - between: this.dateRange(value)} - }; - case 'clientFk': - return {[`c.id`]: value}; - case 'salesPersonFk': - return {[`c.${param}`]: value}; - } - } - - dateRange(value) { - const minHour = new Date(value); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(value); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } -} - -ngModule.vnComponent('vnMonitorSalesOrders', { - template: require('./index.html'), - controller: Controller, - require: { - main: '^vnMonitorIndex' - } -}); diff --git a/modules/monitor/front/index/orders/index.spec.js b/modules/monitor/front/index/orders/index.spec.js deleted file mode 100644 index 109925358..000000000 --- a/modules/monitor/front/index/orders/index.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('Component vnMonitorSalesOrders', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('monitor')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnMonitorSalesOrders', {$element}); - controller.$.model = crudModel; - controller.$.model.data = [ - {id: 1, name: 'My item 1'}, - {id: 2, name: 'My item 2'}, - {id: 3, name: 'My item 3'} - ]; - })); - - describe('checked() getter', () => { - it('should return a the selected rows', () => { - const modelData = controller.$.model.data; - modelData[0].checked = true; - modelData[1].checked = true; - - const result = controller.checked; - - expect(result).toEqual(expect.arrayContaining([1, 2])); - }); - }); - - describe('onDelete()', () => { - it('should make a query and then call to the model refresh() method', () => { - jest.spyOn(controller.$.model, 'refresh'); - - const modelData = controller.$.model.data; - modelData[0].checked = true; - modelData[1].checked = true; - - const expectedParams = {deletes: [1, 2]}; - $httpBackend.expect('POST', 'SalesMonitors/deleteOrders', expectedParams).respond(200); - controller.onDelete(); - $httpBackend.flush(); - - expect(controller.$.model.refresh).toHaveBeenCalledWith(); - }); - }); -}); diff --git a/modules/monitor/front/index/orders/style.scss b/modules/monitor/front/index/orders/style.scss deleted file mode 100644 index 64d6497c9..000000000 --- a/modules/monitor/front/index/orders/style.scss +++ /dev/null @@ -1,19 +0,0 @@ -@import "variables"; - -vn-monitor-sales-orders { - vn-table.scrollable { - max-height: 350px; - overflow-x: hidden - } - - vn-table a.vn-tbody { - & > vn-tr:nth-child(2) { - color: gray; - - & > vn-td { - border-bottom: $border; - font-size: 13px; - } - } - } -} \ No newline at end of file diff --git a/modules/monitor/front/index/search-panel/index.html b/modules/monitor/front/index/search-panel/index.html deleted file mode 100644 index 25a3510ab..000000000 --- a/modules/monitor/front/index/search-panel/index.html +++ /dev/null @@ -1,120 +0,0 @@ -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{name}} - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/monitor/front/index/search-panel/index.js b/modules/monitor/front/index/search-panel/index.js deleted file mode 100644 index ef6625e8a..000000000 --- a/modules/monitor/front/index/search-panel/index.js +++ /dev/null @@ -1,59 +0,0 @@ -import ngModule from '../../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -class Controller extends SearchPanel { - constructor($, $element) { - super($, $element); - this.filter = this.$.filter; - - this.getGroupedStates(); - } - - getGroupedStates() { - let groupedStates = []; - this.$http.get('AlertLevels').then(res => { - for (let state of res.data) { - groupedStates.push({ - id: state.id, - code: state.code, - name: this.$t(state.code) - }); - } - this.groupedStates = groupedStates; - }); - } - - get from() { - return this._from; - } - - set from(value) { - this._from = value; - this.filter.scopeDays = null; - } - - get to() { - return this._to; - } - - set to(value) { - this._to = value; - this.filter.scopeDays = null; - } - - get scopeDays() { - return this._scopeDays; - } - - set scopeDays(value) { - this._scopeDays = value; - - this.filter.from = null; - this.filter.to = null; - } -} - -ngModule.vnComponent('vnMonitorSalesSearchPanel', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/monitor/front/index/search-panel/index.spec.js b/modules/monitor/front/index/search-panel/index.spec.js deleted file mode 100644 index 18cf1abfc..000000000 --- a/modules/monitor/front/index/search-panel/index.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -import './index'; - -describe('Monitor Component vnMonitorSalesSearchPanel', () => { - let $httpBackend; - let controller; - - beforeEach(ngModule('monitor')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnMonitorSalesSearchPanel', {$element: null}); - controller.$t = () => {}; - controller.filter = {}; - })); - - describe('getGroupedStates()', () => { - it('should set an array of groupedStates with the adition of a name translation', () => { - jest.spyOn(controller, '$t').mockReturnValue('miCodigo'); - const data = [ - { - id: 9999, - code: 'myCode' - } - ]; - $httpBackend.whenGET('AlertLevels').respond(data); - controller.getGroupedStates(); - $httpBackend.flush(); - - expect(controller.groupedStates).toEqual([{ - id: 9999, - code: 'myCode', - name: 'miCodigo' - }]); - }); - }); - - describe('from() setter', () => { - it('should clear the scope days when setting the from property', () => { - controller.filter.scopeDays = 1; - - controller.from = Date.vnNew(); - - expect(controller.filter.scopeDays).toBeNull(); - expect(controller.from).toBeDefined(); - }); - }); - - describe('to() setter', () => { - it('should clear the scope days when setting the to property', () => { - controller.filter.scopeDays = 1; - - controller.to = Date.vnNew(); - - expect(controller.filter.scopeDays).toBeNull(); - expect(controller.to).toBeDefined(); - }); - }); - - describe('scopeDays() setter', () => { - it('should clear the date range when setting the scopeDays property', () => { - controller.filter.from = Date.vnNew(); - controller.filter.to = Date.vnNew(); - - controller.scopeDays = 1; - - expect(controller.filter.from).toBeNull(); - expect(controller.filter.to).toBeNull(); - expect(controller.scopeDays).toBeDefined(); - }); - }); -}); diff --git a/modules/monitor/front/index/style.scss b/modules/monitor/front/index/style.scss deleted file mode 100644 index 2b193ac88..000000000 --- a/modules/monitor/front/index/style.scss +++ /dev/null @@ -1,85 +0,0 @@ -@import "variables"; -@import "effects"; - -vn-monitor-index { - .header { - padding: 12px 0 5px 0; - color: gray; - font-size: 1.2rem; - border-bottom: $border; - margin-bottom: 10px; - - & > vn-none > vn-icon { - @extend %clickable-light; - color: $color-button; - font-size: 1.4rem; - } - - vn-none > .arrow { - transition: transform 200ms; - } - } - - vn-monitor-sales-clients { - vn-card { - margin-right: 15px; - } - - .header { - padding-right: 15px; - - & > vn-none > .arrow { - display: none - } - } - } - - vn-table.scrollable { - height: 300px - } - - vn-horizontal { - flex-wrap: wrap - } - - .hidden { - vn-card { - display: none - } - - .header > vn-none > .arrow { - transform: rotate(180deg); - } - } -} - -@media (max-width:1150px) { - vn-monitor-index { - & > vn-horizontal { - flex-direction: column; - - vn-monitor-sales-clients, - vn-monitor-sales-orders { - width: 100% - } - - vn-monitor-sales-clients { - margin-bottom: 15px - } - } - - vn-monitor-sales-clients { - vn-card { - margin-right: 0 - } - - .header { - padding-right: 0; - - & > vn-none > .arrow { - display: inline-block - } - } - } - } -} \ No newline at end of file diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html deleted file mode 100644 index 94a950baf..000000000 --- a/modules/monitor/front/index/tickets/index.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - Tickets monitor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Problems - - Identifier - - Client - - Salesperson - - Date - - Theoretical - - Practical - - Preparation - - Province - - State - - Fragile - - Zone - - Total -
- - - - - - - - - - - - - - - - - {{ticket.id}} - - - - {{ticket.nickname}} - - - - {{ticket.userName | dashIfEmpty}} - - - - {{ticket.shippedDate | date: 'dd/MM/yyyy'}} - - {{ticket.zoneLanding | date: 'HH:mm'}}{{ticket.practicalHour | date: 'HH:mm'}}{{ticket.shipped | date: 'HH:mm'}}{{ticket.province}} - - {{ticket.refFk}} - - - {{ticket.state}} - - - - - - - {{ticket.zoneName | dashIfEmpty}} - - - - {{(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - - Copy value - - - diff --git a/modules/monitor/front/index/tickets/index.js b/modules/monitor/front/index/tickets/index.js deleted file mode 100644 index 2f2dead05..000000000 --- a/modules/monitor/front/index/tickets/index.js +++ /dev/null @@ -1,178 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.filterParams = this.fetchParams(); - this.smartTableOptions = { - activeButtons: { - search: true, - shownColumns: true, - }, - columns: [ - { - field: 'totalProblems', - searchable: false - }, - { - field: 'salesPersonFk', - autocomplete: { - url: 'Workers/activeWithInheritedRole', - where: `{role: 'salesPerson'}`, - searchFunction: '{firstName: $search}', - showField: 'nickname', - valueField: 'id', - } - }, - { - field: 'provinceFk', - autocomplete: { - url: 'Provinces', - } - }, - { - field: 'stateFk', - autocomplete: { - url: 'States', - } - }, - { - field: 'zoneFk', - autocomplete: { - url: 'Zones', - } - }, - { - field: 'warehouseFk', - autocomplete: { - url: 'Warehouses', - } - }, - { - field: 'shippedDate', - datepicker: true - }, - { - field: 'theoreticalHour', - searchable: false - }, - { - field: 'preparationHour', - searchable: false - } - ] - }; - } - - $onInit() { - if (!this.$params.q) { - this.$.$applyAsync( - () => this.$.model.applyFilter(null, this.filterParams)); - } - } - - fetchParams($params = {}) { - const excludedParams = [ - 'search', - 'clientFk', - 'orderFk', - 'refFk', - 'scopeDays' - ]; - - const hasExcludedParams = excludedParams.some(param => { - return $params && $params[param] != undefined; - }); - const hasParams = Object.entries($params).length; - if (!hasParams || !hasExcludedParams) - $params.scopeDays = 1; - - if (typeof $params.scopeDays === 'number') { - const from = Date.vnNew(); - from.setHours(0, 0, 0, 0); - - const to = new Date(from.getTime()); - to.setDate(to.getDate() + $params.scopeDays); - to.setHours(23, 59, 59, 999); - - Object.assign($params, {from, to}); - } - - return $params; - } - - compareDate(date) { - let today = Date.vnNew(); - today.setHours(0, 0, 0, 0); - let timeTicket = new Date(date); - timeTicket.setHours(0, 0, 0, 0); - - let comparation = today - timeTicket; - - if (comparation == 0) - return 'warning'; - if (comparation < 0) - return 'success'; - } - - totalPriceColor(ticket) { - const total = parseInt(ticket.totalWithVat); - if (total > 0 && total < 50) - return 'warning'; - } - - exprBuilder(param, value) { - switch (param) { - case 'stateFk': - return {'ts.stateFk': value}; - case 'salesPersonFk': - return {'c.salesPersonFk': value}; - case 'provinceFk': - return {'a.provinceFk': value}; - case 'theoreticalHour': - return {'z.hour': value}; - case 'practicalHour': - return {'zed.etc': value}; - case 'shippedDate': - return {'t.shipped': { - between: this.dateRange(value)} - }; - case 'nickname': - return {[`t.nickname`]: {like: `%${value}%`}}; - case 'zoneFk': - case 'totalWithVat': - return {[`t.${param}`]: value}; - } - } - - dateRange(value) { - const minHour = new Date(value); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(value); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } - - preview(ticket) { - this.selectedTicket = ticket; - this.$.summary.show(); - } - - autoRefresh(value) { - if (value) - this.refreshTimer = setInterval(() => this.$.model.refresh(), 120000); - else { - clearInterval(this.refreshTimer); - this.refreshTimer = null; - } - } -} - -ngModule.vnComponent('vnMonitorSalesTickets', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js deleted file mode 100644 index c12ea6844..000000000 --- a/modules/monitor/front/index/tickets/index.spec.js +++ /dev/null @@ -1,133 +0,0 @@ -import './index.js'; -describe('Component vnMonitorSalesTickets', () => { - let controller; - let $window; - let tickets = [{ - id: 1, - clientFk: 1, - checked: false, - totalWithVat: 10.5 - }, { - id: 2, - clientFk: 1, - checked: true, - totalWithVat: 20.5 - }, { - id: 3, - clientFk: 1, - checked: true, - totalWithVat: 30 - }]; - - beforeEach(ngModule('monitor')); - - beforeEach(inject(($componentController, _$window_) => { - $window = _$window_; - const $element = angular.element(''); - controller = $componentController('vnMonitorSalesTickets', {$element}); - })); - - describe('fetchParams()', () => { - it('should return a range of dates with passed scope days', () => { - let params = controller.fetchParams({ - scopeDays: 2 - }); - const from = Date.vnNew(); - from.setHours(0, 0, 0, 0); - const to = new Date(from.getTime()); - to.setDate(to.getDate() + params.scopeDays); - to.setHours(23, 59, 59, 999); - - const expectedParams = { - from, - scopeDays: params.scopeDays, - to - }; - - expect(params).toEqual(expectedParams); - }); - - it('should return default value for scope days', () => { - let params = controller.fetchParams({ - scopeDays: 1 - }); - - expect(params.scopeDays).toEqual(1); - }); - - it('should return the given scope days', () => { - let params = controller.fetchParams({ - scopeDays: 2 - }); - - expect(params.scopeDays).toEqual(2); - }); - }); - - describe('compareDate()', () => { - it('should return warning when the date is the present', () => { - let today = Date.vnNew(); - let result = controller.compareDate(today); - - expect(result).toEqual('warning'); - }); - - it('should return sucess when the date is in the future', () => { - let futureDate = Date.vnNew(); - futureDate = futureDate.setDate(futureDate.getDate() + 10); - let result = controller.compareDate(futureDate); - - expect(result).toEqual('success'); - }); - - it('should return undefined when the date is in the past', () => { - let pastDate = Date.vnNew(); - pastDate = pastDate.setDate(pastDate.getDate() - 10); - let result = controller.compareDate(pastDate); - - expect(result).toEqual(undefined); - }); - }); - - describe('totalPriceColor()', () => { - it('should return "warning" when the ticket amount is less than 50€', () => { - const result = controller.totalPriceColor({totalWithVat: '8.50'}); - - expect(result).toEqual('warning'); - }); - }); - - describe('dateRange()', () => { - it('should return two dates with the hours at the start and end of the given date', () => { - const now = Date.vnNew(); - - const today = now.getDate(); - - const dateRange = controller.dateRange(now); - const start = dateRange[0].toString(); - const end = dateRange[1].toString(); - - expect(start).toContain(today); - expect(start).toContain('00:00:00'); - - expect(end).toContain(today); - expect(end).toContain('23:59:59'); - }); - }); - - describe('preview()', () => { - it('should show the dialog summary', () => { - controller.$.summary = {show: () => {}}; - jest.spyOn(controller.$.summary, 'show'); - - let event = new MouseEvent('click', { - view: $window, - bubbles: true, - cancelable: true - }); - controller.preview(event, tickets[0]); - - expect(controller.$.summary.show).toHaveBeenCalledWith(); - }); - }); -}); diff --git a/modules/monitor/front/index/tickets/style.scss b/modules/monitor/front/index/tickets/style.scss deleted file mode 100644 index 102c92a8a..000000000 --- a/modules/monitor/front/index/tickets/style.scss +++ /dev/null @@ -1,47 +0,0 @@ -@import "variables"; - -vn-monitor-sales-tickets { - @media screen and (max-width: 1440px) { - .expendable { - display: none; - } - } - - vn-th.icon-field, - vn-th.icon-field *, - vn-td.icon-field, - vn-td.icon-field * { - padding: 0; - max-width: 50px - } - - vn-th[field="nickname"], - vn-td[name="nickname"] { - min-width: 250px - } - - vn-td.icon-field > vn-icon { - margin-left: 3px; - margin-right: 3px; - } - - vn-table.scrollable.lg { - height: 736px - } - - tbody tr[ng-repeat]:focus { - background-color: $color-primary-light - } - - .highRisk i { - color: $color-alert - } - - td[name="nickname"] { - max-width: 200px - } - - td[name="zone"] { - max-width: 150px - } -} \ No newline at end of file diff --git a/modules/monitor/front/locale/es.yml b/modules/monitor/front/locale/es.yml deleted file mode 100644 index 7d7e72f6b..000000000 --- a/modules/monitor/front/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Sales monitor: Monitor de ventas \ No newline at end of file diff --git a/modules/monitor/front/main/index.html b/modules/monitor/front/main/index.html index 6e04f06d0..e69de29bb 100644 --- a/modules/monitor/front/main/index.html +++ b/modules/monitor/front/main/index.html @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/monitor/front/main/index.js b/modules/monitor/front/main/index.js index 42fc159d5..3af5292cb 100644 --- a/modules/monitor/front/main/index.js +++ b/modules/monitor/front/main/index.js @@ -1,7 +1,16 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; -export default class Monitor extends ModuleMain {} +export default class Monitor extends ModuleMain { + constructor($element, $) { + super($element, $); + } + + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`monitor/`); + } +} ngModule.vnComponent('vnMonitor', { controller: Monitor, diff --git a/modules/monitor/front/routes.json b/modules/monitor/front/routes.json index acad3ecbc..30da8bcac 100644 --- a/modules/monitor/front/routes.json +++ b/modules/monitor/front/routes.json @@ -1,13 +1,9 @@ { "module": "monitor", "name": "Monitors", - "icon" : "grid_view", - "dependencies": ["ticket", "worker", "client"], - "validations" : true, + "icon": "grid_view", "menus": { - "main": [ - {"state": "monitor.index", "icon": "grid_view"} - ], + "main": [], "card": [] }, "keybindings": [ @@ -23,7 +19,7 @@ "abstract": true, "component": "vn-monitor", "description": "Monitors" - }, + }, { "url": "/index?q", "state": "monitor.index",