@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => '']) @include('components.alert')
{{-- Document Preview Tabs --}}
Document Preview
@if(isset($is_pi) && $is_pi) @php $piBankInfo = ''; if(isset($ET_HEADER) && count($ET_HEADER) > 0 && !empty($ET_HEADER[0]->account_info_PI)) { $piBankInfo = addslashes($ET_HEADER[0]->account_info_PI); } @endphp @endif
{{-- View Dropdown --}} {{-- Download Dropdown --}} {{-- Print Dropdown --}} {{-- Edit PI Info Button --}} @if(isset($is_pi) && $is_pi && !(isset($is_admppc) && $is_admppc)) @endif
@if(isset($is_admppc) && $is_admppc)
{{-- Zoom Controls --}} {{-- Fullscreen Control --}}
@php // get use_different_template from backend $useElseTemplate = isset($use_different_template) ? $use_different_template : false; @endphp @php $viewName = $useElseTemplate ? 'pages.documents.internal_order_else' : 'pages.documents.internal_order'; $content = view($viewName, get_defined_vars())->render(); $content = preg_replace('/||<\/html>||<\/head>||<\/body>/is', '', $content); @endphp {!! $content !!}
@else
{{-- Zoom Controls --}} {{-- Fullscreen Control --}}
@php // get use_different_template from backend $useElseTemplate = isset($use_different_template) ? $use_different_template : false; @endphp @php $viewName = $useElseTemplate ? 'pages.documents.sales_contract_else' : 'pages.documents.sales_contract'; $content = view($viewName, get_defined_vars())->render(); $content = preg_replace('/||<\/html>||<\/head>||<\/body>/is', '', $content); @endphp {!! $content !!}
@if(!(isset($is_admppc) && $is_admppc)) @if(isset($is_pi) && $is_pi) @endif @endif
@if(!(isset($is_admppc) && $is_admppc)) {{-- Attachment Preview Section --}}
Dokumen PO (Purchase Order) @if(isset($attachments) && $attachments->count() > 0) {{ $attachments->count() }} file @endif
@php $currentUser = \App\Models\User::where('username', session('username'))->first(); $userRoles = explode(',', $currentUser->idroles); $canUpdate = !empty(array_intersect(['admind', 'admhm1'], $userRoles)); $hasAttachment = isset($attachments) && $attachments->count() > 0; @endphp @if($canUpdate) @endif
@if($hasAttachment) @php $attachmentsForJs = $attachments->map(function($att) { return [ 'id' => $att->id ?? 0, 'path' => asset('storage/' . $att->file_path), 'name' => $att->original_name, 'extension' => strtolower(pathinfo($att->file_path, PATHINFO_EXTENSION)) ]; })->values(); @endphp {{-- All Documents Stacked Vertically --}}
@foreach($attachments as $index => $attachment) @php $extension = strtolower(pathinfo($attachment->file_path, PATHINFO_EXTENSION)); $isImage = in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'webp']); $isPdf = $extension === 'pdf'; $attPath = asset('storage/' . $attachment->file_path); @endphp
{{-- Header with controls --}}
{{ $index + 1 }} {{ $attachment->original_name }}
@if($isImage || $isPdf) @endif Download @if($canUpdate && isset($attachment->id) && $attachment->id > 0) @endif
{{-- Document Preview --}}
@if($isImage)
{{ $attachment->original_name }}
@elseif($isPdf) @else

Preview tidak tersedia untuk tipe file ini.

@endif
@endforeach
@else {{-- No attachment yet --}}

Tidak ada dokumen PO yang diunggah.

@if($canUpdate) @endif
@endif
@endif {{-- check flag js on dmenu --}} @if ($jsmenu == '1') @if (view()->exists("js.{$dmenu}")) @push('addjs') {{-- file js in folder (resources/views/js) --}} @include('js.' . $dmenu); @endpush @else @push('addjs') @endif @endpush @endif @endif @endsection @push('js') @endpush