<?php
/** @var \Magetop\Advancepreview\Block\Adminhtml\Order\PreviewOrderTracking $block */
$id = $block->getRequest()->getParam('id',0);
$itemId = $block->getRequest()->getParam('item_id',0);
$orderId = $block->getRequest()->getParam('order_id',0);
$productId = $block->getRequest()->getParam('product_id',0);
$tracking = $block->getOrderTrackingItem($id,$orderId,$itemId,$productId);
$filedHiddes = [
    'preview_tracking_id',
    'order_id',
    'product_id',
    'item_id',
    'status',
];
$fields = [
    'preview_tracking_id'=>'preview_tracking_id',
    'order_id'=>'order_id',
    'product_id'=>'product_id',
    'item_id'=>'item_id',
    'status'=>'item_id',
    'tracking_number'=>__('Tracking Number'),
    'tracking_link'=>__('Tracking Link'),
    'courier_company'=>__('Courier Company'),
];
?>
<form action="/" method="post" id="form-add-tracking-item">
    <?php foreach ($fields as $key => $field) : ?>
        <?php if(in_array($key,$filedHiddes)) : ?>
            <input type="hidden" name="tracking[<?php echo $key ?>]" value="<?php echo $tracking[$key]; ?>">
        <?php else : ?>
            <label for="txt-tracking-<?php echo $key ?>"><?php echo $field; ?></label>
            <input type="text" id="txt-tracking-<?php echo $key ?>" name="tracking[<?php echo $key ?>]" value="<?php echo $tracking[$key]; ?>" class="admin__control-text">
        <?php endif; ?>
    <?php endforeach; ?>
    <button type="button" id="btn-save-tracking"><?php echo __('Save') ?></button>
</form>
