Merge pull request '4770-routes_roadmap2' (!1647) from 4770-routes_roadmap2 into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1647 Reviewed-by: Javi Gallego <jgallego@verdnatura.es> Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
c88a753865
|
@ -1,68 +0,0 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('VnUser addAlias()', () => {
|
||||
const employeeId = 1;
|
||||
const sysadminId = 66;
|
||||
const developerId = 9;
|
||||
const customerId = 2;
|
||||
const mailAlias = 1;
|
||||
it('should throw an error when user not has privileges', async() => {
|
||||
const ctx = {req: {accessToken: {userId: employeeId}}};
|
||||
const tx = await models.VnUser.beginTransaction({});
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
await models.VnUser.addAlias(ctx, employeeId, mailAlias, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toContain(`You don't have grant privilege`);
|
||||
});
|
||||
|
||||
it('should throw an error when user has privileges but not has the role from user', async() => {
|
||||
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||
const tx = await models.VnUser.beginTransaction({});
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
await models.VnUser.addAlias(ctx, employeeId, mailAlias, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`);
|
||||
});
|
||||
|
||||
it('should add an alias', async() => {
|
||||
const ctx = {req: {accessToken: {userId: developerId}}};
|
||||
const tx = await models.VnUser.beginTransaction({});
|
||||
|
||||
let result;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const user = await models.VnUser.findById(developerId, null, options);
|
||||
await user.updateAttribute('hasGrant', true, options);
|
||||
|
||||
result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(result.mailAlias).toBe(mailAlias);
|
||||
expect(result.account).toBe(customerId);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
ALTER TABLE `vn`.`roadmap` COMMENT='Troncales diarios que se contratan';
|
||||
ALTER TABLE `vn`.`roadmap` ADD price decimal(10,2) NULL;
|
||||
ALTER TABLE `vn`.`roadmap` ADD driverName varchar(45) NULL;
|
||||
ALTER TABLE `vn`.`roadmap` ADD name varchar(45) NOT NULL;
|
||||
ALTER TABLE `vn`.`roadmap` CHANGE name name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL AFTER id;
|
||||
ALTER TABLE `vn`.`roadmap` MODIFY COLUMN etd datetime NOT NULL;
|
||||
|
||||
ALTER TABLE `vn`.`expeditionTruck` COMMENT='Distintas paradas que hacen los trocales';
|
||||
ALTER TABLE `vn`.`expeditionTruck` DROP FOREIGN KEY expeditionTruck_FK_2;
|
||||
ALTER TABLE `vn`.`expeditionTruck` ADD CONSTRAINT expeditionTruck_FK_2 FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,6 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'),
|
||||
('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'),
|
||||
('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'),
|
||||
('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'productionBoss');
|
|
@ -2606,9 +2606,18 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`)
|
|||
(3, 6, 5),
|
||||
(4, 7, 1);
|
||||
|
||||
INSERT INTO `vn`.`expeditionTruck` (`id`, `eta`, `description`)
|
||||
INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`)
|
||||
VALUES
|
||||
(1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet');
|
||||
(1, 'val-algemesi', 'RE-001', 'PO-001', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'),
|
||||
(2, 'alg-valencia', 'RE-002', 'PO-002', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'),
|
||||
(3, 'alz-algemesi', 'RE-003', 'PO-003', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman');
|
||||
|
||||
INSERT INTO `vn`.`expeditionTruck` (`id`, `roadmapFk`, `warehouseFk`, `eta`, `description`, `userFk`)
|
||||
VALUES
|
||||
(1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1),
|
||||
(2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1),
|
||||
(3, 1, 3, DATE_ADD(util.VN_NOW(), INTERVAL '1 4' DAY_HOUR), 'Third truck in fleet', 1),
|
||||
(4, 2, 1, DATE_ADD(util.VN_NOW(), INTERVAL 3 DAY), 'Truck red', 1);
|
||||
|
||||
INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`)
|
||||
VALUES
|
||||
|
|
|
@ -23,6 +23,15 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-trailer:before {
|
||||
content: "\e967";
|
||||
}
|
||||
.icon-grafana:before {
|
||||
content: "\e965";
|
||||
}
|
||||
.icon-trolley:before {
|
||||
content: "\e95c";
|
||||
}
|
||||
.icon-agency-term:before {
|
||||
content: "\e950";
|
||||
}
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 173 KiB |
Binary file not shown.
Binary file not shown.
|
@ -8,7 +8,7 @@ vn-client-summary .summary {
|
|||
}
|
||||
|
||||
vn-horizontal h4 .grafana:after {
|
||||
content: 'contact_support';
|
||||
font-size: 17px;
|
||||
font-family: 'salixfont' !important;
|
||||
content: "\e965";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ vn-entry-buy-index vn-card {
|
|||
}
|
||||
|
||||
thead tr {
|
||||
border-left: 1px solid white;
|
||||
border-right: 1px solid white;
|
||||
border: 1px solid white;;
|
||||
}
|
||||
|
||||
tbody tr:nth-child(1),
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('clone', {
|
||||
description: 'Clones the selected routes',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'ids',
|
||||
type: ['number'],
|
||||
required: true,
|
||||
description: 'The routes ids to clone'
|
||||
},
|
||||
{
|
||||
arg: 'etd',
|
||||
type: 'date',
|
||||
required: true,
|
||||
description: 'The estimated time of departure for all roadmaps'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: ['Object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/clone`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.clone = async(ids, etd) => {
|
||||
const tx = await Self.beginTransaction({});
|
||||
try {
|
||||
const models = Self.app.models;
|
||||
const options = {transaction: tx};
|
||||
const originalRoadmaps = await models.Roadmap.find({
|
||||
where: {id: {inq: ids}},
|
||||
fields: [
|
||||
'id',
|
||||
'name',
|
||||
'tractorPlate',
|
||||
'trailerPlate',
|
||||
'phone',
|
||||
'supplierFk',
|
||||
'etd',
|
||||
'observations',
|
||||
'price'],
|
||||
include: [{
|
||||
relation: 'expeditionTruck',
|
||||
scope: {
|
||||
fields: ['roadmapFk', 'warehouseFk', 'eta', 'description']
|
||||
}
|
||||
}]
|
||||
|
||||
}, options);
|
||||
|
||||
if (ids.length != originalRoadmaps.length)
|
||||
throw new UserError(`The amount of roadmaps found don't match`);
|
||||
|
||||
for (const roadmap of originalRoadmaps) {
|
||||
roadmap.id = undefined;
|
||||
roadmap.etd = etd;
|
||||
|
||||
const clone = await models.Roadmap.create(roadmap, options);
|
||||
|
||||
const expeditionTrucks = roadmap.expeditionTruck();
|
||||
expeditionTrucks.map(expeditionTruck => {
|
||||
expeditionTruck.roadmapFk = clone.id;
|
||||
return expeditionTruck;
|
||||
});
|
||||
await models.ExpeditionTruck.create(expeditionTrucks, options);
|
||||
}
|
||||
|
||||
await tx.commit();
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,109 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('AgencyTerm filter()', () => {
|
||||
const authUserId = 9;
|
||||
const today = Date.vnNew();
|
||||
today.setHours(2, 0, 0, 0);
|
||||
|
||||
it('should return all results matching the filter', async() => {
|
||||
const tx = await models.AgencyTerm.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const filter = {};
|
||||
const ctx = {req: {accessToken: {userId: authUserId}}};
|
||||
|
||||
const agencyTerms = await models.AgencyTerm.filter(ctx, filter, options);
|
||||
const firstAgencyTerm = agencyTerms[0];
|
||||
|
||||
expect(firstAgencyTerm.routeFk).toEqual(1);
|
||||
expect(agencyTerms.length).toEqual(5);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return results matching "search" searching by integer', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
search: 1,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return results matching "search" searching by string', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
search: 'Plants SL',
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should return results matching "from" and "to"', async() => {
|
||||
const tx = await models.Buy.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const from = Date.vnNew();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = Date.vnNew();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
const ctx = {
|
||||
args: {
|
||||
from: from,
|
||||
to: to
|
||||
}
|
||||
};
|
||||
|
||||
const results = await models.AgencyTerm.filter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(5);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return results matching "agencyModeFk"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
agencyModeFk: 1,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return results matching "agencyFk"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
agencyFk: 2,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.AgencyTerm.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].routeFk).toEqual(2);
|
||||
});
|
||||
});
|
|
@ -5,18 +5,22 @@
|
|||
"AgencyTermConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Route": {
|
||||
"DeliveryPoint": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Vehicle": {
|
||||
"ExpeditionTruck": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Roadmap": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Route": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"RouteLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"DeliveryPoint": {
|
||||
"Vehicle": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "ExpeditionTruck",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "expeditionTruck"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"roadmapFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"warehouseFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"eta": {
|
||||
"type": "date"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"roadmap": {
|
||||
"type": "belongsTo",
|
||||
"model": "Roadmap",
|
||||
"foreignKey": "roadmapFk"
|
||||
},
|
||||
"warehouse": {
|
||||
"type": "belongsTo",
|
||||
"model": "Warehouse",
|
||||
"foreignKey": "warehouseFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/roadmap/clone')(Self);
|
||||
};
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"name": "Roadmap",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "roadmap"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tractorPlate": {
|
||||
"type": "string"
|
||||
},
|
||||
"trailerPlate": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"supplierFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"etd": {
|
||||
"type": "date"
|
||||
},
|
||||
"observations": {
|
||||
"type": "string"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"price": {
|
||||
"type": "number"
|
||||
},
|
||||
"driverName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
},
|
||||
"supplier": {
|
||||
"type": "belongsTo",
|
||||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"expeditionTruck": {
|
||||
"type": "hasMany",
|
||||
"model": "ExpeditionTruck",
|
||||
"foreignKey": "roadmapFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,3 +16,4 @@ import './agency-term/createInvoiceIn';
|
|||
import './agency-term-search-panel';
|
||||
import './ticket-popup';
|
||||
import './sms';
|
||||
import './roadmap';
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<mg-ajax path="Roadmaps/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.roadmap"
|
||||
form="form"
|
||||
save="patch">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-focus
|
||||
vn-one
|
||||
label="Roadmap"
|
||||
ng-model="$ctrl.roadmap.name"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="ETD date"
|
||||
ng-model="$ctrl.roadmap.etd">
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
label="ETD hour"
|
||||
ng-model="$ctrl.roadmap.etd">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Tractor plate"
|
||||
ng-model="$ctrl.roadmap.tractorPlate"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Trailer plate"
|
||||
ng-model="$ctrl.roadmap.trailerPlate"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.roadmap.supplierFk"
|
||||
url="Suppliers"
|
||||
show-field="nickname"
|
||||
search-function="{or: [{id: $search}, {nickname: {like: '%'+ $search +'%'}}]}"
|
||||
value-field="id"
|
||||
order="nickname"
|
||||
label="Carrier">
|
||||
<tpl-item>
|
||||
{{::id}} - {{::nickname}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
vn-one
|
||||
label="Price"
|
||||
ng-model="$ctrl.roadmap.price"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Driver name"
|
||||
ng-model="$ctrl.roadmap.driverName"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Phone"
|
||||
ng-model="$ctrl.roadmap.phone"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textArea
|
||||
vn-one
|
||||
label="Observations"
|
||||
ng-model="$ctrl.roadmap.observations"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Save">
|
||||
</vn-submit>
|
||||
<vn-button
|
||||
class="cancel"
|
||||
label="Undo changes"
|
||||
disabled="!watcher.dataChanged()"
|
||||
ng-click="watcher.loadOriginalData()">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,16 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller extends Section {
|
||||
onSubmit() {
|
||||
this.$.watcher.submit();
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnRoadmapBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
roadmap: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
<vn-portal slot="menu">
|
||||
<vn-roadmap-descriptor roadmap="$ctrl.roadmap"></vn-roadmap-descriptor>
|
||||
<vn-left-menu source="roadmap"></vn-left-menu>
|
||||
</vn-portal>
|
||||
<ui-view></ui-view>
|
|
@ -0,0 +1,19 @@
|
|||
import ngModule from '../../module';
|
||||
import ModuleCard from 'salix/components/module-card';
|
||||
|
||||
class Controller extends ModuleCard {
|
||||
reload() {
|
||||
const filter = {
|
||||
include: [
|
||||
{relation: 'supplier'}
|
||||
]
|
||||
};
|
||||
this.$http.get(`Roadmaps/${this.$params.id}`, {filter})
|
||||
.then(res => this.roadmap = res.data);
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnRoadmapCard', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,37 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="Roadmaps"
|
||||
data="$ctrl.roadmap"
|
||||
insert-mode="true"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Roadmap"
|
||||
ng-model="$ctrl.roadmap.name"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<vn-date-picker
|
||||
label="ETD date"
|
||||
ng-model="$ctrl.roadmap.etd">
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
label="ETD hour"
|
||||
ng-model="$ctrl.roadmap.etd">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Create">
|
||||
</vn-submit>
|
||||
<vn-button
|
||||
class="cancel"
|
||||
label="Cancel"
|
||||
ui-sref="roadmap.index">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,23 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $, $transclude, vnReport, vnEmail) {
|
||||
super($element, $, $transclude);
|
||||
this.roadmap = {etd: Date.vnNew()};
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
res => this.$state.go('route.roadmap.card.summary', {id: res.data.id})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnRoadmapCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
vn-ticket-request {
|
||||
.vn-textfield {
|
||||
margin: 0!important;
|
||||
max-width: 100px;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<vn-descriptor-content
|
||||
module="route"
|
||||
base-state="route.roadmap"
|
||||
description="$ctrl.roadmap.name">
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="deleteRoadmap.show()"
|
||||
name="deleteRoadmap"
|
||||
translate>
|
||||
Delete roadmap
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value
|
||||
label="Roadmap"
|
||||
value="{{$ctrl.roadmap.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="ETD"
|
||||
value="{{$ctrl.roadmap.etd | date:'dd/MM/yyyy HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Carrier">
|
||||
<span ng-click="supplierDescriptor.show($event, $ctrl.roadmap.supplier.id)" class="link">
|
||||
{{$ctrl.roadmap.supplier.nickname}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
</div>
|
||||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-confirm
|
||||
vn-id="deleteRoadmap"
|
||||
on-accept="$ctrl.onDelete()"
|
||||
question="Are you sure you want to continue?"
|
||||
message="The roadmap will be removed">
|
||||
</vn-confirm>
|
||||
<vn-supplier-descriptor-popover
|
||||
vn-id="supplierDescriptor">
|
||||
</vn-supplier-descriptor-popover>
|
|
@ -0,0 +1,26 @@
|
|||
import ngModule from '../../module';
|
||||
import Descriptor from 'salix/components/descriptor';
|
||||
|
||||
class Controller extends Descriptor {
|
||||
get roadmap() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
set roadmap(value) {
|
||||
this.entity = value;
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
return this.$http.delete(`Roadmaps/${this.roadmap.id}`)
|
||||
.then(() => this.$state.go('route.roadmap'))
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Roadmap removed')));
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnRoadmapDescriptor', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
roadmap: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
Delete roadmap: Eliminar troncal
|
||||
The roadmap will be removed: La troncal será eliminada
|
||||
Roadmap removed: Troncal eliminada
|
|
@ -0,0 +1,9 @@
|
|||
import './main';
|
||||
import './index/';
|
||||
import './summary';
|
||||
import './card';
|
||||
import './descriptor';
|
||||
import './create';
|
||||
import './basic-data';
|
||||
import './search-panel';
|
||||
import './stops';
|
|
@ -0,0 +1,112 @@
|
|||
<vn-auto-search
|
||||
model="model">
|
||||
</vn-auto-search>
|
||||
<vn-data-viewer
|
||||
model="model"
|
||||
class="vn-w-lg">
|
||||
<vn-card class="vn-pa-md vn-w-lg">
|
||||
<vn-tool-bar class="vn-ma-md">
|
||||
<vn-button
|
||||
disabled="$ctrl.totalChecked == 0"
|
||||
ng-click="$ctrl.openClonationDialog()"
|
||||
icon="icon-clone"
|
||||
vn-tooltip="Clone selected roadmaps">
|
||||
</vn-button>
|
||||
<vn-button
|
||||
disabled="$ctrl.totalChecked == 0"
|
||||
ng-click="deleteRoadmaps.show()"
|
||||
vn-tooltip="Delete roadmap(s)"
|
||||
icon="delete">
|
||||
</vn-button>
|
||||
</vn-tool-bar>
|
||||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th shrink>
|
||||
<vn-multi-check
|
||||
model="model">
|
||||
</vn-multi-check>
|
||||
</vn-th>
|
||||
<vn-th field="description">Roadmap</vn-th>
|
||||
<vn-th field="etd" expand date>ETD</vn-th>
|
||||
<vn-th field="supplierFk">Carrier</vn-th>
|
||||
<vn-th field="plate">Plate</vn-th>
|
||||
<vn-th field="price">Price</vn-th>
|
||||
<vn-th field="observations" expand>Observations</vn-th>
|
||||
<vn-th></vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<a ng-repeat="roadmap in model.data"
|
||||
class="clickable vn-tr search-result"
|
||||
ui-sref="route.roadmap.card.summary({id: {{::roadmap.id}}})">
|
||||
<vn-td>
|
||||
<vn-check
|
||||
ng-model="roadmap.checked"
|
||||
vn-click-stop>
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td>{{::roadmap.name}}</vn-td>
|
||||
<vn-td expand date>{{::roadmap.etd | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td expand>
|
||||
<span
|
||||
class="link"
|
||||
vn-click-stop="supplierDescriptor.show($event, roadmap.supplierFk)">
|
||||
{{::roadmap.supplier.nickname}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>{{::roadmap.tractorPlate | dashIfEmpty}}</vn-td>
|
||||
<vn-td expand>{{::roadmap.price | currency: 'EUR':2 | dashIfEmpty}}</vn-td>
|
||||
<vn-td expand>{{::roadmap.observations | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon-button
|
||||
vn-click-stop="$ctrl.preview(roadmap)"
|
||||
vn-tooltip="Preview"
|
||||
icon="preview">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
</a>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-card>
|
||||
</vn-data-viewer>
|
||||
<a
|
||||
ui-sref="route.roadmap.create"
|
||||
vn-tooltip="Create roadmap"
|
||||
vn-bind="+"
|
||||
fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-roadmap-summary
|
||||
roadmap="$ctrl.roadmapSelected">
|
||||
</vn-roadmap-summary>
|
||||
</vn-popup>
|
||||
<vn-supplier-descriptor-popover
|
||||
vn-id="supplierDescriptor">
|
||||
</vn-supplier-descriptor-popover>
|
||||
|
||||
<!-- Clonation dialog -->
|
||||
<vn-dialog class="edit"
|
||||
vn-id="clonationDialog"
|
||||
on-accept="$ctrl.cloneSelectedRoadmaps()"
|
||||
message="Select the estimated time of departure (ETD)">
|
||||
<tpl-body>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
label="ETD"
|
||||
ng-model="$ctrl.etd">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Clone</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
<vn-confirm
|
||||
vn-id="deleteRoadmaps"
|
||||
question="Are you sure you want to continue?"
|
||||
message="Selected roadmaps will be removed"
|
||||
on-accept="$ctrl.deleteRoadmaps()">
|
||||
</vn-confirm>
|
|
@ -0,0 +1,62 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
get checked() {
|
||||
const roadmaps = this.$.model.data || [];
|
||||
const checkedRoadmap = [];
|
||||
for (let roadmap of roadmaps) {
|
||||
if (roadmap.checked)
|
||||
checkedRoadmap.push(roadmap);
|
||||
}
|
||||
|
||||
return checkedRoadmap;
|
||||
}
|
||||
|
||||
get totalChecked() {
|
||||
return this.checked.length;
|
||||
}
|
||||
|
||||
preview(roadmap) {
|
||||
this.roadmapSelected = roadmap;
|
||||
this.$.summary.show();
|
||||
}
|
||||
|
||||
openClonationDialog() {
|
||||
this.$.clonationDialog.show();
|
||||
this.etd = Date.vnNew();
|
||||
}
|
||||
|
||||
cloneSelectedRoadmaps() {
|
||||
try {
|
||||
if (!this.etd)
|
||||
throw new Error(`The date can't be empty`);
|
||||
|
||||
const roadmapsIds = [];
|
||||
for (let roadmap of this.checked)
|
||||
roadmapsIds.push(roadmap.id);
|
||||
|
||||
return this.$http.post('Roadmaps/clone', {ids: roadmapsIds, etd: this.etd}).then(() => {
|
||||
this.$.model.refresh();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
});
|
||||
} catch (e) {
|
||||
this.vnApp.showError(this.$t(e.message));
|
||||
}
|
||||
}
|
||||
|
||||
deleteRoadmaps() {
|
||||
console.log(this.checked);
|
||||
|
||||
for (const roadmap of this.checked) {
|
||||
this.$http.delete(`Roadmaps/${roadmap.id}`)
|
||||
.then(() => this.$.model.refresh())
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Roadmaps removed')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnRoadmapIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
Delete roadmap(s): Eliminar troncal(es)
|
||||
Selected roadmaps will be removed: Los troncales seleccionados serán eliminados
|
||||
Roadmaps removed: Troncales eliminados
|
|
@ -0,0 +1,14 @@
|
|||
Roadmaps: Troncales
|
||||
Roadmap: Troncal
|
||||
Driver name: Nombre conductor
|
||||
Plate: Matrícula
|
||||
Price: Precio
|
||||
Observations: Observaciones
|
||||
Clone selected roadmaps: Clonar troncales seleccionadas
|
||||
Select the estimated time of departure (ETD): Seleccione la hora estimada de salida (ETD)
|
||||
Create roadmap: Crear troncal
|
||||
Tractor plate: Matrícula tractor
|
||||
Trailer plate: Matrícula trailer
|
||||
Carrier: Transportista
|
||||
ETD date: Fecha ETD
|
||||
ETD hour: Hora ETD
|
|
@ -0,0 +1,20 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Roadmaps"
|
||||
include="$ctrl.include"
|
||||
auto-load="true"
|
||||
limit="20">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
info="Search roadmap by id or trunk"
|
||||
panel="vn-roadmap-search-panel"
|
||||
model="model"
|
||||
filter="$ctrl.filterParams"
|
||||
expr-builder="$ctrl.exprBuilder(param, value)"
|
||||
base-state="route.roadmap">
|
||||
</vn-searchbar>
|
||||
</vn-portal>
|
||||
<ui-view>
|
||||
<vn-roadmap-index></vn-roadmap-index>
|
||||
</ui-view>
|
|
@ -0,0 +1,61 @@
|
|||
import ngModule from '../../module';
|
||||
import ModuleMain from 'salix/components/module-main';
|
||||
|
||||
export default class Roadmap extends ModuleMain {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
|
||||
this.include = {
|
||||
relation: 'supplier',
|
||||
scope: {
|
||||
fields: ['nickname']
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$postLink() {
|
||||
const from = Date.vnNew();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = Date.vnNew();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
this.filterParams = {
|
||||
from: from,
|
||||
to: to
|
||||
};
|
||||
|
||||
this.$.model.addFilter({where: {
|
||||
and: [
|
||||
{etd: {gte: from}},
|
||||
{etd: {lte: to}}
|
||||
]
|
||||
}});
|
||||
}
|
||||
|
||||
exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? {id: value}
|
||||
: {name: {like: `%${value}%`}};
|
||||
case 'from':
|
||||
return {etd: {gte: value}};
|
||||
case 'to':
|
||||
return {etd: {lte: value}};
|
||||
case 'supplierFk':
|
||||
case 'price':
|
||||
return {[param]: value};
|
||||
case 'tractorPlate':
|
||||
case 'trailerPlate':
|
||||
case 'phone':
|
||||
case 'driverName':
|
||||
return {[param]: {like: `%${value}%`}};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnRoadmap', {
|
||||
controller: Roadmap,
|
||||
template: require('./index.html')
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
Search roadmap by id or trunk: Buscar troncales por id o troncal
|
|
@ -0,0 +1,74 @@
|
|||
<div class="search-panel">
|
||||
<form id="manifold-form" ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal class="vn-px-lg vn-pt-lg">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="General search"
|
||||
ng-model="filter.search"
|
||||
info="Search routes by id"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<section class="vn-px-md">
|
||||
<vn-horizontal class="manifold-panel vn-pa-md">
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="From"
|
||||
ng-model="filter.from">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="To"
|
||||
ng-model="filter.to">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
</section>
|
||||
<vn-horizontal class="vn-px-lg">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Tractor plate"
|
||||
ng-model="filter.tractorPlate">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Trailer plate"
|
||||
ng-model="filter.trailerPlate">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg">
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="filter.supplierFk"
|
||||
url="Suppliers"
|
||||
show-field="nickname"
|
||||
search-function="{or: [{id: $search}, {nickname: {like: '%'+ $search +'%'}}]}"
|
||||
value-field="id"
|
||||
order="nickname"
|
||||
label="Carrier">
|
||||
<tpl-item>
|
||||
{{::id}} - {{::nickname}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
vn-one
|
||||
label="Price"
|
||||
ng-model="filter.price">
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Driver name"
|
||||
ng-model="filter.driverName">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Phone"
|
||||
ng-model="filter.phone">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
import ngModule from '../../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
ngModule.component('vnRoadmapSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: SearchPanel
|
||||
});
|
|
@ -0,0 +1,71 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="ExpeditionTrucks"
|
||||
where="{roadmapFk: $ctrl.$params.id}"
|
||||
order="eta ASC"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.expeditionTrucks"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form class="vn-w-md" name="form" ng-submit="$ctrl.onSubmit()">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="expeditionTruck in $ctrl.expeditionTrucks">
|
||||
<vn-autocomplete vn-one
|
||||
label="Warehouse"
|
||||
ng-model="expeditionTruck.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
vn-focus
|
||||
rule>
|
||||
</vn-autocomplete>
|
||||
<vn-date-picker vn-one
|
||||
label="ETA date"
|
||||
ng-model="expeditionTruck.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
vn-one
|
||||
label="ETA hour"
|
||||
ng-model="expeditionTruck.eta">
|
||||
</vn-input-time>
|
||||
<vn-textArea
|
||||
vn-one
|
||||
label="Description"
|
||||
ng-model="expeditionTruck.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
<vn-none>
|
||||
<vn-icon-button
|
||||
vn-tooltip="Remove stop"
|
||||
icon="delete"
|
||||
ng-click="model.remove($index)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-icon-button
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add stop"
|
||||
icon="add_circle"
|
||||
ng-click="$ctrl.add()">
|
||||
</vn-icon-button>
|
||||
</vn-one>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Save">
|
||||
</vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
<vn-confirm
|
||||
vn-id="confirm"
|
||||
question="Delete stop?"
|
||||
on-accept="$ctrl.removeTicketFromRoute($index)">
|
||||
</vn-confirm>
|
|
@ -0,0 +1,39 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
export default class Controller extends Section {
|
||||
add() {
|
||||
const filter = {
|
||||
fields: ['etd']
|
||||
};
|
||||
this.$http.get(`Roadmaps/${this.$params.id}`, {filter})
|
||||
.then(res => {
|
||||
this.roadmap = res.data;
|
||||
|
||||
const eta = new Date(this.roadmap.etd);
|
||||
eta.setDate(eta.getDate() + 1);
|
||||
|
||||
this.$.model.insert({
|
||||
roadmapFk: this.$params.id,
|
||||
eta: eta
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.check();
|
||||
this.$.model.save().then(() => {
|
||||
this.$.watcher.notifySaved();
|
||||
this.$.watcher.updateOriginalData();
|
||||
this.$.model.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnRoadmapStops', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
roadmap: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
Remove stop: Eliminar parada
|
||||
Add stop: Añadir parada
|
||||
ETA date: Fecha ETA
|
||||
ETA hour: Hora ETA
|
|
@ -0,0 +1,113 @@
|
|||
<vn-card class="summary">
|
||||
<h5>
|
||||
<span>{{summary.id}} - {{summary.name}}</span>
|
||||
</h5>
|
||||
<vn-horizontal class="vn-pa-md">
|
||||
<vn-one>
|
||||
<vn-label-value label="Carrier">
|
||||
<span ng-click="supplierDescriptor.show($event, summary.supplier.id)" class="link">
|
||||
{{summary.supplier.nickname}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="ETD"
|
||||
value="{{summary.etd | date:'dd/MM/yyyy HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Tractor plate"
|
||||
value="{{summary.tractorPlate}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Trailer plate"
|
||||
value="{{summary.trailerPlate}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-label-value
|
||||
label="Phone"
|
||||
value="{{summary.phone}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Worker"
|
||||
value="{{summary.worker.firstName}} {{summary.worker.lastName}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Observations"
|
||||
value="{{summary.observations}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-auto>
|
||||
<h4>
|
||||
<a
|
||||
ui-sref="route.roadmap.card.stops({id:summary.id})"
|
||||
target="_self">
|
||||
<span translate vn-tooltip="Go to">Stops</span>
|
||||
<vn-icon-button
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add stop"
|
||||
icon="add_circle"
|
||||
vn-click-stop="addExpeditionTruck.show()">
|
||||
</vn-icon-button>
|
||||
</a>
|
||||
</h4>
|
||||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th>Wharehouse</vn-th>
|
||||
<vn-th>ETA</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="expeditionTruck in summary.expeditionTruck">
|
||||
<vn-td>{{expeditionTruck.warehouse.name}}</vn-td>
|
||||
<vn-td expand>{{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-auto>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-supplier-descriptor-popover
|
||||
vn-id="supplierDescriptor">
|
||||
</vn-supplier-descriptor-popover>
|
||||
|
||||
<vn-dialog
|
||||
vn-id="addExpeditionTruck"
|
||||
on-open="$ctrl.getETD()"
|
||||
on-accept="$ctrl.onAddAccept()">
|
||||
<tpl-body>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Warehouse"
|
||||
ng-model="$ctrl.expeditionTruck.warehouseFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
vn-focus
|
||||
rule>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
label="ETA date"
|
||||
ng-model="$ctrl.expeditionTruck.eta"
|
||||
rule>
|
||||
</vn-date-picker>
|
||||
<vn-input-time
|
||||
label="ETA hour"
|
||||
ng-model="$ctrl.expeditionTruck.eta">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textArea
|
||||
label="Description"
|
||||
ng-model="$ctrl.expeditionTruck.description"
|
||||
rule>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||
<button response="accept" translate>Confirm</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
|
@ -0,0 +1,68 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from 'core/lib/component';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Component {
|
||||
set roadmap(value) {
|
||||
this._roadmap = value;
|
||||
this.$.summary = null;
|
||||
if (!value) return;
|
||||
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
get roadmap() {
|
||||
return this._roadmap;
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
include: [
|
||||
{relation: 'supplier'},
|
||||
{relation: 'worker'},
|
||||
{relation: 'expeditionTruck',
|
||||
scope: {
|
||||
include: [
|
||||
{relation: 'warehouse'}
|
||||
]
|
||||
}}
|
||||
]
|
||||
};
|
||||
this.$http.get(`Roadmaps/${this.roadmap.id}`, {filter})
|
||||
.then(res => this.$.summary = res.data);
|
||||
}
|
||||
|
||||
getETD() {
|
||||
const eta = new Date(this.roadmap.etd);
|
||||
eta.setDate(eta.getDate() + 1);
|
||||
|
||||
this.expeditionTruck = {eta: eta};
|
||||
}
|
||||
|
||||
onAddAccept() {
|
||||
try {
|
||||
const data = {
|
||||
roadmapFk: this.roadmap.id,
|
||||
warehouseFk: this.expeditionTruck.warehouseFk,
|
||||
eta: this.expeditionTruck.eta,
|
||||
description: this.expeditionTruck.description
|
||||
};
|
||||
|
||||
this.$http.post(`ExpeditionTrucks`, data)
|
||||
.then(() => {
|
||||
this.loadData();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
});
|
||||
} catch (e) {
|
||||
this.vnApp.showError(this.$t(e.message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnRoadmapSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
roadmap: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
Stops: Paradas
|
||||
Wharehouse: Almacén
|
||||
You must fill all the fields: Debes rellenar todos los campos
|
|
@ -0,0 +1,10 @@
|
|||
@import "variables";
|
||||
|
||||
vn-roadmap-summary .summary {
|
||||
a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 18.328px;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,17 @@
|
|||
"menus": {
|
||||
"main": [
|
||||
{"state": "route.index", "icon": "icon-delivery"},
|
||||
{"state": "route.agencyTerm.index", "icon": "icon-agency-term"}
|
||||
{"state": "route.agencyTerm.index", "icon": "icon-agency-term"},
|
||||
{"state": "route.roadmap", "icon": "icon-trailer"}
|
||||
],
|
||||
"card": [
|
||||
{"state": "route.card.basicData", "icon": "settings"},
|
||||
{"state": "route.card.tickets", "icon": "icon-ticket"},
|
||||
{"state": "route.card.log", "icon": "history"}
|
||||
],
|
||||
"roadmap": [
|
||||
{"state": "route.roadmap.card.basicData", "icon": "settings"},
|
||||
{"state": "route.roadmap.card.stops", "icon": "icon-lines"}
|
||||
]
|
||||
},
|
||||
"routes": [
|
||||
|
@ -90,6 +95,46 @@
|
|||
"route": "$ctrl.route"
|
||||
},
|
||||
"acl": ["delivery"]
|
||||
}, {
|
||||
"url": "/roadmap?q",
|
||||
"state": "route.roadmap",
|
||||
"component": "vn-roadmap",
|
||||
"description": "Roadmaps"
|
||||
}, {
|
||||
"url": "/create",
|
||||
"state": "route.roadmap.create",
|
||||
"component": "vn-roadmap-create",
|
||||
"description": "Create roadmap"
|
||||
},{
|
||||
"url": "/:id",
|
||||
"state": "route.roadmap.card",
|
||||
"component": "vn-roadmap-card",
|
||||
"abstract": true,
|
||||
"description": "Detail"
|
||||
},{
|
||||
"url": "/summary",
|
||||
"state": "route.roadmap.card.summary",
|
||||
"component": "vn-roadmap-summary",
|
||||
"description": "Summary",
|
||||
"params": {
|
||||
"roadmap": "$ctrl.roadmap"
|
||||
}
|
||||
},{
|
||||
"url": "/basic-data",
|
||||
"state": "route.roadmap.card.basicData",
|
||||
"component": "vn-roadmap-basic-data",
|
||||
"description": "Basic data",
|
||||
"params": {
|
||||
"roadmap": "$ctrl.roadmap"
|
||||
}
|
||||
}, {
|
||||
"url": "/stops",
|
||||
"state": "route.roadmap.card.stops",
|
||||
"component": "vn-roadmap-stops",
|
||||
"description": "Stops",
|
||||
"params": {
|
||||
"route": "$ctrl.roadmap"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
ng-click="deleteShelving.show()"
|
||||
name="deleteShelving"
|
||||
translate>
|
||||
Delete
|
||||
Delete shelving
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
|
@ -32,7 +32,7 @@
|
|||
</slot-body>
|
||||
</vn-descriptor-content>
|
||||
<vn-confirm
|
||||
vn-id="delete-shelving"
|
||||
vn-id="deleteShelving"
|
||||
on-accept="$ctrl.onDelete()"
|
||||
question="Are you sure you want to continue?"
|
||||
message="Shelving will be removed">
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Delete shelving: Eliminar carro
|
||||
Shelving will be removed: El carro será eliminado
|
||||
Shelving removed: Carro eliminado
|
|
@ -270,7 +270,7 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
return this.$http.post(`Tickets/invoiceTickets`, params)
|
||||
return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]})
|
||||
.then(() => this.reload())
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Code"
|
||||
label="Worker code"
|
||||
ng-model="$ctrl.worker.code"
|
||||
maxLength="3"
|
||||
on-change="$ctrl.worker.code = $ctrl.worker.code.toUpperCase()"
|
||||
|
|
|
@ -2,7 +2,7 @@ Firstname: Nombre
|
|||
Lastname: Apellidos
|
||||
Fi: DNI/NIF/NIE
|
||||
Birth: Fecha de nacimiento
|
||||
Code: Código de trabajador
|
||||
Worker code: Código de trabajador
|
||||
Province: Provincia
|
||||
City: Población
|
||||
ProfileType: Tipo de perfil
|
||||
|
|
Loading…
Reference in New Issue