

<?php $__env->startSection('css'); ?>
<style>
    .price_project{
        position: absolute;
        right: 15px;
        top: 15px;
    }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <div class="fade-in">
        <div class="row">
            <?php if($errors->any()): ?>
            <div class="alert alert-danger">
                <ul>
                    <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($error); ?></li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
            </div>
            <?php endif; ?>
            <div class="col-sm-12">
                <?php $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="card">
                    <div class="card-header">
                        <h4><?php echo e($project->project_title); ?></h4>
                        <span>Contract - <?php echo e($project->contract); ?> , Posted <?php echo e(Carbon\Carbon::parse($project->created_at)->diffForHumans()); ?></span>
                        <h5 class="price_project"><?php echo e($project->engineering); ?></h5>
                    </div>
                    <div class="card-body">
                            <?php echo e($project->summary); ?>

                    </div>
                    <div class="card-footer">
                        <button class="btn btn-light rounded-pill" type="button"><?php echo e($project->country_assignment); ?></button>
                        <button class="btn btn-light rounded-pill" type="button"><?php echo e($project->technical_qualification); ?></button>
                        <button class="btn btn-light rounded-pill" type="button"><?php echo e($project->expert); ?></button>
                        <button class="btn btn-success rounded-0 m-1 float-right" type="button">Details</button>
                        <button class="btn btn-primary rounded-0 m-1 float-right" data-toggle="modal" data-target="#exampleModal" data-id="<?php echo e($project->id); ?>" data-title="<?php echo e($project->project_title); ?>" type="button">Apply</button>
                    </div>
                </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>
</div>
</div>


<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Apply Project</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form method="POST"  action="<?php echo e(route('project_requests.store')); ?>"  enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="project_id" id="project_id">
                    <div class="form-group">
                        <label style=" margin-left: 10px;">Proposal Description</label>
                        <textarea type="text" name="proposal_description" class="form-control" required><?php echo e(old('proposal_description')); ?></textarea>
                    </div>
                    <div class="form-group"> <label>Technical Proposal</label>
                        <select id='selUser' name="technical_proposal" class="form-control" required>
                            <option value="">Select Technical Proposal</option>
                            <option value="PEC Gateway format" <?php echo e(old('technical_proposal') == "PEC Gateway format" ?? "selected"); ?>>PEC Gateway format</option>
                            <option value="Other" <?php echo e(old('technical_proposal') == "PEC Gateway format" ?? "selected"); ?>>Other</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label style=" margin-left: 10px;">Commercial Proposal</label>
                        <input type="text" name="commercial_proposal" value="<?php echo e(old('commercial_proposal')); ?>" class="form-control" required/>
                    </div>
                    <div class="form-group">
                        <label>Cover Letter</label>
                        <div class="custom-file mb-3">
                            <input type="file" id="test" class="custom-file-input" name="cover_letter" accept="pdf/doc" required/>
                            <label class="custom-file-label" for="customFile">Choose file</label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">Send</button>
                </div>
            </form>
        </div>
    </div>
</div>


<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>
<script>
    $(document).ready( function () {
            var exampleModal = document.getElementById('exampleModal')
            exampleModal.addEventListener('show.coreui.modal', function (event) {
            var button = event.relatedTarget
            var project_id = button.getAttribute('data-id')
            var modalBodyInput = exampleModal.querySelector('.modal-body #project_id')
            modalBodyInput.value = project_id

            var project_title = button.getAttribute('data-title')
            var modalTitle = exampleModal.querySelector('.modal-title')
            modalTitle.textContent = project_title + ' (Project Proposal)'
            })
    } );
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.base', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/pecdev/public_html/pec_laravel_v2/resources/views/dashboard/projects/index.blade.php ENDPATH**/ ?>