<script src="js/ajax.js" type="text/javascript"></script>
<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title"><?php if($isEdit){ echo 'Edit Expense';} else { echo 'Add Expense'; }?></div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.html">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=project_expenses&id=<?php echo $projectId; ?>">Expenses</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Expense</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header><?php if($isEdit){ echo 'Edit Expense';} else { echo 'Add Expense'; } echo ' of '.getProjectName($projectId);?></header>                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	
                                	<?php if(isset($error) && $error!='') { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo urldecode($_REQUEST['success']); ?></div>
                                	<?php } ?>
                                	                                	
                                    <form action="" id="form_staff_add" class="form-horizontal" method="post">
                                        <div class="form-body">
                                        	                                        	 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Select Category</label>
                                                <div class="col-md-4">                                                    
                                                    <select name="category" id="category" class="form-control" >
                                                    	<option value="">--Select Category--</option>
											              <?php if(mysqli_num_rows($projTypeRs)>0){
											              	while($projTypeRec = mysqli_fetch_array($projTypeRs)){ ?>
											              	<option value="<?php echo $projTypeRec['id']; ?>" <?php if(isset($_POST['category']) && $_POST['category']==$projTypeRec['id']) { echo 'selected="selected"'; } else if(isset($resEdit['cat_id']) && $resEdit['cat_id']==$projTypeRec['id']){ echo 'selected="selected"'; } ?> ><?php echo $projTypeRec['name']; ?></option>
											              <?php } } ?>
										            </select>
                                                </div>
                                            </div>        
                                            <?php if(!$isEdit){ ?>                                    
                                            <div class="form-group row">
                                                <label class="control-label col-md-3"><b>OR</b></label>                                                
                                            </div>                                            
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Enter New Category</label>
                                                <div class="col-md-4">                                                                                                                                                                   
                                                        <input name="new_category" type="text" id="new_category" class="form-control" value="<?php if(isset($_POST['new_category'])) { echo htmlentities(($_POST['new_category']), ENT_QUOTES); } ?>" />
                                                </div>
                                            </div>
                                            <?php } ?>
                                            
                                            <div class="form-group row">
	                                            <label class="col-md-3 control-label">Select Date<span class="required"> * </span></label>
	                                            <div class="input-group date form_date col-md-4" data-date="<?php if(isset($expDate)){ echo $expDate; } ?>" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
	                                                <input class="form-control" size="16" value="<?php if(isset($expDate)){ echo $expDate; } ?>" type="text">
	                                                <span class="input-group-addon"><span class="fa fa-remove"></span></span>
	                                                <span class="input-group-addon"><span class="fa fa-calendar"></span></span>
	                                            </div>
	                                            <input name="exp_date" id="dtp_input2" value="<?php if(isset($_POST['exp_date'])){ echo $_POST['exp_date']; } else if(isset($expDate) && $expDate!=''){ echo $expDate;}?>" type="hidden">
	                                            <br>
	                                        </div>
	                                        
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Enter Amount<span class="required"> * </span></label>
                                                <div class="col-md-4">                                                                                                                                                                   
                                                        <input name="amount" type="text" id="amount" class="form-control" value="<?php if(isset($_POST['amount'])) { echo htmlentities(($_POST['amount']), ENT_QUOTES); } else if(isset($resEdit['amount']) && $resEdit['amount']!=''){ echo $resEdit['amount'];} ?>" />
                                                </div>
                                            </div>                                                                                      
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Description</label>
                                                <div class="col-md-4">        
                                                	<textarea name="description" id="description"><?php if(isset($_POST['description'])) { echo htmlentities(($_POST['description']), ENT_QUOTES); } else if(isset($resEdit['description']) && $resEdit['description']!=''){ echo $resEdit['description'];} ?></textarea>                                            
                                                </div>
                                            </div>
                                            
                                        </div>                                        
                                      	<div class="form-group">
                                            <div class="offset-md-3 col-md-9">
                                            	<?php if($isEdit){ ?>
                                            		<button type="submit" name="update" class="btn btn-info">Update</button>
                                            	<?php } else { ?>
                                            		<button type="submit" name="add" class="btn btn-info">Submit</button>
                                            	<?php } ?>                                                                                                
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
	</div>
</div>
