<?php
	include "db_connection/db_connection.php";
	include "config/config.php";

	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
	$ot=1;
	if(isset($_GET['ot'])!=''){
		$ot = $_GET['ot'];
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php echo $PROJECT_TITLE ?></title>

<script type="text/javascript" src="js/design_add_JS.js"></script>
 <script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

<script type="text/javascript" src="js/plugins/forms/ui.spinner.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.mousewheel.js"></script>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type="text/javascript" src="js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="js/plugins/tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="js/plugins/forms/autogrowtextarea.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.chosen.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="js/files/bootstrap.js"></script>
<script type="text/javascript" src="js/files/functions.js"></script>

<!-- Shared on MafiaShare.net  --><!-- Shared on MafiaShare.net  --></head>

<body onload="des_no('<?php echo $ot;?>'), document.getElementById('listpage').focus();">

<!-- Top line begins -->
<?php include "header_footer/header.php"; ?>
<!-- Top line ends -->

<!-- Sidebar begins -->
<?php include "menus/left_menu.php"; ?>
<!-- Sidebar ends -->

<!-- Content begins -->
<div id="content">
    <!--<div class="contentTop">
        <span class="pageTitle"><span class="icon-key-2"></span>Form validation engines</span>
        <ul class="quickStats">
            <li>
                <a href="" class="blueImg"><img src="images/icons/quickstats/plus.png" alt="" /></a>
                <div class="floatR"><strong class="blue">5489</strong><span>visits</span></div>
            </li>
            <li>
                <a href="" class="redImg"><img src="images/icons/quickstats/user.png" alt="" /></a>
                <div class="floatR"><strong class="blue">4658</strong><span>users</span></div>
            </li>
            <li>
                <a href="" class="greenImg"><img src="images/icons/quickstats/money.png" alt="" /></a>
                <div class="floatR"><strong class="blue">1289</strong><span>orders</span></div>
            </li>
        </ul>
        <div class="clear"></div>
    </div>-->
     <?php include "menus/top_menu.php"; ?> 
    <!-- Breadcrumbs line -->
    <div class="breadLine">
        <div class="bc">
            <ul id="breadcrumbs" class="breadcrumbs">
                <li><a href="home.php">Dashboard</a></li>
                <li><a href="javascritp:">New Design Entry</a></li>
            </ul>
        </div>
        <?php include "menus/top_left_menu.php"; ?>
    </div>
    <!-- Main content -->
    <div class="wrapper">
        <ul class="middleNavR">
            <!--<li><a href="#" title="Add an article" class="tipN"><img src="images/icons/middlenav/create.png" alt="" /></a></li>
            <li><a href="#" title="Upload files" class="tipN"><img src="images/icons/middlenav/upload.png" alt="" /></a></li>
            <li><a href="#" title="Add something" class="tipN"><img src="images/icons/middlenav/add.png" alt="" /></a></li>
            <li><a href="#" title="Messages" class="tipN"><img src="images/icons/middlenav/dialogs.png" alt="" /></a><strong>8</strong></li>-->
            <li><a href="design_new_list.php" id="listpage" title="List Design" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
        </ul>
    	<?php
		$page_id= base64_encode(base64_encode(base64_encode(1))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for add

		$SLCTd = "SELECT * FROM design_det ORDER BY design_det_id DESC";
		$QURYd = mysqli_query($connect,$SLCTd);
		$FTCHd = mysqli_fetch_object($QURYd);
		$country_name='';
		?>

        <div class="fluid">
            <form id="validate" name="fm" class="main" method="post" action="bl/design_BL.php?page_id=<?php echo $page_id; ?>" enctype="multipart/form-data">
                <fieldset>
                	<div class="widget">
                        <div class="whead"><h6>New Design Add</h6><div class="clear"></div></div>
                		<div class="formRow">
                            <div class="grid2"><label>Select Category:<span class="req">*</span></label></div>
                            <div class="grid4 searchDrop" id="cat_name_div">
	<select  data-placeholder="" class="select" name="cat_name" id="cat_name" style="width:200px;" onchange="des_no('<?php echo $ot;?>');" onfocus="foc(this.id)" onblur="stnon(this.id)">
		<option value="">Choose a Category...</option>
		<?php
		$SLCT = "SELECT * FROM master_cat ORDER BY master_cat_id ASC";
		//echo $SLCT;
		$QURY = mysqli_query($connect,$SLCT);
		while($FTCH = mysqli_fetch_object($QURY))
		{
			$SLCT_des = "SELECT * FROM design_det ORDER BY design_det_id DESC";
			//echo $SLCT_des;
			$QURY_des = mysqli_query($connect,$SLCT_des);
			$FTCH_des = mysqli_fetch_object($QURY_des);
			//echo $FTCH_des->master_cat_id;
		?>
		<option <?php if($FTCH_des->master_cat_id==$FTCH->master_cat_id){ ?>  selected="selected" <?php }?> value="<?php echo $FTCH->master_cat_id ?>"><?php echo $FTCH->master_cat_name ?></option>
		<?php
		}
		?>
	</select>
	</div>
    <div class="grid2"><label>Select Sub Category:<span class="req">*</span></label></div>
    <div class="grid4 searchDrop" id="country_name_div">
	<select  data-placeholder="" class="select" name="sub_cat_name[]" id="sub_cat_name" style="width:200px;" onchange="des_no('<?php echo $ot;?>');" onfocus="foc(this.id)" onblur="stnon(this.id)" multiple>
		<option value="">Choose a Sub Category...</option>
		<?php
		$SLCT_con = "SELECT master_sub_category_id,sub_category_name FROM master_sub_category WHERE statu_s='active' ORDER BY sub_category_name ASC";
		//echo $SLCT;
		$QURY_con = mysqli_query($connect,$SLCT_con);
		while($FTCH_con = mysqli_fetch_object($QURY_con))
		{
		?>
		<option value="<?php echo base64_encode(base64_encode(base64_encode(base64_encode($FTCH_con->master_sub_category_id)))); ?>"><?php echo $FTCH_con->sub_category_name ?></option>
		<?php
		}
		?>
			</select>
		</div>
		<div class="clear"></div>
	</div>
	<input type="hidden" name="ot" id="ot" value="<?php echo $ot;?>">
	<div class="formRow">
		<div class="grid2"><label>Design No:<span class="req">*</span></label></div>
		<div class="grid4"><input type="text" class="" name="d_no" id="d_no" readonly="readonly" style="width:200px; background-color:#CCC"/>&nbsp;<div id="dajax_lo"></div></div>
		<div class="grid2"><label>Approximate Weight:<span class="req">*</span></label></div>
		<div class="grid4"> <input type="text" id="appr_wght" name="appr_wght" onfocus="foc(this.id)" onblur="stnon(this.id)" value="<?php echo $FTCHd->approximate_weight; ?>" style="width:100px"></div><div class="clear"></div>
	</div>
		<div class="formRow">
			<div class="grid2"><label>Hand Designer:<span class="req">*</span></label></div>
			<div class="grid4 searchDrop" id="hdes_name_div">
		   <select name="hdes_name" id="hdes_name" data-placeholder="" class="select" style="width:200px;" onfocus="foc(this.id)" onblur="stnon(this.id)">
				<option value="">Choose an Hand Designer...</option>
				<?php
				$SLCT_E = "SELECT * FROM emp_det WHERE master_dept_id REGEXP(CONCAT('(^|,)(',1,')(,|$)')) and statu_s='active'"; 
				//HERE THE 1 IS REPRESENTS HAND DESIGNER ID 
				//echo $SLCT_E;
				$QURY_E = mysqli_query($connect,$SLCT_E);
				while($FTCH_E = mysqli_fetch_object($QURY_E)){
				?>
				<option <?php if($FTCHd->emp_det_id==$FTCH_E->emp_det_id){ ?>  selected="selected" <?php }?> value="<?php echo $FTCH_E->emp_det_id ?>"><?php echo $FTCH_E->name ?></option>
				<?php
				}
				?>
			</select>
			</div>
			<div class="grid2"><label>Hand Design Date:<span class="req">*</span></label></div>
			<div class="grid3"><input type="text" name="hnd_date" id="hnd_date" class="datepicker" value="<?php echo str_replace("-","/",$FTCHd->hand_design_date);?>"/></div>
			<div class="clear"></div>
		</div>

	<div class="formRow">
		<div class="grid2"><label>Design Upload Date:<span class="req">*</span></label></div>
		<div class="grid4"><input type="text" name="ddate" id="ddate" class="datepicker" value="<?php echo str_replace("-","/",$FTCHd->design_date);?>"/></div>

		<div class="grid2" style=""><label>Points:<span class="req">*</span></label></div>
		<div class="grid3 searchDrop" id="hdes_name_div" style="">
		   <select name="cad_cat" id="cad_cat" data-placeholder="" class="select" style="width:100px;" onfocus="foc(this.id)" onblur="stnon(this.id)">
				<option value="">Choose Points...</option>
				<?php
				$SLCT_E = "SELECT * FROM master_cad_cat WHERE statu_s = 'active'";
				//echo $SLCT;
				$QURY_E = mysqli_query($connect,$SLCT_E);
				while($FTCH_E = mysqli_fetch_object($QURY_E))
				{
				?>
				<option <?php if($FTCHd->master_cad_cat_id ==$FTCH_E->master_cad_cat_id ){ ?> selected="selected" <?php } ?> value="<?php echo $FTCH_E->master_cad_cat_id; ?>"><?php echo $FTCH_E->cad_cat_name; ?></option>
				<?php
				}
				?>

			</select>
			</div>
		<div class="clear"></div>
	</div>
		<div class="formRow">
			<div class="grid2"><label>Design Image:<span class="req">*</span></label></div>
			<div class="grid4" id="imgInp_div">
			   <input type="file" class="fileInput" id="imgInp" name="imgInp" onfocus="foc(this.id)" onblur="stnon(this.id)">

				<div id="img_div" style="width:250px; height:250px; border:solid 1px; margin-top:20px; display:none"><img id="blah" name="" type="image" src="#" width="250" height="250"/></div>
			</div>
			<div class="grid2" style=""><label>Party:<span class="req">*</span></label></div>
			<div class="grid3 searchDrop" id="hdes_name_div" style="">
		   <select name="sel_party[]" id="party" multiple data-placeholder="" class="select" style="width:200px;" onfocus="foc(this.id)" onblur="stnon(this.id)">
				<option value="">Choose Party...</option>
				<?php
		      $SLCT_E = "SELECT * FROM party_det WHERE statu_s = 'active'";
				//echo $SLCT;
				$QURY_E = mysqli_query($connect,$SLCT_E);
				while($FTCH_E = mysqli_fetch_object($QURY_E)){	?>
				<option <?php if($FTCHd->master_member_id ==$FTCH_E->party_det_id ){ ?> selected="selected" <?php } ?> value="<?php echo base64_encode(base64_encode(base64_encode(base64_encode($FTCH_E->party_det_id)))); ?>"><?php echo $FTCH_E->cmp_name; ?></option>
				<?php
				}
				?>

			</select>
			</div>
			<div class="clear"></div>
		</div>

		<div class="formRow">
		<input type="button" value="Submit" class="buttonM bBlack formSubmit" onclick="fom_validate();" style="float: right; margin-left:20px;"/>
		<input type="button" value="Reset" class="buttonM bRed" style="float: right; margin-left:20px;" onclick="form_rest();"/>
		<div class="clear"></div></div>
		<div class="clear"></div>
                    </div>
                </fieldset>
            </form>

<script type="text/javascript"> <!--THIS IS FOR SHOWING THE IMAGE FILE WHEN ITS UPLOADING-->
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            $('#blah').attr('src', e.target.result);
        }

        reader.readAsDataURL(input.files[0]);
    }
}

$("#imgInp").change(function(){
    readURL(this);
	hid_sho();
});
</script>

        </div>
    </div>
</div>
<!-- Content ends -->
</body>
</html>