Merge pull request 'feat(last-entries): add dateTo & delete style.scss' (#749) from 3172-item_last-entries into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #749
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-10-18 18:27:30 +00:00
commit 18c9b161e2
3 changed files with 46 additions and 41 deletions

View File

@ -7,17 +7,26 @@
order="landed DESC, buyFk DESC" order="landed DESC, buyFk DESC"
limit="20"> limit="20">
</vn-crud-model> </vn-crud-model>
<vn-card class="vn-mb-md vn-w-xl vn-pa-lg">
<vn-date-picker <vn-card class="vn-w-md vn-pa-md">
vn-none <vn-horizontal>
label="Since" <vn-date-picker class="vn-pa-xs"
ng-model="$ctrl.date"> vn-one
</vn-date-picker> label="Since"
ng-model="$ctrl.dateFrom">
</vn-date-picker>
<vn-date-picker class="vn-pa-xs"
vn-one
label="To"
ng-model="$ctrl.dateTo">
</vn-date-picker>
</vn-horizontal>
</vn-card> </vn-card>
<vn-data-viewer <vn-data-viewer
model="model" model="model"
class="vn-mb-xl vn-w-xl"> class="vn-mb-xl vn-w-xl vn-pa-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-vertical> <vn-vertical>
<vn-table model="model"> <vn-table model="model">

View File

@ -1,17 +1,16 @@
import ngModule from '../module'; import ngModule from '../module';
import Section from 'salix/components/section'; import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section { class Controller extends Section {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
const from = new Date(); const from = new Date();
from.setDate(from.getDate() - 75); from.setDate(from.getDate());
from.setHours(0, 0, 0, 0); from.setHours(0, 0, 0, 0);
const to = new Date(); const to = new Date();
to.setDate(to.getDate() + 60); to.setDate(to.getDate() + 10);
to.setHours(23, 59, 59, 59); to.setHours(23, 59, 59, 59);
this.filter = { this.filter = {
@ -22,19 +21,19 @@ class Controller extends Section {
} }
} }
}; };
this._date = from; this._dateFrom = from;
this._dateTo = to;
} }
set date(value) { set dateFrom(value) {
this._date = value; this._dateFrom = value;
if (!value) return; if (!value) return;
const from = new Date(value); const from = new Date(value);
from.setHours(0, 0, 0, 0); from.setHours(0, 0, 0, 0);
const to = new Date(); const to = new Date(this._dateTo);
to.setDate(to.getDate() + 60);
to.setHours(23, 59, 59, 59); to.setHours(23, 59, 59, 59);
this.filter.where.shipped = { this.filter.where.shipped = {
@ -43,8 +42,29 @@ class Controller extends Section {
this.$.model.refresh(); this.$.model.refresh();
} }
get date() { set dateTo(value) {
return this._date; 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) { exprBuilder(param, value) {

View File

@ -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;
}
}
}