feat: add new section
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
434db10ac9
commit
ddbe1057ad
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('ItemShelving', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('ItemShelvingPlacementSupplyStock', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -7,13 +7,17 @@
|
|||
}
|
||||
},
|
||||
"properties": {
|
||||
"itemShelvingFk": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
},
|
||||
"itemFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"concept": {
|
||||
"longName": {
|
||||
"type": "string"
|
||||
},
|
||||
"parking": {
|
||||
|
@ -24,6 +28,9 @@
|
|||
},
|
||||
"packing": {
|
||||
"type": "number"
|
||||
},
|
||||
"stock": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +1,10 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Defaulters/filter"
|
||||
filter="::$ctrl.filter"
|
||||
limit="20"
|
||||
order="amount DESC"
|
||||
data="defaulters"
|
||||
url="ItemShelvingPlacementSupplyStocks"
|
||||
link="{itemFk: $ctrl.$params.id}"
|
||||
data="itemShelvingPlacementSupplyStocks"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
vn-focus
|
||||
placeholder="Search client"
|
||||
info="Search client by id or name"
|
||||
auto-state="false"
|
||||
model="model">
|
||||
</vn-searchbar>
|
||||
</vn-portal>
|
||||
<vn-card>
|
||||
<smart-table
|
||||
model="model"
|
||||
|
@ -34,10 +23,10 @@
|
|||
<div class="vn-pa-md">
|
||||
<vn-button
|
||||
ng-show="$ctrl.checked.length > 0"
|
||||
ng-click="notesDialog.show()"
|
||||
name="notesDialog"
|
||||
vn-tooltip="Add observation"
|
||||
icon="icon-notes">
|
||||
ng-click="removeConfirm.show()"
|
||||
vn-tooltip="Remove selected lines"
|
||||
vn-acl="replenisherBos"
|
||||
icon="delete">
|
||||
</vn-button>
|
||||
</div>
|
||||
</slot-actions>
|
||||
|
@ -50,123 +39,78 @@
|
|||
model="model">
|
||||
</vn-multi-check>
|
||||
</th>
|
||||
<th field="clientFk">
|
||||
<th field="created">
|
||||
<span translate>Created</span>
|
||||
</th>
|
||||
<th field="salesPersonFk">
|
||||
<th shrink field="itemFk">
|
||||
<span translate>Item</span>
|
||||
</th>
|
||||
<th
|
||||
field="amount"
|
||||
vn-tooltip="Balance due">
|
||||
field="longName">
|
||||
<span translate>Concept</span>
|
||||
</th>
|
||||
<th
|
||||
field="workerFk"
|
||||
vn-tooltip="Worker who made the last observation">
|
||||
field="parking">
|
||||
<span translate>Parking</span>
|
||||
</th>
|
||||
<th field="observation" expand>
|
||||
<th field="shelving">
|
||||
<span translate>Shelving</span>
|
||||
</th>
|
||||
<th
|
||||
vn-tooltip="Last observation date"
|
||||
field="created">
|
||||
field="label">
|
||||
<span translate>Etiqueta</span>
|
||||
</th>
|
||||
<th
|
||||
field="creditInsurance"
|
||||
field="packing"
|
||||
shrink>
|
||||
<span translate>Packing</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="defaulter in defaulters">
|
||||
<tr ng-repeat="itemShelvingPlacementSupplyStock in itemShelvingPlacementSupplyStocks">
|
||||
<td shrink>
|
||||
<vn-check
|
||||
ng-model="defaulter.checked"
|
||||
ng-model="itemShelvingPlacementSupplyStock.checked"
|
||||
vn-click-stop>
|
||||
</vn-check>
|
||||
</td>
|
||||
<td title="{{::defaulter.clientName}}">
|
||||
<td shrink-date>{{::itemShelvingPlacementSupplyStock.created | date: 'dd/MM/yyyy'}}</td>
|
||||
<td>
|
||||
{{::itemShelvingPlacementSupplyStock.itemFk}}
|
||||
</td>
|
||||
<td expand title="{{::itemShelvingPlacementSupplyStock.longName}}">
|
||||
<span
|
||||
vn-click-stop="clientDescriptor.show($event, defaulter.clientFk)"
|
||||
title ="{{::defaulter.clientName}}"
|
||||
vn-click-stop="itemDescriptor.show($event, itemShelvingPlacementSupplyStock.itemFk)"
|
||||
class="link">
|
||||
{{::defaulter.clientName}}
|
||||
{{itemShelvingPlacementSupplyStock.longName}}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span
|
||||
title="{{::defaulter.salesPersonName}}"
|
||||
vn-click-stop="workerDescriptor.show($event, defaulter.salesPersonFk)"
|
||||
class="link">
|
||||
{{::defaulter.salesPersonName | dashIfEmpty}}
|
||||
</span>
|
||||
{{::itemShelvingPlacementSupplyStock.parking}}
|
||||
</td>
|
||||
<td>{{::defaulter.amount | currency: 'EUR': 2}}</td>
|
||||
<td>
|
||||
<span
|
||||
title="{{::defaulter.workerName}}"
|
||||
vn-click-stop="workerDescriptor.show($event, defaulter.workerFk)"
|
||||
class="link">
|
||||
{{::defaulter.workerName | dashIfEmpty}}
|
||||
</span>
|
||||
{{::itemShelvingPlacementSupplyStock.shelving}}
|
||||
</td>
|
||||
<td expand>
|
||||
<vn-textarea
|
||||
vn-three
|
||||
disabled="true"
|
||||
ng-model="defaulter.observation">
|
||||
</vn-textarea>
|
||||
<td>
|
||||
{{::itemShelvingPlacementSupplyStock.label}}
|
||||
</td>
|
||||
<td shrink-date>
|
||||
<span class="chip {{::$ctrl.chipColor(defaulter.created)}}">
|
||||
{{::defaulter.created | date: 'dd/MM/yyyy'}}
|
||||
</span>
|
||||
<td>
|
||||
{{::itemShelvingPlacementSupplyStock.packing}}
|
||||
</td>
|
||||
<td shrink>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
|
||||
<td shrink-date>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</slot-table>
|
||||
</smart-table>
|
||||
</vn-card>
|
||||
<vn-client-descriptor-popover
|
||||
vn-id="client-descriptor">
|
||||
</vn-client-descriptor-popover>
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="worker-descriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-popup vn-id="dialog-summary-client">
|
||||
<vn-client-summary
|
||||
client="$ctrl.clientSelected">
|
||||
</vn-client-summary>
|
||||
</vn-popup>
|
||||
<vn-item-descriptor-popover
|
||||
vn-id="item-descriptor">
|
||||
</vn-item-descriptor-popover>
|
||||
|
||||
<!-- Dialog of add notes button -->
|
||||
<vn-dialog
|
||||
vn-id="notesDialog"
|
||||
on-accept="$ctrl.onResponse()">
|
||||
<tpl-body>
|
||||
<section class="SMSDialog">
|
||||
<h5 class="vn-py-sm">{{$ctrl.$t('Add observation to all selected clients', {total: $ctrl.checked.length})}}</h5>
|
||||
<vn-horizontal>
|
||||
<vn-textarea vn-one
|
||||
vn-id="message"
|
||||
label="Message"
|
||||
ng-model="$ctrl.defaulter.observation"
|
||||
rows="3"
|
||||
required="true"
|
||||
rule>
|
||||
</vn-textarea>
|
||||
</vn-horizontal>
|
||||
</section>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Save</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
<vn-confirm
|
||||
vn-id="removeConfirm"
|
||||
message="Selected lines will be deleted"
|
||||
question="Are you sure you want to continue?"
|
||||
on-accept="$ctrl.onRemove()">
|
||||
</vn-confirm>
|
|
@ -1,11 +1,9 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import UserError from 'core/lib/user-error';
|
||||
|
||||
export default class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.defaulter = {};
|
||||
|
||||
this.smartTableOptions = {
|
||||
activeButtons: {
|
||||
|
@ -13,42 +11,31 @@ export default class Controller extends Section {
|
|||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'clientFk',
|
||||
field: 'parking',
|
||||
autocomplete: {
|
||||
url: 'Clients',
|
||||
showField: 'name',
|
||||
valueField: 'id'
|
||||
url: 'Parkings',
|
||||
showField: 'code',
|
||||
valueField: 'code'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'salesPersonFk',
|
||||
field: 'shelving',
|
||||
autocomplete: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
where: `{role: 'salesPerson'}`,
|
||||
searchFunction: '{firstName: $search}',
|
||||
showField: 'name',
|
||||
valueField: 'id',
|
||||
url: 'Shelvings',
|
||||
showField: 'code',
|
||||
valueField: 'code'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'workerFk',
|
||||
autocomplete: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
searchFunction: '{firstName: $search}',
|
||||
showField: 'name',
|
||||
valueField: 'id',
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'observation',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
field: 'created',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
field: 'defaulterSinced',
|
||||
field: 'itemFk',
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
field: 'longName',
|
||||
searchable: false
|
||||
}
|
||||
]
|
||||
|
@ -58,16 +45,24 @@ export default class Controller extends Section {
|
|||
}
|
||||
|
||||
get checked() {
|
||||
const clients = this.$.model.data || [];
|
||||
const itemShelvings = this.$.model.data || [];
|
||||
const checkedLines = [];
|
||||
for (let defaulter of clients) {
|
||||
if (defaulter.checked)
|
||||
checkedLines.push(defaulter);
|
||||
for (let itemShelving of itemShelvings) {
|
||||
if (itemShelving.checked)
|
||||
checkedLines.push(itemShelving);
|
||||
}
|
||||
|
||||
return checkedLines;
|
||||
}
|
||||
|
||||
get label() {
|
||||
const itemShelvings = this.$.model.data || [];
|
||||
for (let itemShelving of itemShelvings)
|
||||
itemShelving.label = itemShelving.stock / itemShelving.packing;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
getBalanceDueTotal() {
|
||||
this.$http.get('Defaulters/filter')
|
||||
.then(res => {
|
||||
|
@ -80,48 +75,27 @@ export default class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
chipColor(date) {
|
||||
const day = 24 * 60 * 60 * 1000;
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
const observationShipped = new Date(date);
|
||||
observationShipped.setHours(0, 0, 0, 0);
|
||||
|
||||
const difference = today - observationShipped;
|
||||
|
||||
if (difference > (day * 20))
|
||||
return 'alert';
|
||||
if (difference > (day * 10))
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
onResponse() {
|
||||
if (!this.defaulter.observation)
|
||||
throw new UserError(`The message can't be empty`);
|
||||
|
||||
async onRemove() {
|
||||
const params = [];
|
||||
for (let defaulter of this.checked) {
|
||||
params.push({
|
||||
text: this.defaulter.observation,
|
||||
clientFk: defaulter.clientFk
|
||||
});
|
||||
}
|
||||
for (let itemShelving of this.checked)
|
||||
params.push(itemShelving.itemShelvingFk);
|
||||
|
||||
this.$http.post(`ClientObservations`, params) .then(() => {
|
||||
this.vnApp.showMessage(this.$t('Observation saved!'));
|
||||
this.$state.reload();
|
||||
});
|
||||
for (let id of params) {
|
||||
await this.$http.delete(`ItemShelvings/${id}`)
|
||||
.then(() => {
|
||||
this.vnApp.showSuccess(this.$t('ItemShelving removed'));
|
||||
this.$state.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'creditInsurance':
|
||||
case 'amount':
|
||||
case 'clientFk':
|
||||
case 'workerFk':
|
||||
case 'salesPersonFk':
|
||||
return {[`d.${param}`]: value};
|
||||
case 'parking':
|
||||
case 'shelving':
|
||||
case 'label':
|
||||
case 'packing':
|
||||
return {[param]: value};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
Add observation: Añadir observación
|
||||
Add observation to all selected clients: Añadir observación a {{total}} cliente(s) seleccionado(s)
|
||||
Balance D.: Saldo V.
|
||||
Credit I.: Crédito A.
|
||||
Last observation: Última observación
|
||||
L. O. Date: Fecha Ú. O.
|
||||
Last observation date: Fecha última observación
|
||||
Search client: Buscar clientes
|
||||
Worker who made the last observation: Trabajador que ha realizado la última observación
|
||||
Shelving: Matrícula
|
||||
Remove selected lines: Eliminar líneas seleccionadas
|
||||
Selected lines will be deleted: Las líneas seleccionadas serán eliminadas
|
Loading…
Reference in New Issue