diff --git a/modules/client/front/address/create/index.html b/modules/client/front/address/create/index.html deleted file mode 100644 index cd2be39c9..000000000 --- a/modules/client/front/address/create/index.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - -
- - - - - - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/client/front/address/create/index.js b/modules/client/front/address/create/index.js deleted file mode 100644 index aa603725e..000000000 --- a/modules/client/front/address/create/index.js +++ /dev/null @@ -1,90 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.address = { - isActive: true, - isDefaultAddress: false - }; - } - - onSubmit() { - this.$.watcher.submit().then(res => { - if (this.address.isDefaultAddress) - this.client.defaultAddressFk = res.data.id; - - this.$state.go('client.card.address.index'); - }); - } - - showCustomAgent(event) { - if (event.defaultPrevented) return; - event.preventDefault(); - - this.$.customAgent.show(); - } - - onCustomAgentAccept() { - return this.$http.post(`CustomsAgents`, this.newCustomsAgent) - .then(res => this.address.customsAgentFk = res.data.id); - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - this._town = selection; - - if (!selection) return; - - const province = selection.province; - const postcodes = selection.postcodes; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - - if (postcodes.length === 1) - this.address.postalCode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - this._postcode = selection; - - if (!selection) return; - - const town = selection.town; - const province = town.province; - - if (!this.address.city) - this.address.city = town.name; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - } - - onResponse(response) { - this.address.postalCode = response.code; - this.address.city = response.city; - this.address.provinceFk = response.provinceFk; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientAddressCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js deleted file mode 100644 index 1be4766f5..000000000 --- a/modules/client/front/address/create/index.spec.js +++ /dev/null @@ -1,130 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Client', () => { - describe('Component vnClientAddressCreate', () => { - let $scope; - let controller; - let $httpBackend; - let $element; - let $state; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $state = _$state_; - $state.params.id = '1234'; - $element = angular.element(''); - controller = $componentController('vnClientAddressCreate', {$element, $scope}); - controller.$.watcher = watcher; - controller.$.watcher.submit = () => { - return { - then: callback => { - callback({data: {id: 124}}); - } - }; - }; - controller.client = {id: 1101, defaultAddressFk: 121}; - })); - - it('should define and set address property', () => { - expect(controller.address.isActive).toBe(true); - }); - - describe('onSubmit()', () => { - it('should perform a PATCH and not set value to defaultAddressFk property', () => { - jest.spyOn(controller.$state, 'go'); - controller.address.isDefaultAddress = false; - controller.onSubmit(); - - expect(controller.client.defaultAddressFk).toEqual(121); - expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); - }); - - it('should perform a PATCH and set a value to defaultAddressFk property', () => { - jest.spyOn(controller.$state, 'go'); - controller.address.isDefaultAddress = true; - controller.onSubmit(); - - expect(controller.client.defaultAddressFk).toEqual(124); - expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); - }); - }); - - describe('town() setter', () => { - it(`should set provinceFk property`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [] - }; - - expect(controller.address.provinceFk).toEqual(1); - }); - - it(`should set provinceFk property and fill the postalCode if there's just one`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [{code: '46001'}] - }; - - expect(controller.address.provinceFk).toEqual(1); - expect(controller.address.postalCode).toEqual('46001'); - }); - }); - - describe('postcode() setter', () => { - it(`should set the town and province properties`, () => { - controller.postcode = { - townFk: 1, - code: 46001, - town: { - id: 1, - name: 'New York', - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - } - } - }; - - expect(controller.address.city).toEqual('New York'); - expect(controller.address.provinceFk).toEqual(1); - }); - }); - - describe('onCustomAgentAccept()', () => { - it(`should create a new customs agent and then set the customsAgentFk property on the address`, () => { - const expectedResult = {id: 1, fiscalName: 'Customs agent one'}; - $httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult); - controller.onCustomAgentAccept(); - $httpBackend.flush(); - - expect(controller.address.customsAgentFk).toEqual(1); - }); - }); - }); -}); diff --git a/modules/client/front/address/edit/index.html b/modules/client/front/address/edit/index.html deleted file mode 100644 index 4bab3aeae..000000000 --- a/modules/client/front/address/edit/index.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - - - - - - - - Notes -
- - - - - - - - - - - - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/client/front/address/edit/index.js b/modules/client/front/address/edit/index.js deleted file mode 100644 index b8d2e28a4..000000000 --- a/modules/client/front/address/edit/index.js +++ /dev/null @@ -1,94 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - removeObservation(index) { - this.$.watcher.setDirty(); - this.$.model.remove(index); - } - - cancel() { - this.goToIndex(); - } - - goToIndex() { - this.$state.go('client.card.address.index'); - } - - onSubmit() { - this.$.watcher.submit() - .then(() => this.$.model.save(true)) - .then(() => { - this.card.reload(); - this.goToIndex(); - }); - } - - showCustomAgent(event) { - if (event.defaultPrevented) return; - event.preventDefault(); - - this.$.customAgent.show(); - } - - onCustomAgentAccept() { - return this.$http.post(`CustomsAgents`, this.newCustomsAgent) - .then(res => this.address.customsAgentFk = res.data.id); - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - const oldValue = this._town; - this._town = selection; - - if (!selection || !oldValue) return; - - const province = selection.province; - const postcodes = selection.postcodes; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - - if (!this.address.postalCode && postcodes.length === 1) - this.address.postalCode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - const oldValue = this._postcode; - this._postcode = selection; - - if (!selection || !oldValue) return; - - const town = selection.town; - const province = town.province; - - if (!this.address.city) - this.address.city = town.name; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - } - - onResponse(response) { - this.address.postalCode = response.code; - this.address.city = response.city; - this.address.provinceFk = response.provinceFk; - } -} - -ngModule.vnComponent('vnClientAddressEdit', { - template: require('./index.html'), - controller: Controller, - require: { - card: '^vnClientCard' - } -}); diff --git a/modules/client/front/address/edit/index.spec.js b/modules/client/front/address/edit/index.spec.js deleted file mode 100644 index f763495ac..000000000 --- a/modules/client/front/address/edit/index.spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientAddressEdit', () => { - let $scope; - let controller; - let $httpBackend; - let $element; - let $state; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $state = _$state_; - $state.params.addressId = '1'; - $element = angular.element(''); - controller = $componentController('vnClientAddressEdit', {$element, $scope}); - controller.address = {id: 1, customsAgentFk: null}; - controller.$.watcher = { - setDirty: () => {}, - setPristine: () => {}, - realSubmit: () => {}, - check: () => {}, - notifySaved: () => {} - }; - controller.$.model = { - remove: () => {}, - save: () => {} - }; - controller.card = { - reload: () => {} - }; - })); - - describe('removeObservation()', () => { - it('should call $.watcher.setDirty() and $.model.remove(index)', () => { - jest.spyOn(controller.$.watcher, 'setDirty'); - jest.spyOn(controller.$.model, 'remove'); - controller.removeObservation(1); - - expect(controller.$.model.remove).toHaveBeenCalledWith(1); - expect(controller.$.watcher.setDirty).toHaveBeenCalledWith(); - }); - }); - - describe('cancel()', () => { - it('should call goToIndex()', () => { - jest.spyOn(controller, 'goToIndex'); - controller.cancel(); - - expect(controller.goToIndex).toHaveBeenCalledWith(); - }); - }); - - describe('goToIndex()', () => { - it('should call $state.go("client.card.address.index")', () => { - jest.spyOn(controller.$state, 'go'); - controller.goToIndex(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); - }); - }); - - describe('onCustomAgentAccept()', () => { - it(`should now create a new customs agent and then set the customsAgentFk property on the address`, () => { - const expectedResult = {id: 1, fiscalName: 'Customs agent one'}; - $httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult); - controller.onCustomAgentAccept(); - $httpBackend.flush(); - - expect(controller.address.customsAgentFk).toEqual(1); - }); - }); - }); -}); diff --git a/modules/client/front/address/index/index.html b/modules/client/front/address/index/index.html deleted file mode 100644 index 8ef423213..000000000 --- a/modules/client/front/address/index/index.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js deleted file mode 100644 index f47d079b2..000000000 --- a/modules/client/front/address/index/index.js +++ /dev/null @@ -1,97 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - fields: [ - 'id', - 'isDefaultAddress', - 'isActive', - 'nickname', - 'street', - 'city', - 'provinceFk', - 'phone', - 'mobile', - 'isEqualizated', - 'isLogifloraAllowed', - 'postalCode' - ], - order: [ - 'isDefaultAddress DESC', - 'isActive DESC', - 'nickname ASC'], - include: [ - { - relation: 'observations', - scope: { - include: 'observationType' - } - }, { - relation: 'province', - scope: { - fields: ['id', 'name', 'countryFk'], - include: { - relation: 'country', - scope: { - fields: ['id', 'name'] - } - } - } - } - ] - }; - } - - onStarClick(event) { - event.stopPropagation(); - event.preventDefault(); - } - - setDefault(address) { - let query = `Clients/${this.$params.id}`; - let params = {defaultAddressFk: address.id}; - this.$http.patch(query, params).then(res => { - if (res.data) { - this.client.defaultAddressFk = res.data.defaultAddressFk; - this.sortAddresses(); - this.vnApp.showSuccess(this.$t('Data saved!')); - } - }); - } - - isDefaultAddress(address) { - return this.client && this.client.defaultAddressFk === address.id; - } - - /** - * Sort address by default address - */ - sortAddresses() { - if (!this.client || !this.addresses) return; - this.addresses = this.addresses.sort((a, b) => { - return this.isDefaultAddress(b) - this.isDefaultAddress(a); - }); - } - - exprBuilder(param, value) { - switch (param) { - case 'search': - return /^\d+$/.test(value) - ? {id: value} - : {nickname: {like: `%${value}%`}}; - } - } -} -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientAddressIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js deleted file mode 100644 index 2a1f0d19e..000000000 --- a/modules/client/front/address/index/index.spec.js +++ /dev/null @@ -1,84 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('Client', () => { - describe('Component vnClientAddressIndex', () => { - let controller; - let $scope; - let $stateParams; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => { - $stateParams = _$stateParams_; - $stateParams.id = 1; - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnClientAddressIndex', {$element, $scope}); - controller.client = {id: 1101, defaultAddressFk: 121}; - controller.$.model = crudModel; - })); - - describe('setDefault()', () => { - it('should perform a PATCH and set a value to defaultAddressFk property', () => { - jest.spyOn(controller, 'sortAddresses'); - let address = {id: 1}; - let data = {defaultAddressFk: address.id}; - let expectedResult = {defaultAddressFk: address.id}; - - $httpBackend.expect('PATCH', `Clients/1`, data).respond(200, expectedResult); - controller.setDefault(address); - $httpBackend.flush(); - - expect(controller.client.defaultAddressFk).toEqual(1); - expect(controller.sortAddresses).toHaveBeenCalledWith(); - }); - }); - - describe('isDefaultAddress()', () => { - it('should return true if a passed address is the current default one', () => { - let address = {id: 121}; - let result = controller.isDefaultAddress(address); - - expect(result).toBeTruthy(); - }); - - it('should return false if a passed address is the current default one', () => { - let address = {id: 1}; - let result = controller.isDefaultAddress(address); - - expect(result).toBeFalsy(); - }); - }); - - describe('sortAddresses()', () => { - it('should return an array of addresses sorted by client defaultAddressFk', () => { - controller.client.defaultAddressFk = 123; - controller.addresses = [ - {id: 121, nickname: 'My address one'}, - {id: 122, nickname: 'My address two'}, - {id: 123, nickname: 'My address three'}]; - - controller.sortAddresses(); - - expect(controller.addresses[0].id).toEqual(123); - }); - }); - - describe('exprBuilder()', () => { - it('should return a filter based on a search by id', () => { - const filter = controller.exprBuilder('search', '123'); - - expect(filter).toEqual({id: '123'}); - }); - - it('should return a filter based on a search by name', () => { - const filter = controller.exprBuilder('search', 'Bruce Wayne'); - - expect(filter).toEqual({nickname: {like: '%Bruce Wayne%'}}); - }); - }); - }); -}); diff --git a/modules/client/front/address/index/style.scss b/modules/client/front/address/index/style.scss deleted file mode 100644 index 27bd8c40e..000000000 --- a/modules/client/front/address/index/style.scss +++ /dev/null @@ -1,21 +0,0 @@ -@import "variables"; -@import "./effects"; - -vn-client-address-index { - .address { - padding-bottom: $spacing-md; - - &:last-child { - padding-bottom: 0; - } - & > a { - @extend %clickable; - box-sizing: border-box; - display: flex; - align-items: center; - width: 100%; - color: inherit; - overflow: hidden; - } - } -} \ No newline at end of file diff --git a/modules/client/front/address/locale/es.yml b/modules/client/front/address/locale/es.yml deleted file mode 100644 index 885ce1a19..000000000 --- a/modules/client/front/address/locale/es.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Index -Set as default: Establecer como predeterminado -Active first to set as default: Active primero para marcar como predeterminado -Search by consignee: Buscar por consignatario -You can search by consignee id or name: Puedes buscar por el id o nombre del consignatario -# Edit -Enabled: Activo -Is equalizated: Recargo de equivalencia -Observation type: Tipo de observación -Description: Descripción -The observation type must be unique: El tipo de observación ha de ser único -Remove note: Quitar nota -Add note: Añadir nota -Customs agent: Agente de aduanas -New customs agent: Nuevo agente de aduanas -# Create -Street address: Dirección postal -Default: Predeterminado -Consignee: Consignatario -Postcode: Código postal -Town/City: Ciudad -Province: Provincia -Agency: Agencia -Phone: Teléfono -Mobile: Móvil - -# Common -Fiscal name: Nombre fiscal -Street: Dirección fiscal -Is Logiflora allowed: Compra directa en Holanda \ No newline at end of file diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html deleted file mode 100644 index 25789b01a..000000000 --- a/modules/client/front/balance/create/index.html +++ /dev/null @@ -1,106 +0,0 @@ - - New payment - - - - - - - - - - - - - {{id}}: {{bank}} - - - - - -
Compensation
- - -
- - - - - -
Cash
- - - - - - -
- - - - - - -
- - - - diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js deleted file mode 100644 index 9113d7605..000000000 --- a/modules/client/front/balance/create/index.js +++ /dev/null @@ -1,217 +0,0 @@ -import ngModule from '../../module'; -import Dialog from 'core/components/dialog'; - -class Controller extends Dialog { - constructor($element, $, $transclude, vnReport, vnEmail) { - super($element, $, $transclude); - this.vnReport = vnReport; - this.vnEmail = vnEmail; - this.receipt = {}; - } - - set payed(value) { - this.receipt.payed = value; - } - - set amountPaid(value) { - this.receipt.amountPaid = value; - this.amountToReturn = this.deliveredAmount - value; - } - - get amountPaid() { - return this.receipt.amountPaid; - } - - set clientFk(value) { - this.receipt.clientFk = value; - - const filter = { - fields: ['email'], - where: { - id: value - } - }; - - this.$http.get(`Clients/findOne`, {filter}) - .then(res => { - this.receipt.email = res.data.email; - }); - } - - get clientFk() { - return this.receipt.clientFk; - } - - get companyFk() { - if (!this.receipt.companyFk) - this.receipt.companyFk = this.vnConfig.companyFk; - return this.receipt.companyFk; - } - - set companyFk(value) { - this.receipt.companyFk = value; - this.getAmountPaid(); - } - - set description(value) { - this.receipt.description = value; - this.originalDescription = value; - } - - get description() { - return this.receipt.description; - } - - get bankSelection() { - return this._bankSelection; - } - - set bankSelection(value) { - this._bankSelection = value; - - if (value) { - const accountingType = value.accountingType; - - this.receipt.description = []; - this.viewReceipt = accountingType.code == 'cash'; - if (accountingType.code == 'compensation') - this.receipt.description = ''; - else { - if (accountingType.receiptDescription != null && accountingType.receiptDescription != '') - this.receipt.description.push(accountingType.receiptDescription); - if (this.originalDescription) - this.receipt.description.push(this.originalDescription); - this.receipt.description = this.receipt.description.join(', '); - } - this.maxAmount = accountingType && accountingType.maxAmount; - - this.receipt.payed = Date.vnNew(); - if (accountingType.daysInFuture) - this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture); - } - } - - set deliveredAmount(value) { - this._deliveredAmount = value; - this.amountToReturn = value - this.receipt.amountPaid; - } - - get amountToReturn() { - return this._amountToReturn; - } - - set amountToReturn(value) { - if (isNaN(value)) return; - - value = value.toFixed(2); - - if (Number.isInteger(value)) - value = parseInt(value); - else value = parseFloat(value); - - this._amountToReturn = value; - } - - get deliveredAmount() { - return this._deliveredAmount; - } - - get bankFk() { - if (!this.receipt.bankFk) - this.receipt.bankFk = this.vnConfig.bankFk; - - return this.receipt.bankFk; - } - - set bankFk(value) { - this.receipt.bankFk = value; - } - - accountShortToStandard(value) { - if (value) { - this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); - const params = {bankAccount: this.receipt.compensationAccount}; - this.$http.get(`Clients/getClientOrSupplierReference`, {params}) - .then(res => { - if (res.data.clientId) { - this.receipt.description = this.$t('Client Compensation Reference', { - clientId: res.data.clientId, - clientName: res.data.clientName - }); - } else { - this.receipt.description = this.$t('Supplier Compensation Reference', { - supplierId: res.data.supplierId, - supplierName: res.data.supplierName - }); - } - }); - } else - this.receipt.description = ''; - } - - getAmountPaid() { - const filter = { - where: { - clientFk: this.$params.id, - companyFk: this.receipt.companyFk - } - }; - - this.$http.get(`ClientRisks`, {filter}).then(res => { - this.receipt.amountPaid = (res.data.length && res.data[0].amount) || null; - }); - } - - responseHandler(response) { - if (response !== 'accept') - return super.responseHandler(response); - - const exceededAmount = this.receipt.amountPaid > this.maxAmount; - const isCash = this.bankSelection.accountingType.code == 'cash'; - if (isCash && exceededAmount) - return this.vnApp.showError(this.$t('Amount exceeded', {maxAmount: this.maxAmount})); - - if (isCash && this.sendEmail && !this.receipt.email) - return this.vnApp.showError(this.$t('There is no assigned email for this client')); - - let receiptId; - return this.$http.post(`Clients/${this.clientFk}/createReceipt`, this.receipt) - .then(res => { - receiptId = res.data.id; - super.responseHandler(response); - }) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .then(() => { - if (!this.sendEmail || !isCash) return; - const params = { - recipient: this.receipt.email - }; - this.vnEmail.send(`Receipts/${receiptId}/receipt-email`, params); - }) - .then(() => { - if (this.viewReceipt) - this.vnReport.show(`Receipts/${receiptId}/receipt-pdf`); - }); - } - - bankSearchFunc($search) { - return /^\d+$/.test($search) - ? {id: $search} - : {bank: {like: '%' + $search + '%'}}; - } -} - -Controller.$inject = ['$element', '$scope', '$transclude', 'vnReport', 'vnEmail']; - -ngModule.vnComponent('vnClientBalanceCreate', { - slotTemplate: require('./index.html'), - controller: Controller, - bindings: { - payed: ' { - describe('Component vnClientBalancCreate', () => { - let controller; - let $httpBackend; - let $httpParamSerializer; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - let $scope = $rootScope.$new(); - const $element = angular.element(''); - const $transclude = { - $$boundTransclude: { - $$slots: [] - } - }; - controller = $componentController('vnClientBalanceCreate', {$element, $scope, $transclude}); - controller.receipt = { - clientFk: 1101, - companyFk: 442 - }; - controller.bankSelection = {accountingType: {code: 'myCode'}}; - })); - - describe('bankSelection() setter', () => { - it('should set the receipt description property', () => { - controller.originalDescription = 'Albaran: 1, 2'; - controller.bankSelection = { - id: 1, - bank: 'Cash', - accountingType: { - id: 2, - receiptDescription: 'Cash' - } - }; - - expect(controller.receipt.description).toEqual('Cash, Albaran: 1, 2'); - }); - }); - - describe('amountToReturn() setter', () => { - it('should set the amount to return with a maximum of two decimals', () => { - controller.amountToReturn = 200.1451789; - - expect(controller.amountToReturn).toEqual(200.15); - }); - }); - - describe('getAmountPaid()', () => { - it('should make an http GET query and then set the receipt amountPaid property', () => { - controller.$params = {id: 1101}; - const receipt = controller.receipt; - const filter = { - where: { - clientFk: 1101, - companyFk: 442 - } - }; - const serializedParams = $httpParamSerializer({filter}); - $httpBackend.expect('GET', `ClientRisks?${serializedParams}`).respond([{amount: 20}]); - controller.getAmountPaid(); - $httpBackend.flush(); - - expect(receipt.amountPaid).toEqual(20); - }); - }); - - describe('responseHandler()', () => { - it('should make an http POST query and then call to the parent responseHandler() method', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - jest.spyOn(controller.vnReport, 'show'); - - controller.$params = {id: 1101}; - - $httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1}); - controller.responseHandler('accept'); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - expect(controller.vnReport.show).not.toHaveBeenCalled(); - }); - - it('should make an http POST query and then call to the report show() method', () => { - const receiptId = 1; - - jest.spyOn(controller.vnApp, 'showSuccess'); - jest.spyOn(controller.vnReport, 'show'); - window.open = jest.fn(); - - controller.$params = {id: 1101}; - controller.viewReceipt = true; - - $httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: receiptId}); - controller.responseHandler('accept'); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - expect(controller.vnReport.show).toHaveBeenCalledWith(`Receipts/${receiptId}/receipt-pdf`); - }); - }); - - describe('deliveredAmount() setter', () => { - it('should set the deliveredAmount property', () => { - controller.amountPaid = 999; - controller.deliveredAmount = 1000; - - expect(controller.amountToReturn).toEqual(1); - }); - }); - - describe('accountShortToStandard()', () => { - it('should get de account in stardard format', () => { - const shortAccount = '4.3'; - controller.accountShortToStandard(shortAccount); - - expect(controller.receipt.compensationAccount).toEqual('4000000003'); - }); - }); - - describe('bankSearchFunc()', () => { - it('should return the filter by id property for an input of a number', () => { - const bankId = 1; - const result = controller.bankSearchFunc(bankId); - - expect(result).toEqual({id: bankId}); - }); - - it('should return the filter by bank property for an input of an string', () => { - const bankName = 'Bank of America'; - const result = controller.bankSearchFunc(bankName); - - expect(result).toEqual({bank: {like: '%' + bankName + '%'}}); - }); - }); - }); -}); diff --git a/modules/client/front/balance/create/locale/es.yml b/modules/client/front/balance/create/locale/es.yml deleted file mode 100644 index 8c407708a..000000000 --- a/modules/client/front/balance/create/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -View receipt: Ver recibo -Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}} -Client Compensation Reference: "({{clientId}}) Ntro Cliente: {{clientName}}" -Supplier Compensation Reference: "({{supplierId}}) Ntro Proveedor: {{supplierName}}" diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html deleted file mode 100644 index 34524d2f3..000000000 --- a/modules/client/front/balance/index/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - -
- - -
-
Total by company
- - -
-
-
-
- - - - - - Date - Creation date - Employee - Reference - Bank - Debit - Havings - Balance - Conciliated - - - - - - - - {{::balance.payed | date:'dd/MM/yyyy'}} - - - - - {{::balance.created | date:'dd/MM/yyyy HH:mm'}} - - - - - {{::balance.userName}} - - - - -
- - {{'BILL' | translate: {ref: balance.description} }} - - - {{balance.description}} - -
-
- - - - -
- {{::balance.bankFk}} - {{::balance.debit | currency: 'EUR':2}} - {{::balance.credit | currency: 'EUR':2}} - {{balance.balance | currency: 'EUR':2}} - - - - - - - - - - - - - - - - -
-
-
-
-
-
- - - - - - - - diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js deleted file mode 100644 index 47cefab7d..000000000 --- a/modules/client/front/balance/index/index.js +++ /dev/null @@ -1,105 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $, vnEmail) { - super($element, $); - this.vnEmail = vnEmail; - this.filter = { - include: { - relation: 'company', - scope: { - fields: ['code'], - }, - } - }; - } - - get companyId() { - if (!this._companyId) - this.companyId = this.vnConfig.companyFk; - - return this._companyId; - } - - set companyId(value) { - this._companyId = value; - - if (value) this.getData(); - } - - get balances() { - return this._balances; - } - - set balances(value) { - this._balances = value; - - const riskModel = this.$.riskModel; - if (value && riskModel.data) - this.getBalances(); - } - - get isAdministrative() { - return this.aclService.hasAny(['administrative']); - } - - getData() { - return this.$.model.applyFilter(null, { - clientId: this.$params.id, - companyId: this.companyId - }).then(() => this.$.riskModel.applyFilter({ - where: { - clientFk: this.$params.id, - companyFk: this.companyId - } - })).then(() => this.getBalances()); - } - - getCurrentBalance() { - const clientRisks = this.$.riskModel.data; - const selectedCompany = this.companyId; - const currentBalance = clientRisks.find(balance => { - return balance.companyFk === selectedCompany; - }); - - return currentBalance && currentBalance.amount; - } - - getBalances() { - const balances = this.$.model.data; - balances.forEach((balance, index) => { - if (index === 0) - balance.balance = this.getCurrentBalance(); - if (index > 0) { - let previousBalance = balances[index - 1]; - balance.balance = previousBalance.balance - (previousBalance.debit - previousBalance.credit); - } - }); - } - - showInvoiceOutDescriptor(event, balance) { - if (!balance.isInvoice) return; - if (event.defaultPrevented) return; - - this.$.invoiceOutDescriptor.show(event.target, balance.id); - } - - changeDescription(balance) { - const params = {description: balance.description}; - const endpoint = `Receipts/${balance.id}`; - this.$http.patch(endpoint, params) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); - } - - sendEmail(balance) { - return this.vnEmail.send(`Receipts/${balance.id}/balance-compensation-email`); - } -} - -Controller.$inject = ['$element', '$scope', 'vnEmail']; - -ngModule.vnComponent('vnClientBalanceIndex', { - template: require('./index.html'), - controller: Controller, -}); diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js deleted file mode 100644 index ea28cb55d..000000000 --- a/modules/client/front/balance/index/index.spec.js +++ /dev/null @@ -1,169 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientBalanceIndex', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - let $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnClientBalanceIndex', {$element, $scope}); - controller.$.model = {applyFilter: () => {}}; - controller.$.riskModel = { - applyFilter: () => {}, - data: - [{ - clientFk: 1101, - companyFk: 442, - amount: 713.24, - company: { - id: 442, - code: 'VNL' - } - }] - }; - })); - - describe('getData()', () => { - it('should apply the filters on he models and get the client balance', () => { - controller._companyId = 442; - controller.$params.id = 1101; - jest.spyOn(controller, 'getBalances').mockReturnThis(); - jest.spyOn(controller.$.model, 'applyFilter').mockReturnValue(Promise.resolve()); - jest.spyOn(controller.$.riskModel, 'applyFilter').mockReturnValue(Promise.resolve()); - - controller.getData().then(() => { - expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 1101, 'companyId': 442}); - expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 1101, 'companyFk': 442}}); - expect(controller.getBalances).toHaveBeenCalledWith(); - }); - }); - }); - - describe('company setter/getter', () => { - it('should return the company and then call getData()', () => { - jest.spyOn(controller, 'getData').mockReturnThis(); - controller.companyId = 442; - - expect(controller._companyId).toEqual(442); - expect(controller.getData).toHaveBeenCalledWith(); - }); - }); - - describe('getCurrentBalance()', () => { - it('should return the client balance amount', () => { - controller._companyId = 442; - let result = controller.getCurrentBalance(); - - expect(result).toEqual(713.24); - }); - }); - - describe('getBalances()', () => { - it('should return the total client balance amount', () => { - jest.spyOn(controller, 'getCurrentBalance'); - controller._companyId = 442; - controller.$.model = {data: - [{ - id: 1, - debit: 1000, - credit: null - }, - { - id: 2, - debit: null, - credit: 500 - }, - { - id: 3, - debit: null, - credit: 300 - } - ]}; - controller.getBalances(); - const expectedBalances = controller.$.model.data; - - expect(expectedBalances[0].balance).toEqual(713.24); - expect(expectedBalances[1].balance).toEqual(-286.76); - expect(expectedBalances[2].balance).toEqual(213.24); - }); - }); - - describe('balances() setter', () => { - it('should set the balances data and not call the getBalances() method', () => { - jest.spyOn(controller, 'getBalances'); - controller.$.riskModel.data = null; - controller.balances = [{ - id: 1, - debit: 1000, - credit: null - }, { - id: 2, - debit: null, - credit: 500 - }, { - id: 3, - debit: null, - credit: 300 - }]; - - expect(controller.balances).toBeDefined(); - expect(controller.getBalances).not.toHaveBeenCalledWith(); - }); - - it('should set the balances data and then call the getBalances() method', () => { - jest.spyOn(controller, 'getBalances').mockReturnThis(); - controller.balances = [{ - id: 1, - debit: 1000, - credit: null - }, { - id: 2, - debit: null, - credit: 500 - }, { - id: 3, - debit: null, - credit: 300 - }]; - - expect(controller.balances).toBeDefined(); - expect(controller.getBalances).toHaveBeenCalledWith(); - }); - }); - - describe('changeDescription()', () => { - it('should make an http PATCH query', () => { - const expectedParams = {description: 'Web'}; - - $httpBackend.expect('PATCH', `Receipts/1`, expectedParams).respond(200); - controller.changeDescription({ - id: 1, - description: 'Web', - accountingType: { - description: 'Cash' - } - }); - $httpBackend.flush(); - }); - }); - - describe('sendEmail()', () => { - it('should send an email', () => { - jest.spyOn(controller.vnEmail, 'send'); - - const $data = {id: 1103}; - - controller.sendEmail($data); - - const expectedPath = `Receipts/${$data.id}/balance-compensation-email`; - - expect(controller.vnEmail.send).toHaveBeenCalledWith(expectedPath); - }); - }); - }); -}); diff --git a/modules/client/front/balance/index/locale/en.yml b/modules/client/front/balance/index/locale/en.yml deleted file mode 100644 index 0b37c1a1d..000000000 --- a/modules/client/front/balance/index/locale/en.yml +++ /dev/null @@ -1,3 +0,0 @@ -BILL: N/INV {{ref}} -Notify compensation: Do you want to report compensation to the client by mail? -Send compensation: Send compensation diff --git a/modules/client/front/balance/index/locale/es.yml b/modules/client/front/balance/index/locale/es.yml deleted file mode 100644 index de710869e..000000000 --- a/modules/client/front/balance/index/locale/es.yml +++ /dev/null @@ -1,13 +0,0 @@ -Creation date: Fecha de creación -Reference: Referencia -Bank: Caja -Debit: Debe -Conciliated: Conciliado -New payment: Añadir pago -Havings: Haber -Balance: Balance -Total by company: Total por empresa -Download PDF: Descargar PDF -Send compensation: Enviar compensación -BILL: N/FRA {{ref}} -Notify compensation: ¿Desea informar de la compensación al cliente por correo? \ No newline at end of file diff --git a/modules/client/front/balance/locale/es.yml b/modules/client/front/balance/locale/es.yml deleted file mode 100644 index 53750799c..000000000 --- a/modules/client/front/balance/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Compensation: Compensación -Cash: Efectivo \ No newline at end of file diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html deleted file mode 100644 index acab99d91..000000000 --- a/modules/client/front/basic-data/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/modules/client/front/basic-data/index.js b/modules/client/front/basic-data/index.js deleted file mode 100644 index ed34eefc4..000000000 --- a/modules/client/front/basic-data/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - transferorSearchFunction($search) { - return /^\d+$/.test($search) - ? {id: $search} - : {name: {like: '%' + $search + '%'}}; - } - - onSubmit() { - return this.$.watcher.submit(); - } -} - -ngModule.vnComponent('vnClientBasicData', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/basic-data/locale/es.yml b/modules/client/front/basic-data/locale/es.yml deleted file mode 100644 index 8dc52e7ce..000000000 --- a/modules/client/front/basic-data/locale/es.yml +++ /dev/null @@ -1,16 +0,0 @@ -Comercial Name: Nombre comercial -Tax number: NIF/CIF -Social name: Razón social -Phone: Teléfono -Mobile: Móvil -Fax: Fax -Email: E-mail -Salesperson: Comercial -Channel: Canal -You can save multiple emails: >- - Puede guardar varios correos electrónicos encadenándolos mediante comas - sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer - correo electrónico el principal -Contact: Contacto -Undo changes: Deshacer cambios -Business type: Tipo de negocio \ No newline at end of file diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html deleted file mode 100644 index 39c0fc428..000000000 --- a/modules/client/front/billing-data/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - -
- - - - - - - - - - - - -
{{::bic}}
-
{{::name}}
-
- - - - -
-
- - - - - - - - -
- - - - - - -
- - diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js deleted file mode 100644 index 7056fa566..000000000 --- a/modules/client/front/billing-data/index.js +++ /dev/null @@ -1,77 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - get client() { - return this._client; - } - - set client(value) { - this._client = value; - - if (!value) return; - - if (!value.bankEntityFk) - this.autofillBic(); - } - - onSubmit() { - let shouldNotify = false; - - if (this.hasPaymethodChanges()) - shouldNotify = true; - - this.$.watcher.submit().then(() => { - if (shouldNotify) - this.vnApp.showMessage(this.$t('Notification sent!')); - }); - } - - hasPaymethodChanges() { - let orgData = this.$.watcher.orgData; - - let payMethod = orgData.payMethodFk != this.client.payMethodFk; - let iban = orgData.iban != this.client.iban; - let dueDay = orgData.dueDay != this.client.dueDay; - - return payMethod || iban || dueDay; - } - - onAccept(data) { - this.client.bankEntityFk = data.id; - } - - get ibanCountry() { - if (!this.client || !this.client.iban) return false; - - let countryCode = this.client.iban.substr(0, 2); - - return countryCode; - } - - autofillBic() { - if (!this.client || !this.client.iban) return; - - let bankEntityId = parseInt(this.client.iban.substr(4, 4)); - let filter = {where: {id: bankEntityId}}; - - if (this.ibanCountry != 'ES') return; - - this.$http.get(`BankEntities`, {filter}).then(response => { - const hasData = response.data && response.data[0]; - - if (hasData) - this.client.bankEntityFk = response.data[0].id; - else if (!hasData) - this.client.bankEntityFk = null; - }); - } -} - -ngModule.vnComponent('vnClientBillingData', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js deleted file mode 100644 index 2e9e8ba97..000000000 --- a/modules/client/front/billing-data/index.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientBillingData', () => { - let $httpBackend; - let $scope; - let controller; - let vnApp; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { - let $element = angular.element(''); - $httpBackend = _$httpBackend_; - vnApp = _vnApp_; - $scope = $rootScope.$new(); - $scope.watcher = {}; - jest.spyOn(vnApp, 'showError'); - controller = $componentController('vnClientBillingData', {$element, $scope}); - controller.client = {id: 1101, name: 'Client name', payMethodFk: 4}; - $scope.watcher.orgData = {id: 1101, name: 'Client name', payMethodFk: 4}; - })); - - describe('hasPaymethodChanges()', () => { - it(`should return true if there are changes on payMethod data`, () => { - controller.client.payMethodFk = 5; - - expect(controller.hasPaymethodChanges()).toBeTruthy(); - }); - - it(`should return false if there are no changes on payMethod data`, () => { - controller.client.payMethodFk = 4; - - expect(controller.hasPaymethodChanges()).toBeFalsy(); - }); - }); - - describe('onAccept()', () => { - it('should assign the response id to the client bankEntityFk', () => { - const expectedResponse = {id: 999}; - controller.onAccept(expectedResponse); - - expect(controller.client.bankEntityFk).toEqual(expectedResponse.id); - }); - }); - - describe('autofillBic()', () => { - it(`Should do nothing if there is not client`, () => { - controller.client = undefined; - - controller.autofillBic(); - - expect(controller.client).toBeUndefined(); - }); - - it(`Should do nothing if the iban is not spanish`, () => { - controller.client.iban = 'FR9121000418450200051332'; - - controller.autofillBic(); - - expect(controller.client.bankEntityFk).toBeUndefined(); - }); - - it(`Should set the bankEntityId in the client`, () => { - controller.client.iban = 'ES9121000418450200051332'; - - $httpBackend.whenRoute('GET', `BankEntities`).respond([{id: 123}]); - controller.autofillBic(); - $httpBackend.flush(); - - expect(controller.client.bankEntityFk).toEqual(123); - }); - - it(`Should set clients bankEntityFk to null if no bank entity founds`, () => { - controller.client.iban = 'ES9121000418450200051332'; - - $httpBackend.whenRoute('GET', `BankEntities`).respond([]); - controller.autofillBic(); - $httpBackend.flush(); - - expect(controller.client.bankEntityFk).toBeNull(); - }); - }); - - describe('ibanCountry()', () => { - it('should return a country code from iban', () => { - controller.client.iban = 'ES123'; - let countryCode = controller.ibanCountry; - - expect(countryCode).toEqual('ES'); - }); - }); - }); -}); diff --git a/modules/client/front/billing-data/locale/en.yml b/modules/client/front/billing-data/locale/en.yml deleted file mode 100644 index 20177159b..000000000 --- a/modules/client/front/billing-data/locale/en.yml +++ /dev/null @@ -1,14 +0,0 @@ -Changed terms: Payment terms have changed -Notify customer?: Do you want to notify customer? -No: No -Yes, notify: Yes, notify -Notification sent!: Notification sent! -Notification error: Error while sending notification -Yes, propagate: Yes, propagate -Equivalent tax spreaded: Equivalent tax spreaded -Invoice by address: Invoice by address -Equalization tax: Equalization tax -Due day: Due day -Received core VNL: VNL core received -Received B2B VNL: VNL B2B received -Save: Save \ No newline at end of file diff --git a/modules/client/front/billing-data/locale/es.yml b/modules/client/front/billing-data/locale/es.yml deleted file mode 100644 index 0052ee403..000000000 --- a/modules/client/front/billing-data/locale/es.yml +++ /dev/null @@ -1,17 +0,0 @@ -Changed terms: Has modificado las condiciones de pago -Notify customer?: ¿Deseas notificar al cliente de dichos cambios? -No: No -Yes, notify: Sí, notificar -Notification sent!: ¡Notificación enviada! -Notification error: Error al enviar notificación -Yes, propagate: Si, propagar -Equivalent tax spreaded: Recargo de equivalencia propagado -Invoice by address: Facturar por consignatario -Equalization tax: Recargo de equivalencia -Due day: Vencimiento -Received LCR: Recibido LCR -Received core VNL: Recibido core VNL -Received B2B VNL: Recibido B2B VNL -Save: Guardar -New bank entity: Nueva entidad bancaria -Name can't be empty: El nombre no puede quedar vacío \ No newline at end of file diff --git a/modules/client/front/card/index.html b/modules/client/front/card/index.html deleted file mode 100644 index b4fe95820..000000000 --- a/modules/client/front/card/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/modules/client/front/card/index.js b/modules/client/front/card/index.js deleted file mode 100644 index 76a4711d1..000000000 --- a/modules/client/front/card/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import ngModule from '../module'; -import ModuleCard from 'salix/components/module-card'; - -export default class Controller extends ModuleCard { - reload() { - this.$http.get(`Clients/${this.$params.id}/getCard`) - .then(res => this.client = res.data); - } -} - -ngModule.vnComponent('vnClientCard', { - template: require('./index.html'), - controller: Controller -}); - diff --git a/modules/client/front/card/index.spec.js b/modules/client/front/card/index.spec.js deleted file mode 100644 index 979497253..000000000 --- a/modules/client/front/card/index.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCard', () => { - let controller; - let $httpBackend; - let data = {id: 1, name: 'fooName'}; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { - $httpBackend = _$httpBackend_; - - let $element = angular.element('
'); - controller = $componentController('vnClientCard', {$element}); - - $stateParams.id = data.id; - $httpBackend.whenRoute('GET', 'Clients/:id/getCard').respond(data); - })); - - it('should request data and set it on the controller', () => { - controller.$onInit(); - $httpBackend.flush(); - - expect(controller.client).toEqual(data); - }); - }); -}); diff --git a/modules/client/front/consumption-search-panel/index.html b/modules/client/front/consumption-search-panel/index.html deleted file mode 100644 index c113ee601..000000000 --- a/modules/client/front/consumption-search-panel/index.html +++ /dev/null @@ -1,85 +0,0 @@ -
-
- - - - - - - - - - - - - -
{{name}}
-
- {{category.name}} -
-
-
- - -
- - - - {{code}} {{dated | date: 'yyyy'}} - - - - - - - - - - - - -
-
diff --git a/modules/client/front/consumption-search-panel/index.js b/modules/client/front/consumption-search-panel/index.js deleted file mode 100644 index 465d24afd..000000000 --- a/modules/client/front/consumption-search-panel/index.js +++ /dev/null @@ -1,56 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -class Controller extends SearchPanel { - constructor($, $element) { - super($, $element); - - this.filter = this.$.filter; - - if (!this.dateParams) - this.getUpcomingCampaing(); - } - - get dateParams() { - if (this.$params.q) { - const params = JSON.parse(this.$params.q); - - if (params.from || params.to) - return true; - } - - return false; - } - - getUpcomingCampaing() { - this.$http.get('Campaigns/upcoming').then(res => { - this.filter.campaign = res.data.id; - }); - } - - onChangeDate(value) { - if (value) - this.filter.campaign = null; - } - - get campaignSelection() { - return this._campaignSelection; - } - - set campaignSelection(value) { - this._campaignSelection = value; - - if (value) { - const from = new Date(value.dated); - from.setDate(from.getDate() - value.scopeDays); - - this.filter.to = value.dated; - this.filter.from = from; - } - } -} - -ngModule.vnComponent('vnConsumptionSearchPanel', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/consumption-search-panel/index.spec.js b/modules/client/front/consumption-search-panel/index.spec.js deleted file mode 100644 index 7209fe3c3..000000000 --- a/modules/client/front/consumption-search-panel/index.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import './index.js'; - -describe('Client', () => { - describe('Component vnConsumptionSearchPanel', () => { - let $httpBackend; - let $element; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $element = angular.element(`
`); - controller = $componentController('vnConsumptionSearchPanel', {$element}); - controller.$.filter = {}; - $httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 1}); - })); - - describe('getUpcomingCampaing()', () => { - it(`should make an HTTP query and then set the campaign property`, () => { - $httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 2, code: 'allSaints'}); - controller.getUpcomingCampaing(); - $httpBackend.flush(); - - const filter = controller.$.filter; - - expect(filter.campaign).toEqual(2); - }); - }); - }); -}); diff --git a/modules/client/front/consumption-search-panel/locale/en.yml b/modules/client/front/consumption-search-panel/locale/en.yml deleted file mode 100644 index 03364d7cf..000000000 --- a/modules/client/front/consumption-search-panel/locale/en.yml +++ /dev/null @@ -1,3 +0,0 @@ -allSaints: All Saints Day -valentinesDay: Valentine's Day -mothersDay: Mother's day \ No newline at end of file diff --git a/modules/client/front/consumption-search-panel/locale/es.yml b/modules/client/front/consumption-search-panel/locale/es.yml deleted file mode 100644 index f136283f8..000000000 --- a/modules/client/front/consumption-search-panel/locale/es.yml +++ /dev/null @@ -1,7 +0,0 @@ -Item id: Id artículo -From: Desde -To: Hasta -Campaign: Campaña -allSaints: Día de todos los Santos -valentinesDay: Día de San Valentín -mothersDay: Día de la madre \ No newline at end of file diff --git a/modules/client/front/consumption/index.html b/modules/client/front/consumption/index.html deleted file mode 100644 index 06611da5a..000000000 --- a/modules/client/front/consumption/index.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - -
- - - - - - - - -
- - - - Item - Ticket - Fecha - Description - Quantity - - - - - - - {{::sale.itemFk}} - - - - - {{::sale.ticketFk}} - - - {{::sale.shipped | date: 'dd/MM/yyyy'}} - -
- {{::sale.concept}} - -

{{::sale.subName}}

-
-
- - -
- {{::sale.quantity | dashIfEmpty}} -
-
-
-
- - - - - - diff --git a/modules/client/front/consumption/index.js b/modules/client/front/consumption/index.js deleted file mode 100644 index eb3a10dd6..000000000 --- a/modules/client/front/consumption/index.js +++ /dev/null @@ -1,75 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $, vnReport, vnEmail) { - super($element, $); - this.vnReport = vnReport; - this.vnEmail = vnEmail; - - this.filter = { - where: { - isPackaging: false - } - }; - - this.setDefaultFilter(); - } - - setDefaultFilter() { - const minDate = Date.vnNew(); - minDate.setHours(0, 0, 0, 0); - minDate.setMonth(minDate.getMonth() - 2); - - const maxDate = Date.vnNew(); - maxDate.setHours(23, 59, 59, 59); - - this.filterParams = { - from: minDate, - to: maxDate - }; - } - - get reportParams() { - const userParams = this.$.model.userParams; - return Object.assign({ - recipient: this.client.email, - recipientId: this.client.id - }, userParams); - } - - showTicketDescriptor(event, sale) { - if (!sale.isTicket) return; - - this.$.ticketDescriptor.show(event.target, sale.origin); - } - - showReport() { - const path = `Clients/${this.client.id}/campaign-metrics-pdf`; - this.vnReport.show(path, this.reportParams); - } - - sendEmail() { - const path = `Clients/${this.client.id}/campaign-metrics-email`; - this.vnEmail.send(path, this.reportParams); - } - - changeGrouped(value) { - const model = this.$.model; - - model.addFilter({}, {grouped: value}); - } -} - -Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; - -ngModule.vnComponent('vnClientConsumption', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - }, - require: { - card: '^vnClientCard' - } -}); diff --git a/modules/client/front/consumption/index.spec.js b/modules/client/front/consumption/index.spec.js deleted file mode 100644 index f2acddbca..000000000 --- a/modules/client/front/consumption/index.spec.js +++ /dev/null @@ -1,67 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('Client', () => { - describe('Component vnClientConsumption', () => { - let $scope; - let controller; - let $httpParamSerializer; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { - $scope = $rootScope.$new(); - $httpParamSerializer = _$httpParamSerializer_; - $httpBackend = _$httpBackend_; - const $element = angular.element(' { - it('should call the window.open function', () => { - jest.spyOn(window, 'open').mockReturnThis(); - - const now = Date.vnNew(); - controller.$.model.userParams = { - from: now, - to: now - }; - - controller.showReport(); - - const clientId = controller.client.id; - const expectedParams = { - recipientId: clientId, - from: now, - to: now - }; - const serializedParams = $httpParamSerializer(expectedParams); - const expectedPath = `api/Clients/${clientId}/campaign-metrics-pdf?${serializedParams}`; - - expect(window.open).toHaveBeenCalledWith(expectedPath); - }); - }); - - describe('sendEmail()', () => { - it('should make a GET query sending the report', () => { - const now = Date.vnNew(); - controller.$.model.userParams = { - from: now, - to: now - }; - const clientId = controller.client.id; - const expectedPath = `Clients/${clientId}/campaign-metrics-email`; - - $httpBackend.expect('POST', expectedPath).respond({}); - controller.sendEmail(); - $httpBackend.flush(); - }); - }); - }); -}); - diff --git a/modules/client/front/consumption/locale/es.yml b/modules/client/front/consumption/locale/es.yml deleted file mode 100644 index adf0f060c..000000000 --- a/modules/client/front/consumption/locale/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -Group by item: Agrupar por artículo -Open as PDF: Abrir como PDF -Send to email: Enviar por email -Search by item id or name: Buscar por id de artículo o nombre -The consumption report will be sent: Se enviará el informe de consumo -Please, confirm: Por favor, confirma diff --git a/modules/client/front/contact/index.html b/modules/client/front/contact/index.html deleted file mode 100644 index eab1f33ce..000000000 --- a/modules/client/front/contact/index.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/client/front/contact/index.js b/modules/client/front/contact/index.js deleted file mode 100644 index d79c7645a..000000000 --- a/modules/client/front/contact/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - add() { - this.$.model.insert({ - clientFk: this.client.id, - name: this.$t('Phone'), - phone: null - }); - } - - onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - }); - } -} - -ngModule.vnComponent('vnClientContact', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/create/index.html b/modules/client/front/create/index.html deleted file mode 100644 index abd974cbf..000000000 --- a/modules/client/front/create/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - - - - - - - - -
- - - diff --git a/modules/client/front/create/index.js b/modules/client/front/create/index.js deleted file mode 100644 index 631029802..000000000 --- a/modules/client/front/create/index.js +++ /dev/null @@ -1,95 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.client = { - active: true - }; - } - - onSubmit() { - return this.$.watcher.submit().then(json => { - this.$state.go('client.card.basicData', {id: json.data.id}); - }); - } - - get province() { - return this._province; - } - - // Province auto complete - set province(selection) { - this._province = selection; - - if (!selection) return; - - const country = selection.country; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - this._town = selection; - - if (!selection) return; - - const province = selection.province; - const country = province.country; - const postcodes = selection.postcodes; - - if (!this.client.provinceFk) - this.client.provinceFk = province.id; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - - if (postcodes.length === 1) - this.client.postcode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - this._postcode = selection; - - if (!selection) return; - - const town = selection.town; - const province = town.province; - const country = province.country; - - if (!this.client.city) - this.client.city = town.name; - - if (!this.client.provinceFk) - this.client.provinceFk = province.id; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - } - - onResponse(response) { - this.client.postcode = response.code; - this.client.city = response.city; - this.client.provinceFk = response.provinceFk; - this.client.countryFk = response.countryFk; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/create/index.spec.js b/modules/client/front/create/index.spec.js deleted file mode 100644 index 24fc80d21..000000000 --- a/modules/client/front/create/index.spec.js +++ /dev/null @@ -1,122 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCreate', () => { - let $scope; - let $state; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $scope.watcher = { - submit: () => { - return { - then: callback => { - callback({data: {id: '1234'}}); - } - }; - } - }; - const $element = angular.element(''); - controller = $componentController('vnClientCreate', {$element, $scope}); - })); - - it('should define and set scope, state and client properties', () => { - expect(controller.$).toBe($scope); - expect(controller.$state).toBe($state); - expect(controller.client.active).toBe(true); - }); - - describe('onSubmit()', () => { - it(`should call submit() on the watcher then expect a callback`, () => { - jest.spyOn($state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.basicData', {id: '1234'}); - }); - }); - - describe('province() setter', () => { - it(`should set countryFk property`, () => { - controller.client.countryFk = null; - controller.province = { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }; - - expect(controller.client.countryFk).toEqual(2); - }); - }); - - describe('town() setter', () => { - it(`should set provinceFk property`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [] - }; - - expect(controller.client.provinceFk).toEqual(1); - }); - - it(`should set provinceFk property and fill the postalCode if there's just one`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [{code: '46001'}] - }; - - expect(controller.client.provinceFk).toEqual(1); - expect(controller.client.postcode).toEqual('46001'); - }); - }); - - describe('postcode() setter', () => { - it(`should set the town, provinceFk and contryFk properties`, () => { - controller.postcode = { - townFk: 1, - code: 46001, - town: { - id: 1, - name: 'New York', - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - } - } - }; - - expect(controller.client.city).toEqual('New York'); - expect(controller.client.provinceFk).toEqual(1); - expect(controller.client.countryFk).toEqual(2); - }); - }); - }); -}); diff --git a/modules/client/front/create/locale/es.yml b/modules/client/front/create/locale/es.yml deleted file mode 100644 index 31b7cd403..000000000 --- a/modules/client/front/create/locale/es.yml +++ /dev/null @@ -1,11 +0,0 @@ -Name: Nombre -Tax number: NIF/CIF -Business name: Razón social -Web user: Usuario Web -Email: E-mail -Create and edit: Crear y editar -You can save multiple emails: >- - Puede guardar varios correos electrónicos encadenándolos mediante comas - sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer - correo electrónico el principal -The type of business must be filled in basic data: El tipo de negocio debe estar rellenado en datos básicos diff --git a/modules/client/front/credit-insurance/create/index.html b/modules/client/front/credit-insurance/create/index.html deleted file mode 100644 index c32d0a87b..000000000 --- a/modules/client/front/credit-insurance/create/index.html +++ /dev/null @@ -1,37 +0,0 @@ -
- - - - - - - - - - - - - - - - -
diff --git a/modules/client/front/credit-insurance/create/index.js b/modules/client/front/credit-insurance/create/index.js deleted file mode 100644 index e3138e459..000000000 --- a/modules/client/front/credit-insurance/create/index.js +++ /dev/null @@ -1,40 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.creditClassification = { - started: this.$filter('date')(Date.vnNew(), 'yyyy-MM-dd HH:mm') - }; - } - - onSubmit() { - if (this.$.form.$invalid) - return this.vnApp.showError(this.$t('Some fields are invalid')); - - let query = `creditClassifications/createWithInsurance`; - let data = this.creditClassification; - data.clientFk = this.client.id; - - this.$http.post(query, data).then(res => { - if (res.data) { - this.card.reload(); - this.$state.go('client.card.creditInsurance.index'); - } - }); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientCreditInsuranceCreate', { - template: require('./index.html'), - controller: Controller, - require: { - card: '^vnClientCard' - }, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/credit-insurance/create/index.spec.js b/modules/client/front/credit-insurance/create/index.spec.js deleted file mode 100644 index c50afd5cf..000000000 --- a/modules/client/front/credit-insurance/create/index.spec.js +++ /dev/null @@ -1,48 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCreditInsuranceCreate', () => { - let controller; - let $scope; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $scope.form = { - $invalid: false - }; - const $element = angular.element(''); - controller = $componentController('vnClientCreditInsuranceCreate', {$element, $scope}); - controller.client = {id: 1101}; - controller.card = { - reload: () => {} - }; - })); - - describe('onSubmit()', () => { - it('should perform a POST query', () => { - let started = Date.vnNew(); - controller.creditClassification = { - started: started, - credit: 300, - grade: 1 - }; - - let newData = { - started: started, - credit: 300, - grade: 1, - clientFk: 1101 - }; - - $httpBackend.whenPOST(`creditClassifications/createWithInsurance`, newData).respond(200, true); - $httpBackend.expectPOST(`creditClassifications/createWithInsurance`, newData); - controller.onSubmit(); - $httpBackend.flush(); - }); - }); - }); -}); diff --git a/modules/client/front/credit-insurance/index/index.html b/modules/client/front/credit-insurance/index/index.html deleted file mode 100644 index 3f5c5f023..000000000 --- a/modules/client/front/credit-insurance/index/index.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - -
Since {{::classification.started | date:'dd/MM/yyyy'}}
-
To {{classification.finished | date:'dd/MM/yyyy'}}
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - \ No newline at end of file diff --git a/modules/client/front/credit-insurance/index/index.js b/modules/client/front/credit-insurance/index/index.js deleted file mode 100644 index b40025c65..000000000 --- a/modules/client/front/credit-insurance/index/index.js +++ /dev/null @@ -1,68 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - $onChanges() { - if (this.client && this.client.id) - this._getClassifications(this.client.id); - } - - _getClassifications(clientId) { - let filter = { - order: 'finished ASC, started DESC', - include: [ - { - relation: 'insurances', - scope: { - fields: ['id', 'credit', 'created', 'grade'], - order: 'created DESC', - limit: 2 - } - } - - ], - where: {client: clientId} - }; - filter = encodeURIComponent(JSON.stringify(filter)); - - let query = `CreditClassifications?filter=${filter}`; - this.$http.get(query).then(res => { - if (res.data) - this.classifications = res.data; - }); - } - - canCreateNew() { - if (!this.classifications) - return false; - - let items = this.classifications; - for (let i = 0; i < items.length; i++) { - if (!items[i].finished) - return false; - } - - return true; - } - - closeContract(classification) { - this.classificationId = classification.id; - this.$.closeContract.show(); - } - - returnDialog() { - let params = {finished: Date.vnNow()}; - this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => { - this._getClassifications(this.client.id); - }); - } -} - -ngModule.vnComponent('vnClientCreditInsuranceIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js deleted file mode 100644 index af072691a..000000000 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ /dev/null @@ -1,88 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCreditInsuranceIndex', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnClientCreditInsuranceIndex', {$element, $scope}); - controller.client = {id: 1101}; - })); - - describe('_getClassifications()', () => { - it('should perform a GET query to define the classifications property in the controller', () => { - let res = ['some classifications']; - let query = 'CreditClassifications?filter=%7B%22order%22%3A%22finished%20ASC%2C%20started%20DESC%22%2C%22include%22%3A%5B%7B%22relation%22%3A%22insurances%22%2C%22scope%22%3A%7B%22fields%22%3A%5B%22id%22%2C%22credit%22%2C%22created%22%2C%22grade%22%5D%2C%22order%22%3A%22created%20DESC%22%2C%22limit%22%3A2%7D%7D%5D%2C%22where%22%3A%7B%7D%7D'; - - $httpBackend.whenGET(query).respond(res); - $httpBackend.expectGET(query); - controller._getClassifications(); - $httpBackend.flush(); - - expect(controller.classifications).toEqual(['some classifications']); - }); - }); - - describe('canCreateNew()', () => { - it(`should return false if doesn't have classifications`, () => { - let result = controller.canCreateNew(); - - expect(result).toBeFalsy(); - }); - - it(`should return false if finds a classification without due date`, () => { - controller.classifications = [ - {finished: Date.vnNow()}, - {finished: null} - ]; - - let result = controller.canCreateNew(); - - expect(result).toBeFalsy(); - }); - - it(`should return true if all classifications are defined with due date`, () => { - controller.classifications = [ - {finished: Date.vnNow()}, - {finished: Date.vnNow()} - ]; - - let result = controller.canCreateNew(); - - expect(result).toBeTruthy(); - }); - }); - - describe('closeContract()', () => { - it('should define the classificationId property of the controller and then call the show method()', () => { - controller.$.closeContract = {show: () => {}}; - jest.spyOn(controller.$.closeContract, 'show'); - - expect(controller.classificationId).toBeFalsy(); - controller.closeContract({id: 1}); - - expect(controller.classificationId).toEqual(1); - expect(controller.$.closeContract.show).toHaveBeenCalledWith(); - }); - }); - - describe('returnDialog()', () => { - it('should call the returnDialog method and perform a PATCH query, then call _getClassifications method', () => { - jest.spyOn(controller, '_getClassifications').mockReturnThis(); - controller.classificationId = 1; - $httpBackend.expect('PATCH', `CreditClassifications/1`).respond(200); - controller.returnDialog(); - $httpBackend.flush(); - - expect(controller._getClassifications).toHaveBeenCalledWith(1101); - }); - }); - }); -}); diff --git a/modules/client/front/credit-insurance/index/locale/es.yml b/modules/client/front/credit-insurance/index/locale/es.yml deleted file mode 100644 index 014faffbe..000000000 --- a/modules/client/front/credit-insurance/index/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -Contract credit insurance: Contratos de seguro de crédito -Close contract: Cerrar contrato -View credits: Ver créditos -Are you sure you want to close this contract?: ¿Seguro que quieres cerrar este contrato? \ No newline at end of file diff --git a/modules/client/front/credit-insurance/index/style.scss b/modules/client/front/credit-insurance/index/style.scss deleted file mode 100644 index 6b4f25e2c..000000000 --- a/modules/client/front/credit-insurance/index/style.scss +++ /dev/null @@ -1,5 +0,0 @@ -vn-client-credit-insurance-index{ - .insurance:last-child { - padding-bottom: 0; - } -} \ No newline at end of file diff --git a/modules/client/front/credit-insurance/insurance/create/index.html b/modules/client/front/credit-insurance/insurance/create/index.html deleted file mode 100644 index 0a3189bd1..000000000 --- a/modules/client/front/credit-insurance/insurance/create/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/client/front/credit-insurance/insurance/create/index.js b/modules/client/front/credit-insurance/insurance/create/index.js deleted file mode 100644 index 9eae5bfa9..000000000 --- a/modules/client/front/credit-insurance/insurance/create/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import ngModule from '../../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.insurance = { - created: this.$filter('date')(Date.vnNew(), 'yyyy-MM-dd HH:mm:ss') - }; - } - - onSubmit() { - let params = {classificationId: this.$params.classificationId}; - let state = 'client.card.creditInsurance.insurance.index'; - - this.$.watcher.submitGo(state, params).then(() => { - this.card.reload(); - }); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientCreditInsuranceInsuranceCreate', { - template: require('./index.html'), - controller: Controller, - require: { - card: '^vnClientCard' - }, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/credit-insurance/insurance/index/index.html b/modules/client/front/credit-insurance/insurance/index/index.html deleted file mode 100644 index a3a4478bc..000000000 --- a/modules/client/front/credit-insurance/insurance/index/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - -
- - - - - - Created - Grade - Credit - - - - - {{::insurance.created | date: 'dd/MM/yyyy'}} - {{::insurance.grade}} - {{::insurance.credit | currency: 'EUR': 2}} - - - - - -
- - - \ No newline at end of file diff --git a/modules/client/front/credit-insurance/insurance/index/index.js b/modules/client/front/credit-insurance/insurance/index/index.js deleted file mode 100644 index 193a0b088..000000000 --- a/modules/client/front/credit-insurance/insurance/index/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import ngModule from '../../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.isClosed = true; - this.filter = { - include: [ - {relation: 'classification'} - ] - }; - } - - $onInit() { - let filter = { - fields: ['finished'], - where: {id: this.$params.classificationId} - }; - filter = encodeURIComponent(JSON.stringify(filter)); - - let query = `CreditClassifications?filter=${filter}`; - this.$http.get(query).then(res => { - if (res.data) - this.isClosed = res.data[0].finished != null; - }); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientCreditInsuranceInsuranceIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/credit-insurance/insurance/index/index.spec.js b/modules/client/front/credit-insurance/insurance/index/index.spec.js deleted file mode 100644 index 34e557fa4..000000000 --- a/modules/client/front/credit-insurance/insurance/index/index.spec.js +++ /dev/null @@ -1,33 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCreditInsuranceInsuranceIndex', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$element, $scope}); - controller.$params = {classificationId: 1}; - })); - - describe('$onInit()', () => { - it('should perform a query to GET credit the credit classification', () => { - let res = [{finished: 'some value'}]; - let query = 'CreditClassifications?filter=%7B%22fields%22%3A%5B%22finished%22%5D%2C%22where%22%3A%7B%22id%22%3A1%7D%7D'; - - $httpBackend.whenGET(query).respond(res); - $httpBackend.expectGET(query); - controller.$onInit(); - $httpBackend.flush(); - - expect(controller.isClosed).toBe(true); - }); - }); - }); -}); diff --git a/modules/client/front/credit-insurance/insurance/index/locale/es.yml b/modules/client/front/credit-insurance/insurance/index/locale/es.yml deleted file mode 100644 index 84ce712a0..000000000 --- a/modules/client/front/credit-insurance/insurance/index/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Created: Creado \ No newline at end of file diff --git a/modules/client/front/credit-management/index.html b/modules/client/front/credit-management/index.html deleted file mode 100644 index f66b988f5..000000000 --- a/modules/client/front/credit-management/index.html +++ /dev/null @@ -1,79 +0,0 @@ - - - -
- - - - - - - - - - - - -
- - - - - - - - - Since - Employee - Rating - Recommended credit - - - - - {{::clientInforma.created | date:'dd/MM/yyyy HH:mm'}} - - - {{::clientInforma.worker.user.nickname}} - - - {{::clientInforma.rating}} - {{::clientInforma.recommendedCredit | currency: 'EUR'}} - - - - - - - diff --git a/modules/client/front/credit-management/index.js b/modules/client/front/credit-management/index.js deleted file mode 100644 index 7733319e8..000000000 --- a/modules/client/front/credit-management/index.js +++ /dev/null @@ -1,32 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.filter = { - include: [{ - relation: 'worker', - scope: { - fields: ['id'], - include: { - relation: 'user', - scope: { - fields: ['nickname'] - } - } - } - }], - }; - } - onSubmit() { - this.$.watcher.submit() - .then(() => this.$state.reload()); - } -} - -ngModule.vnComponent('vnClientCreditManagement', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/credit-management/locale/es.yml b/modules/client/front/credit-management/locale/es.yml deleted file mode 100644 index 8743a1fb9..000000000 --- a/modules/client/front/credit-management/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Recommended credit: Crédito recomendado -Rating: Clasificación diff --git a/modules/client/front/credit/create/index.html b/modules/client/front/credit/create/index.html deleted file mode 100644 index 13ba434d0..000000000 --- a/modules/client/front/credit/create/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - -
- - - - - - - - - - - - -
- - diff --git a/modules/client/front/credit/create/index.js b/modules/client/front/credit/create/index.js deleted file mode 100644 index 3c1d376ed..000000000 --- a/modules/client/front/credit/create/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - onSubmit() { - this.$http.get(`Recoveries/${this.$params.id}/hasActiveRecovery`).then(res => { - let activeRecovery = res.data; - if (activeRecovery) - this.$.confirmation.show(); - else - this.addCredit(); - }); - } - - cancel() { - this.goToIndex(); - } - - returnDialog() { - this.addCredit(); - } - - goToIndex() { - this.$state.go('client.card.credit.index'); - } - - addCredit() { - this.$.watcher.submit().then( - () => { - this.goToIndex(); - } - ); - } -} - -ngModule.vnComponent('vnClientCreditCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/credit/create/index.spec.js b/modules/client/front/credit/create/index.spec.js deleted file mode 100644 index f8deb6911..000000000 --- a/modules/client/front/credit/create/index.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientCreditCreate', () => { - let controller; - let $httpBackend; - let $state; - let $scope; - let client; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $scope.confirmation = {show: () => { - return { - then: () => {} - }; - }}; - $scope.watcher = { - submit: () => { - return { - then: callback => { - callback(); - } - }; - } - }; - client = {credit: 0}; - $state = _$state_; - $state.params.id = 1101; - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientCreditCreate', {$element, $scope}); - })); - - describe('onSubmit()', () => { - it('should perform a query to check (GET) if the client has an active recovery', () => { - $httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(true); - $httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`); - controller.onSubmit(); - $httpBackend.flush(); - }); - - it('should call show() method when the client have a recovery', () => { - jest.spyOn(controller.$.confirmation, 'show'); - $httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(true); - $httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`); - controller.onSubmit(); - $httpBackend.flush(); - - expect(controller.$.confirmation.show).toHaveBeenCalledWith(); - }); - - it('should call addCredit() method when the client doesnt have a recovery', () => { - jest.spyOn(controller, 'addCredit'); - $httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(false); - $httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`); - controller.onSubmit(); - $httpBackend.flush(); - - expect(controller.addCredit).toHaveBeenCalledWith(); - }); - }); - - describe('cancel()', () => { - it('should call goToIndex()', () => { - jest.spyOn(controller, 'goToIndex'); - controller.cancel(); - - expect(controller.goToIndex).toHaveBeenCalledWith(); - }); - }); - - describe('returnDialog()', () => { - it('should call addCredit() when is called with accept', () => { - jest.spyOn(controller, 'addCredit'); - controller.returnDialog(); - - expect(controller.addCredit).toHaveBeenCalledWith(); - }); - }); - - describe('addCredit()', () => { - it('should call the function go() on $state to go to the credit list', () => { - jest.spyOn($state, 'go'); - client.credit = 1; - controller.addCredit(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.credit.index'); - }); - }); - }); -}); diff --git a/modules/client/front/credit/index/index.html b/modules/client/front/credit/index/index.html deleted file mode 100644 index d11449268..000000000 --- a/modules/client/front/credit/index/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - Since - Employee - Credit - - - - - {{::credit.created | date:'dd/MM/yyyy HH:mm'}} - - - {{::credit.worker.user.name}} - - - {{::credit.amount | currency:'EUR':2}} - - - - - - - - - diff --git a/modules/client/front/credit/index/index.js b/modules/client/front/credit/index/index.js deleted file mode 100644 index 3083ac598..000000000 --- a/modules/client/front/credit/index/index.js +++ /dev/null @@ -1,31 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'worker', - scope: { - fields: ['id'], - include: { - relation: 'user', - scope: { - fields: ['name'] - } - } - } - } - ] - }; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientCreditIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/credit/index/locale/es.yml b/modules/client/front/credit/index/locale/es.yml deleted file mode 100644 index a15a1085f..000000000 --- a/modules/client/front/credit/index/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Since : Desde -Employee : Empleado \ No newline at end of file diff --git a/modules/client/front/defaulter/index.html b/modules/client/front/defaulter/index.html deleted file mode 100644 index 33bb751f1..000000000 --- a/modules/client/front/defaulter/index.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - -
-
-
Total
- - -
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - Client - - Es trabajador - - Comercial - - Country - - P.Method - - Balance D. - - Author - - Last observation - - L. O. Date - - Credit I. - - From -
- - - - - {{::defaulter.clientName}} - - - - - - - {{::defaulter.salesPersonName | dashIfEmpty}} - - - {{::defaulter.country}} - - {{::defaulter.payMethod}} - {{::defaulter.amount | currency: 'EUR': 2}} - - {{::defaulter.workerName | dashIfEmpty}} - - - - - - - {{::defaulter.created | date: 'dd/MM/yyyy'}} - - {{::defaulter.creditInsurance | currency: 'EUR': 2}}{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}
-
-
-
- - - - - - - - - - - - -
-
{{$ctrl.$t('Add observation to all selected clients', {total: $ctrl.checked.length})}}
- - - - -
-
- - - - -
diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js deleted file mode 100644 index bc8686c10..000000000 --- a/modules/client/front/defaulter/index.js +++ /dev/null @@ -1,199 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import UserError from 'core/lib/user-error'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.defaulter = {}; - this.defaulters = []; - this.checkedDefaulers = []; - - this.smartTableOptions = { - activeButtons: { - search: true - }, - columns: [ - { - field: 'clientFk', - autocomplete: { - url: 'Clients', - showField: 'name', - valueField: 'id' - } - }, { - field: 'salesPersonFk', - autocomplete: { - url: 'Workers/activeWithInheritedRole', - where: `{role: 'salesPerson'}`, - searchFunction: '{firstName: $search}', - showField: 'name', - valueField: 'id', - } - }, { - field: 'countryFk', - autocomplete: { - url: 'Countries', - showField: 'country', - valueField: 'id' - } - }, { - field: 'payMethodFk', - autocomplete: { - showField: 'name', - valueField: 'id' - } - }, - { - field: 'workerFk', - autocomplete: { - url: 'Workers/activeWithInheritedRole', - searchFunction: '{firstName: $search}', - showField: 'name', - valueField: 'id', - } - }, - { - field: 'observation', - searchable: false - }, - { - field: 'created', - datepicker: true - }, - { - field: 'defaulterSinced', - datepicker: true - } - ] - }; - - this.getBalanceDueTotal(); - } - - set defaulters(value) { - if (!value || !value.length) return; - for (let defaulter of value) - defaulter.isWorker = defaulter.businessTypeFk === 'worker'; - - this._defaulters = value; - } - - get defaulters() { - return this._defaulters; - } - - get checked() { - const clients = this.$.model.data || []; - const checkedLines = []; - for (let defaulter of clients) { - if (defaulter.checked) - checkedLines.push(defaulter); - } - - return checkedLines; - } - - saveChecked(clientId) { - this.checkedDefaulers = this.checkedDefaulers.includes(clientId) ? - this.checkedDefaulers.filter(id => id !== clientId) : [...this.checkedDefaulers, clientId]; - } - - reCheck() { - if (!this.$.model.data || !this.checkedDefaulers.length) return; - - this.$.model.data.forEach(defaulter => { - defaulter.checked = this.checkedDefaulers.includes(defaulter.clientFk); - }); - } - - getBalanceDueTotal() { - this.$http.get('Defaulters/filter') - .then(res => { - if (!res.data) return 0; - - this.balanceDueTotal = res.data.reduce( - (accumulator, currentValue) => { - return accumulator + (currentValue['amount'] || 0); - }, 0); - }); - } - - chipColor(date) { - const day = 24 * 60 * 60 * 1000; - const today = Date.vnNew(); - today.setHours(0, 0, 0, 0); - - const observationShipped = new Date(date); - observationShipped.setHours(0, 0, 0, 0); - - const difference = today - observationShipped; - - if (difference > (day * 20)) - return 'alert'; - if (difference > (day * 10)) - return 'warning'; - } - - onResponse() { - if (!this.defaulter.observation) - throw new UserError(`The message can't be empty`); - - const params = []; - for (let defaulter of this.checked) { - params.push({ - text: this.defaulter.observation, - clientFk: defaulter.clientFk - }); - } - - this.$http.post(`ClientObservations`, params) .then(() => { - this.vnApp.showSuccess(this.$t('Observation saved!')); - this.sendMail(); - this.$state.reload(); - }); - } - - sendMail() { - const params = { - defaulters: this.checked, - observation: this.defaulter.observation, - }; - this.$http.post(`Defaulters/observationEmail`, params); - } - - exprBuilder(param, value) { - switch (param) { - case 'creditInsurance': - case 'amount': - case 'clientFk': - case 'workerFk': - case 'countryFk': - case 'payMethod': - case 'salesPersonFk': - return {[`d.${param}`]: value}; - case 'created': - return {'d.created': { - between: this.dateRange(value)} - }; - case 'defaulterSinced': - return {'d.defaulterSinced': { - between: this.dateRange(value)} - }; - } - } - - dateRange(value) { - const minHour = new Date(value); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(value); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } -} - -ngModule.vnComponent('vnClientDefaulter', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/defaulter/index.spec.js b/modules/client/front/defaulter/index.spec.js deleted file mode 100644 index b4a9df184..000000000 --- a/modules/client/front/defaulter/index.spec.js +++ /dev/null @@ -1,179 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('client defaulter', () => { - describe('Component vnClientDefaulter', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientDefaulter', {$element}); - controller.$.model = crudModel; - controller.$.model.data = [ - {clientFk: 1101, amount: 125}, - {clientFk: 1102, amount: 500}, - {clientFk: 1103, amount: 250} - ]; - })); - - describe('checked() getter', () => { - it('should return the checked lines', () => { - const data = controller.$.model.data; - data[1].checked = true; - data[2].checked = true; - - const checkedRows = controller.checked; - - const firstCheckedRow = checkedRows[0]; - const secondCheckedRow = checkedRows[1]; - - expect(firstCheckedRow.clientFk).toEqual(1102); - expect(secondCheckedRow.clientFk).toEqual(1103); - }); - }); - - describe('chipColor()', () => { - it('should return undefined when the date is the present', () => { - let today = Date.vnNew(); - let result = controller.chipColor(today); - - expect(result).toEqual(undefined); - }); - - it('should return warning when the date is 10 days in the past', () => { - let pastDate = Date.vnNew(); - pastDate = pastDate.setDate(pastDate.getDate() - 11); - let result = controller.chipColor(pastDate); - - expect(result).toEqual('warning'); - }); - - it('should return alert when the date is 20 days in the past', () => { - let pastDate = Date.vnNew(); - pastDate = pastDate.setDate(pastDate.getDate() - 21); - let result = controller.chipColor(pastDate); - - expect(result).toEqual('alert'); - }); - }); - - describe('onResponse()', () => { - it('should return error for empty message', () => { - let error; - try { - controller.onResponse(); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.message).toBe(`The message can't be empty`); - }); - - it('should return saved message', () => { - const data = controller.$.model.data; - data[1].checked = true; - controller.defaulter = {observation: 'My new observation'}; - - const params = [{text: controller.defaulter.observation, clientFk: data[1].clientFk}]; - - jest.spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expect('GET', `Defaulters/filter`).respond(200); - $httpBackend.expect('POST', `ClientObservations`, params).respond(200, params); - $httpBackend.expect('POST', `Defaulters/observationEmail`).respond(200); - - controller.onResponse(); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Observation saved!'); - }); - }); - - describe('exprBuilder()', () => { - it('should search by sales person', () => { - const expr = controller.exprBuilder('salesPersonFk', '5'); - - expect(expr).toEqual({'d.salesPersonFk': '5'}); - }); - - it('should search by client', () => { - const expr = controller.exprBuilder('clientFk', '5'); - - expect(expr).toEqual({'d.clientFk': '5'}); - }); - }); - - describe('getBalanceDueTotal()', () => { - it('should return balance due total', () => { - const defaulters = controller.$.model.data; - $httpBackend.when('GET', `Defaulters/filter`).respond(defaulters); - - controller.getBalanceDueTotal(); - $httpBackend.flush(); - - expect(controller.balanceDueTotal).toEqual(875); - }); - }); - - describe('dateRange()', () => { - it('should return two dates with the hours at the start and end of the given date', () => { - const now = Date.vnNew(); - - const today = now.getDate(); - - const dateRange = controller.dateRange(now); - const start = dateRange[0].toString(); - const end = dateRange[1].toString(); - - expect(start).toContain(today); - expect(start).toContain('00:00:00'); - - expect(end).toContain(today); - expect(end).toContain('23:59:59'); - }); - }); - - describe('reCheck()', () => { - it(`should recheck buys`, () => { - controller.$.model.data = [ - {checked: false, clientFk: 1}, - {checked: false, clientFk: 2}, - {checked: false, clientFk: 3}, - {checked: false, clientFk: 4}, - ]; - controller.checkedDefaulers = [1, 2]; - - controller.reCheck(); - - expect(controller.$.model.data[0].checked).toEqual(true); - expect(controller.$.model.data[1].checked).toEqual(true); - expect(controller.$.model.data[2].checked).toEqual(false); - expect(controller.$.model.data[3].checked).toEqual(false); - }); - }); - - describe('saveChecked()', () => { - it(`should check buy`, () => { - const buyCheck = 3; - controller.checkedDefaulers = [1, 2]; - - controller.saveChecked(buyCheck); - - expect(controller.checkedDefaulers[2]).toEqual(buyCheck); - }); - - it(`should uncheck buy`, () => { - const buyUncheck = 3; - controller.checkedDefaulers = [1, 2, 3]; - - controller.saveChecked(buyUncheck); - - expect(controller.checkedDefaulers[2]).toEqual(undefined); - }); - }); - }); -}); diff --git a/modules/client/front/defaulter/locale/es.yml b/modules/client/front/defaulter/locale/es.yml deleted file mode 100644 index 7d93d4fe2..000000000 --- a/modules/client/front/defaulter/locale/es.yml +++ /dev/null @@ -1,14 +0,0 @@ -Add observation: Añadir observación -Add observation to all selected clients: Añadir observación a {{total}} cliente(s) seleccionado(s) -Balance D.: Saldo V. -Credit I.: Crédito A. -Last observation: Última observación -L. O. Date: Fecha Ú. O. -Last observation date: Fecha última observación -Search client: Buscar clientes -Worker who made the last observation: Trabajador que ha realizado la última observación -Email sended!: Email enviado! -Observation saved!: Observación añadida! -P.Method: F.Pago -Pay Method: Forma de Pago -Country: Pais \ No newline at end of file diff --git a/modules/client/front/descriptor-popover/index.html b/modules/client/front/descriptor-popover/index.html deleted file mode 100644 index 28c271abc..000000000 --- a/modules/client/front/descriptor-popover/index.html +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/client/front/descriptor-popover/index.js b/modules/client/front/descriptor-popover/index.js deleted file mode 100644 index 12f7a1664..000000000 --- a/modules/client/front/descriptor-popover/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import ngModule from '../module'; -import DescriptorPopover from 'salix/components/descriptor-popover'; - -class Controller extends DescriptorPopover {} - -ngModule.vnComponent('vnClientDescriptorPopover', { - slotTemplate: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html deleted file mode 100644 index f2dbd64b6..000000000 --- a/modules/client/front/descriptor/index.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - Simple ticket - - - Send SMS - - - -
- - - - - - - - - - - {{$ctrl.client.salesPersonUser.name}} - - - - -
-
- - - - - - - - - - - - -
- -
-
- - - - - - - diff --git a/modules/client/front/descriptor/index.js b/modules/client/front/descriptor/index.js deleted file mode 100644 index cdabf13e7..000000000 --- a/modules/client/front/descriptor/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import ngModule from '../module'; -import Descriptor from 'salix/components/descriptor'; - -class Controller extends Descriptor { - get entity() { - return super.entity; - } - - set entity(value) { - super.entity = value; - - if (value && this.$params.sendSMS) - this.showSMSDialog(); - } - - get client() { - return this.entity; - } - - set client(value) { - this.entity = value; - } - - get filter() { - return JSON.stringify({clientFk: this.id}); - } - - loadData() { - return this.getData(`Clients/${this.id}/getCard`) - .then(res => this.entity = res.data); - } - - showSMSDialog() { - const client = this.client || {}; - this.newSMS = { - destinationFk: this.id, - destination: this.$params.phone || client.mobile || client.phone, - message: this.$params.message || '' - }; - this.$.sms.open(); - } - - onSmsSend(sms) { - return this.$http.post(`Clients/${this.id}/sendSms`, sms) - .then(() => this.vnApp.showSuccess(this.$t('SMS sent'))); - } - - clientUnpaid() { - return this.$t(`Unpaid`) + '
' - + this.$t(`Unpaid Dated`, {dated: this.client.unpaid.dated}) + '
' - + this.$t(`Unpaid Amount`, {amount: this.client.unpaid.amount}); - } -} - -ngModule.vnComponent('vnClientDescriptor', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/descriptor/index.spec.js b/modules/client/front/descriptor/index.spec.js deleted file mode 100644 index 1a123d901..000000000 --- a/modules/client/front/descriptor/index.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import './index'; - -describe('vnClientDescriptor', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnClientDescriptor', {$element: null}); - })); - - describe('loadData()', () => { - it(`should perform a get query to store the client data into the controller`, () => { - const id = 1; - const response = 'foo'; - - $httpBackend.expectGET(`Clients/${id}/getCard`).respond(response); - controller.id = id; - $httpBackend.flush(); - - expect(controller.client).toEqual(response); - }); - }); -}); diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml deleted file mode 100644 index 776b67698..000000000 --- a/modules/client/front/descriptor/locale/es.yml +++ /dev/null @@ -1,11 +0,0 @@ -Simple ticket: Ticket simple -View consumer report: Ver informe de consumo -From date: Fecha desde -To date: Fecha hasta -Go to user: Ir al usuario -Go to supplier: Ir al proveedor -Client invoices list: Listado de facturas del cliente -Pay method: Forma de pago -Unpaid Dated: "Fecha: {{dated | date:'dd/MM/yyyy'}}" -Unpaid Amount: "Importe: {{amount | currency: 'EUR':2}}" -Business type: Tipo de negocio \ No newline at end of file diff --git a/modules/client/front/dms/create/index.html b/modules/client/front/dms/create/index.html deleted file mode 100644 index 8f270378f..000000000 --- a/modules/client/front/dms/create/index.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/client/front/dms/create/index.js b/modules/client/front/dms/create/index.js deleted file mode 100644 index 461d0aa36..000000000 --- a/modules/client/front/dms/create/index.js +++ /dev/null @@ -1,113 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.dms = { - files: [], - hasFile: false, - hasFileAttached: false - }; - } - - get client() { - return this._client; - } - - set client(value) { - this._client = value; - - if (value) { - this.setDefaultParams(); - this.getAllowedContentTypes(); - } - } - - getAllowedContentTypes() { - this.$http.get('DmsContainers/allowedContentTypes').then(res => { - const contentTypes = res.data.join(', '); - this.allowedContentTypes = contentTypes; - }); - } - - get contentTypesInfo() { - return this.$t('ContentTypesInfo', { - allowedContentTypes: this.allowedContentTypes - }); - } - - setDefaultParams() { - const params = {filter: { - where: {code: 'paymentsLaw'} - }}; - this.$http.get('DmsTypes/findOne', {params}).then(res => { - const dmsType = res.data && res.data; - const companyId = this.vnConfig.companyFk; - const warehouseId = this.vnConfig.warehouseFk; - const defaultParams = { - reference: this.client.id, - warehouseId: warehouseId, - companyId: companyId, - dmsTypeId: dmsType.id, - description: this.$t('ClientFileDescription', { - dmsTypeName: dmsType.name, - clientId: this.client.id, - clientName: this.client.name - }).toUpperCase() - }; - - this.dms = Object.assign(this.dms, defaultParams); - }); - } - - onSubmit() { - const query = `clients/${this.client.id}/uploadFile`; - const options = { - method: 'POST', - url: query, - params: this.dms, - headers: { - 'Content-Type': undefined - }, - transformRequest: files => { - const formData = new FormData(); - - for (let i = 0; i < files.length; i++) - formData.append(files[i].name, files[i]); - - return formData; - }, - data: this.dms.files - }; - this.$http(options).then(res => { - if (res) { - this.vnApp.showSuccess(this.$t('Data saved!')); - this.$.watcher.updateOriginalData(); - this.$state.go('client.card.dms.index'); - } - }); - } - - onFileChange(files) { - let hasFileAttached = false; - - if (files.length > 0) - hasFileAttached = true; - - this.$.$applyAsync(() => { - this.dms.hasFileAttached = hasFileAttached; - }); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientDmsCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js deleted file mode 100644 index fe302f7d2..000000000 --- a/modules/client/front/dms/create/index.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientDmsCreate', () => { - let controller; - let $scope; - let $httpBackend; - let $httpParamSerializer; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - const $element = angular.element(''); - controller = $componentController('vnClientDmsCreate', {$element, $scope}); - controller._client = {id: 1101, name: 'Bruce wayne'}; - })); - - describe('client() setter', () => { - it('should set the client data and then call setDefaultParams() and getAllowedContentTypes()', () => { - jest.spyOn(controller, 'setDefaultParams'); - jest.spyOn(controller, 'getAllowedContentTypes'); - controller.client = { - id: 15, - name: 'Bruce wayne' - }; - - expect(controller.client).toBeDefined(); - expect(controller.setDefaultParams).toHaveBeenCalledWith(); - expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); - }); - }); - - describe('setDefaultParams()', () => { - it('should perform a GET query and define the dms property on controller', () => { - const params = {filter: { - where: {code: 'paymentsLaw'} - }}; - let serializedParams = $httpParamSerializer(params); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'}); - controller.setDefaultParams(); - $httpBackend.flush(); - - expect(controller.dms).toBeDefined(); - expect(controller.dms.reference).toEqual(1101); - expect(controller.dms.dmsTypeId).toEqual(12); - }); - }); - - describe('onFileChange()', () => { - it('should set dms hasFileAttached property to true if has any files', () => { - const files = [{id: 1, name: 'MyFile'}]; - controller.onFileChange(files); - $scope.$apply(); - - expect(controller.dms.hasFileAttached).toBeTruthy(); - }); - }); - - describe('getAllowedContentTypes()', () => { - it('should make an HTTP GET request to get the allowed content types', () => { - const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); - controller.getAllowedContentTypes(); - $httpBackend.flush(); - - expect(controller.allowedContentTypes).toBeDefined(); - expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); - }); - }); - }); -}); diff --git a/modules/client/front/dms/create/style.scss b/modules/client/front/dms/create/style.scss deleted file mode 100644 index 73f136fc1..000000000 --- a/modules/client/front/dms/create/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -vn-ticket-request { - .vn-textfield { - margin: 0!important; - max-width: 100px; - } -} - diff --git a/modules/client/front/dms/edit/index.html b/modules/client/front/dms/edit/index.html deleted file mode 100644 index 2d653c827..000000000 --- a/modules/client/front/dms/edit/index.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/client/front/dms/edit/index.js b/modules/client/front/dms/edit/index.js deleted file mode 100644 index 8765eeff2..000000000 --- a/modules/client/front/dms/edit/index.js +++ /dev/null @@ -1,94 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - get client() { - return this._client; - } - - set client(value) { - this._client = value; - - if (value) { - this.setDefaultParams(); - this.getAllowedContentTypes(); - } - } - - getAllowedContentTypes() { - this.$http.get('DmsContainers/allowedContentTypes').then(res => { - const contentTypes = res.data.join(', '); - this.allowedContentTypes = contentTypes; - }); - } - - get contentTypesInfo() { - return this.$t('ContentTypesInfo', { - allowedContentTypes: this.allowedContentTypes - }); - } - - setDefaultParams() { - const path = `Dms/${this.$params.dmsId}`; - this.$http.get(path).then(res => { - const dms = res.data && res.data; - this.dms = { - reference: dms.reference, - warehouseId: dms.warehouseFk, - companyId: dms.companyFk, - dmsTypeId: dms.dmsTypeFk, - description: dms.description, - hasFile: dms.hasFile, - hasFileAttached: false, - files: [] - }; - }); - } - - onSubmit() { - const query = `dms/${this.$params.dmsId}/updateFile`; - const options = { - method: 'POST', - url: query, - params: this.dms, - headers: { - 'Content-Type': undefined - }, - transformRequest: files => { - const formData = new FormData(); - - for (let i = 0; i < files.length; i++) - formData.append(files[i].name, files[i]); - - return formData; - }, - data: this.dms.files - }; - this.$http(options).then(res => { - if (res) { - this.vnApp.showSuccess(this.$t('Data saved!')); - this.$.watcher.updateOriginalData(); - this.$state.go('client.card.dms.index'); - } - }); - } - - onFileChange(files) { - let hasFileAttached = false; - if (files.length > 0) - hasFileAttached = true; - - this.$.$applyAsync(() => { - this.dms.hasFileAttached = hasFileAttached; - }); - } -} - -ngModule.vnComponent('vnClientDmsEdit', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js deleted file mode 100644 index 155b1aba3..000000000 --- a/modules/client/front/dms/edit/index.spec.js +++ /dev/null @@ -1,81 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientDmsEdit', () => { - let controller; - let $scope; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientDmsEdit', {$element, $scope}); - controller._client = {id: 1}; - controller.$params = {dmsId: 1}; - })); - - describe('client() setter', () => { - it('should set the client data and then call setDefaultParams() and getAllowedContentTypes()', () => { - jest.spyOn(controller, 'setDefaultParams'); - jest.spyOn(controller, 'getAllowedContentTypes'); - controller._client = undefined; - controller.client = { - id: 15 - }; - - expect(controller.setDefaultParams).toHaveBeenCalledWith(); - expect(controller.client).toBeDefined(); - expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); - }); - }); - - describe('setDefaultParams()', () => { - it('should perform a GET query and define the dms property on controller', () => { - const dmsId = 1; - const expectedResponse = { - reference: 1101, - warehouseFk: 1, - companyFk: 442, - dmsTypeFk: 12, - description: 'Test', - hasFile: false, - hasFileAttached: false - }; - - $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); - controller.setDefaultParams(); - $httpBackend.flush(); - - expect(controller.dms).toBeDefined(); - expect(controller.dms.reference).toEqual(1101); - expect(controller.dms.dmsTypeId).toEqual(12); - }); - }); - - describe('onFileChange()', () => { - it('should set dms hasFileAttached property to true if has any files', () => { - const files = [{id: 1, name: 'MyFile'}]; - controller.dms = {hasFileAttached: false}; - controller.onFileChange(files); - $scope.$apply(); - - expect(controller.dms.hasFileAttached).toBeTruthy(); - }); - }); - - describe('getAllowedContentTypes()', () => { - it('should make an HTTP GET request to get the allowed content types', () => { - const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); - controller.getAllowedContentTypes(); - $httpBackend.flush(); - - expect(controller.allowedContentTypes).toBeDefined(); - expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); - }); - }); - }); -}); diff --git a/modules/client/front/dms/edit/style.scss b/modules/client/front/dms/edit/style.scss deleted file mode 100644 index 73f136fc1..000000000 --- a/modules/client/front/dms/edit/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -vn-ticket-request { - .vn-textfield { - margin: 0!important; - max-width: 100px; - } -} - diff --git a/modules/client/front/dms/index/index.html b/modules/client/front/dms/index/index.html deleted file mode 100644 index 7098fcbbd..000000000 --- a/modules/client/front/dms/index/index.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - Id - Type - Order - Reference - Description - Original - File - Employee - Created - - - - - - - - {{::document.dmsFk}} - - - {{::document.dms.dmsType.name}} - - - - - {{::document.dms.hardCopyNumber}} - - - - - {{::document.dms.reference}} - - - - - {{::document.dms.description}} - - - - - - - - - {{::document.dms.file}} - - - - - {{::document.dms.worker.user.name | dashIfEmpty}} - - - {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}} - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/client/front/dms/index/index.js b/modules/client/front/dms/index/index.js deleted file mode 100644 index aff64aa4f..000000000 --- a/modules/client/front/dms/index/index.js +++ /dev/null @@ -1,64 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $, vnFile) { - super($element, $, vnFile); - this.vnFile = vnFile; - this.filter = { - include: { - relation: 'dms', - scope: { - fields: [ - 'dmsTypeFk', - 'reference', - 'hardCopyNumber', - 'workerFk', - 'description', - 'hasFile', - 'file', - 'created', - ], - include: [{ - relation: 'dmsType', - scope: { - fields: ['name'] - } - }, { - relation: 'worker', - scope: { - fields: ['id'], - include: { - relation: 'user', - scope: { - fields: ['name'] - } - }, - } - }] - }, - } - }; - } - - deleteDms(index) { - const dmsFk = this.clientDms[index].dmsFk; - return this.$http.post(`ClientDms/${dmsFk}/removeFile`) - .then(() => { - this.$.model.remove(index); - this.vnApp.showSuccess(this.$t('Data saved!')); - }); - } - - downloadFile(dmsId) { - this.vnFile.download(`api/dms/${dmsId}/downloadFile`); - } -} - -Controller.$inject = ['$element', '$scope', 'vnFile']; - -ngModule.vnComponent('vnClientDmsIndex', { - template: require('./index.html'), - controller: Controller, -}); diff --git a/modules/client/front/dms/index/index.spec.js b/modules/client/front/dms/index/index.spec.js deleted file mode 100644 index 71c8d74a9..000000000 --- a/modules/client/front/dms/index/index.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('Client', () => { - describe('Component vnClientDmsIndex', () => { - let $scope; - let $httpBackend; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - controller = $componentController('vnClientDmsIndex', {$element: null, $scope}); - controller.$.model = crudModel; - })); - - describe('deleteDms()', () => { - it('should make an HTTP Post query', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - jest.spyOn(controller.$.model, 'remove'); - - const dmsId = 1; - const dmsIndex = 0; - controller.clientDms = [{dmsFk: 1}]; - - $httpBackend.expectPOST(`ClientDms/${dmsId}/removeFile`).respond(); - controller.deleteDms(dmsIndex); - $httpBackend.flush(); - - expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex); - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/modules/client/front/dms/index/locale/es.yml b/modules/client/front/dms/index/locale/es.yml deleted file mode 100644 index 0994c7d86..000000000 --- a/modules/client/front/dms/index/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Type: Tipo -File management: Gestión documental -File: Fichero -Hard copy: Copia -This file will be deleted: Este fichero va a ser borrado -Are you sure?: Estas seguro? -File deleted: Fichero eliminado -Remove file: Eliminar fichero -Download file: Descargar fichero \ No newline at end of file diff --git a/modules/client/front/dms/index/style.scss b/modules/client/front/dms/index/style.scss deleted file mode 100644 index a6758e2e6..000000000 --- a/modules/client/front/dms/index/style.scss +++ /dev/null @@ -1,6 +0,0 @@ -vn-client-risk-index { - .totalBox { - display: table; - float: right; - } -} \ No newline at end of file diff --git a/modules/client/front/dms/locale/en.yml b/modules/client/front/dms/locale/en.yml deleted file mode 100644 index 766853fca..000000000 --- a/modules/client/front/dms/locale/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -ClientFileDescription: "{{dmsTypeName}} from client {{clientName}} id {{clientId}}" -ContentTypesInfo: Allowed file types {{allowedContentTypes}} \ No newline at end of file diff --git a/modules/client/front/dms/locale/es.yml b/modules/client/front/dms/locale/es.yml deleted file mode 100644 index 4185098f3..000000000 --- a/modules/client/front/dms/locale/es.yml +++ /dev/null @@ -1,14 +0,0 @@ -Upload file: Subir fichero -Edit file: Editar fichero -Upload: Subir -File: Fichero -ClientFileDescription: "{{dmsTypeName}} del cliente {{clientName}} id {{clientId}}" -ContentTypesInfo: "Tipos de archivo permitidos: {{allowedContentTypes}}" -Generate identifier for original file: Generar identificador para archivo original -File management: Gestión documental -Hard copy: Copia -This file will be deleted: Este fichero va a ser borrado -Are you sure?: Estas seguro? -File deleted: Fichero eliminado -Remove file: Eliminar fichero -Download file: Descargar fichero \ No newline at end of file diff --git a/modules/client/front/extended-list/index.html b/modules/client/front/extended-list/index.html deleted file mode 100644 index 784e88b8a..000000000 --- a/modules/client/front/extended-list/index.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Identifier - - Name - - Social name - - Tax number - - Salesperson - - Credit - - Credit insurance - - Phone - - Mobile - - Street - - Country - - Province - - City - - Postcode - - Email - - Created - - Business type - - Billing data - - Sage tax type - - Sage tr. type - - Active - - Vies - - Verified data - - Is equalizated - - Freezed - - Invoice - - Invoice by address - - Mailing - - Received LCR - - Received core VNL - - Received B2B VNL -
- - - - - - - {{::client.id}} - - {{::client.name}}{{::client.socialName}}{{::client.fi}} - - {{::client.salesPerson | dashIfEmpty}} - - {{::client.credit}}{{::client.creditInsurance | dashIfEmpty}}{{::client.phone | dashIfEmpty}}{{::client.mobile | dashIfEmpty}}{{::client.street | dashIfEmpty}}{{::client.country | dashIfEmpty}}{{::client.province | dashIfEmpty}}{{::client.city | dashIfEmpty}}{{::client.postcode | dashIfEmpty}}{{::client.email | dashIfEmpty}}{{::client.created | date:'dd/MM/yyyy'}}{{::client.businessType | dashIfEmpty}}{{::client.payMethod | dashIfEmpty}}{{::client.sageTaxType | dashIfEmpty}}{{::client.sageTransactionType | dashIfEmpty}} - - {{ ::client.isActive ? 'Yes' : 'No' | translate}} - - - - {{ ::client.isVies ? 'Yes' : 'No' | translate}} - - - - {{ ::client.isTaxDataChecked ? 'Yes' : 'No' | translate}} - - - - {{ ::client.isEqualizated ? 'Yes' : 'No' | translate}} - - - - {{ ::client.isFreezed ? 'Yes' : 'No' | translate}} - - - - {{ ::client.hasToInvoice ? 'Yes' : 'No' | translate}} - - - - {{ ::client.hasToInvoiceByAddress ? 'Yes' : 'No' | translate}} - - - - {{ ::client.isToBeMailed ? 'Yes' : 'No' | translate}} - - - - {{ ::client.hasLcr ? 'Yes' : 'No' | translate}} - - - - {{ ::client.hasCoreVnl ? 'Yes' : 'No' | translate}} - - - - {{ ::client.hasSepaVnl ? 'Yes' : 'No' | translate}} - - - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - - \ No newline at end of file diff --git a/modules/client/front/extended-list/index.js b/modules/client/front/extended-list/index.js deleted file mode 100644 index 208d77539..000000000 --- a/modules/client/front/extended-list/index.js +++ /dev/null @@ -1,184 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.smartTableOptions = { - activeButtons: { - search: true, - shownColumns: true, - }, - columns: [ - { - field: 'socialName', - autocomplete: { - url: 'Clients', - showField: 'socialName', - valueField: 'socialName', - } - }, - { - field: 'created', - datepicker: true - }, - { - field: 'countryFk', - autocomplete: { - url: 'Countries', - showField: 'name', - } - }, - { - field: 'provinceFk', - autocomplete: { - url: 'Provinces' - } - }, - { - field: 'salesPersonFk', - autocomplete: { - url: 'Workers/activeWithInheritedRole', - where: `{role: 'salesPerson'}`, - searchFunction: '{firstName: $search}', - showField: 'nickname', - valueField: 'id', - } - }, - { - field: 'businessTypeFk', - autocomplete: { - url: 'BusinessTypes', - valueField: 'code', - showField: 'description', - } - }, - { - field: 'payMethodFk', - autocomplete: { - url: 'PayMethods', - } - }, - { - field: 'sageTaxTypeFk', - autocomplete: { - url: 'SageTaxTypes', - showField: 'vat', - } - }, - { - field: 'sageTransactionTypeFk', - autocomplete: { - url: 'SageTransactionTypes', - showField: 'transaction', - } - }, - { - field: 'isActive', - checkbox: true - }, - { - field: 'isVies', - checkbox: true - }, - { - field: 'isTaxDataChecked', - checkbox: true - }, - { - field: 'isEqualizated', - checkbox: true - }, - { - field: 'isFreezed', - checkbox: true - }, - { - field: 'hasToInvoice', - checkbox: true - }, - { - field: 'hasToInvoiceByAddress', - checkbox: true - }, - { - field: 'isToBeMailed', - checkbox: true - }, - { - field: 'hasSepaVnl', - checkbox: true - }, - { - field: 'hasLcr', - checkbox: true - }, - { - field: 'hasCoreVnl', - checkbox: true - } - ] - }; - } - - exprBuilder(param, value) { - switch (param) { - case 'created': - return {'c.created': { - between: this.dateRange(value)} - }; - case 'id': - case 'name': - case 'socialName': - case 'fi': - case 'credit': - case 'creditInsurance': - case 'phone': - case 'mobile': - case 'street': - case 'city': - case 'postcode': - case 'email': - case 'isActive': - case 'isVies': - case 'isTaxDataChecked': - case 'isEqualizated': - case 'isFreezed': - case 'hasToInvoice': - case 'hasToInvoiceByAddress': - case 'isToBeMailed': - case 'hasSepaVnl': - case 'hasLcr': - case 'hasCoreVnl': - case 'countryFk': - case 'provinceFk': - case 'salesPersonFk': - case 'businessTypeFk': - case 'payMethodFk': - case 'sageTaxTypeFk': - case 'sageTransactionTypeFk': - return {[`c.${param}`]: value}; - } - } - - dateRange(value) { - const minHour = new Date(value); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(value); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } - - preview(client) { - this.clientSelected = client; - this.$.preview.show(); - } -} - -ngModule.vnComponent('vnClientExtendedList', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/extended-list/locale/es.yml b/modules/client/front/extended-list/locale/es.yml deleted file mode 100644 index ea56f3af2..000000000 --- a/modules/client/front/extended-list/locale/es.yml +++ /dev/null @@ -1,3 +0,0 @@ -Mailing: Env. emails -Sage tr. type: Tipo tr. sage -Yes: Sí \ No newline at end of file diff --git a/modules/client/front/extended-list/style.scss b/modules/client/front/extended-list/style.scss deleted file mode 100644 index 7625b5d16..000000000 --- a/modules/client/front/extended-list/style.scss +++ /dev/null @@ -1,6 +0,0 @@ -@import "variables"; - -vn-chip.success, -vn-chip.alert { - color: $color-font-bg -} \ No newline at end of file diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html deleted file mode 100644 index 979f45fcc..000000000 --- a/modules/client/front/fiscal-data/index.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - -
- - - - - - - - - - - - - - - - {{id}}: {{transaction}} - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js deleted file mode 100644 index acad38185..000000000 --- a/modules/client/front/fiscal-data/index.js +++ /dev/null @@ -1,189 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - $onInit() { - this.card.reload(); - } - - onSubmit() { - const orgData = this.$.watcher.orgData; - delete this.client.despiteOfClient; - - const hasContactData = this.client.email || this.client.phone || this.client.mobile; - const hasChangedTaxData = !orgData.isTaxDataChecked && this.client.isTaxDataChecked; - - const shouldInvoice = this.client.isActive && !this.client.hasToInvoice; - const clientActivation = this.client.isActive && (orgData.isActive != this.client.isActive); - if (shouldInvoice && clientActivation) { - this.client.hasToInvoice = true; - this.vnApp.showMessage(this.$t('Client invoices enabled')); - } - - if (hasChangedTaxData && hasContactData) - this.checkExistingClient(); - else this.save(); - } - - checkExistingClient() { - const findParams = []; - if (this.client.email) - findParams.push({email: this.client.email}); - - if (this.client.phone) - findParams.push({phone: this.client.phone}); - - if (this.client.mobile) - findParams.push({mobile: this.client.mobile}); - - const filterObj = { - where: { - and: [ - {or: findParams}, - {id: {neq: this.client.id}} - ] - } - }; - - const $t = this.$translate.instant; - const filter = encodeURIComponent(JSON.stringify(filterObj)); - const query = `Clients/findOne?filter=${filter}`; - this.$http.get(query).then(res => { - const params = {clientId: res.data.id}; - const question = $t('Found a client with this phone or email', params, null, null, 'sanitizeParameters'); - - this.client.despiteOfClient = params.clientId; - this.$.confirmDuplicatedClient.question = question; - this.$.confirmDuplicatedClient.show(); - }).catch(error => { - if (error.status == 404) - return this.save(); - throw error; - }); - } - - checkEtChanges(orgData) { - const equalizatedHasChanged = orgData.isEqualizated != this.client.isEqualizated; - const hasToInvoiceByAddress = orgData.hasToInvoiceByAddress || this.client.hasToInvoiceByAddress; - - if (equalizatedHasChanged && hasToInvoiceByAddress) - this.$.propagateIsEqualizated.show(); - else if (equalizatedHasChanged) - return this.onAcceptEt(); - - return this.$q.resolve(); - } - - onAcceptEt() { - const query = `Clients/${this.client.id}/addressesPropagateRe`; - return this.$http.patch(query, {isEqualizated: this.client.isEqualizated}).then( - () => this.vnApp.showMessage(this.$t('Equivalent tax spreaded')) - ); - } - - onAcceptDuplication() { - this.save(); - - return true; - } - - save() { - const orgData = this.$.watcher.orgData; - const clonedOrgData = JSON.parse(JSON.stringify(orgData)); - return this.$.watcher.submit().then( - () => this.checkEtChanges(clonedOrgData)); - } - - onChangeEqualizated(value) { - const orgData = this.$.watcher.orgData; - if (value === true) - this.client.hasToInvoiceByAddress = false; - else if (orgData.hasToInvoiceByAddress) - this.client.hasToInvoiceByAddress = true; - - this.$.$apply(); - } - - get province() { - return this._province; - } - - // Province auto complete - set province(selection) { - const oldValue = this._province; - this._province = selection; - - if (!selection || !oldValue) return; - - const country = selection.country; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - const oldValue = this._town; - this._town = selection; - - if (!selection || !oldValue) return; - - const province = selection.province; - const country = province.country; - const postcodes = selection.postcodes; - - if (!this.client.provinceFk) - this.client.provinceFk = province.id; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - - if (!this.client.postcode && postcodes.length === 1) - this.client.postcode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - const oldValue = this._postcode; - this._postcode = selection; - - if (!selection || !oldValue) return; - - const town = selection.town; - const province = town.province; - const country = province.country; - - if (!this.client.city) - this.client.city = town.name; - - if (!this.client.provinceFk) - this.client.provinceFk = province.id; - - if (!this.client.countryFk) - this.client.countryFk = country.id; - } - - onResponse(response) { - this.client.postcode = response.code; - this.client.city = response.city; - this.client.provinceFk = response.provinceFk; - this.client.countryFk = response.countryFk; - } -} - -ngModule.vnComponent('vnClientFiscalData', { - template: require('./index.html'), - controller: Controller, - require: {card: '^vnClientCard'}, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js deleted file mode 100644 index 609ba5121..000000000 --- a/modules/client/front/fiscal-data/index.spec.js +++ /dev/null @@ -1,225 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Client', () => { - describe('Component vnClientFiscalData', () => { - let $httpBackend; - let $scope; - let $element; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $scope.watcher = watcher; - $scope.watcher.orgData = {id: 1101, isEqualizated: false, isTaxDataChecked: false}; - $element = angular.element(''); - controller = $componentController('vnClientFiscalData', {$element, $scope}); - controller.card = {reload: () => {}}; - controller.client = { - id: 1101, - email: 'batman@gothamcity.com', - phone: '1111111111', - isEqualizated: false, - isTaxDataChecked: false - }; - - controller._province = {}; - controller._town = {}; - controller._postcode = {}; - })); - - describe('onSubmit()', () => { - it('should call the save() method directly', () => { - jest.spyOn(controller, 'save'); - - controller.onSubmit(); - - expect(controller.save).toHaveBeenCalledWith(); - }); - - it('should call the checkExistingClient() if the isTaxDataChecked property is checked', () => { - jest.spyOn(controller, 'save'); - jest.spyOn(controller, 'checkExistingClient'); - - controller.client.isTaxDataChecked = true; - controller.onSubmit(); - - expect(controller.save).not.toHaveBeenCalledWith(); - expect(controller.checkExistingClient).toHaveBeenCalledWith(); - }); - - it('should enable the hasToInvoice property any time the form activates the client with isActive', () => { - $scope.watcher.orgData.isActive = false; - controller.client.isActive = true; - controller.client.hasToInvoice = false; - - controller.onSubmit(); - - expect(controller.client.hasToInvoice).toBe(true); - }); - }); - - describe('checkExistingClient()', () => { - it(`should make a HTTP GET query filtering by email, phone and mobile`, () => { - controller.client.mobile = 222222222; - const filterObj = { - where: { - and: [ - {or: [ - {email: controller.client.email}, - {phone: controller.client.phone}, - {mobile: controller.client.mobile} - ]}, - {id: {neq: controller.client.id}} - ] - } - }; - const filter = encodeURIComponent(JSON.stringify(filterObj)); - $httpBackend.expect('GET', `Clients/findOne?filter=${filter}`).respond(404); - controller.checkExistingClient(); - $httpBackend.flush(); - }); - - it(`should show a save confirmation and then set the despiteOfClient property`, () => { - controller.$.confirmDuplicatedClient = {show: () => {}}; - jest.spyOn(controller.$.confirmDuplicatedClient, 'show'); - - const filterObj = { - where: { - and: [ - {or: [{email: controller.client.email}, {phone: controller.client.phone}]}, - {id: {neq: controller.client.id}} - ] - } - }; - const expectedClient = {id: 1102}; - const filter = encodeURIComponent(JSON.stringify(filterObj)); - $httpBackend.expect('GET', `Clients/findOne?filter=${filter}`).respond(expectedClient); - controller.checkExistingClient(); - $httpBackend.flush(); - - expect(controller.$.confirmDuplicatedClient.show).toHaveBeenCalledWith(); - expect(controller.client.despiteOfClient).toEqual(1102); - }); - }); - - describe('checkEtChanges()', () => { - it(`should show a propagation confirmation if isEqualizated property is changed and invoice by address is checked`, () => { - controller.$.propagateIsEqualizated = {show: () => {}}; - jest.spyOn(controller.$.propagateIsEqualizated, 'show'); - - const orgData = $scope.watcher.orgData; - orgData.hasToInvoiceByAddress = true; - controller.client.isEqualizated = true; - - controller.checkEtChanges(orgData); - - expect(controller.$.propagateIsEqualizated.show).toHaveBeenCalledWith(); - }); - - it(`should call to the onAcceptEt() method if isEqualizated property is changed and invoice by address isn't checked`, () => { - jest.spyOn(controller, 'onAcceptEt'); - - const orgData = $scope.watcher.orgData; - orgData.hasToInvoiceByAddress = false; - controller.client.isEqualizated = true; - - controller.checkEtChanges(orgData); - - expect(controller.onAcceptEt).toHaveBeenCalledWith(); - }); - }); - - describe('onAcceptEt()', () => { - it('should request to patch the propagation of tax status', () => { - controller.client = {id: 123, isEqualizated: false}; - $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); - controller.onAcceptEt(); - $httpBackend.flush(); - }); - }); - - describe('province() setter', () => { - it(`should set countryFk property`, () => { - controller.client.countryFk = null; - controller.province = { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }; - - expect(controller.client.countryFk).toEqual(2); - }); - }); - - describe('town() setter', () => { - it(`should set provinceFk property`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [] - }; - - expect(controller.client.provinceFk).toEqual(1); - }); - - it(`should set provinceFk property and fill the postalCode if there's just one`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [{code: '46001'}] - }; - - expect(controller.client.provinceFk).toEqual(1); - expect(controller.client.postcode).toEqual('46001'); - }); - }); - - describe('postcode() setter', () => { - it(`should set the town, provinceFk and contryFk properties`, () => { - controller.postcode = { - townFk: 1, - code: 46001, - town: { - id: 1, - name: 'New York', - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - } - } - }; - - expect(controller.client.city).toEqual('New York'); - expect(controller.client.provinceFk).toEqual(1); - expect(controller.client.countryFk).toEqual(2); - }); - }); - }); -}); diff --git a/modules/client/front/fiscal-data/locale/en.yml b/modules/client/front/fiscal-data/locale/en.yml deleted file mode 100644 index 14bd6d18f..000000000 --- a/modules/client/front/fiscal-data/locale/en.yml +++ /dev/null @@ -1 +0,0 @@ -Found a client with this phone or email: The client with id {{clientId}} already has this phone or email.
¿Do you want to continue? \ No newline at end of file diff --git a/modules/client/front/fiscal-data/locale/es.yml b/modules/client/front/fiscal-data/locale/es.yml deleted file mode 100644 index 61a91828f..000000000 --- a/modules/client/front/fiscal-data/locale/es.yml +++ /dev/null @@ -1,16 +0,0 @@ -Yes, notify: Sí, notificar -You changed the equalization tax: Has cambiado el recargo de equivalencia -Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios? -Frozen: Congelado -In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar. -Only letters, numbers and spaces can be used: Sólo se pueden usar letras, numeros y espacios -Found a client with this data: Se ha encontrado un cliente con estos datos -Found a client with this phone or email: El cliente con id {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? -Sage tax type: Tipo de impuesto Sage -Sage transaction type: Tipo de transacción Sage -Previous client: Cliente anterior -In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente -Incoterms authorization: Autorización incoterms -Electronic invoice: Factura electrónica -When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF -The first two values are letters: Los dos primeros valores son letras \ No newline at end of file diff --git a/modules/client/front/greuge/create/index.html b/modules/client/front/greuge/create/index.html deleted file mode 100644 index 7cbacb349..000000000 --- a/modules/client/front/greuge/create/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/client/front/greuge/create/index.js b/modules/client/front/greuge/create/index.js deleted file mode 100644 index 147ad9bcb..000000000 --- a/modules/client/front/greuge/create/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor(...args) { - super(...args); - this.greuge = { - shipped: Date.vnNew(), - clientFk: this.$params.id - }; - } - - goToIndex() { - return this.$state.go('client.card.greuge.index'); - } - - onSubmit() { - this.$.watcher.submit() - .then(() => this.goToIndex()); - } -} - -ngModule.vnComponent('vnClientGreugeCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/greuge/create/index.spec.js b/modules/client/front/greuge/create/index.spec.js deleted file mode 100644 index 2d900d258..000000000 --- a/modules/client/front/greuge/create/index.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientGreugeCreate', () => { - let $scope; - let $state; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $scope.watcher = { - submit: () => { - return { - then: callback => { - callback(); - } - }; - } - }; - const $element = angular.element(''); - controller = $componentController('vnClientGreugeCreate', {$element, $scope}); - })); - - describe('onSubmit()', () => { - it('should call the function go() on $state to go to the greuges list', () => { - jest.spyOn($state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.greuge.index'); - }); - }); - }); -}); diff --git a/modules/client/front/greuge/index/index.html b/modules/client/front/greuge/index/index.html deleted file mode 100644 index 014246b31..000000000 --- a/modules/client/front/greuge/index/index.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - Date - Created by - Comment - Type - Amount - - - - - {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} - {{::greuge.user.name}} - - {{::greuge.description}} - - {{::greuge.greugeType.name}} - {{::greuge.amount | currency: 'EUR': 2}} - - - - - - - - - diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js deleted file mode 100644 index 4f1b77b4b..000000000 --- a/modules/client/front/greuge/index/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'greugeType', - scope: { - fields: ['id', 'name'] - }, - }, { - relation: 'user', - scope: { - fields: ['id', 'name'] - } - } - ], - order: 'shipped DESC, amount' - }; - } -} - -ngModule.vnComponent('vnClientGreugeIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/greuge/index/locale/es.yml b/modules/client/front/greuge/index/locale/es.yml deleted file mode 100644 index d1f202862..000000000 --- a/modules/client/front/greuge/index/locale/es.yml +++ /dev/null @@ -1,5 +0,0 @@ -Date: Fecha -Comment: Comentario -Amount: Importe -Type: Tipo -Created by: Creado por \ No newline at end of file diff --git a/modules/client/front/index.js b/modules/client/front/index.js index 62076459b..a7209a0bd 100644 --- a/modules/client/front/index.js +++ b/modules/client/front/index.js @@ -1,52 +1,3 @@ export * from './module'; import './main'; -import './index/'; -import './card'; -import './create'; -import './basic-data'; -import './fiscal-data'; -import './billing-data'; -import './descriptor'; -import './descriptor-popover'; -import './search-panel'; -import './address/index'; -import './address/create'; -import './address/edit'; -import './note/index'; -import './note/create'; -import './web-access'; -import './credit/index'; -import './credit/create'; -import './greuge/index'; -import './greuge/create'; -import './balance/index'; -import './balance/create'; -import './mandate'; -import './summary'; -import './recovery/index'; -import './recovery/create'; -import './credit-insurance/index'; -import './credit-insurance/create'; -import './credit-insurance/insurance/index'; -import './credit-insurance/insurance/create'; -import './contact'; -import './sample/index'; -import './sample/create'; -import './web-payment'; -import './log'; -import './postcode'; -import './postcode/province'; -import './postcode/city'; -import './dms/index'; -import './dms/create'; -import './dms/edit'; -import './consumption'; -import './consumption-search-panel'; -import './defaulter'; -import './notification'; -import './unpaid'; -import './extended-list'; -import './credit-management'; -import './sms'; - diff --git a/modules/client/front/locale/es.yml b/modules/client/front/locale/es.yml deleted file mode 100644 index 0c44a17bc..000000000 --- a/modules/client/front/locale/es.yml +++ /dev/null @@ -1,69 +0,0 @@ -Active: Activo -Amount: Importe -Client: Cliente -client: cliente -Comercial Name: Comercial -Has to invoice: Factura -Notify by email: Notificar vía e-mail -Country: País -Street: Domicilio fiscal -City: Ciudad -Postcode: Código postal -Province: Provincia -Address: Consignatario -Verified data: Datos comprobados -Remove contact: Quitar contacto -Client ticket list: Listado de tickets del cliente -Add contact: Añadir contacto -Sent: Enviado -Worker: Trabajador -Sample: Plantilla -Credit: Crédito -Are you sure you want to delete this expedition?: ¿Está seguro de eliminar esta expedición? -Others: Otros -New order: Nuevo pedido -Client frozen: Cliente congelado -Client has debt: Cliente con riesgo -Client inactive: Cliente inactivo -Client not checked: Cliente no comprobado -Credit insurance: Crédito asegurado -Web Account inactive: Sin acceso Web -Search client by id or name: Buscar clientes por identificador o nombre - -# Sections - -Clients: Clientes -Extended list: Listado extendido -Defaulter: Morosos -New client: Nuevo cliente -Fiscal data: Datos fiscales -Billing data: Forma de pago -Consignees: Consignatarios -New consignee: Nuevo consignatario -Edit consignee: Editar consignatario -Web access: Acceso web -Notes: Notas -New note: Nueva nota -Credits: Créditos -New credit: Nuevo crédito -New greuge: Nuevo greuge -Mandates: Mandatos -Invoices: Facturas -Recoveries: Recobros -New recovery: Nuevo recobro -Credit contracts: Contratos de crédito -New contract: Nuevo contrato -Edit contract: Editar contrato -Requested credits: Créditos solicitados -Contacts: Contactos -Samples: Plantillas -Send sample: Enviar plantilla -Log: Historial -Consumption: Consumo -Compensation Account: Cuenta para compensar -Amount to return: Cantidad a devolver -Delivered amount: Cantidad entregada -Unpaid: Impagado -Credit management: Gestión de crédito -Credit opinion: Opinión de crédito -There is no zona: No hay zona diff --git a/modules/client/front/log/index.html b/modules/client/front/log/index.html deleted file mode 100644 index 881d5c039..000000000 --- a/modules/client/front/log/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/client/front/log/index.js b/modules/client/front/log/index.js deleted file mode 100644 index f4aa99bfd..000000000 --- a/modules/client/front/log/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -ngModule.vnComponent('vnClientLog', { - template: require('./index.html'), - controller: Section, -}); diff --git a/modules/client/front/main/index.js b/modules/client/front/main/index.js index 346880f4c..06a340e00 100644 --- a/modules/client/front/main/index.js +++ b/modules/client/front/main/index.js @@ -2,6 +2,13 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; export default class Client extends ModuleMain { + constructor($element, $) { + super($element, $); + } + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`customer/`); + } } ngModule.vnComponent('vnClient', { diff --git a/modules/client/front/mandate/index.html b/modules/client/front/mandate/index.html deleted file mode 100644 index 1ee18737f..000000000 --- a/modules/client/front/mandate/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - Id - Company - Type - Register date - End date - - - - - {{::mandate.id}} - {{::mandate.company.code}} - {{::mandate.mandateType.code}} - {{::mandate.created | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}} - {{::mandate.finished | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}} - - - - - \ No newline at end of file diff --git a/modules/client/front/mandate/index.js b/modules/client/front/mandate/index.js deleted file mode 100644 index 605ae08cc..000000000 --- a/modules/client/front/mandate/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'mandateType', - scope: { - fields: ['id', 'code'] - } - }, { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - } - ] - }; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientMandate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/mandate/locale/es.yml b/modules/client/front/mandate/locale/es.yml deleted file mode 100644 index 545707023..000000000 --- a/modules/client/front/mandate/locale/es.yml +++ /dev/null @@ -1,3 +0,0 @@ -Company: Empresa -Register date: Fecha alta -End date: Fecha baja \ No newline at end of file diff --git a/modules/client/front/note/create/index.html b/modules/client/front/note/create/index.html deleted file mode 100644 index ca61c74b3..000000000 --- a/modules/client/front/note/create/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - -
- - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/client/front/note/create/index.js b/modules/client/front/note/create/index.js deleted file mode 100644 index c540c3a0b..000000000 --- a/modules/client/front/note/create/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.note = { - clientFk: parseInt(this.$params.id), - text: null - }; - } - - cancel() { - this.$state.go('client.card.note.index', {id: this.$params.id}); - } -} - -ngModule.vnComponent('vnNoteCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/note/create/index.spec.js b/modules/client/front/note/create/index.spec.js deleted file mode 100644 index 117aa0720..000000000 --- a/modules/client/front/note/create/index.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnNoteCreate', () => { - let $state; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$state_) => { - $state = _$state_; - $state.params.id = '1234'; - const $element = angular.element(''); - controller = $componentController('vnNoteCreate', {$element, $state}); - })); - - it('should define clientFk using $state.params.id', () => { - expect(controller.note.clientFk).toBe(1234); - expect(controller.note.client).toBe(undefined); - }); - }); -}); diff --git a/modules/client/front/note/create/locale/es.yml b/modules/client/front/note/create/locale/es.yml deleted file mode 100644 index bfe773f48..000000000 --- a/modules/client/front/note/create/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -New note: Nueva nota -Note: Nota \ No newline at end of file diff --git a/modules/client/front/note/index/index.html b/modules/client/front/note/index/index.html deleted file mode 100644 index 634a9c3ce..000000000 --- a/modules/client/front/note/index/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - -
- - {{::note.worker.user.nickname}} - {{::note.created | date:'dd/MM/yyyy HH:mm'}} - - - {{::note.text}} - -
-
-
- - - diff --git a/modules/client/front/note/index/index.js b/modules/client/front/note/index/index.js deleted file mode 100644 index ed15db671..000000000 --- a/modules/client/front/note/index/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - order: 'created DESC', - }; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientNote', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/note/index/style.scss b/modules/client/front/note/index/style.scss deleted file mode 100644 index 44ae2cee7..000000000 --- a/modules/client/front/note/index/style.scss +++ /dev/null @@ -1,5 +0,0 @@ -vn-client-note { - .note:last-child { - margin-bottom: 0; - } -} \ No newline at end of file diff --git a/modules/client/front/notification/index.html b/modules/client/front/notification/index.html deleted file mode 100644 index 49e4e3c3f..000000000 --- a/modules/client/front/notification/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - Identifier - - Social name - - City - - Phone - - Email -
- - - - - {{::client.id}} - - {{::client.socialName}}{{::client.city}}{{::client.phone}}{{::client.email}}
-
-
-
- - - - -
-
-

Campaign consumption

- - - - {{code}} {{dated | date: 'yyyy'}} - - - - - - - - - - - - -
-
-
- - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - - Copy value - - - - - \ No newline at end of file diff --git a/modules/client/front/notification/index.js b/modules/client/front/notification/index.js deleted file mode 100644 index faa062b25..000000000 --- a/modules/client/front/notification/index.js +++ /dev/null @@ -1,123 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.$checkAll = false; - this.smartTableOptions = { - activeButtons: { - search: true - }, - columns: [ - { - field: 'socialName', - autocomplete: { - url: 'Clients', - showField: 'socialName', - valueField: 'socialName' - } - }, - { - field: 'city', - autocomplete: { - url: 'Towns', - valueField: 'name', - showField: 'name' - } - } - ] - }; - - this.campaign = { - id: null, - from: null, - to: null - }; - - this.getUpcomingCampaing(); - } - - get checked() { - const clients = this.$.model.data || []; - const checkedClients = []; - for (const buy of clients) { - if (buy.$checked) - checkedClients.push(buy); - } - - return checkedClients; - } - - onChangeDate(value) { - if (value) - this.campaign.id = null; - } - - getUpcomingCampaing() { - this.$http.get('Campaigns/upcoming') - .then(res => this.campaign.id = res.data.id); - } - - get campaignSelection() { - return this._campaignSelection; - } - - set campaignSelection(value) { - this._campaignSelection = value; - - if (value) { - const from = new Date(value.dated); - from.setDate(from.getDate() - value.scopeDays); - - this.campaign.to = value.dated; - this.campaign.from = from; - } - } - - onSendClientConsumption() { - const clientIds = this.checked.map(client => client.id); - const data = { - clients: clientIds, - from: this.campaign.from, - to: this.campaign.to - }; - - const params = JSON.stringify(data); - this.$http.post('ClientConsumptionQueues', {params}) - .then(() => this.$.filters.hide()) - .then(() => this.vnApp.showSuccess(this.$t('Notification sent!'))); - } - - exprBuilder(param, value) { - switch (param) { - case 'search': - return /^\d+$/.test(value) - ? {id: value} - : {or: [{name: {like: `%${value}%`}}, {socialName: {like: `%${value}%`}}]}; - case 'phone': - return { - or: [ - {phone: value}, - {mobile: value} - ] - }; - case 'name': - case 'socialName': - case 'city': - case 'email': - return {[param]: {like: `%${value}%`}}; - case 'id': - case 'fi': - case 'postcode': - case 'salesPersonFk': - case 'provinceFk': - return {[param]: value}; - } - } -} - -ngModule.vnComponent('vnClientNotification', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/notification/index.spec.js b/modules/client/front/notification/index.spec.js deleted file mode 100644 index e1de104be..000000000 --- a/modules/client/front/notification/index.spec.js +++ /dev/null @@ -1,99 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('Client notification', () => { - describe('Component vnClientNotification', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientNotification', {$element}); - controller.$.model = crudModel; - controller.$.model.data = [ - {id: 1101}, - {id: 1102}, - {id: 1103} - ]; - $httpBackend.expect('GET', `Campaigns/upcoming`).respond(200, {id: 1}); - })); - - describe('checked() getter', () => { - it('should return the checked lines', () => { - const data = controller.$.model.data; - data[1].$checked = true; - data[2].$checked = true; - - const checkedRows = controller.checked; - - const firstCheckedRow = checkedRows[0]; - const secondCheckedRow = checkedRows[1]; - - expect(firstCheckedRow.id).toEqual(1102); - expect(secondCheckedRow.id).toEqual(1103); - }); - }); - - describe('campaignSelection() setter', () => { - it('should set the campaign from and to properties', () => { - const dated = Date.vnNew(); - controller.campaignSelection = { - dated: dated, - scopeDays: 14 - }; - - const expectedDateTo = new Date(dated); - expectedDateTo.setDate(expectedDateTo.getDate() - 14); - - const campaign = controller.campaign; - - expect(campaign.from).toEqual(expectedDateTo); - expect(campaign.to).toEqual(dated); - }); - }); - - describe('onSendClientConsumption()', () => { - it('should return saved message', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - - controller.$.filters = {hide: () => {}}; - controller.campaign = { - from: Date.vnNew(), - to: Date.vnNew() - }; - - const data = controller.$.model.data; - data[0].$checked = true; - data[1].$checked = true; - - const args = Object.assign({ - clients: [1101, 1102] - }, controller.campaign); - const params = JSON.stringify(args); - - $httpBackend.expect('POST', `ClientConsumptionQueues`, {params}).respond(200, params); - controller.onSendClientConsumption(); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Notification sent!'); - }); - }); - - describe('exprBuilder()', () => { - it('should search by sales person', () => { - let expr = controller.exprBuilder('salesPersonFk', '5'); - - expect(expr).toEqual({'salesPersonFk': '5'}); - }); - - it('should search by client social name', () => { - let expr = controller.exprBuilder('socialName', '1foo'); - - expect(expr).toEqual({'socialName': {like: '%1foo%'}}); - }); - }); - }); -}); diff --git a/modules/client/front/notification/locale/es.yml b/modules/client/front/notification/locale/es.yml deleted file mode 100644 index dd89d7c6e..000000000 --- a/modules/client/front/notification/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Campaign consumption: Consumo campaña -Send: Enviar \ No newline at end of file diff --git a/modules/client/front/postcode/city/index.html b/modules/client/front/postcode/city/index.html deleted file mode 100644 index a83505222..000000000 --- a/modules/client/front/postcode/city/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - -

Please, ensure you put the correct data!

- - - - - - -
- - - - -
\ No newline at end of file diff --git a/modules/client/front/postcode/city/index.js b/modules/client/front/postcode/city/index.js deleted file mode 100644 index c4c110745..000000000 --- a/modules/client/front/postcode/city/index.js +++ /dev/null @@ -1,37 +0,0 @@ -import ngModule from '../../module'; -import Component from 'core/lib/component'; - -class Controller extends Component { // Comprobar funcionamiento añadir ciudad - open($event) { - if ($event.defaultPrevented) return; - - this.$.cityDialog.show(); - $event.preventDefault(); - } - - onAccept() { - try { - if (!this.city.name) - throw new Error(`The city name can't be empty`); - if (!this.city.provinceFk) - throw new Error(`The province can't be empty`); - - this.$http.patch(`towns`, this.city).then(res => { - this.vnApp.showMessage(this.$t('The city has been created')); - this.emit('response', {$response: res.data}); - }); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - return false; - } - return true; - } -} - -ngModule.vnComponent('vnGeoCity', { - template: require('./index.html'), - controller: Controller, - bindings: { - data: '<', - } -}); diff --git a/modules/client/front/postcode/city/index.spec.js b/modules/client/front/postcode/city/index.spec.js deleted file mode 100644 index 18f93fe23..000000000 --- a/modules/client/front/postcode/city/index.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnGeoCity', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnGeoCity', {$element, $scope}); - controller.client = {id: 1101}; - })); - - describe('onAccept()', () => { - it('should perform a POST query and show a success snackbar', () => { - let params = {name: 'Gotham City', provinceFk: 1}; - controller.city = {name: 'Gotham City', provinceFk: 1}; - - jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.expect('PATCH', `towns`, params).respond(200, params); - - controller.onAccept(); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The city has been created'); - }); - }); - }); -}); diff --git a/modules/client/front/postcode/index.html b/modules/client/front/postcode/index.html deleted file mode 100644 index fa0b7870f..000000000 --- a/modules/client/front/postcode/index.html +++ /dev/null @@ -1,76 +0,0 @@ - - -

Please, ensure you put the correct data!

- - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - diff --git a/modules/client/front/postcode/index.js b/modules/client/front/postcode/index.js deleted file mode 100644 index 2c44ae13f..000000000 --- a/modules/client/front/postcode/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import ngModule from '../module'; -import Component from 'core/lib/component'; -import './style.scss'; - -class Controller extends Component { - get townSelection() { - return this._townSelection; - } - - set townSelection(selection) { - this._townSelection = selection; - - if (!selection) return; - - const province = selection.province; - const country = province.country; - - this.location.city = selection.name; - this.location.provinceFk = province.id; - this.location.countryFk = country.id; - } - - open() { - this.$.postcodeDialog.show(); - } - - onOpen() { - this.location = {}; - this.$.postcode.focus(); - } - - onProvinceResponse(response) { - this.location.provinceFk = response.id; - this.location.countryFk = response.countryFk; - } - - onCityResponse(response) { - this.location.townFk = response.id; - this.location.provinceFk = response.provinceFk; - this.location.countryFk = response.countryFk; - } - - onAccept() { - try { - if (!this.location.code) - throw new Error(`The postcode can't be empty`); - if (!this.location.townFk) - throw new Error(`The town can't be empty`); - if (!this.location.provinceFk) - throw new Error(`The province can't be empty`); - if (!this.location.provinceFk) - throw new Error(`The country can't be empty`); - - this.$http.patch(`postcodes`, this.location).then(() => { - this.vnApp.showMessage(this.$t('The postcode has been created. You can save the data now')); - this.emit('response', {$response: this.location}); - }); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - return false; - } - return true; - } -} - -ngModule.vnComponent('vnGeoPostcode', { - template: require('./index.html'), - controller: Controller, - bindings: { - data: '<', - } -}); diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js deleted file mode 100644 index 497852324..000000000 --- a/modules/client/front/postcode/index.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnGeoPostcode', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnGeoPostcode', {$element, $scope}); - controller.client = {id: 1101}; - })); - - describe('onAccept()', () => { - it('should perform a POST query and show a success snackbar', () => { - let params = {townFk: 1, provinceFk: 1, countryFk: 1, code: '46460'}; - controller.location = {townFk: 1, provinceFk: 1, countryFk: 1, code: '46460'}; - - jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.expect('PATCH', `postcodes`, params).respond(200, params); - - controller.onAccept(); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The postcode has been created. You can save the data now'); - }); - }); - }); -}); diff --git a/modules/client/front/postcode/locale/es.yml b/modules/client/front/postcode/locale/es.yml deleted file mode 100644 index 29d0d7af9..000000000 --- a/modules/client/front/postcode/locale/es.yml +++ /dev/null @@ -1,12 +0,0 @@ -New postcode: Nuevo código postal -New city: Nueva ciudad -New province: Nueva provincia -Please, ensure you put the correct data!: ¡Por favor, asegúrate de poner los datos correctos! -The postcode can't be empty: El código postal no puede quedar vacío -The town can't be empty: La población no puede quedar vacía -The province can't be empty: La provincia no puede quedar vacía -The country can't be empty: El país no puede quedar vacío -The postcode has been created. You can save the data now: Se ha creado el código postal. Ahora puedes guardar los datos -The city has been created: Se ha creado la ciudad -The province has been created: Se ha creado la provincia -Autonomy: Autonomia \ No newline at end of file diff --git a/modules/client/front/postcode/province/index.html b/modules/client/front/postcode/province/index.html deleted file mode 100644 index e05cdf644..000000000 --- a/modules/client/front/postcode/province/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - -

Please, ensure you put the correct data!

- - - - - - -
- - - - -
\ No newline at end of file diff --git a/modules/client/front/postcode/province/index.js b/modules/client/front/postcode/province/index.js deleted file mode 100644 index 5da81aa52..000000000 --- a/modules/client/front/postcode/province/index.js +++ /dev/null @@ -1,37 +0,0 @@ -import ngModule from '../../module'; -import Component from 'core/lib/component'; - -class Controller extends Component { - open($event) { - if ($event.defaultPrevented) return; - - this.$.provinceDialog.show(); - $event.preventDefault(); - } - - onAccept() { - try { - if (!this.province.name) - throw new Error(`The province name can't be empty`); - if (!this.province.autonomyFk) - throw new Error(`The autonomy can't be empty`); - - this.$http.patch(`provinces`, this.province).then(res => { - this.vnApp.showMessage(this.$t('The province has been created')); - this.emit('response', {$response: res.data}); - }); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - return false; - } - return true; - } -} - -ngModule.vnComponent('vnGeoProvince', { - template: require('./index.html'), - controller: Controller, - bindings: { - data: '<', - } -}); diff --git a/modules/client/front/postcode/province/index.spec.js b/modules/client/front/postcode/province/index.spec.js deleted file mode 100644 index f73a3c284..000000000 --- a/modules/client/front/postcode/province/index.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnGeoProvince', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnGeoProvince', {$element, $scope}); - controller.client = {id: 1101}; - })); - - describe('onAccept()', () => { - it('should perform a POST query and show a success snackbar', () => { - const params = {name: 'New Jersey', autonomyFk: 1}; - controller.province = {name: 'New Jersey', autonomyFk: 1}; - - jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.expect('PATCH', `provinces`, params).respond(200, params); - - controller.onAccept(); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The province has been created'); - }); - }); - }); -}); diff --git a/modules/client/front/postcode/style.scss b/modules/client/front/postcode/style.scss deleted file mode 100644 index 51e181357..000000000 --- a/modules/client/front/postcode/style.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import "variables"; - -vn-geo-postcode { - vn-dialog { - p { - color: $color-alert - } - } -} \ No newline at end of file diff --git a/modules/client/front/recovery/create/index.html b/modules/client/front/recovery/create/index.html deleted file mode 100644 index 3d4cc2e1e..000000000 --- a/modules/client/front/recovery/create/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - -
diff --git a/modules/client/front/recovery/create/index.js b/modules/client/front/recovery/create/index.js deleted file mode 100644 index 1779d647e..000000000 --- a/modules/client/front/recovery/create/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.recovery = { - started: Date.vnNew() - }; - } - - cancel() { - this.goToIndex(); - } - - goToIndex() { - this.$state.go('client.card.recovery.index'); - } - - onSubmit() { - this.recovery.clientFk = this.$params.id; - this.$.watcher.submit().then( - () => { - this.goToIndex(); - } - ); - } -} -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientRecoveryCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/recovery/create/index.spec.js b/modules/client/front/recovery/create/index.spec.js deleted file mode 100644 index ec9054140..000000000 --- a/modules/client/front/recovery/create/index.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientRecoveryCreate', () => { - let $scope; - let $state; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $scope.watcher = { - submit: () => { - return { - then: callback => { - callback(); - } - }; - } - }; - const $element = angular.element(''); - controller = $componentController('vnClientRecoveryCreate', {$element, $scope}); - })); - - describe('onSubmit()', () => { - it('should call the function go() on $state to go to the recovery list', () => { - jest.spyOn($state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('client.card.recovery.index'); - }); - }); - }); -}); diff --git a/modules/client/front/recovery/create/locale/es.yml b/modules/client/front/recovery/create/locale/es.yml deleted file mode 100644 index 29877c03c..000000000 --- a/modules/client/front/recovery/create/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Period: Periodo \ No newline at end of file diff --git a/modules/client/front/recovery/index/index.html b/modules/client/front/recovery/index/index.html deleted file mode 100644 index 214dff822..000000000 --- a/modules/client/front/recovery/index/index.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - Since - To - Amount - Period - - - - - - - - - {{::recovery.started | date:'dd/MM/yyyy' }} - {{recovery.finished | date:'dd/MM/yyyy' }} - {{::recovery.amount | currency: 'EUR': 0}} - {{::recovery.period}} - - - - - - - diff --git a/modules/client/front/recovery/index/index.js b/modules/client/front/recovery/index/index.js deleted file mode 100644 index e89b6832c..000000000 --- a/modules/client/front/recovery/index/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - setFinished(recovery) { - if (!recovery.finished) { - let params = {finished: Date.vnNow()}; - this.$http.patch(`Recoveries/${recovery.id}`, params).then( - () => this.$.model.refresh() - ); - } - } -} - -ngModule.vnComponent('vnClientRecoveryIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/recovery/index/locale/es.yml b/modules/client/front/recovery/index/locale/es.yml deleted file mode 100644 index 0cb5b3ed6..000000000 --- a/modules/client/front/recovery/index/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -Since: Desde -Employee: Empleado -To: Hasta -Finish that recovery period: Terminar el recobro \ No newline at end of file diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 63d6709e5..b2622589e 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -6,10 +6,7 @@ "dependencies": ["worker", "invoiceOut"], "menus": { "main": [ - {"state": "client.index", "icon": "person"}, - {"state": "client.extendedList", "icon": "person"}, - {"state": "client.notification", "icon": "campaign"}, - {"state": "client.defaulter", "icon": "icon-defaulter"} + {"state": "client.index", "icon": "person"} ], "card": [ {"state": "client.card.basicData", "icon": "settings"}, @@ -64,392 +61,6 @@ "state": "client.index", "component": "vn-client-index", "description": "Clients" - }, - { - "url": "/create", - "state": "client.create", - "component": "vn-client-create", - "description": "New client" - }, - { - "url": "/:id?sendSMS&phone&message", - "state": "client.card", - "abstract": true, - "component": "vn-client-card" - }, - { - "url": "/summary", - "state": "client.card.summary", - "component": "vn-client-summary", - "description": "Summary", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/basic-data", - "state": "client.card.basicData", - "component": "vn-client-basic-data", - "description": "Basic data", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/fiscal-data", - "state": "client.card.fiscalData", - "component": "vn-client-fiscal-data", - "description": "Fiscal data", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/billing-data", - "state": "client.card.billingData", - "component": "vn-client-billing-data", - "description": "Billing data", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/address", - "state": "client.card.address", - "component": "ui-view", - "abstract": true - }, - { - "url": "/index?q", - "state": "client.card.address.index", - "component": "vn-client-address-index", - "description": "Consignees", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.address.create", - "component": "vn-client-address-create", - "description": "New address", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/:addressId/edit", - "state": "client.card.address.edit", - "component": "vn-client-address-edit", - "description": "Edit address" - }, - { - "url": "/web-access", - "state": "client.card.webAccess", - "component": "vn-client-web-access", - "description": "Web access", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/note", - "state": "client.card.note", - "component": "ui-view", - "abstract": true - }, - { - "url": "/index", - "state": "client.card.note.index", - "component": "vn-client-note", - "description": "Notes", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.note.create", - "component": "vn-note-create", - "description": "New note" - }, - { - "url": "/credit", - "abstract": true, - "state": "client.card.credit", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.credit.index", - "component": "vn-client-credit-index", - "description": "Credits", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.credit.create", - "component": "vn-client-credit-create", - "description": "New credit", - "acl": ["teamBoss"], - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/greuge", - "abstract": true, - "state": "client.card.greuge", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.greuge.index", - "component": "vn-client-greuge-index", - "description": "Greuges", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.greuge.create", - "component": "vn-client-greuge-create", - "description": "New greuge", - "acl": ["salesAssistant", "claimManager"], - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/mandate", - "state": "client.card.mandate", - "component": "vn-client-mandate", - "description": "Mandates" - }, - { - "url": "/balance", - "abstract": true, - "state": "client.card.balance", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.balance.index", - "component": "vn-client-balance-index", - "description": "Balance", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create?payed&companyFk&bankFk&payedAmount", - "state": "client.card.balance.create", - "component": "vn-client-balance-create", - "description": "New payment", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/recovery", - "abstract": true, - "state": "client.card.recovery", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.recovery.index", - "component": "vn-client-recovery-index", - "description": "Recoveries", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.recovery.create", - "component": "vn-client-recovery-create", - "description": "New recovery", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/credit-insurance", - "abstract": true, - "state": "client.card.creditInsurance", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.creditInsurance.index", - "component": "vn-client-credit-insurance-index", - "description": "Credit contracts", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.creditInsurance.create", - "component": "vn-client-credit-insurance-create", - "description": "New insurance", - "acl": ["insurance"], - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/insurance", - "abstract": true, - "state": "client.card.creditInsurance.insurance", - "component": "ui-view", - "acl": ["insurance"] - }, - { - "url": "/:classificationId/index", - "state": "client.card.creditInsurance.insurance.index", - "component": "vn-client-credit-insurance-insurance-index", - "description": "Requested credits", - "acl": ["insurance"], - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/:classificationId/create", - "state": "client.card.creditInsurance.insurance.create", - "component": "vn-client-credit-insurance-insurance-create", - "description": "New credit", - "acl": ["insurance"], - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/contact", - "state": "client.card.contact", - "component": "vn-client-contact", - "description": "Contacts", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/sample", - "abstract": true, - "state": "client.card.sample", - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.sample.index", - "component": "vn-client-sample-index", - "description": "Samples", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/create", - "state": "client.card.sample.create", - "component": "vn-client-sample-create", - "description": "Send sample", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/web-payment", - "state": "client.card.webPayment", - "component": "vn-client-web-payment", - "description": "Web Payment" - }, - { - "url" : "/log", - "state": "client.card.log", - "component": "vn-client-log", - "description": "Log" - }, - { - "url" : "/sms", - "state": "client.card.sms", - "component": "vn-client-sms", - "description": "Sms" - }, - { - "url": "/dms", - "state": "client.card.dms", - "abstract": true, - "component": "ui-view" - }, - { - "url": "/index", - "state": "client.card.dms.index", - "component": "vn-client-dms-index", - "description": "File management" - }, - { - "url": "/create", - "state": "client.card.dms.create", - "component": "vn-client-dms-create", - "description": "Upload file", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/:dmsId/edit", - "state": "client.card.dms.edit", - "component": "vn-client-dms-edit", - "description": "Edit file", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/consumption?q", - "state": "client.card.consumption", - "component": "vn-client-consumption", - "description": "Consumption", - "params": { - "client": "$ctrl.client" - } - }, - { - "url": "/defaulter?q", - "state": "client.defaulter", - "component": "vn-client-defaulter", - "description": "Defaulter" - }, - { - "url" : "/notification?q", - "state": "client.notification", - "component": "vn-client-notification", - "description": "Notifications" - }, - { - "url": "/unpaid", - "state": "client.card.unpaid", - "component": "vn-client-unpaid", - "acl": ["administrative"], - "description": "Unpaid" - }, - { - "url": "/extended-list?q", - "state": "client.extendedList", - "component": "vn-client-extended-list", - "description": "Extended list" - }, - { - "url": "/credit-management", - "state": "client.card.creditManagement", - "component": "vn-client-credit-management", - "acl": ["financial"], - "description": "Credit opinion" } ] } diff --git a/modules/client/front/sample/create/index.html b/modules/client/front/sample/create/index.html deleted file mode 100644 index 9dce7ec72..000000000 --- a/modules/client/front/sample/create/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - -
- - - - - - - - - - - - - - - - - {{::!isActive ? '(Inactive)' : ''}} - {{::nickname}} - - , {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}} - - - - - - - - - - - - - - - - - - - -
- - -
- -
-
-
diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js deleted file mode 100644 index 5370aa8a8..000000000 --- a/modules/client/front/sample/create/index.js +++ /dev/null @@ -1,188 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $, vnEmail) { - super($element, $); - this.vnEmail = vnEmail; - } - - get client() { - return this._client; - } - - set client(value) { - this._client = value; - - if (value) { - this.setClientSample(value); - this.clientAddressesList(value.id); - } - } - - get companyId() { - if (!this.clientSample.companyFk) - this.clientSample.companyFk = this.vnConfig.companyFk; - return this.clientSample.companyFk; - } - - set companyId(value) { - this.clientSample.companyFk = value; - } - - get addressId() { - if (!this.clientSample.addressId) - this.clientSample.addressId = this.client.defaultAddressFk; - return this.clientSample.addressId; - } - - set addressId(value) { - this.clientSample.addressId = value; - } - - onSubmit() { - this.$.watcher.check(); - - const validationMessage = this.validate(); - if (validationMessage) - return this.vnApp.showError(this.$t(validationMessage)); - - this.$.watcher.realSubmit().then(() => this.send()); - } - - validate() { - const sampleType = this.$.sampleType.selection; - - if (!this.clientSample.recipient) - return 'Email cannot be blank'; - - if (!sampleType) - return 'Choose a sample'; - - if (sampleType.hasCompany && !this.clientSample.companyFk) - return 'Choose a company'; - - if (sampleType.datepickerEnabled && !this.clientSample.from) - return 'Choose a date'; - - return; - } - - setParams(params) { - const sampleType = this.$.sampleType.selection; - - if (sampleType.hasCompany) - params.companyId = this.clientSample.companyFk; - - if (sampleType.datepickerEnabled) - params.from = this.clientSample.from; - - if (this.clientSample.addressId) - params.addressId = this.clientSample.addressId; - } - - preview() { - const sampleType = this.$.sampleType.selection; - - const params = { - recipientId: this.$params.id - }; - - const validationMessage = this.validate(); - if (validationMessage) - return this.vnApp.showError(this.$t(validationMessage)); - - this.setParams(params); - - const path = `${sampleType.model}/${this.$params.id}/${sampleType.code}-html`; - this.$http.get(path, {params}) - .then(response => { - this.$.showPreview.show(); - const dialog = document.body.querySelector('div.vn-dialog'); - const body = dialog.querySelector('tpl-body'); - const scroll = dialog.querySelector('div:first-child'); - - body.innerHTML = response.data; - scroll.scrollTop = 0; - }); - } - - send() { - const sampleType = this.$.sampleType.selection; - - const params = { - recipientId: this.client.id, - recipient: this.clientSample.recipient, - replyTo: this.clientSample.replyTo - }; - - const validationMessage = this.validate(); - if (validationMessage) - return this.vnApp.showError(this.$t(validationMessage)); - - this.setParams(params); - - const path = `${sampleType.model}/${this.$params.id}/${sampleType.code}-email`; - this.vnEmail.send(path, params) - .then(() => this.$state.go('client.card.sample.index')); - } - - setClientSample(client) { - const userId = window.localStorage.currentUserWorkerId; - const params = {filter: {where: {userFk: userId}}}; - this.$http.get('EmailUsers', params).then(res => { - const [worker] = res && res.data; - this.clientSample = { - clientFk: this.$params.id, - companyId: this.vnConfig.companyFk, - recipient: client.email, - replyTo: worker.email - }; - }); - } - - clientAddressesList(value) { - let filter = { - include: [ - { - relation: 'province', - scope: { - fields: ['name'] - } - }, - { - relation: 'agencyMode', - scope: { - fields: ['name'] - } - } - ] - }; - filter = encodeURIComponent(JSON.stringify(filter)); - - let query = `Clients/${value}/addresses?filter=${filter}`; - this.$http.get(query).then(res => { - if (res.data) - this.addresses = res.data; - }); - } - - getClientDefaultAddress(value) { - let query = `Clients/${value}`; - this.$http.get(query).then(res => { - if (res.data) - this.addressId = res.data.defaultAddressFk; - }); - } -} - -Controller.$inject = ['$element', '$scope', 'vnEmail']; - -ngModule.vnComponent('vnClientSampleCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js deleted file mode 100644 index ecaf038fa..000000000 --- a/modules/client/front/sample/create/index.spec.js +++ /dev/null @@ -1,210 +0,0 @@ -import './index'; - -describe('Client', () => { - describe('Component vnClientSampleCreate', () => { - let $httpParamSerializer; - let $scope; - let $element; - let $httpBackend; - let $state; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_, _$httpParamSerializer_) => { - $scope = $rootScope.$new(); - $scope.sampleType = {}; - $scope.watcher = { - check: () => {}, - realSubmit: () => { - return { - then: callback => { - callback(); - } - }; - } - }; - $scope.showPreview = { - element: { - querySelector: () => { - return { - innerHTML: () => {} - }; - } - }, - show: () => {} - }; - $state = _$state_; - $state.params.id = 1101; - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - $element = angular.element(''); - controller = $componentController('vnClientSampleCreate', {$element, $scope}); - controller._client = {id: 1101}; - const element = document.createElement('div'); - document.body.querySelector = () => { - return { - querySelector: () => { - return element; - } - }; - }; - // $httpBackend.expectGET('EmailUsers?filter=%7B%22where%22:%7B%7D%7D').respond(); - })); - - describe('onSubmit()', () => { - it(`should call send() method`, () => { - controller.send = jest.fn(); - - controller.$.sampleType.selection = { - hasCompany: false, - code: 'MyReport', - model: 'Clients' - }; - - controller.clientSample = { - recipient: 'email@email' - }; - - controller.onSubmit(); - - expect(controller.send).toHaveBeenCalledWith(); - }); - }); - - describe('send()', () => { - it(`should not perform an HTTP query if no recipient is specified`, () => { - jest.spyOn(controller.$http, 'get'); - - controller.$.sampleType.selection = { - hasCompany: false, - code: 'MyReport', - model: 'Clients' - }; - controller.clientSample = { - recipientId: 1101 - }; - - controller.send(); - - expect(controller.$http.get).not.toHaveBeenCalled(); - }); - - it(`should not perform an HTTP query if no sample is specified`, () => { - jest.spyOn(controller.$http, 'get'); - - controller.$.sampleType.selection = null; - controller.clientSample = { - recipientId: 1101, - recipient: 'client@email.com' - }; - - controller.send(); - - expect(controller.$http.get).not.toHaveBeenCalled(); - }); - - it(`should not perform an HTTP query if company is required and not specified`, () => { - jest.spyOn(controller.$http, 'get'); - - controller.$.sampleType.selection = { - hasCompany: true, - code: 'MyReport' - }; - controller.clientSample = { - recipientId: 1101, - recipient: 'client@email.com' - }; - - controller.send(); - - expect(controller.$http.get).not.toHaveBeenCalled(); - }); - - it(`should perform an HTTP query without passing companyFk param`, () => { - $state.go = jest.fn(); - - controller.$.sampleType.selection = { - hasCompany: false, - code: 'my-report', - model: 'Clients' - }; - controller.clientSample = { - recipientId: 1101, - recipient: 'client@email.com' - }; - - const expectedPath = `Clients/${controller.client.id}/my-report-email`; - $httpBackend.expect('POST', expectedPath).respond(true); - controller.send(); - $httpBackend.flush(); - }); - - it(`should perform an HTTP query passing companyFk param`, () => { - $state.go = jest.fn(); - - controller.$.sampleType.selection = { - hasCompany: true, - code: 'my-report', - model: 'Clients' - }; - controller.clientSample = { - recipientId: 1101, - recipient: 'client@email.com', - companyFk: 442 - }; - - const expectedPath = `Clients/${controller.client.id}/my-report-email`; - $httpBackend.expect('POST', expectedPath).respond(true); - controller.send(); - $httpBackend.flush(); - }); - }); - - describe('preview()', () => { - it(`should open a sample preview`, () => { - jest.spyOn(controller.$.showPreview, 'show'); - - controller.$.sampleType.selection = { - hasCompany: true, - code: 'my-report', - model: 'Clients' - }; - controller.clientSample = { - recipientId: 1101, - recipient: 'client@email.com', - companyFk: 442 - }; - - const expectedParams = { - companyId: 442, - recipientId: 1101 - }; - const serializedParams = $httpParamSerializer(expectedParams); - - const expectedPath = `Clients/${controller.client.id}/my-report-html?${serializedParams}`; - $httpBackend.expect('GET', expectedPath).respond(true); - controller.preview(); - $httpBackend.flush(); - - expect(controller.$.showPreview.show).toHaveBeenCalledWith(); - }); - }); - - describe('setClientSample()', () => { - it(`should perform a query and then set the replyTo property to the clientSample object`, () => { - const client = {email: 'test@example.com'}; - const expectedEmail = 'batman@arkhamcity.com'; - const serializedParams = $httpParamSerializer({filter: {where: {}}}); - $httpBackend.expect('GET', `EmailUsers?${serializedParams}`).respond([{email: expectedEmail}]); - controller.setClientSample(client); - $httpBackend.flush(); - - expect(controller.clientSample.replyTo).toEqual(expectedEmail); - expect(controller.clientSample.clientFk).toEqual(controller.$params.id); - expect(controller.clientSample.recipient).toEqual(client.email); - expect(controller.clientSample.companyId).toEqual(controller.vnConfig.companyFk); - }); - }); - }); -}); diff --git a/modules/client/front/sample/create/locale/es.yml b/modules/client/front/sample/create/locale/es.yml deleted file mode 100644 index b72d456d8..000000000 --- a/modules/client/front/sample/create/locale/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -Choose a sample: Selecciona una plantilla -Choose a company: Selecciona una empresa -Choose a date: Selecciona una fecha -Email cannot be blank: Debes introducir un email -Recipient: Destinatario -Its only used when sample is sent: Se utiliza únicamente cuando se envía la plantilla -Reply to: Responder a -To who should the recipient reply?: ¿A quíen debería responder el destinatario? \ No newline at end of file diff --git a/modules/client/front/sample/create/style.scss b/modules/client/front/sample/create/style.scss deleted file mode 100644 index b6cb688b5..000000000 --- a/modules/client/front/sample/create/style.scss +++ /dev/null @@ -1,34 +0,0 @@ -div.vn-dialog { - tpl-body.client-sample-dialog { - width: 800px; - - .container, .container h1 { - font-family: "Roboto","Helvetica","Arial",sans-serif; - font-size: 1rem !important; - - h1 { - font-weight: bold; - margin: auto - } - - p { - margin: 16px 0 - } - - footer p { - font-size: .625rem !important; - line-height: 10px; - } - } - - - .title h1 { - font-size: 2rem !important; - margin: 0 - } - - .loading { - text-align: center - } - } -} diff --git a/modules/client/front/sample/index/index.html b/modules/client/front/sample/index/index.html deleted file mode 100644 index 1f499a589..000000000 --- a/modules/client/front/sample/index/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - Sent - Description - Worker - Company - - - - - {{::sample.created | date:'dd/MM/yyyy HH:mm' }} - - {{::sample.type.description}} - - - - {{::sample.user.name || 'System' | translate}} - - - {{::sample.company.code}} - - - - - - - - - - - \ No newline at end of file diff --git a/modules/client/front/sample/index/index.js b/modules/client/front/sample/index/index.js deleted file mode 100644 index 7aa44c67f..000000000 --- a/modules/client/front/sample/index/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'type', - scope: { - fields: ['code', 'description'] - } - }, { - relation: 'user', - scope: { - fields: ['id', 'name'] - } - }, { - relation: 'company', - scope: { - fields: ['code'] - } - } - ] - }; - } -} - -ngModule.vnComponent('vnClientSampleIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/search-panel/index.html b/modules/client/front/search-panel/index.html deleted file mode 100644 index 2105d3a65..000000000 --- a/modules/client/front/search-panel/index.html +++ /dev/null @@ -1,80 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/client/front/search-panel/index.js b/modules/client/front/search-panel/index.js deleted file mode 100644 index bdbbcdaef..000000000 --- a/modules/client/front/search-panel/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -ngModule.vnComponent('vnClientSearchPanel', { - template: require('./index.html'), - controller: SearchPanel -}); diff --git a/modules/client/front/search-panel/locale/es.yml b/modules/client/front/search-panel/locale/es.yml deleted file mode 100644 index b0d0649c8..000000000 --- a/modules/client/front/search-panel/locale/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -Client id: Id cliente -Tax number: NIF/CIF -Name: Nombre -Social name: Razón social -Town/City: Ciudad -Postcode: Código postal -Email: E-mail -Phone: Teléfono \ No newline at end of file diff --git a/modules/client/front/sms/index.html b/modules/client/front/sms/index.html deleted file mode 100644 index 7fb3b870e..000000000 --- a/modules/client/front/sms/index.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/modules/client/front/sms/index.js b/modules/client/front/sms/index.js deleted file mode 100644 index 8fa130248..000000000 --- a/modules/client/front/sms/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - } - - async $onInit() { - this.$state.go('client.card.summary', {id: this.$params.id}); - window.location.href = await this.vnApp.getUrl(`Customer/${this.$params.id}/sms`); - } -} - -ngModule.vnComponent('vnClientSms', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/sms/locale/es.yml b/modules/client/front/sms/locale/es.yml deleted file mode 100644 index 6d1e9e147..000000000 --- a/modules/client/front/sms/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Sender: Remitente -Number sender: Número remitente diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html deleted file mode 100644 index 3a46a4959..000000000 --- a/modules/client/front/summary/index.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - -
- - - - - {{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPersonUser.name}} - -
- - -

- - Basic data - -

-

- Basic data -

- - - - - - - - - - - - - - - - - - - - {{$ctrl.summary.salesPersonUser.name}} - - - - - - -
- -

- - Fiscal address - -

-

- Fiscal address -

- - - - - - - - - - - - - - -
- -

- - Fiscal data - -

-

- Fiscal data -

- - - - - - - - - - - - - - - - -
- -

- - Billing data - -

-

- Billing data -

- - - - - - - - - - - - - - -
- -

- - Address - -

-

- Address -

- - - - - - -
- -

- - Web access - -

-

Web access -

- - - - - - -
- -

Business data

- - - - - - - - - - -
- -

- - Billing data - -

- - - - - - - - - - - - - - - - -
-
- - -

Latest tickets

- - - - Id - Nickname - Agency - Route - Packages - Date - State - Total - - - - - - {{::ticket.id}} - - - {{::ticket.nickname}} - - - - {{::ticket.agencyMode.name}} - - - - {{::ticket.routeFk}} - - - - {{::ticket.packages}} - - - - {{::ticket.shipped | date: 'dd/MM/yyyy'}} - - - - - {{::ticket.refFk}} - - - {{::ticket.ticketState.state.name}} - - - - - {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} - - - - - - - - - - - - - -
-
-
- - - - - - - - - - - - diff --git a/modules/client/front/summary/index.js b/modules/client/front/summary/index.js deleted file mode 100644 index 877579e33..000000000 --- a/modules/client/front/summary/index.js +++ /dev/null @@ -1,135 +0,0 @@ -import ngModule from '../module'; -import Summary from 'salix/components/summary'; -import './style.scss'; - -class Controller extends Summary { - constructor($element, $) { - super($element, $); - - this.ticketFilter = { - include: [ - { - relation: 'ticketState', - scope: { - fields: ['stateFk', 'code', 'alertLevel'], - include: { - relation: 'state' - } - } - }, - { - relation: 'invoiceOut', - scope: { - fields: ['id'] - } - }, - { - relation: 'agencyMode', - scope: { - fields: ['name'] - } - }, - ] - }; - } - - get client() { - return this._client; - } - - set client(value) { - this._client = value; - if (value) { - this.loadData(); - this.loadTickets(); - } - } - - loadData() { - this.$http.get(`Clients/${this.client.id}/summary`).then(res => { - if (res && res.data) { - this.summary = res.data; - - if (res.data.classifications.length) - this.grade = res.data.classifications[0].insurances[0].grade; - - this.summary.sumRisk = this.sumRisk(); - } - }); - } - - loadTickets() { - this.$.$applyAsync(() => this.$.ticketsModel.refresh()); - } - - get isEmployee() { - return this.aclService.hasAny(['employee']); - } - - sumRisk() { - let total = 0; - this.summary.clientRisks.forEach(risk => { - total += risk.amount; - }); - return total; - } - - claimRate(priceIncreasing) { - if (priceIncreasing) - return priceIncreasing * 100; - } - - claimingRate(rate) { - if (rate) - return rate * 100; - } - - stateColor(ticket) { - const ticketState = ticket.ticketState; - - if (!ticketState) return; - - if (ticketState.code === 'OK') - return 'success'; - else if (ticketState.code === 'FREE') - return 'notice'; - else if (ticketState.alertLevel === 1) - return 'warning'; - else if (ticketState.alertLevel === 0) - return 'alert'; - } - - chipColor(date) { - const today = Date.vnNew(); - today.setHours(0, 0, 0, 0); - - const ticketShipped = new Date(date); - ticketShipped.setHours(0, 0, 0, 0); - - const difference = today - ticketShipped; - - if (difference == 0) - return 'warning'; - if (difference < 0) - return 'success'; - } - - totalPriceColor(ticket) { - const total = parseInt(ticket.totalWithVat); - if (total > 0 && total < 50) - return 'warning'; - } - - preview(ticket) { - this.selectedTicket = ticket; - this.$.summary.show(); - } -} - -ngModule.vnComponent('vnClientSummary', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/summary/index.spec.js b/modules/client/front/summary/index.spec.js deleted file mode 100644 index a05d48518..000000000 --- a/modules/client/front/summary/index.spec.js +++ /dev/null @@ -1,154 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('Client', () => { - describe('Component vnClientSummary', () => { - let controller; - let $httpBackend; - let $window; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, _$httpBackend_, _$window_) => { - $window = _$window_; - $httpBackend = _$httpBackend_; - const $element = angular.element(''); - controller = $componentController('vnClientSummary', {$element}); - controller._client = {id: 1101}; - controller.$.ticketsModel = crudModel; - })); - - describe('client() setter', () => { - it('should call to the loadData() and loadTickets() methods', () => { - controller.loadData = jest.fn(); - controller.loadTickets = jest.fn(); - - controller.client = {id: 1102}; - - expect(controller.loadData).toHaveBeenCalledWith(); - expect(controller.loadTickets).toHaveBeenCalledWith(); - }); - }); - - describe('loadData()', () => { - it('should perform a GET query and then define the summary property', () => { - let res = {name: 'Superman', classifications: []}; - - jest.spyOn(controller, 'sumRisk').mockReturnThis(); - $httpBackend.expect('GET', `Clients/1101/summary`).respond(200, res); - - controller.loadData(); - $httpBackend.flush(); - - expect(controller.summary).toBeDefined(); - expect(controller.summary.name).toEqual('Superman'); - }); - }); - - describe('loadTickets()', () => { - it('should call to the model refresh() method', () => { - jest.spyOn(controller.$.ticketsModel, 'refresh'); - - controller.loadTickets(); - controller.$.$apply(); - - expect(controller.$.ticketsModel.refresh).toHaveBeenCalledWith(); - }); - }); - - describe('sumRisk()', () => { - it('should sum property amount of an array', () => { - controller.summary = { - clientRisks: [{ - companyFk: 442, - amount: 100 - }, - { - companyFk: 567, - amount: 200 - }]}; - - let result = controller.sumRisk(); - - expect(result).toEqual(300); - }); - }); - - describe('chipColor()', () => { - it('should return warning when the date is the present', () => { - let today = Date.vnNew(); - let result = controller.chipColor(today); - - expect(result).toEqual('warning'); - }); - - it('should return success when the date is in the future', () => { - let futureDate = Date.vnNew(); - futureDate = futureDate.setDate(futureDate.getDate() + 10); - let result = controller.chipColor(futureDate); - - expect(result).toEqual('success'); - }); - - it('should return undefined when the date is in the past', () => { - let pastDate = Date.vnNew(); - pastDate = pastDate.setDate(pastDate.getDate() - 10); - let result = controller.chipColor(pastDate); - - expect(result).toEqual(undefined); - }); - }); - - describe('stateColor()', () => { - it('should return "success" when the alertLevelCode property is "OK"', () => { - const result = controller.stateColor({ticketState: {code: 'OK'}}); - - expect(result).toEqual('success'); - }); - - it('should return "notice" when the alertLevelCode property is "FREE"', () => { - const result = controller.stateColor({ticketState: {code: 'FREE'}}); - - expect(result).toEqual('notice'); - }); - - it('should return "warning" when the alertLevel property is "1', () => { - const result = controller.stateColor({ticketState: {code: 'PACKING', alertLevel: 1}}); - - expect(result).toEqual('warning'); - }); - - it('should return "alert" when the alertLevel property is "0"', () => { - const result = controller.stateColor({ticketState: {code: 'FIXING', alertLevel: 0}}); - - expect(result).toEqual('alert'); - }); - }); - - describe('totalPriceColor()', () => { - it('should return "warning" when the ticket amount is less than 50€', () => { - const result = controller.totalPriceColor({totalWithVat: '8.50'}); - - expect(result).toEqual('warning'); - }); - }); - - describe('preview()', () => { - it('should show the dialog summary', () => { - controller.$.summary = {show: () => {}}; - jest.spyOn(controller.$.summary, 'show'); - - const ticket = {id: 1, clientFk: 1101}; - - const event = new MouseEvent('click', { - view: $window, - bubbles: true, - cancelable: true - }); - controller.preview(event, ticket); - - expect(controller.$.summary.show).toHaveBeenCalledWith(); - }); - }); - }); -}); diff --git a/modules/client/front/summary/locale/es.yml b/modules/client/front/summary/locale/es.yml deleted file mode 100644 index c1fde0c17..000000000 --- a/modules/client/front/summary/locale/es.yml +++ /dev/null @@ -1,26 +0,0 @@ -Default address: Consignatario predeterminado -Total greuge: Greuge total -Financial information: Datos financieros -Mana: Maná -Risk: Riesgo -Secured credit: Crédito asegurado -Average invoiced: Consumo medio -Sales person: Comercial -Recovery: Recobro -Basic data: Datos básicos -Balance due: Saldo vencido -Rate: Tarifa -Business data: Datos comerciales -Recovery since: Recobro desde -Fiscal address: Dirección fiscal -Invoices minus payments plus orders not yet invoiced: Facturas menos recibos mas pedidos sin facturar -Verdnatura's maximum risk: Riesgo máximo asumido por Verdnatura -Solunion's maximum risk: Riesgo máximo asumido por Solunion -Invoices minus payments: Facturas menos recibos -Deviated invoices minus payments: Facturas fuera de plazo menos recibos -Go to the client: Ir al cliente -Latest tickets: Últimos tickets -Rating: Clasificación -Value from 1 to 20. The higher the better value: Valor del 1 al 20. Cuanto más alto mejor valoración -Go to grafana: Ir a grafana -Business type: Tipo de negocio \ No newline at end of file diff --git a/modules/client/front/summary/style.scss b/modules/client/front/summary/style.scss deleted file mode 100644 index 7dc1cc928..000000000 --- a/modules/client/front/summary/style.scss +++ /dev/null @@ -1,14 +0,0 @@ -@import "variables"; - -vn-client-summary .summary { - max-width: $width-lg; - - .alert span { - color: $color-alert !important - } - - vn-horizontal h4 .grafana:after { - font-family: 'salixfont' !important; - content: "\e965"; - } -} diff --git a/modules/client/front/unpaid/index.html b/modules/client/front/unpaid/index.html deleted file mode 100644 index 2a0432f5a..000000000 --- a/modules/client/front/unpaid/index.html +++ /dev/null @@ -1,51 +0,0 @@ -
- - -
- - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/client/front/unpaid/index.js b/modules/client/front/unpaid/index.js deleted file mode 100644 index 1585b808d..000000000 --- a/modules/client/front/unpaid/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - setDefaultDate(hasData) { - if (hasData && !this.clientUnpaid.dated) - this.clientUnpaid.dated = Date.vnNew(); - } - - onSubmit() { - this.$.watcher.submit() - .then(() => this.card.reload()); - } -} - -ngModule.vnComponent('vnClientUnpaid', { - template: require('./index.html'), - controller: Controller, - require: { - card: '^vnClientCard' - } -}); diff --git a/modules/client/front/unpaid/index.spec.js b/modules/client/front/unpaid/index.spec.js deleted file mode 100644 index 0f6460a03..000000000 --- a/modules/client/front/unpaid/index.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -import './index'; - -describe('client unpaid', () => { - describe('Component vnClientUnpaid', () => { - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject($componentController => { - const $element = angular.element(''); - controller = $componentController('vnClientUnpaid', {$element}); - })); - - describe('setDefaultDate()', () => { - it(`should not set today date if has dated`, () => { - const hasData = true; - const yesterday = Date.vnNew(); - yesterday.setDate(yesterday.getDate() - 1); - - controller.clientUnpaid = { - dated: yesterday - }; - controller.setDefaultDate(hasData); - - expect(controller.clientUnpaid.dated).toEqual(yesterday); - }); - - it(`should set today if not has dated`, () => { - const hasData = true; - - controller.clientUnpaid = {}; - controller.setDefaultDate(hasData); - - expect(controller.clientUnpaid.dated).toBeDefined(); - }); - }); - }); -}); diff --git a/modules/client/front/unpaid/locale/es.yml b/modules/client/front/unpaid/locale/es.yml deleted file mode 100644 index d88764407..000000000 --- a/modules/client/front/unpaid/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Unpaid client: Cliente impagado \ No newline at end of file diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html deleted file mode 100644 index bf3d34c79..000000000 --- a/modules/client/front/web-access/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - diff --git a/modules/client/front/web-access/index.js b/modules/client/front/web-access/index.js deleted file mode 100644 index b5ba84bb6..000000000 --- a/modules/client/front/web-access/index.js +++ /dev/null @@ -1,99 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.canChangePassword = false; - this.canEnableCheckBox = true; - } - - set client(value) { - this._client = value; - if (!value) return; - - const filter = {where: {id: value.id}}; - this.$http.get(`VnUsers/preview`, {filter}) - .then(res => { - const [user] = res.data; - this.account = user; - }); - } - - get client() { - return this._client; - } - - $onChanges() { - if (this.client) { - this.account = this.client.account; - this.isCustomer(); - this.checkConditions(); - } - } - - isCustomer() { - if (this.client.id) { - this.$http.get(`Clients/${this.client.id}/hasCustomerRole`).then(res => { - this.canChangePassword = res.data && res.data; - }); - } - } - - checkConditions() { - if (this.client.id) { - this.$http.get(`Clients/${this.client.id}/isValidClient`).then(res => { - this.canEnableCheckBox = res.data; - }); - } - } - - onPassOpen() { - this.newPassword = ''; - this.repeatPassword = ''; - this.$.$apply(); - } - - onPassChange() { - try { - if (!this.newPassword) - throw new Error(`You must enter a new password`); - if (this.newPassword != this.repeatPassword) - throw new Error(`Passwords don't match`); - const data = { - newPassword: this.newPassword - }; - - this.$http.patch(`Clients/${this.client.id}/setPassword`, data).then(() => { - this.vnApp.showSuccess(this.$t('Data saved!')); - }); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - - return false; - } - - return true; - } - - onSubmit() { - const data = { - name: this.account.name, - email: this.account.email, - active: this.account.active - }; - this.$http.patch(`Clients/${this.client.id}/updateUser`, data).then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - }); - } -} -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnClientWebAccess', { - template: require('./index.html'), - controller: Controller, - bindings: { - client: '<' - } -}); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js deleted file mode 100644 index 7325bf932..000000000 --- a/modules/client/front/web-access/index.spec.js +++ /dev/null @@ -1,129 +0,0 @@ -import './index'; - -describe('Component VnClientWebAccess', () => { - let $httpBackend; - let $scope; - let vnApp; - let controller; - let $httpParamSerializer; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_, _vnApp_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - vnApp = _vnApp_; - jest.spyOn(vnApp, 'showError'); - const $element = angular.element(''); - controller = $componentController('vnClientWebAccess', {$element, $scope}); - })); - - describe('$onChanges()', () => { - it(`should pass client's account data to account then call isCustomer function`, () => { - jest.spyOn(controller, 'isCustomer'); - controller.client = {client: 'Bruce Wayne', account: 'Wayne Industries'}; - controller.account = {}; - controller.$onChanges(); - - expect(controller.account).toBe('Wayne Industries'); - expect(controller.isCustomer).toHaveBeenCalledWith(); - }); - }); - - describe('isCustomer()', () => { - it('should return true if the password can be modified', () => { - controller.client = {id: '1234'}; - const filter = {where: {id: controller.client.id}}; - const serializedParams = $httpParamSerializer({filter}); - - $httpBackend.expectGET(`VnUsers/preview?${serializedParams}`).respond('foo'); - $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond(true); - controller.isCustomer(); - $httpBackend.flush(); - - expect(controller.canChangePassword).toBeTruthy(); - }); - - it(`should return a false if the password can't be modified`, () => { - controller.client = {id: '1234'}; - const filter = {where: {id: controller.client.id}}; - const serializedParams = $httpParamSerializer({filter}); - - $httpBackend.expectGET(`VnUsers/preview?${serializedParams}`).respond('foo'); - $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond(false); - controller.isCustomer(); - $httpBackend.flush(); - - expect(controller.canChangePassword).toBeFalsy(); - }); - }); - - describe('checkConditions()', () => { - it('should perform a query to check if the client is valid', () => { - controller.client = {id: '1234'}; - const filter = {where: {id: controller.client.id}}; - const serializedParams = $httpParamSerializer({filter}); - - expect(controller.canEnableCheckBox).toBeTruthy(); - - $httpBackend.expectGET(`VnUsers/preview?${serializedParams}`).respond('foo'); - $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`).respond(false); - controller.checkConditions(); - $httpBackend.flush(); - - expect(controller.canEnableCheckBox).toBeFalsy(); - }); - }); - - describe('onPassOpen()', () => { - it('should set passwords to empty values', () => { - controller.newPassword = 'm24x8'; - controller.repeatPassword = 'm24x8'; - controller.onPassOpen(); - - expect(controller.newPassword).toBe(''); - expect(controller.repeatPassword).toBe(''); - }); - }); - - describe('onPassChange()', () => { - it('should request to update the password', () => { - controller.client = {id: '1234'}; - controller.newPassword = 'm24x8'; - controller.repeatPassword = 'm24x8'; - controller.canChangePassword = true; - const filter = {where: {id: controller.client.id}}; - const serializedParams = $httpParamSerializer({filter}); - - $httpBackend.expectGET(`VnUsers/preview?${serializedParams}`).respond('foo'); - const query = `Clients/${controller.client.id}/setPassword`; - $httpBackend.expectPATCH(query, {newPassword: controller.newPassword}).respond('done'); - controller.onPassChange(); - $httpBackend.flush(); - }); - - describe(`when password is empty`, () => { - it(`should throw 'You must enter a new password' error`, () => { - controller.client = {id: '1234'}; - controller.newPassword = ''; - controller.canChangePassword = true; - controller.onPassChange(); - - expect(vnApp.showError).toHaveBeenCalledWith(`You must enter a new password`); - }); - }); - - describe(`when passwords don't match`, () => { - it(`should throw Passwords don't match error`, () => { - controller.client = {id: '1234'}; - controller.newPassword = 'm24x8'; - controller.canChangePassword = true; - controller.repeatPassword = 'notMatchingPassword'; - controller.onPassChange(); - - expect(vnApp.showError).toHaveBeenCalledWith(`Passwords don't match`); - }); - }); - }); -}); diff --git a/modules/client/front/web-access/locale/es.yml b/modules/client/front/web-access/locale/es.yml deleted file mode 100644 index 5090ed020..000000000 --- a/modules/client/front/web-access/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -User: Usuario -Enable web access: Habilitar acceso web -New password: Nueva contraseña -Repeat password: Repetir contraseña -Change password: Cambiar contraseña -Passwords don't match: Las contraseñas no coinciden -You must enter a new password: Debes introducir una nueva contraseña -Recovery email: Correo de recuperación -This email is used for user to regain access their account.: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta. \ No newline at end of file diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html deleted file mode 100644 index 2ecfc950b..000000000 --- a/modules/client/front/web-payment/index.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - State - Id - Date - Amount - - - - - - - - - - - - {{::transaction.id}} - {{::transaction.created | date:'dd/MM/yyyy HH:mm'}} - {{::transaction.amount | currency: 'EUR':2}} - - - - - - - - - \ No newline at end of file diff --git a/modules/client/front/web-payment/index.js b/modules/client/front/web-payment/index.js deleted file mode 100644 index 00d0adc4d..000000000 --- a/modules/client/front/web-payment/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - confirm(transaction) { - const path = 'Clients/confirmTransaction'; - let data = {id: transaction.id}; - this.$http.post(path, data).then(res => { - this.$.model.refresh(); - }); - } - - getFormattedMessage(transaction) { - const errorMessage = transaction.errorMessage ? transaction.errorMessage : ''; - const separator = transaction.errorMessage && transaction.responseMessage ? '
' : ''; - const responseMessage = transaction.responseMessage ? transaction.responseMessage : ''; - return `${errorMessage}` - + separator - + `${responseMessage}`; - } -} - -ngModule.vnComponent('vnClientWebPayment', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/client/front/web-payment/index.spec.js b/modules/client/front/web-payment/index.spec.js deleted file mode 100644 index ee7d6c717..000000000 --- a/modules/client/front/web-payment/index.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import './index'; -import crudModel from 'core/mocks/crud-model'; - -describe('Component vnClientWebPayment', () => { - let $httpBackend; - let $scope; - let vnApp; - let controller; - - beforeEach(ngModule('client')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { - $scope = $rootScope.$new(); - $scope.model = crudModel; - $httpBackend = _$httpBackend_; - vnApp = _vnApp_; - jest.spyOn(vnApp, 'showError'); - const $element = angular.element(''); - controller = $componentController('vnClientWebPayment', {$element, $scope}); - })); - - describe('confirm()', () => { - it(`should confirm a transaction`, () => { - let transaction = {id: 1}; - let query = 'Clients/confirmTransaction'; - - controller.confirm(transaction); - $httpBackend.expect('POST', query, transaction).respond('ok'); - $httpBackend.flush(); - }); - }); - - describe('getFormattedMessage()', () => { - it(`should return error message and response Message`, () => { - let transaction = { - errorMessage: 'My error message', - responseMessage: 'My response message' - }; - let result = controller.getFormattedMessage(transaction); - - expect(result).toContain('My error message'); - expect(result).toContain('My response message'); - }); - }); -}); diff --git a/modules/client/front/web-payment/locale/es.yml b/modules/client/front/web-payment/locale/es.yml deleted file mode 100644 index 8e988857c..000000000 --- a/modules/client/front/web-payment/locale/es.yml +++ /dev/null @@ -1,5 +0,0 @@ -Web Payment: Pago Web -Confirmed: Confirmado -Confirm transaction: Confirmar transacción -Confirm: Confirmar -State: Estado \ No newline at end of file diff --git a/modules/client/front/web-payment/style.scss b/modules/client/front/web-payment/style.scss deleted file mode 100644 index 3c9b3b705..000000000 --- a/modules/client/front/web-payment/style.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "variables"; - -vn-client-web-payment { - vn-icon[icon=clear] { - color: $color-alert; - } - vn-icon[icon=check] { - color: $color-success; - } -} \ No newline at end of file