From 6d05b046e8289c0dbe7c9695b59a5f2b229154a4 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 15 Oct 2021 10:34:32 +0200 Subject: [PATCH] feat(last-entries): add dateTo & delete style.scss --- modules/item/front/last-entries/index.html | 23 +++++++++---- modules/item/front/last-entries/index.js | 40 ++++++++++++++++------ modules/item/front/last-entries/style.scss | 24 ------------- 3 files changed, 46 insertions(+), 41 deletions(-) delete mode 100644 modules/item/front/last-entries/style.scss diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 820085654..af7bbd751 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -7,17 +7,26 @@ order="landed DESC, buyFk DESC" limit="20"> - - - + + + + + + + + + + class="vn-mb-xl vn-w-xl vn-pa-md"> diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js index d6a2a9913..a92ec4858 100644 --- a/modules/item/front/last-entries/index.js +++ b/modules/item/front/last-entries/index.js @@ -1,17 +1,16 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -import './style.scss'; class Controller extends Section { constructor($element, $) { super($element, $); const from = new Date(); - from.setDate(from.getDate() - 75); + from.setDate(from.getDate()); from.setHours(0, 0, 0, 0); const to = new Date(); - to.setDate(to.getDate() + 60); + to.setDate(to.getDate() + 10); to.setHours(23, 59, 59, 59); this.filter = { @@ -22,19 +21,19 @@ class Controller extends Section { } } }; - this._date = from; + this._dateFrom = from; + this._dateTo = to; } - set date(value) { - this._date = value; + set dateFrom(value) { + this._dateFrom = value; if (!value) return; const from = new Date(value); from.setHours(0, 0, 0, 0); - const to = new Date(); - to.setDate(to.getDate() + 60); + const to = new Date(this._dateTo); to.setHours(23, 59, 59, 59); this.filter.where.shipped = { @@ -43,8 +42,29 @@ class Controller extends Section { this.$.model.refresh(); } - get date() { - return this._date; + set dateTo(value) { + this._dateTo = value; + + if (!value) return; + + const from = new Date(this._dateFrom); + from.setHours(0, 0, 0, 0); + + const to = new Date(value); + to.setHours(23, 59, 59, 59); + + this.filter.where.shipped = { + between: [from, to] + }; + this.$.model.refresh(); + } + + get dateFrom() { + return this._dateFrom; + } + + get dateTo() { + return this._dateTo; } exprBuilder(param, value) { diff --git a/modules/item/front/last-entries/style.scss b/modules/item/front/last-entries/style.scss deleted file mode 100644 index 6188daabc..000000000 --- a/modules/item/front/last-entries/style.scss +++ /dev/null @@ -1,24 +0,0 @@ -@import "variables"; - -vn-item-last-entries { - .round { - background-color: $color-spacer; - border-radius: 25px; - float: right; - width: 25px; - color: $color-font-dark; - text-align: center; - font-weight: bold; - } - vn-horizontal { - justify-content: center; - } - vn-date-picker { - flex: none !important; - } - @media screen and (max-width: 1440px) { - .expendable { - display: none; - } - } -}