diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue deleted file mode 100644 index 6b7fb6228..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/components/SelectHouseholdAddress.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/components/SelectHouseholdAddress.vue deleted file mode 100644 index 74ce14c3c..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/components/SelectHouseholdAddress.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/index.js deleted file mode 100644 index e7a73238d..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import { createApp } from 'vue' -import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' -import { appMessages } from './js/i18n' -import { store } from './store' - -import App from './App.vue'; - -const root = window.vueRootComponent; - -/* -* Load all App component, for Household edition page -*/ - -const i18n = _createI18n(appMessages); - -const app = createApp({ - template: ``, -}) -.use(store) -.use(i18n) -.component('app', App) -.mount('#household-address'); - - - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/js/i18n.js deleted file mode 100644 index f7ee56e02..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/js/i18n.js +++ /dev/null @@ -1,21 +0,0 @@ -import { addressMessages } from 'ChillMainAssets/vuejs/Address/js/i18n' - -const appMessages = { - fr: { - select_a_existing_address: 'Sélectionner une adresse existante', - create_a_new_address: 'Créer une nouvelle adresse', - add_an_address_to_household: 'Enregistrer', - validFrom: 'Date du déménagement', - move_date: 'Date du déménagement', - back_to_the_list: 'Retour à la liste', - household_address_move_success: 'La nouvelle adresse du ménage est enregistrée', - household_address_edit_success: 'L\'adresse du ménage a été mise à jour', - loading: 'chargement en cours...' - } -}; - -Object.assign(appMessages.fr, addressMessages.fr); - -export { - appMessages -}; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/store/index.js deleted file mode 100644 index 9a3e4b866..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/store/index.js +++ /dev/null @@ -1,160 +0,0 @@ -import 'es6-promise/auto'; -import { createStore } from 'vuex'; - -import { postAddress, postPostalCode, patchAddress, getAddress } from 'ChillMainAssets/vuejs/Address/api'; -import { postAddressToHousehold } from '../api'; - -const debug = process.env.NODE_ENV !== 'production'; - -const store = createStore({ - strict: debug, - state: { - newAddress: {}, - editAddress: {}, //TODO or should be newAddress? - household: {}, - validFrom: {}, - errorMsg: [], - loading: false, - success: false - }, - getters: { - }, - mutations: { - catchError(state, error) { - state.errorMsg.push(error); - }, - addAddress(state, address) { - console.log('@M addAddress address', address); - state.newAddress = address; - }, - updateAddress(state, address) { - console.log('@M updateAddress address', address); - state.newAddress = address; - }, - addAddressToHousehold(state, household) { - console.log('@M addAddressToHousehold household', household); - state.household = household; - }, - addDateToAddress(state, validFrom) { - console.log('@M addDateToAddress address.validFrom', validFrom); - state.validFrom = validFrom; - }, - getEditAddress(state, address) { - console.log('@M getEditAddress address', address); - state.editAddress = address; - }, - setLoading(state, b) { - state.loading = b; - }, - setSuccess(state, b) { - state.success = b; - } - }, - actions: { - addAddress({ commit }, payload) { - console.log('@A addAddress payload', payload); - commit('setLoading', true); - if('newPostalCode' in payload){ - postPostalCode(payload.newPostalCode) - .then(postalCode => { - let body = payload; - body.postcode = {'id': postalCode.id }, - postAddress(body) - .then(address => new Promise((resolve, reject) => { - commit('addAddress', address); - resolve(); - commit('setLoading', false); - })) - .catch((error) => { - commit('catchError', error); - commit('setLoading', false); - }); - }) - - } else { - postAddress(payload) - .then(address => new Promise((resolve, reject) => { - commit('addAddress', address); - resolve(); - commit('setLoading', false); - })) - .catch((error) => { - commit('catchError', error); - commit('setLoading', false); - }); - } - }, - addDateToAddressAndAddressToHousehold({ commit }, payload) { - console.log('@A addDateToAddressAndAddressToHousehold payload', payload); - commit('setLoading', true); - patchAddress(payload.addressId, payload.body) - .then(address => new Promise((resolve, reject) => { - commit('addDateToAddress', address.validFrom); - resolve(); - }).then( - postAddressToHousehold(payload.householdId, payload.addressId) - .then(household => new Promise((resolve, reject) => { - commit('addAddressToHousehold', household); - commit('setSuccess', true); - commit('setLoading', false); - window.location.assign(payload.backUrl); - resolve(); - })) - .catch((error) => { - commit('catchError', error); - commit('setLoading', false); - }) - )) - .catch((error) => { - commit('catchError', error); - commit('setLoading', false); - }); - }, - updateAddress({ commit }, payload) { - console.log('@A updateAddress payload', payload); - - if('newPostalCode' in payload.newAddress){ // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode - let postalCodeBody = payload.newAddress.newPostalCode; - postalCodeBody = Object.assign(postalCodeBody, {'origin': 3}); - postPostalCode(postalCodeBody) - .then(postalCode => { - let body = payload.newAddress; - body.postcode = {'id': postalCode.id }, - patchAddress(payload.addressId, body) - .then(address => new Promise((resolve, reject) => { - commit('updateAddress', address); - commit('setSuccess', true); - resolve(); - })) - .catch((error) => { - commit('catchError', error); - }); - }) - - } else { - patchAddress(payload.addressId, payload.newAddress) - .then(address => new Promise((resolve, reject) => { - commit('updateAddress', address); - commit('setSuccess', true); - resolve(); - })) - .catch((error) => { - commit('catchError', error); - }); - } - }, - getEditAddress({ commit }, payload) { - console.log('@A getEditAddress payload', payload); - - getAddress(payload).then(address => new Promise((resolve, reject) => { - commit('getEditAddress', address); - resolve(); - })) - .catch((error) => { - commit('catchError', error); - }); - }, - } -}); - -export { store }; diff --git a/src/Bundle/ChillPersonBundle/chill.webpack.config.js b/src/Bundle/ChillPersonBundle/chill.webpack.config.js index df2d89245..42da38268 100644 --- a/src/Bundle/ChillPersonBundle/chill.webpack.config.js +++ b/src/Bundle/ChillPersonBundle/chill.webpack.config.js @@ -8,9 +8,6 @@ module.exports = function(encore, entries) ChillPersonAssets: __dirname + '/Resources/public' }); - // will disappear - //encore.addEntry('vue_household_address', __dirname + '/Resources/public/vuejs/HouseholdAddress/index.js'); - encore.addEntry('vue_household_members_editor', __dirname + '/Resources/public/vuejs/HouseholdMembersEditor/index.js'); encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js'); encore.addEntry('vue_accourse_work_create', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js');