#1346 fix confirm.js and update item request
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-04-18 11:02:28 +02:00
parent 7595905c5e
commit bc005b2310
8 changed files with 88 additions and 42 deletions

View File

@ -1210,10 +1210,10 @@ INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`)
VALUES
(1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2, 'Melee weapon combat fist 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(4, 'Melee weapon combat fist 15cm', 18, 35, 15, 2, 1.30, NULL, NULL, 11, CURDATE());
(1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, 4, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, CURDATE());
INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`)
VALUES

View File

@ -80,6 +80,6 @@
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
"This client can't be invoiced": "Este cliente no puede ser facturado",
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
"That item is not available on that day": "That item is not available on that day",
"That item is not available on that day": "El item no esta disponible para esa fecha",
"That item doesn't exists": "That item doesn't exists"
}

View File

@ -45,6 +45,8 @@ stems: Tallos
Compression: Compresión
Density: Densidad
Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras
SalesPerson: Comercial
Concept: Concepto
# Sections
Items: Artículos

View File

@ -50,6 +50,16 @@
model="filter.to">
</vn-date-picker>
</vn-horizontal>
<vn-horizontal>
<vn-one>
</vn-one>
<vn-check
vn-one
triple-state="true"
label="Confirmed"
field="filter.isOk">
</vn-check>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>

View File

@ -1,6 +1,6 @@
<vn-crud-model
vn-id="model"
url="/api/TicketRequests/filter"
url="/ticket/api/TicketRequests/filter"
limit="20"
data="requests"
auto-load="false">
@ -17,7 +17,7 @@
</vn-searchbar>
</vn-horizontal>
</vn-card>
<vn-card margin-medium-v pad-medium>
<vn-card margin-medium-v>
<vn-table model="model" auto-load="false">
<vn-thead>
<vn-tr>
@ -29,9 +29,9 @@
<vn-th field="quantity" number editable>Quantity</vn-th>
<vn-th field="price" number>Price</vn-th>
<vn-th field="atenderNickname">Atender</vn-th>
<vn-th field="itemFk">itemFk</vn-th>
<vn-th field="itemFk">Item</vn-th>
<vn-th field="description">Concept</vn-th>
<vn-th field="">Quantity</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>State</vn-th>
</vn-tr>
</vn-thead>
@ -43,15 +43,36 @@
{{request.ticketFk}}
</span>
</vn-td>
<vn-td class="{{$ctrl.compareDate(request.shipped)}}">
{{::request.shipped | dateTime: 'dd/MM/yyyy'}}
<vn-td>
<span title="{{::request.shipped | dateTime: 'dd/MM/yyyy'}}"
class="chip {{$ctrl.compareDate(request.shipped)}}">
{{::request.shipped | dateTime: 'dd/MM/yyyy'}}
</span>
</vn-td>
<vn-td>{{::request.warehouse}}</vn-td>
<vn-td>{{::request.salesPersonNickname}}</vn-td>
<vn-td>{{::request.description}}</vn-td>
<vn-td>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.salesPersonUserFk)">
{{::request.salesPersonNickname}}
</span>
</vn-td>
<vn-td>
<span
class="link"
ng-click="$ctrl.showItemDescriptor($event, request.itemFk)">
{{::request.description}}
</span>
</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price}}</vn-td>
<vn-td>{{::request.atenderNickname}}</vn-td>
<vn-td number>{{::request.price | currency: 'EUR':2}}</vn-td>
<vn-td>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, request.atenderUserFk)">
{{::request.atenderNickname}}
</span>
</vn-td>
<vn-td-editable number>
<text>{{request.itemFk}}</text>
<field>
@ -88,10 +109,15 @@
<vn-pagination model="model"></vn-pagination>
</div>
</form>
<vn-client-descriptor-popover vn-id="clientDescriptor"></vn-client-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
</vn-item-descriptor-popover>
<vn-dialog
vn-id="denyReason"
class="modal-form">

