{% include 'header.twig' %}

    <div class="pagewrap">
      <!-- Main variables *content* -->
      <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

<section class="pageheadrdash">
  <div class="container-fluid">
    <div class="row align-items-center">
      <div class="col-md-10">
        <span class="breadcrum">
          <a href="/">home</a>/new order
        </span>
        <h2 class="mb-0">
          New Order
        </h2>
      </div>
      <div class="col-md-2">
        <!-- Button trigger modal -->
        <button type="button" class="btn btn-primary w-100" data-bs-toggle="modal" data-bs-target="#ordertype">
          Order Type
        </button>
      </div>
    </div>
  </div>
</section>

<div class="container-fluid">
  <div class="row">
    <!--<div class="col-md-12">
      <div class="notopheader">
        <div class="welcomeboxwrap">
          <div class="welcomebox">
            <div class="cont">
              <h1>
                Welcome to <span>AirSMM</span>
              </h1>
              <h5>We are the Best SMM Panel</h5>
              <p>
                Welcome to our AirSMM! Elevate your social media presence with our fast, reliable, and affordable services. Whether you're looking to increase followers, likes, or engagement, we're here to help you succeed.
              </p>
            </div>
          </div>
        </div>
        <div class="statboxwrap">
          <div class="statbox">
            <div class="statboxchild">
              <div class="statboxhead">
                <i class="fad fa-wallet"></i>
                <span>Total Balance</span>
              </div>
              <h5>
                $0
              </h5>
              <small>Change Currency? <a href="">Change</a></small>
            </div>
            <div class="statboxchild">
              <div class="statboxhead">
                <i class="fad fa-chart-pie"></i>
                <span>Money Spent</span>
              </div>
              <h5>
                $0
              </h5>
              <small>Want To Add Funds. <a href="/addfunds">Click Here</a></small>
            </div>
          </div>
        </div>
      </div>
    </div>-->
    <div class="col-md-12">
      <div class="contactinfoalert">
        <div class="continf blink">
          <div class="embed-responsive embed-responsive-16by9"><iframe frameborder="0" src="//www.youtube.com/embed/zVl8iq7GnKs" width="640" height="360" class="note-video-clip embed-responsive-item"></iframe></div><h2 style="text-align: center; ">How to use</h2>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="container-fluid">
  <div class="row">
    <div class="col-md-6">
      <a class="communitycard wpcomm" target="_blank" href="https://whatsapp.com/channel/0029VasmvvcId7nNUGLXyr37">
        <i class="fab fa-whatsapp"></i>
        <div>
          <p>
            To Get all latest updates
          </p>
          <h3>
            Join Our Community
          </h3>
        </div>
      </a>
    </div>
    <div class="col-md-6">
      <a class="communitycard tgcomm" target="_blank" href="#">
        <i class="fab fa-telegram-plane"></i>
        <div>
          <p>
            To Get all latest updates
          </p>
          <h3>
            Join Our Channel
          </h3>
        </div>
      </a>
    </div>
  </div>
</div>

