<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
  @include('layout.header')
    <style>
        .center {
            height:100%;
            display:flex;
            align-items:center;
            justify-content:center;

        }
        .form-input {
            width:250px;
            padding:20px;
        }
        .form-input img {
            width:100%;
            display:{{''==''?'none':'block'}};
            margin-bottom:10px;
        }
        .form-input input {
            display:none;
        }

        .form-input label {
            height:25px;
            background:#cdcdcd26;
            color:#c9c9c9;
            cursor:pointer;
            width: 75px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
  <div class="row" id="x" style="display: none;">
    <div class="col-12">
      <span class="d-flex align-items-center purchase-popup">
        <i class="typcn typcn-delete-outline" id="bannerClose"></i>
      </span>
    </div>
  </div>
  <div class="container-scroller">
    @include('layout.navbar')
    <!-- partial -->
    @include('layout.breadscrum')
    <div class="container-fluid page-body-wrapper">

      @include('layout.sidebar')

      <!-- partial -->
      <div class="main-panel">
        <div class="content-wrapper">
          <div class="row">
            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title"><i class="mdi mdi-dots-vertical menu-icon"></i> {{__('laboratory.clone_lab')}}</h4>
                        <hr>
                        <div class="row">
                            <div class="col-lg-12">
                                <form method="post" action="{{url('laboratory/clone-data')}}" class="p-2" id="form-test-sample">
                                    @csrf
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('laboratory.source_lab')}} <span class="text-danger">*</span></label>
                                                <div class="input-group" id="testItem">
                                                    <div class="form-group" style="flex: 1 !important;">
                                                        <select class="form-control rounded-0 select2" required name="source_lab" id="source-lab" style=" width: 100% !important;">
                                                            <option></option>
                                                            @foreach($labs as $department)
                                                             @if($department->id == Session::get('base_lab_id'))
                                                                <option value="{{$department->id}}">{{$department->name_en }}</option>
                                                             @endif
                                                            @endforeach
                                                        </select>
                                                    </div>
{{--                                                    <div class="input-group-append">--}}
{{--                                                        <button id="btnViewLabData" class="btn btn-sm rounded-0 btn-info px-3" type="button">View Data</button>--}}
{{--                                                    </div>--}}
                                                </div>
                                            </div>
                                            <div class="form-group" id="data">

                                            </div>
                                        </div>

                                        <div class="col-sm-6">
                                            <div class="form-group mb-1">
                                                <label for="lab-name-en">{{__('laboratory.target_lab')}} <span class="text-danger">*</span></label>
                                                <select class="form-control rounded-0 select2" required name="target_lab" id="target-lab" style=" width: 100% !important;">
                                                    <option></option>
                                                    @foreach($labs as $department)
                                                    @if($department->id != Session::get('base_lab_id'))
                                                        <option value="{{$department->id}}">{{$department->name_en}}</option>
                                                        @endif
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="row">
                                        <div class="col-sm-12 text-right">
                                            <button class="btn rounded-0 btn-info px-3" type="submit"><i class="mdi mdi-content-duplicate"></i> {{__('laboratory.start_clone')}}</button>
                                        </div>
                                    </div>

                                </form>


                            </div>
                        </div>
                    </div>
                </div>
            </div>

          </div>
        </div>


        @include('layout.footer')
      </div>
    </div>
  </div>
  @include('layout.common_script')

</body>

<script>


    var base_url = "{{url('laboratory-profile')}}";


    $("#btnViewLabData").on('click',function(e){
        e.preventDefault();
        data_id = $('#data-id').val();
        let url = "{{url('laboratory/get-data')}}/"+$('#source-lab').val();
        $.ajax({
            url: url,
            type:"get",
            success:function(res){
                if(res.success){
                    let data = (res.data)
                    data.map(item =>{
                        console.log(item)
                    })
                }
            }
        });
    });

</script>

</html>

