Skip to content

Commit

Permalink
changed static links on dynamic ones; made one common menu in base te…
Browse files Browse the repository at this point in the history
…mplate
  • Loading branch information
msalakhov-smartorange committed Mar 22, 2022
1 parent da2f83f commit e1cb375
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 229 deletions.
24 changes: 17 additions & 7 deletions app/src/Controller/ClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class ClientController extends AbstractController
{
#[Route('/', name: 'client')]
#[Route('/', name: 'homepage')]
public function index(UserInterface $user, ClientRepository $clientRepository)
{
if (in_array('ADMIN', $user->getRoles())) {
Expand Down Expand Up @@ -87,6 +87,7 @@ public function create(UserInterface $user, Request $request): Response
return $this->render('client/create.html.twig', [
'controller_name' => 'ClientController',
'clientForm' => $form->createView(),
'title' => 'Create new client'
]);
}

Expand Down Expand Up @@ -161,6 +162,7 @@ public function edit(Request $request, $id, UserInterface $user): Response
return $this->render('client/edit.html.twig', [
'controller_name' => 'ClientController',
'clientForm' => $form->createView(),
'title' => 'Client editing'
]);
}

Expand Down Expand Up @@ -227,7 +229,8 @@ public function addInsurance($id, ClientRepository $clientRepository, UserInterf
}

return $this->render('client/add-insurance.html.twig', [
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance"
]);
}

Expand Down Expand Up @@ -259,7 +262,8 @@ public function addInsuranceHome(Request $request, $id, ClientRepository $client
return $this->render('client/add-insurance-item.html.twig', [
'controller_name' => 'ClientController',
'addInsuranceForm' => $form->createView(),
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance | Home"
]);
}

Expand Down Expand Up @@ -291,7 +295,8 @@ public function addInsuranceAuto(Request $request, $id, ClientRepository $client
return $this->render('client/add-insurance-item.html.twig', [
'controller_name' => 'ClientController',
'addInsuranceForm' => $form->createView(),
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance | Auto"
]);
}

Expand Down Expand Up @@ -323,7 +328,8 @@ public function addInsuranceColl(Request $request, $id, ClientRepository $client
return $this->render('client/add-insurance-item.html.twig', [
'controller_name' => 'ClientController',
'addInsuranceForm' => $form->createView(),
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance | Collectibles"
]);
}

Expand Down Expand Up @@ -355,7 +361,8 @@ public function addInsuranceUmbrella(Request $request, $id, ClientRepository $cl
return $this->render('client/add-insurance-item.html.twig', [
'controller_name' => 'ClientController',
'addInsuranceForm' => $form->createView(),
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance | Umbrella"
]);
}

Expand Down Expand Up @@ -387,7 +394,8 @@ public function addInsuranceOther(Request $request, $id, ClientRepository $clien
return $this->render('client/add-insurance-item.html.twig', [
'controller_name' => 'ClientController',
'addInsuranceForm' => $form->createView(),
'clientId' => $id
'clientId' => $id,
'title' => "Add client's insurance | Other"
]);
}

Expand Down Expand Up @@ -505,6 +513,7 @@ public function uploadIns(Request $request, $id, $insId, ClientRepository $clien
return $this->render('client/insurance-upload-file.html.twig', [
'controller_name' => 'ClientController',
'attachmentForm' => $form->createView(),
'title' => 'Attach insurance file'
]);
}

