<?php
    $isCreate = $this->formGetContext() === 'create';
?>
<div class="form-buttons loading-indicator-container">
    <!-- Save -->
    <a
        href="javascript:;"
        class="btn btn-primary wn-icon-check save"
        data-request="onSave"
        data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
        data-request-before-update="$el.trigger('unchange.oc.changeMonitor')"
        <?php if (!$isCreate) : ?>data-request-data="redirect:0"<?php endif ?>
        data-hotkey="ctrl+s, cmd+s">
            <?= e(trans('backend::lang.form.save')) ?>
    </a>

    <?php if (!$isCreate) : ?>
        <!-- Save and Close -->
        <a
            href="javascript:;"
            class="btn btn-primary wn-icon-check save"
            data-request-before-update="$el.trigger('unchange.oc.changeMonitor')"
            data-request="onSave"
            data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>">
                <?= e(trans('backend::lang.form.save_and_close')) ?>
        </a>
    <?php endif ?>

    <?php if ($formModel->url) : ?>
        <!-- Preview -->
        <a
            href="<?= e($formModel->url) ?>"
            target="_blank"
            class="btn btn-primary wn-icon-crosshairs"
            data-control="preview-button">
                <?= e(trans('winter.blog::lang.posts.view_post')) ?>
        </a>
    <?php endif ?>

    <?php if (!$isCreate) : ?>
        <!-- Delete -->
        <button
            type="button"
            class="btn btn-default empty wn-icon-trash-o"
            data-request="onDelete"
            data-request-confirm="<?= e(trans('winter.blog::lang.post.delete_confirm')) ?>"
            data-control="delete-button"
        ></button>
    <?php endif ?>
</div>
