add supplier autonomous
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
20ee9727e9
commit
a32ebc37da
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO salix.ACL (id, model, property, accessType, permission, principalType, principalId)
|
||||
VALUES(304, 'Agency', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('SupplierAgencyTerms', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -0,0 +1,27 @@
|
|||
ALTER TABLE vn.agencyTerm ADD supplierFk INT NULL;
|
||||
ALTER TABLE vn.agencyTerm CHANGE supplierFk supplierFk INT NULL AFTER agencyFk;
|
||||
|
||||
UPDATE vn.agencyTerm `at`
|
||||
JOIN vn.agency a ON a.id = `at`.agencyFk
|
||||
SET `at`.supplierFk = a.supplierFk;
|
||||
|
||||
ALTER TABLE vn.agencyTerm ADD CONSTRAINT agencyTerm_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE vn.agencyTerm ADD CONSTRAINT agencyTerm_FK_1 FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
RENAME TABLE vn.agencyTerm TO vn.supplierAgencyTerm;
|
||||
|
||||
CREATE OR REPLACE
|
||||
ALGORITHM = UNDEFINED
|
||||
DEFINER=`root`@`localhost`
|
||||
VIEW `vn`.`agencyTerm` AS
|
||||
SELECT
|
||||
`sat`.`agencyFk` AS `agencyFk`,
|
||||
`sat`.`minimumPackages` AS `minimumPackages`,
|
||||
`sat`.`kmPrice` AS `kmPrice`,
|
||||
`sat`.`packagePrice` AS `packagePrice`,
|
||||
`sat`.`routePrice` AS `routePrice`,
|
||||
`sat`.`minimumKm` AS `minimumKm`,
|
||||
`sat`.`minimumM3` AS `minimumM3`,
|
||||
`sat`.`m3Price` AS `m3Price`
|
||||
FROM
|
||||
`vn`.`supplierAgencyTerm` `sat`
|
|
@ -2472,3 +2472,11 @@ INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`)
|
|||
INSERT INTO `vn`.`docuwareConfig` (`url`)
|
||||
VALUES
|
||||
('https://verdnatura.docuware.cloud/docuware/platform');
|
||||
|
||||
INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
|
||||
VALUES
|
||||
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),
|
||||
(2, 1, 60, 0.00, 0.00, NULL, 0, 5.00, 33),
|
||||
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
||||
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
||||
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
||||
|
|
|
@ -219,5 +219,6 @@
|
|||
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
||||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||
"You don't have privileges to create pay back": "No tienes permisos para crear un abono",
|
||||
"The item is required": "El artículo es requerido"
|
||||
"The item is required": "El artículo es requerido",
|
||||
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo"
|
||||
}
|
|
@ -11,6 +11,9 @@
|
|||
"SupplierAccount": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierAgencyTerm": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`The agency is already assigned to another autonomous`);
|
||||
return err;
|
||||
});
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "SupplierAgencyTerm",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplierAgencyTerm"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"agencyFk": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"supplierFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"minimumPackages": {
|
||||
"type": "number"
|
||||
},
|
||||
"kmPrice": {
|
||||
"type": "number"
|
||||
},
|
||||
"packagePrice": {
|
||||
"type": "number"
|
||||
},
|
||||
"routePrice": {
|
||||
"type": "number"
|
||||
},
|
||||
"minimumKm": {
|
||||
"type": "number"
|
||||
},
|
||||
"minimumM3": {
|
||||
"type": "number"
|
||||
},
|
||||
"m3Price": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "EXECUTE",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="SupplierAgencyTerms"
|
||||
link="{supplierFk: $ctrl.$params.id}"
|
||||
data="$ctrl.supplierAgencyTerms"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.supplierAgencyTerms"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="supplierAgencyTerm in $ctrl.supplierAgencyTerms">
|
||||
<vn-autocomplete
|
||||
vn-id="text"
|
||||
label="Agency"
|
||||
ng-model="supplierAgencyTerm.agencyFk"
|
||||
url="Agencies"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
rule>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Minimum M3"
|
||||
ng-model="supplierAgencyTerm.minimumM3"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Package Price"
|
||||
ng-model="supplierAgencyTerm.packagePrice"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Km Price"
|
||||
ng-model="supplierAgencyTerm.kmPrice"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="M3 Price"
|
||||
ng-model="supplierAgencyTerm.m3Price"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Route Price"
|
||||
ng-model="supplierAgencyTerm.routePrice"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-input-number
|
||||
type="number"
|
||||
label="Minimum Km"
|
||||
ng-model="supplierAgencyTerm.minimumKm"
|
||||
rule>
|
||||
</vn-input-number>
|
||||
<vn-none>
|
||||
<vn-icon-button
|
||||
vn-tooltip="Remove row"
|
||||
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 row"
|
||||
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>
|
|
@ -0,0 +1,28 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
}
|
||||
|
||||
add() {
|
||||
this.$.model.insert({});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.check();
|
||||
this.$.model.save().then(() => {
|
||||
this.$.watcher.notifySaved();
|
||||
this.$.watcher.updateOriginalData();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnSupplierAgencyTerm', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
supplier: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
import './index.js';
|
||||
import crudModel from 'core/mocks/crud-model';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Component vnItemTags', () => {
|
||||
let $scope;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('item'));
|
||||
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.model = crudModel;
|
||||
const $element = angular.element('<vn-item-tags></vn-item-tags>');
|
||||
controller = $componentController('vnItemTags', {$element, $scope});
|
||||
}));
|
||||
|
||||
describe('getHighestPriority', () => {
|
||||
it('should return the highest priority value + 1 from the array', () => {
|
||||
$scope.model.data = [{priority: 1}, {priority: 2}, {priority: 1}];
|
||||
let result = controller.getHighestPriority();
|
||||
|
||||
expect(result).toEqual(3);
|
||||
});
|
||||
|
||||
it('should return 1 when there is no priority defined', () => {
|
||||
$scope.model.data = [];
|
||||
let result = controller.getHighestPriority();
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
Minimum M3: M3 minimos
|
||||
Package Price: Precio bulto
|
||||
Km Price: Precio Km
|
||||
M3 Price: Precio M3
|
||||
Route Price: Precio ruta
|
||||
Minimum Km: Km minimos
|
||||
Remove row: Eliminar fila
|
||||
Add row: Añadir fila
|
|
@ -18,3 +18,4 @@ import './billing-data';
|
|||
import './address/index';
|
||||
import './address/create';
|
||||
import './address/edit';
|
||||
import './agency-term';
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
{"state": "supplier.card.address.index", "icon": "icon-delivery"},
|
||||
{"state": "supplier.card.account", "icon": "icon-account"},
|
||||
{"state": "supplier.card.contact", "icon": "contact_phone"},
|
||||
{"state": "supplier.card.agencyTerm", "icon": "contact_support"},
|
||||
{"state": "supplier.card.log", "icon": "history"},
|
||||
{"state": "supplier.card.consumption", "icon": "show_chart"}
|
||||
]
|
||||
|
@ -86,6 +87,13 @@
|
|||
"supplier": "$ctrl.supplier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "/agency-term",
|
||||
"state": "supplier.card.agencyTerm",
|
||||
"component": "vn-supplier-agency-term",
|
||||
"description": "Autonomous",
|
||||
"acl": ["administrative"]
|
||||
},
|
||||
{
|
||||
"url": "/consumption?q",
|
||||
"state": "supplier.card.consumption",
|
||||
|
|
Loading…
Reference in New Issue