48 lines
2.4 KiB
PHP
48 lines
2.4 KiB
PHP
<?= $this->extend('layout/management_layout') ?>
|
|
<?= $this->section('content') ?>
|
|
|
|
<?php $isEdit = !empty($template); ?>
|
|
<div class="container mt-4">
|
|
<h2><?= $isEdit ? 'Edit Job Template' : 'New Job Template' ?></h2>
|
|
<?php if (session('errors')): ?>
|
|
<div class="alert alert-danger"><?php foreach ((array) session('errors') as $error): ?><div><?= esc($error) ?></div><?php endforeach; ?></div>
|
|
<?php endif; ?>
|
|
<form action="<?= $isEdit ? site_url('administrator/job-postings/templates/' . $template['template_id']) : site_url('administrator/job-postings/templates') ?>" method="post">
|
|
<?= csrf_field() ?>
|
|
<?= view('jobs/admin/_posting_fields', ['item' => $template ?? []]) ?>
|
|
<?php if ($isEdit): ?>
|
|
<div class="mb-3">
|
|
<label class="form-label" for="save_mode">Save Mode</label>
|
|
<select id="save_mode" name="save_mode" class="form-select">
|
|
<option value="overwrite">Overwrite current version</option>
|
|
<option value="new_version">Save as new version</option>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
<button type="submit" class="btn btn-primary">Save Template</button>
|
|
<a href="<?= site_url('administrator/job-postings/templates') ?>" class="btn btn-outline-secondary">Cancel</a>
|
|
</form>
|
|
<?php if ($isEdit && !empty($versions)): ?>
|
|
<h3 class="h5 mt-5">Version History</h3>
|
|
<table class="table table-sm table-bordered no-mgmt-sticky" data-no-mgmt-sticky>
|
|
<thead><tr><th>Version</th><th>Saved At</th><th>Actions</th></tr></thead>
|
|
<tbody>
|
|
<?php foreach ($versions as $version): ?>
|
|
<tr>
|
|
<td><?= esc($version['version']) ?></td>
|
|
<td><?= esc($version['saved_at']) ?></td>
|
|
<td>
|
|
<form action="<?= site_url('administrator/job-postings/templates/versions/' . $version['version_id'] . '/restore') ?>" method="post">
|
|
<?= csrf_field() ?>
|
|
<button class="btn btn-sm btn-outline-primary" type="submit">Restore</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?= $this->endSection() ?>
|