<?php $__env->startSection('title', 'View Complaint'); ?>
<?php $__env->startSection('content'); ?>

    <div class="validation-page">
        <div class="container-fluid text-center">
            <h2 class="noMargin">Complaint Management</h2>
        </div>
        <br>
        <br>
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-8">

                    <?php if(Session::has('success')): ?>
                        <div class="alert custom-dark-alert-success alert-dismissible">
                            <button class="close" data-dismiss="alert"><span>×</span></button>
                            <bold><?php echo e(Session::get('success')); ?></bold>
                        </div>
                    <?php endif; ?>

                    <div class="panel panel-default  with-button">

                            <div class="panel-heading clearfix">
                                <span> Edit Complaints &nbsp;</span>
                                 <span class="text-muted">
                                       <?php $__currentLoopData = $complaints; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $complaint): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        (<?php echo e($complaint->complainant_name); ?> (<?php echo e($complaint->token); ?>))
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </span>

                                <div class="header-button pull-right">
                                    <a href="javascript:window.open('','_self').close();" class="btn btn-primary rounded noMargin">Close</a>
                                </div>
                            </div>


                        <div class="panel-body">
                            <?php echo e(Form::open(['url' => '/assign/complaint', 'files' => true])); ?>


                            <?php $__currentLoopData = $complaints; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $complaint): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <?php if(Auth::user()->role_id != 3): ?>

                                    <div class="form-group">
                                        <label>Assign To</label>
                                        <select class="form-control" name="assign">
                                            <?php if($complaint->assign_to != null): ?>
                                                <option value="<?php echo e($complaint->assign_to); ?>" selected><?php echo e($complaint->users->username); ?></option>
                                                <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $items): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>{
                                                <option value="<?php echo e($items->id); ?>"><?php echo e($items->username); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                                <?php else: ?>
                                                <option value>Select</option>
                                                <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $items): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>{
                                                <option value="<?php echo e($items->id); ?>"><?php echo e($items->username); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                <?php endif; ?>
                                <input type="hidden" name="id" value="<?php echo e($complaint->id); ?>">
                                <input type="hidden" name="status" value="<?php echo e($complaint->status); ?>">
                                <div class="form-group">
                                    <label>Status</label>
                                    <select class="form-control text-capitalize" name="status">
                                        <option value>Select</option>
                                        <?php if(Auth::user()->role_id == 3): ?>
                                            <?php if($complaint->status != null): ?>
                                                <option value="<?php echo e($complaint->status); ?>" selected><?php echo e($complaint->status); ?></option>
                                            <?php endif; ?>
                                            <option value="Closed">Closed</option>
                                            <option value="Under Process">Under Process</option>
                                        <?php else: ?>
                                            <?php if($complaint->status != null): ?>
                                            <option value="<?php echo e($complaint->status); ?>" selected><?php echo e($complaint->status); ?></option>
                                            <?php endif; ?>
                                            <option value="Open">Open</option>
                                            <option value="Closed">Closed</option>
                                            <option value="Under Process">Under Process</option>
                                            <option value="Over Due">Over Due</option>
                                        <?php endif; ?>
                                    </select>
                                </div>
                                <?php if(Auth::user()->role_id == 3): ?>

                                    <div class="form-group">
                                        <label class="control-label">Attach File:</label>
                                        <input type="file" class="form-control" name="file" />
                                        <span class="help-block" id="file"></span>
                                    </div>
                                <?php endif; ?>


                                <div class="form-group">
                                    <label>Add Comments</label>
                                    <textarea class="form-control" name="comment"></textarea>
                                </div>

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

                            <input type="submit" class="btn btn-success rounded pull-right load" value="Save">
                            <button type="reset" class="btn btn-primary rounded pull-right" style="margin: 0px 10px" value="Reset">Reset</button>

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


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

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