<?php $__env->startSection('content'); ?>
<div class="container">
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-success">
                    <!-- <div class="box-header">
                        <h3 class="box-title">Ticket List</h3> 
                        <div class="box-tools pull-right">
                            <a href="<?php echo e(url('ticket/create')); ?>" class="btn btn-primary btn-flat"> <i class="fa fa-plus"></i> Create Ticket</a>
                        </div>
                    </div> -->
                    <div class="box-body">
                        
                        

                        <div class="panel panel-primary">
                            <div class="panel-heading text-center"><code>Ticket ID: <b><?php echo e($ticket->id); ?></b></code> <code>Customer Number: <b><?php echo e($ticket->phone_number); ?></b></code></div>
                                <div class="panel-body">
                            
                                    <h4><code>Ticket ID: <b><a href="<?php echo e(url('/ticket/' . $ticket->id)); ?>"><?php echo e($ticket->id); ?></a></b></code></h4> 
                                    <div class="table-responsive">          
                                        <table class="table">
                                            <tbody>
                                                <tr>
                                                    <td><b>Customer Number</b></td>
                                                    <td><?php echo e($ticket->phone_number); ?></td>
                                                    <td><b>Customer Name</b></td>
                                                    <td><?php echo e($ticket->customer_name); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Subject</b></td>
                                                    <td><?php echo e($ticket->subject); ?></td>
                                                    <td><b>Assigned Person</b></td>
                                                    <?php if(isset($ticket->assigned->name)): ?>
                                                        <td><?php echo e($ticket->assigned->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                </tr>
                                                <tr>
                                                    <td><b>Ticket Type</b></td>
                                                    <?php if(isset($ticket->ticketType->name)): ?>
                                                        <td><?php echo e($ticket->ticketType->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                    <td><b>Ticket Status</b></td>
                                                    <?php if(isset($ticket->ticketStatus->name)): ?>
                                                        <td><?php echo e($ticket->ticketStatus->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                </tr>
                                                <tr>
                                                    <td><b>Customer Name</b></td>
                                                    <td><?php echo e($ticket->customer_name); ?></td>
                                                    <td><b>Customer Address</b></td>
                                                    <td><?php echo e($ticket->customer_address); ?></td>
                                                </tr>
                                                <!-- <tr>
                                                    <td><b>District</b></td>
                                                    <?php if(isset($ticket->district->name)): ?>
                                                        <td><?php echo e($ticket->district->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                    <td><b>Division</b></td>
                                                    <?php if(isset($ticket->division->name)): ?>
                                                        <td><?php echo e($ticket->division->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                </tr> -->
                                                <!-- <tr>
                                                    <td><b>Product Detail</b></td>
                                                    <td><?php echo e($ticket->product_model); ?></td>
                                                    <td><b>Area Assigned</b></td>
                                                    <td><?php echo e($ticket->area_assigned); ?></td>
                                                </tr> -->
                                                <?php
                                                    $productDetail = str_replace( ['[', ']', '{', '}', '"'], "", $ticket->product_detail );
                                                ?>
                                                <tr>
                                                    <td><b>Product Detail</b></td>
                                                    <td colspan="3"><?php echo e($productDetail); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Delivery DateTime</b></td>
                                                    <td><?php echo e($ticket->delivery_time); ?></td>
                                                    <td><b>Delivery Stauts</b></td>
                                                    <td><?php echo e($ticket->delivery_status); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Product Price</b></td>
                                                    <td><?php echo e($ticket->product_price); ?></td>
                                                    <td><b>Client & Discount</b></td>
                                                    <td><?php echo e($ticket->client_discount); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Created At</b></td>
                                                    <td><?php echo e($ticket->created_at); ?></td>
                                                    <td><b>Updated At</b></td>
                                                    <td><?php echo e($ticket->updated_at); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Created By</b></td>
                                                    <td><?php echo e($ticket->createdBy->name); ?></td>
                                                    <td><b>Updated By</b></td>
                                                    <?php if(isset($ticket->updatedBy->name)): ?>
                                                        <td><?php echo e($ticket->updatedBy->name); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                </tr>
                                                <tr>
                                                    <td><b>Total Price</b></td>
                                                    <td><?php echo e($ticket->total_price); ?> Taka</td>
                                                    <td><b>Online P. Done</b></td>
                                                    <td><?php echo e($ticket->online_payment); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Discount</b></td>
                                                    <td><?php echo e($ticket->discount); ?></td>
                                                    <td><b></b></td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Payment Status</b></td>
                                                    <td><?php echo e($ticket->payment_status); ?></td>
                                                    <td><b>Gift</b></td>
                                                    <td><?php echo e($ticket->gift); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Delivery Boy</b></td>
                                                    <?php if(isset($ticket->dbAssigned)): ?>
                                                        <td><?php echo e($ticket->dbAssigned->name .': '.$ticket->dbAssigned->depot_app_user); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                    <td><b>Supervisor</b></td>
                                                    <?php if(isset($ticket->svAssigned)): ?>
                                                        <td><?php echo e($ticket->svAssigned->name .': '.$ticket->svAssigned->depot_app_user); ?></td>
                                                    <?php else: ?>
                                                        <td></td>
                                                    <?php endif; ?>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>

                                   <div class="row">
                                        <div class="col-md-offset-3 col-md-6">
                                            <?php if(isset($ticket->product_detail)): ?>

                                                <?php
                                                    $productDecode = json_decode($ticket->product_detail);
                                                ?>

                                                <?php if(json_last_error() == JSON_ERROR_NONE): ?>
                                                <h4><code>Product Details</code></h4> 
                                                <div class="table-responsive"> 
                                                    <table id="" class="table table-bordered table-striped table-condensed">
                                                        <thead>
                                                            <tr>
                                                                <th>Name</th>
                                                                <th>Qty</th>
                                                                <th>Unit</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>

                                                        <?php foreach($productDecode as $value): ?>
                                                        <tr>
                                                            <td><?php echo e($value->Name); ?></td>
                                                            <td><?php echo e($value->Qty); ?></td>
                                                            <?php if(isset($value->Unit)): ?>
                                                                <td><?php echo e($value->Unit); ?></td>
                                                            <?php else: ?>
                                                                <td></td>
                                                            <?php endif; ?>
                                                        </tr>
                                                        <?php endforeach; ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                    </div>

                                    <h4><code>Ticket Details</code></h4> 
                                    <div class="table-responsive"> 
                                        <table id="" class="table table-bordered table-striped table-condensed">
                                            <thead>
                                                <tr>
                                                    <th>Ticket Status</th>
                                                    <th>Remarks</th>
                                                    <th>Created By</th>
                                                    <th>Created At</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                            <?php foreach($ticket->ticketDetails as $ticketDetail): ?>
                                            <tr>
                                                <?php if(isset($ticketDetail->ticketStatus->name)): ?>
                                                    <td><?php echo e($ticketDetail->ticketStatus->name); ?></td>
                                                <?php else: ?>
                                                    <td></td>
                                                <?php endif; ?>
                                                
                                                <td><?php echo e($ticketDetail->remarks); ?></td>

                                                <?php if(isset($ticketDetail->createdBy->name)): ?>
                                                    <td><?php echo e($ticketDetail->createdBy->name); ?></td>
                                                <?php else: ?>
                                                    <td></td>
                                                <?php endif; ?>
                                                <td><?php echo e($ticketDetail->created_at); ?></td>

                                            </tr>
                                            <?php endforeach; ?>
                                            </tbody>
                                        </table>
                                    </div>

                                    <div class="box-footer">
                                        <!-- <a href="#" class="btn btn-default">Cancel</a> -->
                                       
                                        <a href="<?php echo e(url('/ticket/'.$ticket->id.'/edit')); ?>" class="btn btn-success btn-xs btn-block">Update This Ticket</a>
                                        
                                    </div>

                                    <hr>
                                </div>
                            </div>
                      

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

<?php $__env->startSection('style'); ?>
    <!-- <link rel="stylesheet" href="<?php echo e(asset('assets/css/dataTables.bootstrap.min.css')); ?>"> -->
    <style type="text/css">
        hr {
            margin-top: 0px;
            margin-bottom: 0px;
            border: 0;
            border-top: 2px solid #000;
        }

        .panel-heading {
            padding: 0px 15px;
        }
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <!-- <script src="<?php echo e(asset('assets/js/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/dataTables.bootstrap.min.js')); ?>"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $('#example').DataTable();
        } );
    </script> -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>