diff --git a/app/__init__.py b/app/__init__.py index 9ff29af79..a2c3047ed 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -54,6 +54,7 @@ from app.notify_client.provider_client import ProviderClient from app.notify_client.organisations_client import OrganisationsClient from app.notify_client.models import AnonymousUser from app.notify_client.letter_jobs_client import LetterJobsClient +from app.notify_client.inbound_number_client import InboundNumberClient from app.utils import get_cdn_domain from app.utils import gmt_timezones @@ -75,6 +76,7 @@ organisations_client = OrganisationsClient() asset_fingerprinter = AssetFingerprinter() statsd_client = StatsdClient() letter_jobs_client = LetterJobsClient() +inbound_number_client = InboundNumberClient() # The current service attached to the request stack. current_service = LocalProxy(partial(_lookup_req_object, 'service')) @@ -107,6 +109,7 @@ def create_app(): provider_client.init_app(application) organisations_client.init_app(application) letter_jobs_client.init_app(application) + inbound_number_client.init_app(application) login_manager.init_app(application) login_manager.login_view = 'main.sign_in' diff --git a/app/main/__init__.py b/app/main/__init__.py index 506d07858..553238962 100644 --- a/app/main/__init__.py +++ b/app/main/__init__.py @@ -29,5 +29,6 @@ from app.main.views import ( platform_admin, letter_jobs, conversation, - notifications + notifications, + inbound_number ) diff --git a/app/main/views/inbound_number.py b/app/main/views/inbound_number.py new file mode 100644 index 000000000..c21649f06 --- /dev/null +++ b/app/main/views/inbound_number.py @@ -0,0 +1,32 @@ +from flask import ( + render_template, + redirect, + session, + url_for, + request +) + +from flask_login import login_required +from app.main import main +from app import inbound_number_client +from app.utils import user_has_permissions + + +@main.route('/inbound-sms-admin', methods=['GET', 'POST']) +@login_required +@user_has_permissions(admin_override=True) +def inbound_sms_admin(): + #data = user_api_client.get_inboundsms_number_service() + data = inbound_number_client.get_inbound_sms_number_service() + + # return jsonify(data) + + return render_template('views/inbound_sms_admin.html', + inbound_num_list = data) + + + + + + + diff --git a/app/notify_client/inbound_number_client.py b/app/notify_client/inbound_number_client.py new file mode 100644 index 000000000..efa7fdfd4 --- /dev/null +++ b/app/notify_client/inbound_number_client.py @@ -0,0 +1,15 @@ +from app.notify_client import NotifyAdminAPIClient + +class InboundNumberClient(NotifyAdminAPIClient): + + def __init__(self): + super().__init__("a" * 73, "b") + + def init_app(self, app): + self.base_url = app.config['API_HOST_NAME'] + self.service_id = app.config['ADMIN_CLIENT_USER_NAME'] + self.api_key = app.config['ADMIN_CLIENT_SECRET'] + + def get_inbound_sms_number_service(self): + endpoint = '/inbound_number' + return self.get(endpoint) \ No newline at end of file diff --git a/app/templates/views/inbound_sms_admin.html b/app/templates/views/inbound_sms_admin.html new file mode 100644 index 000000000..f1f6ad4ca --- /dev/null +++ b/app/templates/views/inbound_sms_admin.html @@ -0,0 +1,85 @@ +{% extends "withnav_template.html" %} +{% from "components/table.html" import list_table, row, field, hidden_field_heading %} +{% from "components/page-footer.html" import page_footer %} + +{% block service_page_title %} +Inbound Numbers +{% endblock %} + +{% set table_headings = { + 'field_headings': [ + '', 'Number', 'Status', 'Service', 'Created on' + ], + 'field_headings_visible': True, + 'caption_visible': True +} %} + +{% set phone_number = { + 'num':['012345560', '012345561', '012345562', '012345563', '012345564', '012345564', '012345564', '012345564', '012345564' + , '012345564', '012345564'], + 'field_headings_visible': True, + 'caption_visible': True +} %} + +{% set service = { + 'name':['GOV.UK', 'DVLA', 'Passport office', 'Fishing Dept', 'Gov Wifi', 'Test', '', '', '' + , '', ''], + 'field_headings_visible': True, + 'caption_visible': True +} %} + +{% set active = { + 'state':['active', 'active', 'active', 'active', 'active', 'active', '', '', '' + , '', ''], + 'field_headings_visible': True, + 'caption_visible': True +} %} + +.inbound { + font-style:normal; + font-weight:normal; +} + +{% block maincolumn_content %} + +
| {{table_headings.field_headings[0]}} | +{{table_headings.field_headings[1]}} | +{{table_headings.field_headings[2]}} | +{{table_headings.field_headings[3]}} | +
|---|---|---|---|
| {{loop.index}} | +{{value.number}} | ++ {% if value.active %} + Active + {% else %}Inactive + {% endif %} + | +{{value.service.name}} | +