<?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">
                        <a href="<?php echo e(url('/project/edit')); ?>" class="btn btn-outline btn-info pull-right">
                            <i class="fa fa-plus"></i>Adauga colet
                        </a>
                        <h2 class="ibox-title">
                            Adaugare/Editare proiect
                        </h2>
                    </div>

                    <?php if(isset($items) && count($items)): ?>

                        <?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 class="text-center">Nume colet</th>
                                        <th class="text-center">Nume client</th>
                                        <th class="text-center">Data crearii</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php foreach($items as $item): ?>
                                        <tr>
                                            <td class="serial-td"><?php echo e(isset($item->serial) ? $item->serial : ''); ?></td>
                                            <td class="text-center"><?php echo e(isset($item->name) ? $item->name : ''); ?></td>
                                            <td class="text-center"><?php echo e(isset($item->client->name) ? $item->client->name : ''); ?></td>
                                            <td class="text-center"><?php echo e(date('d/m/Y H:i', strtotime($item->created_at))); ?></td>
                                            <td class="text-right">
                                                <a href="<?php echo e(url('/project/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-right">Etapa parcursa</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-right"><?php echo e(trans('e.draft')); ?></td>
                                                            </tr>
                                                        <?php endforeach; ?>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    <?php else: ?>
                        <div class="empty-list"><?php echo e(trans('e.empty_list')); ?></div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

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