View File

@ -2,11 +2,11 @@ import ngModule from '../module';
import './style.scss';
export default class Controller {
constructor($scope, vnApp, $translate, $http, $state, $stateParams) {
constructor($, vnApp, $translate, $http, $state, $stateParams) {
this.$state = $state;
this.$stateParams = $stateParams;
this.$http = $http;
this.$scope = $scope;
this.$ = $;
this.vnApp = vnApp;
this._ = $translate;
if (!$stateParams.q)
@ -39,7 +39,7 @@ export default class Controller {
this.$http.post(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
}).catch( e => {
this.$scope.model.refresh();
this.$.model.refresh();
throw e;
});
}
@ -56,7 +56,7 @@ export default class Controller {
this.$http.patch(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
}).catch( e => {
this.$scope.model.refresh();
this.$.model.refresh();
throw e;
});
}
@ -78,15 +78,15 @@ export default class Controller {
onSearch(params) {
if (params)
this.$scope.model.applyFilter(null, params);
this.$.model.applyFilter(null, params);
else
this.$scope.model.clear();
this.$.model.clear();
}
showDenyReason(event, requestId) {
this.denyRequestId = requestId;
this.$scope.denyReason.parent = event.target;
this.$scope.denyReason.show();
this.$.denyReason.parent = event.target;
this.$.denyReason.show();
}
clear() {
@ -102,35 +102,38 @@ export default class Controller {
this.$http.post(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
this.$scope.model.refresh();
this.$scope.denyReason.hide();
this.$.model.refresh();
this.$.denyReason.hide();
this.denyObservation = null;
});
}
showClientDescriptor(event, clientFk) {
this.$scope.clientDescriptor.clientFk = clientFk;
this.$scope.clientDescriptor.parent = event.target;
this.$scope.clientDescriptor.show();
showTicketDescriptor(event, ticketFk) {
this.$.ticketDescriptor.ticketFk = ticketFk;
this.$.ticketDescriptor.parent = event.target;
this.$.ticketDescriptor.show();
event.preventDefault();
event.stopImmediatePropagation();
}
showTicketDescriptor(event, ticketFk) {
this.$scope.ticketDescriptor.ticketFk = ticketFk;
this.$scope.ticketDescriptor.parent = event.target;
this.$scope.ticketDescriptor.show();
event.preventDefault();
event.stopImmediatePropagation();
showItemDescriptor(event, itemFk) {
this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show();
}
showWorkerDescriptor(event, userId) {
this.$.workerDescriptor.userId = userId;
this.$.workerDescriptor.parent = event.target;
this.$.workerDescriptor.show();
}
onDescriptorLoad() {
this.$scope.popover.relocate();
this.$.popover.relocate();
}
preventNavigation(event) {
event.preventDefault();
event.stopImmediatePropagation();
}
}

View File

@ -48,14 +48,13 @@ module.exports = Self => {
let params = [
ctx.args.itemFk,
request.ticket().warehouseFk,
request.ticket().shipped,
request.ticket().warehouseFk,
false
];
console.log(params);
let [res] = await Self.rawSql(query, params);
let available = res[0].available;
if (!available)
throw new UserError(`That item is not available on that day`);

View File

@ -43,6 +43,10 @@ module.exports = Self => {
arg: 'to',
type: 'Date',
description: `Date to`
}, {
arg: 'isOk',
type: 'Boolean',
description: `Search request by request state`
}
],
returns: {
@ -111,7 +115,9 @@ module.exports = Self => {
t.clientFk,
w.name AS warehouse,
u.nickname AS salesPersonNickname,
ua.nickname AS atenderNickname
ua.nickname AS atenderNickname,
u.id AS salesPersonUserFk,
ua.id AS atenderUserFk
FROM ticketRequest tr
LEFT JOIN ticket t ON t.id = tr.ticketFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk