@if(!empty($param['vip']))
<div class="alert alert-dismissible text-black" role="alert" style="background-color:pink">
    <span class="fw-bolder">Attention!</span> {{$param['vip']->comments}}
</div>
@endif

<h4><b>SUBMISSION DETAILS</b></h4>
<div class="card mb-4">
    <div class="row">
        <div class="col-12 col-md-12">
            <h5 class="card-header bg-siteblue text-white" id="user_theme_header"><b>{{$manuscript_data->reference_number}}</b></h5>
        </div>
    </div>
    <div class="table-responsive overflow-v">
        <table class="table mb-0">
            <tr>
                <td class="bg-secondary text-white">Submission Type</td>
                <td>Manuscript</td>
            </tr>
            <tr>
                <td class="bg-secondary text-white">Title</td>
                <td class="text-wrap">{{$manuscript_data->title}}</td>
            </tr>
            <tr>
                <td class="bg-secondary text-white">Abstract</td>
                <td> <button type="button" class="btn btn-info" data-bs-toggle="modal" data-bs-target="#modalAbstract" id="user_theme_button2">View Abstract</button></td>
                <!-- Modal -->
                <div class="modal fade" id="modalAbstract" tabindex="-1" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-scrollable" role="document">
                        <div class="modal-content">
                            <div class="modal-header border-bottom">
                                <h5 class="modal-title fw-bolder" id="modalAbstractTitle">Abstract</h5>
                            </div>
                            <div class="modal-body">
                                <p class="text-wrap">{{$manuscript_data->abstract}}</p>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
                                    Close
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </tr>
            <tr>
                <td class="bg-secondary text-white">Submitted Date</td>
                <td>{{gmdate("d-m-Y", $manuscript_data->date_submitted)}}</td>
            </tr>
        </table>
    </div>
</div>

<div class="card ">
    <div class="row align-items-center ">
        <div class="col-12">
            <h5 class="card-header text-white bg-siteblue" id="user_theme_header"><b>AUTHORS</b> <small class="ms-1 fw-light text-white" style="font-size:12px">(* is Prinicipal Author)</small></h5>
        </div>
    </div>
    <div class="table-responsive overflow-v">
        <table class="table mb-0">
            <thead class="table-warning" id="user_theme_table2">
                <tr>
                    <th class="text-black">Sr No.</th>
                    <th class="text-black">First Name</th>
                    <th class="text-black">Middle Name</th>
                    <th class="text-black">Last Name</th>
                    <th class="text-black">Field of Expertise</th>
                    <th class="text-black">Affiliation</th>
                </tr>
            </thead>
            <tbody class="table-border-bottom-0">
                @if(count($authors_list)>0)
                @php $a=1; @endphp
                @foreach($authors_list as $authors)
                <tr @if($authors->institution_id == $param['grid_id']) class="table-info"
                    @endif>
                    <td>{{ $a }}</td>
                    @if($authors->is_principal == 1)
                    <td class="text-danger">*{{$authors->first_name}}</td>
                    @else
                    <td>{{$authors->first_name}}</td>
                    @endif
                    <td>{{$authors->middle_name}}</td>
                    <td>{{$authors->last_name}}</td>
                    <td>{{$authors->field_of_expertise}}</td>
                    <td><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#affModal{{$authors->author_id}}" id="user_theme_button3">View</button></td>

                    <!-- Modal -->
                    <div class="modal fade" id="affModal{{$authors->author_id}}" tabindex="-1" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-scrollable" role="document">
                            <div class="modal-content mb-0">
                                <div class="modal-header border-bottom">
                                    <h5 class="modal-title fw-bolder" id="affModalTitle">Author Affiliation</h5>
                                </div>
                                <div class="modal-body py-0">
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Institution</div>
                                        <div class="col-8 py-2 border-bottom text-wrap">{{$authors->institution}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Department</div>
                                        <div class="col-8 py-2 border-bottom text-wrap">{{$authors->department}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Address</div>
                                        <div class="col-8 py-2 border-bottom text-wrap">{{$authors->address}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Country</div>
                                        <div class="col-8 py-2 border-bottom">{{$authors->nicename}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">State</div>
                                        <div class="col-8 py-2 border-bottom">{{$authors->state}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">City</div>
                                        <div class="col-8 py-2 border-bottom">{{$authors->city}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Postal Code</div>
                                        <div class="col-8 py-2 border-bottom">{{$authors->postal_code}}</div>
                                    </div>
                                    <div class="row">
                                        <div class="col-4 py-2 border-bottom bg-secondary text-white">Phone</div>
                                        <div class="col-8 py-2 border-bottom">{{$authors->phone}}</div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
                                        Close
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Modal End-->

                </tr>
                @php $a++; @endphp
                @endforeach
                @else
                <tr>
                    <td colspan="5" class="text-center">No Record</td>
                </tr>
                @endif
            </tbody>
        </table>
    </div>
</div>

@if(!empty($param['btn_show']))
<div class="d-flex justify-content-center pt-4 mb-3">
    <button data-toggle="modal" data-id="{{$manuscript_data->manuscript_id}}" data-status-id="1" class="open-ConfirmManuscript btn btn-primary mr-2" href="#modalToggle" id="user_theme_button4">Approve</button>
    <button data-toggle="modal" data-id="{{$manuscript_data->manuscript_id}}" data-status-id="0" class="open-ConfirmManuscript btn btn-danger" href="#modalToggle" id="user_theme_button5">Reject</button>
</div>

<div class="modal fade" id="modalToggle">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header border-bottom">
                <h5 class="modal-title text-danger" id="modalToggleLabel">Confirmation!</h5>
            </div>
            <form method="post" action="/member/add-manuscript" enctype="multipart/form-data">
                <div class="modal-body border-bottom">Are you sure?
                    <input type="hidden" name="_token" value="<?= csrf_token() ?>">
                    <input type="text" name="manuscriptId" id="manuscriptId" value="" hidden />
                    <input type="text" name="statusId" id="statusId" value="" hidden />
                </div>
                <div class="modal-footer">
                    <button type="submit" name="check" class="btn btn-primary" name="submit">YES</button>
                    <button id='closeModal' type="button" class="btn btn-outline-secondary" data-dismiss="modal">NO</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Import jquery cdn -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous">
</script>
<script>
    $(document).on("click", ".open-ConfirmManuscript", function() {
        var mymanuscriptId = $(this).data('id');
        var mystatusId = $(this).data('status-id');
        $(".modal-body #manuscriptId").val(mymanuscriptId);
        $(".modal-body #statusId").val(mystatusId);
    });
</script>
@endif