<button class="cabinet-button mb-2" type="button" data-toggle="modal" data-target="#modalDellPrivilage">Добавить привилегию</button>

<div class="modal fade" id="modalDellPrivilage" tabindex="-1" role="dialog" aria-labelledby="modalDellPrivilageTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="modalAddPrivilageTitle">Добавление привилегии</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form id="add_privilage">
          <div class="form-group mb-1">
            <label for="old_pass">Название</label>
            <input type="text" class="form-control" name="add_privilage_name" id="add_privilage_name" placeholder="Как в конфиге плагина" required>
          </div>
          <div class="form-group mb-1">
            <label for="old_pass">Стоимость</label>
            <input type="number" class="form-control" name="add_privilage_price" id="add_privilage_price" placeholder="Стоимость в месяц" required>
          </div>
          <div class="form-group mb-1">
            <label for="old_pass">Выберите сервер</label>
            <div class="category_list">
              {foreach $server_list as $value}
              <input type="checkbox" name="privilage-server-{$value.id}" id="privilage-server-{$value.id}"><label for="privilage-server-{$value.id}" class="category_list-item">{$value.name}</label>
              {/foreach}
            </div>
          </div>
          <div class="form-group mt-3">
            <button class="cabinet-button" type="button" onclick="add_privilage();">Добавить привилегию</button>
          </div>
        </form>
        <script>
          function add_privilage() {
            var form_data = $('#add_privilage').serialize();
            $.ajax({
              type: "POST",
              url: "/cabinet/engine/handlers/handler.php",
              data: "operation=addprivilage&" + form_data,
              success: function(data) {
                var message = JSON.parse(data);
                if (message.type == "success") {
                  notif_success(message.text);
                  $('#add_privilage')[0].reset();
                  $('.label-active').removeClass('label-active');
                } else {
                  notif_error(message.text);
                }
              }
            });
          }
        </script>
      </div>
    </div>
  </div>
</div>
