@extends('layouts.web')

@section('css')
<link href="https://cdnjs.cloudflare.com/ajax/libs/gijgo/1.9.13/combined/css/gijgo.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
@endsection

@section('content')
<div class="container-fluid pt-3">
    <form action="#" 
            novalidate class="{{ ($errors->any()) ? 'was-validated' : 'needs-validation' }}" 
            method="post">
    @csrf
    @method('PUT')
        <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-4">
                                <div class="form-group">
                                    <label for="cost">ราคาคอร์ส</label>
                                    <input type="text" class="form-control" id="cost" name="cost" value="{{ $enroll->course_cost }}" disabled>
                                </div>
                            </div>
                            <div class="col-4">
                                <div class="form-group">
                                    <label for="discount">ส่วนลด</label>
                                    <input type="text" class="form-control" id="discount" name="discount" value="{{ $enroll->discount }}" disabled>
                                </div>
                            </div>
                            <div class="col-4">
                                <div class="form-group">
                                    <label for="totalCost">ราคาหลังหักส่วนลด</label>
                                    <input type="text" class="form-control" id="totalCost" name="totalCost" value="{{ $enroll->total_cost }}" disabled>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-4">
                                <div class="form-group">
                                    <label for="amount">ยอดค้างที่ต้องชำระ</label>
                                    <input type="text" class="form-control" id="amount" name="amount" value=" " disabled>
                                </div>
                            </div>
                            <div class="col-4">
                                <div class="form-group">
                                    <label for="pay">จำนวนที่ชำระ <span class="text-red">*</span></label>
                                    <input type="number" class="form-control" id="pay" name="pay" placeholder="จำนวนที่ชำระ (บาท)" required>
                                    @error('pay')
                                    <div class="text-danger">{{  $message }}</div>
                                    @enderror
                                </div>
                            </div>
                        </div>
                    </div>  <!-- div card body -->
                </div>
                <div class="row mt-3">
                    <div class="col-12">
                        <div style="float:left">
                            <a href="{{ route('student.index') }}" class="btn btn-outline-secondary"><i class="fas fa-chevron-left"></i> ย้อนกลับ</a>
                        </div>
                        <div style="float: right">
                            <button type="reset" class="btn btn-outline-secondary" value="reset">ล้างข้อความ</button>
                            <button type="submit" class="btn btn-success ml-2" value="add-course">ชำระเงิน</button>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
@endsection

@section('footerscript')
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>
<script src="{{ asset('js/gijgo.min.js') }}"></script>
<script>
    $(document).ready(function(){
        $('.selectpicker').selectpicker();
    });
</script>
@endsection