@extends('layouts.admin')

@section('content')


<?php
    $type = Request::segment('2');
    $bank_id = Request::segment('3');

?>

        <!-- Content Wrapper. Contains car content -->
        <div class="content-wrapper" style="margin-left:10px !important;">
            <!-- Content Header (car header) -->
            <section class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6">
                            <h1>انشاء ملف جديد</h1>
                        </div>
                        <div class="col-sm-6">
                            <ol class="breadcrumb float-sm-right">
                                <li class="breadcrumb-item"><a href="#">الرئيسية</a></li>
                                <li class="breadcrumb-item active">ادارة النظام</li>
                            </ol>
                        </div>
                    </div>
                </div><!-- /.container-fluid -->
            </section>









            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="success">
                            @if(session()->has('success'))
                                <div class="alert alert-success">
                                    {{ session()->get('success') }}
                                </div>
                            @endif

                                <h2 id="success" style="color: green;
                                font-weight: bolder;">

                                </h2>


                        </div>
                        <form action="{{url('/operation')}}" method="post" enctype="multipart/form-data">
                            @csrf


                        <div class="form-group">
                            <label for="bank_id">  اسم الحساب    </label>
                            <input type="text" style="font-size: 22px; font-weight: bolder;" readonly disabled name="bank_name" id="bank_name" class="form-control" id="bank_name"  placeholder="Enter bank name" value="{{\App\banks::where('id',$bank_id)->first()->bank}}">
                            @error('title') {{ $message }} @enderror

                        </div>

                        <input type="hidden" name="bank_id" value="{{$bank_id}}">
                        <input type="hidden" name="type" value="{{$type}}">

                        <div class="form-group">
                            <label for="bank">  نوع العملية     </label>
                            <input type="text" style="font-size: 22px; font-weight: bolder;" readonly disabled name=""
                            value="<?php 

                            if($type == "credit"){
                                echo "ايــداع  ";
                            }

                            if($type == "depit"){
                                echo " سحـــب   ";
                            }


                             ?>" 
                             id="" class="form-control" id="" placeholder="Enter type">
                            @error('title') {{ $message }} @enderror

                        </div>


                        <div class="form-group">
                            <label for="amount">   المبلغ     </label>
                            <input type="number" name="amount" id="amount" class="form-control" id="amount" placeholder="Enter amount">
                            @error('title') {{ $message }} @enderror

                        </div>

                        @if($bank_id == 3)
                        <input type="hidden" name="payment_method" value="cash">
                        @endif


                        @if($bank_id == 4)
                        <input type="hidden" name="payment_method" value="bankak">
                        @endif


                        @if($bank_id > 3)
                        <input type="hidden" name="payment_method" value="<?php echo \App\banks::where('id',$bank_id)->first()->bank; ?>">
                        @endif


                        <?php /*
                        <div class="form-group">
                            <label for="payment_method"> طريقة الدفع  </label>
                           <select class="form-control" name="payment_method">
                               <option value="bankak">Bankak | بنكك</option>
                               <option value="cash">Cash | كاش </option>
                               <?php
                                $banks = \App\banks::where('id','>','4')->get();
                               ?>
                               @foreach($banks as $r)
                               <option value="{{$r->bank_id}}"> {{$r->bank}} </option>

                               @endforeach

                           </select>

                        </div>

                        */ ?>
                        <div class="form-group">
                            <label for="notes">   ملاحظات      </label>
                            <textarea name="notes" class="form-control"></textarea>
                        </div>

  
                        <div class="card-footer">
                        <button class="btn btn-primary" >اضافة</button>
                        
                        </div>


                        </form>


                    </div>
                    <!-- /.col-->
                </div>
                <!-- ./row -->
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->





@endsection
