2708 - Extra community changes #503

Merged
carlosjr merged 11 commits from 2708-travel_extracommunity into dev 2021-01-19 14:13:13 +00:00
8 changed files with 100 additions and 24 deletions
Showing only changes of commit 56925be41f - Show all commits

View File

@ -172,8 +172,8 @@ module.exports = Self => {
e.notes, e.notes,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg, CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
FROM entry e FROM tmp.travel tr
JOIN tmp.travel tr ON tr.id = e.travelFk JOIN entry e ON e.travelFk = tr.id
JOIN buy b ON b.entryFk = e.id JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk

View File

@ -37,6 +37,9 @@
"m3": { "m3": {
"type": "Number" "type": "Number"
}, },
"kg": {
"type": "Number"
},
"cargoSupplierFk": { "cargoSupplierFk": {
"type": "Number" "type": "Number"
}, },

View File

@ -39,24 +39,28 @@
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Shipped from" label="Shipped from"
ng-model="filter.shippedFrom"> ng-model="filter.shippedFrom"
on-change="$ctrl.shippedFrom = value">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Shipped to" label="Shipped to"
ng-model="filter.shippedTo"> ng-model="filter.shippedTo"
on-change="$ctrl.shippedTo = value">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Landed from" label="Landed from"
ng-model="filter.landedFrom"> ng-model="filter.landedFrom"
on-change="$ctrl.landedFrom = value">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Landed to" label="Landed to"
ng-model="filter.landedTo"> ng-model="filter.landedTo"
on-change="$ctrl.landedTo = value">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -1,7 +1,59 @@
import ngModule from '../module'; import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel'; import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel {
constructor($, $element) {
super($, $element);
this.filter = this.$.filter;
}
get shippedFrom() {
return this._shippedFrom;
}
set shippedFrom(value) {
this._shippedFrom = value;
if (!this.filter.shippedTo)
this.filter.shippedTo = value;
}
get shippedTo() {
return this._shippedTo;
}
set shippedTo(value) {
this._shippedTo = value;
if (!this.filter.shippedFrom)
this.filter.shippedFrom = value;
}
get landedFrom() {
return this._landedFrom;
}
set landedFrom(value) {
this._landedFrom = value;
if (!this.filter.landedTo)
this.filter.landedTo = value;
}
get landedTo() {
return this._landedTo;
}
set landedTo(value) {
this._landedTo = value;
if (!this.filter.landedFrom)
this.filter.landedFrom = value;
}
}
ngModule.vnComponent('vnExtraCommunitySearchPanel', { ngModule.vnComponent('vnExtraCommunitySearchPanel', {
template: require('./index.html'), template: require('./index.html'),
controller: SearchPanel controller: Controller
}); });

View File

@ -17,11 +17,11 @@
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>
<vn-data-viewer model="model" class="travel-list"> <vn-data-viewer model="model" class="travel-list">
<vn-card ng-repeat="travel in travels" class="vn-mb-md"> <vn-card>
joan marked this conversation as resolved Outdated

drag & drop needs fixing

