<?php $__env->startSection('body'); ?>
    <div class="wrapper-content animated fadeInRight form-horizontal">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins ">
                    <div class="ibox-content">
                        <h2 class="ibox-title">
                            Vizualizare / Editare / Stergere proiect
                        </h2>
                    </div>

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

                    <div class="ibox-content">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th><?php echo e(trans('e.serial')); ?></th>
                                    <th>Nume colet</th>
                                    <th>Nume client</th>
                                    <th>Data crearii</th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                </tr>
                                </thead>
                                <?php if(isset($items) && count($items)): ?>
                                    <tbody>
                                    <?php foreach($items as $key => $item): ?>
                                        <tr>
                                            <td class="serial-td"><?php echo e(isset($item->serial) ? $item->serial : ''); ?></td>
                                            <td><?php echo e($item->name); ?></td>
                                            <td><?php echo e(isset($item->client) ? $item->client->name : ''); ?></td>
                                            <td><?php echo e(date('d/m/Y H:i', strtotime($item->created_at))); ?></td>
                                            <td class="text-center">
                                                <?php if(!empty($item->fan_courier_file)): ?>
                                                    <a href="<?php echo e(url('fan-files', $item->fan_courier_file)); ?>" download
                                                       type="button"
                                                       class="btn btn-w-m btn-info no-float"><i
                                                                class="fa fa-download"></i>
                                                        FanCourier</a>
                                                <?php endif; ?>
                                            </td>
                                            <td class="text-center">
                                                <?php if(!$item->projects()->isNotCanceled()->get()->isEmpty()): ?>
                                                    <button type="button" class="print-labels btn btn-info no-float"
                                                            data-package-id="<?php echo e($item->id); ?>"
                                                            data-fan-courier="<?php echo e(!empty($item->fan_courier_file) ? url('fan-files', $item->fan_courier_file) : ''); ?>">
                                                        <i class="fa fa-print" aria-hidden="true"></i>
                                                        Printare sticher
                                                    </button>
                                                    <div class="print-client-content">
                                                        <div class="serial-print" id="serial-print-<?php echo e($key); ?>">
                                                            <?php foreach($item->projects()->isNotCanceled()->get() as $project): ?>
                                                                <div class="edit-content-serial">
                                                                    <?php echo e(isset($item->serial) ? $item->serial : ''); ?>

                                                                </div>
                                                                <?php if(!empty($project->file)): ?>
                                                                    <div class="print-img">
                                                                        <img src="<?php echo e(url('/'. $project->file)); ?>"
                                                                             alt="">
                                                                    </div>
                                                                <?php endif; ?>
                                                                <?php if(!is_null($item->client) && $item->client->country_id == 140): ?>
                                                                    <div class="print-price">
                                                                        <?php echo e(isset($project->price) ? $project->price : 0); ?> <?php echo e(!is_null($item->currency) ? $item->currency->name : ''); ?>

                                                                    </div>
                                                                <?php endif; ?>
                                                                <?php if($item->projects()->count() > 1): ?>
                                                                    <div class="page-break"></div>
                                                                <?php endif; ?>
                                                            <?php endforeach; ?>
                                                        </div>
                                                    </div>
                                                <?php endif; ?>
                                            </td>
                                            <td class="text-center">
                                                <a href="<?php echo e(url('/project-registry/edit/'.$item->id)); ?>"
                                                   type="button"
                                                   class="btn btn-w-m btn-info no-float"><i class="fa fa-pencil"></i>&nbsp;Editare</a>
                                            </td>
                                        </tr>
                                        <?php if(!$item->projects->isEmpty()): ?>
                                            <tr>
                                                <td colspan="20" class="tr-with-table">
                                                    <table class="children-table">
                                                        <thead>
                                                        <tr>
                                                            <th>Schita proiect</th>
                                                            <th class="text-center">Nume proiect</th>
                                                            <th class="text-center">Etapa parcursa</th>
                                                            <th></th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                        <?php foreach($item->projects as $project): ?>
                                                            <tr>
                                                                <td>
                                                                    <div class="img-block">
                                                                        <a href="<?php echo e(url('/'.(isset($project) ? $project->file  : ''))); ?>"
                                                                           data-fancybox="project-schema-<?php echo e($item->id); ?>"
                                                                           data-caption="<?php echo e(isset($item->serial) ? $item->serial : ''); ?>">
                                                                            <img src="<?php echo e(url('/'.(isset($project) ? $project->file  : ''))); ?>"
                                                                                 alt="">
                                                                        </a>
                                                                    </div>
                                                                </td>
                                                                <td class="text-center"><?php echo e(isset($project->name) ? $project->name : ''); ?></td>
                                                                <td class="text-center"><?php echo e(trans('e.'.($item->status == 1 ? 'draft' : ($item->status == 0 ? 'finished' : $project->status)))); ?></td>
                                                                <td class="text-right">
                                                                    <?php if(!is_null($project->projectStatus) && $project->projectStatus->finishedProject): ?>
                                                                        <span class="finished-success"></span>
                                                                    <?php elseif($project->is_canceled): ?>
                                                                        <span class="is-canceled"></span>
                                                                    <?php else: ?>
                                                                        <span class="in-progress"></span>
                                                                    <?php endif; ?>
                                                                </td>
                                                            </tr>
                                                        <?php endforeach; ?>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                    </tbody>
                                <?php endif; ?>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

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

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