126 lines
3.4 KiB
HTML
126 lines
3.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Edit Pengumuman{% endblock %}
|
|
|
|
{% block body %}
|
|
<form method="post">
|
|
<h3>Pengumuman {{ post.id }}</h3>
|
|
|
|
<label for="category">Kategori: </label>
|
|
<select name="category">
|
|
{% for cat in categories %}
|
|
<option value="{{ cat.id }}"
|
|
{% if post.category == cat.id %}
|
|
selected
|
|
{% endif %}
|
|
>
|
|
{{ cat.category }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
<input type="hidden" name="old_category" value="{{ post.category }}">
|
|
|
|
<br>
|
|
|
|
<label for="content">Konten: </label>
|
|
<textarea name="content" rows="3" cols="30" maxlength="255">{{ post.content }}</textarea>
|
|
<input type="hidden" name="old_content" value="{{ post.content }}">
|
|
|
|
<br>
|
|
|
|
<label>Dibuat pada: </label>
|
|
<span>
|
|
{{ post.created_at }}
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<label>Dibuat oleh: </label>
|
|
<span>
|
|
{{ creator.full_name }}
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<label for="valid_at">Berlaku dari: </label>
|
|
<input type="date" name="valid_at" value="{{ post.valid_at }}">
|
|
<input type="hidden" name="old_valid_at" value="{{ post.valid_at }}">
|
|
|
|
<br>
|
|
|
|
<label for="expired_at">Berlaku sampai: </label>
|
|
<input type="date" name="expired_at" value="{{ post.expired_at }}">
|
|
<input type="hidden" name="old_expired_at" value="{{ post.expired_at }}">
|
|
|
|
<br>
|
|
|
|
<label>Diubah pada: </label>
|
|
<span>
|
|
{% if post.edited_at is empty %}
|
|
Tidak pernah
|
|
{% else %}
|
|
{{ post.edited_at }}
|
|
{% endif %}
|
|
</span>
|
|
<input type="hidden" name="edited_at" value="{{ timestamp }}">
|
|
|
|
<br>
|
|
|
|
<label for="editor_name">Diubah oleh: </label>
|
|
<span>
|
|
{% if post.editor is empty %}
|
|
-
|
|
{% else %}
|
|
{{ editor.full_name }}
|
|
{% endif %}
|
|
</span>
|
|
<input type="hidden" name="editor" value="{{ editor_now }}">
|
|
|
|
<br>
|
|
|
|
<label>Status: </label>
|
|
<span>
|
|
{% if post.status == 1 %}
|
|
Aktif
|
|
{% elseif post.status == 2 %}
|
|
Belum aktif
|
|
{% else %}
|
|
Nonaktif
|
|
{% endif %}
|
|
</span>
|
|
|
|
<!-- Current Timestamp -->
|
|
<input type="hidden" name="_currts" value="{{ timestamp }}" disabled>
|
|
|
|
<!-- Method -->
|
|
<input type="hidden" name="_method" value="put">
|
|
|
|
<!-- Token -->
|
|
<input type="hidden" name="_token" value="{{ token }}">
|
|
|
|
<br>
|
|
|
|
<button type="submit"
|
|
{% if (post.status == 0 or post.status == 3 or editor_now != creator.id) %}
|
|
disabled
|
|
{% endif %}
|
|
>
|
|
Edit
|
|
</button>
|
|
</form>
|
|
|
|
{% if (post.status == 1 and editor_now == creator.id) %}
|
|
<form method="post">
|
|
<input type="hidden" name="id" value="{{ post.id }}">
|
|
|
|
<!-- Method -->
|
|
<input type="hidden" name="_method" value="delete">
|
|
|
|
<!-- Token -->
|
|
<input type="hidden" name="_token" value="{{ token }}">
|
|
|
|
<button type="submit">Nonaktif</button>
|
|
</form>
|
|
{% endif %}
|
|
{% endblock %}
|