<?php if(isset($items)):?>
    <?php if(empty($items)):?>
    <option value="0"><?= lang('not_found') ?? 'Not found' ?></option>
    <?php endif; ?>
    
    <?php foreach ($items as $item): ?>
    <option value="<?= $item['id'] ?>"><?= $item['name'] ?></option>
    <?php endforeach; ?>
<?php endif; ?>

<?php if (isset($purchases_items) && !empty($purchases_items)): ?>
    <?php foreach ($purchases_items as $i): ?>
        <option <?= isset($row['item_id']) && $row['item_id'] == $i['id'] ? 'selected' : '' ?> value="<?= $i['id'] ?>"><?= $i['name'] ?></option>
    <?php endforeach; ?>
<?php endif; ?>