<?php
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');

@extract($_REQUEST);
if (empty($catID)) {
  $heading = "Add New Case Study";
} else {
  $heading = "Edit Case Study";
}
$res = getResult("admin_details", " where user_type='admin'");

$record_type = "New Category";
$script_name = "addeditcasestudy.php";
$redirect_script_name = "manage-case-study.php";
$table_name = "casestudy_tbl";
#################### Add Record ##################
if ($id == 'remove_image') {
  mysqli_query($dbconn, "UPDATE $table_name SET $field='' where catID = '$catID'");
  // $_SESSION['session_message'] = $record_type . ' has been updated successfully';
  header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
  exit;
}

if ($action == "add_record" && $catname != "") {
  $numCnt = getCount($table_name, " where catName='$catname' and parentID='$parentID' and catID!='$catID' and catgType='$catgType' ");
    if ($numCnt > 0) {
      $_SESSION['session_message'] = '<div class="btn btn-warning">' . $record_type . ' already exist  </div>';
    } else {
      if ($_FILES['image']['name'] != " ") {
        $file_extension = strtolower(getExtension($_FILES['image']['name']));
        if ($_FILES['image']['name'] != "") {
          $cat = clean($catname);
          $img_name = $cat;
          $img = upload_file($img_name, "image", "uploaded-files/category/images");


          $width="660";
          $height="546";
    
          $source_folder=SITE_DIR_PATH."/uploaded-files/category/images";
          $destination_folder=SITE_DIR_PATH."/uploaded-files/category/images/thumbs/";
          saveResizedPhoto($img, $width, $height, $source_folder, $destination_folder);


        }
      }
      if ($_FILES['catIcon']['name'] != " ") {
        $file_extension = strtolower(getExtension($_FILES['catIcon']['name']));
        if ($_FILES['catIcon']['name'] != "") {
          $cat1 = clean($catname);
          $img_name1 = $cat1;
          $img1 = upload_file($img_name1, "catIcon", "uploaded-files/category/caticon");
        }
      }

      if ($_FILES['cat_home_image']['name'] != " ") {
        $file_extension = strtolower(getExtension($_FILES['cat_home_image']['name']));
        if ($_FILES['cat_home_image']['name'] != "") {
          $cat1 = clean($catname);
          $img_name1 = $cat1.uniqid();
          $img2 = upload_file($img_name1, "catIcon", "uploaded-files/category/images");

             //Thumb Cut
      $width="242";
      $height="242";

      $source_folder=SITE_DIR_PATH."/uploaded-files/category/images";
      $destination_folder=SITE_DIR_PATH."/uploaded-files/category/images/thumbs/";
      saveResizedPhoto($img2, $width, $height, $source_folder, $destination_folder);
        }
      }

      $maxRes = mysqli_fetch_array(mysqli_query($dbconn, "select max(catOrder) from `$table_name` where parentID='$parentID'"));
      $catOrder = $maxRes[0] + 1;
      // $catgurl = getValidFileName($catname);
      // $catalogname = $_FILES['catalog']['name'];
      // $cimg = upload_file($catalogname, "catalog", "uploaded_files/catalog_images");
      // echo $sql_insert = "insert into `$table_name` set parentID='$parentID',catName='".$catname."',displayName='".$catDname."',catgurl='$catgurl',catDesc='".$shortdesc."',catDesc1='".$fulldesc."',catImage='".$img."',catOrder='$catOrder',pageTitle='".$metatitle."',pageKeywords='".$metakeyword."',pageDescription='".$metadesc."', gst='$gst',mca='$mca',epf='$epf',iec='$iec',ptr='$ptr',eticket='$eticket',cp='$cp',cbe='$cbe',etp='$etp',vb='$vb',dgft='$dgft',iet='$iet'";
      // die();
      $sql = mysqli_query($GLOBALS['dbconn'], "insert into `$table_name` set parentID='$parentID',catName='" . $catname . "',displayName='" . $catDname . "',catDesc='" . $shortdesc . "',catDesc1='" . $fulldesc . "',catImage='" . $img . "',cat_home_image='$img2',catOrder='$catOrder',catIcon='$img1',heading1='" . $heading1 . "',heading2='" . $heading2 . "',heading3='" . $heading3 . "',pageTitle='" . $metatitle . "',pageKeywords='" . $metakeyword . "',pageDescription='" . $metadesc . "'");

      header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name . "?start=" . $start . "&parentID=" . $parentID . "&catID=" . $catID . "&pagesize=" . $pagesize);
      exit;
    }
  
}
################ Update Record ##################

