diff --git a/idhub/admin/views.py b/idhub/admin/views.py index 3e148d9..0b7cc97 100644 --- a/idhub/admin/views.py +++ b/idhub/admin/views.py @@ -412,10 +412,23 @@ class AdminCredentialsView(Credentials): return context -class AdminIssueCredentialsView(Credentials): +class AdminCredentialView(Credentials): template_name = "idhub/admin/issue_credentials.html" - subtitle = _('Issuance of Credentials') + subtitle = _('Change status of Credential') icon = '' + model = VerificableCredential + + def get(self, request, *args, **kwargs): + self.pk = kwargs['pk'] + self.object = get_object_or_404(self.model, pk=self.pk) + return super().get(request, *args, **kwargs) + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context.update({ + 'object': self.object, + }) + return context class AdminRevokeCredentialsView(Credentials): diff --git a/idhub/templates/idhub/admin/credentials.html b/idhub/templates/idhub/admin/credentials.html index 81a1abb..0d7e84c 100644 --- a/idhub/templates/idhub/admin/credentials.html +++ b/idhub/templates/idhub/admin/credentials.html @@ -28,7 +28,7 @@ {{ f.issue_on }} {{ f.get_status }} {{ f.user.email }} - + {% trans 'View' %} {% endfor %} diff --git a/idhub/templates/idhub/admin/issue_credentials.html b/idhub/templates/idhub/admin/issue_credentials.html index f5849fd..bde1220 100644 --- a/idhub/templates/idhub/admin/issue_credentials.html +++ b/idhub/templates/idhub/admin/issue_credentials.html @@ -2,8 +2,60 @@ {% load i18n %} {% block content %} -

- - {{ subtitle }} -

+
+
+

+ + {{ subtitle }} +

+
+
+ {% if object.get_status == 'Issued' %} + {% trans 'Revoke' %} + {% trans 'Delete' %} + {% elif object.get_status == 'Required' %} + {% trans 'Accept' %} + {% trans 'Deny' %} + {% elif object.get_status == 'Issued' %} + {% trans 'Revoke' %} + {% endif %} +
+
+
+
+
+
+ {% for k, v in object.get_datas %} +
+
+ {{ k|capfirst }}: +
+
+ {{ v }} +
+
+ {% endfor %} +
+
+ Date of Issue: +
+
+ {{ object.issuer_on|default_if_none:"" }} +
+
+
+
+ Status: +
+
+ {{ object.get_status}} +
+
+ +
+
{% endblock %} diff --git a/idhub/urls.py b/idhub/urls.py index 6f13025..c861750 100644 --- a/idhub/urls.py +++ b/idhub/urls.py @@ -136,8 +136,8 @@ urlpatterns = [ name='admin_service_del'), path('admin/credentials/', views_admin.AdminCredentialsView.as_view(), name='admin_credentials'), - path('admin/credentials/new/', views_admin.AdminIssueCredentialsView.as_view(), - name='admin_credentials_new'), + path('admin/credentials//', views_admin.AdminCredentialView.as_view(), + name='admin_credential'), path('admin/credentials/revoke/', views_admin.AdminRevokeCredentialsView.as_view(), name='admin_credentials_revoke'), path('admin/wallet/identities/', views_admin.AdminDidsView.as_view(),