Fakultas Ilmu Komputer UI

Commit 871345f4 authored by I Gusti Putu Agastya Indrayana's avatar I Gusti Putu Agastya Indrayana Committed by igor lestin sianipar
Browse files

Pbi 5 verifikasi materi new riwayat verif

parent 0a6ebc5d
......@@ -4,10 +4,17 @@ stages:
- deploy
UnitTest:
services:
- postgres:alpine
variables:
POSTGRES_DB: gitlab_test
POSTGRES_USER: gitlab_test
POSTGRES_PASSWORD: SebuahPassword
image: python:3.7
stage: test
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+)%/'
before_script:
- export DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB
- pip install -r requirements.txt
- python manage.py makemigrations
- python manage.py migrate
......
# Generated by Django 3.0.3 on 2020-05-04 01:12
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0019_auto_20200504_0812'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('administration', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='VerificationReport',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('report', django.contrib.postgres.fields.jsonb.JSONField()),
('timestamp', models.DateTimeField(auto_now_add=True)),
('status', models.CharField(choices=[('PENDING', 'Diproses'), ('APPROVE', 'Diterima'), ('DISAPPROVE', 'Ditolak'), ('REVISION', 'Perbaikan')], default='PENDING', max_length=30)),
('materi', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='app.Materi')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
]
from django.db import models
from django.contrib.postgres.fields import JSONField
from app.models import Materi, VERIFICATION_STATUS
from authentication.models import User
class VerificationSetting(models.Model):
title = models.CharField(max_length=250, blank=False)
description = models.TextField(blank=False, default="")
archived = models.BooleanField(default=False, blank=False)
class VerificationReport(models.Model):
report = JSONField()
materi = models.ForeignKey(Materi, models.SET_NULL, null=True)
user = models.ForeignKey(User, models.SET_NULL, null=True)
timestamp = models.DateTimeField(auto_now_add=True)
status = models.CharField(
max_length=30, choices=VERIFICATION_STATUS, default=VERIFICATION_STATUS[0][0])
......@@ -19,7 +19,11 @@ Pratinjau Materi
<li class="nav-item">
<button data-toggle="modal" data-target="#myModal" id="checklistButton" class="btn"
style="background-color:#4e73df;color: azure;">
{% if riwayat %}
Tampilkan Laporan Verifikasi
{% else %}
Tampilkan Kriteria
{% endif %}
</button>
</li>
......@@ -34,52 +38,124 @@ Pratinjau Materi
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
{% if riwayat %}
<h4 class="modal-title">Laporan Verifikasi</h4>
{% else %}
<h4 class="modal-title">Kriteria Verifikasi</h4>
{% endif %}
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
{% if error %}
<h4>Terjadi Kesalahan, coba lagi.</h4>
{% endif %}
{% for kriteria in kriteria_list %}
<div class="row m-2">
<div class="col-8">
{{kriteria.title}}
{% if riwayat %}
<div class="info-wrapper">
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Verifikatur</p>
</dt>
<dd>
<p class="info-content">{{verification_report.user.name}}</p>
</dd>
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input id="kriteria{{ forloop.counter }}Ya" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input kriteria-ok" value=1>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Ya">Ya</label>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Waktu Verifikasi</p>
</dt>
<dd>
<p class="info-content">{{verification_report.timestamp}}</p>
</dd>
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input checked id="kriteria{{ forloop.counter }}Tidak" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input" value=0>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Tidak">Tidak</label>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Status Materi</p>
</dt>
<dd>
<p class="info-content">{{verification_report.status}}</p>
</dd>
</div>
</div>
{% endfor %}
<span><small>Kontributor tidak dapat melihat point-point verifikasi, jika materi ditolak tuliskan alasan
penolakan tersebut di kolom tanggapan.</small></span>
<hr>
{% for kriteria in verification_report.report.kriteria %}
<form method="POST" id="submitForm">
{% csrf_token %}
<div class="row m-2">
<div class="col-8">
{{kriteria.title}}
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input id="kriteria{{ forloop.counter }}Ya" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input" value=1
{% if kriteria.status %} checked {% endif %} disabled>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Ya">Ya</label>
</div>
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input id="kriteria{{ forloop.counter }}Tidak" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input" value=0
{% if not kriteria.status %} checked {% endif %} disabled>
<label class="custom-control-label"
for="kriteria{{ forloop.counter }}Tidak">Tidak</label>
</div>
</div>
</div>
{% endfor %}
<span><small>Kontributor tidak dapat melihat point-point verifikasi, jika materi ditolak tuliskan
alasan
penolakan tersebut di kolom tanggapan.</small></span>
<hr>
<label for="feedbackMateri">Tanggapan terhadap materi untuk Kontributor :</label>
<textarea name="feedback" id="feedbackMateri" class="form-control" rows="6"
disabled>{{ verification_report.report.feedback }}</textarea>
</form>
{% else %}
{% for kriteria in kriteria_list %}
<form method="POST" id="submitForm">
{% csrf_token %}
<div class="row m-2">
<div class="col-8">
{{kriteria.title}}
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input id="kriteria{{ forloop.counter }}Ya" type="radio" name="kriteria-{{kriteria.id}}"
class="custom-control-input kriteria-ok" value=1>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Ya">Ya</label>
</div>
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input checked id="kriteria{{ forloop.counter }}Tidak" type="radio"
name="kriteria-{{kriteria.id}}" class="custom-control-input" value=0>
<label class="custom-control-label"
for="kriteria{{ forloop.counter }}Tidak">Tidak</label>
</div>
</div>
</div>
{% endfor %}
<span><small>Kontributor tidak dapat melihat point-point verifikasi, jika materi ditolak tuliskan
alasan
penolakan tersebut di kolom tanggapan.</small></span>
<hr>
<label for="feedbackMateri">Tanggapan terhadap materi untuk Kontributor :</label>
<textarea name="feedback" id="feedbackMateri" class="form-control" rows="6"></textarea>
</form>
{% endif %}
</div>
<div class="modal-footer">
{% if not riwayat %}
<button disabled class="accept-button btn" type="submit" name="action" value="approve" form="submitForm"
style="background-color: #28a745;border-radius: .25rem;color: azure;"
id="approveButton">Terima</button>
<button disabled class="reject-button btn" type="submit" name="action" value="disapprove"
form="submitForm" style="background-color: #dc3545;border-radius: .25rem;color: azure;"
id="disapproveButton">Tolak</button>
{% endif %}
<button type="button" class="btn" data-dismiss="modal">Tutup</button>
</div>
</div>
......
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Dasbor - {{ page_title }}</title>
<!-- Custom fonts for this template -->
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/button.css' %}">
<!-- Custom styles for this page -->
<link href="{% static 'vendor/datatables/dataTables.bootstrap4.min.css' %}" rel="stylesheet">
</head>
<body id="page-top" style="font-family: 'Poppins', sans-serif;">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="verif.html">
<div class="sidebar-brand-icon rotate-n-15">
</div>
<div class="sidebar-brand-text mx-3">Digipus</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider my-0">
<!-- Nav Item - Dashboard -->
<li class="nav-item">
<a class="nav-link" href="/administration/">
<span>Verifikasi Materi</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">
<span>Daftar Kontributor</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">
<span>Statistik Materi</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="/administration/setting/verification/">
<span>Pengaturan Verifikasi</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/administration/setting/category/">
<span>Pengaturan Kategori</span></a>
</li>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars" aria-hidden="true"></i>
</button>
<div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Nav Item - Search Dropdown (Visible Only XS) -->
<li class="nav-item dropdown no-arrow d-sm-none">
<a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
</a>
<!-- Dropdown - Messages -->
<div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in"
aria-labelledby="searchDropdown">
<form class="form-inline mr-auto w-100 navbar-search">
<div class="input-group">
<input type="text" class="form-control bg-light border-0 small" placeholder="Search for..."
aria-label="Search" aria-describedby="basic-addon2">
<div class="input-group-append">
<button class="btn btn-primary" type="button">
<i class="fas fa-search fa-sm" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</div>
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
<img class="img-profile rounded-circle" src="https://source.unsplash.com/QAB-WJcbgJk/60x60" alt="User profile picture">
</a>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">{{ page_title }} Baru</h6>
</div>
<div class="card-body">
<form method="POST">
{% csrf_token %}
<label>Judul &nbsp;&nbsp;&nbsp;&nbsp; :</label>{{ form.title }}<br>
<label>Deskripsi &nbsp;:</label>{{ form.description }}<br>
<br>
<div class="row">
<button class="primary_btn save" style="border-radius:20px;" type="submit"><i class="far fa-save" aria-hidden="true"></i>
Simpan</button>
</div>
</form>
</div>
</div>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary" id="titleTabel">{{ page_title }}</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" aria-describedby="titleTabel">
<thead>
<tr>
<th scope="col">Item</th>
<th scope="col">Deskripsi</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<th>{{item.title}}</th>
<th>{{item.description}}</th>
<th> </th>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; Diskominfo Kota Depok 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up" aria-hidden="true"></i>
</a>
<!-- Bootstrap core JavaScript-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<!-- Core plugin JavaScript-->
<script src="https://code.jquery.com/jquery-3.5.0.min.js"
integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
<!-- Custom scripts for all pages-->
<script src="{% static 'js/sb-admin-2.min.js' %}"></script>
<!-- Page level plugins -->
<script src="{% static 'vendor/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'vendor/datatables/dataTables.bootstrap4.min.js' %}"></script>
<!-- Page level custom scripts -->
<script src="{% static 'js/demo/datatables-demo.js' %}"></script>
</body>
</html>
\ No newline at end of file
......@@ -86,7 +86,7 @@
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
<i class="fa fa-bars" aria-hidden="true"></i>
</button>
<div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
......@@ -98,7 +98,7 @@
<li class="nav-item dropdown no-arrow d-sm-none">
<a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-search fa-fw"></i>
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
</a>
<!-- Dropdown - Messages -->
<div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in"
......@@ -109,7 +109,7 @@
aria-label="Search" aria-describedby="basic-addon2">
<div class="input-group-append">
<button class="btn btn-primary" type="button">
<i class="fas fa-search fa-sm"></i>
<i class="fas fa-search fa-sm" aria-hidden="true"></i>
</button>
</div>
</div>
......@@ -124,7 +124,7 @@
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
<img class="img-profile rounded-circle" src="https://source.unsplash.com/QAB-WJcbgJk/60x60">
<img class="img-profile rounded-circle" src="https://source.unsplash.com/QAB-WJcbgJk/60x60" alt="User profile picture">
</a>
</li>
......@@ -139,48 +139,81 @@
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Verifikasi Materi</h6>
<h6 class="m-0 font-weight-bold text-primary" id="titleTabelPending">Verifikasi Materi</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<table class="table table-bordered" id="dataTablePending" aria-describedby="titleTabelPending">
<thead>
<tr>
<th>Judul Materi</th>
<th>Nama Kontributor</th>
<th>Status</th>
<th scope="col">Judul Materi</th>
<th scope="col">Nama Kontributor</th>
<th scope="col">Status</th>
<th scope="col">Tombol</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col">Judul Materi</th>
<th scope="col">Nama Kontributor</th>
<th scope="col">Status</th>
<th scope="col">Tombol</th>
</tr>
</tfoot>
<tbody>
{% for materi in materi_list %}
{% for materi in materi_list_pending %}
<tr>
<td><a href="?kategori={{itemKategori.pk}}">{{ materi.title }}</a></td>
<td>{{ materi.title }}</td>
<td>{{ materi.uploader.name }}</td>
<td>
{{ materi.status.13 }}{{ materi.status.14 }}{{ materi.status.15 }}{{ materi.status.16 }}{{ materi.status.17 }}{{ materi.status.18 }}{{ materi.status.19 }}{{ materi.status.20 }}</td>
<td>{{ materi.get_status_display }}</td>
{% if materi.status == "PENDING" %}
<td class="verif-buttons">
<a href="/administration/detail-verif/{{materi.id}}/" class="accept-button"
style="background-color:#4e73df">Detail</a>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary" id="titleTabelRiwayat">Riwayat Verifikasi Materi</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTableRiwayat" width="100%" cellspacing="0" aria-describedby="titleTabelRiwayat">
<thead>
<tr>
<th scope="col">Judul Materi</th>
<th scope="col">Nama Kontributor</th>
<th scope="col">Status</th>
<th scope="col">Tombol</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Judul Materi</th>
<th>Nama Kontributor</th>
<th>Status</th>
<th scope="col">Judul Materi</th>
<th scope="col">Nama Kontributor</th>
<th scope="col">Status</th>
<th scope="col">Tombol</th>
</tr>
</tfoot>
<tbody>
{% for materi in materi_list %}
{% for materi in materi_list_history %}
<tr>
<td>{{ materi.title }}</td>
<td>{{ materi.uploader.name }}</td>
<td>{{ materi.status.label }}</td>
{% if materi.status == "PENDING" %}
<td>{{ materi.get_status_display }}</td>
<td class="verif-buttons">
<a href="/administration/detail-verif/{{materi.id}}/" class="accept-button"
style="background-color:#4e73df">Detail</a>
<a href="/administration/api/approve/{{materi.id}}/" class="accept-button">Terima</a>
<a href="/administration/api/disapprove/{{materi.id}}/" class="reject-button">Tolak</a></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
......@@ -213,7 +246,7 @@