<div class="container-fluid">
  <div class="row">
    <div class="col-md-6">
      <div class="card p-3 mb-2">
        <div class="cardwellhed">
          <i class="fad fa-cart-plus"></i>
          <h6 class="m-0">
            New Order
          </h6>
        </div>

        <label for="orderform-filters" class="form-label">Choose a Platform (Optional)</label>
        <div class="servallwrap">
          <ul class="servFiltr" id="filtrButns">
            <li>
              <button class="CatFltr active" data-change-cat="">
                <i class="fas fa-list"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr insta" data-change-cat="Instagram">
                <i class="fab fa-instagram"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr fb" data-change-cat="Facebook">
                <i class="fab fa-facebook"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr yt" data-change-cat="Youtube">
                <i class="fab fa-youtube"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr tele" data-change-cat="Telegram">
                <i class="fab fa-telegram"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr threads" data-change-cat="Thread">
                <img src="https://i.imgur.com/9Q7XGMf.png" style="max-width: 22px; filter: invert(1);">
              </button>
            </li>
            <li>
              <button class="CatFltr tweet" data-change-cat="Twitter">
                <i class="fab fa-twitter"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr spt" data-change-cat="Spotify">
                <i class="fab fa-spotify"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr sndcld" data-change-cat="Soundcloud">
                <i class="fab fa-soundcloud"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr wbst" data-change-cat="Traffic">
                <i class="fas fa-globe-europe"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr tt" data-change-cat="Tiktok">
                <i class="fab fa-tiktok"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr lnkin" data-change-cat="LinkedIn">
                <i class="fab fa-linkedin-in"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr dis" data-change-cat="Discord">
                <i class="fab fa-discord"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr pin" data-change-cat="Pinterest">
                <i class="fab fa-pinterest-p"></i>
              </button>
            </li>
            <li>
              <button class="CatFltr whatsapp" data-change-cat="Whatsapp">
                <i class="fab fa-whatsapp"></i>
              </button>
            </li>
          </ul>
          <!-- Button trigger modal -->
          <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#filtersSocial">
            View All
          </button>
        </div>

        <form  action="/" method="post" id="order-form">
          
          
          
                          {% if error %}
                     <div class="alert alert-dismissible alert-danger">
                        {{ errorText }}
                     </div>
                     {% endif %}
                     {% if data["order"]["success"] == 1 %}
      <div class="alert alert-dismissible alert-success">
          <strong> {{ lang["neworder.success.id"] }}: </strong> {{ data['order']['id'] }} <br>
          <strong> {{ lang["neworder.success.service"] }}: </strong> {{ data['order']['service'] }} <br>
          <strong> {{ lang["neworder.success.link"] }}: </strong> {{ data['order']['link'] }} <br>
          <strong> {{ lang["neworder.success.quantity"] }}: </strong> {{ data['order']['quantity'] }} <br>
          <strong> {{ lang["neworder.success.charge"] }}: </strong> {{ data['order']['price'] }} <br>
          <strong> {{ lang["neworder.success.balance"] }}: </strong>{{ data['order']['balance'] }} <br>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">✕</span></button>

      </div>
    {% endif %}
    
    
    {% if data["order"]["success"] == 2 %}
      <div class="alert alert-dismissible alert-success">
 <strong> {{ lang["neworder.success.id"] }}: </strong> {{ data['order']['id'] }} <br>
 <strong> {{ lang["neworder.success.service"] }}: </strong> {{ data['order']['service'] }} <br>
 <strong> {{ lang["neworder.success.username"] }}: </strong> {{ data['order']['link'] }} <br>
 <strong> {{ lang["neworder.success.quantity"] }}: </strong> {{ data['order']['min'] }} - {{ data['order']['max'] }} <br>
 <strong> {{ lang["neworder.success.posts"] }}: </strong> {{ data['order']['posts'] }} <br>
 <strong> {{ lang["neworder.success.delay"] }}: </strong>{{ data['order']['delay'] }} <br>
       </div>
    {% endif %}

                         
                         
                           
                         
                        <style>
