![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/InventoryBackend/view/adminhtml/templates/source/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ ?> <?php $sources = $block->getSources() ?> <?php if (!empty($sources)) : ?> <div class="store-switcher source-switcher store-view source"> <span class="source-switcher-label store-switcher-label"><?= $block->escapeHtml(__('Source:')) ?></span> <div class="actions dropdown closable"> <input type="hidden" name="source_switcher" id="source_switcher" data-role="source" value="<?= $block->escapeHtmlAttr($block->getSourceCode()) ?>" onchange="switchSource(this);" <?= $block->getUiId()?>/> <button type="button" class="admin__action-dropdown" data-mage-init='{"dropdown":{}}' data-toggle="dropdown" aria-haspopup="true" id="source-change-button"> <?= $block->escapeHtml($block->getCurrentOptionLabel()) ?> </button> <ul class="dropdown-menu" data-role="source-list"> <?php if ($block->isDefaultOptionAvailable()) : ?> <li class="store-switcher-all source-switcher-all <?php if (!$block->getSourceCode()) : ?>current<?php endif ?>"> <?php if ($block->getSourceCode()) : ?> <a data-value="" href="#"><?= $block->escapeHtml($block->getDefaultOptionLabel()) ?></a> <?php else : ?> <span><?= $block->escapeHtml($block->getDefaultOptionLabel()) ?></span> <?php endif ?> </li> <?php endif; ?> <?php foreach ($sources as $source) : ?> <li class="store-switcher-website source-switcher-source<?php if ($block->getSourceCode() == $source->getSourceCode()) : ?> current<?php endif ?>"> <?php if ($block->getSourceCode() != $source->getSourceCode()) : ?> <a data-value="<?= $block->escapeHtmlAttr($source->getSourceCode()) ?>" href="#"><?= $block->escapeHtml($source->getName()) ?></a> <?php else : ?> <span><?= $block->escapeHtml($source->getName()) ?></span> <?php endif ?> </li> <?php endforeach ?> </ul> </div> </div> <script> require([ 'jquery', 'Magento_Ui/js/modal/confirm' ], function(jQuery, confirm){ (function($) { $('[data-role=source-list]').on('click', '[data-value]', function(event) { var sourceCode = $(event.target).data('value'); var source = $('[data-role=source]'); event.preventDefault(); if (!source.val() || (sourceCode !== source.val())) { source.val(sourceCode).trigger('change'); } }); })(jQuery); function switchSource(sourceElement) { var source = jQuery(sourceElement); <?php if ($block->getUseConfirm()) : ?> confirm({ content: "<?= $block->escapeJs(__('Please confirm source switching. All data that hasn\'t been saved will be lost.')) ?>", actions: { confirm: function() { reload(); }, cancel: function() { source.val('<?= $block->escapeJs($block->getSourceCode()) ?>'); } } }); <?php else : ?> reload(); <?php endif ?> function reload() { setLocation('<?= $block->escapeJs($block->getSwitchUrl()) ?>source/' + source.val()); } } window.switchSource = switchSource; }); </script> <?php endif ?>