Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-04-18 11:47:41 +02:00
commit 0176fbc2d5
8 changed files with 88 additions and 42 deletions

View File

@ -1211,9 +1211,9 @@ INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`) INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`)
VALUES VALUES
(1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (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)), (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)), (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()); (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`) INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`)
VALUES VALUES

View File

@ -80,6 +80,6 @@
"We weren't able to send this SMS": "No hemos podido enviar el SMS", "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 client can't be invoiced": "Este cliente no puede ser facturado",
"This ticket can't be invoiced": "Este ticket 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" "That item doesn't exists": "That item doesn't exists"
} }

View File

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

View File

@ -50,6 +50,16 @@
model="filter.to"> model="filter.to">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </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-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit> <vn-submit label="Search"></vn-submit>
</vn-horizontal> </vn-horizontal>

View File

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

View File

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

View File

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

View File

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