@php // Ambil background dari card setting $cardStyle = data_get($cardSetting, 'card', []); $bgImage = data_get($cardStyle, 'background', 'defould.png'); $bgPath = asset('assets/images/card/' . $bgImage); // Ambil ukuran kartu dari setting (default: 260px x 400px sesuai dengan yellow-card-3d) // Untuk preview, kita gunakan ukuran tetap yang sesuai dengan yellow-card-3d // karena preview tidak perlu skala yang sama dengan print $cardWidthPx = 260; // Ukuran tetap untuk preview $cardHeightPx = 400; // Ukuran tetap untuk preview // Ambil style untuk elemen-elemen kartu $titleStyle = data_get($cardSetting, 'title', []); $nameStyle = data_get($cardSetting, 'name', []); $photoStyle = data_get($cardSetting, 'photo', []); $qrStyle = data_get($cardSetting, 'qr', []); // QR Code data $qrData = !empty($anggotaCard->nomor_anggota) ? $anggotaCard->nomor_anggota : ($uCard->id ?? ''); $qrSize = data_get($qrStyle, 'size', 80); $qrSvg = \SimpleSoftwareIO\QrCode\Facades\QrCode::size($qrSize)->generate($qrData); $qrBase64 = base64_encode($qrSvg); // Photo shape dan size $photoShape = data_get($photoStyle, 'shape', 'circle'); $photoSize = data_get($photoStyle, 'size', 90); // Position dari card setting atau default - gunakan nilai yang disimpan $titleTop = data_get($titleStyle, 'top', 20); $titleLeft = data_get($titleStyle, 'left', 0); $nameTop = data_get($nameStyle, 'top', 190); $nameLeft = data_get($nameStyle, 'left', 30); $photoTop = data_get($photoStyle, 'top', 70); $photoLeft = data_get($photoStyle, 'left', 85); $qrTop = data_get($qrStyle, 'top', 320); $qrLeft = data_get($qrStyle, 'left', 30); // Style inline jika ada $titleInlineStyle = data_get($titleStyle, 'style_inline', ''); $nameInlineStyle = data_get($nameStyle, 'style_inline', ''); $photoInlineStyle = data_get($photoStyle, 'style_inline', ''); $qrInlineStyle = data_get($qrStyle, 'style_inline', ''); // Visibility $titleVisible = data_get($titleStyle, 'visible', true); $nameVisible = data_get($nameStyle, 'visible', false); $photoVisible = data_get($photoStyle, 'visible', true); $qrVisible = data_get($qrStyle, 'visible', true); @endphp
@if($titleVisible) @php // Prioritas: gunakan style_inline jika ada dan lengkap // Jika tidak ada atau tidak lengkap, gunakan data dari setting $titleStyleAttr = ''; if ($titleInlineStyle && !empty(trim($titleInlineStyle))) { // Style inline sudah berisi semua style termasuk top, left, dll // Gunakan style_inline langsung tanpa modifikasi untuk memastikan akurasi $titleStyleAttr = $titleInlineStyle; // Pastikan display sesuai dengan visibility setting if (stripos($titleStyleAttr, 'display:') === false) { $titleStyleAttr .= " display: " . ($titleVisible ? 'block' : 'none') . " !important;"; } else { // Update display yang ada $titleStyleAttr = preg_replace('/display:\s*[^;]+;?/i', 'display: ' . ($titleVisible ? 'block' : 'none') . ' !important;', $titleStyleAttr); } } else { // Jika tidak ada style inline, gunakan posisi dan style dari setting $titleStyleAttr = "position: absolute !important; top: {$titleTop}px !important; left: {$titleLeft}px !important;"; $titleStyleAttr .= " color: " . data_get($titleStyle, 'color', '#333') . " !important;"; $titleStyleAttr .= " font-family: " . data_get($titleStyle, 'font', 'Arial, sans-serif') . " !important;"; $titleStyleAttr .= " font-size: " . data_get($titleStyle, 'size', 18) . "px !important;"; $titleStyleAttr .= " font-weight: " . data_get($titleStyle, 'weight', 'bold') . " !important;"; $titleStyleAttr .= " text-align: " . data_get($titleStyle, 'align', 'center') . " !important;"; $titleWidth = data_get($titleStyle, 'width', '100%'); $titleStyleAttr .= " width: " . ($titleWidth . (is_numeric($titleWidth) ? 'px' : '')) . " !important;"; $titleStyleAttr .= " display: " . ($titleVisible ? 'block' : 'none') . " !important;"; } @endphp
{{ data_get($cardSetting, 'title.text', 'KARTU ANGGOTA') }}
@endif @if($nameVisible) @php $nameStyleAttr = ''; if ($nameInlineStyle && !empty(trim($nameInlineStyle))) { // Style inline sudah berisi semua style termasuk top, left, dll // Gunakan style_inline langsung tanpa modifikasi untuk memastikan akurasi $nameStyleAttr = $nameInlineStyle; // Pastikan display sesuai dengan visibility setting if (stripos($nameStyleAttr, 'display:') === false) { $nameStyleAttr .= " display: " . ($nameVisible ? 'block' : 'none') . " !important;"; } else { // Update display yang ada $nameStyleAttr = preg_replace('/display:\s*[^;]+;?/i', 'display: ' . ($nameVisible ? 'block' : 'none') . ' !important;', $nameStyleAttr); } } else { // Jika tidak ada style inline, gunakan posisi dan style dari setting $nameStyleAttr = "position: absolute !important; top: {$nameTop}px !important; left: {$nameLeft}px !important;"; $nameStyleAttr .= " color: " . data_get($nameStyle, 'color', '#333') . " !important;"; $nameStyleAttr .= " font-family: " . data_get($nameStyle, 'font', 'Arial, sans-serif') . " !important;"; $nameStyleAttr .= " font-size: " . data_get($nameStyle, 'size', 16) . "px !important;"; $nameStyleAttr .= " font-weight: " . data_get($nameStyle, 'weight', 'normal') . " !important;"; $nameStyleAttr .= " font-style: " . (data_get($nameStyle, 'italic', 'normal') === 'italic' ? 'italic' : 'normal') . " !important;"; $nameStyleAttr .= " display: " . ($nameVisible ? 'block' : 'none') . " !important;"; } @endphp
{{ $uCard->name ?? '-' }}
@endif @if($photoVisible) @php // Untuk circle, pastikan width = height $photoWidth = $photoSize; $photoHeight = $photoSize; $photoStyleAttr = ''; if ($photoInlineStyle && !empty(trim($photoInlineStyle))) { // Style inline sudah berisi semua style termasuk top, left, width, height // Gunakan style_inline langsung tanpa modifikasi untuk memastikan akurasi $photoStyleAttr = $photoInlineStyle; // Pastikan display sesuai dengan visibility setting if (stripos($photoStyleAttr, 'display:') === false) { $photoStyleAttr .= " display: " . ($photoVisible ? 'block' : 'none') . " !important;"; } else { // Update display yang ada $photoStyleAttr = preg_replace('/display:\s*[^;]+;?/i', 'display: ' . ($photoVisible ? 'block' : 'none') . ' !important;', $photoStyleAttr); } } else { // Jika tidak ada style inline, gunakan posisi dan ukuran dari setting $photoStyleAttr = "position: absolute !important; top: {$photoTop}px !important; left: {$photoLeft}px !important; width: {$photoWidth}px !important; height: {$photoHeight}px !important;"; $photoStyleAttr .= " display: " . ($photoVisible ? 'block' : 'none') . " !important;"; } @endphp
@if($pCard && isset($pCard->foto) && $pCard->foto) {{ $uCard->name ?? 'User' }} @else Default photo @endif
@endif @if($qrVisible) @php $qrStyleAttr = ''; if ($qrInlineStyle && !empty(trim($qrInlineStyle))) { // Style inline sudah berisi semua style termasuk top, left, width, height // Gunakan style_inline langsung tanpa modifikasi untuk memastikan akurasi $qrStyleAttr = $qrInlineStyle; // Pastikan display sesuai dengan visibility setting if (stripos($qrStyleAttr, 'display:') === false) { $qrStyleAttr .= " display: " . ($qrVisible ? 'block' : 'none') . " !important;"; } else { // Update display yang ada $qrStyleAttr = preg_replace('/display:\s*[^;]+;?/i', 'display: ' . ($qrVisible ? 'block' : 'none') . ' !important;', $qrStyleAttr); } } else { // Jika tidak ada style inline, gunakan posisi dan ukuran dari setting $qrStyleAttr = "position: absolute !important; top: {$qrTop}px !important; left: {$qrLeft}px !important; width: {$qrSize}px !important; height: {$qrSize}px !important;"; $qrStyleAttr .= " display: " . ($qrVisible ? 'block' : 'none') . " !important;"; } @endphp
QR Code
@endif