File: /var/www/ipsremont-demo/storage/framework/views/fb27cc4704108b4af15ea71ea8922268ae88b628.php
<?php
/**
* @var mixed $data
* @var string $type
*/
use App\Models\Device;
use App\Models\Part;
use App\Models\PartsStorage;
use App\Models\Permission;
use App\Models\Schema;
use Illuminate\Support\Collection;
if ('schema' === $type) {
/** @var Schema $data */
$schema = $data;
} else {
/** @var Device $data */
$schema = $data->schema();
}
/** @var Collection $parts */
$parts = $schema->getParts();
?>
<table class="table table-hover parts-table">
<tbody>
<?php if(!$parts->isEmpty()): ?>
<?php
$partsIds = [];
foreach ($parts as $part) {
$partsIds[] = $part->id;
}
$counts = [];
$partsStorage = PartsStorage::query()->whereIn('part_id', $partsIds)->get();
foreach ($partsStorage as $row) {
if (empty($counts[$row['part_id']])) {
$counts[$row['part_id']] = 0;
}
$counts[$row['part_id']] += $row->amount;
}
?>
<?php $__currentLoopData = $parts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $part): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php /** @var Part $part */ ?>
<tr class="font-size-lg">
<td class="d-flex align-items-center">
<!--begin::Symbol-->
<div class="symbol symbol-60 flex-shrink-0 mr-4 bg-light">
<div class="symbol-label" style="background-image: url('<?php echo e($part->getImage()); ?>')"></div>
</div>
<!--end::Symbol-->
<div class="d-flex flex-column flex-grow-1 my-lg-0 my-2 pr-3">
<span class="text-dark-75">
<?php echo e(($type == 'device') ? $part->device_parts->label() : $part->schema_parts()->where('schema_external_id', $schema->external_id)->first()->label()); ?>
<?php if(empty($counts[$part->id])): ?>
<span class="text-danger">(нет в наличии)</span>
<?php endif; ?>
</span>
<a href="<?php echo e(route('specifications.categories.device.part', $part->id)); ?>" class="text-primary font-weight-bolder text-hover-primary font-size-lg"><?php echo e($part->getName()); ?></a>
<span class="text-dark-75 font-weight-bold font-size-sm my-1"><?php echo e($part->external_id); ?></span>
</div>
</td>
<?php if(can([Permission::orders, Permission::actions])): ?>
<td class="text-right">
<?php echo e(($type === 'device') ? $part->device_parts->amount : $part->schema_parts->where('schema_external_id', $schema->external_id)->first()->amount); ?> <?php echo e($part->getItemName()); ?>
</td>
<?php endif; ?>
<td class="text-right align-middle font-weight-bolder font-size-h5">
<?= $part->getPriceConverted() ?>
</td>
<?php if(can([Permission::orders, Permission::actions])): ?>
<td class="js-go-to text-right align-middle">
<button id="add-to-cart" data-token="<?php echo e(csrf_token()); ?>" data-id="<?php echo e($part->id); ?>" type="submit" class="btn btn-warning text-uppercase font-weight-bold ml-3 add-to-cart">
<?php echo app('translator')->get('parts.toCart'); ?>
</button>
</td>
<?php endif; ?>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<tr>
<td align="center"><?php echo app('translator')->get('parts.notFound'); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php /**PATH /var/www/ipsremont-demo/resources/views/specifications/_table.blade.php ENDPATH**/ ?>