Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
17 kB
1
Indexable
Never
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- <title>Peno Report</title> -->
</head>

<body>
    <table style="border: 2px solid #000000;border-collapse: collapse;padding: 5px;width: 100%;table-layout: fixed;">
        <thead>
            <tr>
                <th colspan="2" align="center" style="border: 1px solid #000000 ;padding: 1px;min-height: 40px;background-color:#C0C0C0 ;vertical-align: center;">Project Name:</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;word-wrap: break-word;">{{ isset($building['building_name']) ? $building['building_name'] .' '. $name : '' }}</th>
                <th colspan="5" rowspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color: {{ $header_report_color }};font-size: 24px;color: white;vertical-align: center;word-wrap: break-word;text-align: center;"><b>{{ isset($title_report) && $title_report == 'Inspection' ? $title_report . ' Report' : $title_report . ' Inspection' }}</b></th>
                <?php $minColumn = 13;
                    $headerAttrColumnCount = isset($table_data[0]) ? count($table_data[0]) : 0;
                    $appendHeaderColumn = $headerAttrColumnCount - $minColumn;
                    $appendAttrValueColumn = $minColumn - $headerAttrColumnCount;
                ?>
                <th colspan="{{ $headerAttrColumnCount > $minColumn ? $appendHeaderColumn +3 : 3 }}" rowspan="4" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;">
                    <?php
                        if(isset($is_api)) {
                            $logo = str_replace(asset(''), "", $logo);
                        } else {
                            $logo = 'storage/'.$logo;
                        }
                        $logo = public_path($logo);
                        if ($logo) {
                            $arrContextOptions = [
                                "ssl" => [
                                    "verify_peer" => false,
                                    "verify_peer_name" => false,
                                ],
                            ];

                            $imageData = @file_get_contents($logo, false, stream_context_create($arrContextOptions));

                            if ($imageData) {
                                // Define the path in the 'storage/app/public' directory
                                $storePath = $tempFolder;
                                $type = pathinfo($logo, PATHINFO_EXTENSION);

                                // Create a unique file name for the image
                                $fileName = 'logo_' . uniqid() . $type; // Adjust extension if necessary

                                // Define the relative path in the 'public' disk (storage/app/public/...)
                                $filePath = $storePath.'/'.$fileName;

                                // Save the image to the 'public' disk
                                file_put_contents($filePath, $imageData);

                                $relativeFilePath = str_replace(storage_path('app/public/'), '', $filePath);
                                $logo_img = "storage/$relativeFilePath";
                            }
                        }
                    ?>
                    <img height="100" @if(isset($logo_img)) src="{{ public_path($logo_img) }}" @endif />
                </th>
            </tr>
            <tr>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Contact:</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;">{{ isset($building['contact']) ? $building['contact'] : '' }}</th>
            </tr>
            <tr>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Phone:</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;">{{ isset($building['phone']) ? $building['phone'] : '' }}</th>
            </tr>
            <tr>
                <th rowspan="2" colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Address:</th>
                <th rowspan="2" colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;word-wrap: break-word;">{{ isset($building['address']) ? $building['address'] : '' }}</th>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Inspector:</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;word-wrap: break-word;">{{ isset($inspector_name) ? $inspector_name : '' }}</th>
            </tr>
            <tr>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Licence / Registration</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;">{{ isset($inspector_licence) ? $inspector_licence : '' }}</th>
                <th rowspan="2" colspan="{{ $headerAttrColumnCount > $minColumn ? $appendHeaderColumn +3 : 3 }}" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;padding: 0;vertical-align: center;word-wrap: break-word;">
                    <p style="margin: 0 0 2px 0;">{{ isset($owner['firstProfile']) ? $owner['firstProfile']['company_name'] : '' }}</p>
                    <p style="margin: 0 0 2px 0;">{{ isset($owner['firstProfile']) ? $owner['firstProfile']['address'] : '' }}</p>
                    <p style="margin: 0 0 2px 0;">Phone: {{ isset($owner['firstProfile']) ? $owner['firstProfile']['phone'] : '' }}</p>
                </th>
            </tr>
            <tr>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Class:</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;word-wrap: break-word;">{{ isset($building['building_class']) ? implode(', ', $building['building_class']) : '' }}</th>
                <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color:#C0C0C0;vertical-align: center;">Date</th>
                <th colspan="3" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;vertical-align: center;">{{ date('d/m/Y', strtotime($created_at)) }}</th>
            </tr>
            <tr>
                {{-- <th colspan="2" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;background-color: {{ $header_note_color }};vertical-align: center;">Notes:</th> --}}
                <th colspan="11" align="center" style="border: 1px solid #000000;padding: 1px;min-height: 40px;font-weight: normal;vertical-align: center;word-wrap: break-word;">{{ isset($task['task_description']) ? $task['task_description'] : '' }}</th>
            </tr>
        </thead>
        <tbody align="center">
            @foreach ($table_data as $row)
                @if ($loop->first)
                <tr align="center">
                    @foreach ($row as $td)
                        <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;"><b>{{ $td }}</b></td>
                    @endforeach
                    @for($i=1; $i<=$appendAttrValueColumn; $i++)
                        <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;"><b>&nbsp;</b></td>
                    @endfor
                </tr>
                @else
                <tr>
                    @foreach ($row as $td)
                        @if($td != null)
                            @if($task_type == 1 || $custom_task_type == 1 )
                                @if ($td['data_type'] == 1)
                                <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                {!! is_array($td['value']) ? htmlspecialchars($td['value']['value']) : htmlspecialchars($td['value']) !!}
                                </td>
                                @elseif ($td['data_type'] == 3)
                                    <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                <?php
                                    $tempAttrImg = '';
                                    if(isset($td['value']['link'])) {
                                        $imageData = "";
                                        $imageUrl = $td['value']['link'];
                                        $imageUrl = str_replace(asset(''), "", $imageUrl);
                                        $imageUrl = public_path('storage'.$imageUrl);
                                        $arrContextOptions = [
                                            "ssl" => [
                                                "verify_peer" => false,
                                                "verify_peer_name" => false,
                                            ],
                                        ];

                                        $type = pathinfo($imageUrl, PATHINFO_EXTENSION);
                                        $imageData = @file_get_contents($imageUrl, false, stream_context_create($arrContextOptions));

                                        if ($imageData) {
                                            $storePath = $tempFolder;
                                            $fileName = 'img_' . uniqid() . $type; // Adjust extension if necessary
                                            $filePath = $storePath.'/'.$fileName;
                                            file_put_contents($filePath, $imageData);
                                            $relativeFilePath = str_replace(storage_path('app/public/'), '', $filePath);
                                            $tempAttrImg = "storage/$relativeFilePath";
                                        }
                                    }
                                ?>
                                <img height="54px" @if(!empty($tempAttrImg)) src="{{ public_path($tempAttrImg) }}" @endif />
                                </td>
                                @elseif ($td['data_type'] == 5)
                                    @if ($td['value'])
                                        <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                            &#9745;
                                        </td>
                                    @else
                                        <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                            &#9744;
                                        </td>
                                    @endif
                                @else
                                <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                {!! is_array($td['value']) ? htmlspecialchars($td['value']['value']) : htmlspecialchars($td['value']) !!}
                                </td>
                                @endif
                            @else
                                @if ($td['data_type'] == 1)
                                    <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                        {!! is_array($td['value']) ? htmlspecialchars($td['value']['value']) : htmlspecialchars($td['value']) !!}
                                    </td>
                                    @elseif ($td['data_type'] == 3)
                                    <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                        <?php
                                            $tempAttrImg = '';
                                            if(isset($td['value']['link'])) {
                                                $imageData = "";
                                                $imageUrl = $td['value']['link'];
                                                $imageUrl = str_replace(asset(''), "", $imageUrl);
                                                $imageUrl = public_path('storage'.$imageUrl);
                                                $arrContextOptions = [
                                                    "ssl" => [
                                                        "verify_peer" => false,
                                                        "verify_peer_name" => false,
                                                    ],
                                                ];

                                                $type = pathinfo($imageUrl, PATHINFO_EXTENSION);
                                                $imageData = @file_get_contents($imageUrl, false, stream_context_create($arrContextOptions));

                                                if ($imageData) {
                                                    $storePath = $tempFolder;
                                                    $fileName = 'img_' . uniqid() . $type; // Adjust extension if necessary
                                                    $filePath = $storePath.'/'.$fileName;
                                                    file_put_contents($filePath, $imageData);
                                                    $relativeFilePath = str_replace(storage_path('app/public/'), '', $filePath);
                                                    $tempAttrImg = "storage/$relativeFilePath";
                                                }
                                            }
                                        ?>
                                    <img height="54px" @if(!empty($tempAttrImg)) src="{{ public_path($tempAttrImg) }}" @endif />
                                </td>
                                @elseif ($td['data_type'] == 5)
                                    @if ($td['value'])
                                        <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                            &#9745;
                                        </td>
                                    @else
                                        <td style="font-size: 17px;border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                            &#9744;
                                        </td>
                                    @endif
                                @else
                                    <td style="border: 1px solid #000000;padding: 1px;vertical-align: center;word-wrap: break-word;text-align: center;">
                                        {!! is_array($td['value']) ? htmlspecialchars($td['value']['value']) : htmlspecialchars($td['value']) !!}
                                    </td>
                                @endif
                            @endif

                        @else
                        <td style="border: 1px solid #000000;padding: 1px;">&nbsp;</td>
                        @endif
                    @endforeach
                    @for($i=1; $i<=$appendAttrValueColumn; $i++)
                        <td style="border: 1px solid #000000;padding: 1px;">&nbsp;</td>
                    @endfor
                </tr>
                @endif
            @endforeach
        </tbody>
    </table>
</body>
</html>
Leave a Comment