ultimatepos/Modules/Maintenance/Resources/views/equipment_parts/_tree.blade.php

51 lines
2.5 KiB
PHP

@foreach($nodes as $node)
@php $part = $node['part']; @endphp
<tr>
<td style="padding-right: {{ ($depth * 18) + 12 }}px;">
@if($depth > 0)<i class="fa fa-level-up-alt fa-rotate-90 text-muted"></i>@endif
<strong>{{ $part->part_name }}</strong>
@if($part->is_consumable)<span class="label label-warning" style="margin-right:4px;">مصرفی</span>@endif
@if($part->is_critical)<span class="label label-danger" style="margin-right:4px;">بحرانی</span>@endif
</td>
<td>{{ $part->part_code ?? '—' }}</td>
<td>{{ $part_types[$part->part_type] ?? $part->part_type ?? '—' }}</td>
<td>{{ $part->quantity ?? '—' }} {{ $part->unit ?? '' }}</td>
<td>
@if($part->warranty_status && $part->warranty_status !== 'none')
{{ $warranty_statuses[$part->warranty_status] ?? $part->warranty_status }}
@if($part->warranty_expires_at)
<br><small class="text-muted">{{ $util->formatDate($part->warranty_expires_at) }}</small>
@endif
@else
@endif
</td>
<td>{{ $part->health_percentage !== null ? number_format((float) $part->health_percentage, 1).'%' : '—' }}</td>
<td>
@can('maintenance.equipment.update')
<div class="btn-group">
<button type="button" class="btn btn-xs btn-primary btn-modal"
data-href="{{ action([\Modules\Maintenance\Http\Controllers\EquipmentPartController::class, 'edit'], [$equipment->id, $part->id]) }}"
data-container=".maintenance_equipment_part_modal">
<i class="glyphicon glyphicon-edit"></i>
</button>
<button type="button" class="btn btn-xs btn-danger delete_mm_equipment_part"
data-href="{{ action([\Modules\Maintenance\Http\Controllers\EquipmentPartController::class, 'destroy'], [$equipment->id, $part->id]) }}">
<i class="glyphicon glyphicon-trash"></i>
</button>
</div>
@endcan
</td>
</tr>
@if(!empty($node['children']))
@include('maintenance::equipment_parts._tree', [
'nodes' => $node['children'],
'depth' => $depth + 1,
'equipment' => $equipment,
'util' => $util,
'part_types' => $part_types,
'warranty_statuses' => $warranty_statuses,
])
@endif
@endforeach