diff --git a/resources/views/fields/generate-template-preview.blade.php b/resources/views/fields/generate-template-preview.blade.php new file mode 100644 index 0000000..50b9885 --- /dev/null +++ b/resources/views/fields/generate-template-preview.blade.php @@ -0,0 +1,47 @@ +{{-- @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 + + +
+ + Show Template Preview + +
--}}