<?php

/* 
 * Author       : Jai K
 * Purpose      : The add page for Expense
 * Created On   : 2017-01-25 16:05    
 */
?>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color"><a href="<?php echo base_url() . $controller; ?>" class="list-btn"><i class="fa fa-list" title="Go to Listing"></i></a><?php echo $title; ?> - Add</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <form action="<?php echo $form_action;?>" method="post" enctype="multipart/form-data" onsubmit="return validate(this);">    
                    <input type="hidden" name="token" value="<?php echo $token; ?>" />    
                    <div class="box box-danger">
                        <div class="box-body">
                            <?php if( !empty( $success ) || !empty( $error ) ) : ?>
                                <div class="alert alert-<?php echo !empty( $success ) ? 'success' : 'danger'; ?> alert-dismissable">
                                    <i class="fa fa-thumbs-o-<?php echo !empty( $success ) ? 'up' : 'down'; ?>"></i>
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><?php echo !empty( $success ) ? $success : $error; ?></h4>
                                </div>
                            <?php endif; ?>
                            
                            <ul class="error_container"></ul>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <div class="form-group float-clear">
                                        <label>Ref. No</label>
                                        <input type="text" class="form-control readonly" name="exp_rec_no" placeholder="Auto Generated" readonly />
                                    </div>
                                    
                                    <!--<div class="form-group float-clear">
                                        <label>Type<span class="required">*</span></label>
                                        <select name="exp_type" class="form-control select2 req">
                                            <option value="">-- Select Expense Type --</option>
                                            <option value="add" style="color: #f33;">-- Add New --</option>
                                                <?php 
                                                    foreach( $exp_types as $k => $exp_type ) :
                                                        ?>
                                                            <option value="<?php echo $exp_type['exp_type_slug']; ?>"><?php echo $exp_type['exp_type']; ?></option>
                                                        <?php
                                                    endforeach;
                                                ?>
                                        </select>
                                    </div>-->
                                    
                                    <div class="form-group float-clear">
                                        <label>Type<span class="required">*</span></label>
                                        <select name="exp_type" class="form-control select2 req">
                                            <option value="">-- Select Expense Type --</option>
                                            <?php foreach($expense_types as $key => $types) {?>
                                                <option value="<?php echo $types->id;?>"><?php echo $types->type_name;?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    
                                    <div class="form-group float-clear" id="exp-type-add" style="display: none;">
                                        <label>&nbsp;</label>
                                        <input type="text" class="form-control" name="exp_type_add" placeholder="New Type" />
                                    </div>
                                    
                                    
                                    <div class="form-group float-clear">
                                        <label>Subject<span class="required">*</span></label>
                                        <select name="exp_sub" class="form-control select2 req">
                                            <option value="">-- Select Expense Subject --</option>
                                            <option value="add" style="color: #f33;">-- Add New --</option>
                                        </select>
                                    </div>
                                    
                                    <div class="form-group float-clear" id="exp-sub-add" style="display: none;">
                                        <label>&nbsp;</label>
                                        <input type="text" class="form-control" name="exp_sub_add" placeholder="New Subject" />
                                    </div>
                                    
                                    <div class="form-group float-clear">
                                        <label>Name<span class="required">*</span></label>
                                        <input type="text" class="form-control req" name="exp_name" placeholder="Expense Name" autofocus />
                                    </div>
                                    
                                    <div class="form-group float-clear deposit_mode" style="display:none;">
                                        <label>Mode<span class="required">*</span></label>
                                        <select name="mode" class="form-control select2">
                                            <option value="">-- Select Mode --</option>
                                                <option value="1">Cash</option>
                                                <option value="2">Cheque</option>
                                        </select>
                                    </div>
                                    
                                    <div class="cheque_details" style="display:none;">
                                        <div class="form-group float-clear">
                                            <label>Cheque No<span class="required">*</span></label>
                                            <input type="text" class="form-control num-pad" name="cheque_no" />
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="col-md-6">
                                    <div class="form-group float-clear">
                                        <label>Date<span class="required">*</span></label>
                                        <div class="input-group">
                                            <input type="text" class="form-control date-picker req" name="exp_date" placeholder="dd/mm/yyyy" value="<?php echo date("d-m-Y"); ?>" />
                                            <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                        </div>
                                    </div>
                                    
                                    <div class="form-group float-clear">
                                        <label>Amount</label>
                                        <input type="text" class="form-control amount num-pad" name="exp_amount" placeholder="0.00" />
                                    </div>
                                    
                                    <div class="form-group float-clear">
                                        <label>Description</label>
                                        <textarea class="form-control" name="exp_desc"></textarea>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label class="leftcol">Status</label>
                                        <div>
                                            <label for="status" style="width: 32%;"><input type="radio" name="status" value="1"  checked /> &nbsp;&nbsp;Active</label> 
                                            <label for="status" style="width: 32%;"><input type="radio" name="status" value="0" /> &nbsp;&nbsp;Inactive</label> 
                                        </div>
                                    </div>
                                    <div class="cheque_details" style="display:none;">
                                        <div class="form-group float-clear">
                                            <label>Bank Name<span class="required">*</span></label>
                                            <input type="text" class="form-control" name="cheque_bank" />
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Cheque Date<span class="required">*</span></label>
                                            <div class="input-group">
                                                <input type="text" class="form-control date-picker" name="cheque_date" placeholder="dd/mm/yyyy" value="<?php echo date("d-m-Y"); ?>" />
                                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="box-footer form-actions float-clear">
                            <input class="btn reset" type="reset" value="Reset" />
                            <input type="submit" name="submit" value="Save" class="btn btn-success btn-primary" />
                        </div>
                    </div><!-- /.box -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>
<script type="text/javascript" src="<?php echo BASE_URL;  ?>assets/js/expenses.js"></script>
