<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('css/bootstrap-timepicker.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/dataTables.bootstrap4.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-datepicker.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/icheck-bootstrap.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/sweetalert2.min.css')); ?>" rel="stylesheet">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="container-fluid pt-3">
        <div class="row">
            <div class="col-12">
                <div class="card card-outline card-success">
                    <div class="card-header">
                        <h3 class="card-title">ข้อมูลผู้สอน</h3>
                    </div>

                    <div class="card-body">
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">ชื่อ</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($teacher->title.$teacher->firstname ." ". $teacher->lastname); ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">ชื่อเล่น</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p ><i class="fas fa-angle-right mr-3"></i> <?php echo e($teacher->nickname); ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">เพศ</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p ><i class="fas fa-angle-right mr-3"></i> <?php echo e($teacher->gender); ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">เลขที่บัตรประาชาชน</p>
                            </div>
                            <div class="ol-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($teacher->idcard); ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">วันเกิด</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(formatDateFromDB($teacher->birthdate)); ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">อายุ</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(calAge($teacher->birthdate)); ?> ปี</p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">ที่อยู่</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php if($teacher->address != null): ?> <?php echo e($teacher->address ." ". $teacher->district ." ". $teacher->amphoe ." ". $teacher->province); ?> <?php else: ?> - <?php endif; ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">หมายเลขโทรศัพท์</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e($teacher->phone_1); ?> <?php if($teacher->phone_2 != null): ?> <?php echo e(" , ".$teacher->phone_2); ?> <?php endif; ?></p>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-3 col-md-2">
                                <p class="showTitle">ประเภทการสอน</p>
                            </div>
                            <div class="col-sm-9 col-md-10">
                                <p><i class="fas fa-angle-right mr-3"></i> <?php echo e(getTeacherType($teacher->type)); ?></p>
                            </div>
                        </div>
                    </div>  <!-- div card body -->
                </div>
                <div class="card card-outline card-success">
                    <div class="card-header">
                        <h3 class="card-title">รายได้จากการสอน</h3>
                    </div>
                    <div class="card-body">
                        <div class="row justify-content-between align-text-bottom">
                            <div class="col-3">
                                <form action="<?php echo e(route('teacher.show', $teacher->id)); ?>"
                                    novalidate class="<?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
                                    method="get"
                                >
                                
                                    <div class="form-group">
                                        <label for="monthYear">เดือน <span class="text-red">*</span></label>
                                        <div class="input-group mb-3">
                                            <input type="text" class="form-control datepiacker" id="monthYear" name="monthYear" placeholder="เลือกเดือน" autocomplete="off" value="<?php echo e($month_year); ?>" required>
                                            <div class="input-group-append">
                                                <span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
                                            </div>
                                            <button type="submit" class="btn btn-outline-success show-outline-btn ml-2" value="add-student">แสดง</button>
                                        </div>
                                        <?php $__errorArgs = ['monthYear'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="text-danger"><?php echo e($message); ?></div>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                </form>
                            </div>
                            <div class="col-3">
                                <span class="align-text-bottom" style="float:right; padding-top: 50px;">รายได้รวม : <?php echo e(number_format($total)); ?> บาท</span>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12">
                                <table class="table finance-table" id="income-table">
                                    <thead>
                                        <tr>
                                            <th scope="col" width="10%">#</th>
                                            <th scope="col" width="30%">วันที่</th>
                                            <th scope="col" width="20%">ชม. ที่สอน</th>
                                            <th scope="col" width="20%">รายได้ (บาท)</th>
                                            
                                        </tr>
                                    </thead>
                                    <tbody>
                                        
                                        
                                        <?php $__currentLoopData = $incomes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $income): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td class="align-middle"><?php echo e($indexKey + 1); ?>.</td>
                                            <td class="align-middle"><?php echo e(formatDateFromDB($income->vdate)); ?></td>
                                            <td class="align-middle"><?php echo e(($income->end - $income->start)/10000); ?></td>
                                            <td class="align-middle"><?php echo e($income->total); ?></td>
                                        </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>  <!-- div card body -->
                </div>
                <div class="row mt-3 mb-3">
                    <div class="col-12">
                        <div style="float:left">
                            <a href="<?php echo e(route('teacher.index')); ?>" class="btn btn-outline-secondary"><i class="fas fa-chevron-left"></i> ย้อนกลับ</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footerscript'); ?>
<script src="<?php echo e(asset('js/sweetalert2.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/dataTables.bootstrap4.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-datepicker.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-datepicker.th.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/bootstrap-timepicker.min.js')); ?>"></script>
<script>
    $(document).ready(function() {
        $('.teacher-table').DataTable({
            "lengthChange": false,
            "info": false,
            "pageLength": 30,
            "language": {
                "emptyTable":   "ไม่พบข้อมูล",
                "paginate": {
                    "first":    "หน้าแรก",
                    "last":     "หน้าสุดท้าย",
                    "next":     "ถัดไป",
                    "previous": "ก่อนหน้า"
                },
                "search":       "ค้นหา:",
                "lengthMenu":   "ทั้งหมด _MENU_ รายการ",
                "info":         "ทั้งหมด _TOTAL_ รายการ",
                "infoEmpty":    "ไม่พบรายการ",
            }
        });

        $('#monthYear').datepicker({
            format: 'mm/yyyy',
            autoclose: true,
            language: 'th',
            endDate: '+0m',
            orientation: 'top',
            startView: 'months',
            minViewMode: 'months',
        });

        $('#payDate').datepicker({
            format: 'dd/mm/yyyy',
            autoclose: true,
            language: 'th',
            orientation: 'bottom',
        }).datepicker("setDate", 'now');

        $('#payTime').timepicker({
            showMeridian: false,
            showSeconds: true,
            minuteStep: 1,
            secondStep: 1,
            icons: {
                up: 'fa fa-angle-up',
                down: 'fa fa-angle-down'
            }
        });
    });
</script>
<?php if(session('feedback')): ?>
<script>
    Swal.fire({
                text: '<?php echo e(session('feedback')); ?>',
                icon: 'success',
                confirmButtonText: 'ตกลง',
                confirmButtonColor: '#62966C'
    })
</script>
<?php endif; ?>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.web', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\system.pongpetrdriving.com\resources\views/teacher/show.blade.php ENDPATH**/ ?>