Fibinger Ádám
2020-06-04 acb792c92398ed0dd9b45a0a3007c4747de2eba7
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{% extends "admin/site-base.twig" %}
{% block body %}
    <h1 class="display-4">Mérkőzés overlay</h1>
    <form action="/generator/form.php" method="post">
        <input type="hidden" name="stripe[class]" value="team-ban"/>
 
        <div class="form-group">
            <div class="form-row">
                <div class="col-md-2 mb-3">
                    <label for="validationServer02">Első vastagon szedett sor</label>
                    <input type="text" name="stripe[cup][number]" class="form-control" id="validationServer02"
                           placeholder="Pld.: #654"
                           value="{{ stripe.cup.number }}">
                </div>
                <div class="col-md-8 mb-3">
                    <label for="validationServer01">Kupa neve</label>
                    <input type="text" name="stripe[cup][name]" class="form-control" id="validationServer01"
                           placeholder="Pld.: 5on5 Bomb Cup" value="{{ stripe.cup.name }}">
                </div>
            </div>
        </div>
        <div class="form-row">
            <div class="form-group bg-primary">
                <div class="col-md-12 mb-4">
                    {% include 'admin/modules/team-list-select.twig'  with {'target': 'team_blue_name'} %}
                </div>
                <div class="col-md-12 mb-4">
                    <div class="form-group">
                        <label>Kék csapat neve
                            <input type="text" name="stripe[team][blue][name]" class="form-control team"
                                   id="team_blue_name"
                                   placeholder="Pld.: Impress!ve" value="{{ stripe.team.blue.name }}">
                        </label>
                    </div>
                    <div class="form-group">
                        <label>
                            <input type="checkbox" id="checkbox_p_b1" name="stripe[team][blue][score][0]"
                                   value="true" {{ stripe.team.blue.score[0] ? "checked" }}>Map 1</label>
                        <label>
                            <input type="checkbox" id="checkbox_p_b2" name="stripe[team][blue][score][1]"
                                   value="true" {{ stripe.team.blue.score[1] ? "checked" }}>Map 2</label>
                    </div>
                </div>
                <div class="col-md-12 mb-4">
                    <label for="op-blue" class="bg-primary">Banolt operátorok</label>
                    <select name="stripe[team][blue][ban][]" class="operators" id="op-blue" style="width: 100%"
                            multiple>
                        {% for operator in operators %}
                            <option value="{{ operator }}" {{ operator in stripe.team.blue.ban ? "selected" }}>{{ operator|capitalize }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <button class="btn btn-info" title="Csapat színcsere" onclick="swapTeams(); return false;"><=>
                </button>
            </div>
            <div class="form-group bg-warning">
                <div class="col-md-12 mb-4">
                    {% include 'admin/modules/team-list-select.twig'  with {'target': 'team_orange_name'} %}
                </div>
                <div class="col-md-12 mb-4">
                    <div class="form-group">
                        <label>Narancs csapat neve
                            <input type="text" name="stripe[team][orange][name]" class="form-control team"
                                   id="team_orange_name"
                                   placeholder="Pld.: Opress!ve" value="{{ stripe.team.orange.name }}">
                        </label>
                    </div>
                    <div class="form-group">
                        <label>
                            <input type="checkbox" id="checkbox_po_1" name="stripe[team][orange][score][0]"
                                   value="true" {{ stripe.team.orange.score[0] ? "checked" }}>
                            Map 1
                        </label>
 
                        <label>
                            <input type="checkbox" id="checkbox_po_2" name="stripe[team][orange][score][1]"
                                   value="true" {{ stripe.team.orange.score[1] ? "checked" }}>
                            Map 2
                        </label>
                    </div>
                </div>
                <div class="col-md-12 mb-4">
                    <label for="op-orange" class="bg-warning">Banolt operátorok</label>
                    <select name="stripe[team][orange][ban][]" class="operators" id="op-orange" style="width: 100%"
                            multiple>
                        {% for operator in operators %}
                            <option value="{{ operator }}" {{ operator in stripe.team.orange.ban ? "selected" }}>{{ operator|capitalize }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
        </div>
        <div class="form-group">
            <button class="btn btn-primary mx-auto" type="submit">Overlay felülírása</button>
        </div>
    </form>
 
    <iframe src="/overlays/team-ban-refresh.html?asdf={{ random(1, 10000000) }}" width="100%"></iframe>
{% endblock %}
{% block lazyload %}
    {{ parent() }}
    <script type="text/javascript">
        $('.operators').chosen(
            {
                'placeholder_text_multiple': 'Banolt operátorok',
                'max_selected_options': 2
            }
        );
 
        $('.teamname').chosen().on('change', function (event) {
            var target = document.getElementById($(this).data('target'));
            $(target).val(event.target.value);
        });
 
        function swapTeams() {
            var blue = document.getElementById('team_blue_name');
            var orange = document.getElementById('team_orange_name');
 
            var blueTick = [], orangeTick = [];
 
            swapCheckboxValues(document.getElementById('checkbox_p_b1'), document.getElementById('checkbox_po_1'));
            swapCheckboxValues(document.getElementById('checkbox_p_b2'), document.getElementById('checkbox_po_2'));
 
            var blue_name = blue.value;
            blue.value = orange.value;
            orange.value = blue_name;
 
            return false;
        }
 
        function swapCheckboxValues(objectOne, objectTwo) {
            var tempValue = $(objectOne).prop("checked");
            $(objectOne).prop("checked", $(objectTwo).prop("checked"));
            $(objectTwo).prop("checked", tempValue);
        }
 
    </script>
{% endblock %}