<?php $__env->startSection('filter'); ?>

    <?php if(User::checkCategoryPermission('AccountService','View')) { ?>
    <div id="datatable-filter" class="fixed new_filter" data-order-by-status="1" data-max-chat-history="25">
        <div class="filter-inner">
            <h2 class="filter-header">
                <a href="#" class="filter-close" data-animate="1"><i class="entypo-cancel"></i></a>
                <i class="fa fa-filter"></i>
                Filter
            </h2>
            <form id="oneofcharge_filter" method="get" action="#" class="form-horizontal form-groups-bordered validate" >
                <div class="form-group">
                    <label for="field-1" class="control-label">Account</label>
                    <?php echo Form::select('AccountID', $accounts, $id, array("id"=>"filter_AccountID",
                    "class"=>"select2 filter_AccountID","data-allow-clear"=>"true","data-placeholder"=>"Select Account")); ?>

                </div>
                <div class="form-group">
                    <label for="field-1" class="control-label">Service</label>
                    <?php echo Form::select('ServiceID', $services,'', array("class"=>"select2","data-allow-clear"=>"true","data-placeholder"=>"Select Service")); ?>

                </div>
                <div class="form-group">
                    <label for="field-1" class="control-label">Item</label>
                    <?php echo Form::select('OneOfCharge_ProductID',$products,'',array("class"=>"select2 OneOfCharge_product_dropdown")); ?>

                </div>
                <div class="form-group">
                    <label for="field-1" class="control-label">Description</label>
                    <input type="text" name="OneOfCharge_Description" class="form-control" value="" />
                </div>
                <div class="form-group">
                    <label for="field-1" class="control-label">Date</label>
                    <input type="text" name="OneOfCharge_Date" class="form-control datepicker"  data-date-format="yyyy-mm-dd" value=""   />
                </div>
                <div class="form-group">
                    <br/>
                    <button type="submit" class="btn btn-primary btn-md btn-icon icon-left" id="oneofcharge_submit">
                        <i class="entypo-search"></i>
                        Search
                    </button>
                </div>
            </form>
        </div>
    </div>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
    <ol class="breadcrumb bc-3">
        <li> <a href="<?php echo URL::to('dashboard'); ?>"><i class="entypo-home"></i>Home</a> </li>
        <li class="active"> <strong>Account Additional Charges</strong> </li>
    </ol>
    <h3>Account Additional Charges</h3>
    <?php echo $__env->make('includes.errors', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <?php echo $__env->make('includes.success', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <div class="clear"></div>
    <div class="text-right"> <a  id="add-oneofcharge" class=" btn btn-primary btn-sm btn-icon icon-left"><i class="entypo-plus"></i>Add New</a>
        <div class="clear clearfix"><br>
        </div>
    </div>
    <table id="table-oneofcharge" class="table table-bordered datatable">
        <thead>
        <tr>
            <th width="10%">Account</th>
            <th width="5%">Service</th>
            <th width="5%">Item</th>
            <th  width="10%">Description</th>
            <th width="5%">Qty</th>
            <th width="5%">Price</th>
            <th width="5%">Date</th>
            <th width="8%">Tax Amount</th>
            <th width="15%">Created Date</th>
            <th width="10%">Created By</th>
            <th width="20%">Action</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <script type="text/javascript">
        var decimal_places = '<?php echo $decimal_places; ?>';
        /**
         * JQuery Plugin for dataTable
         * */
        //var list_fields_activity  = ['OneOfCharge_ProductID','OneOfCharge_Description'];
        $("#oneofcharge_filter [name=AccountID]").val('');
        $("#oneofcharge_filter [name=ServiceID]").val('');
        $("#oneofcharge_filter [name=OneOfCharge_ProductID]").val('');
        $("#oneofcharge_filter [name=OneOfCharge_Description]").val('');
        $("#oneofcharge_filter [name=OneOfCharge_Date]").val('');
        var data_table_char;
        var account_id='<?php echo $id; ?>';
        account_id = account_id != "" ? account_id : 0;
        var update_new_url;
        var postdata;
        var $search = {};

        jQuery(document).ready(function ($) {
            $('#filter-button-toggle').show();
            var data_table_char;
            var list_fields  = ["AccountName","ServiceName","Name","Description", "Qty" ,"Price","Date","TaxAmount", "created_at",
                "CreatedBy","AccountOneOffChargeID","ProductID","TaxRateID","TaxRateID2","DiscountAmount","DiscountType","AccountID","ServiceID"];

            var oneofcharge_add_url = baseurl + "/accounts/{AccountID}/oneofcharge/store";
            var oneofcharge_datagrid_url = baseurl + "/account_oneofcharge/ajax_datagrid_page";
            var getProductInfo_url = baseurl + "/accounts/{AccountID}/oneofcharge/{id}/ajax_getproductinfo";

            $search.AccountID = $("#oneofcharge_filter [name=AccountID]").val();
            $search.ServiceID = $("#oneofcharge_filter [name=ServiceID]").val();
            $search.OneOfCharge_ProductID = $("#oneofcharge_filter [name=OneOfCharge_ProductID]").val();
            $search.OneOfCharge_Description = $("#oneofcharge_filter [name=OneOfCharge_Description]").val();
            $search.OneOfCharge_Date = $("#oneofcharge_filter [name=OneOfCharge_Date]").val();

            data_table_char = $("#table-oneofcharge").dataTable({
                "bDestroy": true,
                "bProcessing": true,
                "bServerSide": true,
                "sAjaxSource": oneofcharge_datagrid_url,
                "fnServerParams": function (aoData) {
                    aoData.push({"name": "account_id", "value": account_id},
                        {"name": "AccountID", "value": $search.AccountID},
                        {"name": "ServiceID", "value": $search.ServiceID},
                        {"name": "OneOfCharge_ProductID", "value": $search.OneOfCharge_ProductID},
                        {"name": "OneOfCharge_Description", "value": $search.OneOfCharge_Description},
                        {"name": "OneOfCharge_Date", "value": $search.OneOfCharge_Date});

                    data_table_extra_params.length = 0;
                    data_table_extra_params.push({"name": "account_id", "value": account_id},
                        {"name": "AccountID", "value": $search.AccountID},
                        {"name": "ServiceID", "value": $search.ServiceID},
                        {"name": "OneOfCharge_ProductID", "value": $search.OneOfCharge_ProductID},
                        {"name": "OneOfCharge_Description", "value": $search.OneOfCharge_Description},
                        {"name": "OneOfCharge_Date", "value": $search.OneOfCharge_Date},
                        { "name": "Export", "value": 1});

                },
                "bPaginate": true,
                "iDisplayLength": parseInt('<?php echo CompanyConfiguration::get('PAGE_SIZE'); ?>'),
                "sPaginationType": "bootstrap",
                "aaSorting": [[1, 'asc']],
                "sDom": "<'row'<'col-xs-6 col-left '<'#selectcheckbox.col-xs-1'>'l><'col-xs-6 col-right'<'export-data'T>f>r>t<'row'<'col-xs-6 col-left'i><'col-xs-6 col-right'p>>",
                "aoColumns": [
                    {"bSortable": true},  // 1 account
                    {"bSortable": true},  // 2 service
                    {"bSortable": true},  // 3 Name
                    {"bSortable": true},  // 4 Description
                    {"bSortable": true},  // 5 Qty
                    {"bSortable": true},  // 6 Price
                    {"bSortable": true,   // 7 date
                        mRender: function (id, type, full) {
                            var ar = id.split(' ');
                            return ar[0];
                        }
                    },
                    {"bSortable": true},  // 8 Tax Amount
                    {"bSortable": true},  // 9 Created at
                    {"bSortable": true},  // 10 CreatedBy
                    {                        // 11 Action
                        "bSortable": false,
                        mRender: function (id, type, full) {
                            var edit_account = 0;
                            var oneofcharge_edit_url = baseurl + "/accounts/{AccountID}/oneofcharge/{id}/update";
                            var oneofcharge_delete_url = baseurl + "/accounts/{AccountID}/oneofcharge/{id}/delete";

                            action = '<div class = "hiddenRowData" >';
                            for (var i = 0; i < list_fields.length; i++) {
                                var str = '';
                                str = full[i];
                                if(list_fields[i]=='Date'){
                                    var ar = str.split(' ');
                                    str = ar[0];
                                }
                                action += '<input disabled type = "hidden"  name = "' + list_fields[i] + '"       value = "' + (full[i] != null ? str : '') + '" / >';
                                if(list_fields[i]=='AccountID'){
                                    edit_account = full[i];
                                }
                            }
                            oneofcharge_edit_url = oneofcharge_edit_url.replace("{id}",id);
                            oneofcharge_edit_url = oneofcharge_edit_url.replace("{AccountID}",edit_account);
                            oneofcharge_delete_url = oneofcharge_delete_url.replace("{id}",id);
                            oneofcharge_delete_url = oneofcharge_delete_url.replace("{AccountID}",edit_account);
                            action += '</div>';
                            action += ' <a href="' + oneofcharge_edit_url.replace("{id}", id) + '" title="Edit" class="edit-oneofcharge btn btn-default btn-sm"><i class="entypo-pencil"></i>&nbsp;</a>'
                            action += ' <a href="' + oneofcharge_delete_url.replace("{id}", id) + '" title="Delete" class="delete-oneofcharge btn btn-danger btn-sm"><i class="entypo-trash"></i></a>'
                            return action;
                        }
                    }
                ],
                "oTableTools": {
                    "aButtons": [
                        {
                            "sExtends": "download",
                            "sButtonText": "EXCEL",
                            "sUrl": oneofcharge_datagrid_url+"/xlsx", //baseurl + "/generate_xlsx.php",
                            sButtonClass: "save-collection btn-sm"
                        },
                        {
                            "sExtends": "download",
                            "sButtonText": "CSV",
                            "sUrl": oneofcharge_datagrid_url + "/csv", //baseurl + "/generate_csv.php",
                            sButtonClass: "save-collection btn-sm"
                        }
                    ]
                },
                "fnDrawCallback": function () {
                    $(".dataTables_wrapper select").select2({
                        minimumResultsForSearch: -1
                    });
                }
            });
            $("#oneofcharge_submit").click(function(e) {

                e.preventDefault();
                public_vars.$body = $("body");
                account_id = $("#oneofcharge_filter [name=AccountID]").val();
                $search.AccountID = $("#oneofcharge_filter [name=AccountID]").val();
                $search.ServiceID = $("#oneofcharge_filter [name=ServiceID]").val();
                $search.OneOfCharge_ProductID = $("#oneofcharge_filter [name=OneOfCharge_ProductID]").val();
                $search.OneOfCharge_Description = $("#oneofcharge_filter").find('[name="OneOfCharge_Description"]').val();
                $search.OneOfCharge_Date = $("#oneofcharge_filter").find('[name="OneOfCharge_Date"]').val();
                data_table_char.fnFilter('', 0);
                return false;
            });

            $('#oneofcharge_submit').trigger('click');
            //inst.myMethod('I am a method');
            $('#add-oneofcharge').click(function(ev){
                ev.preventDefault();
                $('#oneofcharge-form').trigger("reset");
                $('#oneofcharge-form .edit-hide-fields').prop('disabled', false).parent().parent().show();
                $('#oneofcharge-form .edit-show-fields').prop('disabled', true).hide();
                $('#modal-oneofcharge h4').html('Add Additional Charge');
                $("#oneofcharge-form [name=ProductID]").select2().select2('val',"");
                // $("#oneofcharge-form [name=ServiceID]").select2().select2('val',"");
                $("#oneofcharge-form [name='TaxRateID']").val(0).trigger("change");
                $("#oneofcharge-form [name='AccountID']").val(account_id).trigger("change");
                $("#oneofcharge-form [name='ServiceID']").val('').trigger("change");
                $("#oneofcharge-form [name='TaxRateID2']").val(0).trigger("change");
                $('.tax').removeClass('hidden');

                //console.log(account_id)
                $('#oneofcharge-form').attr("action",oneofcharge_add_url.replace("{AccountID}", account_id));
                $('#modal-oneofcharge').modal('show');
            });

            $('table tbody').on('click', '.edit-oneofcharge', function (ev) {
                ev.preventDefault();
                $('#oneofcharge-form').trigger("reset");
                var edit_url  = $(this).attr("href");
                $('#oneofcharge-form').attr("action",edit_url);
                $('#oneofcharge-form .edit-hide-fields').prop('disabled', true).parent().parent().hide();
                $('#oneofcharge-form .edit-show-fields').prop('disabled', false).show();
                $('#modal-oneofcharge h4').html('Edit Additional Charge');
                var cur_obj = $(this).prev("div.hiddenRowData");
                for(var i = 0 ; i< list_fields.length; i++){
                    $("#oneofcharge-form [name='"+list_fields[i]+"']").val(cur_obj.find("input[name='"+list_fields[i]+"']").val());
                    if(list_fields[i] == 'ProductID'){
                        $("#oneofcharge-form [name='"+list_fields[i]+"']").select2().select2('val',cur_obj.find("input[name='"+list_fields[i]+"']").val());
                    }else if(list_fields[i] == 'TaxRateID'){
                        $("#oneofcharge-form [name='"+list_fields[i]+"']").val(cur_obj.find("input[name='"+list_fields[i]+"']").val()).trigger("change");
                    }else if(list_fields[i] == 'TaxRateID2'){
                        $("#oneofcharge-form [name='"+list_fields[i]+"']").val(cur_obj.find("input[name='"+list_fields[i]+"']").val()).trigger("change");
                    }
                }
                $('#modal-oneofcharge').modal('show');
            });

            $('table tbody').on('click', '.delete-oneofcharge', function (ev) {
                ev.preventDefault();
                result = confirm("Are you Sure?");
                if(result){
                    var delete_url  = $(this).attr("href");
                    submit_ajax_datatable( delete_url,"",0,data_table_char);
                    //data_table_char.fnFilter('', 0);
                }
                return false;
            });

            $("#oneofcharge-form").submit(function(e){
                e.preventDefault();
                var _url  = $(this).attr("action");

                var submitBtn = $(this).find(".btn[type='submit']");
                var btnLoadingText = submitBtn.data('input-loading-text');
                var btnOldText = submitBtn.html();
                submitBtn.html(btnLoadingText).prop('disabled', true).addClass('disabled');
                var AccountID_add = $('#AccountID_add_change').val();
                if(AccountID_add == undefined || AccountID_add == false || AccountID_add == ""){
                    submitBtn.html(btnOldText).prop('disabled', false).removeClass('disabled');
                    toastr.error("The Account field is required", "Error", toastr_opts);
                    return false;
                }

                var ServiceID_add = $('#ServiceID_add_change').val();
                if(ServiceID_add == undefined || ServiceID_add == false || ServiceID_add == ""){
                    submitBtn.html(btnOldText).prop('disabled', false).removeClass('disabled');
                    toastr.error("The Service field is required", "Error", toastr_opts);

                    return false;
                }


                console.log(AccountID_add);
                console.log(ServiceID_add);

                /*tax1 start*/
                var option = $("#oneofcharge-form [name='TaxRateID'] option:selected");
                var Status = option.attr('data-status');
                var Amount = option.attr('data-amount');
                var TaxAmount1 = 0;
                var TotalPrice = parseFloat($('#oneofcharge-form [name="Price"]').val().replace(/,/g,'')) * parseInt($('#oneofcharge-form [name="Qty"]').val());
                if (Status == 1) {
                    TaxAmount1 = parseFloat(Amount);
                } else {
                    TaxAmount1 = (TotalPrice * Amount)/100;
                }
                /*tax1 end*/


                /*tax2 start*/
                var option2 = $("#oneofcharge-form [name='TaxRateID2'] option:selected");
                var Status2 = option2.attr('data-status');
                var Amount2 = option2.attr('data-amount');
                var TaxAmount2 = 0;
                var TotalPrice2 = parseFloat($('#oneofcharge-form [name="Price"]').val().replace(/,/g,'')) * parseInt($('#oneofcharge-form [name="Qty"]').val());
                if (Status2 == 1) {
                    TaxAmount2 = parseFloat(Amount2);
                } else {
                    TaxAmount2 = (TotalPrice2 * Amount2)/100;
                }
                /*tax2 end*/

                var tax_final  = 	parseFloat(TaxAmount1+TaxAmount2);

                $('#oneofcharge-form [name="TaxAmount"]').val(tax_final.toFixed(parseInt(decimal_places)));
                //submit_ajax_datatable(_url,$(this).serialize(),0,data_table_char);
                $.ajax({
                    url:_url, //Server script to process data
                    type: 'POST',
                    dataType: 'json',
                    success: function(response) {
                        submitBtn.html(btnOldText).prop('disabled', false).removeClass('disabled');
                        if (response.status == 'success') {
                            if(typeof response.warning != 'undefined' && response.warning != '') {
                                toastr.warning(response.warning, "Error", toastr_opts);
                            }
                            $('.modal').modal('hide');
                            toastr.success(response.message, "Success", toastr_opts);
                            if( typeof data_table_char !=  'undefined'){
                                data_table_char.fnFilter('', 0);
                            }

                        } else {
                            toastr.error(response.message, "Error", toastr_opts);
                        }

                    },
                    data: $(this).serialize(),
                    //Options to tell jQuery not to process data or worry about content-type.
                    cache: false
                });

                //data_table_char.fnFilter('', 0);
            });

            $("#oneofcharge-form [name='TaxRateID']").change(function(e) {
                check_same_tax();
            });

            $("#oneofcharge-form [name='TaxRateID2']").change(function(e) {
                check_same_tax();
            });

            function check_same_tax(){
                var tax1val = $("#oneofcharge-form [name='TaxRateID']").val();
                var tax2val = $("#oneofcharge-form [name='TaxRateID2']").val();
                if(tax1val > 0 &&  (tax1val == tax2val)){
                    toastr.error($("#oneofcharge-form [name='TaxRateID'] option:selected").text()+" already applied", "Error", toastr_opts);
                }
            }

            $(document).on("change","#AccountID_add_change",function(){
                var account_change = $(this).val();
                if(account_change){
                    $('#oneofcharge-form').attr("action",oneofcharge_add_url.replace("{AccountID}", account_change));
                }
            });


            $('#oneofcharge-form [name="ProductID"]').change(function(e){
                id = $(this).val();
                getProductinfo(id);
            });

            function getProductinfo(id){
                if(id>0) {
                    var url = getProductInfo_url.replace("{id}", id);
                    account_id = account_id == "" ? 0 : account_id;
                    url = url.replace("{AccountID}",account_id);
                    $.ajax({
                        url: url,  //Server script to process data
                        type: 'POST',
                        dataType: 'json',
                        success: function (response) {
                            $('#oneofcharge-form').find('[name="Description"]').val(response.Description);
                            $('#oneofcharge-form').find('[name="Price"]').val(response.Amount);
                        },
                        //Options to tell jQuery not to process data or worry about content-type.
                        cache: false
                    });
                }
            }

            function TotalPrice(){
                var total = $('#oneofcharge-form').find('[name="productPrice"]').val() * $('#oneofcharge-form').find('[name="Qty"]').val();
                $('#oneofcharge-form').find('[name="Price"]').val(total);
            }

            $(document).on("keypress",".Qty",function (event) {
                return isDecimal(event, this)
            });

        });

        function isDecimal(evt, element) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (
                //(charCode != 45 || $(element).val().indexOf('-') != -1) &&      // “-” CHECK MINUS, AND ONLY ONE.
                (charCode != 46 || $(element).val().indexOf('.') != -1) &&      // “.” CHECK DOT, AND ONLY ONE.
                (charCode < 48 || charCode > 57)
            ) {
                return false;
            }
            return true;
        }
    </script>

    <div class="modal fade in" id="modal-oneofcharge">
        <div class="modal-dialog">
            <div class="modal-content">
                <form id="oneofcharge-form" method="post">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Additional Charges</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">Account</label>
                                    <?php echo Form::select('AccountID',$accounts, '', array("class"=>"select2 dropdown1
                                    AccountID_add_change edit-hide-fields","id"=>"AccountID_add_change")); ?>

                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Service</label>
                                    <div>
                                        <?php echo Form::select('ServiceID',$services,'', array("class"=>"select2 dropdown1
                                            edit-hide-fields","id"=>"ServiceID_add_change")); ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">One of charge</label>
                                    <?php echo Form::select('ProductID',$products,'',array("class"=>"select2 product_dropdown")); ?>


                                    <input type="hidden" class="edit-show-fields" name="AccountOneOffChargeID" />
                                    <input type="hidden" class="edit-show-fields" name="TaxAmount" />
                                    <input type="hidden" class="edit-show-fields" name="ServiceID">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Description</label>
                                    <input type="text" name="Description" class="form-control" value="" />
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Qty</label>
                                    <input type="text" name="Qty" class="form-control Qty" value="1" data-min="1" />
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Date</label>
                                    <input type="text" name="Date" class="form-control datepicker"  data-date-format="yyyy-mm-dd" value=""   />
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Price</label>
                                    <input type="text" name="Price" class="form-control" value="0"   />
                                </div>
                            </div>
                        </div>
                        <div class="row tax">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Tax 1</label>
                                    <?php echo Form::SelectExt(
                                                [
                                                "name"=>"TaxRateID",
                                                "data"=>$taxes,
                                                "selected"=>'',
                                                "value_key"=>"TaxRateID",
                                                "title_key"=>"Title",
                                                "data-title1"=>"data-amount",
                                                "data-value1"=>"Amount",
                                                "data-title2"=>"data-status",
                                                "data-value2"=>"FlatStatus",
                                                "class" =>"select2 small TaxRateID",
                                                ]
                                        ); ?>

                                </div>
                            </div>
                        </div>

                        <div class="row tax">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Tax 2</label>
                                    <?php echo Form::SelectExt(
                                                [
                                                "name"=>"TaxRateID2",
                                                "data"=>$taxes,
                                                "selected"=>'',
                                                "value_key"=>"TaxRateID",
                                                "title_key"=>"Title",
                                                "data-title1"=>"data-amount",
                                                "data-value1"=>"Amount",
                                                "data-title2"=>"data-status",
                                                "data-value2"=>"FlatStatus",
                                                "class" =>"select2 small TaxRateID2",
                                                ]
                                        ); ?>

                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Discount</label>
                                    <input type="text" name="DiscountAmount" class="form-control" value=""  />
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="field-5" class="control-label">Discount Type</label>
                                    <?php echo Form::select('DiscountType', array('Flat' => 'Flat', 'Percentage' => 'Percentage') ,'', array("class"=>"form-control") ); ?>

                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary print btn-sm btn-icon icon-left"
                                data-input-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 } ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>