OverLord Shell
<?php
/*
@Purpose: Add Product UI
@Author: Rajahree
@CreatedOn: 12 April 2016
@ModifiedOn: 12 April 2016
*/
session_start();
include("db/conn.php");
include_once("headerdash.inc.php");
include("sidebar.php");
if(!isset($_SESSION['company_id']) || !isset($_SESSION['company_name'])){session_destroy();header("location:login.php");}
if(!in_array($_SESSION['loggedin_user'],array('admin','company'))){header("location:404.php");}
$arrinfo = getData('busdir_product','product_id',base64_decode($_GET['id']),null,' and active="y" and deleted="n"');
//$arrinfo = getData('busdir_product','product_id',base64_decode($_GET['id']),null,' and active="y" and deleted="n"');
$arrinfo2 = getData('busdir_mst_category','catid',$arrinfo['catid'],null,'and active="y" ');
$arrinfo3 = getData('busdir_mst_subcategory','subcatid',$arrinfo['subcatid'],null,'and active="y" ');
if(empty($arrinfo))header("location:404.php");
/*$arrphotoinfo = getData('busdir_product_photo','product_id',base64_decode($_GET['id']),null,"AND featured = 'y' AND active = 'y'");
$photopath = (!empty($arrphotoinfo['photo_path'])) ? $arrphotoinfo['photo_path'] : "no_image_available.jpg";*/
$companyid = (!empty($_SESSION['company_id'])) ? $_SESSION['company_id'] : null;
$webpagetitle="View Product";
?>
<!--BEGIN CONTENT-->
<section>
<div class="second-page-container" style="padding-top: 30px;ba">
<div class="container">
<div class=" row " >
<div class="col-md-8">
<div class=" well col-lg-6 col-sm-6" style="width: 121%; border-top-color: red; border-top-width: 7px;">
<fieldset>
<legend style="padding: 4px;"><div class="col-sm-6"><h4 class="wow fadeInRight animated" data-wow-duration="1s" style="color:red; padding-top:2%;">View Product</h4>
</div><div class="col-sm-6">
<a href="userproduct.php" class="btn btn-info pull-right mrm" style="margin-top: 1%;"><i class="fa fa-angle-left mrm"></i>Go Back</a>
<form><button type="submit" name="id" style="margin-top: 1%;float: right;margin-right: 1%;padding-bottom: 2%;" value="<?php echo base64_encode($arrinfo['product_id'])?>" formaction="userproductedit.php" class="btn btn-primary btn-sm">Edit<i class="fa fa-pencil mlm"></i></button></form>
</div>
</legend>
<?php if(!empty($_GET['msg']) && strpos($_GET['msg'],'success')!=FALSE){?>
<div class="note note-success note-dismissable" id="msg">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php if($_GET['msg']=='add_success'){?>Record added Successfully<?php }?>
<?php if($_GET['msg']=='update_success'){?>Record updated Successfully<?php }?>
<?php if($_GET['msg']=='delete_success'){?>Record deleted Successfully<?php }?>
</div>
<?php }?>
<form role="form" id="updateform" enctype="multipart/form-data">
<input type="hidden" name="product_id" id="product_id" value="<?php echo base64_decode($_GET['id']);?>">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Product Name <span class="require"></span></label>
<input type="text" class="form-control" name="product_name" id="product_name" value="<?php echo $arrinfo['product_name'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Company <span class="require"></span></label>
<?php
$my=$arrinfo['my_company_id'];
$listq1="SELECT * FROM busdir_mst_all_company where active='y' and deleted='n'and my_company_id=$my ";
// echo $listq1;exit;
$listr1=$connection->query($listq1);
$listrow1=$listr1->fetch_assoc();
?>
<div class="form-group ">
<input type="text" class="form-control" name="company_name" id="company_name" value="<?php echo $listrow1['company_name'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Category</label>
<input type="text" class="form-control" name="company_name" id="company_name" value="<?php echo $arrinfo2['categoryname'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Subcategory</label>
<input type="text" class="form-control" name="company_name" id="company_name" value="<?php echo $arrinfo3['subcategoryname'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<label>currency </label>
<input type="text" class="form-control" name="company_name" id="company_name" value="<?php echo $arrinfo['currency'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label>Price <span class="require"></span></label>
<input type="number" style=" margin-left: -31px; width: 296px;" class="form-control"step="0.01" name="price" id="price" value="<?php echo $arrinfo['price'];?>" maxlength="11" data-validation="" data-validation-error-msg="Invalid price" required="required" disabled="disabled">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Discounted Price</label>
<input type="number" step="0.01" style="width:420px" class="form-control" name="discounted_price" id="discounted_price" value="<?php echo $arrinfo['discounted_price'];?>" maxlength="11" data-validation="" data-validation-error-msg="Invalid discounted price" data-validation-optional="true" required="required" disabled="disabled">
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label style="margin-left: 3%;">Offer</label>
<textarea style=" margin-left:4%;width: 415px;" class="form-control" name="offer_des" id="offer_des" rows="5" maxlength="3000" data-validation="required" data-validation-error-msg="Invalid Description" data-validation-optional="true" disabled="disabled"><?php echo $arrinfo['offer_des'];?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Description</label>
<textarea style=" width: 420px;" class="form-control" name="description" id="description" rows="5" maxlength="3000" data-validation="required" data-validation-error-msg="Invalid Description" data-validation-optional="true" disabled="disabled"><?php echo $arrinfo['description'];?></textarea>
</div>
</div>
</div>
</div><div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Keyword <span class="require">*</span></label>
<div class="input-icon">
<i class="fa fa-key"></i>
<input type="text" class="form-control" name="keyword" id="keyword" data-validation="required" data-validation-error-msg="Invalid Keyword" maxlength="50" value="<?php echo $arrinfo['keyword'];?>" disabled="disabled">
</div>
</div>
</div>
</form>
</fieldset>
</div>
</div><!--col-md-8-->
</div>
</div>
</div>
</div>
</section>
<!--END CONTENT-->
<link type="text/css" rel="stylesheet" href="css/jquery.fancybox.css">
<script src="js/jquery.fancybox.pack.js"></script>
<!--<script src="js/validate.js"></script>-->
<script>
$('.fancybox').fancybox();
$(document).ready(function() {
$(".btn-pref .btn").click(function () {
$(".btn-pref .btn").removeClass("btn-primary").addClass("btn-default");
// $(".tab").addClass("active"); // instead of this do the below
$(this).removeClass("btn-default").addClass("btn-primary");
});
});
function valEdit() {
$.validate({
modules: 'file,security',
form: '#updateform',
scrollToTopOnError: false,
onSuccess: function() {
$('#updateform button[type=submit]').button('loading');
$('#updateform button[type=reset]').attr('disabled', 'disabled');
$('.alert-danger').html('').hide();
$.ajax({
type: 'POST',
url:'userproductedit_save.php',
data: new FormData($('#updateform')[0]),
contentType: false,
processData: false,
success: function(data) {
//alert(data);
if (data == 'success') {
$('.alert-danger').html(data).show();
location = 'userproduct.php&msg=update_success';
} else if (data.substr(data.length - 4) == '.php') location = data;
else {
$('.alert-danger').html(data).show();
$('#updateform button[type=submit]').button('reset');
$('#updateform button[type=reset]').removeAttr('disabled');
}
}
});
return false;
}
});
}
valEdit();
</script>
<?php include_once("footer.inc.php");connClose();?>
xRyukZ - Copyright 2k19