refs #5206 version with plane added, needs to implement general search
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-03-02 13:55:47 +01:00
parent be1993cf8b
commit dbe42e3bf4
8 changed files with 82 additions and 70 deletions

View File

@ -26,7 +26,7 @@ Value should have at most %s characters: El valor debe tener un máximo de %s ca
Enter a new search: Introduce una nueva búsqueda
No results: Sin resultados
Ups! It seems there was an error: ¡Vaya! Parece que ha habido un error
General search: Busqueda general
General search: Búsqueda general
January: Enero
February: Febrero
March: Marzo
@ -42,9 +42,9 @@ December: Diciembre
Monday: Lunes
Tuesday: Martes
Wednesday: Miércoles
Thursday: Jueves
Friday: Viernes
Saturday: Sábado
Thursday: Jueves
Friday: Viernes
Saturday: Sábado
Sunday: Domingo
Has delivery: Hay reparto
Loading: Cargando
@ -63,4 +63,4 @@ Loading...: Cargando...
No results found: Sin resultados
No data: Sin datos
Undo changes: Deshacer cambios
Load more results: Cargar más resultados
Load more results: Cargar más resultados

View File

@ -5,6 +5,13 @@
<vn-travel-search-panel
model="model">
</vn-travel-search-panel>
<vn-crud-model
vn-id="model"
url="Travels/filter"
limit="20"
order="shipped DESC, landed DESC"
auto-load="true">
</vn-crud-model>
<vn-data-viewer
model="model"
class="vn-mb-xl vn-w-xl">
@ -16,10 +23,10 @@
<vn-th field="agencyModeFk">Agency</vn-th>
<vn-th field="warehouseOutFk">Warehouse Out</vn-th>
<vn-th field="shipped" center shrink-date>Shipped</vn-th>
<vn-th field="isDelivered" center>Delivered</vn-th>
<vn-th shrink></vn-th>
<vn-th field="warehouseInFk">Warehouse In</vn-th>
<vn-th field="landed" center shrink-date>Landed</vn-th>
<vn-th field="isReceived" center>Received</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
@ -35,14 +42,26 @@
{{::travel.shipped | date:'dd/MM/yyyy'}}
</span>
</vn-td>
<vn-td center><vn-check ng-model="travel.isDelivered" disabled="true"></vn-check></vn-td>
<vn-td shrink>
<vn-icon
icon="flight_takeoff"
translate-attr="{title: 'Delivered'}"
ng-class="{active: travel.isDelivered}">
</vn-icon>
</vn-td>
<vn-td expand>{{::travel.warehouseInName}}</vn-td>
<vn-td center shrink-date>
<span class="chip {{$ctrl.compareDate(travel.landed)}}">
{{::travel.landed | date:'dd/MM/yyyy'}}
</span>
</vn-td>
<vn-td center><vn-check ng-model="travel.isReceived" disabled="true"></vn-check></vn-td>
<vn-td shrink>
<vn-icon
icon="flight_land"
translate-attr="{title: 'Received'}"
ng-class="{active: travel.isReceived}">
</vn-icon>
</vn-td>
<vn-td shrink>
<vn-horizontal class="buttons">
<vn-icon-button

View File

