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"');
//print_r($arrinfo);
$arrinfo1 = getData('busdir_mst_all_company','my_company_id',$arrinfo['my_company_id'],null,'and active="y" and deleted="n"');
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="Edit 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> <h4 class="wow fadeInRight animated" data-wow-duration="1s" style="color:red; padding-top:5%;">Edit Product</h4>
</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">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Company <span class="require">*</span></label>
<?php
$listq1="SELECT * FROM busdir_mst_all_company where active='y' and deleted='n' and company_id=$companyid ";
$listr1=$connection->query($listq1);
?>
<div class="form-group ">
<select class="form-control" name="my_company_id" id="my_company_id">
<?php
while($listrow1=$listr1->fetch_assoc()){
?>
<option <?php if($listrow1['my_company_id'] == $arrinfo['my_company_id']) { ?> selected="<?php echo $listrow1['my_company_id']; ?>" <?php } ?> value="<?php echo $listrow1['my_company_id']; ?>"><?php echo $listrow1['company_name']; ?></option>
<?php
}?></select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Category <span class="require">*</span></label>
<?php echo getDropDown('catid','busdir_mst_category','categoryname','catid','active="y"',$arrinfo['catid'],'onChange=getSubcat()','valid=true'); ?>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Subcategory</label>
<?php echo getDropDown('subcatid','busdir_mst_subcategory','subcategoryname','subcatid','active="y"',$arrinfo['subcatid'],null,'valid=true'); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<label>currency </label>
<?php echo getDropDown('currency_id','busdir_mst_currency','symbol','symbol','active="y" group by symbol',$arrinfo['currency'],'valid=true','form-control'); ?>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label>Price </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-error-msg="Invalid price" data-validation="number"/>
</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">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Description</label>
<textarea class="form-control" name="description" id="description" rows="5" maxlength="3000" data-validation="required" data-validation-error-msg="Invalid Description" data-validation-optional="true"><?php echo $arrinfo['description'];?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Offer</label>
<input type="checkbox" id="checkBox" onclick="enableDisable(this.checked, 'textBox')">
<input type="text" id="textBox"name="textBox" rows="5" maxlength="500"value="<?php echo $arrinfo['offer_des'];?>" disabled style="height: 100px;
width: 100%; ">
<!-- <textarea class="form-control" name="offer_des" id="offer_des" rows="5" maxlength="3000"><?php echo $arrinfo['offer_des'];?></textarea>
--> </div>
</div ></div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Image <span class="require"></span> <small class="text-muted">(max size: 1MB)</small></label>
<div class="input-group">
<input type="file" class="form-control" name="catlog" id="catlog" value="" data-validation="mime size" data-validation-allowing="jpg, png, gif" data-validation-max-size="1MB" >
<a href="<?php echo"uploads/products/".$arrinfo['catlog'];?>" class="fancybox input-group-addon " title="Logo"><i class="fa fa-eye"></i></a>
</div> <input type="hidden" name="old_catlog" id="old_catlog" value="<?php echo $arrinfo['catlog']; ?>">
</div>
</div>
<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'];?>">
</div>
</div>
<div class="col-sm-12">
<div class="note note-danger displaynone"></div>
<div style="float:right;padding-top:10px;">
<button type="submit" class="btn btn-primary" data-loading-text="Submitting...">Save</button> <button type="reset" class="btn btn-default" onClick="$('.note-danger').hide()">Reset</button>
<a href="javascript:void(0)" class="btn btn-link" onclick="history.back()"><i class="fa fa-angle-left mrm"></i>Go Back</a>
</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>
function enableDisable(bEnable, textBoxID)
{
document.getElementById(textBoxID).disabled = !bEnable
}
$(document).ready(function() {
$(".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