feat(last-entries): add dateTo & delete style.scss
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2021-10-15 10:34:32 +02:00
parent d06385fc73
commit 6d05b046e8
3 changed files with 46 additions and 41 deletions

View File

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

View File

@ -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) {

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