Files
qds/resources/views/fields/generate-template-preview.blade.php
dhanabalan b3e0db6815
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 20s
Laravel Larastan / larastan (pull_request) Failing after 2m40s
Laravel Pint / pint (pull_request) Failing after 2m35s
Commented Blade File
2025-12-23 17:47:37 +05:30

48 lines
1.3 KiB
PHP

{{-- @props(['sticker_id']) --}}
{{-- @props([
'sticker_id',
'plant_id',
'item_characteristic_id',
])
@php
use App\Models\StickerStructureDetail;
$hasStickerId = !empty($sticker_id) && $sticker_id != 'empty';
$hasPlantAndItem = !empty($plant_id) && !empty($item_characteristic_id);
$isValid = false;
if ($hasStickerId) {
$isValid = StickerStructureDetail::where('sticker_id', $sticker_id)->exists();
}
$url = $isValid
? route('stickers.pdf', [
'stickerId' => $sticker_id,
// include only if present
'plant_id' => $hasPlantAndItem ? $plant_id : null,
'item_characteristic_id' => $hasPlantAndItem ? $item_characteristic_id : null,
])
: '#';
@endphp
<div class="flex flex-col items-start space-y-2">
<a
href="{{ $url }}"
@if(!$isValid)
onclick="alert('Sticker ID not found in sticker structure preview!'); return false;"
@endif
target="_blank"
class="px-2 py-1 border
{{ $isValid
? 'border-success-500 text-success-600 hover:bg-success-50 hover:border-success-700'
: 'border-gray-300 text-gray-400 cursor-not-allowed' }}
rounded transition text-sm"
>
Show Template Preview
</a>
</div> --}}