Move files and add list-cases route method

This commit is contained in:
Ryan Prather 2024-11-30 22:12:33 -05:00
parent 4403f65b74
commit 8825f5fc36
4 changed files with 261 additions and 3 deletions

View File

@ -73,7 +73,7 @@ class AdminController extends AbstractController
$this->navLinks['user_list'] = 'nav-link text-white active bg-gradient-dark';
return $this->render(
'internal/admin/list-users.html.twig',
'internal/admin/users/list-users.html.twig',
array_merge(
$this->navLinks,
[
@ -126,7 +126,7 @@ class AdminController extends AbstractController
$this->navLinks['user_list'] = 'nav-link text-white active bg-gradient-dark';
return $this->render(
'internal/admin/add-user.html.twig',
'internal/admin/users/add-user.html.twig',
array_merge(
$this->navLinks,
[
@ -169,7 +169,7 @@ class AdminController extends AbstractController
}
return $this->render(
'internal/admin/edit-user.html.twig',
'internal/admin/users/edit-user.html.twig',
array_merge(
$this->navLinks,
[
@ -225,4 +225,23 @@ class AdminController extends AbstractController
)
);
}
#[Route('/list-cases', name: 'app_list_cases')]
public function listCases(#[CurrentUser()] User $user): Response
{
$this->denyAccessUnlessGranted('ROLE_ADMIN');
return $this->render(
'internal/cases/case-list.html.twig',
array_merge(
$this->navLinks,
[
'breadcrumbs' => [
'List Cases'
],
'notifications' => $user->retrieveUnreadNotifications(),
]
)
);
}
}

View File

@ -0,0 +1,86 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
<section>
<div class='page-header min-vh-100'>
<div class='container'>
<div class="row">
<div class="col-6 d-lg-flex d-none h-100 my-auto pe-0 position-absolute top-0 start-0 text-center justify-content-center flex-column">
<div class="position-relative bg-gradient-primary h-100 m-3 px-7 border-radius-lg d-flex flex-column justify-content-center" style="background-image: url('/assets/img/illustrations/illustration-signup.jpg'); background-size: cover;"></div>
</div>
<div class="col-xl-4 col-lg-5 col-md-7 d-flex flex-column ms-auto me-auto ms-lg-auto me-lg-5">
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Create User</h4>
<p class="mb-0">Add a new user to your company</p>
</div>
<div class="card-body">
{{ form_errors(form) }}
{{ form_start(form) }}
<div class="input-group input-group-outline mb-3">
<label for="user_form_name" class="form-label">Name</label>
<input type="text" name="{{ field_name(form.name) }}" id='user_form_name' placeholder="" class="form-control" required="required"/>
</div>
<div class="input-group input-group-outline mb-3">
<label for="user_form_username" class="form-label">Username</label>
<input type="text" name="{{ field_name(form.username) }}" id='user_form_username' placeholder="" class="form-control" required="required"/>
</div>
<div class="input-group input-group-outline mb-3">
<label for="user_form_email" class="form-label">Email</label>
<input type="email" name="{{ field_name(form.email) }}" id='user_form_email' placeholder="" class="form-control" required="required"/>
</div>
<div class="input-group input-group-outline mb-3">
<label for="user_form_password" class="form-label">Password</label>
<input type="password" name="{{ field_name(form.password) }}" id='user_form_password' placeholder="" class="form-control" required="required"/>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='user_form_job' class='form-label'>Job</label>
<select name='{{ field_name(form.job) }}' id='user_form_job' class='form-control'>
<option value=''></option>
{% for jt in enum('App\\Enums\\JobType').cases() %}
<option value='{{ jt.value }}'>{{ jt.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='user_form_level' class='form-label'>Level</label>
<select name='{{ field_name(form.level) }}' id='user_form_level' class='form-control'>
<option value=''></option>
{% for cl in enum('App\\Enums\\CaseLevel').cases() %}
<option value='{{ cl.value }}'>{{ cl.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='user_form_rateType' class='form-label'>Rate Type</label>
<select name='{{ field_name(form.rateType) }}' id='user_form_rateType' class='form-control'>
<option value=''></option>
{% for rt in enum('App\\Enums\\RateType').cases() %}
<option value='{{ rt.value }}'>{{ rt.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='user_form_rate' class='form-label'>Rate</label>
<input type='number' name='{{ field_name(form.rate) }}' id='user_form_rate' class='form-control' min='0' step='0.01'/>
</div>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Add User</button>
</div>
{{ form_end(form) }}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
{% endblock %}

View File

@ -0,0 +1,80 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
<section>
<div class='page-header min-vh-100'>
<div class='container'>
<div class="row">
<div class="col-6 d-lg-flex d-none h-100 my-auto pe-0 position-absolute top-0 start-0 text-center justify-content-center flex-column">
<div class="position-relative bg-gradient-primary h-100 m-3 px-7 border-radius-lg d-flex flex-column justify-content-center" style="background-image: url('/assets/img/illustrations/illustration-signup.jpg'); background-size: cover;"></div>
</div>
<div class="col-xl-4 col-lg-5 col-md-7 d-flex flex-column ms-auto me-auto ms-lg-auto me-lg-5">
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Update User</h4>
</div>
<div class="card-body">
{{ form_errors(form) }}
{{ form_start(form) }}
<div class="input-group input-group-outline mb-3 is-filled">
<label for="user_form_name" class="form-label">Name</label>
<input type="text" name="{{ field_name(form.name) }}" value='{{ field_value(form.name) }}' class="form-control" required="required"/>
</div>
<div class="input-group input-group-outline mb-3 is-filled">
<label for="user_form_email" class="form-label">Email</label>
<input type="email" name="{{ field_name(form.email) }}" value='{{ field_value(form.email) }}' class="form-control" required="required"/>
</div>
<div class='input-group input-group-outline mb-3 is-filled'>
<label for='user_form_job' class='form-label'>Job</label>
<select name='{{ field_name(form.job) }}' id='user_form_job' class='form-control'>
<option value=''></option>
{% for j in enum('App\\Enums\\JobType').cases() %}
{% set selected = (j.value == data.job.value) %}
<option value='{{ j.value }}' {% if selected %} selected="true" {% endif %}>{{ j.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3 is-filled'>
<label for='user_form_level' class='form-label'>Level</label>
<select name='{{ field_name(form.level) }}' id='user_form_level' class='form-control'>
<option value=''></option>
{% for l in enum('App\\Enums\\CaseLevel').cases() %}
{% set selected = (l.value == data.level.value) %}
<option value='{{ l.value }}' {% if selected %} selected="true" {% endif %}>{{ l.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3 is-filled'>
<label for='user_form_rateType' class='form-label'>Rate Type</label>
<select name='{{ field_name(form.rateType) }}' id='user_form_rateType' class='form-control'>
<option value=''></option>
{% for rt in enum('App\\Enums\\RateType').cases() %}
{% set selected = (rt.value == data.rateType.value) %}
<option value='{{ rt.value }}' {% if selected %} selected="true" {% endif %}>{{ rt.name }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3 is-filled'>
<label for='user_form_rate' class='form-label'>Rate</label>
<input type='number' name='{{ field_name(form.rate) }}' id='user_form_rate' class='form-control' value='{{ data.rate }}' min='0' step='0.01'/>
</div>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Save</button>
</div>
{{ form_end(form) }}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
{% endblock %}

View File

@ -0,0 +1,73 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
<div class="container-fluid py-2">
<div class="row">
<div class="col-12">
<div class="card my-4">
<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
<div class="bg-gradient-dark shadow-dark border-radius-lg pt-4 pb-3">
<h6 class="text-white text-capitalize ps-3">User List</h6>
</div>
</div>
<div class="card-body px-0 pb-2">
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
<thead>
<tr>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Name</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Job</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Active Cases</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Supervisor</th>
<th class="text-secondary opacity-7"></th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>
<div class='d-flex px-2 py-1'>
<div>
<img src='' class='avatar avatar-sm me-3 border-radius-large' alt='{{ user.name }}'>
</div>
<div class='d-flex flex-column justify-content-center'>
<h6 class='mb-0 text-small'>{{ user.name }}</h6>
<p class='text-xs text-secondary mb-0'>
<a href='mailto:{{ user.email }}'>{{ user.email }}</a>
</p>
</div>
</div>
</td>
<td>
<p class='text-xs font-weight-bold mb-0'>{{ user.job.value|lower|capitalize }}</p>
</td>
<td class='align-middle text-center text-xs'>
{{ user.userCases|length }}
</td>
<td class='align-middle text-center text-xs'>
{% if user.supervisor %}
{{ user.supervisor.name }}
{% endif %}
</td>
<td class='align-middle'>
<a href='/index.php/edit-user/{{ user.id }}' class='text-secondary font-weight-bold text-xs' data-toggle='tooltip' data-original-title='Edit user'>Edit</a>
&nbsp;&nbsp;
<a href='/index.php/assign-supervisor/{{ user.id }}' class='text-secondary text-xs' data-toggle='tooltip' data-original-title='Assign supervisor'>Assign</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</main>
{% endblock %}