<!-- Price Field -->
<div class="form-group col-sm-6">
    {!! Form::label('price', 'Payment Amount:*') !!}
    {!! Form::number('price', null, ['class' => 'form-control', 'placeholder'=>'Please Enter Amount' ,'required' , 'step'=>".01"]) !!}
</div>

<div class="form-group col-sm-6">
    {!! Form::label('lead_id', 'Lead Id:*') !!}
    {!! Form::number('lead_id', \Request::query('lead_id'), ['class' => 'form-control ', 'placeholder'=>'Please Enter Lead Id','required']) !!}
</div>

<!-- Website Id Field -->
<div class="form-group col-sm-6">
    {!! Form::label('website_id', 'Website:*') !!}
    {!! Form::select('website_id', $web, null,['class' => 'form-control select2']) !!}
</div>
<!-- Image Field -->
<div class="form-group col-sm-6">
    {!! Form::label('image', 'Screen Shot:*') !!}
    {!! Form::file('image'  , ['class' => 'form-control', 'placeholder'=>'Enter image' ,isset($payment->image_url)?'':'required' ,'accept'=>"image/jpg,image/png,image/jpeg"]) !!}
</div>
<!-- Currency Field -->
<div class="form-group col-sm-4">
    {!! Form::label('currency', 'Currency:*') !!}
    {!! Form::select('currency', $currency,null, ['class' => 'form-control select2 ','required']) !!}
</div>
<div class="form-group col-sm-4">
    {!! Form::label('type', 'Payment Type:*') !!}
    <div class="clearfix"></div>
    {!! Form::select('type',\App\Models\Payment::$TYPES, null, ['class' => 'form-control select2' ,'required', 'placeholder'=>'Please Enter Payment Type']) !!}
</div>

<div class="form-group col-sm-4">
    {!! Form::label('platform', 'Platform:*') !!}
    <div class="clearfix"></div>
    {!! Form::select('platform',\App\Models\Payment::$PLATFORM, null, ['class' => 'form-control select2' ,'required', 'placeholder'=>'Please Enter Platform']) !!}
</div>

@if(isset($payment->image_url))
        <!-- Image Field -->
        <div class="form-group col-sm-6">
            <dd><img src="{{$payment->image_url}}" style="width: 400px; height: 200px"alt="Image" class="img-thumbnail" data-toggle="modal" data-target="#exampleModal"></dd>
        </div>
@endif

<!-- Comments Field -->
<div class="form-group col-sm-12">
    {!! Form::label('comments', 'Comments/Add Associates/Payment method:') !!}
    {!! Form::textarea('comments', null, ['class' => 'form-control textarea', 'placeholder'=>'Please Enter comments (If any)']) !!}
</div>

@if(\Entrust::hasRole('admin') || \Entrust::hasRole('super-admin'))
    <!-- Status Field -->
    <div class="form-group col-sm-6">
        {!! Form::label('status', 'Mark as paid:') !!}
        {!! Form::hidden('status', 0) !!}
        {!! Form::checkbox('status', 1,  null, ['data-toggle'=>'toggle']) !!}
    </div>
    @if((isset($payment->status)) && $payment->status == 1)
    <div class="form-group col-sm-6">
        {!! Form::label('status2', 'Mark as Disputed:') !!}
        {!! Form::hidden('status2', 0) !!}
        {!! Form::checkbox('status2', 1,  null, ['data-toggle'=>'toggle']) !!}
    </div>
        @else
        <input type="hidden" name="status2" value="0">
    @endif

    @if(!isset($payment->status))
   <div class="form-group col-sm-6">
       {!! Form::label('team_id', 'Teams:*') !!}
       {!! Form::select('team_id', $teams, null,['class' => 'form-control select2']) !!}
   </div>
   <div class="form-group col-sm-6">
       {!! Form::label('user_id', 'Users:*') !!}
       {!! Form::select('user_id', $users, null,['class' => 'form-control select2']) !!}
   </div>
   @else
        <input type="hidden" name="team_id" value="{{$payment->team_id ?? 1}}">
        @endif
@else
   <input type="hidden" name="team_id" value="{{\Auth::user()->details->team_id}}">
   <input type="hidden" name="user_id" value="{{\Auth::user()->id}}">
@endif

<!-- Submit Field -->
<div class="form-group col-sm-12">
   {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
   {{--@if(!isset($payment))--}}
   {{--{!! Form::submit(__('Save And Add Translations'), ['class' => 'btn btn-primary', 'name'=>'translation']) !!}--}}
   {{--@endif--}}
   {!! Form::submit(__('Save And Add More'), ['class' => 'btn btn-primary', 'name'=>'continue']) !!}
   <a href="{!! route('admin.payments.index') !!}" class="btn btn-default">Cancel</a>





   @if(isset($payment))

</div><div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
   <div class="modal-dialog modal-lg">
       <div class="modal-content">
           <div class="modal-header">
               <h5 class="modal-title" id="exampleModalLabel"><a href="{{$payment->image_url}}" target="_blank">{{$payment->image_url}}</a></h5>
               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
               </button>
           </div>
           <div class="modal-body">
               <img src="{{$payment->image_url}}" id="modalImage" class="img-fluid">
           </div>
       </div>
   </div>
</div>

<script>
   $('.img-thumbnail').on('click', function() {
       var src = $(this).attr('src');
       $('#modalImage').attr('src', src);
   });
</script>

<style>
   .modal-dialog {
       max-width: 800px; /* Adjust as needed */
   }

   #modalImage {
       max-width: 100%; /* Ensures the image fits within the modal */
   }
</style>
@endif