#unique-dropdown{max-height: 300px;border-radius: 8px;margin-top:8px;border-left-width: 0px;border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-color: transparent;border-style: solid;box-shadow: 0 12px 24px 12px rgba(0, 0, 0, 0.2);overflow-y: auto;display: block;position: absolute;left:auto;max-width:100%;width: 94.5%;background:white;z-index: 1;}@media(min-width:776px){ #unique-dropdown{width: 93%;}}@media(min-width:991px){ #unique-dropdown{width: 92.4%;}}.selectme {padding: 3px 10px;cursor: pointer;list-style-type: none; }.selectme:hover {background-color: #f2f2f2;}.highlight {font-weight: bold; }.form-group .search-dropdown .input-wrapper .input-wrapper__prepend, .form-group .search-dropdown .input-wrapper .input-wrapper__append {position: absolute;background: none;border: none;top: 50%;transform: translateY(-50%);padding: 0px 15px;color: var(--form_group_icon_color);}.form-group .search-dropdown .input-wrapper .input-wrapper__prepend:hover, .form-group .search-dropdown .input-wrapper .input-wrapper__append:hover {opacity: 0.5;}.form-group .search-dropdown .input-wrapper .input-wrapper__prepend:hover, .form-group .search-dropdown .input-wrapper .input-wrapper__append:focus {outline:none;}.form-group .search-dropdown .input-wrapper .input-wrapper__append {font-size: 12px;right: 3px;display: none;}
</style>


 <div class="form-group">
        <div class="search-dropdown" id="new-order-search" style="position: relative;" data-lang-placeholder="Search">
            <div class="input-wrapper" style="position: relative;">
                <button style="margin-left:-11px" type="button" class="input-wrapper__prepend" onclick="focusInputField()"><span class="fas fa-search"></span></button>
             <input style="padding-left:41px" type="text" class="form-control" id="unique-input" value="" placeholder="Search">
             <button type="button" class="input-wrapper__append" onclick="clearInput()"><span class="fas fa-times"></span></button>
            </div>
        </div>
        <div class="search-results" id="unique-dropdown" style="display: none;"></div>
    </div> 
                         
                    <div class="mb-3">
                 <label for="orderform-category" class="control-label">Category</label>
                     
<select class="form-control" id="neworder_category" name="categories" data-select="true" data-select-search="true" data-select-search-placeholder="Search" data-select-container="#select-category-container" tabindex="-1" aria-hidden="true">
{{ category_html_simplify }}

</select>
<div id="select-category-container" class="position-relative"></div>
</div>
                                     
                      
                              <div class="mb-3">
                                 <label for="orderform-service" class="control-label">Service</label>
                                 	<select class="form-control" id="neworder_services" name="services" data-select="true" data-select-search="true" data-select-search-placeholder="Search" data-select-container="#select-service-container" tabindex="-1" aria-hidden="true">
<option value="1">No services found in this category</option>
</select>
<div id="select-service-container" class="position-relative"></div>
    </div>
            
            
            
                      <div id="neworder_fields"></div>
           <div class="mb-3">
                                 <label for="charge" class="control-label">Charge</label>
                                 <input type="text" class="form-control" id="charge" value="" readonly>
                              </div>
          
          <input type="hidden" name="_csrf" value="2sw_CkAszlYR5_U-bHB-q4dSqdsCLTSisz6ZknV5WgqW_llIDGODZWiOvHhZBSbSwzXuklVeQZLmas3zHRtpcA==">
          <button type="submit" class="btn btn-primary">Submit</button>
        </form>
      </div>
    </div>
    <div class="col-md-6">
      <div class="card p-3">
        <div class="cardwellhed">
          <i class="fad fa-newspaper"></i>
          <h6 class="m-0">
            Service Updates
          </h6>
        </div>
        <div id="ajaxUpdt">

        </div>
        <script>
          $(document).ready(function() {
            // Use jQuery to perform an AJAX request
            $.ajax({
              url: '/updates', // The URL of the page where the content is located
              success: function(response) {
                // Use jQuery to find the content inside the div with id servTabajax in the response
                var content = $(response).find('#updtParent').html();
                // Place the content inside the div with id ajaxUpdt
                $('#ajaxUpdt').html(content);
              },
              error: function(xhr, status, error) {
                console.error("An error occurred: " + status + " - " + error);
              }
            });
          });
        </script>
      </div>
    </div>
  </div>
</div>

<!--<div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="well ">
        <div class="embed-responsive embed-responsive-16by9"><iframe frameborder="0" src="//www.youtube.com/embed/zVl8iq7GnKs" width="640" height="360" class="note-video-clip embed-responsive-item"></iframe></div><h2 style="text-align: center; ">How to use</h2>
      </div>
    </div>
  </div>
</div>
-->