Expand Down Expand Up @@ -593,6 +602,7 @@ public function upload(Request $request, $id, ClientRepository $clientRepository
return $this->render('client/upload-file.html.twig', [
'controller_name' => 'ClientController',
'attachmentForm' => $form->createView(),
'title' => "Upload client's files"
]);
}
}
71 changes: 48 additions & 23 deletions app/templates/base.html.twig
Original file line number Diff line number Diff line change
@@ -1,30 +1,55 @@
<!DOCTYPE html>
<html class="h-100">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>{% block title %}Welcome!{% endblock %}</title>
{# Run `composer require symfony/webpack-encore-bundle`
and uncomment the following Encore helpers to start using Symfony UX #}
{% block stylesheets %}
{#{{ encore_entry_link_tags('app') }}#}
{% endblock %}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>
{% block title %}Welcome!
{% endblock %}
</title>
{# Run `composer require symfony/webpack-encore-bundle`
and uncomment the following Encore helpers to start using Symfony UX #}
{% block stylesheets %}
{#{{ encore_entry_link_tags('app') }}#}
{% endblock %}

{% block javascripts %}
{#{{ encore_entry_script_tags('app') }}#}
{% endblock %}
</head>
<body class="h-100" style="background-color: #ecf3fd;">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
{% block body %}{% endblock %}
{% block javascripts %}
{#{{ encore_entry_script_tags('app') }}#}
{% endblock %}
</head>
<body class="h-100" style="background-color: #ecf3fd;">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

<script>
document.addEventListener('DOMContentLoaded', function() {
<header>
<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>
</div>
</div>
{% endif %}
{% if app.request.attributes.get('_route') != "homepage" %}
<ul class="nav nav-tabs mt-5">
{% block breadcrumb %}
<li class="nav-item">
<a class="nav-link" href="{{ path('homepage') }}">Home</a>
</li>
{% endblock %}
</ul>
{% endif %}
</div>
</header>

{% block body %}{% endblock %}

<script>
document.addEventListener('DOMContentLoaded', function () {
bsCustomFileInput.init();
});
</script>
</body>
</script>
</body>
</html>
32 changes: 11 additions & 21 deletions app/templates/client/add-insurance-item.html.twig
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
{% extends 'base.html.twig' %}

{% block title %}Creating insurance object{% endblock %}
{% block title %}{{ title }}{% endblock %}

{% block breadcrumb %}
<li class="nav-item">
<a class="nav-link" href="/client/{{ clientId }}">Back</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">{{ title }}</a>
</li>
{% endblock %}

{% block body %}

<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>
</div>
</div>
{% endif %}
<ul class="nav nav-tabs mt-5">
<li class="nav-item">
<a class="nav-link" href="/">Main</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/client/{{ clientId }}">Back</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">Home</a>
</li>
</ul>
<br>
<h1 class="text-center">New insurance object</h1>
<h1 class="text-center">{{ title }}</h1>
<br>
<div class="row justify-content-md-center">
<div class="col-md-6">
Expand Down
31 changes: 12 additions & 19 deletions app/templates/client/add-insurance.html.twig
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{% extends 'base.html.twig' %}

{% block title %}Creating insurance object{% endblock %}
{% block title %}{{ title }}{% endblock %}

{% block breadcrumb %}
{{ parent() }}
<li class="nav-item">
<a class="nav-link" href="/client/{{ clientId }}">Back</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">{{ title }}</a>
</li>
{% endblock %}

{% block body %}

<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>
</div>
</div>
{% endif %}
<ul class="nav nav-tabs mt-5">
<li class="nav-item">
<a class="nav-link" href="/">Main</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/client/{{ clientId }}">Back</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">New insurance object</a>
</li>
</ul>

<br>
<br>
<div class="row justify-content-md-center">
Expand Down
39 changes: 16 additions & 23 deletions app/templates/client/create.html.twig
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
{% extends 'base.html.twig' %}

{% block title %}Hello ClientController!{% endblock %}
{% block title %}
{{ title }}
{% endblock %}

{% block body %}
{% block breadcrumb %}
{{ parent() }}
<li class="nav-item">
<a class="nav-link active" href="#">{{ title }}</a>
</li>
{% endblock %}

<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>
{% block body %}
<div class="container">
<h1 class="text-center mt-4">{{ title }}</h1>
<div class="row justify-content-md-center">
<div class="col-md-6">
{{ form(clientForm) }}
</div>
</div>
{% endif %}
<ul class="nav nav-tabs mt-5">
<li class="nav-item">
<a class="nav-link" href="/">Main</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">Creating client</a>
</li>
</ul>
<h1 class="text-center mt-4">Creating client</h1>
<div class="row justify-content-md-center">
<div class="col-md-6">
{{ form(clientForm) }}
</div>
</div>
</div>
{% endblock %}
{% endblock %}
39 changes: 17 additions & 22 deletions app/templates/client/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
{% extends 'base.html.twig' %}

{% block title %}Hello ClientController!{% endblock %}
{% block title %}
{{ title }}
{% endblock %}

{% block breadcrumb %}
{{ parent() }}
<li class="nav-item">
<a class="nav-link active" href="#">{{ title }}</a>
</li>
{% endblock %}

{% block body %}
<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>

<div class="container">
<h1 class="text-center mt-4">{{ title }}</h1>
<div class="row justify-content-md-center">
<div class="col-md-6">
{{ form(clientForm) }}
</div>
</div>
{% endif %}
<ul class="nav nav-tabs mt-5">
<li class="nav-item">
<a class="nav-link" href="/">Main</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">Editing client</a>
</li>
</ul>
<h1 class="text-center mt-4">Editing client</h1>
<div class="row justify-content-md-center">
<div class="col-md-6">
{{ form(clientForm) }}
</div>
</div>
</div>
{% endblock %}
{% endblock %}
7 changes: 0 additions & 7 deletions app/templates/client/editInsurance.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
{% block body %}

<div class="container">
{% if app.user %}
<div class="row justify-content-end">
<div class="p-2 border-bottom">
<a href="{{ path('app_logout') }}">logout</a>
</div>
</div>
{% endif %}
<ul class="nav nav-tabs mt-5">
<li class="nav-item">
<a class="nav-link" href="/">Main</a>
Expand Down
Loading

0 comments on commit e1cb375

Please sign in to comment.