Jacek Kowalski
4 hours ago 6b9278a5d57091fce636dbb640b380cfb990db6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{% extends 'base.html.twig' %}
 
{% block title %}{{ book.title }}{% endblock %}
 
{% block content %}
    <div class="page_content">
        <h2>{{ book.title }}</h2>
 
        <div class="columns">
            <div class="column col-7 col-md-12">
                {% embed 'book/_details.html.twig' %}
                    {% block footer %}
                        <div class="panel-footer">
                            <a class="btn"
                               href="{{ path('book_edit', {id: book.id}) }}">{% trans %}book_action_edit{% endtrans %}</a>
                        </div>
                    {% endblock %}
                {% endembed %}
 
                {{ include('book/_history.html.twig', {history: book.borrowHistory}) }}
            </div>
            <div class="column col-5 col-md-12">
                <div class="panel book-panel">
                    <div class="panel-header">
                        <div class="panel-title h5">{% trans %}cover_section_title{% endtrans %}</div>
                    </div>
                    {% if book.cover %}
                        <div class="panel-body">
                            {{ include('book/_cover.html.twig') }}
                            <form action="{{ path('cover_remove', {id: book.id}) }}" method="post">
                                <input type="hidden" name="_token" value="{{ csrf_token('remove-cover' ~ book.id) }}"/>
                                <button class="btn btn-link btn-sm">{% trans %}cover_action_remove{% endtrans %}</button>
                            </form>
                        </div>
                    {% endif %}
                    <div class="panel-footer">
                        {{ form(cover_form) }}
                    </div>
                </div>
 
                <div class="panel book-panel">
                    <div class="panel-header">
                        <div class="panel-title h5">{% trans %}borrow_section_title{% endtrans %}</div>
                    </div>
                    {% if book.borrow %}
                        <div class="panel-body">
                            <p>{{ 'borrow_lent_to'|trans({'%who%': book.borrow.who, '%date%': book.borrow.at|date('Y-m-d')}) }}</p>
                        </div>
                        <div class="panel-footer">
                            <form action="{{ path('book_return', {id: book.id}) }}" method="post">
                                <input type="hidden" name="_token" value="{{ csrf_token('return' ~ book.id) }}"/>
                                <button class="btn btn-primary">{% trans %}borrow_action_return{% endtrans %}</button>
                            </form>
                        </div>
                    {% else %}
                        <div class="panel-footer">
                            {{ form(borrow_form) }}
                        </div>
                    {% endif %}
                </div>
 
                <div class="panel book-panel">
                    <div class="panel-header">
                        <div class="panel-title h5">{% trans %}menu_labels{% endtrans %}</div>
                    </div>
                    {% if book.labels is not empty %}
                        <div class="panel-body">
                            <ul class="book-labels">
                                {% for label in book.labels %}
                                    <li>
                                        {% if label.type.value == 'text' %}
                                            <span class="label label-rounded">{{ label.label }}</span>
                                        {% else %}
                                            <span class="label label-rounded">{{ ('label_type_' ~ label.type.value)|trans }}: {{ label.label }}</span>
                                        {% endif %}
                                        <form class="inline" action="{{ path('label_remove', {id: label.id}) }}"
                                              method="post">
                                            <input type="hidden" name="_token"
                                                   value="{{ csrf_token('remove-label' ~ label.id) }}"/>
                                            <button class="btn btn-link btn-sm">{% trans %}label_action_remove{% endtrans %}</button>
                                        </form>
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                    {% endif %}
                    <div class="panel-footer">
                        {{ form(label_form) }}
                    </div>
                </div>
 
                {% if not book.borrowed %}
                    <div class="panel book-panel">
                        <div class="panel-header">
                            <div class="panel-title h5">{% trans %}ousted_section_title{% endtrans %}</div>
                            <div class="panel-subtitle text-gray">{% trans %}ousted_section_desc{% endtrans %}</div>
                        </div>
                        <div class="panel-footer">
                            {{ form(oust_form) }}
                        </div>
                    </div>
                {% endif %}
            </div>
        </div>
    </div>
{% endblock %}