<!-- Modals -->
<div class="modal fade" id="filtersSocial" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-6" id="exampleModalLabel">Select a Platform</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <!-- Search Bar -->
        <div class="input-group mb-3">
          <input type="text" class="form-control" id="searchInput" placeholder="Search platform...">
        </div>

        <!-- List of Buttons -->
        <ul class="list-unstyled d-flex flex-wrap gap-2 mb-0">
          <li>
            <button class="CatFltr active" data-change-cat="" onclick="selectOption(this)">
              <i class="fas fa-list"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr insta" data-change-cat="Instagram" onclick="selectOption(this)">
              <i class="fab fa-instagram"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr threads" data-change-cat="Thread" onclick="selectOption(this)">
              <img src="https://i.imgur.com/9Q7XGMf.png" style="max-width: 22px; filter: invert(1);">
            </button>
          </li>
          <li>
            <button class="CatFltr fb" data-change-cat="Facebook" onclick="selectOption(this)">
              <i class="fab fa-facebook"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr tweet" data-change-cat="Twitter" onclick="selectOption(this)">
              <i class="fab fa-twitter"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr yt" data-change-cat="Youtube" onclick="selectOption(this)">
              <i class="fab fa-youtube"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr spt" data-change-cat="Spotify" onclick="selectOption(this)">
              <i class="fab fa-spotify"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr sndcld" data-change-cat="Soundcloud" onclick="selectOption(this)">
              <i class="fab fa-soundcloud"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr wbst" data-change-cat="Traffic" onclick="selectOption(this)">
              <i class="fas fa-globe-europe"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr tt" data-change-cat="Tiktok" onclick="selectOption(this)">
              <i class="fab fa-tiktok"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr tele" data-change-cat="Telegram" onclick="selectOption(this)">
              <i class="fab fa-telegram"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr lnkin" data-change-cat="LinkedIn" onclick="selectOption(this)">
              <i class="fab fa-linkedin-in"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr dis" data-change-cat="Discord" onclick="selectOption(this)">
              <i class="fab fa-discord"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr pin" data-change-cat="Pinterest" onclick="selectOption(this)">
              <i class="fab fa-pinterest-p"></i>
            </button>
          </li>
          <li>
            <button class="CatFltr whatsapp" data-change-cat="Whatsapp" onclick="selectOption(this)">
              <i class="fab fa-whatsapp"></i>
            </button>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>

<div class="modal fade" id="ordertype" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-6" id="exampleModalLabel">Order Type</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body ordtypemodbod">
        <!-- List of Buttons -->
        <ul class="list-unstyled">
          <li>
            <a href="/">Single Order</a>
          </li>
          <li>
            <a href="/massorder">Mass Order</a>
          </li>
          <li>
            <button class="CatFltr ordrtypebtn" data-change-cat="auto" onclick="selectOption(this)" data-bs-dismiss="modal">
              Subscription
            </button>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>


<script>
  // Function to close the modal when an option is selected
  function selectOption(button) {
    var selectedPlatform = button.getAttribute("data-change-cat");
    console.log("Selected Platform: " + selectedPlatform);
    // Additional logic can be added here based on the selected platform
    var modal = bootstrap.Modal.getInstance(document.getElementById('filtersSocial'));
    modal.hide();
  }

  // Function to filter the list based on search input
  document.getElementById('searchInput').addEventListener('input', function() {
    var filter = this.value.toLowerCase();
    var listItems = document.querySelectorAll('.list-unstyled li');
    listItems.forEach(function(item) {
      var text = item.querySelector('button').getAttribute('data-change-cat').toLowerCase();
      if (text.includes(filter)) {
        item.style.display = "";
      } else {
        item.style.display = "none";
      }
    });
  });
