Skip to content

Commit

Permalink
add mabar scrim feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ridwaanhall committed Sep 17, 2024
1 parent 02f6f36 commit 4f022f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions mabar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class MabarAdmin(admin.ModelAdmin):
def colored_status(self, obj):
color = {
'antri': 'orange',
'antri_scrim': 'orange',
'prepare': 'blue',
'in_mabar': 'lightgreen',
'salah_id': 'red',
Expand Down
14 changes: 10 additions & 4 deletions mabar/templates/public/mabar_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ <h1 class="text-center mb-4">Daftar Mabar</h1>
<td>
{% if prepare.status == 'done' %}
<span class="badge" style="background-color: green; color: white;">Selesai</span>
{% elif prepare.status == 'antri' %}
<span class="badge" style="background-color: orange; color: white;">Dalam Antrian</span>
{% elif record.status == 'antri' %}
<span class="badge" style="background-color: orange; color: white;">Antri Mabar</span>
{% elif record.status == 'antri_scrim' %}
<span class="badge" style="background-color: rgb(0, 217, 255); color: rgb(0, 0, 0);">Antri Scrim</span>
{% elif prepare.status == 'prepare' %}
<span class="badge" style="background-color: blue; color: white;">Persiapan</span>
{% elif prepare.status == 'in_mabar' %}
Expand Down Expand Up @@ -104,7 +106,9 @@ <h1 class="text-center mb-4">Daftar Mabar</h1>
{% if record.status == 'done' %}
<span class="badge" style="background-color: green; color: white;">Selesai</span>
{% elif record.status == 'antri' %}
<span class="badge" style="background-color: orange; color: white;">Dalam Antrian</span>
<span class="badge" style="background-color: orange; color: white;">Antri Mabar</span>
{% elif record.status == 'antri_scrim' %}
<span class="badge" style="background-color: rgb(0, 217, 255); color: rgb(0, 0, 0);">Antri Scrim</span>
{% elif record.status == 'prepare' %}
<span class="badge" style="background-color: blue; color: white;">Persiapan</span>
{% elif record.status == 'in_mabar' %}
Expand Down Expand Up @@ -170,7 +174,9 @@ <h1 class="text-center mb-4">Daftar Mabar</h1>
{% if record.status == 'done' %}
<span class="badge" style="background-color: green; color: white;">Selesai</span>
{% elif record.status == 'antri' %}
<span class="badge" style="background-color: orange; color: white;">Dalam Antrian</span>
<span class="badge" style="background-color: orange; color: white;">Antri Mabar</span>
{% elif record.status == 'antri_scrim' %}
<span class="badge" style="background-color: rgb(0, 217, 255); color: rgb(0, 0, 0);">Antri Scrim</span>
{% elif record.status == 'prepare' %}
<span class="badge" style="background-color: blue; color: white;">Persiapan</span>
{% elif record.status == 'in_mabar' %}
Expand Down
4 changes: 2 additions & 2 deletions mabar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# View untuk menampilkan daftar Mabar Record
def mabar_list(request):
records = Mabar.objects.all().order_by('date_created')
records_show_all_except_done = records.filter(is_done=False)
records_show_all_except_done_and_except_prepare = records.filter(is_done=False, status__in=['antri', 'antri_scrim', 'in_mabar', 'salah_id', 'kurang', 'done'])
records_filter_by_status_prepare = records.filter(status='prepare', is_done=False)
records_show_all_done = records.filter(is_done=True)

context = {
'records_all': records,
'records_except_done': records_show_all_except_done,
'records_except_done': records_show_all_except_done_and_except_prepare,
'prepare_records': records_filter_by_status_prepare,
'done_records': records_show_all_done
}
Expand Down

0 comments on commit 4f022f4

Please sign in to comment.