<?php require __DIR__ . '/../../layouts/header.php'; ?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="page-title"><?= e(trans('author_workflow')) ?></h1>
        <div class="text-muted"><?= e((string) ($submission['title'] ?? '')) ?></div>
    </div>
    <a href="<?= e(base_path('admin/author-workflow')) ?>" class="btn ec-btn btn-outline-secondary rounded-3"><?= e(trans('back')) ?></a>
</div>

<div class="ec-card  "><div class="ec-card-body p-4">
<form method="post" action="<?= e(base_path('admin/author-workflow/edit?submission_id=' . (int) $submission['id'])) ?>">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<input type="hidden" name="submission_id" value="<?= e((string) $submission['id']) ?>">
<div class="row g-3">
    <div class="col-md-6">
        <label class="form-label"><?= e(trans('workflow_stage')) ?></label>
        <select name="workflow_stage" class="form-select rounded-3">
            <?php foreach (['submission','reviewing','production','copyediting','publishing'] as $s): ?>
                <option value="<?= e($s) ?>" <?= (($workflow['workflow_stage'] ?? 'submission') === $s) ? 'selected' : '' ?>><?= e(trans($s . '_stage')) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="col-md-6">
        <label class="form-label"><?= e(trans('workflow_status')) ?></label>
        <select name="workflow_status" class="form-select rounded-3">
            <?php foreach (['pending','in_progress','completed','returned'] as $s): ?>
                <option value="<?= e($s) ?>" <?= (($workflow['workflow_status'] ?? 'pending') === $s) ? 'selected' : '' ?>><?= e(trans($s)) ?></option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('notes')) ?> EN</label><textarea name="notes_en" class="form-control rounded-3 richtext" rows="6"><?= e((string) ($workflow['notes_en'] ?? '')) ?></textarea></div>
    <div class="col-md-6"><label class="form-label"><?= e(trans('notes')) ?> AR</label><textarea name="notes_ar" class="form-control rounded-3 richtext" rows="6"><?= e((string) ($workflow['notes_ar'] ?? '')) ?></textarea></div>
</div>
<div class="mt-4"><button class="btn ec-btn btn-success rounded-3"><?= e(trans('save')) ?></button></div>
</form>
</div></div>

<?php require __DIR__ . '/../../layouts/footer.php'; ?>
