mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Remove old list for person document
This commit is contained in:
parent
40af1e64ac
commit
e9fdabf931
@ -45,10 +45,6 @@ class DocumentPersonController extends AbstractController
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
|
||||
|
||||
/**
|
||||
* DocumentPersonController constructor.
|
||||
*/
|
||||
@ -56,14 +52,10 @@ class DocumentPersonController extends AbstractController
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +80,7 @@ class DocumentPersonController extends AbstractController
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
@ -160,45 +152,6 @@ class DocumentPersonController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="person_document_index", methods="GET")
|
||||
*/
|
||||
public function index(Person $person): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
|
||||
$pagination = $this->paginatorFactory->create($total);
|
||||
|
||||
$documents = $this->personDocumentACLAwareRepository->findByPerson(
|
||||
$person,
|
||||
['date' => 'DESC', 'id' => 'DESC'],
|
||||
$pagination->getItemsPerPage(),
|
||||
$pagination->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => PersonDocument::class,
|
||||
'action' => 'index',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render(
|
||||
'ChillDocStoreBundle:PersonDocument:index.html.twig',
|
||||
[
|
||||
'documents' => $documents,
|
||||
'person' => $person,
|
||||
'pagination' => $pagination,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="person_document_new", methods="GET|POST")
|
||||
*/
|
||||
@ -233,7 +186,7 @@ class DocumentPersonController extends AbstractController
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('The document is successfully registered'));
|
||||
|
||||
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
|
@ -80,9 +80,9 @@ final class MenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
if ($this->security->isGranted(PersonDocumentVoter::SEE, $person)) {
|
||||
$menu->addChild($this->translator->trans('Documents'), [
|
||||
'route' => 'person_document_index',
|
||||
'route' => 'chill_docstore_generic-doc_by-person_index',
|
||||
'routeParameters' => [
|
||||
'person' => $person->getId(),
|
||||
'id' => $person->getId(),
|
||||
],
|
||||
])
|
||||
->setExtras([
|
||||
|
@ -36,8 +36,8 @@
|
||||
'title' : 'Delete document ?'|trans,
|
||||
'display_content' : block('docdescription'),
|
||||
'confirm_question' : 'Are you sure you want to remove this document ?'|trans,
|
||||
'cancel_route' : 'person_document_index',
|
||||
'cancel_parameters' : {'person' : person.id, 'id': document.id},
|
||||
'cancel_route' : 'chill_docstore_generic-doc_by-person_index',
|
||||
'cancel_parameters' : {'id' : person.id},
|
||||
'form' : delete_form
|
||||
} ) }}
|
||||
{% endblock %}
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_return_path_or('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-person_index', {'id': person.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -1,72 +0,0 @@
|
||||
{#
|
||||
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||
|
||||
{% block title %}
|
||||
{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
||||
{{ encore_entry_script_tags('mod_document_action_buttons_group') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
||||
{{ encore_entry_link_tags('mod_entity_workflow_pick') }}
|
||||
{{ encore_entry_link_tags('mod_document_action_buttons_group') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="col-md-10 col-xxl">
|
||||
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
||||
|
||||
{% if documents|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||
{% else %}
|
||||
<div class="flex-table chill-task-list">
|
||||
{% for document in documents %}
|
||||
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ chill_pagination(pagination) }}
|
||||
|
||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\Person" data-entity-id="{{ person.id }}"></div>
|
||||
|
||||
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="create">
|
||||
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Create new document' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
@ -42,7 +42,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_return_path_or('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-person_index', {'id': person.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||
<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-person_index', {'id': person.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user