<title>Prove Review - Best Leearning</title>

<?php $__env->startSection('css'); ?>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
    <link rel="stylesheet" href="https://www.powerworkerearn.com/resources/css/argon.css" type="text/css">
    <link rel="stylesheet" href="https://www.powerworkerearn.com/resources/css/myapp.css" type="text/css">
    <link rel="stylesheet" href="https://www.powerworkerearn.com/resources/css/bttn.css" type="text/css">
<style>
    .shadow-sm {
        display: none !important;
    }

    .table th {
        background-color: rgba(250, 250, 250, 1); 
        color: #000066; 
        font-size: 12px;
    }

    .table-no-vertical-border th,
    .table-no-vertical-border td {
        border-left: none; 
        border-right: none; 
        border-color: rgba(0, 0, 0, 0.1); 
    }

    .table tbody tr:hover {
        cursor: pointer;
        opacity: 0.6;
    }
    
    #imageModal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }

    #imageModal img {
        max-width: 100%;
        max-height: 100%;
    }

    #closeButton {
        position: absolute;
        top: 20px;
        right: 20px;
        color: white;
        font-size: 20px;
        cursor: pointer;
    }
    .prv_task_id {
      color: blue;
      font-weight:bold;
    }

</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('user-content'); ?>
<section>
    <div class="card mt-2">
        <div class="card-header">
            <h5 class="h3 mb-0">Proves Of: <?php echo e($job->title); ?></h5>
        </div>
        <div class="card-body">
            <button type="button" class="btn text-white btn-sm bttn" style="background:#27954f" data-toggle="modal" data-target="#modalConfirm">Satisfy All</button>
            <?php $__currentLoopData = $headlines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $headline): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <br><br> <b> <h5>
              <marquee style="color:red ;padding: 5px;border-radius: 5px;border:1px solid white" behavior="scroll" ><?php echo e($headline->title); ?></marquee> </b></h5>
              <br> 
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            
                <?php if($datas->isEmpty()): ?>
                    <div class="text-center py-3">
                        <p>This Job Has No Submitted Proves</p>
                    </div>
                <?php else: ?>
                
                <div class="table-responsive active">
                    <table class="table table-bordered text-nowrap table-no-vertical-border table-flush" id="example1">
                        <thead class="thead-light">
                            <tr>
                                <th scope="col border-bottom-0" width="5%">PROVE ID</th>
                                <th scope="col border-bottom-0" width="8%">PROOF</th>
                                <th scope="col border-bottom-0">WORKER</th>
                                <th scope="col border-bottom-0">RATE WORK</th>
                                <th scope="col border-bottom-0">TIPS</th>
                            </tr>
                        </thead>
                       <tbody>
                            <?php $__currentLoopData = $datas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> 
                                <?php if(this_work_for_my_job($data->job_id) == 1): ?>
                                    <tr>
                                        <?php if($data->status == 0): ?>
                                            <td class="prv_task_id" style="vertical-align: middle;">
                                                <a href="javascript:;" onclick="sShoootMosdalOpen(<?php echo e($data->id); ?>)">
                                                    TASK <?php echo e($data->id); ?>

                                                </a>
                                            </td>
                                        <?php else: ?>
                                            <td style="vertical-align: middle;">
                                                <a href="javascript:;" onclick="sShoootMosdalOpen(<?php echo e($data->id); ?>)"
                                                    <?php if($data->status == 1): ?>
                                                        <span class="btn btn-success btn-sm">Satisfied</span>
                                                    <?php else: ?>
                                                        <span class="btn btn-danger btn-sm">Unsatisfied</span>
                                                    <?php endif; ?>
                                                </a>
                                            </td>
                                        <?php endif; ?>
                                    
                                        <td style="vertical-align: middle;">
                                            <small style="font-size: 12px"><?php echo e(\Carbon\Carbon::parse($data->created_at)->format('j M Y g:i A')); ?></small>
                                            <br>
                                            <small style="color: black; font-size: 12px;"><?php echo e(Str::limit($data->work_proof, 40)); ?></small>
                                            <br>
                                            <?php if($data->status == 2): ?>
                                                <small style="color: red; font-size: 12px;">Reason: <?php echo e(Str::limit($data->reason, 40)); ?></small>
                                            <?php endif; ?>
                                        </td>
                                    
                                        <td class="prv_task_id" style="vertical-align: middle;"><a href="<?php echo e(route('user.user-profile', $data->user_id)); ?>"><?php echo e(user_name($data->user_id)); ?></a></td>
                                    
                                        <td style="vertical-align: middle;">
                                            <?php if($data->is_rated): ?>
                                                <i class="<?php if($data->rating >= 1): ?> fas text-warning <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                <i class="<?php if($data->rating >= 2): ?> fas text-warning <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                <i class="<?php if($data->rating >= 3): ?> fas text-warning <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                <i class="<?php if($data->rating >= 4): ?> fas text-warning <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                <i class="<?php if($data->rating >= 5): ?> fas text-warning <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                <!--<span class="text-black">Task <small>Rated</small></span>-->
                                            <?php else: ?>
                                                <a href="javascript:;" class="btn btn-info btn-sm" onclick="rateMosdalOpen(<?php echo e($data->id); ?>)">Give Rate</a>
                                            <?php endif; ?>
                                        </td>
                                   

                                        <td style="vertical-align: middle;">
                                            <a href="javascript:;" class="btn btn-success btn-sm" onclick="tipsMosdalOpen(<?php echo e($data->id); ?>)">Give Tips</a>
                                        </td>
                                    </tr>

                                    <div class="modal fade" id="reject_job_<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="divisionEditModalLabel" aria-hidden="true">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <form action="<?php echo e(route('user.job-work-reject', $data->id)); ?>" method="POST" enctype="multipart/form-data">
                                                <?php echo csrf_field(); ?>
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLabel">Reject This Work?</h5>
                                                    </div>
                                                    <div class="modal-body">
                                                        <div class="form-group col-lg-12 col-md-12 col-12">
                                                            <textarea class="form-control" name="reason" id="reason" cols="30" rows="3" required placeholder="Reason for reject"><?php echo e($data->reason); ?></textarea>
                                                        </div>
                                                    </div>

                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="rejectMosdalClose(<?php echo e($data->id); ?>)">Close</button>
                                                        <button type="submit" class="btn btn-primary bttn">Submit</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                    
                                    <div class="modal fade" id="rate_job_<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="divisionEditModalLabel" aria-hidden="true">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <form action="<?php echo e(route('user.job-work-rate', $data->id)); ?>" method="POST" enctype="multipart/form-data">
                                                <?php echo csrf_field(); ?>
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLabel">Rate This Prove</h5>
                                                    </div>
                                                    <div class="modal-body">
                                                        <input type="hidden" id="work_rate_<?php echo e($data->id); ?>" name="rate" value="0"/>
                                                        <div class="form-group">
                                                            <!--<label for="rate">Work Rateing: </label>-->
                                                            <i class="far fa-star rate-star" id="reate_1_<?php echo e($data->id); ?>" onclick="workRated('<?php echo e($data->id); ?>', '1')"></i>
                                                            <i class="far fa-star rate-star" id="reate_2_<?php echo e($data->id); ?>" onclick="workRated('<?php echo e($data->id); ?>', '2')"></i>
                                                            <i class="far fa-star rate-star" id="reate_3_<?php echo e($data->id); ?>" onclick="workRated('<?php echo e($data->id); ?>', '3')"></i>
                                                            <i class="far fa-star rate-star" id="reate_4_<?php echo e($data->id); ?>" onclick="workRated('<?php echo e($data->id); ?>', '4')"></i>
                                                            <i class="far fa-star rate-star" id="reate_5_<?php echo e($data->id); ?>" onclick="workRated('<?php echo e($data->id); ?>', '5')"></i>
                                                        </div>
                                                    </div>

                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="rateMosdalClose(<?php echo e($data->id); ?>)">Close</button>
                                                        <button type="submit" class="btn btn-primary bttn">Submit</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                    </div>

                                    
                                    <div class="modal fade" id="tips_for_job_<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="divisionEditModalLabel" aria-hidden="true">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <form action="<?php echo e(route('user.job-work-give-tips', $data->id)); ?>" method="POST" enctype="multipart/form-data">
                                                <?php echo csrf_field(); ?>
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLabel">Tips For Work</h5>
                                                    </div>
                                                    <div class="modal-body">
                                                        <div class="form-group">
                                                            <label class="form-control-label" for="exampleFormControlTextarea1Report">Enter tips amount</label>
                                                            <input type="text" class="form-control" id="tipsAmount" name="tipsAmount" placeholder="Enter amount" min="0.1">
                                                            <!-- Display live error message -->
                                                                <small class="text-muted text-red font-weight-600" id="tipsAmountError" style="margin-top: 8px; margin-left: 2%; display: block;"></small>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="tipsMosdalClose(<?php echo e($data->id); ?>)">Close</button>
                                                        <button type="submit" class="btn btn-primary bttn">Submit</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                    <div class="modal fade" id="modalConfirm" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <div class="modal-content">
                                                <div class="modal-body">
                                                    <h4 class="text-red">Sir, Do You Want To Satisfy All Proves?</h4>
                                                    <br>
                                                    <p class="tab-title-header h2">Are you confirm ?</p>
                                                </div>
                                                <div class="modal-footer">
                                                    <a href="<?php echo e(route('user.all-satisfied-job-woked', $job->id)); ?>" class="btn btn-success bttn" id="btnPress">Yes, Confirm</a>
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                                    
                                    <div class="modal fade" id="s_shoot_job_<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="divisionEditModalLabel" aria-hidden="true">
                                        <div class="modal-dialog modal-dialog-centered" role="document">
                                            <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLabel">Work Proves:</h5>
                                                        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <div class="modal-header">
                                                        <div style="" class="">
                                                            <p class="card-text text-uppercase text-muted font-weight-800"></p>
                                                            <h5><b><i class="fas fa-tasks"></i> Submitted Prove</b></h5>
                                                            <p style="background:#f5f7fa;padding: 10px;border-radius:4px;" class="drk-bg-second card-text font-weight-500"> <?php echo e($data->work_proof); ?></br></p>
                                                        </div>
                                                    </div>
                                                    <?php if($data->status != 1): ?>
                                                        <center><button type="button" style="margin: 10px;border-radius: 20px;" class="btn btn-danger btn-sm" onclick="jobTaskReport('<?php echo e($data->id); ?>')">Report (optional)</button></center>
                                                    <?php endif; ?>
                                                    
                                                <?php if($data->screenshot_proof != NULL): ?>
                                                    <div class="modal-body">
                                                        <div class="d-flex justify-content-start" style="overflow-x: auto;">
                                                            <?php
                                                                $s_shots = explode("|", $data->screenshot_proof);
                                                            ?>
                                                            <?php if($s_shots): ?>
                                                                <?php $__currentLoopData = $s_shots; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s_shot): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                    <div class="mr-3" style="width: 80px;">
                                                                        <a href="<?php echo e(URL::to($s_shot)); ?>" target="_blank">
                                                                            <img src="<?php echo e(URL::to($s_shot)); ?>" class="img-fluid c-pointer grid-image" style="width: 100%; height: auto; border: 1px solid white; border-radius: 5px;" alt="Screen Shot">
                                                                        </a>
                                                                    </div>
                                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                            <?php endif; ?>
                                                        </div>
                                                    </div>
                                                <?php endif; ?>

                                                    <!--<h5 class="modal-title" id="exampleModalLabel">
                                                        <div class="form-group">
                                                            <label for="rate">Task Rating: </label>
                                                            <i class="<?php if($data->rating >= 1): ?> fas <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                            <i class="<?php if($data->rating >= 2): ?> fas <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                            <i class="<?php if($data->rating >= 3): ?> fas <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                            <i class="<?php if($data->rating >= 4): ?> fas <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                            <i class="<?php if($data->rating >= 5): ?> fas <?php else: ?> far <?php endif; ?> fa-star"></i>
                                                            
                                                            <a href="javascript:;" class="btn btn-info btn-sm" onclick="rateMosdalOpen(<?php echo e($data->id); ?>)">
                                                                Rate
                                                            </a>
                                                        </div>
                                                    </h5>
                                                    <div class="">
                                                        <a href="javascript:;" class="btn btn-success btn-sm" onclick="tipsMosdalOpen(<?php echo e($data->id); ?>)">Give Tips</a>
                                                    </div>-->                                                    
                                                    
                                                    <!--<div class="modal-header">
                                                        <div style="background: transparent;padding: 5px;border-radius:4px;" class="drk-bg-second">
                                                            <p class="card-text text-uppercase text-muted font-weight-800"></p>
                                                            <h5><b> Required Prove Was</b></h5>
                                                            <p class="card-text font-weight-500"> <?php echo e($job->required_proof); ?></br></p>
                                                        </div>
                                                    </div>-->
                                                    
                                                    <div class="modal-footer">
                                                        <?php if($data->status == 0): ?>
                                                            <a href="<?php echo e(route('user.job-work-approve', $data->id)); ?>" class="btn btn-sm btn-success bttn">Satisfied</a>
                                                            <a href="javascript:;" class="btn btn-danger btn-sm" onclick="rejectMosdalOpen(<?php echo e($data->id); ?>)">
                                                                Unsatisfied
                                                            </a>
                                                        <?php endif; ?>
                                                        
                                                        <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="sShoootMosdalClose(<?php echo e($data->id); ?>)">Close</button>
                                                    </div>
                                            </div>    
                                        </div>
                                    </div>
                                
                                    <form action="<?php echo e(route('user.job-task-report', $data->id)); ?>" method="POST" enctype="multipart/form-data">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="job_id" value="<?php echo e($data->job_id); ?>">
                                        <div class="modal fade" id="jobTaskReport_<?php echo e($data->id); ?>" tabindex="-1" role="dialog" aria-labelledby="jobTaskReportTitle" aria-hidden="true">
                                            <div class="modal-dialog modal-dialog-centered" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title" id="exampleModalLongTitle">Report This Prove</h5>
                                                        <button type="button" class="close" data-bs-dismiss="modal" onclick="jobTaskReportHide()">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <div class="modal-body">
                                                        <p>Do you have any issue/problem with this prove?<br> Write down below about your problem/reason</p>
                                                        <div class="form-group">
                                                            <label class="form-control-label" for="exampleFormControlTextarea1">Describe your issue/reason</label>
                                                            <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="report_describe" placeholder="Write your reason here..."></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-secondary" onclick="jobTaskReportHide('<?php echo e($data->id); ?>')">Cancel</button>
                                                        <button type="submit" class="btn btn-primary bttn">Submit Report</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                     </form>
                                     
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                    
                </div>
            <?php endif; ?>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<!-- Include jQuery from a CDN -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>


    <script>
        function setAccount(account_id) {
            $('#deposit_account').val(account_id);

            $.ajax({
                url: "<?php echo e(route('user.deposit-account-info')); ?>",
                type: "POST",
                data: {
                    _token: '<?php echo e(csrf_token()); ?>',
                    account_id: account_id,
                },
                success: function(data) {
                    $('#deposit_area').show();
                    $('#deposit_account_text').html('Account No: ' + data['account_no']);
                    $('#deposit_account_guideline').html(data['guideline']);
                },
            });
        }

        function rejectMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('hide');
            $('#reject_job_'+id).modal('show');
        }

        function rejectMosdalClose(id){
            $('#reject_job_'+id).modal('hide');
        }
        
        function reportMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('hide');
            $('#report_job_'+id).modal('show');
        }

        function reportMosdalClose(id){
            $('#report_job_'+id).modal('hide');
        }
        
        function rateMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('hide');
            $('#rate_job_'+id).modal('show');
        }

        function rateMosdalClose(id){
            $('#rate_job_'+id).modal('hide');
        }
        
        function resumeMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('hide');
            $('#resume_job_'+id).modal('show');
        }

        function resumeMosdalClose(id){
            $('#resume_job_'+id).modal('hide');
        }

        function sShoootMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('show');
        }

        function sShoootMosdalClose(id){
            $('#s_shoot_job_'+id).modal('hide');
        }

        function tipsMosdalOpen(id){
            $('#s_shoot_job_'+id).modal('hide');
            $('#tips_for_job_'+id).modal('show');
        }

        function tipsMosdalClose(id){
            $('#tips_for_job_'+id).modal('hide');
        }
        
        function jobTaskReport(id) {
            $('#jobTaskReport_'+id).modal('show');
        }
        
        function jobTaskReportHide(id) {
            $('#jobTaskReport_'+id).modal('hide');
        }
        
        document.addEventListener('DOMContentLoaded', function () {
            var tipsAmountInput = document.getElementById('tipsAmount');
            var tipsAmountError = document.getElementById('tipsAmountError');

            tipsAmountInput.addEventListener('input', function () {
                validateTipsAmount();
            });

            function validateTipsAmount() {
                var tipsAmount = parseFloat(tipsAmountInput.value);
                var minAmount = 0.1;

                // Check if the entered amount is below the minimum
                if (isNaN(tipsAmount) || tipsAmount < minAmount) {
                    // Show an error message
                    tipsAmountError.textContent = 'Minimum Tips 0.1';
                } else {
                    // Hide the error message
                    tipsAmountError.textContent = '';
                }
            }
        });
        
        document.getElementById('btnPress').addEventListener('click', function() {
        window.location.href = "<?php echo e(route('user.all-satisfied-job-woked', $job->id)); ?>";
    });

    function workRated(work_id, rate) {
        // Reset all stars to default color
        for (let i = 1; i <= 5; i++) {
            $('#reate_' + i + '_' + work_id).removeClass('fas text-warning');
            $('#reate_' + i + '_' + work_id).addClass('far text-muted');
        }

        // Color the selected stars
        for (let i = 1; i <= rate; i++) {
            $('#reate_' + i + '_' + work_id).removeClass('far text-muted');
            $('#reate_' + i + '_' + work_id).addClass('fas text-warning');
        }

        // Update the hidden input value
        $('#work_rate_' + work_id).val(rate);
    }
</script>

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

<?php echo $__env->make('user.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/powerwor/public_html/resources/views/user/pages/accept-worked-job-prove-list.blade.php ENDPATH**/ ?>