
<script>
    $(document).ready(function ($) {
        $('#add-new-service-form').submit(function(e){
            e.preventDefault();
            var ServiceID = $("#add-new-service-form [name='LateFeeID']").val()
            if( typeof ServiceID != 'undefined' && ServiceID != ''){
                update_new_url = baseurl + '/latefee/update/'+ServiceID;
            }else{
                update_new_url = baseurl + '/latefee/store';
            }

            showAjaxScript(update_new_url, new FormData(($('#add-new-service-form')[0])), function(response){
                $(".btn").button('reset');
                if (response.status == 'success') {
                    $('#add-new-modal-service').modal('hide');
                    toastr.success(response.message, "Success", toastr_opts);										
					var ServiceRefresh = $("#ServiceRefresh").val()
                    data_table.fnFilter('',0);     
                }else{
                    toastr.error(response.message, "Error", toastr_opts);
                }
            });
        })
    });
</script>

<?php $__env->startSection('footer_ext'); ?>
    @parent
    <div class="modal fade" id="add-new-modal-service">
        <div class="modal-dialog">
            <div class="modal-content">
                <form id="add-new-service-form" method="post">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Add New Late Fee</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Late Fee Name</label>
                                    <input type="text" name="Name" class="form-control" id="field-5" placeholder="">
									<input type="hidden" name="LateFeeID" >
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Type</label>
									<?php echo Form::select('Type',['' => 'Select' , 'Fixed' => 'Fixed' , 'Percentage' => 'Percentage'],'', array("class"=>"select2")); ?>

                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Value</label>
									<input type="text" class="form-control" name="Value">
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Late Fee Apply</label>
									<?php echo Form::select('LateFeeApply',['' => 'Select' , 'Daily' => 'Daily' , 'Weekly' => 'Weekly' ,'Once' => 'Once' , 'Monthly' => 'Monthly' , '15 Days' => '15 Days'],'', array("class"=>"select2")); ?>

                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Active</label>
                                    <div class="make-switch switch-small">
										<input type="checkbox" name="Status" checked="" value="1">
									</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" id="Service-update"  class="save btn btn-primary btn-sm btn-icon icon-left" data-loading-text="Loading...">
                            <i class="entypo-floppy"></i>
                            Save
                        </button>
                        <button  type="button" class="btn btn-danger btn-sm btn-icon icon-left" data-dismiss="modal">
                            <i class="entypo-cancel"></i>
                            Close
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>