<?php

include('views/_header.tpl.php');

?>
<style>
	div.spacer {
		padding-top: 55px; 
	}
    .form .row-item .lbl { width: 60px; }
    
	.form .txt {
		max-width: 550px;
	}
	#mmen {
		display: none; 
	}
</style>

 <div class="home-feature-category" style="background:none; border:none; min-height:700px">
        <div class="container_12 clearfix">
        <div class="grid_12 marked-category">

		<h1><?php
		
		if ($cat) {
			echo "Edit";
			$def = "static/uploads/categories/placeholder.jpg";
		} else {
			echo "Add";
			$def = "static/uploads/categories/placeholder.jpg";
		}
		
		?> Category</h1>

		<form method="post" class="form form-profile" enctype="multipart/form-data" style="padding:25px 0px 0px;">
			<div class="row-item clearfix">
				<label class="lbl" for="txt_name1" style="text-align:left; margin-right:5px;">Image:</label>
                <div class="val" style="margin-left:0px; margin-bottom:10px;">
                	<img src="/<?php if($cat && $cat['image'] !='') { echo "" .$cat['image']. ""; } else { echo "" . $def . ""; } ?>" style="height:100px; width:auto;" onerror="this.src='/static/uploads/categories/placeholder.jpg'"/>
                    <p class="rs description-input"></p>
                </div>	
				<label class="lbl" for="txt_name1" style="text-align:left; margin-right:5px;">Name:</label>
                <div class="val" style="margin-left:0px;">
                	<input class="txt" type="text" name="title" value="<?= $cat['title'] ?>">
                    <p class="rs description-input"></p>
                </div>
                <label class="lbl" for="txt_name1" style="text-align:left; margin-right:5px;">Filename:</label>
                <div class="val" style="margin-left:0px;">
					<input class="txt" type="text" value="<?= $cat['image'] ?>" readonly style="background:#ccc;">
                    <p class="rs description-input"></p>
                </div>               
                <label class="lbl" for="txt_name1" style="text-align:left; margin-right:5px;">Image:</label>
                <div class="val" style="margin-left:0px;">
                    <input class="txt" type="file" name="image" >
                    <p class="rs description-input"></p>
                </div>					
            </div>
            <br />
            <input type="submit" style="font-weight:300" class="btn btn-black" /> 
            <input type="button" value="Cancel" class="btn btn-black" onclick="location = '/admin/'" />
            <br /><br />
			<a href="/admin/">&laquo; Go Back</a>
		</form>

		</div>
	</div>
</div>

<?php

include('views/_footer.tpl.php');

?>