<?php

/* 
 * Author       : Kowsalya K
 * Purpose      : The add page for Member Subscription
 * Created On   : 2016-08-03   
 */
?>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/billing/member_subscription.js"></script>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color"><a href="<?php echo get_bill_list_url(); ?>" 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" id="main-content">
            <div class="col-xs-12">
                <form action="<?php echo $form_action;?>" name="member_subscript" method="post"  enctype="multipart/form-data" method="post" onsubmit="return autoValidate();">
                    <input type="hidden" name="hidden_id" value="" />
                    <input type="hidden" name="service_type_id" value="<?php echo $service_type_id;?>" />
                    <div class="box box-danger">
                        <div class="box-body">
                            <ul class="error_container"></ul>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <div class="form-group float-clear">
                                        <label>Receipt No</label>
                                        <input type="text" class="form-control readonly" name="rec_no" placeholder="Auto Generated" readonly />
                                    </div>
                                                           
                                    <div class="form-group">
                                        <label>Type<span class="required">*</span></label>
                                        <div class="input-group">
                                            <select name="service_type" class="form-control select2 req" data-err-target=".sub-title">
                                                <option value="">-- Select Type --</option>
                                                <?php foreach($service_type as $key=>$type) {?>
                                                    <option value="<?php echo $type->id;?>"><?php echo $type->name;?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>    
                                    
                            <div class="col-xs-12 blck">
                                <div class="sub-title" ><h4><i class="fa fa-fire" style="font-size: 14px;"></i> Member Details</h4><i class="ctrl opener opened fa fa-chevron-up" style="float: right; margin-top: -25px;"></i></div>
                                <div class="blck-content col-xs-12">
                                    <div class="col-md-6">        
                                        <div class="form-group">
                                            <label>Member Name<span class="required">*</span></label>
                                            <div class="input-group">
                                                <input type="text" class="form-control req name" name="member_name" placeholder="Member Name" data-err-target=".sub-title" />
                                            </div>
                                        </div>
                                        
                                        <div class="form-group m-h30">
                                            <label class="leftcol">Entry Fee</label>
                                            <div>
                                                <label for="entry_fee" style="width: 32%;"><input type="radio" name="entry_fee" value="1" /> &nbsp;&nbsp;Yes</label> 
                                                <label for="entry_fee" style="width: 32%;"><input type="radio" name="entry_fee" value="0" checked /> &nbsp;&nbsp;No</label>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Member No</label>
                                            <input type="text" class="form-control" name="member_no" placeholder="Member No" data-err-target=".sub-title" />
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Date of Birth</label>
                                                <div class="input-group">
                                                <input type="text" class="form-control date-picker" name="dob" placeholder="DD-MM-YYYY" data-err-target=".sub-title" />
                                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group">
                                            <label>Maritial Status</label>
                                            <div class="input-group">
                                                <select name="maritial_status" class="form-control select2">
                                                    <option value="">-- Select Maritial Status --</option>
                                                    <option value="1">Single</option>
                                                    <option value="2">Married</option>
                                                </select>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group">
                                            <label>Email Id</label>
                                            <div class="input-group">
                                                <input type="text" class="form-control email" name="email" placeholder="Email Id" data-err-target=".sub-title" />
                                                <div class="input-group-addon"><i class="fa fa-envelope"></i></div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Date of Joining</label>
                                                <div class="input-group">
                                                <input type="text" class="form-control date-picker" name="date_join" placeholder="DD-MM-YYYY" data-err-target=".sub-title" />
                                                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Description</label>
                                            <textarea class="form-control" name="desc"></textarea>
                                        </div>

                                    </div>

                                    <div class="col-md-6">                                    
                                         <div class="form-group">
                                            <label>Member Name (T)</label>
                                            <div class="input-group">
                                                <input class="form-control multi tamil-name input-tamil" type="text" name="tamil_member_name" placeholder="jkpH;bgah;" onclick="set_tamil_keypad(this);" />
                                                <div class="input-group-addon"><i class="fa fa-keyboard-o"></i></div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear entry_fee_amount" style="display:none;">
                                            <label>Entry Fee Amount</label>
                                            <div class="input-group">
                                                <div class="input-group-addon">$</div>
                                                <input type="text" class="form-control float_value amount num-pad" name="fee_amount" />
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Contact No</label>
                                            <div class="input-group">
                                                <input type="text" class="form-control contact-no num-pad" name="contact_no" placeholder="Contact No" data-err-target=".sub-title" />
                                                <div class="input-group-addon"><i class="fa fa-phone"></i></div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label class="leftcol">Sex</label>
                                            <div>
                                                <label for="sex" style="width: 32%;"><input type="radio" class="" name="sex" value="1" data-err-target=".sub-title" /> &nbsp;&nbsp;Male</label> 
                                                <label for="sex" style="width: 32%;"><input type="radio" name="sex" value="2" /> &nbsp;&nbsp;Female</label>
                                            </div>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Address</label>
                                            <textarea class="form-control address" name="address" data-err-target=".sub-title"></textarea>
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Postal Code</label>
                                            <input type="text" class="form-control" name="postal_code" placeholder="Postal Code" data-err-target=".sub-title" />
                                        </div>
                                        
                                        <div class="form-group float-clear">
                                            <label>Amount</label>
                                            <input type="text" class="form-control amount num-pad" name="amount" placeholder="0.00" />
                                            <input type="hidden" class="form-control float_value" name="hidden_amount" readonly placeholder="0.00" />
                                        </div>
                                        
                                        
                                    </div>
                                </div> <!-- blck-content -->    
                            </div> <!-- blck -->
                        </div>
                        
                        <div class="box-footer form-actions float-clear" style="text-align: right; padding-right: 30px;">
                            <button class="btn btn-primary" type="reset" id="clrbtn"><i class="fa fa-trash"></i> Clear</button>
                            <button type="button" class="btn btn-danger" id="payment-btn" disabled><i class="fa fa-credit-card"></i> Payment</button>
                        </div>
                    </div><!-- /.box -->
                    
                    <!-- Payment types Modal -->
                    <div class="modal fade" id="ptypes-dialog" role="dialog">
                        <div class="modal-dialog">
                            <!-- Modal content-->
                            <div class="modal-content">
                                    <div class="modal-header" style="background-color: #337AB7;">
                                        <h4 class="modal-title" style="color: #FFF;">Payment Details</h4>
                                    </div>
                                    <div class="modal-body col-xs-12">
                                        <div class="err-blck" style="margin-top: -20px;"></div>
                                        <div class="row" id="pay-amounts-box">

                                            <div class="col-md-6">                                    
                                                <div class="form-group float-clear">
                                                    <label>Amount To Pay</label>
                                                    <input type="text" class="form-control readonly" name="pay_amount" placeholder="0.00" readonly />
                                                </div>
                                            </div>

                                            <div class="col-md-6">                                    
                                                <div class="form-group float-clear">
                                                    <label>Now Paying</label>
                                                    <input type="text" class="form-control readonly" name="paid_amount" placeholder="0.00" readonly />
                                                </div>
                                            </div>

                                        </div>

                                        <div class="row" id="cheque-box" style="display: none;">
                                            <div class="col-xs-4">                                    
                                                <div class="form-group float-clear">
                                                    <label>Bank Name</label>
                                                    <input type="text" class="form-control input"  name="chq_bnk_name" placeholder="Bank Name" value=""/>
                                                </div>
                                            </div>
                    
                                            <div class="col-xs-4">                                    
                                                <div class="form-group float-clear">
                                                    <label>No</label>
                                                    <input type="text" class="form-control input"  name="chq_no" placeholder="No" value=""/>
                                                </div>
                                            </div>
                                            
                                            <div class="col-xs-4">                                    
                                                <div class="form-group float-clear">
                                                    <label>Date</label>
                                                    <input type="text" class="form-control input date-picker"  name="chq_date" placeholder="dd/mm/YYYY" value="<?php echo date('d-m-Y');?>"/>
                                                </div>
                                            </div>
                    
                                        </div>                                        
                                        
                                        <div style="margin-top: 10px; border-top: 1px dotted #1ba; padding: 20px 0px;">
                                            <div class="row">
                                                <?php
                                                    $step = 4;
                                                    foreach( $payments as $k => $ptype ) :

                                                        echo '<div class="col-md-'. floor( 12 / $step ) .'">';
                                                        ?>
                                                        <div class="form-group float-clear blck-content ptype-box" id="ptype-box-<?php echo $ptype->slug; ?>" style="margin: 10px 10px;">
                                                            <div class="pay-box">
                                                                <?php if( !empty( $ptype->img_url ) && file_exists( DIR_PAY_TYPE . $ptype->img_url ) ) : ?><div id="pay-preview"><img src="<?php echo BASE_URL . DIR_PAY_TYPE . $ptype->img_url; ?>" /></div><?php endif; ?>
                                                                <label><?php echo $ptype->name; ?></label>
                                                            </div>
                                                            <input type="text" class="input pay-type amount num-pad" data-id="<?php echo $ptype->id; ?>" name="pay_type[<?php echo $ptype->id; ?>]" value="" />
                                                        </div>
                                                        <?php
                                                        echo '</div>';

                                                        if( ($k+1) % $step == 0 ) :
                                                            echo '</div><div class="row">';
                                                        endif;

                                                    endforeach;
                                                ?>
                                            </div>
                                        </div>
                                        

                                    </div>

                                    <div class="modal-footer" style="padding-right: 30px;">
                                        <button type="button" class="btn btn-primary cancel_popup" id="sbmt-cancel-btn" data-dismiss="modal"><i class="fa fa-chevron-left"></i> Go Back</button>
                                        <button type="submit" id="sbmt-btn" class="btn btn-danger"><i class="fa fa-floppy-o"></i> Submit</button>
                                        
                                    </div>
                                

                            </div>   <!-- Modal Content -->     
                        </div> 
                    </div> <!-- Payment Types Dialog -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>


