Files
2026-09-15 10:35:56 +08:00

73 lines
2.7 KiB
PHTML

<?php
/**
* @var \Esun\MultiLocaleTranslation\Block\Adminhtml\Translate\Index $block
*/
$entityType = $block->getEntityType();
$entityId = $block->getEntityId();
$sourceStoreId = $block->getSourceStoreId();
$storeOptions = $block->getStoreOptions();
?>
<div id="esun-mlt-root" class="admin__scope-old">
<div class="page-title">
<h1 class="page-title">
<?= $block->escapeHtml(__('Translate %1', strtoupper($entityType))) ?>
</h1>
<p>
<?= $block->escapeHtml(__('Entity ID: %1', $entityId)) ?>
<span style="margin-left: 16px;">
<?= $block->escapeHtml(__('Source: %1', $block->getSourceStoreIdName())) ?>
</span>
</p>
</div>
<div class="admin__fieldset">
<div class="admin__field">
<label class="admin__field-label" for="mlt-target-store">
<span><?= $block->escapeHtml(__('Target Store View')) ?></span>
</label>
<div class="admin__field-control">
<select id="mlt-target-store" class="admin__control-select">
<?php foreach ($storeOptions as $storeOption): ?>
<?php if ((int)$storeOption['store_id'] === (int)$sourceStoreId) {
continue;
} ?>
<option value="<?= (int)$storeOption['store_id'] ?>">
<?= $block->escapeHtml($storeOption['label']) ?> (<?= $block->escapeHtml($storeOption['code']) ?>)
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<div style="margin-top: 16px;">
<button id="mlt-load-btn" class="action-primary" type="button">
<?= $block->escapeHtml(__('Load Fields')) ?>
</button>
</div>
</div>
<div id="mlt-fields" style="margin-top: 18px;"></div>
<div class="admin__field" style="margin-top: 20px; display: none;" id="mlt-save-area">
<button id="mlt-save-btn" class="action-secondary" type="button">
<?= $block->escapeHtml(__('Save Translation')) ?>
</button>
</div>
</div>
<script type="text/x-magento-init">
{
"#esun-mlt-root": {
"Esun_MultiLocaleTranslation/js/translate-form": {
"entityType": "<?= $block->escapeJs($entityType) ?>",
"entityId": <?= (int)$entityId ?>,
"sourceStoreId": <?= (int)$sourceStoreId ?>,
"fieldsUrl": "<?= $block->escapeJs($block->getFieldsUrl()) ?>",
"applyUrl": "<?= $block->escapeJs($block->getApplyUrl()) ?>",
"formKey": "<?= $block->escapeJs($block->getFormKeyValue()) ?>"
}
}
}
</script>