drag & drop needs fixing
<section class="vn-pa-md"> <section class="vn-pa-md">
<vn-table vn-droppable="$ctrl.onDrop($event)" ng-attr-id="{{::travel.id}}"> <vn-table>
<vn-thead> <vn-thead>
<vn-tr ng-if="$index == 0"> <vn-tr>
<vn-th shrink>Id</vn-th> <vn-th shrink>Id</vn-th>
<vn-th expand>Supplier</vn-th> <vn-th expand>Supplier</vn-th>
<vn-th expand>Freighter</vn-th> <vn-th expand>Freighter</vn-th>
@ -30,17 +30,17 @@
<vn-th number>Bl. KG</vn-th> <vn-th number>Bl. KG</vn-th>
<vn-th number>Phy. KG</vn-th> <vn-th number>Phy. KG</vn-th>
<vn-th number>Vol. KG</vn-th> <vn-th number>Vol. KG</vn-th>
<vn-th expand translate-attr="{title: 'Warehouse Out'}">
Wh. Out
</vn-th>
<vn-th expand>Shipped</vn-th>
<vn-th expand translate-attr="{title: 'Warehouse In'}"> <vn-th expand translate-attr="{title: 'Warehouse In'}">
Wh. In Wh. In
</vn-th> </vn-th>
<vn-th expand>Landed</vn-th> <vn-th expand>W. Shipped</vn-th>
<vn-th expand translate-attr="{title: 'Warehouse Out'}">
Wh. Out
</vn-th>
<vn-th expand>W. Landed</vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody ng-repeat="travel in travels" class="vn-mb-md" vn-droppable="$ctrl.onDrop($event)" ng-attr-id="{{::travel.id}}">
<vn-tr class="header"> <vn-tr class="header">
<vn-td> <vn-td>
<span class="link" <span class="link"
@ -55,17 +55,26 @@
<field> <field>
<vn-textfield class="dense" vn-focus <vn-textfield class="dense" vn-focus
ng-model="travel.ref" ng-model="travel.ref"
on-change="$ctrl.changeReference(travel)"> on-change="$ctrl.save(travel.id, {ref: value})">
</vn-textfield> </vn-textfield>
</field> </field>
</vn-td-editable> </vn-td-editable>
<vn-td number>{{::travel.stickers}}</vn-td> <vn-td number>{{::travel.stickers}}</vn-td>
<vn-td number>{{::travel.kg}}</vn-td> <vn-td-editable expand style="text-align: right">
<text number>{{travel.kg}}</text>
<field>
<vn-input-number class="dense" vn-focus
ng-model="travel.kg"
on-change="$ctrl.save(travel.id, {kg: value})"
min="0">
</vn-input-number>
</field>
</vn-td-editable>
<vn-td number>{{::travel.loadedKg}}</vn-td> <vn-td number>{{::travel.loadedKg}}</vn-td>
<vn-td number>{{::travel.volumeKg}}</vn-td> <vn-td number>{{::travel.volumeKg}}</vn-td>
<vn-td expand>{{::travel.warehouseOutName}}</vn-td>
<vn-td expand>{{::travel.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td expand>{{::travel.warehouseInName}}</vn-td> <vn-td expand>{{::travel.warehouseInName}}</vn-td>
<vn-td expand>{{::travel.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td expand>{{::travel.warehouseOutName}}</vn-td>
<vn-td expand>{{::travel.landed | date: 'dd/MM/yyyy'}}</vn-td> <vn-td expand>{{::travel.landed | date: 'dd/MM/yyyy'}}</vn-td>
</vn-tr> </vn-tr>
<a href="#" ng-repeat="entry in travel.entries" class="vn-tr" draggable <a href="#" ng-repeat="entry in travel.entries" class="vn-tr" draggable
@ -80,7 +89,7 @@
<vn-td>{{::entry.supplierName}}</vn-td> <vn-td>{{::entry.supplierName}}</vn-td>
<vn-td></vn-td> <vn-td></vn-td>
<vn-td expand>{{::entry.ref}}</vn-td> <vn-td expand>{{::entry.ref}}</vn-td>
<vn-th number>{{::entry.stickers}}</vn-th> <vn-th number>{{::entry.stickers}} 1123</vn-th>
<vn-td number></vn-td> <vn-td number></vn-td>
<vn-td number>{{::entry.loadedkg}}</vn-td> <vn-td number>{{::entry.loadedkg}}</vn-td>
<vn-td number>{{::entry.volumeKg}}</vn-td> <vn-td number>{{::entry.volumeKg}}</vn-td>

View File

@ -83,6 +83,12 @@ class Controller extends Section {
this.$http.patch(endpoint, params) this.$http.patch(endpoint, params)
.then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
} }
save(id, data) {
const endpoint = `Travels/${id}`;
this.$http.patch(endpoint, data)
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
}
} }
ngModule.vnComponent('vnTravelExtraCommunity', { ngModule.vnComponent('vnTravelExtraCommunity', {

View File

@ -5,4 +5,6 @@ Bl. KG: KG Bloq.
Phy. KG: KG físico Phy. KG: KG físico
Vol. KG: KG Vol. Vol. KG: KG Vol.
Search by travel id or reference: Buscar por id travel o referencia Search by travel id or reference: Buscar por id travel o referencia
Continent Out: Continente salida Continent Out: Continente salida
W. Shipped: F. envío
W. Landed: F. llegada

View File

@ -26,11 +26,11 @@ vn-travel-extra-community {
color: $color-active color: $color-active
} }
vn-td-editable text:after { vn-td-editable:hover text:after {
font-family: 'Material Icons'; font-family: 'Material Icons';
content: 'edit'; content: 'edit';
position: absolute; position: absolute;
margin-left: 5px; right: -15px;
color: $color-spacer color: $color-spacer
} }