

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

    Report
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>

        <li class="active">Account Statement</li>
    </ol>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('css'); ?>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
    <style type="text/css">
        .daterangepicker {
            right: 695px !important
        }
    </style>
<?php $__env->stopSection(); ?>


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


    <!-- Main content -->
    <!-- Main content -->
    <section class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-info">
                    <div class="panel-heading">Account Statement Report</div>

                    <!-- /.box -->
                    <!-- START CUSTOM TABS -->
                    <!-- Custom Tabs -->
                    <div class="nav-tabs-custom">
                        <div class="tab-content">
                            <div class="tab-pane active">
                                <div class="row">
                                    <div class="col-md-6">
                                        <!-- Horizontal Form -->
                                        <!-- form start -->
                                        <form class="form-horizontal" method='post'
                                            action="<?php echo e(route('report.account-statement.generate')); ?>">
                                            <?php echo e(csrf_field()); ?>

                                            <div class="box-body">
                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('isSuperAdmin')): ?>
                                                <?php echo $__env->make('partial.multiselect_for_reporting', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                <?php endif; ?>

                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label">Term</label>
                                                    <div class="col-sm-9">
                                                        <div class="input-group">
                                                            <div class="input-group-addon">
                                                                <i class="fa fa-calendar"></i>
                                                            </div>

                                                            <select name="period"
                                                                class="form-control chosen-select pull-right"
                                                                id="period">
                                                                <option value="1">Periodic</option>
                                                                <option value="2">Till Date</option>
                                                            </select>



                                                            <?php if($errors->has('period')): ?>
                                                                <span class="help-block">
                                                                    <strong><?php echo e($errors->first('period')); ?></strong>
                                                                </span>
                                                            <?php endif; ?>
                                                        </div>
                                                    </div>
                                                    <!-- /.input group -->
                                                </div>

                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label">Date range</label>
                                                    <div class="col-sm-9">
                                                        <div class="input-group" id="date-div">
                                                            <div class="input-group-addon">
                                                                <i class="fa fa-calendar"></i>
                                                            </div>
                                                            <input type="text" class="form-control pull-right"
                                                                id="daterange-btn" value='<?php echo e(old('date_range')); ?>'
                                                                name='date_range'>

                                                        </div>
                                                        <?php if($errors->has('date_range')): ?>
                                                            <span class="help-block">
                                                                <strong><?php echo e($errors->first('date_range')); ?></strong>
                                                            </span>
                                                        <?php endif; ?>
                                                    </div>
                                                    <!-- /.input group -->
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label"><input type='submit'
                                                            class="btn btn-success" value='Generate'></label>

                                                </div>
                                            </div>
                                        </form>
                                        <!-- /.box -->
                                    </div>
                                </div>
                                <!-- /.row -->
                            </div>
                            <!-- /.tab-pane -->
                        </div>
                        <!-- /.tab-content -->
                    </div>
                    <!-- nav-tabs-custom -->
                    <!-- END CUSTOM TABS -->
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->
    <div class="clearfix"></div>

<?php $__env->stopSection(); ?>

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


    <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
    <script>
        const year = new Date().getFullYear();

        const this_fiscal_year_start_date = new Date(year + '-' + <?php echo e(\App\ChartOfAccount::FISCAL_YEAR_START); ?> + '-01');

        const this_fiscal_year_end_date = new Date((year + 1) + '-' + <?php echo e(\App\ChartOfAccount::FISCAL_YEAR_END); ?> + '-30');

        const last_fiscal_year_start_date = new Date((year - 1) + '-' + <?php echo e(\App\ChartOfAccount::FISCAL_YEAR_START); ?> +
            '-01');

        const last_fiscal_year_end_date = new Date(year + '-' + <?php echo e(\App\ChartOfAccount::FISCAL_YEAR_END); ?> + '-30');




        $('#daterange-btn').daterangepicker({

                ranges: {
                    'Today': [moment(), moment()],
                    'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                    'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                    'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                    'This Month': [moment().startOf('month'), moment().endOf('month')],
                    'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf(
                        'month')],
                    'This Fiscal Year': [this_fiscal_year_start_date, this_fiscal_year_end_date],
                    'Last Fiscal Year': [last_fiscal_year_start_date, last_fiscal_year_end_date]
                },
                startDate: moment().subtract(29, 'days'),
                endDate: moment()
            },
            function(start, end) {
                $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
            }
        );

        $('#period').change(function() {

            if (this.value == 1) {

                document.getElementById('date-div').innerHTML =
                    '<div class="input-group-addon"><i class="fa fa-calendar"></i></div><input type="text" class="form-control pull-right" id="daterange-btn" name="date_range">';

                $('#daterange-btn').daterangepicker({
                        locale: {
                            format: 'DD/MM/YYYY'
                        },
                        ranges: {
                            'Today': [moment(), moment()],
                            'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                            'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                            'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                            'This Month': [moment().startOf('month'), moment().endOf('month')],
                            'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1,
                                'month').endOf('month')],
                            'This Fiscal Year': [this_fiscal_year_start_date, this_fiscal_year_end_date],
                            'Last Fiscal Year': [last_fiscal_year_start_date, last_fiscal_year_end_date]
                        },
                        startDate: moment().subtract(29, 'days'),
                        endDate: moment()
                    },
                    function(start, end) {
                        $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format(
                            'MMMM D, YYYY'));
                    }
                );

            } else {



                document.getElementById('date-div').innerHTML =
                    '<div class="input-group-addon"><i class="fa fa-calendar"></i></div><input type="date" class="form-control pull-right"  name="date_range">';

            }



        });
    </script>
    <!--Accordian-->


<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/proje372/akram-city.projecterp.net/resources/views/report/account-statement-range.blade.php ENDPATH**/ ?>