</script>
<script>
  const changeCatBtns = document.querySelectorAll('.CatFltr');

  if (changeCatBtns[0]) {
    const orderFormCats = document.getElementById('orderform-category');
    var realData = orderFormCats.innerHTML;

    const categories = [];

    [...changeCatBtns].forEach(btn => {
      categories.push(btn.dataset.changeCat);
      btn.addEventListener('click', e => {
        const val = btn.getAttribute('data-change-cat');
        const orderFormCats = document.getElementById('orderform-category');
        const options = document.querySelectorAll('#orderform-category-copy option');

        const newOptions = [];
        [...options].forEach(el => {
          if (val == 'other') {
            // if el inner text is not in categories
            let isIn = false;
            [...categories].forEach(cat => {
              if (cat.toLowerCase() == 'other' || cat == null || cat == "" || cat.trim() == '' || cat.trim == null) {

              } else {
                if (el.innerText.toLowerCase().includes(cat.toLowerCase())) {
                  isIn = true;
                }
              }
            });
            if (!isIn) {
              newOptions.push(el);
            }
          } else {
            if (el.innerText.toLowerCase().includes(val.toLowerCase())) {
              newOptions.push(el);
            }
          }
        });
        const newOptionsHtml = [];
        [...newOptions].forEach(el => {
          newOptionsHtml.push(el.outerHTML);
        });
        orderFormCats.innerHTML = newOptionsHtml.join('');

        $('#orderform-category').trigger('change');
      });
    });

    /**
       * copy order form data hidden
       */
    setTimeout(() => {
      const orderFormCopy = document.createElement('select');
      orderFormCopy.setAttribute('id', 'orderform-category-copy');
      orderFormCopy.style.display = 'none';
      orderFormCopy.innerHTML = realData;
      orderFormCats.parentNode.insertBefore(orderFormCopy, orderFormCats);
    }, 2000)

    const nocWrapper = document.getElementById('noc-wrapper');
    nocWrapper.style.display = 'none';
    setTimeout(() => {
      nocWrapper.style.display = 'block';
    }, 2001);
  }
  //* end */
</script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    const urlParams = new URLSearchParams(window.location.search);
    const buyParam = urlParams.get('buy');

    if (buyParam) {
      // Scroll to the form
      const orderForm = document.getElementById('orderwell');
      if (orderForm) {
        orderForm.scrollIntoView({ behavior: 'smooth', block: 'start' });

        // Remove the URL parameter
        urlParams.delete('buy');
        let newUrl = window.location.pathname;
        const newQueryString = urlParams.toString();
        if (newQueryString) {
          newUrl += `?${newQueryString}`;
        }
        window.history.replaceState({}, '', newUrl);
      }
    }
  });
</script>

<script>
  $(document).ready(function () {
    // Function to update service details based on description content
    function updateServiceDetails() {
      console.log("Updating service details...");

      // Function to wrap any URL in <a> tags
      function wrapURLs(text) {
        var urlRegex = /(https?:\/\/[^\s]+)/g;
        return text.replace(urlRegex, function(url) {
          return '<a href="' + url + '" target="_blank">' + url + '</a>';
        });
      }

      // Get the content of the selected panel body and wrap URLs
      var selectedOption = $('#service_description .panel-body').html();
      selectedOption = wrapURLs(selectedOption); // Wrap URLs

      console.log("Selected option with URLs wrapped:", selectedOption);

      // Function to extract content based on the key name
      function extractContent(serviceName, key) {
        var regex = new RegExp(key + "\\s*:\\s*([^|]+)");
        var match = serviceName.match(regex);
        return match ? match[1].trim() : "N/A";
      }

      // Update the content of the panel body with the wrapped URLs
      $('#service_description .panel-body').html(selectedOption);

      // Extract and update the details
      $('#starttime').html(extractContent(selectedOption, "Starts"));
      $('#speed').html(extractContent(selectedOption, "Speed"));
      $('#refill').html(extractContent(selectedOption, "Refill"));
      $('#drop').html(extractContent(selectedOption, "Drop rate"));
      $('#quality').html(extractContent(selectedOption, "Quality"));
      $('#specs').html(extractContent(selectedOption, "Specs"));
    }

    // Show skeleton loader initially, then update details
    setTimeout(function () {
      updateServiceDetails();
      $('.skeleton').removeClass('skeleton');
    }, 1000);

    // Change event listener for select element
    $('#orderform-service').change(function () {
      console.log("Select option changed.");
      setTimeout(function () {
        updateServiceDetails();
      }, 100); // Call the function immediately
    });
  });
</script>
    </div>

    <!-- Notifications wrapper -->
    <div id="notify-wrapper" class="alert alert-success d-none"></div>

    

{% include 'footer.twig' %}