diff --git a/modules/client/front/address/edit/index.html b/modules/client/front/address/edit/index.html index c2dce8f37..8c604d323 100644 --- a/modules/client/front/address/edit/index.html +++ b/modules/client/front/address/edit/index.html @@ -61,17 +61,11 @@ fields="['code', 'townFk']" field="$ctrl.address.postalCode" where="{townFk: town.selection.id}" - selection="$ctrl.postcodeSelection" search-function="{code: $search}" - fetch-function="{townFk: town.selection.id}" order="code, townFk" show-field="code" value-field="code" label="Postcode"> - - {{code}}, {{town.name}} - {{town.province.name}} - ({{town.province.country.country}}) - { expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); }); }); - - describe('postcodeSelection() setter', () => { - it(`should set the town, province and contry properties`, () => { - controller.address = {}; - controller._postcodeSelection = {townFk: 2}; - controller.postcodeSelection = { - 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); - }); - }); }); }); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 67d7705ce..061ee92f1 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -58,16 +58,12 @@ url="/api/Postcodes/location" fields="['code', 'townFk']" field="$ctrl.client.postcode" - selection="$ctrl.postcodeSelection" search-function="{code: $search}" where="{townFk: town.selection.id}" + order="code, townFk" show-field="code" value-field="code" - label="Postcode"> - - {{code}}, {{town.name}} - {{town.province.name}} - ({{town.province.country.country}}) - + label="Postcode"> diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index dac6d7db9..a794d93ac 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -56,24 +56,8 @@ export default class Controller { ); } } - - get postcodeSelection() { - return this._postcodeSelection; - } - - set postcodeSelection(selection) { - const hasValue = this._postcodeSelection; - this._postcodeSelection = selection; - - if (!selection || !hasValue) return; - - const town = selection.town; - const province = town.province; - - this.client.city = town.name; - this.client.provinceFk = province.id; - } } + Controller.$inject = ['$scope', '$http', 'vnApp', '$translate']; ngModule.component('vnClientFiscalData', {