+
+
\ No newline at end of file
diff --git a/modules/monitor/front/index/orders/index.js b/modules/monitor/front/index/orders/index.js
index 0a4c8c04f..8b9489a9d 100644
--- a/modules/monitor/front/index/orders/index.js
+++ b/modules/monitor/front/index/orders/index.js
@@ -2,7 +2,31 @@ 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());
+ }
+}
+
ngModule.vnComponent('vnMonitorSalesOrders', {
template: require('./index.html'),
- controller: Section
+ controller: Controller
});
diff --git a/modules/monitor/front/index/orders/index.spec.js b/modules/monitor/front/index/orders/index.spec.js
new file mode 100644
index 000000000..109925358
--- /dev/null
+++ b/modules/monitor/front/index/orders/index.spec.js
@@ -0,0 +1,50 @@
+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
index 5f80472fe..f4d56010c 100644
--- a/modules/monitor/front/index/orders/style.scss
+++ b/modules/monitor/front/index/orders/style.scss
@@ -1,16 +1,18 @@
@import "variables";
vn-monitor-sales-orders {
- .dark-row {
- background-color: lighten($color-marginal, 15%);
- color: gray;
-
- vn-td {
- border-bottom: 2px solid $color-marginal
+ vn-table.scrollable {
+ height: 350px
+ }
+
+ vn-table a.vn-tbody {
+ & > vn-tr:nth-child(2) {
+ color: gray;
+
+ & > vn-td {
+ border-bottom: 2px solid $color-marginal;
+ font-size: 13px;
+ }
}
}
-
- vn-tbody vn-tr:nth-child(3) {
- height: inherit
- }
}
\ No newline at end of file
diff --git a/modules/monitor/front/index/style.scss b/modules/monitor/front/index/style.scss
index 4e0d9df2f..c020f60c7 100644
--- a/modules/monitor/front/index/style.scss
+++ b/modules/monitor/front/index/style.scss
@@ -17,4 +17,40 @@ vn-monitor-index {
color: $color-font-secondary;
text-align: center;
}
+
+ vn-vertical {
+ position: fixed;
+ width: 400px
+ }
+
+ vn-horizontal {
+ flex-wrap: wrap
+ }
+}
+
+@media (max-width:1500px) {
+ vn-monitor-index {
+ & > vn-horizontal {
+ flex-direction: column-reverse;
+ }
+
+ & > vn-horizontal > vn-one {
+ flex: none;
+ width: 100%;
+
+ & > vn-vertical {
+ position: initial;
+ flex-direction: row;
+ width: 100%;
+
+ vn-monitor-sales-clients {
+ margin-right: 15px
+ }
+
+ vn-table.scrollable {
+ height: 300px
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html
index 8fc3e09d9..e410be4e5 100644
--- a/modules/monitor/front/index/tickets/index.html
+++ b/modules/monitor/front/index/tickets/index.html
@@ -30,7 +30,7 @@
-
+
@@ -49,7 +49,7 @@
+ ui-sref="ticket.card.summary({id: {{::ticket.id}}})" target="_blank">
+ class="vn-pt-xs">