![]() 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/old/vendor/extmag/shiplab/view/adminhtml/templates/configuration/scope/ |
<?php /** * Copyright © Extmag. All rights reserved. */ // @codingStandardsIgnoreFile use Extmag\Shiplab\Block\Adminhtml\Configuration\Scope\Switcher; /* @var $block Switcher */ ?> <?php if ($stores = $block->getStores()): ?> <div class="store-switcher store-view"> <span class="store-switcher-label"><?= /* @escapeNotVerified */ __('Scope View:') ?></span> <div class="actions dropdown closable"> <input type="hidden" name="country_switcher" id="country_switcher" data-role="country-id" data-param="<?= /* @escapeNotVerified */ $block->getCountryVarName() ?>" value="<?= $block->escapeHtml($block->getCountryId()) ?>" onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?>> <input type="hidden" name="direction_switcher" id="direction_switcher" data-role="direction-id" data-param="<?= /* @escapeNotVerified */ $block->getDirectionVarName() ?>" value="<?= $block->escapeHtml($block->getDirectionId()) ?>" onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?>> <input type="hidden" name="store_switcher" id="store_switcher" data-role="store-id" data-param="<?= /* @escapeNotVerified */ $block->getStoreVarName() ?>" value="<?= $block->escapeHtml($block->getStoreId()) ?>" onchange="switchScope(this);"<?= /* @escapeNotVerified */ $block->getUiId() ?>> <button type="button" class="admin__action-dropdown" data-mage-init='{"dropdown":{}}' data-toggle="dropdown" aria-haspopup="true" id="store-change-button"> <?= /* @escapeNotVerified */ $block->getCurrentSelectionName() ?> </button> <ul class="dropdown-menu" data-role="stores-list"> <?php if ($block->hasDefaultOption()): ?> <li class="store-switcher-all <?php if (!($block->getDefaultSelectionName() != $block->getCurrentSelectionName())) { echo "disabled"; } ?> <?php if (!$block->hasScopeSelected()) { ?> current<?php } ?>"> <?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) { ?> <a data-role="country-id" data-value="" href="#"> <?= /* @escapeNotVerified */ $block->getDefaultSelectionName() ?> </a> <?php } else { ?> <span><?= /* @escapeNotVerified */ $block->getDefaultSelectionName() ?></span> <?php } ?> </li> <?php endif; ?> <?php foreach ($stores as $store): ?> <?php $showStore = false; ?> <?php foreach ($block->getDirections($store) as $direction): ?> <?php $showDirection = false; ?> <?php foreach ($block->getCountries($direction) as $country): ?> <?php if (!$showStore): ?> <?php $showStore = true; ?> <li class="store-switcher-website <?php if ($block->isStoreSelected($store)) { ?> current<?php } ?>"> <?php if (!$block->isStoreSelected($store)) { ?> <a data-role="store-id" data-value="<?= $block->escapeHtml($store->getId()) ?>" href="#"> <?= $block->escapeHtml($store->getTitle()) ?> </a> <?php } else { ?> <span><?= $block->escapeHtml($store->getTitle()) ?></span> <?php } ?> </li> <?php endif; ?> <?php if (!$showDirection): ?> <?php $showDirection = true; ?> <li class="store-switcher-store <?php if ($block->isDirectionSelected($direction)) { ?> current<?php } ?>"> <?php if (!$block->isDirectionSelected($direction)) { ?> <a data-role="direction-id" data-value="<?= $block->escapeHtml($direction->getId()) ?>" href="#"> <?= $block->escapeHtml($direction->getTitle()) ?> </a> <?php } else { ?> <span><?= $block->escapeHtml($direction->getTitle()) ?></span> <?php } ?> </li> <?php endif; ?> <li class="store-switcher-country <?php if ($block->isCountrySelected($country)) { ?> current<?php } ?>"> <?php if (!$block->isCountrySelected($country)) { ?> <a data-role="country-id" data-value="<?= $block->escapeHtml($country->getId()) ?>" href="#"> <?= $block->escapeHtml($country->getTitle()) ?> </a> <?php } else { ?> <span><?= $block->escapeHtml($country->getTitle()) ?></span> <?php } ?> </li> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> <?php if ($block->getShowManageStoresLink() && $block->getAuthorization()->isAllowed('Extmag_Shiplab::shiplab_configurationscope')): ?> <li class="dropdown-toolbar"> <a href="<?= /* @escapeNotVerified */ $block->getUrl('*/configurationScope') ?>"><?= /* @escapeNotVerified */ __('Scopes Configuration') ?></a> </li> <?php endif; ?> </ul> </div> <?= $block->getHintHtml() ?> </div> <script> require([ 'jquery', 'Magento_Ui/js/modal/confirm' ], function (jQuery, confirm) { (function ($) { var $storesList = $('[data-role=stores-list]'); $storesList.on('click', '[data-value]', function (event) { var val = $(event.target).data('value'); var role = $(event.target).data('role'); var switcher = $('[data-role=' + role + ']'); event.preventDefault(); if (!switcher.val() || val != switcher.val()) { switcher.val(val).trigger('change'); // Set the value & trigger event } }); })(jQuery); var scopeSwitcherHandler; function switchScope(obj) { var switcher = jQuery(obj); var scopeId = switcher.val(); var scopeParams = ''; if (scopeId) { scopeParams = switcher.data('param') + '/' + scopeId + '/'; } if (obj.switchParams) { scopeParams += obj.switchParams; } if ((typeof scopeSwitcherHandler) != 'undefined') { var switcherParams = { scopeId: scopeId, scopeParams: scopeParams, useConfirm: <?= (int)$block->getUseConfirm() ?> }; scopeSwitcherHandler(switcherParams); } else { <?php if ($block->getUseConfirm()): ?> confirm({ content: "<?= /* @escapeNotVerified */ __('Please confirm scope switching. All data that hasn\'t been saved will be lost.') ?>", actions: { confirm: function () { reload(); }, cancel: function () { obj.value = '<?= $block->escapeHtml($block->getCountryId()) ?>'; } } }); <?php else: ?> reload(); <?php endif; ?> } function reload() { <?php if (!$block->isUsingIframe()): ?> var url = '<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>' + scopeParams; setLocation(url); <?php else: ?> jQuery('#preview_selected_store').val(scopeId); jQuery('#preview_form').submit(); jQuery('.store-switcher .dropdown-menu li a').each(function () { var $this = jQuery(this); if ($this.data('role') === 'store-view-id' && $this.data('value') == scopeId) { jQuery('#store-change-button').html($this.text()); } }); jQuery('#store-change-button').click(); <?php endif; ?> } } window.scopeSwitcherHandler = scopeSwitcherHandler; window.switchScope = switchScope; }); </script> <?php endif; ?>