From fae56408bb4de9432550a5c815b0509183f7e2f4 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Wed, 31 May 2017 12:57:18 +0200 Subject: [PATCH] merge --- client/auth/src/auth.js | 2 +- .../auth/src/login/{index.html => login.html} | 0 client/auth/src/login/{index.js => login.js} | 2 +- client/client/src/address-create/index.html | 46 -- client/client/src/address-create/index.js | 25 -- client/client/src/address-edit/index.html | 48 -- client/client/src/address-edit/index.js | 18 - client/client/src/addresses/index.html | 32 -- client/client/src/addresses/index.js | 6 - client/client/src/basic-data/index.html | 48 -- client/client/src/basic-data/index.js | 9 - client/client/src/billing-data/index.html | 43 -- client/client/src/billing-data/index.js | 11 - client/client/src/card/index.html | 10 - client/client/src/card/index.js | 17 - client/client/src/create/index.html | 28 -- client/client/src/create/index.js | 23 - client/client/src/descriptor/index.html | 15 - client/client/src/descriptor/index.js | 21 - client/client/src/fiscal-data/index.html | 45 -- client/client/src/fiscal-data/index.js | 11 - client/client/src/new-note/index.html | 18 - client/client/src/new-note/index.js | 27 -- client/client/src/notes/index.html | 17 - client/client/src/notes/index.js | 34 -- client/client/src/search-panel/index.html | 26 -- client/client/src/search-panel/index.js | 28 -- client/client/src/web-access/index.html | 42 -- client/client/src/web-access/index.js | 48 -- client/core/src/autocomplete/index.html | 10 - client/core/src/autocomplete/index.js | 418 ------------------ client/core/src/confirm/index.html | 23 - client/core/src/confirm/index.js | 16 - client/core/src/dialog/index.html | 13 - client/core/src/dialog/index.js | 111 ----- client/core/src/icon/index.js | 19 - client/core/src/icon/index.mdl.html | 1 - client/core/src/icon/index.mdl.js | 12 - client/core/src/paging/index.html | 10 - client/core/src/paging/index.js | 46 -- client/core/src/popover/index.js | 98 ---- client/core/src/snackbar/index.html | 4 - client/core/src/snackbar/index.js | 25 -- client/core/src/spinner/index.html | 2 - client/core/src/spinner/index.js | 58 --- client/core/src/subtitle/index.html | 2 - client/core/src/subtitle/index.js | 6 - client/core/src/textfield/index.js | 82 ---- client/core/src/textfield/index.mdl.html | 18 - client/core/src/textfield/index.mdl.js | 16 - client/core/src/title/index.html | 2 - client/core/src/title/index.js | 6 - client/core/src/watcher/index.html | 6 - client/core/src/watcher/index.js | 162 ------- services/mailer/.gitignore | 3 +- 55 files changed, 4 insertions(+), 1865 deletions(-) rename client/auth/src/login/{index.html => login.html} (100%) mode change 100755 => 100644 rename client/auth/src/login/{index.js => login.js} (98%) delete mode 100644 client/client/src/address-create/index.html delete mode 100644 client/client/src/address-create/index.js delete mode 100644 client/client/src/address-edit/index.html delete mode 100644 client/client/src/address-edit/index.js delete mode 100644 client/client/src/addresses/index.html delete mode 100644 client/client/src/addresses/index.js delete mode 100644 client/client/src/basic-data/index.html delete mode 100644 client/client/src/basic-data/index.js delete mode 100644 client/client/src/billing-data/index.html delete mode 100644 client/client/src/billing-data/index.js delete mode 100644 client/client/src/card/index.html delete mode 100644 client/client/src/card/index.js delete mode 100644 client/client/src/create/index.html delete mode 100644 client/client/src/create/index.js delete mode 100644 client/client/src/descriptor/index.html delete mode 100644 client/client/src/descriptor/index.js delete mode 100644 client/client/src/fiscal-data/index.html delete mode 100644 client/client/src/fiscal-data/index.js delete mode 100644 client/client/src/new-note/index.html delete mode 100644 client/client/src/new-note/index.js delete mode 100644 client/client/src/notes/index.html delete mode 100644 client/client/src/notes/index.js delete mode 100644 client/client/src/search-panel/index.html delete mode 100644 client/client/src/search-panel/index.js delete mode 100644 client/client/src/web-access/index.html delete mode 100644 client/client/src/web-access/index.js delete mode 100644 client/core/src/autocomplete/index.html delete mode 100644 client/core/src/autocomplete/index.js delete mode 100644 client/core/src/confirm/index.html delete mode 100644 client/core/src/confirm/index.js delete mode 100644 client/core/src/dialog/index.html delete mode 100644 client/core/src/dialog/index.js delete mode 100644 client/core/src/icon/index.js delete mode 100644 client/core/src/icon/index.mdl.html delete mode 100644 client/core/src/icon/index.mdl.js delete mode 100644 client/core/src/paging/index.html delete mode 100644 client/core/src/paging/index.js delete mode 100644 client/core/src/popover/index.js delete mode 100644 client/core/src/snackbar/index.html delete mode 100644 client/core/src/snackbar/index.js delete mode 100644 client/core/src/spinner/index.html delete mode 100644 client/core/src/spinner/index.js delete mode 100644 client/core/src/subtitle/index.html delete mode 100644 client/core/src/subtitle/index.js delete mode 100644 client/core/src/textfield/index.js delete mode 100644 client/core/src/textfield/index.mdl.html delete mode 100644 client/core/src/textfield/index.mdl.js delete mode 100644 client/core/src/title/index.html delete mode 100644 client/core/src/title/index.js delete mode 100644 client/core/src/watcher/index.html delete mode 100644 client/core/src/watcher/index.js diff --git a/client/auth/src/auth.js b/client/auth/src/auth.js index 703c81193..8b7c022dd 100644 --- a/client/auth/src/auth.js +++ b/client/auth/src/auth.js @@ -1,3 +1,3 @@ import './ngModule'; import './config'; -import './login/index'; +import './login/login'; diff --git a/client/auth/src/login/index.html b/client/auth/src/login/login.html old mode 100755 new mode 100644 similarity index 100% rename from client/auth/src/login/index.html rename to client/auth/src/login/login.html diff --git a/client/auth/src/login/index.js b/client/auth/src/login/login.js similarity index 98% rename from client/auth/src/login/index.js rename to client/auth/src/login/login.js index 7c7447d73..229c1a345 100644 --- a/client/auth/src/login/index.js +++ b/client/auth/src/login/login.js @@ -76,6 +76,6 @@ export default class Controller { Controller.$inject = ['$element', '$scope', '$window', '$http']; ngModule.component('vnLogin', { - template: require('./index.html'), + template: require('./login.html'), controller: Controller }); diff --git a/client/client/src/address-create/index.html b/client/client/src/address-create/index.html deleted file mode 100644 index f014ceb36..000000000 --- a/client/client/src/address-create/index.html +++ /dev/null @@ -1,46 +0,0 @@ - - -
- - - Consignatario - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/client/client/src/address-create/index.js b/client/client/src/address-create/index.js deleted file mode 100644 index 7626ea5a8..000000000 --- a/client/client/src/address-create/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import {module} from '../module'; - -class Controller { - constructor($scope, $state) { - this.$ = $scope; - this.$state = $state; - this.address = { - clientFk: parseInt($state.params.id), - enabled: true - }; - } - onSubmit() { - this.$.watcher.submit().then( - () => this.$state.go('clientCard.addresses') - ); - } -} -Controller.$inject = ['$scope', '$state']; - -export const NAME = 'vnAddressCreate'; -export const COMPONENT = { - template: require('./index.html'), - controller: Controller -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/address-edit/index.html b/client/client/src/address-edit/index.html deleted file mode 100644 index c2086ff2a..000000000 --- a/client/client/src/address-edit/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - -
- - - Consignatario - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/client/client/src/address-edit/index.js b/client/client/src/address-edit/index.js deleted file mode 100644 index 70f609d2d..000000000 --- a/client/client/src/address-edit/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import {module} from '../module'; - -class Controller { - constructor($stateParams) { - this.address = { - id: $stateParams.addressId - }; - } -} -Controller.$inject = ['$stateParams']; - -export const NAME = 'vnAddressEdit'; -export const COMPONENT = { - template: require('./index.html'), - controllerAs: 'addressData', - controller: Controller -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/addresses/index.html b/client/client/src/addresses/index.html deleted file mode 100644 index 1b11b1931..000000000 --- a/client/client/src/addresses/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Consignatario - - - - - -
{{i.consignee}}
-
{{i.street}}
-
{{i.city}}, {{i.province}}
-
{{i.phone}}, {{i.mobile}}
-
- - - -
-
-
-
-
- - - -
diff --git a/client/client/src/addresses/index.js b/client/client/src/addresses/index.js deleted file mode 100644 index 0c0dc0846..000000000 --- a/client/client/src/addresses/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import {module} from '../module'; - -export const component = { - template: require('./index.html') -}; -module.component('vnClientAddresses', component); diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html deleted file mode 100644 index 4a4e7c391..000000000 --- a/client/client/src/basic-data/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - -
- - - Datos básicos - - - - - - - - - - - - - - - {{::i.name}} {{::i.surname}} - - - - - - - - - - -
diff --git a/client/client/src/basic-data/index.js b/client/client/src/basic-data/index.js deleted file mode 100644 index 2e3dececc..000000000 --- a/client/client/src/basic-data/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import {module} from '../module'; - -export const component = { - template: require('./index.html'), - bindings: { - client: '<' - } -}; -module.component('vnClientBasicData', component); diff --git a/client/client/src/billing-data/index.html b/client/client/src/billing-data/index.html deleted file mode 100644 index a001ba49e..000000000 --- a/client/client/src/billing-data/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - -
- - - Información de facturación - - - - - - - - - - - - - - - - Documentación - - - - - - - - - - -
\ No newline at end of file diff --git a/client/client/src/billing-data/index.js b/client/client/src/billing-data/index.js deleted file mode 100644 index 7c6c6ffeb..000000000 --- a/client/client/src/billing-data/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import {module} from '../module'; - -export const NAME = 'vnClientBillingData'; -export const COMPONENT = { - template: require('./index.html'), - controllerAs: 'bill', - bindings: { - client: '<' - } -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/card/index.html b/client/client/src/card/index.html deleted file mode 100644 index 589deb152..000000000 --- a/client/client/src/card/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js deleted file mode 100644 index 107aa9815..000000000 --- a/client/client/src/card/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import {module} from '../module'; -import './style.css'; - -export const NAME = 'vnClientCard'; - -export default class vnClientCard { - constructor() { - this.client = null; - } -} - - -module.component(NAME, { - template: require('./index.html'), - controllerAs: 'card', - controller: vnClientCard -}); diff --git a/client/client/src/create/index.html b/client/client/src/create/index.html deleted file mode 100644 index 45b290997..000000000 --- a/client/client/src/create/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - -
-
- - - Crear Cliente - - - - - - - - - - - - - - -
-
diff --git a/client/client/src/create/index.js b/client/client/src/create/index.js deleted file mode 100644 index f42583d25..000000000 --- a/client/client/src/create/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import {module} from '../module'; - -class Controller { - constructor($scope, $state) { - this.$scope = $scope; - this.$state = $state; - this.client = { - active: true - }; - } - onSubmit() { - this.$scope.watcher.submit().then( - json => this.$state.go('clientCard.basicData', {id: json.data.id}) - ); - } -} -Controller.$inject = ['$scope', '$state']; - -export const component = { - template: require('./index.html'), - controller: Controller -}; -module.component('vnClientCreate', component); diff --git a/client/client/src/descriptor/index.html b/client/client/src/descriptor/index.html deleted file mode 100644 index 333803051..000000000 --- a/client/client/src/descriptor/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - person - - -
{{descriptor.client.id}}
-
{{descriptor.client.name}}
-
{{descriptor.client.phone}}
- -
-
-
-
diff --git a/client/client/src/descriptor/index.js b/client/client/src/descriptor/index.js deleted file mode 100644 index 8c2da7404..000000000 --- a/client/client/src/descriptor/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import {module} from '../module'; -import './style.css'; - -export const NAME = 'vnDescriptor'; -export const COMPONENT = { - template: require('./index.html'), - controllerAs: 'descriptor', - bindings: { - client: '<', - active: '<' - }, - controller: function($http, $scope) { - var self = this; - $scope.$watch('descriptor.active', function(newValue, oldValue) { - if (oldValue !== undefined) - $http.put(`/client/api/Clients/${self.client.id}/activate`); - }); - } -}; -COMPONENT.controller.$inject = ['$http', '$scope']; -module.component(NAME, COMPONENT); diff --git a/client/client/src/fiscal-data/index.html b/client/client/src/fiscal-data/index.html deleted file mode 100644 index 7e9b2a7e9..000000000 --- a/client/client/src/fiscal-data/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - -
- - - Datos fiscales y de facturación - - - - - - - - - - - - - - - - - - - - - -
diff --git a/client/client/src/fiscal-data/index.js b/client/client/src/fiscal-data/index.js deleted file mode 100644 index d6ece6020..000000000 --- a/client/client/src/fiscal-data/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import {module} from '../module'; - -export const NAME = 'vnClientFiscalData'; -export const COMPONENT = { - template: require('./index.html'), - controllerAs: 'fiscal', - bindings: { - client: '<' - } -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/new-note/index.html b/client/client/src/new-note/index.html deleted file mode 100644 index 2e05ec244..000000000 --- a/client/client/src/new-note/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - -
- - - Nueva nota - - - - - - -
\ No newline at end of file diff --git a/client/client/src/new-note/index.js b/client/client/src/new-note/index.js deleted file mode 100644 index d69fa470e..000000000 --- a/client/client/src/new-note/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import template from './index.html'; -import {module} from '../module'; - -class Controller { - constructor($element, $state) { - this.element = $element[0]; - this.$state = $state; - this.note = { - clientFk: $state.params.id, - text: null - }; - } - onSubmit() { - this.element.querySelector('vn-watcher').$ctrl.submit().then( - () => this.$state.go('clientCard.notes') - ); - } -} -Controller.$inject = ['$element', '$state']; - -export const NAME = 'vnNewNote'; -export const COMPONENT = { - template: template, - controllerAs: 'newNote', - controller: Controller -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html deleted file mode 100644 index a671a353e..000000000 --- a/client/client/src/notes/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - Notas - - -
{{n.created | date:'dd/MM/yyyy HH:mm'}}
-
{{n.employee.name}}
-
{{n.text}}
-
-
-
-
- - \ No newline at end of file diff --git a/client/client/src/notes/index.js b/client/client/src/notes/index.js deleted file mode 100644 index d7fc78bf1..000000000 --- a/client/client/src/notes/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import './style.css'; -import template from './index.html'; -import {module} from '../module'; - -export const NAME = 'vnClientNotes'; -export const COMPONENT = { - template: template, - controllerAs: 'observation', - bindings: { - client: '<' - }, - controller: function($http, $state) { - this.$onChanges = function(changes) { - if (this.client) { - this.getObservation(this.client.id); - } - }; - - this.getObservation = function(clientId) { - let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); - $http.get(`/client/api/clientObservations?filter=${json}`).then( - json => { - this.observations = json.data; - } - ); - }; - - this.newObservation = () => { - $state.go("clientCard.notes.create", {id: this.client.id}); - }; - } -}; -COMPONENT.controller.$inject = ['$http', '$state']; -module.component(NAME, COMPONENT); diff --git a/client/client/src/search-panel/index.html b/client/client/src/search-panel/index.html deleted file mode 100644 index 60385efc5..000000000 --- a/client/client/src/search-panel/index.html +++ /dev/null @@ -1,26 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - - - -
-
- diff --git a/client/client/src/search-panel/index.js b/client/client/src/search-panel/index.js deleted file mode 100644 index bf8af3c03..000000000 --- a/client/client/src/search-panel/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import {module} from '../module'; - -export const NAME = 'vnClientSearchPanel'; -export const COMPONENT = { - template: require('./index.html'), - controller: function($scope, $window) { - this.filter = {id: null, fi: null, name: null, socialName: null, city: null, postcode: null, email: null, phone: null}; - this.formVisibility = true; - this.onSearch = () => { - this.setStorageValue(); - this.onSubmit(this.filter); - }; - this.getKeyPressed = function(event) { - if (event.which === 27) - this.formVisibility = false; - }; - this.$onChanges = () => { - var value = JSON.parse($window.sessionStorage.getItem('filter')); - if (value !== undefined) - this.filter = value; - }; - this.setStorageValue = () => { - $window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); - }; - } -}; - -module.component(NAME, COMPONENT); diff --git a/client/client/src/web-access/index.html b/client/client/src/web-access/index.html deleted file mode 100644 index d2e039024..000000000 --- a/client/client/src/web-access/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - -
- - - Web access - - - - - - - - -
- - - - - - - - - - - - diff --git a/client/client/src/web-access/index.js b/client/client/src/web-access/index.js deleted file mode 100644 index d7f444af4..000000000 --- a/client/client/src/web-access/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import {module} from '../module'; - -class Controller { - constructor($scope, $http, vnAppLogger) { - this.$scope = $scope; - this.$http = $http; - this.vnAppLogger = vnAppLogger; - } - $onChanges() { - if(this.client) - this.account = this.client.account; - } - onPassOpen() { - this.newPassword = ''; - this.repeatPassword = ''; - this.$scope.$apply(); - } - onPassChange(response) { - if(response == 'ACCEPT') - try { - if(!this.newPassword) - throw new Error(`Passwords can't be empty`); - if(this.newPassword != this.repeatPassword) - throw new Error(`Passwords don't match`); - - let account = { - password: this.newPassword - }; - - this.$http.put(`/client/api/Accounts/${this.client.id}`, account); - } - catch(e) { - this.vnAppLogger.showError(e.message); - return false; - } - - return true; - } -} -Controller.$inject = ['$scope', '$http', 'vnAppLogger']; - -module.component('vnClientWebAccess', { - template: require('./index.html'), - bindings: { - client: '<' - }, - controller: Controller -}); diff --git a/client/core/src/autocomplete/index.html b/client/core/src/autocomplete/index.html deleted file mode 100644 index 4d25b25c1..000000000 --- a/client/core/src/autocomplete/index.html +++ /dev/null @@ -1,10 +0,0 @@ -
- - -
diff --git a/client/core/src/autocomplete/index.js b/client/core/src/autocomplete/index.js deleted file mode 100644 index 2cd088c9b..000000000 --- a/client/core/src/autocomplete/index.js +++ /dev/null @@ -1,418 +0,0 @@ -import {module} from '../module'; -import Component from '../lib/component'; -import './style.scss'; - -/** - * Combobox like component with search and partial data loading features. - */ -export default class Autocomplete extends Component { - constructor($element, $scope, $http, vnPopover, $transclude) { - super($element); - this.input = $element[0].querySelector('input'); - this.item = null; - this.data = null; - this.popover = null; - this.displayData = null; - this.timeoutId = null; - this.lastSearch = null; - this.lastRequest = null; - this.currentRequest = null; - this.moreData = false; - this.activeOption = -1; - this.locked = false; - this.$http = $http; - this.$scope = $scope; - this.vnPopover = vnPopover; - this.$transclude = $transclude; - this.scopes = null; - - Object.assign(this, { - maxRows: 10, - requestDelay: 350, - showField: 'name', - valueField: 'id', - itemAs: 'i' - }); - - componentHandler.upgradeElement($element[0].firstChild); - } - set field(value) { - this.locked = true; - this.setValue(value); - this.locked = false; - } - get field() { - return this.value; - } - set initialData(value) { - if (value) { - if (!this.data) - this.data = []; - this.data.push(value); - } - } - set selectFields(value) { - this._selectFields = []; - - if (!value) - return; - - let res = value.split(','); - for (let i of res) - this._selectFields.push(i.trim()); - } - mdlUpdate() { - let mdlField = this.element.firstChild.MaterialTextfield; - if (mdlField) - mdlField.updateClasses_(); - } - loadData(textFilter) { - textFilter = textFilter ? textFilter : ''; - - if (this.lastSearch === textFilter) { - this.showPopoverIfFocus(); - return; - } - - this.lastSearch = textFilter; - - let lastRequest = this.lastRequest; - let requestWillSame = lastRequest !== null - && !this.moreData - && textFilter.substr(0, lastRequest.length) === lastRequest; - - if (requestWillSame) - this.localFilter(textFilter); - else - this.requestData(textFilter, false); - } - getRequestFields() { - let fields = {}; - fields[this.valueField] = true; - fields[this.showField] = true; - - if (this._selectFields) - for (let field of this._selectFields) - fields[field] = true; - - return fields; - } - requestData(textFilter, append) { - let where = {}; - let skip = 0; - - if (textFilter) - where[this.showField] = {regexp: textFilter}; - if (append && this.data) - skip = this.data.length; - - let filter = { - fields: this.getRequestFields(), - where: where, - order: `${this.showField} ASC`, - skip: skip, - limit: this.maxRows - }; - - this.lastRequest = textFilter ? textFilter : ''; - let json = JSON.stringify(filter); - - if (this.currentRequest) - this.currentRequest.resolve(); - - this.currentRequest = this.$http.get(`${this.url}?filter=${json}`); - this.currentRequest.then( - json => this.onRequest(json.data, append), - json => this.onRequest([]) - ); - } - onRequest(data, append) { - this.currentRequest = null; - this.moreData = data.length >= this.maxRows; - - if (!append || !this.data) - this.data = data; - else - this.data = this.data.concat(data); - - this.setDisplayData(this.data); - } - localFilter(textFilter) { - let regex = new RegExp(textFilter, 'i'); - let data = this.data.filter(item => { - return regex.test(item[this.showField]); - }); - this.setDisplayData(data); - } - setDisplayData(data) { - this.displayData = data; - this.showPopoverIfFocus(); - } - showPopoverIfFocus() { - if (this.hasFocus) - this.showPopover(); - } - destroyScopes() { - if (this.scopes) - for (let scope of this.scopes) - scope.$destroy(); - } - showPopover() { - let data = this.displayData; - - if (!data) - return; - - let fragment = this.document.createDocumentFragment(); - this.destroyScopes(); - this.scopes = []; - - let hasTemplate = this.$transclude.isSlotFilled('tplItem'); - - for (let i = 0; i < data.length; i++) { - let li = this.document.createElement('li'); - fragment.appendChild(li); - - if (hasTemplate) { - this.$transclude((clone, scope) => { - scope[this.itemAs] = data[i]; - li.appendChild(clone[0]); - this.scopes[i] = scope; - }, null, 'tplItem'); - } else { - let text = this.document.createTextNode(data[i][this.showField]); - li.appendChild(text); - } - } - - if (this.moreData) { - let li = this.document.createElement('li'); - li.appendChild(this.document.createTextNode('Load more')); - li.className = 'load-more'; - fragment.appendChild(li); - } - - if (this.popover) { - this.popover.innerHTML = ''; - this.popover.appendChild(fragment); - } else { - let popover = this.document.createElement('ul'); - popover.addEventListener('click', - e => this.onPopoverClick(e)); - popover.addEventListener('mousedown', - e => this.onPopoverMousedown(e)); - popover.className = 'vn-autocomplete'; - popover.appendChild(fragment); - this.vnPopover.show(popover, this.input); - this.popover = popover; - } - } - hidePopover() { - if (!this.popover) return; - this.activeOption = -1; - this.vnPopover.hide(); - this.destroyScopes(); - this.popover = null; - } - selectPopoverOption(index) { - if (!this.popover || index === -1) return; - if (index < this.displayData.length) { - this.selectOptionByDataIndex(this.displayData, index); - this.hidePopover(); - } else - this.requestData(this.lastRequest, true); - } - onPopoverClick(event) { - let target = event.target; - let childs = this.popover.childNodes; - - if (target === this.popover) - return; - - while (target.parentNode !== this.popover) - target = target.parentNode; - - for (let i = 0; i < childs.length; i++) - if (childs[i] === target) { - this.selectPopoverOption(i); - break; - } - } - onPopoverMousedown(event) { - // Prevents input from loosing focus - event.preventDefault(); - } - onClick(event) { - if (!this.popover) - this.showPopover(); - } - onFocus() { - this.hasFocus = true; - this.input.select(); - - this.loadData(); - } - onBlur() { - this.hasFocus = false; - this.restoreShowValue(); - this.hidePopover(); - } - onKeydown(event) { - switch (event.keyCode) { - case 13: // Enter - this.selectPopoverOption(this.activeOption); - break; - case 27: // Escape - this.restoreShowValue(); - this.input.select(); - break; - case 38: // Arrow up - this.activateOption(this.activeOption - 1); - break; - case 40: // Arrow down - this.activateOption(this.activeOption + 1); - break; - default: - return; - } - - event.preventDefault(); - } - onKeyup(event) { - if (!this.isKeycodePrintable(event.keyCode)) return; - if (this.timeoutId) clearTimeout(this.timeoutId); - this.timeoutId = setTimeout(() => this.onTimeout(), this.requestDelay); - } - onTimeout() { - this.loadData(this.input.value); - this.timeoutId = null; - } - isKeycodePrintable(keyCode) { - return keyCode === 32 // Spacebar - || keyCode === 8 // Backspace - || (keyCode > 47 && keyCode < 58) // Numbers - || (keyCode > 64 && keyCode < 91) // Letters - || (keyCode > 95 && keyCode < 112) // Numpad - || (keyCode > 185 && keyCode < 193) // ;=,-./` - || (keyCode > 218 && keyCode < 223); // [\]' - } - restoreShowValue() { - this.putItem(this.item); - } - requestItem() { - if (!this.value) return; - - let where = {}; - where[this.valueField] = this.value; - - let filter = { - fields: this.getRequestFields(), - where: where - }; - - let json = JSON.stringify(filter); - - this.$http.get(`${this.url}?filter=${json}`).then( - json => this.onItemRequest(json.data), - json => this.onItemRequest(null) - ); - } - onItemRequest(data) { - if (data && data.length > 0) - this.showItem(data[0]); - else - this.showItem(null); - } - activateOption(index) { - if (!this.popover) - this.showPopover(); - - let popover = this.popover; - let childs = popover.childNodes; - let len = this.displayData.length; - - if (this.activeOption >= 0) - childs[this.activeOption].className = ''; - - if (index >= len) - index = 0; - else if (index < 0) - index = len - 1; - - if (index >= 0) { - let opt = childs[index]; - let top = popover.scrollTop; - let height = popover.clientHeight; - - if (opt.offsetTop + opt.offsetHeight > top + height) - top = opt.offsetTop + opt.offsetHeight - height; - else if (opt.offsetTop < top) - top = opt.offsetTop; - - opt.className = 'active'; - popover.scrollTop = top; - } - - this.activeOption = index; - } - setValue(value) { - this.value = value; - - if (value) { - let data = this.data; - - if (data) - for (let i = 0; i < data.length; i++) - if (data[i][this.valueField] == value) { - this.putItem(data[i]); - return; - } - - this.requestItem(); - } else - this.putItem(null); - } - selectOptionByIndex(index) { - this.selectOptionByDataIndex(this.data, index); - } - selectOptionByDataIndex(data, index) { - if (data && index >= 0 && index < data.length) - this.putItem(data[index]); - else - this.putItem(null); - } - putItem(item) { - this.showItem(item); - let value = item ? item[this.valueField] : undefined; - - if (!this.locked) - this.value = value; - } - showItem(item) { - this.input.value = item ? item[this.showField] : ''; - this.item = item; - this.mdlUpdate(); - } - $onDestroy() { - this.destroyScopes(); - } -} -Autocomplete.$inject = ['$element', '$scope', '$http', 'vnPopover', '$transclude']; - -module.component('vnAutocomplete', { - template: require('./index.html'), - bindings: { - url: '@', - showField: '@?', - valueField: '@?', - selectFields: '@?', - initialData: ' - -
-
- -
- {{$ctrl.question}} -
-
- {{$ctrl.message}} -
-
-
-
- - - - -
-
- diff --git a/client/core/src/confirm/index.js b/client/core/src/confirm/index.js deleted file mode 100644 index 0d7c56cc0..000000000 --- a/client/core/src/confirm/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import {module} from '../module'; -import Dialog from '../dialog/index'; -import './style.css'; - -export default class Confirm extends Dialog {} -Dialog.$inject = ['$element']; - -module.component('vnConfirm', { - template: require('./index.html'), - bindings: { - onResponse: '&', - question: '@', - message: '@' - }, - controller: Confirm -}); diff --git a/client/core/src/dialog/index.html b/client/core/src/dialog/index.html deleted file mode 100644 index 4ccb39e00..000000000 --- a/client/core/src/dialog/index.html +++ /dev/null @@ -1,13 +0,0 @@ -
- -
-
-
-
-
-
\ No newline at end of file diff --git a/client/core/src/dialog/index.js b/client/core/src/dialog/index.js deleted file mode 100644 index e45f66b93..000000000 --- a/client/core/src/dialog/index.js +++ /dev/null @@ -1,111 +0,0 @@ -import {module} from '../module'; -import Component from '../lib/component'; -import './style.scss'; - -/** - * Dialog component. - */ -export default class Dialog extends Component { - /** - * Contructor. - */ - constructor($element) { - super($element); - $element.addClass('vn-dialog'); - this.dialog = $element[0].firstChild; - this.element.addEventListener('mousedown', - event => this.onBackgroundMouseDown(event)); - } - /** - * Displays the dialog to the user. - */ - show() { - let style = this.dialog.style; - let screenMargin = 20; - - let window = this.window; - let innerWidth = window.innerWidth; - let innerHeight = window.innerHeight; - let width = this.dialog.offsetWidth; - let height = this.dialog.offsetHeight; - - if (width + screenMargin > innerWidth) { - width = innerWidth - dblMargin; - style.width = width + 'px'; - } - if (height + screenMargin > innerHeight) { - height = innerHeight - dblMargin; - style.height = height + 'px'; - } - - this.keypressHandler = - event => this.onKeypress(event); - this.document.addEventListener('keypress', - this.keypressHandler); - this.element.style.display = 'block'; - - if (this.onOpen) - this.onOpen(); - } - /** - * Hides the dialog calling the response handler. - */ - hide() { - this.fireResponse(); - this.realHide(); - } - /** - * Calls the response handler. - */ - fireResponse(response) { - let cancel = false; - if (this.onResponse) - cancel = this.onResponse({response: response}); - return cancel; - } - realHide() { - this.element.style.display = 'none'; - this.document.removeEventListener('keypress', - this.keypressHandler); - this.lastEvent = null; - } - onButtonClick(event) { - let buttonBar = this.element.querySelector('.button-bar'); - let buttons = buttonBar.querySelector('tpl-buttons'); - let node = event.target; - - while (node.parentNode != buttons) { - if (node == buttonBar) return; - node = node.parentNode; - } - - let response = node.getAttribute('response'); - let cancel = this.fireResponse(response); - if (cancel !== false) this.realHide(); - } - onDialogMouseDown(event) { - this.lastEvent = event; - } - onBackgroundMouseDown(event) { - if (event != this.lastEvent) - this.hide(); - } - onKeypress(event) { - if (event.keyCode == 27) // Esc - this.hide(); - } -} -Dialog.$inject = ['$element']; - -module.component('vnDialog', { - template: require('./index.html'), - transclude: { - tplBody: 'tplBody', - tplButtons: 'tplButtons' - }, - bindings: { - onOpen: '&', - onResponse: '&' - }, - controller: Dialog -}); diff --git a/client/core/src/icon/index.js b/client/core/src/icon/index.js deleted file mode 100644 index 7e36fab97..000000000 --- a/client/core/src/icon/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import {module} from '../module'; -import './index.mdl'; -import './style.css'; -import * as resolveFactory from '../lib/resolveDefaultComponents'; - -const _NAME = 'icon'; -export const NAME = 'vnIcon'; - -export function directive(resolver) { - return { - restrict: 'E', - template: function(_, attrs) { - return resolver.getTemplate(_NAME, attrs); - } - }; -} -directive.$inject = [resolveFactory.NAME]; - -module.directive(NAME, directive); diff --git a/client/core/src/icon/index.mdl.html b/client/core/src/icon/index.mdl.html deleted file mode 100644 index 865296d9b..000000000 --- a/client/core/src/icon/index.mdl.html +++ /dev/null @@ -1 +0,0 @@ -*[icon]* diff --git a/client/core/src/icon/index.mdl.js b/client/core/src/icon/index.mdl.js deleted file mode 100644 index 3084fdd12..000000000 --- a/client/core/src/icon/index.mdl.js +++ /dev/null @@ -1,12 +0,0 @@ -import {module} from '../module'; -import template from './index.mdl.html'; - -export const NAME = 'vnIconMdlFactory'; -export function factory() { - return { - template: template, - default: {} - } -} - -module.factory(NAME, factory); diff --git a/client/core/src/paging/index.html b/client/core/src/paging/index.html deleted file mode 100644 index 6e2f56fd3..000000000 --- a/client/core/src/paging/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/client/core/src/paging/index.js b/client/core/src/paging/index.js deleted file mode 100644 index fd17b994e..000000000 --- a/client/core/src/paging/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import {module} from '../module'; -import './style.scss'; - -export default class Paging { - get numPages() { - return Math.ceil(this.numItems / this.numPerPage); - } - constructor($http, $scope) { - this.$http = $http; - this.$scope = $scope; - this.where = this.filter; - this.numPerPage = null; - this.numItems = 0; - $scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated()); - } - $onChanges(changes) { - if (!this.index) return; - this.numPerPage = this.index.filter.size; - if(changes.total) - this.numItems = changes.total.currentValue; - } - onModelUpdated() { - let index = this.index; - let filter = index.filter; - - if (filter.page >= this.numPages - && index.model.length >= this.numPerPage) - this.numItems = filter.page * filter.size + 1; - } - onPageChange(page) { - this.index.filter.page = page; - this.index.accept(); - } -} -Paging.$inject = ['$http', '$scope']; - -export const NAME = 'vnPaging'; -export const COMPONENT = { - template: require('./index.html'), - bindings: { - index: '<', - total: '<' - }, - controller: Paging -}; -module.component(NAME, COMPONENT); diff --git a/client/core/src/popover/index.js b/client/core/src/popover/index.js deleted file mode 100644 index 30a56a633..000000000 --- a/client/core/src/popover/index.js +++ /dev/null @@ -1,98 +0,0 @@ -import {module} from '../module'; -import './style.css'; - -directive.$inject = ['vnPopover']; -export function directive(popover) { - return { - restrict: 'A', - link: function($scope, $element, $attrs) { - $element.on('click', function(event) { - popover.showComponent($attrs.vnDialog, $scope, $element); - event.preventDefault(); - }); - } - }; -} -module.directive('vnPopover', directive); - -export class Popover { - constructor($document, $compile) { - this.document = $document[0]; - this.$compile = $compile; - } - show(childElement, parent) { - let popover = this.document.createElement('div'); - popover.className = 'vn-popover'; - popover.addEventListener('mousedown', - event => this.onPopoverMouseDown(event)); - popover.appendChild(childElement); - this.popover = popover; - - let style = popover.style; - - let spacing = 0; - let screenMargin = 20; - let dblMargin = screenMargin * 2; - - let width = popover.offsetWidth; - let height = popover.offsetHeight; - let innerWidth = window.innerWidth; - let innerHeight = window.innerHeight; - - if (width + dblMargin > innerWidth) { - width = innerWidth - dblMargin; - style.width = width + 'px'; - } - if (height + dblMargin > innerHeight) { - height = innerHeight - dblMargin; - style.height = height + 'px'; - } - - if (parent) { - let parentNode = parent; - let rect = parentNode.getBoundingClientRect(); - let left = rect.left; - let top = rect.top + spacing + parentNode.offsetHeight; - - if (left + width > innerWidth) - left -= (left + width) - innerWidth + margin; - if (top + height > innerHeight) - top -= height + parentNode.offsetHeight + spacing * 2; - - if (left < 0) - left = screenMargin; - if (top < 0) - top = screenMargin; - - style.top = (top) + 'px'; - style.left = (left) + 'px'; - style.minWidth = (rect.width) + 'px'; - } - - this.document.body.appendChild(popover); - this.docMouseDownHandler = event => this.onDocMouseDown(event); - this.document.addEventListener('mousedown', this.docMouseDownHandler); - } - showComponent(childComponent, $scope, parent) { - let childElement = this.document.createElement(childComponent); - this.$compile(childElement)($scope); - this.show(childElement, parent); - } - hide() { - if (!this.popover) return; - this.document.removeEventListener('mousedown', this.docMouseDownHandler); - this.document.body.removeChild(this.popover); - this.popover = null; - this.lastEvent = null; - this.docMouseDownHandler = null; - } - onDocMouseDown(event) { - if (event != this.lastEvent) - this.hide(); - } - onPopoverMouseDown(event) { - this.lastEvent = event; - } -} -Popover.$inject = ['$document', '$compile']; -module.service('vnPopover', Popover); diff --git a/client/core/src/snackbar/index.html b/client/core/src/snackbar/index.html deleted file mode 100644 index 6f99d5fdb..000000000 --- a/client/core/src/snackbar/index.html +++ /dev/null @@ -1,4 +0,0 @@ -
-
- -
diff --git a/client/core/src/snackbar/index.js b/client/core/src/snackbar/index.js deleted file mode 100644 index ce76c1ba3..000000000 --- a/client/core/src/snackbar/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import {module} from '../module'; - -/** - * A simple component to show non-obstructive notifications to the user. - */ -export default class Controller { - constructor($element) { - this.snackbar = $element[0].firstChild; - componentHandler.upgradeElement(this.snackbar); - } - /** - * Shows a notification. - * - * @param {Object} data The message data - */ - show(data) { - this.snackbar.MaterialSnackbar.showSnackbar(data); - } -} -Controller.$inject = ['$element']; - -module.component('vnSnackbar', { - template: require('./index.html'), - controller: Controller -}); diff --git a/client/core/src/spinner/index.html b/client/core/src/spinner/index.html deleted file mode 100644 index 47b6e42fe..000000000 --- a/client/core/src/spinner/index.html +++ /dev/null @@ -1,2 +0,0 @@ -
-
\ No newline at end of file diff --git a/client/core/src/spinner/index.js b/client/core/src/spinner/index.js deleted file mode 100644 index daf694e1d..000000000 --- a/client/core/src/spinner/index.js +++ /dev/null @@ -1,58 +0,0 @@ -import {module} from '../module'; -import Component from '../lib/component'; -import './style.css'; - -/** - * A spinner to inform the user about loading process. - */ -export default class Spinner extends Component { - constructor($element, $scope) { - super($element); - this._enable = false; - this.spinner = $element[0].firstChild; - componentHandler.upgradeElement(this.spinner); - } - /** - * Enables/disables the spinner. - * - * @param {Boolean} value %true to enable, %false to disable - */ - set enable(value) { - if (value) - this.start(); - else - this.stop(); - } - /** - * Returns the current spinner state. - * - * @return {Boolean} %true if it's enabled, %false otherwise - */ - get enable() { - return this._enable; - } - /** - * Activates the spinner. - */ - start() { - this.spinner.MaterialSpinner.start(); - this._enable = true; - } - /** - * Deactivates the spinner. - */ - stop() { - this.spinner.MaterialSpinner.stop(); - this._enable = false; - } -} -Spinner.$inject = ['$element', '$scope']; - -export const component = { - template: require('./index.html'), - bindings: { - enable: '=' - }, - controller: Spinner -}; -module.component('vnSpinner', component); diff --git a/client/core/src/subtitle/index.html b/client/core/src/subtitle/index.html deleted file mode 100644 index ac00ac0c2..000000000 --- a/client/core/src/subtitle/index.html +++ /dev/null @@ -1,2 +0,0 @@ -
-
\ No newline at end of file diff --git a/client/core/src/subtitle/index.js b/client/core/src/subtitle/index.js deleted file mode 100644 index 941e8eb54..000000000 --- a/client/core/src/subtitle/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import {module} from '../module'; - -module.component('vnSubtitle', { - template: require('./index.html'), - transclude: true -}); diff --git a/client/core/src/textfield/index.js b/client/core/src/textfield/index.js deleted file mode 100644 index af4d7c4ab..000000000 --- a/client/core/src/textfield/index.js +++ /dev/null @@ -1,82 +0,0 @@ -import {module} from '../module'; -import Component from '../lib/component'; -import * as resolveFactory from '../lib/resolveDefaultComponents'; -import * as normalizerFactory from '../lib/inputAttrsNormalizer'; -import './style.scss'; -import './index.mdl'; - -export default class Textfield extends Component { - constructor($element, $scope, $attrs) { - super($element); - - let input = this.input = this.element.querySelector('input'); - input.addEventListener('input', - () => this.checkValue()); - input.addEventListener('focus', - () => this.checkValue()); - input.addEventListener('blur', - () => this.showClear(false)); - - let clearButton = this.element.querySelector('button'); - clearButton.addEventListener('click', - () => this.onClearClick()); - clearButton.addEventListener('mousedown', - event => event.preventDefault()); - - let div = this.element.firstChild; - componentHandler.upgradeElement(div); - } - link($scope, $attrs) { - let mdlTextField = this.element.firstChild.MaterialTextfield; - mdlTextField.updateClasses_(); - - $scope.$watch($attrs.model, - () => mdlTextField.updateClasses_()); - } - onClearClick() { - this.input.value = ''; - this.checkValue(); - - let event = this.document.createEvent('HTMLEvents'); - event.initEvent('change', false, true); - this.input.dispatchEvent(event); - } - checkValue() { - this.showClear(this.input.value); - } - showClear(show) { - show = show && document.activeElement === this.input; - let clearButton = this.element.querySelector('button'); - clearButton.style.visibility = show ? 'visible' : 'hidden'; - } - /** - * Selects the textfield. - */ - select() { - this.input.select(); - } - /** - * Puts the focus on the textfield. - */ - focus() { - this.input.focus(); - } -} -Textfield.$inject = ['$element', '$scope', '$attrs']; - -directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME]; -export function directive(resolve, normalizer) { - return { - restrict: 'E', - template: function(_, attrs) { - normalizer.normalize(attrs); - return resolve.getTemplate('textfield', attrs); - }, - link: function($scope, $element, $attrs, $ctrl) { - $ctrl.link($scope, $attrs); - }, - controller: Textfield - }; -} - -module.directive('vnTextfield', directive); diff --git a/client/core/src/textfield/index.mdl.html b/client/core/src/textfield/index.mdl.html deleted file mode 100644 index fc4ab00bf..000000000 --- a/client/core/src/textfield/index.mdl.html +++ /dev/null @@ -1,18 +0,0 @@ -
- - - -
diff --git a/client/core/src/textfield/index.mdl.js b/client/core/src/textfield/index.mdl.js deleted file mode 100644 index 64e156885..000000000 --- a/client/core/src/textfield/index.mdl.js +++ /dev/null @@ -1,16 +0,0 @@ -import {module} from '../module'; - -export const NAME = 'vnTextfieldMdlFactory'; - -export function factory() { - return { - template: require('./index.mdl.html'), - default: { - label: 'text', - className: 'mdl-textfield--floating-label', - type: 'text' - } - }; -} - -module.factory(NAME, factory); diff --git a/client/core/src/title/index.html b/client/core/src/title/index.html deleted file mode 100644 index e8ab561ed..000000000 --- a/client/core/src/title/index.html +++ /dev/null @@ -1,2 +0,0 @@ -

-

\ No newline at end of file diff --git a/client/core/src/title/index.js b/client/core/src/title/index.js deleted file mode 100644 index 3fb71f567..000000000 --- a/client/core/src/title/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import {module} from '../module'; - -module.component('vnTitle', { - template: require('./index.html'), - transclude: true -}); diff --git a/client/core/src/watcher/index.html b/client/core/src/watcher/index.html deleted file mode 100644 index 76315ece8..000000000 --- a/client/core/src/watcher/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/client/core/src/watcher/index.js b/client/core/src/watcher/index.js deleted file mode 100644 index d421405df..000000000 --- a/client/core/src/watcher/index.js +++ /dev/null @@ -1,162 +0,0 @@ -import {module} from '../module'; -import Component from '../lib/component'; -import getModifiedData from '../lib/modified'; -import copyObject from '../lib/copy'; -import isEqual from '../lib/equals'; - -/** - * Component that checks for changes on a specific model property and - * asks the user to save or discard it when the state changes. - * Also it can save the data to the server when the @url and @idField - * properties are provided. - */ -export default class Watcher extends Component { - constructor($element, $scope, $state, $transitions, $http, vnAppLogger, $translate) { - super($element); - this.$scope = $scope; - this.$state = $state; - this.$http = $http; - this.$translate = $translate; - this.vnAppLogger = vnAppLogger; - - this.state = null; - this.deregisterCallback = $transitions.onStart({}, - transition => this.callback(transition)); - this.copyData(); - } - $onInit() { - if (this.get) { - this.fetchData(); - } - } - $onChanges(changes) { - if (this.data) { - this.copyData(); - } - } - $onDestroy() { - this.deregisterCallback(); - } - fetchData() { - let id = this.data[this.idField]; - return new Promise((resolve, reject) => { - this.$http.get(`${this.url}/${id}`).then( - json => this.writeData(json, resolve), - json => reject(json) - ); - }); - } - /** - * Submits the data and goes back in the history. - */ - submitBack() { - this.submit().then( - () => this.window.history.back() - ); - } - /** - * Submits the data to the server. - * - * @return {Promise} The http request promise - */ - submit() { - if (this.form) { - this.form.$setSubmitted(); - - if (!this.form.$valid) - return new Promise( - (resolve, reject) => this.invalidForm(reject) - ); - } - if (!this.dataChanged()) { - return new Promise( - (resolve, reject) => this.noChanges(reject) - ); - } - let changedData = getModifiedData(this.data, this.orgData); - - if (this.save) { - this.save.model = changedData; - return new Promise((resolve, reject) => { - this.save.accept().then( - json => this.writeData({data: json}, resolve), - json => reject(json) - ); - }); - } - - // XXX: Alternative when mgCrud is not used - - let id = this.orgData[this.idField]; - - if (id) { - return new Promise((resolve, reject) => { - this.$http.put(`${this.url}/${id}`, changedData).then( - json => this.writeData(json, resolve), - json => reject(json) - ); - }); - } - - return new Promise((resolve, reject) => { - this.$http.post(this.url, this.data).then( - json => this.writeData(json, resolve), - json => reject(json) - ); - }); - } - writeData(json, resolve) { - copyObject(json.data, this.data); - this.copyData(); - resolve(json); - } - noChanges(resolve) { - this.vnAppLogger.showMessage( - this.$translate.instant('No changes to save') - ); - resolve(); - } - invalidForm(resolve) { - this.vnAppLogger.showMessage( - this.$translate.instant('Some fields are invalid') - ); - resolve(); - } - copyData() { - this.orgData = copyObject(this.data); - } - callback(transition) { - if (!this.state && this.dataChanged()) { - this.state = transition.to().name; - this.$scope.confirm.show(); - return false; - } - - return true; - } - dataChanged() { - return !isEqual(this.data, this.orgData); - } - onConfirmResponse(response) { - if (response === 'ACCEPT') { - copyObject(this.orgData, this.data); - this.$state.go(this.state); - } else { - this.state = null; - } - } -} -Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnAppLogger', '$translate']; - -module.component('vnWatcher', { - template: require('./index.html'), - bindings: { - url: '@?', - idField: '@?', - data: '<', - form: '<', - save: '<', - get: '=?' - }, - controller: Watcher -}); diff --git a/services/mailer/.gitignore b/services/mailer/.gitignore index b512c09d4..36420af85 100644 --- a/services/mailer/.gitignore +++ b/services/mailer/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +config.json \ No newline at end of file