<?php
require_once("header.php");
require_once("menu.php");


if(isset($_REQUEST['edit']))
{
    $int_supp_ch_id = base64_decode($_REQUEST['edit']);
    $ex = $obj->get_integration_supply_chain($int_supp_ch_id);
    $row = mysqli_fetch_array($ex);
}
if(isset($_POST['update']))
{   

  $int_supply_chain_info['int_supp_ch_id'] = $_POST['int_supp_ch_id'];
  $int_supply_chain_info['int_supp_ch_icon'] = $_POST['int_supp_ch_icon'];
  $int_supply_chain_info['int_supp_ch_title'] = str_replace("'","\'", $_POST['int_supp_ch_title']);
  $int_supply_chain_info['int_supp_ch_desc'] = str_replace("'","\'", $_POST['int_supp_ch_desc']);
  
        
       
    $ex = $obj->update_integration_supply_chain($int_supply_chain_info);
    echo '<script>window.location="integration_supply_chain.php"</script>';
}

if(isset($_POST['submit']))
{
   $int_supply_chain_info['int_supp_ch_icon'] = $_POST['int_supp_ch_icon'];
   $int_supply_chain_info['int_supp_ch_title'] = str_replace("'","\'", $_POST['int_supp_ch_title']);
   $int_supply_chain_info['int_supp_ch_desc'] = str_replace("'","\'", $_POST['int_supp_ch_desc']);

  $ex = $obj->insert_integration_supply_chain($int_supply_chain_info);
    echo '<script>window.location="integration_supply_chain.php"</script>';
}

?>

<div id="layoutSidenav_content">
<main class="mt-4">
    <div class="container-fluid">
        
        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-check-square mr-1"></i>Integration Page Content
                <a href="integration_supply_chain.php" class="btn btn-primary btn-sm float-right">Back</a>
            </div>
            <div class="card-body">
                <form method="post" name="frm" id="frm" enctype="multipart/form-data">
                   <input type="hidden" name="int_supp_ch_id" value="<?php echo $row['int_supp_ch_id'];?>">
                   
                   <div class="form-group">
                        <label>Icon</label>
                        <input type="text" name="int_supp_ch_icon" class="form-control" value="<?php echo $row['int_supp_ch_icon'];?>">
                   </div>
                  <div class="form-group">
                        <label>Title</label>
                        <input type="text" name="int_supp_ch_title" class="form-control" value="<?php echo $row['int_supp_ch_title'];?>">
                   </div>
                    <div class="form-group">
                        <label>Description</label>
                        <textarea id="w3review" name="int_supp_ch_desc" rows="6" cols="50" class="tinymce"><?php echo $row['int_supp_ch_desc'];?></textarea>
                      </div>
          
          
                    <?php if(isset($_REQUEST['edit']))
                    { ?> 
                        <button type="submit" class="btn btn-primary" name="update">Update</button>
                    <?php } 
                    else
                    { ?>
                        <button type="submit" class="btn btn-primary" name="submit">Submit</button>
                    <?php } ?>
                </form> 
            </div>
        </div>
    </div>
</main>

<script>
    var url = "integration_supply_chain.php";
</script>

<?php require_once("footer.php");?>

