Shop Master Ultimate - Version: 7.5.0
  • Endlich wieder geöffnet! Jetzt Ihren persönlichen Termin vereinbaren unter TEL 0261 9737824 oder service@aquamon.de
  • ViisonCommonApp.addSnippetNamespaces({"backend\/viison_common_compatibility_check\/main":{"check\/notification\/additionalinformation":"Mehr Informationen","check\/notification\/message":"Das Plugin [0] erfordert Version >= [1] des Plugins [2]. Bitte aktualisieren Sie das Plugin.","check\/notification\/title":"Plugin Kompatibilit\u00e4t"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonCompatibilityCheck.view.Menu', { override: 'Shopware.apps.Index.view.Menu', /* @Override */ initComponent: function () { // Trigger the compatibility check 500 ms after the menu was created this.on('menu-created', function () { window.setTimeout(this.viisonCommonPerformCompatibilityCheck.bind(this), 500); }, this); return this.callParent(arguments); }, /** * Checks for any plugin compatibility issues and displays them * as growl messages. */ viisonCommonPerformCompatibilityCheck: function () { Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('ViisonCommonCompatibilityCheck/getCompatibilityIssues'), scope: this, success: function (response) { var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData.success) { return; } // Display compatibility issues as growl message. // Each issue is displayed in its own growl message var compatibilityIssues = responseData.data; if (compatibilityIssues !== null) { Ext.Array.forEach(compatibilityIssues, function (growl) { Shopware.Notification.createStickyGrowlMessage({ title: ViisonCommonApp.getSnippet('check/notification/title', 'backend/viison_common_compatibility_check/main'), text: growl.message, // Add additional button if link and title are given btnDetail: (growl.detailButton) ? { text: growl.detailButton.title, callback: function () { // Open the link window.open(growl.detailButton.link, '_blank'); }, } : '', }); }, this); } }, }); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonCompatibilityCheck', { /** * Extends from the general sub-application controller, which handles * the sub-application behavior and the event bus. */ extend: 'Enlight.app.SubApplication', /** * The name of the module. */ name: 'Shopware.apps.ViisonCommonCompatibilityCheck', }); ViisonCommonApp.addSnippetNamespaces({"backend\/viison_common_migration\/main":{"dialog\/error\/body":"Folgender unerwarteter Fehler ist aufgetreten:","dialog\/error\/title":"Ein unerwarteter Fehler ist aufgetreten","errorWindow\/button\/disablePlugins\/confirmation\/text":"Wollen Sie wirklich die Migrationen \u00fcberspringen und damit die betroffenen Plugins deaktivieren?","errorWindow\/button\/disablePlugins\/confirmation\/title":"Plugins wirklich deaktivieren?","errorWindow\/button\/disablePlugins\/text":"Abbrechen und Plugins deaktivieren","errorWindow\/button\/reloadBackend\/text":"Backend neuladen","errorWindow\/button\/retry\/text":"Erneut versuchen","errorWindow\/description\/header":"Migrationsfehler aufgetreten!","errorWindow\/description\/paragraph":"F\u00fcr mindestens ein Plugin sind Migrationen fehlgeschlagen:","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/error\/text":"Kopieren der Fehlerdetails in diesem Browser nicht m\u00f6glich. Bitte klicken Sie auf die Lupe und kopieren Sie die Details manuell in die Zwischenablage.","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/error\/title":"Fehler","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/success\/text":"Fehlerdetails wurden in die Zwischenablage kopiert.","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/success\/title":"Details in Zwischenablage kopiert","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/toolTip":"Fehlerdetails in die Zwischenablage kopieren","errorWindow\/migrationSetList\/actionColumn\/showDetails\/dialog\/title":"Fehlerdetails","errorWindow\/migrationSetList\/actionColumn\/showDetails\/toolTip":"Fehlerdetails anzeigen","errorWindow\/migrationSetList\/column\/errorMessage\/text":"Fehlermeldung","errorWindow\/migrationSetList\/column\/errorMessage\/value\/noError":"Kein Fehler aufgetreten<\/i>","errorWindow\/migrationSetList\/column\/pluginName\/text":"Plugin","errorWindow\/migrationSetList\/column\/remaining\/text":"Ausstehend","errorWindow\/migrationSetList\/column\/remaining\/toolTip":"Anzahl noch ausstehender Migrationen","errorWindow\/migrationSetList\/column\/successful\/text":"Erfolgreich","errorWindow\/migrationSetList\/column\/successful\/toolTip":"Anzahl erfolgreicher Migrationen","errorWindow\/migrationSetList\/header":"Hinweise zu den durchgef\u00fchrten Migrationen","errorWindow\/title":"Shopware-Update erkannt","growlMessage\/successfulMigration\/text":"Dadurch ergeben sich \u00c4nderungen an ihren Plugins","growlMessage\/successfulMigration\/title":"Shopware Update erkannt","loadMask\/disablingPlugins":"Deaktiviere betroffene Plugins ...","loadMask\/reloadingBackend":"Lade Backend neu ...","migrationLog\/clearedCaches":"Geleerte Caches:","migrationLog\/disabledPlugins":"Meldungen von deaktivierten Plugins:","successWindow\/button\/close\/text":"Schlie\u00dfen","successWindow\/description\/header":"Migrationen wurden erfolgreich durchgef\u00fchrt!","successWindow\/description\/paragraph":"Bitte beachten Sie dazu folgende Hinweise:","successWindow\/title":"Shopware-Update erkannt"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.component.MigrationLog', { extend: 'Ext.form.field.TextArea', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_common_migration/main', readOnly: true, cls: 'is--viison-common--textarea viison_common_migration-component-migration_log', style: { fontFamily: 'Arial, Verdana, sans-serif', }, migrationExecutionResult: null, initComponent: function () { this.callParent(arguments); this.setValueFromMigrationExecutionResult(this.migrationExecutionResult); }, /** * Fills the content with the log for a MigrationExecutionResult * * @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult */ setValueFromMigrationExecutionResult: function (migrationExecutionResult) { if (!migrationExecutionResult) { this.setValue(''); } var log = ''; log += migrationExecutionResult.getMessages().join('\n\n'); log += '\n\n' + this.getViisonSnippet('migrationLog/clearedCaches') + '\n'; log += migrationExecutionResult.getInvalidatedCaches().join(', '); this.setValue(log); }, /** * Extends the content with the log for a pluginDisablingResult * * @param {object} pluginDisablingResultData */ appendPluginDisablingResultData: function (pluginDisablingResultData) { var log = this.getValue(); log += '\n\n' + this.getViisonSnippet('migrationLog/disabledPlugins') + '\n'; log += pluginDisablingResultData.messages.join('\n'); log += '\n\n' + this.getViisonSnippet('migrationLog/clearedCaches') + '\n'; log += pluginDisablingResultData.invalidatedCaches.join(', '); this.setValue(log); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.controller.Main', { extend: 'Ext.app.Controller', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_common_migration/main', /** * @Override */ init: function () { this.callParent(arguments); this.control({ 'viison_common_migration-error_window': { clickDisablePluginsButton: this.onClickDisablePluginsButton, clickReloadBackendButton: this.onClickReloadBackendButton, retry: this.onRetry, }, }); this.executeMigrations(); }, /** * Sends a request to the server to execute all executable migrations */ executeMigrations: function () { var fiveMinutesInMilliseconds = 5 * 60 * 1000; var tenSecondsInMilliseconds = 10 * 1000; // The max execution time of the migration framework is 5 minutes. Therefore allow 5 minutes plus 10 seconds // (to handle the request/response boilerplate) for the request. var timeoutInMilliseconds = fiveMinutesInMilliseconds + tenSecondsInMilliseconds; Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('ViisonCommonMigration/executeMigrations'), scope: this, timeout: timeoutInMilliseconds, success: function (response) { var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData || !responseData.success) { this.showErrorDialogForFailedRequest(response); } var migrationExecutionResultStore = Ext.create('Shopware.apps.ViisonCommonMigration.store.MigrationExecutionResult'); migrationExecutionResultStore.loadData([responseData.data]); var migrationExecutionResult = migrationExecutionResultStore.first(); this.clearCaches(migrationExecutionResult.getInvalidatedCaches()); if (migrationExecutionResult.hasExecutableMigrations()) { // If the migration store has executable migrations AFTER the execution, it means there went s.th. // wrong this.showErrorWindow(migrationExecutionResult); return; } if (migrationExecutionResult.getMessages().length === 0) { // The sub app should be absolutely quiet if no migrations has a message to be shown to the user return; } Shopware.Notification.createStickyGrowlMessage({ title: this.getViisonSnippet('growlMessage/successfulMigration/title'), text: this.getViisonSnippet('growlMessage/successfulMigration/text'), btnDetail: { callback: function () { this.showSuccessWindow(migrationExecutionResult); }, scope: this, }, }); }, failure: function (response) { this.showErrorDialogForFailedRequest(response); }, }); }, /** * Sends a requests to the server to clear Shopware caches. * * @param {string[]} caches The names of the caches to clear */ clearCaches: function (caches) { if (caches.length === 0) { return; } var requestParams = {}; caches.forEach(function (cache) { requestParams[cache] = 'on'; }); Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('Cache/clearCache'), method: 'post', params: caches, success: function (response) { var responseData = Ext.JSON.decode(response.responseText); if (!responseData.success) { this.showErrorDialogForFailedRequest(response); } if (caches.indexOf('theme') >= 0 || caches.indexOf('frontend') >= 0) { Shopware.app.Application.fireEvent('shopware-theme-cache-warm-up-request'); } }, failure: function (response) { this.showErrorDialogForFailedRequest(response); }, scope: this, }); }, /** * Shows the error window for a MigrationExecutionResult * * @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult */ showErrorWindow: function (migrationExecutionResult) { Ext.create('Shopware.apps.ViisonCommonMigration.view.error.Window', { migrationExecutionResult: migrationExecutionResult, subApp: this.subApplication, }); }, /** * Shows the success window for a MigrationExecutionResult * * @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult */ showSuccessWindow: function (migrationExecutionResult) { Ext.create('Shopware.apps.ViisonCommonMigration.view.success.Window', { migrationExecutionResult: migrationExecutionResult, }); }, /** * Handles event when the user clicks the 'disable plugins' button * * @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow */ onClickDisablePluginsButton: function (migrationWindow) { this.getViisonSnippet('loadMask/disablingPlugins'); Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('ViisonCommonMigration/disablePluginsWithExecutableMigrations'), success: function (response) { var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData.success) { this.showError(responseData.message); } this.clearCaches(responseData.data.invalidatedCaches); migrationWindow.migrationLog.appendPluginDisablingResultData(responseData.data); migrationWindow.reloadBackendButton.show(); migrationWindow.disablePluginsButton.hide(); migrationWindow.retryButton.hide(); }, failure: function (response) { this.showError(response.statusText); }, callback: function () { migrationWindow.setLoading(false); }, scope: this, }); }, /** * Handles event when the user clicks the 'reload backend' button * * @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow */ onClickReloadBackendButton: function (migrationWindow) { this.reloadBackend(migrationWindow); }, /** * Handles event when the user clicks the 'retry' button * * @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow */ onRetry: function (migrationWindow) { // When the backend is reloaded, all failed migrations will be retried this.reloadBackend(migrationWindow); }, /** * Reloads the backend and shows a loading mask about that in the given window. * * @param {Ext.window.Window} window */ reloadBackend: function (window) { window.setLoading(this.getViisonSnippet('loadMask/reloadingBackend')); // eslint-disable-next-line no-restricted-globals location.reload(); }, /** * @param {XMLHttpRequest} XMLHttpRequest */ showErrorDialogForFailedRequest: function (XMLHttpRequest) { var errorMessage = this.getErrorMessageFromXMLHttpRequest(XMLHttpRequest); var dialogMessage = this.getViisonSnippet('dialog/error/body') + '\n\n' + errorMessage; Ext.Msg.show({ title: this.getViisonSnippet('dialog/error/title'), msg: dialogMessage, buttons: Ext.Msg.OK, icon: Ext.Msg.ERROR, }); }, /** * @param {XMLHttpRequest} XMLHttpRequest */ getErrorMessageFromXMLHttpRequest: function (XMLHttpRequest) { var json = Ext.JSON.decode(XMLHttpRequest.responseText, true); if (json) { if (json.success) { return ''; } return json.message; } return XMLHttpRequest.statusText + '\n\n' + XMLHttpRequest.responseText; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.model.ManifestedMigration', { extend: 'Ext.data.Model', alternateClassName: 'ViisonManifestedMigration', statics: { STATUS_COMPLETED: 'completed', STATUS_FAILED: 'failed', STATUS_PENDING: 'pending', }, fields: [ { name: 'migrationSetId', type: 'int' }, { name: 'name', type: 'string' }, { name: 'status', type: 'string' }, { name: 'canExecute', type: 'boolean' }, { name: 'exceptionMessage', type: 'string', useNull: true }, { name: 'exceptionDetails', type: 'string', useNull: true }, ], }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult', { extend: 'Ext.data.Model', fields: [ { name: 'id', type: 'int' }, { name: 'migrationTranscript', type: 'auto' }, ], associations: [{ type: 'hasMany', model: 'Shopware.apps.ViisonCommonMigration.model.MigrationSet', associationKey: 'migrationSets', name: 'getMigrationSets', foreignKey: 'migrationExecutionResultId', primaryKey: 'id', }], /** * @returns {string[]} */ getInvalidatedCaches: function () { return this.get('migrationTranscript').invalidatedCaches; }, /** * @returns {string[]} */ getMessages: function () { return this.get('migrationTranscript').messages; }, /** * @returns {boolean} */ hasExecutableMigrations: function () { var migrationSets = this.getMigrationSets(); for (var i = 0; i < migrationSets.count(); i += 1) { if (migrationSets.getAt(i).get('hasExecutableMigrations')) { return true; } } return false; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.model.MigrationSet', { extend: 'Ext.data.Model', fields: [ { name: 'id', type: 'int' }, { name: 'migrationExecutionResultId', type: 'int', useNull: true, default: null }, { name: 'name', type: 'string' }, { name: 'hasExecutableMigrations', type: 'boolean' }, ], associations: [{ type: 'hasMany', model: 'Shopware.apps.ViisonCommonMigration.model.ManifestedMigration', associationKey: 'migrations', name: 'getMigrations', foreignKey: 'migrationSetId', primaryKey: 'id', }], /** * @returns {Shopware.apps.ViisonCommonMigration.model.ManifestedMigration[]} */ getExecutableMigrations: function () { return this.getMigrations().getRange().filter(function (migration) { return migration.get('canExecute'); }); }, /** * @returns {Shopware.apps.ViisonCommonMigration.model.ManifestedMigration} */ getFailedMigration: function () { var failedMigration = null; this.getMigrations().getRange().forEach(function (migration) { if (migration.get('status') === ViisonManifestedMigration.STATUS_FAILED) { failedMigration = migration; return false; } return true; }); return failedMigration; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.store.MigrationExecutionResult', { extend: 'Ext.data.Store', model: 'Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult', /** * @override */ loadData: function (MigrationExecutionResultData, append) { if (!append) { this.removeAll(); } MigrationExecutionResultData.forEach(function (migrationExecutionResultData) { var migrationExecutionResult = Ext.create(this.model, migrationExecutionResultData); migrationExecutionResult.getMigrationSetsStore = Ext.create( 'Shopware.apps.ViisonCommonMigration.store.MigrationSet' ); migrationExecutionResult.getMigrationSets().loadData(migrationExecutionResultData.migrationSets); this.add(migrationExecutionResult); }, this); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.store.MigrationSet', { extend: 'Ext.data.Store', model: 'Shopware.apps.ViisonCommonMigration.model.MigrationSet', sorters: [ { property: 'name' }, ], /** * @override */ loadData: function (migrationSetsData, append) { if (!append) { this.removeAll(); } migrationSetsData.forEach(function (migrationSetData) { var migrationSet = Ext.create(this.model, migrationSetData); migrationSet.getMigrations().loadData(migrationSetData.migrations); this.add(migrationSet); }, this); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.view.error.List', { extend: 'Ext.grid.Panel', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_common_migration/main', cls: 'viison-common--grid', /** * @override */ initComponent: function () { this.columns = this.createColumns(); this.callParent(arguments); }, /** * @returns {object[]} */ createColumns: function () { return [ { text: this.getViisonSnippet('errorWindow/migrationSetList/column/pluginName/text'), dataIndex: 'name', width: 150, sortable: false, }, { text: this.getViisonSnippet('errorWindow/migrationSetList/column/successful/text'), width: 75, tooltip: this.getViisonSnippet('errorWindow/migrationSetList/column/successful/toolTip'), sortable: false, renderer: function (value, meta, record) { return record.getMigrations().count() - record.getExecutableMigrations().length; }, }, { text: this.getViisonSnippet('errorWindow/migrationSetList/column/remaining/text'), width: 75, tooltip: this.getViisonSnippet('errorWindow/migrationSetList/column/remaining/toolTip'), sortable: false, renderer: function (value, meta, record) { return record.getExecutableMigrations().length; }, }, { text: this.getViisonSnippet('errorWindow/migrationSetList/column/errorMessage/text'), dataIndex: 'exceptionMessage', flex: 1, sortable: false, renderer: function (value, meta, record) { var failedMigration = record.getFailedMigration(); if (failedMigration) { return failedMigration.get('exceptionMessage'); } return this.getViisonSnippet('errorWindow/migrationSetList/column/errorMessage/value/noError'); }, scope: this, }, { xtype: 'actioncolumn', width: 48, items: this.createActionColumnItems(), }, ]; }, /** * @returns {object[]} */ createActionColumnItems: function () { var getClassFunction = function (value, metadata, record) { if (record.getFailedMigration()) { return ''; } return 'x-hidden'; }; return [{ iconCls: 'sprite-magnifier', tooltip: this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/toolTip'), getClass: getClassFunction, handler: function (view, rowIndex, colIndex, item, ops, record) { Ext.Msg.alert( this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/dialog/title'), record.getFailedMigration().get('exceptionDetails') ); }, scope: this, }, { iconCls: 'sprite-document-copy', tooltip: this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/toolTip'), getClass: getClassFunction, handler: function (view, rowIndex, colIndex, item, ops, record) { var textArea = document.createElement('textarea'); textArea.value = record.getFailedMigration().get('exceptionDetails'); document.body.appendChild(textArea); textArea.select(); try { document.execCommand('copy'); Shopware.Msg.createGrowlMessage( this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/success/title'), this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/success/text'), 'Pickware' ); } catch (err) { Shopware.Msg.createGrowlMessage( this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/error/title'), this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/error/text'), 'Pickware' ); } document.body.removeChild(textArea); }, scope: this, }]; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.view.error.Window', { extend: 'Enlight.app.Window', alias: 'widget.viison_common_migration-error_window', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_common_migration/main', autoShow: true, minimizable: false, layout: { type: 'vbox', align: 'stretch', pack: 'start', }, height: '70%', width: 900, modal: true, migrationExecutionResult: null, /** * @override */ initComponent: function () { this.title = this.getViisonSnippet('errorWindow/title'); this.items = [ this.createHelpContainer(), this.createMigrationsList(), this.createMigrationLogContainer(), ]; this.buttons = this.createButtons(); this.callParent(arguments); }, /** * @returns {(Ext.button.Button)[]} */ createButtons: function () { this.disablePluginsButton = Ext.create('Ext.button.Button', { text: this.getViisonSnippet('errorWindow/button/disablePlugins/text'), cls: 'secondary', handler: function () { Ext.Msg.confirm( this.getViisonSnippet('errorWindow/button/disablePlugins/confirmation/title'), this.getViisonSnippet('errorWindow/button/disablePlugins/confirmation/text'), function (selection) { if (selection === 'yes') { this.fireEvent('clickDisablePluginsButton', this); } }, this ); }, scope: this, }); this.reloadBackendButton = Ext.create('Ext.button.Button', { text: this.getViisonSnippet('errorWindow/button/reloadBackend/text'), cls: 'primary', hidden: true, handler: function () { this.fireEvent('clickReloadBackendButton', this); }, scope: this, }); this.retryButton = Ext.create('Ext.button.Button', { text: this.getViisonSnippet('errorWindow/button/retry/text'), cls: 'primary', handler: function () { this.fireEvent('retry', this); }, scope: this, }); return [ this.disablePluginsButton, this.reloadBackendButton, this.retryButton, ]; }, /** * @returns {object} */ createHelpContainer: function () { return { xtype: 'container', cls: 'viison-common--explanation-area', anchor: '100%', items: [ { xtype: 'container', cls: 'is--header', html: this.getViisonSnippet('errorWindow/description/header'), }, { xtype: 'container', cls: 'is--paragraph', html: this.getViisonSnippet('errorWindow/description/paragraph'), }, ], }; }, /** * @returns {Shopware.apps.ViisonCommonMigration.view.error.List} */ createMigrationsList: function () { this.migrationsList = Ext.create('Shopware.apps.ViisonCommonMigration.view.error.List', { store: this.migrationExecutionResult.getMigrationSets(), height: 100, anchor: '100%', }); return this.migrationsList; }, /** * @returns {object} */ createMigrationLogContainer: function () { return { xtype: 'container', flex: 1, anchor: '100%', layout: 'border', items: [ { xtype: 'container', region: 'north', cls: 'viison-common--explanation-area', items: [ { xtype: 'container', cls: 'is--header is--last', html: this.getViisonSnippet('errorWindow/migrationSetList/header'), }, ], }, this.createMigrationLog(), ], }; }, /** * @returns {Shopware.apps.ViisonCommonMigration.component.MigrationLog} */ createMigrationLog: function () { this.migrationLog = Ext.create('Shopware.apps.ViisonCommonMigration.component.MigrationLog', { region: 'center', migrationExecutionResult: this.migrationExecutionResult, }); return this.migrationLog; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration.view.success.Window', { extend: 'Enlight.app.Window', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_common_migration/main', autoShow: true, layout: 'border', height: '60%', width: 900, migrationExecutionResult: null, /** * @Override */ initComponent: function () { this.title = this.getViisonSnippet('successWindow/title'); this.items = [ this.createHelpContainer(), this.createMigrationLog(), ]; this.buttons = this.createButtons(); this.callParent(arguments); }, /** * @returns {object} */ createHelpContainer: function () { return { xtype: 'container', cls: 'viison-common--explanation-area', region: 'north', items: [ { xtype: 'container', cls: 'is--header', html: this.getViisonSnippet('successWindow/description/header'), }, { xtype: 'container', cls: 'is--paragraph', html: this.getViisonSnippet('successWindow/description/paragraph'), }, ], }; }, /** * @returns {object[]} */ createButtons: function () { return [{ xtype: 'button', text: this.getViisonSnippet('successWindow/button/close/text'), cls: 'primary', handler: function () { this.close(); }, scope: this, }]; }, /** * @returns {Shopware.apps.ViisonCommonMigration.component.MigrationLog} */ createMigrationLog: function () { this.migrationLog = Ext.create('Shopware.apps.ViisonCommonMigration.component.MigrationLog', { region: 'center', width: '100%', migrationExecutionResult: this.migrationExecutionResult, }); return this.migrationLog; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonCommonMigration', { override: 'Shopware.apps.Index', /** * @Override */ init: function () { this.callParent(arguments); window.setTimeout(function () { this.addController({ name: 'Shopware.apps.ViisonCommonMigration.controller.Main', }); }.bind(this), 1000); }, }); ViisonCommonApp.addSnippetNamespaces({"backend\/viison_pickware_erp_index_news_widget\/main":{"panel\/columns\/date":"Datum","panel\/columns\/title":"Titel","panel\/title":"Pickware News"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexNewsWidget.model.News', { extend: 'Ext.data.Model', fields: [ { name: 'title', type: 'string' }, { name: 'link', type: 'string' }, { name: 'linkHash', type: 'string' }, { name: 'date', type: 'date' }, { name: 'visited', type: 'boolean', convert: function (value, record) { var visited = window.localStorage.getItem('viison_pickware_erp_index_news_widget-news_cache'); if (!visited) { return false; } var visitedLinks = Ext.decode(visited) || {}; return !!visitedLinks[record.get('linkHash')]; }, }, ], }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexNewsWidget.store.News', { extend: 'Ext.data.Store', model: 'Shopware.apps.ViisonPickwareERPIndexNewsWidget.model.News', autoLoad: true, pageSize: 5, remoteSort: false, sorters: [{ property: 'date', direction: 'DESC', }], proxy: { type: 'ajax', url: ViisonCommonApp.assembleBackendUrl('ViisonPickwareERPIndexNewsWidget/getNews'), reader: { type: 'json', root: 'data', totalProperty: 'total', }, }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexNewsWidget.view.Main', { extend: 'Shopware.apps.Index.view.widgets.Base', alias: 'widget.viison-pickware-erp-news-widget', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_pickware_erp_index_news_widget/main', layout: 'fit', bodyPadding: '8 8', /** * @Override */ initComponent: function () { this.title = this.getViisonSnippet('panel/title'); this.newsStore = Ext.create('Shopware.apps.ViisonPickwareERPIndexNewsWidget.store.News'); this.items = [ this.createNewsGrid(), ]; this.tools = [{ type: 'refresh', scope: this, handler: function () { this.newsStore.load(); }, }]; this.callParent(arguments); }, /** * Creates the main Widget grid and its columns * * @return Ext.grid.Panel */ createNewsGrid: function () { return Ext.create('Ext.grid.Panel', { border: 0, store: this.newsStore, columns: [{ dataIndex: 'title', header: this.getViisonSnippet('panel/columns/title'), flex: 1, }, { dataIndex: 'date', header: this.getViisonSnippet('panel/columns/date'), width: 80, align: 'right', renderer: Ext.util.Format.dateRenderer(), }], listeners: { scope: this, itemclick: function (view, record) { // Open clicked news in new tab/window window.open(record.data.link, '_blank'); // Update grid view.getSelectionModel().deselectAll(); this.setVisited(record.data.linkHash); record.set('visited', true); view.refresh(); }, }, viewConfig: { getRowClass: function (record) { // Return css class to modify style (highlight unvisited links) return record.get('visited') ? 'x-widget-viison-pickware-erp-index-news-widget-visited' : 'x-widget-viison-pickware-erp-index-news-widget-unvisited'; }, }, }); }, /** * Remembers visited links in a local storage (saved linkHash) * * @param string linkHash */ setVisited: function (linkHash) { var visited = window.localStorage.getItem('viison_pickware_erp_index_news_widget-news_cache'); var visitedLinks = Ext.decode(visited) || {}; if (visitedLinks[linkHash]) { return; } // Mark link as visited visitedLinks[linkHash] = true; window.localStorage.setItem('viison_pickware_erp_index_news_widget-news_cache', Ext.encode(visitedLinks)); }, }); ViisonCommonApp.addConfig('ViisonPickwareERPPurchasePriceHelper', {"purchasePriceMode":"net"}); ViisonCommonApp.addSnippetNamespaces({"backend\/viison_pickware_erp_purchase_price_helper\/main":{"gross":"brutto","net":"netto","purchase_price":"Einkaufspreis"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. /** * A singleton that holds the plugin's purchase price configuration and allows easy creation * of the correct 'purchase price' ('gross'/'net') labels. */ Ext.define('Shopware.apps.ViisonPickwareERPPurchasePriceHelper.Helper', { singleton: true, alternateClassName: 'ViisonPickwarePurchasePriceHelper', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_pickware_erp_purchase_price_helper/main', viisonConfigNamespace: 'ViisonPickwareERPPurchasePriceHelper', constructor: function () { this.callParent(arguments); this.purchasePriceMode = this.getViisonConfig('purchasePriceMode'); }, /** * @return boolean */ purchasePriceIsNet: function () { return this.purchasePriceMode === 'net'; }, /** * Creates a label of the form 'purchase price (mode)', where 'mode' is either 'net' * or 'gross', depending on the 'purchasePriceMode'. If the optional parameter 'baseLabel' * is given, the it is used instead of 'purchase price', resulting in the format 'baseLabel (mode)'. * * @param string|null baseLabel * @return string */ purchasePriceLabel: function (baseLabel) { var label = baseLabel || this.getViisonSnippet('purchase_price'); var modeLabel = this.purchasePriceIsNet() ? this.getViisonSnippet('net') : this.getViisonSnippet('gross'); return label + ' (' + modeLabel + ')'; }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPPurchasePriceHelper', { extend: 'Enlight.app.SubApplication', name: 'Shopware.apps.ViisonPickwareERPPurchasePriceHelper', }); ViisonCommonApp.addConfig('ViisonPickwareERPPurchasePriceConverter', {"ViisonPickwareERPPurchasePriceConverter":{"purchasePriceModes":{"active":"net","configured":"net"}}}); ViisonCommonApp.addSnippetNamespaces({"backend\/viison_pickware_erp_purchase_price_converter\/main":{"alerts\/close_change_notification\/buttons\/hide_notification":"Hinweis nicht mehr anzeigen","alerts\/close_change_notification\/message":"Da Sie die \"Eingabe von Einkaufspreisen\" von \"[0]\" auf \"[1]\" ge\u00e4ndert haben, sollten Sie in der Regel die Einkaufspreise entsprechend umrechnen. Wenn Sie sich sicher sind, dass eine Umrechnung nicht notwendig ist, k\u00f6nnen Sie den Umrechnungs-Hinweis dauerhaft ausblenden. Der Hinweis wird dann erst wieder angezeigt, wenn Sie die Konfiguration erneut \u00e4ndern.","alerts\/close_change_notification\/title":"Hinweis","alerts\/convert_prices\/message":"M\u00f6chten Sie alle Einkaufspreise jetzt von \"[0]\" zu \"[1]\" umrechnen?","alerts\/convert_prices\/title":"Einkaufspreise umrechnen","convert_prices\/error\/mode_changed":"Die Einkaufspreise wurden nicht umgerechnet, da sich die entsprechende Konfiguration in der Zwischenzeit erneut ge\u00e4ndert hat.","notifications\/convert_prices\/failure\/message":"Die Einkaufspreise konnten nicht umgerechnet werden, da ein unbekannter Fehler aufgetreten ist.","notifications\/convert_prices\/failure\/title":"Fehler","notifications\/convert_prices\/success\/message":"Alle vorhandenen Einkaufspreise wurden erfolgreich umgerechnet.","notifications\/convert_prices\/success\/title":"Einkaufspreise umgerechnet","notifications\/purchase_price_mode_changed\/buttons\/convert":"Preise umrechnen","notifications\/purchase_price_mode_changed\/message":"Sie haben die \"Eingabe von Einkaufspreisen\" von \"[0]\" auf \"[1]\" ge\u00e4ndert. Sie sollten daher jetzt die Einkaufspreise entsprechend umrechnen.","notifications\/purchase_price_mode_changed\/title":"Wichtiger Hinweis"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. /** * A singleton that can observe changes within a ViisonPickwareERP plugin config form and, * in case the 'purchasePriceMode' changes, shows a growl notification, which informs the user * about converting the pruchase prices accordingly. */ Ext.define('Shopware.apps.ViisonPickwareERPPurchasePriceConverter.Converter', { singleton: true, alternateClassName: 'ViisonPickwarePurchasePriceConverter', mixins: [ 'Shopware.apps.ViisonCommonApp.Mixin', ], viisonSnippetNamespace: 'backend/viison_pickware_erp_purchase_price_converter/main', viisonConfigNamespace: 'ViisonPickwareERPPurchasePriceConverter', /** * @var Ext.panel.Panel modeChangeGrowlNotification */ modeChangeGrowlNotification: null, constructor: function () { this.callParent(arguments); var converterConfig = this.getViisonConfig('ViisonPickwareERPPurchasePriceConverter'); this.activePurchasePriceMode = converterConfig.purchasePriceModes.active; this.configuredPurchasePriceMode = converterConfig.purchasePriceModes.configured; }, /** * Adds listeners on the 'load' and 'update' events to the given formStore, which check and compare * the 'purchasePriceMode' configured in the 'ViisonPickwareERP' plugin config form. If the mode * is changed, the listener on the the 'update' event triggers a growl notification informing the * user about the change an the consequences. * * @param Shopware.apps.Base.model.Form|Shopware.apps.Config.store.main.Form formStore */ observeFormStore: function (formStore) { // Add listener on 'load' events, to be able to save the value of the 'purchasePriceMode' // element for later use formStore.on('load', function (store, records) { if (records.length === 0 || records[0].get('name') !== 'ViisonPickwareERP') { return; } // Save the currently configured purchasePriceMode this.configuredPurchasePriceMode = this.getPurchasePriceMode(records[0]); }, this); // Add listener on 'update' events, to be able to detect changes of the 'purchasePriceMode' element formStore.on('update', function (store, record, operation) { if (record.get('name') !== 'ViisonPickwareERP' || operation !== Ext.data.Model.COMMIT) { return; } // Save the new configured purchase price mode and update the growl notifications this.configuredPurchasePriceMode = this.getPurchasePriceMode(record); this.updatePurchasePriceModeChangeNotification(); }, this); }, /** * Loads the currently active and configured purchase price modes and, if the differ, shows a new * purchase price change notification. */ checkPurchasePriceModeConfiguration: function () { Ext.Ajax.request({ method: 'GET', url: ViisonCommonApp.assembleBackendUrl( 'ViisonPickwareERPPurchasePriceConverter/getPurchasePriceModes' ), scope: this, success: function (response) { // Decode the response var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData || !responseData.purchasePriceModes) { return; } // Save the purchase price modes and update the growl notifications this.activePurchasePriceMode = responseData.purchasePriceModes.active || this.activePurchasePriceMode; this.configuredPurchasePriceMode = responseData.purchasePriceModes.configured || this.configuredPurchasePriceMode; this.updatePurchasePriceModeChangeNotification(); }, }); }, /** * Creates and shows a customised, sticky growl notification, which notifies the user about the * change of the purchase price mode and ask them to convert the purchase prices accordingly. */ updatePurchasePriceModeChangeNotification: function () { // Close a currently displayed notification if (this.modeChangeGrowlNotification) { Shopware.Notification.closeGrowlMessage(this.modeChangeGrowlNotification, Shopware.Notification); this.modeChangeGrowlNotification = null; } // Check whether a new notification must be displayed var oldMode = this.activePurchasePriceMode; var newMode = this.configuredPurchasePriceMode; if (oldMode === newMode) { return; } // Show sticky growl notification this.modeChangeGrowlNotification = Shopware.Notification.createStickyGrowlMessage({ title: this.getViisonSnippet('notifications/purchase_price_mode_changed/title'), text: Ext.String.format( this.getViisonSnippet('notifications/purchase_price_mode_changed/message'), this.getViisonSnippet(oldMode, 'backend/viison_pickware_erp_purchase_price_helper/main'), this.getViisonSnippet(newMode, 'backend/viison_pickware_erp_purchase_price_helper/main') ), log: true, btnDetail: { text: this.getViisonSnippet('notifications/purchase_price_mode_changed/buttons/convert'), scope: this, callback: function () { this.onNotificationConvertPricesButton.apply(this, [oldMode, newMode]); }, }, onCloseButton: function () { this.onNotificationCloseButton.apply(this, [oldMode, newMode]); }.bind(this), scope: this, callback: function () { this.modeChangeGrowlNotification = null; }, }, 'ViisonPickwareERP'); }, /** * Shows a confirm alert and, if the user confirms it, sends an AJAX request to convert * all purchase prices from the 'oldMode' to the 'newMode'. * * @param string oldMode * @param string newMode */ onNotificationConvertPricesButton: function (oldMode, newMode) { var alertMessage = Ext.String.format( this.getViisonSnippet('alerts/convert_prices/message'), this.getViisonSnippet(oldMode, 'backend/viison_pickware_erp_purchase_price_helper/main'), this.getViisonSnippet(newMode, 'backend/viison_pickware_erp_purchase_price_helper/main') ); Ext.Msg.confirm( this.getViisonSnippet('alerts/convert_prices/title'), alertMessage, function (buttonId) { if (buttonId === 'yes') { // Confirmed, hence convert the purchase prices Ext.Ajax.request({ method: 'POST', url: ViisonCommonApp.assembleBackendUrl( 'ViisonPickwareERPPurchasePriceConverter/convertPurchasePrices' ), params: { oldMode: oldMode, newMode: newMode, }, scope: this, success: function (response) { // Decode the response var responseData = Ext.JSON.decode(response.responseText, true); var success = responseData && responseData.success; if (responseData && responseData.purchasePriceModes) { // Save the purchase price modes and update the growl notifications this.activePurchasePriceMode = responseData.purchasePriceModes.active || this.activePurchasePriceMode; this.configuredPurchasePriceMode = responseData.purchasePriceModes.configured || this.configuredPurchasePriceMode; this.updatePurchasePriceModeChangeNotification(); } // Show success/failure notification var title; var message; if (success) { title = this.getViisonSnippet('notifications/convert_prices/success/title'); message = this.getViisonSnippet('notifications/convert_prices/success/message'); } else { title = this.getViisonSnippet('notifications/convert_prices/failure/title'); message = (responseData && responseData.message) ? responseData.message : this.getViisonSnippet('notifications/convert_prices/failure/message'); } Shopware.Notification.createGrowlMessage(title, message, 'ViisonPickwareERP', null, true); }, }); } else { // Declined, hence show the notification again this.updatePurchasePriceModeChangeNotification(); } }, this ); }, /** * Shows a confirm alert and, if the user confirms it, sends an AJAX request to hide * the change the notification until the mode changes again. * * @param string oldMode * @param string newMode */ onNotificationCloseButton: function (oldMode, newMode) { Ext.Msg.show({ title: this.getViisonSnippet('alerts/close_change_notification/title'), msg: Ext.String.format( this.getViisonSnippet('alerts/close_change_notification/message'), this.getViisonSnippet(oldMode, 'backend/viison_pickware_erp_purchase_price_helper/main'), this.getViisonSnippet(newMode, 'backend/viison_pickware_erp_purchase_price_helper/main') ), buttons: Ext.Msg.OK, buttonText: { cancel: this.getViisonSnippet('alerts/close_change_notification/buttons/hide_notification'), }, icon: Ext.Msg.WARNING, scope: this, callback: function (buttonId) { if (buttonId !== 'cancel') { return; } // Hide future notifications Ext.Ajax.request({ method: 'POST', url: ViisonCommonApp.assembleBackendUrl( 'ViisonPickwareERPPurchasePriceConverter/hideChangeNotification' ), scope: this, success: function (response) { // Decode the response var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData || !responseData.purchasePriceModes) { return; } // Save the purchase price modes and update the growl notifications this.activePurchasePriceMode = responseData.purchasePriceModes.active || this.activePurchasePriceMode; this.configuredPurchasePriceMode = responseData.purchasePriceModes.configured || this.configuredPurchasePriceMode; this.updatePurchasePriceModeChangeNotification(); }, }); }, }); }, /** * @param Shopware.apps.Config.model.main.Form * @return string|null */ getPurchasePriceMode: function (form) { // Try to find the the 'purchasePriceMode' element var modeIndex = form.getElements().findExact('name', 'purchasePriceMode'); if (modeIndex === -1) { return null; } var element = form.getElements().getAt(modeIndex); // Determine the value return (element.getValues().count() > 0) ? element.getValues().first().get('value') : element.get('value'); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPPurchasePriceConverter', { extend: 'Enlight.app.SubApplication', name: 'Shopware.apps.ViisonPickwareERPPurchasePriceConverter', }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexPurchasePriceModeCheck.view.Menu', { override: 'Shopware.apps.Index.view.Menu', /** * @Override */ initComponent: function () { // Trigger the purchase price mode check 500 ms after the menu was created this.on('menu-created', function () { window.setTimeout(function () { ViisonPickwarePurchasePriceConverter.checkPurchasePriceModeConfiguration(); }, 500); }, this); this.callParent(arguments); }, }); ViisonCommonApp.addSnippetNamespaces({"backend\/viison_pickware_erp_index_stock_check\/main":{"notification\/message":"Der Bestand von [0] Artikeln ist noch nicht initialisiert.","notification\/open_button":"Jetzt bearbeiten","notification\/title":"Warenbestand initialisieren"}}); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexStockCheck.view.Menu', { override: 'Shopware.apps.Index.view.Menu', /** * @Override */ initComponent: function () { // Trigger the stock range check 500 ms after the menu was created this.on('menu-created', function () { window.setTimeout(function () { this.performStockCheck(); }.bind(this), 500); }, this); this.callParent(arguments); }, /** * Checks all articles for already initialised stocks. */ performStockCheck: function () { Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('ViisonPickwareERPIndexStockCheck/checkStock'), success: function (response) { // Decode the response var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData || parseInt(responseData.count, 10) === 0) { return; } Shopware.Notification.createStickyGrowlMessage({ title: ViisonCommonApp.getSnippet( 'notification/title', 'backend/viison_pickware_erp_index_stock_check/main' ), text: Ext.String.format( ViisonCommonApp.getSnippet( 'notification/message', 'backend/viison_pickware_erp_index_stock_check/main' ), responseData.count ), btnDetail: { text: ViisonCommonApp.getSnippet( 'notification/open_button', 'backend/viison_pickware_erp_index_stock_check/main' ), callback: function () { // Open the stock setup sub app Shopware.app.Application.addSubApplication({ name: 'Shopware.apps.ViisonPickwareERPStockInitialization', localizedName: ViisonCommonApp.getSnippet( 'notification/title', 'backend/viison_pickware_erp_index_stock_check/main' ), }); }, }, }); }, }); }, }); // Copyright (c) Pickware GmbH. All rights reserved. // This file is part of software that is released under a proprietary license. // You must not copy, modify, distribute, make publicly available, or execute // its contents or parts thereof without express permission by the copyright // holder, unless otherwise permitted by law. Ext.define('Shopware.apps.ViisonPickwareERPIndexPluginTestCheck.view.Menu', { override: 'Shopware.apps.Index.view.Menu', /** * @Override */ initComponent: function () { // Trigger the test license range check 500 ms after the menu was created this.on('menu-created', function () { window.setTimeout(function () { this.performPluginTestCheck(); }.bind(this), 500); }, this); this.callParent(arguments); }, /** * Checks for a test license and its validity or a test version in combination with a Shopware PR license. */ performPluginTestCheck: function () { Ext.Ajax.request({ url: ViisonCommonApp.assembleBackendUrl('ViisonPickwareERPIndexPluginTestCheck/checkLicense'), success: function (response) { // Decode the response var responseData = Ext.JSON.decode(response.responseText, true); if (!responseData || !responseData.pluginTestStatus || responseData.pluginTestStatus.daysLeft > 14) { return; } // Show growl notification var expiredSnippet = ViisonCommonApp.getSnippet( 'notification/message/test_expired', 'backend/viison_pickware_erp_index_plugin_test_check/main' ); var expiresSoonSnippet = ViisonCommonApp.getSnippet( 'notification/message/test_expires_soon', 'backend/viison_pickware_erp_index_plugin_test_check/main' ); var message = (responseData.pluginTestStatus.daysLeft < 0) ? expiredSnippet : expiresSoonSnippet; Shopware.Notification.createStickyGrowlMessage({ title: ViisonCommonApp.getSnippet( 'notification/title', 'backend/viison_pickware_erp_index_plugin_test_check/main' ), text: Ext.String.format(message, Math.abs(responseData.pluginTestStatus.daysLeft)), btnDetail: { text: ViisonCommonApp.getSnippet( 'notification/buttons/more_info', 'backend/viison_pickware_erp_index_plugin_test_check/main' ), link: 'https://www.pickware.de/starten/mit-pickware-direkt-starten', }, }); }, }); }, });