<?php $this->load->view('site/layout'); ?>
<?php $this->load->view('site/navbar'); ?>

<!-- begin:: Content -->
<div class="kt-container  kt-container--fluid  kt-grid__item kt-grid__item--fluid">

    <div class="kt-portlet kt-portlet--mobile">
        <div class="kt-portlet__head kt-portlet__head--lg">
            <div class="kt-portlet__head-label">
                <span class="kt-portlet__head-icon">
                    <i class="kt-font-brand flaticon2-line-chart"></i>
                </span>
                <h3 class="kt-portlet__head-title">
                    <?php echo $this->lang->line('update'); ?>
                </h3>
            </div>

        </div>
        <div class="kt-portlet__body">
            <?php if ($this->session->flashdata('message')) { ?>
                <div class="alert alert-warning alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <strong>Alert!</strong> <?php echo $this->session->flashdata('message'); ?>
                </div>
            <?php } ?>

            <?php
            $message = validation_errors();

            if ($message) {
                ?>
                <div class="col-lg-12">
                    <div class="m-alert m-alert--outline alert alert-danger" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button>
                        <strong>
                            <?php echo $message; ?>
                        </strong>

                    </div>
                </div>
            <?php } ?>

            <!--begin::Form-->
            <form class="m-form" action="<?= base_url() ?>update/update_now" method="post"  enctype="multipart/form-data">
                <div class="m-portlet__body">
                    <div class="m-form__section m-form__section--first">
                        <h2><?= $new ? $this->lang->line('update_available') .' '. $this->lang->line('version') .' : ' . $setting->new_version : $this->lang->line('no_update_available') ?></h2>

                    </div>
                    <br/>
                    <hr/>
                    <div>
                        <?php if ($new) { ?>

                            <button type="submit" class="btn btn-success">
                                <?php echo $this->lang->line('update_now'); ?>
                            </button>
                        <?php } ?>
                    </div>  

                </div>

            </form>
        </div>
    </div>
</div>
<!--end::Section-->

<!--end::Form-->

<?php $this->load->view('site/footer'); ?>
<script type="text/javascript">
    var KTFormControls = {init: function () {
            $("#kt_form_1").validate();
        }}

    jQuery(document).ready(function () {
        KTFormControls.init()
    });
    $(document).on("input", ".inputs", function () {

        var purchase = $(".purchase").val();
        var commission = $(".commission").val();
        console.log(purchase + '----' + commission);
        if (purchase && commission) {
            var total = calculate(purchase, commission);
            $(".total").val(total.toFixed(2));
            $(".total_html").html(total.toFixed(2));
        }
    });

    function calculate(amount, perntage) {
        return parseFloat(amount) + parseFloat((perntage / 100) * amount);
    }


</script>
