<?php if ($_GET['page'] == 'sliderList'){ ?>
<div class="card">
  <div class="card-body table-responsive">
    <table id="dataTable" class="table table-bordered table-striped">
      <thead>
        <tr>
          <th><?php echo $langArray['TABLE_ORDER_SORT']; ?></th>
          <th><?php echo $langArray['TABLE_IMAGE']; ?></th>
          <th><?php echo $langArray['GLOBAL_FORM_TABLE_TITLE']; ?></th>
          <th><?php echo $langArray['TABLE_STATUS']; ?></th>
          <th><?php echo $langArray['TABLE_OPERATION']; ?></th>
        </tr>
      </thead>
      <tbody>
        <?php while ($allSliderCheck=$allSliderAsk->fetch(PDO::FETCH_ASSOC)){ ?>
          <tr>
            <td><?php echo $allSliderCheck['order_sort']; ?></td>
            <td><img src="../<?php echo $allSliderCheck['banner']; ?>" width="60"></td>
            <td><?php echo $allSliderCheck['title']; ?></td>
            <td>
              <?php if ($allSliderCheck['status']== 1){ ?>
                <i class="fas fa-eye text-success"></i>
              <?php }else{ ?>
                <i class="fas fa-eye-slash text-danger"></i>
              <?php } ?>
            </td>
            <td>
               <a class="btn btn-light" href="index.php?page=sliderEdit&slider_id=<?php echo $allSliderCheck['slider_id'] ?>"><?php echo $langArray['TABLE_EDIT']; ?></a>
               <a class="btn btn-danger" data-toggle="modal" data-target="#dataDelete-<?php echo $allSliderCheck['slider_id'] ?>"><?php echo $langArray['TABLE_DELETE']; ?></a>
               <div class="modal fade" id="dataDelete-<?php echo $allSliderCheck['slider_id']  ?>">
                 <div class="modal-dialog customDialog">
                   <div class="modal-content bg-danger">
                     <div class="modal-header">
                       <h4 class="modal-title"><?php echo $langArray['ARE_YOU_SURE']; ?></h4>
                     </div>
                     <div class="modal-footer justify-content-between">
                       <button type="button" class="btn btn-outline-light" data-dismiss="modal"><?php echo $langArray['CANCEL_FORM']; ?></button>
                       <a href="system/operation.php?slider_id=<?php echo $allSliderCheck['slider_id']; ?>&banner=<?php echo $allSliderCheck['banner']; ?>&sliderDelete=success" class="btn btn-outline-light"><?php echo $langArray['TABLE_DELETE']; ?></a>
                     </div>
                   </div>
                 </div>
               </div>
            </td>
          </tr>
        <?php } ?>
      </tbody>
      <tfoot>
        <tr>
          <th><?php echo $langArray['TABLE_ORDER_SORT']; ?></th>
          <th><?php echo $langArray['TABLE_IMAGE']; ?></th>
          <th><?php echo $langArray['GLOBAL_FORM_TABLE_TITLE']; ?></th>
          <th><?php echo $langArray['TABLE_STATUS']; ?></th>
          <th><?php echo $langArray['TABLE_OPERATION']; ?></th>
        </tr>
      </tfoot>
    </table>
  </div>
</div>
<?php }elseif($_GET['page'] == 'sliderAdd'){ ?>
<div class="card">
  <div class="card-body">
    <form action="system/operation.php" method="post" enctype="multipart/form-data" data-parsley-validate>
      <input type="hidden" name="language_id" value="<?=$getLangCheck["language_id"] ?>">
      <div class="row">
        <div class="col-md-4">
          <div class="card card-secondary">
            <div class="card-body">
              <!-- #form-group -->
              <div class="form-group">
                <label for="image"><?php echo $langArray['TABLE_IMAGE']; ?></label>
                <div class="input-group">
                  <div class="custom-file">
                    <input type="file" name="banner" class="custom-file-input"  id="inputGroupFile01" aria-describedby="inputGroupFileAddon01">
                    <label class="custom-file-label"><?php echo $langArray['TABLE_CHOOSE_FILE']; ?></label>
                  </div>
                </div>
              </div>
              <!-- #form-group -->
              <div class="form-group">
                <label for="title"><?php echo $langArray['GLOBAL_FORM_TABLE_TITLE']; ?></label>
                <input type="text" name="title" class="form-control">
              </div>
              <!-- #form-group -->
              <div class="form-group">
                <label for="link"><?php echo $langArray['GLOBAL_FORM_TABLE_LINK']; ?></label>
                <input type="text" name="link" class="form-control">
              </div>
                <!-- #form-group -->
                <div class="form-group">
                    <label for="video_link"><?php echo $langArray['GLOBAL_FORM_TABLE_LINK']; ?></label>
                    <input type="text" name="video_link" class="form-control" placeholder="Video Link">
                </div>
              <div class="row">
                <div class="col-md-6">
                  <!-- #form-group -->
                  <div class="form-group">
                    <label for="status"><?php echo $langArray['TABLE_STATUS']; ?></label>
                    <div class="input-group">
                      <input type="checkbox" id="status" name="status[]" checked data-bootstrap-switch data-off-color="danger" data-on-color="success">
                    </div>
                  </div>
                </div>
                <div class="col-md-6">
                  <!-- #form-group -->
                  <div class="form-group">
                    <label for="order_sort"><?php echo $langArray['TABLE_ORDER_SORT']; ?></label>
                    <input type="number" name="order_sort" class="form-control" value="<?php echo $sliderCount+1; ?>">
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="col-12">
            <a href="servicesList" class="btn btn-secondary"><?php echo $langArray['CANCEL_FORM']; ?></a>
            <input type="submit" value="<?php echo $langArray['CREATE_FORM']; ?>" class="btn btn-success float-right" name="sliderAdd">
          </div>
          <div class="clearfix"></div>
        </div>
          <div class="col-md-8">
            <div class="card card-primary">
              <div class="card-body">
                <!-- #form-group -->
                <div class="form-group">
                  <label for="content"><?php echo $langArray['GLOBAL_FORM_TABLE_CONTENT']; ?></label>
                  <textarea class="textarea" name="content"></textarea>
                </div>
              </div>
            </div>
          </div>
        <div class="clearfix"></div>
      </div>
    </form>
  </div>
</div>
<?php }elseif($_GET['page'] == 'sliderEdit'){ ?>
<?php
  $askData=$db->prepare("SELECT * FROM slider where slider_id=:slider_id");
  $askData->execute(array(
    'slider_id' => $_GET["slider_id"]
    ));
  $checkData=$askData->fetch(PDO::FETCH_ASSOC);
  // $_GET null or nothing
  if ($_GET['slider_id'] == null) {
    Header("Location:sliderList");
  }elseif($_GET['slider_id'] != $checkData['slider_id']){
    Header("Location:sliderList");
  }
?>
<div class="card">
  <div class="card-body">
    <form action="system/operation.php" method="post" enctype="multipart/form-data" data-parsley-validate>
      <input type="hidden" name="slider_id" value="<?=$checkData["slider_id"] ?>">
      <input type="hidden" name="isset_banner" value="<?=$checkData["banner"] ?>">
      <div class="row">
        <div class="col-md-4">
          <div class="card card-secondary">
            <div class="card-body">
              <!-- #form-group -->
              <div class="form-group">
                <label for="image"><?php echo $langArray['TABLE_IMAGE']; ?></label>
                <div class="input-group">
                  <div class="custom-file">
                    <input type="file" name="banner" class="custom-file-input"  id="inputGroupFile01" aria-describedby="inputGroupFileAddon01">
                    <label class="custom-file-label"><?php echo $langArray['TABLE_CHOOSE_FILE']; ?></label>
                  </div>
                </div>
              </div>
              <!-- #form-group -->
              <div class="form-group">
                <label for="image"><?php echo $langArray['TABLE_IMAGE']; ?></label>
                <div class="input-group">
                  <img src="../<?php echo $checkData['banner']; ?>" width="100%">
                </div>
              </div>
              <!-- #form-group -->
              <div class="form-group">
                <label for="title"><?php echo $langArray['GLOBAL_FORM_TABLE_TITLE']; ?></label>
                <input type="text" name="title" class="form-control" value="<?php echo $checkData['title']; ?>">
              </div>
              <!-- #form-group -->
              <div class="form-group">
                <label for="link"><?php echo $langArray['GLOBAL_FORM_TABLE_LINK']; ?></label>
                <input type="text" name="link" class="form-control" value="<?php echo $checkData['link']; ?>">
              </div>
                <!-- #form-group -->
                <div class="form-group">
                    <label for="video_link"><?php echo $langArray['GLOBAL_FORM_TABLE_LINK']; ?></label>
                    <input type="text" name="video_link" class="form-control" placeholder="Video Link" value="<?php echo $checkData['video_link']; ?>">
                </div>
              <div class="row">
                <div class="col-md-6">
                  <!-- #form-group -->
                  <div class="form-group">
                    <label for="status"><?php echo $langArray['TABLE_STATUS']; ?></label>
                    <div class="input-group">
                      <input type="checkbox" id="status" name="status[]" <?php echo $checkData['status'] == "1" ? 'checked=""' : ''; ?> data-bootstrap-switch data-off-color="danger" data-on-color="success">
                    </div>
                  </div>
                </div>
                <div class="col-md-6">
                  <!-- #form-group -->
                  <div class="form-group">
                    <label for="order_sort"><?php echo $langArray['TABLE_ORDER_SORT']; ?></label>
                    <input type="number" name="order_sort" class="form-control" value="<?php echo $checkData['order_sort']; ?>">
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="col-12">
            <a href="sliderList" class="btn btn-secondary"><?php echo $langArray['CANCEL_FORM']; ?></a>
            <input type="submit" value="<?php echo $langArray['UPDATE_FORM']; ?>" class="btn btn-warning float-right" name="sliderUpdate">
          </div>
          <div class="clearfix"></div>
        </div>
          <div class="col-md-8">
            <div class="card card-primary">
              <div class="card-body">
                <!-- #form-group -->
                <div class="form-group">
                  <label for="content"><?php echo $langArray['GLOBAL_FORM_TABLE_CONTENT']; ?></label>
                  <textarea class="textarea" name="content"><?php echo $checkData['content']; ?></textarea>
                </div>
              </div>
            </div>
          </div>
        <div class="clearfix"></div>
      </div>
    </form>
  </div>
</div>
<?php } ?>
