Merge pull request #242 from Reena-cell/develop

changes in system view
This commit is contained in:
Simon Redfern 2022-10-18 13:45:56 +02:00 committed by GitHub
commit 27cd621957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 124 additions and 2 deletions

View File

@ -51,6 +51,7 @@ INSTALLED_APPS = [
'base',
'obp',
'consumers',
'systemviews',
'users',
'branches',
'atms',

View File

@ -34,6 +34,7 @@ urlpatterns += i18n_patterns(
OAuthInitiateView.as_view(), name='single-sign-on'),
url(r'^logout$',
LogoutView.as_view(), name='oauth-logout'),
url(r'^systemviews/', include('systemviews.urls')),
url(r'^consumers/', include('consumers.urls')),
url(r'^entitlementrequests/', include('entitlementrequests.urls')),
url(r'^users/', include('users.urls')),

View File

@ -59,13 +59,13 @@
<li {% if metrics_summary_url in request.path %} class="active" {% endif %}><a href="{{ metrics_summary_url }}">{% trans "KPI Dashboard" %}</a></li>
</ul>
</li>
{% url "branches_list" as branches_list_url %} {% url "customers-create" as customers_create_url %} {% url "customer-list" as customer_list_url %} {% url "atms_create" as atms_create_url %} {% url "atm-list" as atm_list_url %} {% url "product-list" as product_list_url %} {% url "products-create" as product_create_url %}
{% url "system_view" as system_view_url %} {% url "branches_list" as branches_list_url %} {% url "customers-create" as customers_create_url %} {% url "customer-list" as customer_list_url %} {% url "atms_create" as atms_create_url %} {% url "atm-list" as atm_list_url %} {% url "product-list" as product_list_url %} {% url "products-create" as product_create_url %}
<li class="dropdown{% if customers_create_url in request.path %} active{% endif %}">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">{% trans "Resources" %}</a>
<ul class="dropdown-menu">
<li {% if system_view_url in request.path %} class="active" {% endif %}><a href="{{ system_view_url }}">{% trans "System View" %}</a></li><hr class="dropdown-hr">
<li {% if customers_create_url in request.path %} class="active" {% endif %}><a href="{{ customers_create_url }}">{% trans "Customers" %}</a></li>
<li {% if customer_list_url in request.path %} class="active" {% endif %}><a href="{{ customer_list_url }}">{% trans "Customer List" %}</a></li>
<hr class="dropdown-hr">
<li {% if branches_list_url in request.path %} class="active" {% endif %}><a href="{{ branches_list_url }}">{% trans "Branches" %}</a></li>
<li {% if atms_create_url in request.path %} class="active" {% endif %}><a href="{{ atms_create_url }}">{% trans "ATM Create" %}</a></li>
<li {% if atm_list_url in request.path %} class="active" {% endif %}><a href="{{ atm_list_url }}">{% trans "ATM List" %}</a></li>

View File

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class AtmsConfig(AppConfig):
name = 'atms'

View File

@ -0,0 +1,4 @@
from django.db import models
# Create your models here.
# -*- coding: utf-8 -*-

View File

@ -0,0 +1,18 @@
#system_view div {
margin: 5px 0;
}
/* The actual popup (appears on top) */
.popuptext {
width: 250px;
background-color: #555;
color: #fff;
text-align: left;
border-radius: 6px;
padding: 8px 0;
z-index: 1;
/*bottom: 125%;*/
top:100%;
left: 50%;
margin-left: -80px;
}

View File

@ -0,0 +1,5 @@
$(document).ready(function($) {
$('#info').click(function() {
alert("Hello World")
});
});

View File

@ -0,0 +1,29 @@
{% extends 'base.html' %} {% load static %} {% load i18n %}
{% block page_title %} {{ block.super }} / {% trans "System View" %}{% endblock page_title %} {% block content %}
<div id="systemview">
<h1>{% trans "System View" %}</h1>
<div class="table-responsive">
<table class="table table-hover tablesorter" id="system_view" aria-describedby="system view">
<thead>
<th scope="col">{% trans "Id" %}</th>
<th scope="col">{% trans "Short Name" %}</th>
<th scope="col">{% trans "Is Public" %}</th>
<th scope="col">{% trans "Description" %}</th>
</thead>
<tbody>
<tr data-system-view="{{ system_view.id }}">
<td>{{ system_view.id }}</td>
<td>{{ system_view.short_name }}</td>
<td>{{ system_view.is_public }}</td>
<td>{{ system_view.description }}</td>
<td><a href="{{ url_systemview_update }}" class="btn btn-primary">{% trans "View" %}</a></td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %} {% block extrajs %} {% endblock extrajs %} {% block extracss %}
<link href="{% static 'systemview/css/systemview.css' %}" rel="stylesheet"> {% endblock extracss %}

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
"""
URLs for System View app
"""
from django.conf.urls import url
from .views import SystemView
urlpatterns = [
url(r'^$',
SystemView.as_view(),
name='system_view'),
]

View File

@ -0,0 +1,43 @@
from django.shortcuts import render
# Create your views here.
# -*- coding: utf-8 -*-
"""
Views of System View app
"""
import datetime
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
import json
from django.urls import reverse_lazy
from django.http import HttpResponse
from django.views.generic import FormView,TemplateView, View
from obp.api import API, APIError
import csv
class SystemView(LoginRequiredMixin, FormView):
template_name = "systemviews/index.html"
success_url = '/systemview'
def get_systemview(self):
api = API(self.request.session.get('obp'))
try:
system_view = []
urlpath = '/system-views/owner'
result = api.get(urlpath)
system_view = result
except APIError as err:
messages.error(self.request, err)
return []
except Exception as inst:
messages.error(self.request, "Unknown Error {}".format(type(inst).__name__))
return []
return system_view
def get_context_data(self, **kwargs):
system_view = self.get_systemview()
context = {}
context.update({
'system_view': system_view,
})
return context