if ($action == "update_record" && $catname != "") {
  $numCnt = getCount($table_name, " where catName='$catname' and parentID='$parentID' and catID!='$catID' and catgType='$catgType'");
  if ($numCnt > 0) {
    $_SESSION['session_message'] = '<div class="btn btn-warning">' . $record_type . ' already exist  </div>';
    header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
    exit;
  }

  if ($_FILES['image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catImage");
      $filename = $categoryRes['catImage'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }

        $file_thumb = site_url . "/uploaded-files/category/images/thumbs/" . $filename;
        if (file_exists($file_thumb)) {
          unlink($file_thumb);
        }
      }
      $cat = clean($catname);
      $img_name = $cat;
      $img = upload_file($img_name, "image", "uploaded-files/category/images");
    
      $width="660";
      $height="546";

      $source_folder=SITE_DIR_PATH."/uploaded-files/category/images";
      $destination_folder=SITE_DIR_PATH."/uploaded-files/category/images/thumbs/";
      saveResizedPhoto($img, $width, $height, $source_folder, $destination_folder);
      updateTable($table_name, " catImage='$img' where catID='$catID'");
    }
  }

  if ($_FILES['catIcon']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['catIcon']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['catIcon']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catIcon");
      $filename = $categoryRes['catIcon'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/caticon/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = clean($catname);
      $img_name = $cat;
      $img1 = upload_file($img_name, "catIcon", "uploaded-files/category/caticon");
      updateTable($table_name, " catIcon='$img1' where catID='$catID'");
    }
  }

  if ($_FILES['cat_home_image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['cat_home_image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning"> Please upload image (.jpg,.gif,.png,.webp Format Only) </div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['cat_home_image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "cat_home_image");
      $filename = $categoryRes['cat_home_image'];
      if ($filename != "") {
        $file = site_url . "/uploaded-files/category/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $cat = clean($catname);
      $img_name = $cat.uniqid();
      $img1 = upload_file($img_name, "cat_home_image", "uploaded-files/category/images");

      $width="242";
      $height="242";

      $source_folder=SITE_DIR_PATH."/uploaded-files/category/images";
      $destination_folder=SITE_DIR_PATH."/uploaded-files/category/images/thumbs/";
      saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);

      updateTable($table_name, " cat_home_image='$img1' where catID='$catID'");
    }
  }



  $q = updateTable($table_name, " pageDescription='" . $metadesc . "', catName='" . $catname . "', displayName='" . $catDname . "', catDesc='" . $shortdesc . "',catDesc1='" . $fulldesc . "', heading1='" . $heading1 . "',heading2='" . $heading2 . "',heading3='" . $heading3 . "',pageTitle='" . $metatitle . "', pageKeywords='" . $metakeyword . "' where catID='$catID'");
  // $_SESSION['session_message'] = '<div class="btn btn-success">' . $record_type . ' has been added successfully  </div>';

  echo mysqli_error($db);

  //header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name);

  header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name . "?start=" . $start . "&parentID=" . $parentID . "&catID=" . $catID . "&pagesize=" . $pagesize);
  exit;
}
########################################################
admin_header();
$res = getResult($table_name, " where catID='$catID'");
?>
<div class="content-wrapper">
  <div class="page-header">
    <h3 class="page-title">
      <?= $heading; ?>
    </h3>
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb">
        <li class="nav-item d-none d-lg-flex">
          <a class="nav-link" href="<?= admin_url ?>manage-category.php?parentID=<?= $parentID; ?>">
            <span class="btn btn-primary">Go Back</span>
          </a>
        </li>
      </ol>
    </nav>
  </div>
  <div class="row">

    <div class="col-12 grid-margin stretch-card">
      <div class="card">
        <div class="card-body">
          <form class="forms-sample" method="post" action="" enctype="multipart/form-data"
            onsubmit="return validate(this);">
            <div class="form-group row">
              <div class="col">
                <label>Company Name *</label>
                <div id="the-basics">
                  <input class="typeahead" type="text" name="catname" placeholder="Company Name"
                    value="<?= $res['catName'] ?>" required>
                </div>
              </div>
              <!-- <div class="col">
                <label>Category Display Name</label>
                <div id="bloodhound">
                  <input class="typeahead" type="text" name="catDname" value="<?= $res['displayName'] ?>"
                    placeholder="Category Display Name" required>
                </div>
              </div> -->
            </div>
            <div class="form-group row">
              <div class="col">
                <label>Service Heading</label>
                <div id="the-basics">
                  <input class="typeahead" type="text" name="heading1" value="<?= $res['heading1'] ?>"
                    placeholder="Service Heading">
                </div>
              </div>
              <!-- <div class="col">
                <label>Heading 2</label>
                <div id="bloodhound">
                  <input class="typeahead" type="text" name="heading2" value="<?= $res['heading2'] ?>"
                    placeholder="Heading 2">
                </div>
              </div> -->
            </div>
            <!-- <div class="form-group">
              <label for="exampleTextarea1">Heading 3</label>
              <input class="typeahead" type="text" name="heading3" value="<?= $res['heading3'] ?>"
                placeholder="Heading 3">
            </div> -->
            <!-- <div class="form-group row d-none">
              <div class="col">
                <label>User Type</label>
                <div id="bloodhound">
                  <select name="usertype" class="form-control">
                    <option value="Individual" <?= ($res['usertype'] == 'Individual') ? 'selected' : ''; ?>>Individual</option>
                    <option value="Organization" <?= ($res['usertype'] == 'Organization') ? 'selected' : ''; ?>>Organization
                    </option>
                  </select>
                </div>
              </div>
              <div class="col">
                <label>Price</label>
                <div id="the-basics">
                  <input class="typeahead" type="number" name="catprice" value="<?= $res['catprice'] ?>"
                    placeholder="Price">
                </div>
              </div>
            </div> -->
            <!-- <div class="form-group ">
              <label for="exampleTextarea1">Meta Title</label>
              <input class="typeahead" type="text" name="metatitle" value="<?= $res['pageTitle'] ?>"
                placeholder="Meta Title">
            </div>
            <div class="form-group">
              <label for="exampleTextarea1">Meta Keyword</label>
              <input class="typeahead" type="text" name="metakeyword" value="<?= $res['pageKeywords'] ?>"
                placeholder="Meta Keyword">
            </div>
            <div class="form-group">
              <label for="exampleTextarea1">Meta Description</label>
              <textarea class="form-control" name="metadesc"><?= $res['pageDescription'] ?></textarea>
            </div>
            <div class="form-group">
              <label for="exampleTextarea1">Category Short Description</label>
              <textarea class="form-control editor" name="shortdesc" rows="6"><?= $res['catDesc'] ?></textarea>
            </div>
            <div class="form-group">
              <label for="exampleTextarea1">Category Description</label>
              <textarea class="form-control editor" name="fulldesc" rows="4"><?= $res['catDesc1'] ?></textarea>
            </div> -->

            <!-- <div class="form-group">
              <label for="exampleTextarea1">Uses of Certificate</label>
              <textarea class="form-control editor" name="certificateUsed"
                rows="4"><?= $res['certificateUsed'] ?></textarea>
            </div> -->

            <?php
          if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Company Image</label>
                            <input type="file" class="dropify" name="image">
                        </div>
                        <?php } else{ ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Company Image</label>
                                <input type="file" class="dropify" name="image">
                            </div>
                            <div class="col">
                                <img src="<?=site_url."/uploaded-files/category/images/".$res['catImage']?>"
                                    alt="image" style="width: 60%;">
                            </div>
                        </div>
                        <?php   } ?>

                        <!-- <?php
          if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Home Image (500 X 500 Px)</label>
                            <input type="file" class="dropify" name="cat_home_image">
                        </div>
                        <?php } else{ ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Home Image</label>
                                <input type="file" class="dropify" name="cat_home_image">
                            </div>
                            <div class="col">
                                <img src="<?=site_url."/uploaded-files/category/images/".$res['cat_home_image']?>"
                                    alt="image" style="width: 60%;">
                            </div>
                        </div>
                        <?php   } ?>

                        <?php
          if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Category Icon</label>
                            <input type="file" class="dropify" name="catIcon">
                        </div>
                        <?php } else{ ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Category Icon</label>
                                <input type="file" class="dropify" name="catIcon">
                            </div>
                            <div class="col">
                                <img src="<?=site_url."/uploaded-files/category/caticon/".$res['catIcon']?>"
                                    alt="image" style="width: 60%;">
                            </div>
                        </div>
                        <?php   } ?> -->
            <!-- <div class="form-group">
              <label for="exampleTextarea1">Category Icon</label>
              <input type="file" class="form-control editor" name="catIcon" value="">
            </div> -->
            <!-- <div class="form-group d-none">
              <label for="exampleTextarea1">Required Documents <span class="text-danger">(Must be seperate by 'comma')</span></label>
              <input type="text" class="form-control editor" name="required_doc" value="<?= $res['required_doc'] ?>">
            </div> -->
            <!-- <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">GST, Income Tax, EPF, Patent Trademark Registration</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="gst" value="1"
                          <?= ($res['gst'] == 1) ? 'checked' : ''; ?>> Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="gst" value="0"
                          <?= ($res['gst'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">MCA (ROC) Director’s KYC, Partner’s KYC</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="mca" value="1"
                          <?= ($res['mca'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="mca" value="0"
                          <?= ($res['mca'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le"> Start-up India</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="epf" value="1"
                          <?= ($res['epf'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="epf" value="0"
                          <?= ($res['epf'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Import Export Code (IEC)</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iec" value="1"
                          <?= ($res['iec'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iec" value="0"
                          <?= ($res['iec'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">E-Ticketing</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="ptr" value="1"
                          <?= ($res['ptr'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="ptr" value="0"
                          <?= ($res['ptr'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">IceGate – AD Code Reg.</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="eticket" value="1"
                          <?= ($res['eticket'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="eticket" value="0"
                          <?= ($res['eticket'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">IceGate - Customs Portal</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cp" value="1"
                          <?= ($res['cp'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cp" value="0"
                          <?= ($res['cp'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">CBSE - School</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cbe" value="1"
                          <?= ($res['cbe'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="cbe" value="0"
                          <?= ($res['cbe'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Login into e-Tender Portal</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="etp" value="1"
                          <?= ($res['etp'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="etp" value="0"
                          <?= ($res['etp'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Vendor / Bidder (eProcure.gov.in) | E-Auctioning</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="vb" value="1"
                          <?= ($res['vb'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="vb" value="0"
                          <?= ($res['vb'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">DGFT - Foreign Trade</label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="dgft" value="1"
                          <?= ($res['dgft'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="dgft" value="0"
                          <?= ($res['dgft'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <label class="col-md-12 col-form-label le">Country of Origin-Code  </label>
                <div class="row">
                  <div class="col-sm-4">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iet" value="1"
                          <?= ($res['iet'] == 1) ? 'checked' : ''; ?>>
                        Yes
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-5">
                    <div class="form-check">
                      <label class="form-check-label">
                        <input type="radio" class="form-check-input" name="iet" value="0"
                          <?= ($res['iet'] == 0) ? 'checked' : ''; ?>>
                        No
                      </label>
                    </div>
                  </div>
                </div>
              </div>
            </div> -->





            <?php
            if ($res['catID'] == "") {
              ?>
              <button type="submit" class="btn btn-primary mr-2" name="add_record">Submit</button>
              <input type="hidden" name="action" value="add_record">
              <?php
            } else {
              ?>
              <button type="submit" class="btn btn-primary mr-2" name="update_record">Update</button>
              <input type="hidden" name="action" value="update_record">
              <?php
            }
            ?>
            <button class="btn btn-light"
              onclick="javascript: window.location.href = '<?= SITE_ADMIN_URL; ?>/<?= $redirect_script_name; ?>?parentID=<?= $parentID; ?>&catID=<?= $catID; ?>&start=<?= $start; ?>&pagesize=<?= $pagesize; ?>'">Cancel</button>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- content-wrapper ends -->
<?php
admin_footer();
exit;
?>