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");}
$companyid = (!empty($_SESSION['company_id'])) ? $_SESSION['company_id'] : null;
$webpagetitle="Add 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%; padding-top: 3%;
border-top-color: red;
border-top-width: 7px;">
<fieldset><legend><h4 class="wow fadeInRight animated" data-wow-duration="1s" style="color:red ;padding-top:2%;">Add New Product/Service</h4></legend><br>
<form role="form" id="registerform" enctype="multipart/form-data">
<div class="col-md-12" >
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>Product/Service Name <span class="require">*</span></label>
<input type="text" class="form-control" name="product_name" id="product_name" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Company Name">
</div>
</div>
<?php /*?> <?php echo $companyid;exit; ?><?php */?>
<?php if($_SESSION['loggedin_user']=='company'){?>
<input type="hidden" name="company_id" id="company_id" value="<?php echo $_SESSION['company_id']?>" readonly>
<?php }else{?>
<div class="col-sm-4">
<div class="form-group">
<label>Company <span class="require">*</span></label>
<?php echo getDropDown('company_id','busdir_mst_all_company','company_name','company_id','active="y" deleted="n"',null,null,'valid=true','form-control'); ?>
</div>
</div>
<?php }?>
<div class="col-sm-6">
<div class="form-group">
<label>Company <span class="require">*</span></label>
<?php echo getDropDown('my_company_id','busdir_mst_all_company','company_name','my_company_id','company_id='.$_SESSION['company_id'].' and active="y" and deleted="n"',null,null,'valid=true','form-control'); ?>
</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"',null,'onChange=getSubcat();','valid=true','form-control'); ?>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Subcategory</label>
<select class="form-control" name="subcatid" id="subcatid" data-validation="required" data-validation-error-msg="Invalid Subcategory" disabled>
<option value="">Select</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<label>currency </label>
<Select class="form-control" type="text" name="symbol" id="symbol" ><?php $editd="SELECT * FROM `busdir_mst_currency` where active='y' group by symbol";
$editd=$connection->query($editd);?><?php
while($arrinfd=$editd->fetch_assoc()){?>
<option value="<?php echo $arrinfd['currency_id'];?>"><?php echo $arrinfd['symbol'];?></option>
<?php }?>
</Select>
<?php /*?>
<label>currency </label>
<?php echo getDropDown('currency_id','busdir_mst_currency','symbol','symbol','active="y" group by symbol',null,'null','form-control'); ?>
<?php */?>
</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" style=" margin-left: -34px; width: 291px;" maxlength="11" data-validation-error-msg="Invalid price"/>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Discounted Price <span class="require"></span></label>
<input type="number" step="0.01" style="width:420px" class="form-control" name="discounted_price" id="discounted_price" maxlength="11" data-validation-error-msg="Invalid discounted price" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label>New Offer:</label>
<input type="checkbox" id="checkBox" onclick="enableDisable(this.checked, 'textBox')">
<input type="text" id="textBox"name="textBox" rows="5" maxlength="500" data-validation="required" data-validation-error-msg="Invalid Description" data-validation-optional="true" disabled style="height: 100px;
width: 100%; ">
</div>
</div>
<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"></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>
<input type="file" class="form-control" name="catlog" data-validation="required size" data-validation-max-size="1MB" >
</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">
</div>
</div>
</div>
</div>
<!--
<div class="note note-danger displaynone"></div> <div style="float:right;">
<button type="submit" class="btn btn-primary" data-loading-text="Submitting...">Add</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 class="alert alert-danger displaynone"></div>
<div style="float:right;">
<button type="submit" class="btn btn-primary" >add</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>
</form>
</fieldset>
</div>
</div>
</div><!--col-md-8-->
</div>
</div>
</div>
</div>
</section>
<!--END CONTENT-->
<link href="css/jquery-ui.min.css" rel="stylesheet">
<script src="js/jquery-ui.min.js"></script>
<!--<script src="js/validate.js"></script>-->
<!--<script type = "text/javascript" src = "EnableTextbox.js"></script>-->
<script language="javascript">
$(function(){
$.validate({modules:'security,file',form:'#registerform',scrollToTopOnError:false,onSuccess:function(){
$('#registerform button').button('loading');
$('#registerform .alert').hide();
$.ajax({
type: 'POST',
url: 'userproductadd_save.php',
data: new FormData($('#registerform')[0]),
contentType: false,
processData: false,
success: function(data) {
alert(data);
$('#regpassword').val('');
if(data=='success'){
$('#registerform').siblings('.alert-success').fadeIn();
$('#registerform').remove();
setTimeout(location='userproduct.php?msg=register_success', 3000);
}
else if(data.substr((data.length)-4,4)=='.php')location=data;
else{
$('#registerform .alert-danger').html(data).show();
$('#registerform button').button('reset');
}
}
});
return false;
}
});
});
function enableDisable(bEnable, textBoxID)
{
document.getElementById(textBoxID).disabled = !bEnable
}
</script>
<script>
function getSubcat() {
if ($('#catid').val() != '') {
$('#subcatid').load('getsubcat.php', {
catid: $('#catid').val()
}, function(responseText, textStatus, req) {
if (textStatus == 'error') {
alert('An unknown error occured. Please try again.');
location.reload();
}
if (responseText.substr(responseText.length - 4) == '.php') location = responseText;
}).removeAttr('disabled');
} else $('#subcatid').val('').attr('disabled', 'disabled');
}
</script>
<?php include_once("footer.inc.php");connClose();?>
xRyukZ - Copyright 2k19