@ -1,5 +1,6 @@
import ngModule from '../module';
import Section from 'salix/components/section';
import './style.scss';
export default class Controller extends Section {
preview(travel) {

View File

@ -0,0 +1,11 @@
@import "variables";
vn-travel-index {
vn-icon {
color: $color-font-secondary
}
vn-icon.active {
color: $color-success
}
}

View File

@ -1,17 +1,4 @@
<vn-crud-model
vn-id="model"
url="Travels/filter"
limit="20"
order="shipped DESC, landed DESC">
</vn-crud-model>
<vn-portal slot="topbar">
<vn-searchbar
vn-focus
info="Search travels by id"
model="model"
fetch-params="$ctrl.fetchParams($params)"
suggested-filter="$ctrl.filterParams">
</vn-searchbar>
</vn-portal>
<vn-portal slot="menu">
<vn-left-menu></vn-left-menu>

View File

@ -4,28 +4,6 @@ import ModuleMain from 'salix/components/module-main';
export default class Travel extends ModuleMain {
constructor() {
super();
this.filterParams = {
scopeDays: 1
};
}
fetchParams($params) {
if (!Object.entries($params).length)
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
const shippedFrom = Date.vnNew();
shippedFrom.setHours(0, 0, 0, 0);
const shippedTo = new Date(shippedFrom.getTime());
shippedTo.setDate(shippedTo.getDate() + $params.scopeDays);
shippedTo.setHours(23, 59, 59, 999);
Object.assign($params, {shippedFrom, shippedTo});
}
return $params;
}
}

View File

@ -1,23 +1,18 @@
<vn-side-menu side="right">
<vn-horizontal class="input">
<vn-textfield
label="Reference"
ng-model="$ctrl.filter.ref"
ng-change="$ctrl.addFilters()">
label="General search"
info="Search travels by id"
ng-model="$ctrl.search"
ng-keydown="$ctrl.onKeyPress($event, 'search')">
</vn-textfield>
</vn-horizontal>
<vn-horizontal class="input horizontal">
<vn-input-number
min="0"
label="Total entries"
ng-model="$ctrl.filter.totalEntries"
ng-change="$ctrl.addFilters()">
</vn-input-number>
<vn-input-number
min="0"
label="Travel id"
ng-model="$ctrl.filter.id"
ng-change="$ctrl.addFilters()">
ng-model="$ctrl.totalEntries"
ng-keydown="$ctrl.onKeyPress($event, 'totalEntries')">
</vn-input-number>
</vn-horizontal>
<vn-horizontal class="input horizontal">
@ -61,12 +56,9 @@
label="Days onward"
ng-model="$ctrl.filter.scopeDays"
on-change="$ctrl.changeScopeDays()"
display-controls="true">
display-controls="true"
info="Cannot choose a range of dates and days onward at the same time">
</vn-input-number>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</div>
</vn-vertical>
<vn-horizontal class="input horizontal">
@ -103,11 +95,11 @@
</vn-horizontal>
<div class="chips">
<vn-chip
ng-if="$ctrl.filter.ref"
ng-if="$ctrl.filter.search"
removable="true"
on-remove="$ctrl.removeParamFilter('ref')"
on-remove="$ctrl.removeParamFilter('search')"
class="colored">
<span>{{$ctrl.$t('Reference')}}: {{$ctrl.filter.ref}}</span>
<span>Id/{{$ctrl.$t('Reference')}}: {{$ctrl.filter.search}}</span>
</vn-chip>
<vn-chip
ng-if="$ctrl.filter.totalEntries"
@ -116,13 +108,6 @@
class="colored">
<span>{{$ctrl.$t('Total entries')}}: {{$ctrl.filter.totalEntries}}</span>
</vn-chip>
<vn-chip
ng-if="$ctrl.filter.id"
removable="true"
on-remove="$ctrl.removeParamFilter('id')"
class="colored">
<span>{{$ctrl.$t('Travel id')}}: {{$ctrl.filter.id}}</span>
</vn-chip>
<vn-chip
ng-if="agency.selection"
removable="true"

View File

@ -5,6 +5,28 @@ import './style.scss';
class Controller extends SearchPanel {
constructor($, $element) {
super($, $element);
this.filter = {};
this.filterParams = {
scopeDays: 1
};
}
fetchParams($params) {
if (!Object.entries($params).length)
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
const shippedFrom = Date.vnNew();
shippedFrom.setHours(0, 0, 0, 0);
const shippedTo = new Date(shippedFrom.getTime());
shippedTo.setDate(shippedTo.getDate() + $params.scopeDays);
shippedTo.setHours(23, 59, 59, 999);
Object.assign($params, {shippedFrom, shippedTo});
}
return $params;
}
changeShipped() {
@ -23,9 +45,18 @@ class Controller extends SearchPanel {
}
removeParamFilter(param) {
if (this[param]) this[param] = null;
this.filter[param] = null;
this.addFilters();
}
onKeyPress($event, param) {
console.log('event');
if ($event.key === 'Enter') {
this.filter[param] = this[param];
this.addFilters();
}
}
}
ngModule.vnComponent('vnTravelSearchPanel', {