Fibinger Ádám
2020-06-04 ffa7c6f5c007dfc826aef0ca27d23bb69bbeed7e
templates/admin/modules/overlay.twig
@@ -1,76 +1,127 @@
{% extends "admin/site-base.twig" %}
{% block body %}
    <h1 class="display-4">Mérkőzés overlay</h1>
   <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"/>
    <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 class="col-md-8 mb-3">
               <label for="bestof">Win condition</label>
               <select name="stripe[cup][bestof]" class="form-control" id="bestof">
                  <option value="1" {{ stripe.cup.bestof == 1 ? "selected='selected'" }}>Best Of 1</option>
                  <option value="3" {{ stripe.cup.bestof == 3 ? "selected='selected'" }}>Best Of 3</option>
                  <option value="5" {{ stripe.cup.bestof == 5 ? "selected='selected'" }}>Best Of 5</option>
               </select>
            </div>
         </div>
        <div class="form-group">
            <div class="form-row">
                <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 class="col-md-2 mb-3">
                    <label for="validationServer02">Kupa sorszám</label>
                    <input type="text" name="stripe[cup][number]" class="form-control" id="validationServer02"
                           placeholder="Pld.: #654"
                           value="{{ stripe.cup.number }}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="form-row">
                <div class="form-group bg-primary">
                    {% include 'admin/modules/team-list-select.twig' %}
                    <div class="col-md-12 mb-4">
                        <label for="team_blue_name" class="bg-primary">Kék csapat neve</label>
                        <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 }}" required>
                    </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">
                    {% include 'admin/modules/team-list-select.twig' %}
                    <div class="col-md-12 mb-4">
                        <label for="team_orange_name">Narancs csapat neve</label>
                        <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 }}" required>
                    </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>
        <div class="form-group">
            <button class="btn btn-primary mx-auto" type="submit">Overlay felülírása</button>
        </div>
    </form>
      </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>
                  <label>
                     <input type="checkbox" id="checkbox_p_b3" name="stripe[team][blue][score][2]"
                           value="true" {{ stripe.team.blue.score[2] ? "checked" }}>Map 3
                  </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>
    <iframe src="/overlays/team-ban-refresh.html" width="100%"></iframe>
                  <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>
                  <label>
                     <input type="checkbox" id="checkbox_po_3" name="stripe[team][orange][score][2]"
                           value="true" {{ stripe.team.orange.score[2] ? "checked" }}>
                     Map 3
                  </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">
   {{ parent() }}
   <script type="text/javascript">
        $('.operators').chosen(
            {
                'placeholder_text_multiple': 'Banolt operátorok',
@@ -78,13 +129,18 @@
            }
        );
        $('.teamname').chosen().on('change',function (event) {
            $(this).parent().children().find('input.team')[0].value = event.target.value;
        $('.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');
            swapCheckboxValues(document.getElementById('checkbox_p_b1'), document.getElementById('checkbox_po_1'));
            swapCheckboxValues(document.getElementById('checkbox_p_b2'), document.getElementById('checkbox_po_2'));
            swapCheckboxValues(document.getElementById('checkbox_p_b3'), document.getElementById('checkbox_po_3'));
            var blue_name = blue.value;
            blue.value = orange.value;
@@ -93,5 +149,11 @@
            return false;
        }
    </script>
        function swapCheckboxValues(objectOne, objectTwo) {
            var tempValue = $(objectOne).prop("checked");
            $(objectOne).prop("checked", $(objectTwo).prop("checked"));
            $(objectTwo).prop("checked", tempValue);
        }
   </script>
{% endblock %}