<?php
	include(''. $config['LocalPath'] . '/includes/.sql_con.php');


if(isset($_POST['asset'])){

	$new_asset_type=$_POST['asset'];

		$insert_asset_type ="INSERT INTO `ASSET_TYPE` (TYPE) VALUES ('$new_asset_type')";
			mysql_query($insert_asset_type)or die ('Add Failed</br>'.mysql_error());
}
?>

<div class="row">
	<div class="col-lg-6  col-md-6  col-sm-6  col-xs-6">
		<div class="card card-mini">
			<div class="card-header">
				<div class="card-title"><b><center>Add Asset Type</center></b></div>
			</div>
		<div class="card-body">

			<form class="form form-horizontal" method="post" id="form">
				<div class="form-group">
					<label class="col-md-3 control-label"><b>Asset Type</b></label>
					<div class="col-md-5">
						<input type="text" name="asset" class="form-control" placeholder="Building">
					</div>
				</div>
		<!--<div class="form-group">
			<div class="col-md-3">
				<label class="control-label"><b>Customer ID</b></label>
			</div>
			<div class="col-md-5">
				<input type="text"  name="custid" class="form-control" placeholder="123456">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-3 control-label"><b>Asset Name</b></label>
			<div class="col-md-5">
					<input type="text" name="servname" class="form-control" placeholder="Device.hostirian.com">
			</div>
		</div>-->
		<!--<div class="form-group">
			<label class="col-md-3 control-label">Type</label>
			<div class="col-md-9">
				<div class="radio radio-inline">
					<input type="radio" name="radio4" id="radio10" value="option10">
					<label for="radio10">
					Global
					</label>
				</div>
				<div class="radio radio-inline">
					<input type="radio" name="radio4" id="radio11" value="option11" checked>
					<label for="radio11">
					Local
					</label>
				</div>
			</div>
		</div>-->
		<!--<div class="form-group">
			<label class="col-md-3 control-label"><b>Asset Type</b></label>
			<div class="col-md-5">
				<div class="input-group">
					<select class="select2" name="asset_type">
					<option value="0">Please Selet Asset Type</option>
							<?php 
						$asset_type_fetch=mysql_query("SELECT ID, TYPE FROM ASSET_TYPE");

						while ($assetrow = mysql_fetch_array($asset_type_fetch)){
							$asset_type= $assetrow['TYPE'];
						        $asset_type_id = $assetrow['ID'];
        						?>
							<option value="<?php echo $asset_type_id;?>"><?php echo $asset_type;?></option>
						<?php
						}
						?>


					</select>
				</div>
			</div>
		</div>-->
		<div class="form-footer">
			<div class="form-group">
				<div class="col-md-5 col-md-offset-3">
					<center>	<button type="submit" class="btn btn-primary">Add Asset Type</button>
					<button type="button" class="btn btn-default" onclick="resetForm()">Clear</button> </center>
						<script>
							function resetForm() {
							document.getElementById("form").reset();
							}
						</script>
				</div>
			</div>
		</div>
	</form>
	</div>
</div>
<!--</div>-->
<!--</div>-->
</div>
<div class="row">
	<!--<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">-->
	<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
		<div class="card card-mini">
      <div class="card-header">
        <div class="card-title"><b><center>Active Asset Types</center></b></div>
        <ul class="card-action">
          <li>
            <a href="#" onClick="MyFunction();">
              <i class="fa fa-refresh"></i>
            </a>
		<script>
			function MyFunction() {
				location.reload();
			}
		</script>
          </li>
        </ul>
      </div>
      <div class="card-body no-padding table-responsive">
        <table class="table card-table">
          <thead>
            <tr>
              <th><b>Asset Type</b></th>
            </tr>
          </thead>
          <tbody>
<?php


$asset_type_result = mysql_query('SELECT TYPE FROM ASSET_TYPE');

while ($row=mysql_fetch_array($asset_type_result)){
        $asset_type=$row['TYPE'];
        


?>
            <tr>
              <td><?php echo $asset_type;?></td>
            </tr>
<?php
}
?>
          </tbody>
        </table>
      </div>
    </div>

	</div>
</div>	
