{% include 'header.twig' %}
<br><Br><br><Br><br><Br>
<div id="content-wrap">
    
        <div class="section">
           
          <div class="container collapse-view ">
             <div class="well">
    {% if error %}
      <div class="alert alert-dismissible alert-danger">
          <button type="button" class="close" data-dismiss="alert">&times;</button>
        {{ errorText }}
      </div>
    {% endif %}  

    {% if data["childpanel"]["success"] == 1 %}
      <div class="alert alert-dismissible alert-success">
          <strong> Order Id: </strong> {{ data['childpanel']['id'] }} <br>
          <strong> Service: </strong> {{ data['childpanel']['service'] }} <br>
          <strong> Domain: </strong> {{ data['childpanel']['link'] }} <br>
          <strong> Quantity: </strong> {{ data['childpanel']['quantity'] }} <br>
          <strong> Charge: </strong> {{ data['childpanel']['price'] }} <br>
      </div>
    {% endif %}
    
    {% if data["childpanel"]["success"] == 2 %}
      <div class="alert alert-dismissible alert-success">
          <strong> Order Id: </strong> {{ data['childpanel']['id'] }} <br>
          <strong> Child Panel Renewed Successfully</strong>
      </div>
    {% endif %}

<div class="account-info wrapper-box">
  <div class="button-bar">
      <button id="tab-add-btn" onclick="payment()" class="btn btn-primary">Order Child Panel</button>
      <button id="tab-history-btn" onclick="detail()" class="btn btn-primary">CHECK HISTORY</button>
   </div>
  <br>
  <br>
  <div class="row">
        <div class="col-lg-12 tab-content" id="tab-add">
            
            <div class="alert alert-info">
    <p style="margin-bottom: 5px">Please visit your registrar's dashboard to change nameservers to:</p>
                              <ul style="padding-left: 20px">
                                  <li>{{ site['ns1'] }}</li>
                                  <li>{{ site['ns2'] }}</li>
                              </ul>
  </div>

  <form action="/child-panels" method="post">

    <div class="row">
      <div class="col-sm-6"><input type="link" class="form-control" id="domain" name="domain" value="" placeholder="DOMAIN"></div>
      <div class="col-sm-6">
        <select class="form-control" id="createorderform-currency" name="currency">
                      <option value="USD" >
              United States Dollars (USD)
            </option>
                      <option value="INR" >
              Indian Rupee (INR)
            </option>

                  </select>
      </div>
      <Br>
      <div class="col-sm-6"><input type="text" class="form-control" id="createorderform-username" name="username" value="" placeholder="ADMIN USERNAME"></div><Br>
      <div class="col-sm-6"><input type="password" class="form-control" id="createorderform-password" name="password" placeholder="ADMIN PASSWORD"></div><Br>
      <div class="col-sm-12">
        <div class="label-text"><input type="password" class="form-control" id="createorderform-password_confirm" name="password_confirm" placeholder="CONFIRM PASSWORD"> <br> <Br><span class="alert alert-info" id="price">CHARGE {% if settings['site_currency'] == "TRY" %}{{ "&#8378;" }}
                {% elseif settings['site_currency'] == "USD" %}{{ "&#36;" }}
                {% else %}{{ "₹" }}
                {% endif %}{{ site['childpanel_price'] }}</span><br><br></div>
      </div>
      <div class="col-md-12"><button type="submit" class="btn btn-primary btn-block btn-shadow"><strong>SUBMIT</strong> NOW</button></div>
  </div>
  </form>
  </div>
  
     <div class="col-lg-12 tab-content" id="tab-history" style="display: none;">
      <div class="">
        <div class="">
          
          <div class="">
              <div class="table-responsive custom-table">
            <table class="table ">
              <thead>
            <tr>
              <th>#</th>
              <th>Domain</th>
              <th>Currency</th>
              <th class="width-40">Username</th>
              <th>Password</th>
              <th class="nowrap">Date</th>
              <th class="nowrap">Status</th>
            </tr>
          </thead>
          <tbody>

            {% for logs in chilpanel_logs %}
              <tr>
                <td>{{ logs['id'] }}</td>
                <td>{{ logs['domain'] }}</td>
                <td>{{ logs['currency'] }}</td>
                <td class="width-40">{{ logs['child_username'] }}</td>
                <td>{{ logs['child_password'] }}</td>
                <td class="nowrap">{{ logs['date_created'] }}</td>
                <td class="nowrap">
                {% if logs['status'] == "terminated" %}<form action="/child-panels" method="post"><input name="renew_id" type="hidden" value="{{ logs['id'] }}"/><input type="submit" name="renew" class="btn btn-primary" value="Renew"></form>
                {% elseif logs['status'] == "active" %}<button class="btn btn-primary">Active</button>
                {% else %}<button class="btn btn-secondary">Disabled</button>
                {% endif %}
                </td>
              </tr>
            {% endfor %}

          </tbody>
        </table>
      </div>

    </div>
  </div>
</div>

<br><Br><Br>
  
          </div>
        </div>
      </div>
                </div>
        </div>
        </div>
      </div>
      
<script>
    function detail(){
        document.getElementById('tab-add').style.display = 'none';
        document.getElementById('tab-add-btn').className = 'btn btn-secondary tab-head';
        document.getElementById('tab-history').style.display = 'block';
        document.getElementById('tab-history-btn').className = 'btn btn-primary tab-head ml-2';
    }
    
    function payment(){
        document.getElementById('tab-history').style.display = 'none';
        document.getElementById('tab-history-btn').className = 'btn btn-secondary tab-head ml-2';
        document.getElementById('tab-add').style.display = 'block';
        document.getElementById('tab-add-btn').className = 'btn btn-primary tab-head';
    }
</script>
{% include 'footer.twig' %}