def edit_queue_form(request, queue_id): return Form( title=EditQueueForm.TITLE, description=EditQueueForm.DESCRIPTION, questions=[ TextInput( title=EditQueueForm.Name.TITLE, description=EditQueueForm.Name.DESCRIPTION, name="name", ), Select( title=EditQueueForm.CountersigningQueue.TITLE, description=EditQueueForm.CountersigningQueue.DESCRIPTION, options=remove_current_queue_id( get_queues(request=request, disable_pagination=True, convert_to_options=True, users_team_first=True), queue_id, ), name="countersigning_queue", ), ], back_link=BackLink(EditQueueForm.BACK, reverse_lazy("queues:manage")), )
def add_user_form(request): return Form( title=AddUserForm.TITLE, questions=[ TextInput(title=AddUserForm.Email.TITLE, description=AddUserForm.Email.DESCRIPTION, name="email"), Select( title=AddUserForm.Team.TITLE, description=AddUserForm.Team.DESCRIPTION, name="team", options=get_teams(request, True), ), Select( title=AddUserForm.Role.TITLE, description=AddUserForm.Role.DESCRIPTION, name="role", options=get_roles(request, True), ), Select( title=AddUserForm.DefaultQueue.TITLE, description=AddUserForm.DefaultQueue.DESCRIPTION, name="default_queue", options=get_queues(request, include_system=True, convert_to_options=True), ), ], back_link=BackLink(AddUserForm.BACK_LINK, reverse_lazy("users:users")), javascript_imports={"/javascripts/filter-default-queue-list.js"}, )
def get(self, request, **kwargs): params = { "page": int(request.GET.get("page", 1)), **get_params_if_exist(request, [ "case_status", "team", "queue", "tier", "only_active" ]), } data, _ = get_routing_rules(request, convert_dict_to_query_params(params)) user_data, _ = get_gov_user(request, str(request.session["lite_api_user_id"])) status = request.GET.get("status", "active") filters = FiltersBar([ Select(title=Filter.CASE_STATUS, name="case_status", options=get_statuses(request, True)), *conditional( has_permission(request, Permission.MANAGE_ALL_ROUTING_RULES), [ Select(title=Filter.TEAM, name="team", options=get_teams(request, True)), AutocompleteInput( title=Filter.QUEUE, name="queue", options=get_queues(request, convert_to_options=True), ), ], [ AutocompleteInput( title=Filter.QUEUE, name="queue", options=get_users_team_queues( request, request.session["lite_api_user_id"], True), ), ], ), TextInput(title=Filter.TIER, name="tier"), Checkboxes( name="only_active", options=[Option(True, Filter.ACTIVE_ONLY)], classes=["govuk-checkboxes--small"], ), ]) context = { "data": data, "status": status, "user_data": user_data, "filters": filters, } return render(request, "routing-rules/index.html", context)
def get(self, request, **kwargs): page = request.GET.get("page", 1) name = request.GET.get("name") queues = get_queues(request, page=page, disable_pagination=False, name=name) user_data, _ = get_gov_user(request, str(request.session["lite_api_user_id"])) filters = FiltersBar([TextInput(name="name", title="name")]) context = { "data": queues, "user_data": user_data, "filters": filters, "name": name, } return render(request, "queues/manage.html", context)
def edit_user_form(request, user, can_edit_role: bool): return Form( title=EditUserForm.TITLE.format(user["first_name"], user["last_name"]), questions=[ TextInput(title=EditUserForm.Email.TITLE, description=EditUserForm.Email.DESCRIPTION, name="email"), Select( title=EditUserForm.Team.TITLE, description=EditUserForm.Team.DESCRIPTION, name="team", options=get_teams(request, True), ), conditional( can_edit_role, Select( title=EditUserForm.Role.TITLE, description=EditUserForm.Role.DESCRIPTION, name="role", options=get_roles(request, True), ), ), Select( title=EditUserForm.DefaultQueue.TITLE, description=EditUserForm.DefaultQueue.DESCRIPTION, name="default_queue", options=get_queues(request, include_system=True, convert_to_options=True), ), ], back_link=BackLink( EditUserForm.BACK_LINK.format(user["first_name"], user["last_name"]), reverse_lazy("users:user", kwargs={"pk": user["id"]}), ), default_button_name=EditUserForm.SUBMIT_BUTTON, javascript_imports={"/javascripts/filter-default-queue-list.js"}, )
from django.http import HttpRequest from django.urls import reverse from lite_content.lite_internal_frontend.cases import Manage from lite_forms.components import Form, Checkboxes, Filter, BackLink, DetailComponent, TextArea from caseworker.queues.services import get_queues def move_case_form(request: HttpRequest, queue, case: dict): return Form( title=Manage.MoveCase.TITLE, description=Manage.MoveCase.DESCRIPTION, questions=[ Filter(), Checkboxes("queues[]", get_queues(request, convert_to_options=True), filterable=True), DetailComponent( title=Manage.MoveCase.NOTE, components=[ TextArea(name="note", classes=["govuk-!-margin-0"]), ], ), ], back_link=BackLink(url=reverse("cases:case", kwargs={ "queue_pk": queue["id"], "pk": case["id"] })), container="case", )