<?= Form::open(['id' => 'updateForm']) ?>

    <input type="hidden" name="record_id" value="<?= $recordId ?>" />

    <div class="modal-header flex-row-reverse">
        <button type="button" class="close" data-dismiss="popup">&times;</button>
        <h4 class="modal-title"><?= e(trans('rainlab.translate::lang.locale.update_title')) ?></h4>
    </div>

    <?php if (!$this->fatalError): ?>

        <div class="modal-body">
            <?= $this->formRender() ?>
        </div>
        <div class="modal-footer">
            <button
                type="submit"
                data-request="onUpdate"
                data-request-data="redirect:0"
                data-hotkey="ctrl+s, cmd+s"
                data-popup-load-indicator
                class="btn btn-primary">
                <?= e(trans('backend::lang.form.save')) ?>
            </button>

            <button
                type="button"
                class="btn btn-default"
                data-dismiss="popup">
                <?= e(trans('backend::lang.form.cancel')) ?>
            </button>

            <button
                type="button"
                class="oc-icon-trash-o btn-icon danger pull-right"
                data-request="onDelete"
                data-popup-load-indicator
                data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
            </button>
        </div>

    <?php else: ?>

        <div class="modal-body">
            <p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
        </div>
        <div class="modal-footer">
            <button
                type="button"
                class="btn btn-default"
                data-dismiss="popup">
                <?= e(trans('backend::lang.form.close')) ?>
            </button>
        </div>

    <?php endif ?>

    <script>
        setTimeout(
            function() {
                $('#updateForm input.form-control:first').focus()
            },
            310
        )
    </script>

<?= Form::close() ?>
