<?php $__env->startSection('title', 'Track Complaint'); ?>
<?php $__env->startSection('content'); ?>
    <div class="validation-page">
        <div class="container-fluid text-center">
            <h2>Complaint Status</h2>
        </div>
        <br>
        <br>
        <div class="container-fluid">
            <?php if(!empty($empty)): ?>
                <p class="text-center">Please enter correct token number and CNIC number to track the complain.
                    <a href="<?php echo e(url('/')); ?>">Back to home</a>
                </p>
            <?php else: ?>

                <div class="row">
                    <div class="col-sm-6">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                Complaint Detail
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered table-striped">
                                    <tbody>
                                    <?php $__currentLoopData = $complaints; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $items): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <th>Complainant Name</th>
                                            <td><?php echo e($items->complainant_name); ?></td>
                                        </tr>

                                        <tr>
                                            <th style="width: 30%">CNIC No</th>
                                            <td><?php echo e($items->cnic_no); ?></td>
                                        </tr>
                                        <tr>
                                            <th style="width: 30%">Address</th>
                                            <td><?php echo e($items->address); ?></td>
                                        </tr>

                                        <tr>
                                            <th style="width: 30%">Description</th>
                                            <td><?php echo e($items->description); ?></td>
                                        </tr>

                                        <tr>
                                            <th style="width: 30%">Status</th>
                                            <td><?php echo e($items->status); ?></td>
                                        </tr>
                                        <tr>
                                            <th style="width: 30%">Files  </th>
                                            <td>
                                                <?php $__currentLoopData = $files; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $items): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <a href="http://192.168.0.32:8000/uploads/<?php echo e($items->name); ?>" download=""><span class="label label-default"><?php echo e($items->name); ?></span>
                                                    </a>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="panel panel-default">
                            <div class="panel-heading">Add new File</div>
                            <div class="panel-body">
                                <?php echo e(Form::open(['url'=>'/add_file', 'files'=> true])); ?>


                                <input type="hidden" value="<?php echo e($id); ?>" name="id">
                                <div class="form-group">
                                    <input type="file" name="file" class="form-control">
                                </div>

                                <?php if(!empty($message)): ?>
                                    <?php if($message == 'uploaded'): ?>
                                        <span class="text-muted">File uploaded successfully</span><br>
                                    <?php elseif($message == 'failed'): ?>
                                        <span class="text-muted">Please choose a file to upload</span><br>
                                    <?php endif; ?>
                                <?php endif; ?>

                                <button type="submit" class="btn btn-success rounded pull-right">Add File</button>

                                <?php echo e(Form::close()); ?>

                            </div>
                        </div>

                        <div class="panel panel-default">
                            <div class="panel-heading">Add new Comment</div>
                            <div class="panel-body">
                                <?php echo e(Form::open(['url'=>'/add_comment'])); ?>

                                <input type="hidden" value="<?php echo e($id); ?>" name="id">
                                <div class="form-group">
                                    <textarea name="comment" required class="form-control"></textarea>
                                </div>
                                <?php if(!empty($message)): ?>

                                    <?php if($message == 'added'): ?>
                                        <span class="text-muted">Comment added successfully</span><br>
                                    <?php endif; ?>

                                    <?php if($message == 'uploaded'): ?>
                                        <span class="text-muted">File uploaded successfully</span><br>
                                    <?php else: ?>
                                        <span class="text-muted">Please add your comments</span><br>
                                    <?php endif; ?>
                                <?php endif; ?>

                                <button type="submit" class="btn btn-success rounded pull-right">Add Comment</button>
                                <?php echo e(Form::close()); ?>

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

                    <div class="col-sm-6">
                        <div class="panel panel-default">
                            <div class="panel-heading">Conversation</div>
                            <div class="panel-body">
                                <?php $__currentLoopData = $comments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $comment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if(!empty($comment->user_comment)): ?>
                                        <?php echo e($comment->user_comment); ?><br>
                                        <span class="text-muted pull-left">Date: <?php echo e($comment->created_at); ?></span>
                                        <span class="text-muted pull-right">Added by:
                                            <?php if($comment->user_id != null): ?>
                                                Focal person
                                                <?php else: ?>
                                                Complainant
                                            <?php endif; ?>

                                        </span>
                                    <div class="clearfix"></div>

                                        <hr class="clearfix" style="margin-top: 2px;">
                                    <?php endif; ?>

                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </div>
                        </div>
                    </div>


                </div>

            <?php endif; ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('script'); ?>

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



<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>