Added menu to create a new supplier, not working
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
4d4e446ff6
commit
012cd68c89
|
@ -0,0 +1,28 @@
|
|||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('new', {
|
||||
description: 'returns the created item',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'params',
|
||||
type: 'object',
|
||||
http: {source: 'body'}
|
||||
}],
|
||||
returns: {
|
||||
type: 'number',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/new`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.new = async(params, options) => {
|
||||
console.log(params);
|
||||
console.log(options);
|
||||
};
|
||||
};
|
|
@ -10,6 +10,7 @@ module.exports = Self => {
|
|||
require('../methods/supplier/freeAgencies')(Self);
|
||||
require('../methods/supplier/campaignMetricsPdf')(Self);
|
||||
require('../methods/supplier/campaignMetricsEmail')(Self);
|
||||
require('../methods/supplier/new')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {
|
||||
message: 'The social name cannot be empty'
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="supplier/new"
|
||||
data="$ctrl.supplier"
|
||||
insert-mode="true"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<vn-crud-model
|
||||
auto-load="true"
|
||||
url="Origins"
|
||||
data="originsData"
|
||||
order="name"
|
||||
vn-id="origin-model">
|
||||
</vn-crud-model>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Supplier name"
|
||||
ng-model="$ctrl.supplier.name"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Create">
|
||||
</vn-submit>
|
||||
<vn-button
|
||||
class="cancel"
|
||||
label="Cancel"
|
||||
ui-sref="supplier.index">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,25 @@
|
|||
/* eslint-disable no-console */
|
||||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
console.log($);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
console.log('abc'),
|
||||
json => this.$state.go('item.card.basicData', {id: json.data.id})
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnSupplierCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -20,3 +20,4 @@ import './address/create';
|
|||
import './address/edit';
|
||||
import './agency-term/index';
|
||||
import './agency-term/create';
|
||||
import './create/index';
|
||||
|
|
|
@ -59,3 +59,8 @@
|
|||
supplier="$ctrl.supplierSelected">
|
||||
</vn-supplier-summary>
|
||||
</vn-popup>
|
||||
<!--vn-float-button vn-acl="administrative" icon="add" ng-click="$ctrl.test()" fixed-bottom-right vn-tooltip="New supplier"></vn-float-button>
|
||||
-->
|
||||
<a vn-acl="administrative" ui-sref="supplier.create" vn-tooltip="New supplier" vn-bind="+" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
|
@ -10,6 +10,11 @@ export default class Controller extends Section {
|
|||
this.supplierSelected = supplier;
|
||||
this.$.dialogSummarySupplier.show();
|
||||
}
|
||||
|
||||
test() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Creating new supplier');
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnSupplierIndex', {
|
||||
|
|
|
@ -3,3 +3,4 @@ Pay day: Dia de pago
|
|||
Account: Cuenta
|
||||
Pay method: Metodo de pago
|
||||
Tax number: Nif
|
||||
New supplier: Nuevo proveedor
|
|
@ -31,6 +31,12 @@
|
|||
"component": "vn-supplier",
|
||||
"description": "Suppliers"
|
||||
},
|
||||
{
|
||||
"url": "/create",
|
||||
"state": "supplier.create",
|
||||
"component": "vn-supplier-create",
|
||||
"description": "New supplier"
|
||||
},
|
||||
{
|
||||
"url": "/index?q",
|
||||
"state": "supplier.index",
|
||||
|
|
Loading…
Reference in New Issue