diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 91814e7f2..9b8a51c65 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -198,6 +198,12 @@ "abstract": true, "component": "ui-view" }, + { + "url": "/service", + "state": "ticket.card.service", + "component": "vn-ticket-service", + "description": "Service" + }, { "url" : "/index", "state": "ticket.card.request.index", @@ -226,6 +232,7 @@ {"state": "ticket.card.volume", "icon": "icon-volume"}, {"state": "ticket.card.expedition", "icon": "icon-volum"}, {"state": "ticket.card.package.index", "icon": "icon-bucket"}, + {"state": "ticket.card.service"}, {"state": "ticket.card.tracking.index", "icon": "remove_red_eye"}, {"state": "ticket.card.saleChecked", "icon": "assignment"}, {"state": "ticket.card.components", "icon": "icon-components"}, diff --git a/client/ticket/src/services/index.html b/client/ticket/src/services/index.html new file mode 100644 index 000000000..6be1e3c2b --- /dev/null +++ b/client/ticket/src/services/index.html @@ -0,0 +1,67 @@ + + + + +
+ + Service + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/client/ticket/src/services/index.js b/client/ticket/src/services/index.js new file mode 100644 index 000000000..b9bccd446 --- /dev/null +++ b/client/ticket/src/services/index.js @@ -0,0 +1,31 @@ +import ngModule from '../module'; + +class Controller { + constructor($scope, $stateParams) { + this.$scope = $scope; + this.$stateParams = $stateParams; + } + + add() { + this.$scope.model.insert({ + taxClassFk: 2, + quantity: 1, + ticketFk: this.$stateParams.id + }); + } + + onSubmit() { + this.$scope.watcher.check(); + this.$scope.model.save().then(() => { + this.$scope.watcher.notifySaved(); + this.$scope.model.refresh(); + }); + } +} + +Controller.$inject = ['$scope', '$stateParams']; + +ngModule.component('vnTicketService', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/ticket/src/services/locale/es.yml b/client/ticket/src/services/locale/es.yml new file mode 100644 index 000000000..9059c9250 --- /dev/null +++ b/client/ticket/src/services/locale/es.yml @@ -0,0 +1,4 @@ +Service: Servicios +Tax class: Tipo IVA +Add service: AƱadir servicio +Remove service: Quitar servicio \ No newline at end of file diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index 336728272..d64f55524 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -19,6 +19,7 @@ import './sale/editDiscount'; import './tracking/index'; import './tracking/edit'; import './sale-checked'; +import './services'; import './component'; import './sale-tracking'; import './picture'; diff --git a/services/item/server/model-config.json b/services/item/server/model-config.json index 6723f86f6..410ee3dd2 100644 --- a/services/item/server/model-config.json +++ b/services/item/server/model-config.json @@ -1,13 +1,4 @@ { - "TaxClass": { - "dataSource": "vn" - }, - "TaxCode": { - "dataSource": "vn" - }, - "TaxType": { - "dataSource": "vn" - }, "ItemNiche": { "dataSource": "vn" }, @@ -23,9 +14,6 @@ "ItemPlacement": { "dataSource": "vn" }, - "ItemTaxCountry": { - "dataSource": "vn" - }, "Warehouse": { "dataSource": "vn" }, diff --git a/services/loopback/common/methods/order/new.js b/services/loopback/common/methods/order/new.js index ae090dedd..8f21e6d3f 100644 --- a/services/loopback/common/methods/order/new.js +++ b/services/loopback/common/methods/order/new.js @@ -28,7 +28,7 @@ module.exports = Self => { ] }); let clientFk = address.clientFk; - console.log(address); + if (address.client().isFreezed) throw new UserError(`You can't create an order for a frozen client`); diff --git a/services/item/common/models/item-tax-country.json b/services/loopback/common/models/item-tax-country.json similarity index 100% rename from services/item/common/models/item-tax-country.json rename to services/loopback/common/models/item-tax-country.json diff --git a/services/item/common/models/tax-class.json b/services/loopback/common/models/tax-class.json similarity index 100% rename from services/item/common/models/tax-class.json rename to services/loopback/common/models/tax-class.json diff --git a/services/item/common/models/tax-code.json b/services/loopback/common/models/tax-code.json similarity index 100% rename from services/item/common/models/tax-code.json rename to services/loopback/common/models/tax-code.json diff --git a/services/item/common/models/tax-type.json b/services/loopback/common/models/tax-type.json similarity index 100% rename from services/item/common/models/tax-type.json rename to services/loopback/common/models/tax-type.json diff --git a/services/loopback/common/models/ticket-service.json b/services/loopback/common/models/ticket-service.json new file mode 100644 index 000000000..427baced0 --- /dev/null +++ b/services/loopback/common/models/ticket-service.json @@ -0,0 +1,39 @@ +{ + "name": "TicketService", + "base": "VnModel", + "options": { + "mysql": { + "table": "ticketService" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "String", + "required": true + }, + "quantity": { + "type": "Number", + "required": true + }, + "price": { + "type": "Number", + "required": true + }, + "taxClassFk": { + "type": "Number", + "required": true + } + }, + "relations": { + "taxClass": { + "type": "belongsTo", + "model": "TaxClass", + "foreignKey": "taxClassFk" + } + } +} \ No newline at end of file diff --git a/services/loopback/server/model-config.json b/services/loopback/server/model-config.json index fa4508883..6532f6bf9 100644 --- a/services/loopback/server/model-config.json +++ b/services/loopback/server/model-config.json @@ -5,11 +5,11 @@ "AccessToken": { "dataSource": "salix", "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } } }, "ACL": { @@ -99,6 +99,21 @@ "TicketState":{ "dataSource": "vn" }, + "TaxClass": { + "dataSource": "vn" + }, + "TaxCode": { + "dataSource": "vn" + }, + "TaxType": { + "dataSource": "vn" + }, + "ItemTaxCountry": { + "dataSource": "vn" + }, + "TicketService":{ + "dataSource": "vn" + }, "Item": { "dataSource": "vn" },