<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Pengeluaran Cetakan Pengurus Besar</title>

    <link rel="icon" type="image/x-icon" href="{{ asset('img/icon_pkb.png') }}" />


    <link href="{{ asset('css/all.min.css') }}" rel="stylesheet">
    
    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">

</head>
<body class="p-2">

    <div class="mb-2">
        <div class="w-100 d-flex flex-column text-right">
            <div class="ml-2">
                <div class="column">
                <b>{{ $fullname }}</b>
                <div style="font-size: 0.75rem;line-height: 1rem;">{{ $cawangan_detail['namacaw'] }}</div>
                <div style="font-size: 0.75rem;line-height: 1rem;">{{ $cawangan_detail['alamat1'] }}</div>
                <div style="font-size: 0.75rem;line-height: 1rem;">{{ $cawangan_detail['alamat2'] }}</div>
                </div>
            
                <div class="d-flex justify-content-end">
                <span class="font-size: 0.75rem;line-height: 1rem; mr-2">No Tel : {{ $cawangan_detail['notel'] }}</span><br>
                <span class="font-size: 0.75rem;line-height: 1rem;">No Faks : {{ $cawangan_detail['nofaks'] }}</span><br>
                </div>
            </div>
        </div>

    </div>
    <div class="d-flex ">
        <div class="ml-2 w-50 d-flex flex-column justify-content-end">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Kepada</b>
            <p style="font-size: 0.75rem;line-height: 1rem;">
                @php
                    if($jeniscawangan === 'BMMB')
                    {
                        echo 'AHLI ' . $fullname;
                    }else{
                        echo 'Pengurus Besar Kumpulan PKB';
                    }
                    @endphp
                </p>
        </div>

        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1 justify-content-end">No Permohonan</b>
            <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">{{ $permohonan['nopermohonan'] }}</p>
        </div>
    </div>

    <div class="d-flex mb-2">
        <div class="ml-2 w-50 d-flex flex-column justify-content-end">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Daripada</b>
            <div class="column">
            <div style="font-size: 0.75rem;line-height: 1rem;">{{ ($permohonan['jawatan_pemohon'] == 'pc') ? 'Pengurus Cawangan' : 'Pen. Peng. Cawangan' }} {{ $cawangan_detail['namacaw'] }}</div>
            <div style="font-size: 0.75rem;line-height: 1rem;">Nama : {{ $permohonan['nama_pemohon'] }}</div>
            </div>
            {{-- <p style="font-size: 0.75rem;line-height: 1rem;">NO KP : 970403-03-5003</p> --}}

        </div>

        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Tarikh</b>
            <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">{{ $tarikhcetakan }}</p>
        </div>
    </div>

    <div class="d-flex mb-2">
        <div class="ml-2 w-100 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;background-color: #bdc3c7;" class="border border-dark pl-1 text-center font-weight-bold"> PENYEDIA PERMOHONAN</b>
        </div>
    </div>
    

    <div class="d-flex ">
        <div class="ml-2 w-50 d-flex flex-column justify-content-end">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Disediakan oleh</b>
            <p class="h-8"></p>
            <br>
            <div class="d-flex">
                {{-- <div class="w-50"></div> --}}
                {{-- <p class="text-xs w-100 text-right italic text-black">{{ $permohonan['nama_pemohon'] }}</p> --}}
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
            <div class="justify-content-end border-top border-secondary w-25"></div>
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 text-right">{{ ($permohonan['jawatan_pemohon'] == 'pc') ? 'Pengurus Cawangan' : 'Pen. Peng. Cawangan' }}</p>
            </div>
            <div class="d-flex">
                <p style="font-size: 0.75rem;line-height: 1rem;" class="text-center w-50">Tarikh</p>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-25 border border-gray-400 text-right">
                    @php 
                    $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_permohonan']);
                    $formattedweddingdate = $myDateTime->format('d-m-Y');
                    echo($formattedweddingdate)
                    @endphp
                </p>
            </div>

        </div>

    </div>

    <div class="d-flex ">
        <div class="ml-2 w-100 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;background-color: #bdc3c7;" class="border border-dark pl-1 text-center font-weight-bold">PERMOHONAN PENDAHULUAN / SERAHAN WANG PETI BESI</b>
        </div>
    </div>

    <div class="d-flex mb-1">
        <div class="ml-2 w-50 d-flex flex-column justify-content-end">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">PERMOHONAN PENDAHULUAN WANG PETI BESI</b>
            @if($permohonan['jenismohon'] === 'permohonanwang')
                <div class="d-flex column">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Jumlah dipohon</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">RM {{ number_format($permohonan['amaun_mohon'],2) }}</div>
                </div>
                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh mohon</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                        @php
                        if($permohonan['tarikh_pengesahanoperasi'] !== null)
                        {
                            $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_pengesahanoperasi']);
                            $formattedweddingdate = $myDateTime->format('d-m-Y');
                            echo($formattedweddingdate);
                        }
                        @endphp
                    </div>
                </div>
                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Peti Besi</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                        RM {{ number_format($permohonan['baki_petibesi'],2) }}
                    </div>
                </div>

                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Pendahuluan terkumpul sehingga kini</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    </div>
                </div>

                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Pembiayaan</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    </div>
                </div>

                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-1/5">Nama</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-4/5 border border-gray-400 text-right">
                    </div>
                </div>

                <div class="d-flex">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">No. KP</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    </div>
                </div>

                <div class="d-flex flex-column">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Penerima Telegrafic Transfer (TT)</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100 h-4 border border-gray-400 text-right">
                    </div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100 h-4 border border-gray-400">
                        Nota:
                    </div>
                </div>

                <div class="mt-2 d-flex ">
                <div class="w-100 d-flex flex-column justify-content-end">
                    <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Disahkan oleh</b>
                    <p class="h-8"></p>
                    <div class="d-flex">
                        {{-- <div class="w-50"></div> --}}
                        {{-- <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100 text-right italic text-black">{{ $permohonan['nama_pemohon'] }}</p> --}}
                    </div>
                    <div class="d-flex">
                        <div class="w-50"></div>
                    <div class="text-right border-top border-secondary w-25"></div>
                    </div>
                    <div class="d-flex">
                        <div class="w-50"></div>
                        <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 text-right">Pengurus Cawangan</p>
                    </div>
                    <div class="d-flex">
                        <p style="font-size: 0.75rem;line-height: 1rem;" class="text-center w-50">Tarikh</p>
                        <p style="font-size: 0.75rem;line-height: 1rem;" class="w-25 border border-gray-400 text-right">
                            @php 
                            $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_permohonan']);
                            $formattedweddingdate = $myDateTime->format('d-m-Y');
                            echo($formattedweddingdate)
                            @endphp
                        </p>
                    </div>
        
                </div>
                </div>
            @else
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Jumlah dipohon</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right"></p>
                </div>
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh mohon</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
    
                    </p>
                </div>
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Peti Besi</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                       
                    </p>
                </div>
            @endif
        </div>

        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1 justify-content-end">SERAHAN WANG PETI BESI</b>
            @if($permohonan['jenismohon'] === 'permohonanwang')
                <div class="d-flex column">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Jumlah Serahan</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400"></div>
                </div>
                <div class="d-flex column">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh Transaksi</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400"></div>
                </div>
                <div class="d-flex column">
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Peti besi</div>
                    <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400"></div>
                </div>

                <div>
                    <div class="mb-n2">
                        <label class="d-flex items-center">
                          <input type="checkbox" class="form-checkbox h-4 w-4">
                          <span style="font-size: 0.75rem;line-height: 1rem;" class="ml-1">Terminal</span>
                        </label>
                    </div>
                    <div class="mb-n2">
                        <label class="d-flex items-center">
                          <input type="checkbox" class="form-checkbox h-4 w-4">
                          <span style="font-size: 0.75rem;line-height: 1rem;" class="ml-1">Bank In</span>
                        </label>
                    </div>
                    <div class="mb-n2">
                        <label class="d-flex items-center">
                          <input type="checkbox" class="form-checkbox h-4 w-4">
                          <span style="font-size: 0.75rem;line-height: 1rem;" class="ml-1">Cash In Transit (CIT)</span>
                        </label>
                    </div>  
                </div>
            @else
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Bayar balik pinjaman</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">{{ number_format($permohonan['amaun_mohon'],2) }}</p>
                </div>
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh bank-in ke PKB</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                        @php 
                            $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_permohonan']);
                            $formattedweddingdate = $myDateTime->format('d-m-Y');
                            echo($formattedweddingdate)
                        @endphp
                    </p>
                </div>
                <div class="d-flex">
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Peti Besi</p>
                    <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">{{ number_format($permohonan['baki_petibesi'],2) }}</p>
                </div>
            @endif
        </div>
    </div>

    <div class="d-flex ">
        <div class="ml-2 w-100 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;background-color: #bdc3c7;" class="border border-dark pl-1 text-center font-weight-bold">PENGESAHAN BAHAGIAN OPERASI AR-RAHN</b>
        </div>
    </div>

    <div class="d-flex ">

        <div class="ml-2 w-50 d-flex flex-column">

        </div>
        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1">Disahkan oleh</b>
            
            <p class="h-8"></p>
            <br>
            <div class="d-flex">
                {{-- <p style="font-size: 0.75rem;line-height: 1rem;" class="w-100 text-right italic">{{ $permohonan['nama_operasi'] }}</p> --}}
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
            <div class="text-right border-top border-secondary w-25"></div>
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 text-right">Pengurus Operasi Ar-Rahn</p>
            </div>
            <div class="d-flex">
                <p style="font-size: 0.75rem;line-height: 1rem;" class="text-center w-50">Tarikh</p>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-25 border border-gray-400 text-right">
                    @php 
                    // $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_pengesahanoperasi']);
                    // $formattedweddingdate = $myDateTime->format('d-m-Y');
                    // echo($formattedweddingdate)
                    @endphp
                </p>
            </div>

        </div>

    </div>

    <div class="ml-2 w-100 d-flex flex-column">
        <b style="font-size: 0.75rem;line-height: 1rem;background-color: #bdc3c7;" class="border border-dark pl-1 text-center font-weight-bold">@php if($jeniscawangan === 'PKB')
        {
            echo 'KELULUSAN ' . $fullname;
        }else{
            echo 'KELULUSAN AHLI ' . $fullname;
        }
        @endphp
        </b>
    </div>

    <div class="d-flex">
        <p style="font-size: 0.75rem;line-height: 1rem;" class="mt-2 w-2/4">Diluluskan pengeluaran wang kepada Ar-Rahn sebanyak RM</p>
        <p style="font-size: 0.75rem;line-height: 1rem;" class="mt-2 w-25">{{ ($permohonan['jumlah_diluluskan'] !== null) ? number_format($permohonan['jumlah_diluluskan'],2) : ''  }} </p>
    </div>

    <div class="d-flex">
        <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50">{{ ($ringgittext !== '') ? '(Ringgit Malaysia:' . $ringgittext . ' Sahaja)' : '' }}</p>
    </div>

    <div class="d-flex ">
        <div class="ml-2 w-50 d-flex flex-column justify-content-end">
            <p class="h-8"></p>
            <div class="d-flex">
                <div class="w-50"></div>
            <div class="text-right border-top border-secondary w-25"></div>
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 text-right">Ketua Kewangan & Akaun</p>
            </div>
            <div class="d-flex">
                <p style="font-size: 0.75rem;line-height: 1rem;" class="text-center w-50">Tarikh</p>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-25 border border-gray-400 text-right">
                    @php 
                    if($permohonan['tarikh_pengesahanakaun'] !== null)
                    {
                        $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_pengesahanakaun']);
                        $formattedweddingdate = $myDateTime->format('d-m-Y');
                        echo($formattedweddingdate);
                    }
                   
                    @endphp
                </p>
            </div>
        </div>

        <div class="ml-2 w-50 d-flex flex-column">
            
            <p class="h-8"></p>
            <div class="d-flex">
                <div class="w-50"></div>
            <div class="text-right border-top border-secondary w-25"></div>
            </div>
            <div class="d-flex">
                <div class="w-50"></div>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-50 text-right">
                @php if($jeniscawangan === 'BMMB')
                {
                    echo 'Ahli JMC';
                }else{
                    echo 'Pengurus Besar';
                }
                @endphp
                </p>
            </div>
            <div class="d-flex column">
                <p style="font-size: 0.75rem;line-height: 1rem;" class="text-center w-50">Tarikh</p>
                <p style="font-size: 0.75rem;line-height: 1rem;" class="w-25 border border-gray-400 text-right">
                    @php 
                    if($permohonan['tarikh_diluluskan'] !== null)
                    {
                        $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_diluluskan']);
                        $formattedweddingdate = $myDateTime->format('d-m-Y');
                        echo($formattedweddingdate);
                    }
                    @endphp
                </p>
            </div>

        </div>
    </div>

    <div class="w-100 pl-2">
        <span class="text-black font-weight-bold text-xs">Kaedah Penghantaran:</span>
        <div class="w-25">
          <div class="mb-n2">
            <label class="d-flex items-center">
              <input type="checkbox" class="form-checkbox h-4" checked>
              <span style="font-size: 0.75rem;line-height: 1rem;" class="ml-2">Cash In Transit (CIT)</span>
            </label>
          </div>
          <div class="mb-n2">
            <label class="d-flex items-center">
              <input type="checkbox" class="form-checkbox h-4">
              <span style="font-size: 0.75rem;line-height: 1rem;" class="ml-2">Telegrafic Transfer (TT)</span>
            </label>
          </div>
        </div>
      </div>

    <div class="d-flex mt-4">
        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1 text-center">PENERIMA WANG</b>
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1 text-center">Wakil Ar-Rahn</b>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Pengesahan penerima wang oleh</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                
                    {{ ($permohonan['nama_penerima'] !== null) ? $permohonan['nama_penerima'] : '' }}
                
                </div>
            </div>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh serahan</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    @php 

                    if($permohonan['tarikh_terima'] !== null)
                    {
                        $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_terima']);
                        $formattedweddingdate = $myDateTime->format('d-m-Y');
                        echo($formattedweddingdate);
                    }
                    @endphp
                    </div>
            </div>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Baki Peti Besi</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    @php
                    $jumlah = 0;
                    if($permohonan['jumlah_diluluskan'] !== null)
                    {
                        $jumlah = floatval($permohonan['baki_petibesi']) + floatval($permohonan['jumlah_diluluskan']);
                        echo 'RM ' . number_format($jumlah,2);
                    } 
                    @endphp
                </div>
            </div>
           
            {{-- <p style="font-size: 0.75rem;line-height: 1rem;">NO KP : 970403-03-5003</p> --}}

        </div>

        <div class="ml-2 w-50 d-flex flex-column">
            <b style="font-size: 0.75rem;line-height: 1rem;" class="border border-dark pl-1 text-center">Bahagian Kewangan & Akaun PKB</b>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Bank</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right"></div>
            </div>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">No. Rujukan</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right"></div>
            </div>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Tarikh kemasukan</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    @php 

                    if($permohonan['tarikh_terima'] !== null)
                    {
                        $myDateTime = DateTime::createFromFormat('Y-m-d', $permohonan['tarikh_terima']);
                        $formattedweddingdate = $myDateTime->format('d-m-Y');
                        echo($formattedweddingdate);
                    }
                   
                    @endphp
                </div>
            </div>
            <div class="d-flex column">
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-100">Pengesahan oleh</div>
                <div style="font-size: 0.75rem;line-height: 1rem;" class="w-50 border border-gray-400 text-right">
                    {{ $permohonan['nama_akaun'] }}
                </div>
            </div>
        </div>
    </div>

<script>
    // window.print();
    // window.onfocus=function(){ window.close();}
</script>
</body>
</html>