<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
	$check_acc  = check_access('23');
	$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="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 -->
<?php
	$page_id= base64_encode(base64_encode(base64_encode(4))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for add		 
	$pge_cad_id= base64_decode(base64_decode(base64_decode($_GET['id'])));			 
?>



<!-- 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="index.html">Dashboard</a></li>
                <?php if($pge_cad_id==1){ ?>
                <li><a href="javascritp:">Render Image Add</a></li>
                <?php } else if($pge_cad_id==2){ ?>
                <li><a href="javascritp:">Cad Finish Image Add</a></li>
                <?php } ?>
                
            </ul>
        </div>        
        <?php include "menus/top_left_menu.php"; ?>  
    </div>
    
    <!-- Main content -->
    <div class="wrapper">
	<?php if($check_acc==1){ ?>
        <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_list.php" id="listpage" title="List Design" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
        </ul>
    	
        <div class="fluid" style="width:800px; margin-left:50px;">
            <form id="validate" name="fm_cat" class="main" method="post" action="bl/design_BL.php?page_id=<?php echo $page_id; ?>" enctype="multipart/form-data">
			<input type="hidden" name="ot" id="ot" value="<?php echo $ot; ?>">
                <fieldset>
                
                	<div class="widget">
                        <div class="whead">
                        <?php if($pge_cad_id==1){ ?>
                        <h6>Render Image Add</h6>
                        <?php } else if($pge_cad_id==2){ ?>
                       <h6>Cad Finish Image Add</h6>
                        <?php } ?>
                        <div class="clear"></div></div>
                        <input type="hidden" class="" name="page_cat_id" id="page_cat_id" value="<?php echo $pge_cad_id; ?>" readonly="readonly" style="width:250px"/>
                		<div class="formRow">
                            <div class="grid3"><label>Select Design No:<span class="req">*</span></label></div>
                            <div class="grid6 searchDrop" id="cat_name_div">
                                <select  data-placeholder="" class="select" name="design_no" id="design_no" style="width:250px;" onchange="des_sts();" onfocus="foc(this.id)" onblur="stnon(this.id)">
                                    <option value="">Choose a Design No...</option>
                                    <?php
									if($pge_cad_id==1)
									{
										$SLCT = "SELECT * FROM design_det WHERE mas_fin_ext='' and up_status!='yes' ORDER BY design_det_id ASC";
									}
									else
									{
										$SLCT = "SELECT * FROM design_det WHERE cad_fin_ext='' and up_status!='yes' ORDER BY design_det_id ASC";
									}
									//echo $SLCT;
									$QURY = mysqli_query($connect,$SLCT);
									while($FTCH = mysqli_fetch_object($QURY))
									{	
										$SLCT_cat = "SELECT  * FROM master_cat WHERE master_cat_id='$FTCH->master_cat_id'";
										//echo $SLCT_cat;
										$QURY_cat = mysqli_query($connect,$SLCT_cat);
										$FTCH_cat = mysqli_fetch_object($QURY_cat);								
									?>
                                    <option value="<?php echo $FTCH->design_det_id ?>"><?php echo $FTCH_cat->master_cat_name ." ". $FTCH->design_no ?></option>
                                    <?php
									}
									?>
                                        
                                </select>
                                
                            </div>                            
                            <div class="clear"></div>
                        </div>
                        
                    	<div class="formRow">
                            <div class="grid3"><label>Design Status:<span class="req">*</span></label></div>
                            <div class="grid2"><input type="text" class="" name="d_sts" id="d_sts" readonly="readonly" style="width:250px ;background-color:#CCC"/>&nbsp;<div id="dajax_lo"></div></div><div class="clear"></div>
                        </div>
                        
                        <div class="formRow">
                            <div class="grid3">
                            <?php if($pge_cad_id==1){ ?>
                            <label>Image For Master Finishing:<span class="req">*</span></label>
                            <?php } else if($pge_cad_id==2){ ?>
                           	<label>Image For Cad Finishing:<span class="req">*</span></label>
                            <?php } ?>
                            
                            </div>
                            <div class="grid4" id="imgInp_div" style="width:257px">
                                <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="clear"></div>
                        </div>
                        
                        <div class="formRow">
                        <input type="button" value="Submit" class="buttonM bBlack formSubmit" onclick="fom_cat_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>
		<?php } else {  echo ACCESS_MSG;} ?>
    </div>
</div>
<!-- Content ends -->    
        
</body>
</html>