<template>
    <div class="row m-b-10 p-b-10 b-b" style="border-bottom-width: 3px;">
        <div class="col">
            <div class="row">
                <div class="col">
                    <div class="row parentContainer m-b-10">
                        <div class="col">
                            <div class="row align-items-center">
                                <div class="col-auto">
                                    <div class="row m-b-10">
                                        <div class="col-auto">
                                            <div class="font-heading fs-10 muted all-caps">Date</div>
                                            <div class="font-heading fs-10">
                                                {{item.updated_at}}
                                            </div>
                                        </div>
                                        <div class="col-auto">
                                            <div class="font-heading fs-10 muted all-caps">Reference</div>
                                            <a :href="$store.getters.isAdmin ? route('booking.details', item.booking.marking): '#'">
                                                <div class="font-heading fs-10">
                                                    {{item.booking.marking}}
                                                </div>
                                            </a>
                                        </div>
                                        <div class="col-auto">
                                            <div class="font-heading fs-10 muted all-caps">Marking</div>
                                            <div class="font-heading fs-10">
                                                {{item.booking.company.reference}}
                                            </div>
                                        </div>
                                        <div class="col-auto" v-if="$store.getters.isAdmin">
                                            <div class="font-heading fs-10 muted all-caps">Supplier</div>
                                            <div class="font-heading fs-10">
                                                {{item.issuer_name}}
                                            </div>
                                        </div>
                                        <div class="col"  v-if="item.status === 3">
                                            <div v-for="file in item.documents.files" v-bind:key="file.id"  class="col-auto no-padding m-l-5">
                                                <document-file-viewer-component :file="file">
                                                    <template slot="button">
                                                        <div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-0">
                                                            <i class="fa fa-file-image-o fs-10"></i>
                                                        </div>
                                                    </template>
                                                </document-file-viewer-component>
                                            </div>
                                        </div>
                                    </div>
                                    <bank-in-component :data="item"></bank-in-component>
                                    <div class="row">
                                        <div class="col" v-if="item.recipient_bank_account.status === 5">
                                            <div class="fs-9 bold text-warning">*This Bank Account has been suspended. Please notify customer to update their Bank Account.*</div>
                                        </div>
                                        <div class="col" v-if="item.recipient_bank_account.status !== 5">
                                            <span class="text-complete fs-10 pointer requestModal text-underline" data-type="suspendBankAccountModal">Suspend this Bank Account ?</span>
                                        </div>
                                    </div>
                                    <modal-component type="suspendBankAccountModal">
                                        <suspend-bank-account-form-component :data="item" section="paymentProofSection"></suspend-bank-account-form-component>
                                    </modal-component>
                                    <div class="row hide" v-if="item.status === 1 || item.status === 2">
                                        <div class="col">
                                            <span class="text-complete fs-10 pointer requestModal" data-type="cancelOrderModal">Cancel this order?</span>
                                        </div>
                                    </div>
                                    <modal-component type="cancelOrderModal">
                                        <delete-transaction-form-component :data="item" section="paymentProofSection" class="text-center"></delete-transaction-form-component>
                                    </modal-component>
                                </div>
                            </div>
                        </div>
                        <div class="col-2 b-a b-dashed b-success requestModal pointer" v-if="item.status === 1" @click="selectedID(item.id)"  data-type="paymentProofModal">
                            <div class="row align-item-center justify-content-center h-100">
                                <div class="col-auto" >
                                    <div class="row align-items-center h-100">
                                        <div class="col">
                                            <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
                                                 width="40" height="40"
                                                 viewBox="0 0 172 172"
                                                 style=" fill:#000000;"><defs><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-1_48314_gr1"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-2_48314_gr2"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient><linearGradient x1="86" y1="16.79688" x2="86" y2="92.05225" gradientUnits="userSpaceOnUse" id="color-3_48314_gr3"><stop offset="0" stop-color="#67eba8"></stop><stop offset="1" stop-color="#67eba8"></stop></linearGradient><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-4_48314_gr4"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M147.8125,48.375h-32.25v5.375h32.25c1.50769,0 2.6875,1.12875 2.6875,2.56925v75.25c0,1.51844 -1.23087,2.80575 -2.6875,2.80575h-123.625c-1.45662,0 -2.6875,-1.28731 -2.6875,-2.80575v-75.25c0,-1.4405 1.17981,-2.56925 2.6875,-2.56925h32.25v-5.375h-32.25c-4.52038,0 -8.0625,3.49106 -8.0625,7.94425v75.25c0,3.55019 2.25481,6.54944 5.375,7.67819v3.07181c0,4.51231 3.61737,8.18075 8.0625,8.18075h112.875c4.44512,0 8.0625,-3.66844 8.0625,-8.18075v-3.07181c3.12019,-1.12875 5.375,-4.128 5.375,-7.67819v-75.25c0,-4.45319 -3.54212,-7.94425 -8.0625,-7.94425zM142.4375,145.125h-112.875c-1.45662,0 -2.6875,-1.28731 -2.6875,-2.80575v-2.56925h118.25v2.56925c0,1.51844 -1.23087,2.80575 -2.6875,2.80575z" fill="url(#color-1_48314_gr1)"></path><path d="M126.3125,129h-83.3125v-2.6875c0,-7.51425 -6.02806,-13.4375 -13.4375,-13.4375h-2.6875v-37.625h2.6875c6.3425,0 13.4375,-5.79156 13.4375,-13.46706v-2.70363l13.4375,0.04569v5.375l-8.2775,-0.01613c-1.26044,7.95231 -7.94425,14.61731 -15.91,15.86969v27.219c8.25869,1.18788 14.80006,7.76956 15.94762,16.05244h75.6155c1.17444,-8.30438 7.70238,-14.85112 15.93688,-16.03631v-27.262c-7.96844,-1.247 -14.65494,-7.89587 -15.91269,-15.82669h-8.27481v-5.375h13.4375v2.6875c0,6.30219 5.74587,13.4375 13.4375,13.4375h2.6875v37.50675l-2.6875,0.01613c-7.40944,0 -13.4375,6.03344 -13.4375,13.45094v2.6875z" fill="url(#color-2_48314_gr2)"></path><path d="M104.8125,53.75h-8.0625c-1.4835,0 -2.6875,1.14487 -2.6875,2.63106v29.61356c0,1.48619 -1.204,2.69288 -2.6875,2.69288h-10.75c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.69288v-29.61356c0,-1.48619 -1.204,-2.63106 -2.6875,-2.63106h-8.0625c-2.2145,0 -3.47763,-2.881 -2.15,-4.87781l16.65175,-25.04481c2.05056,-3.08256 6.57094,-3.08794 8.6215,-0.00806l16.65175,25.05556c1.32762,1.99681 0.0645,4.87512 -2.15,4.87512z" fill="url(#color-3_48314_gr3)"></path><path d="M86,112.875c-10.37375,0 -18.8125,-8.0625 -18.8125,-18.8125h5.375c0,8.0625 6.02806,13.4375 13.4375,13.4375c7.40944,0 13.4375,-5.375 13.4375,-13.4375h5.375c0,10.75 -8.43875,18.8125 -18.8125,18.8125z" fill="url(#color-4_48314_gr4)"></path></g></g></svg>
                                        </div>
                                    </div>
                                </div>
                                <modal-component type="paymentProofModal">
                                    <payment-proof-form-component  v-if="selected_id == item.id" section="paymentProofSection" :id="item.id" :data="item"></payment-proof-form-component>
                                </modal-component>
                            </div>
                        </div>
                        <div class="col-auto" v-if="item.status === 2">
                            <button class="btn btn-xs btn-default bg-success b-rad-none no-border requestModal" data-type="approvePaymentTransaction">
                                <i class="fa fa-check text-white fa-fw"></i>
                            </button>
                            <modal-component type="approvePaymentTransaction">
                                <approve-payment-transaction-form-component :data="item" section="section" class="text-center"></approve-payment-transaction-form-component>
                            </modal-component>
                            <button class="btn btn-xs btn-default bg-danger b-rad-none no-border requestModal" data-type="deletePaymentTransaction">
                                <i class="fa fa-times text-white fa-fw"></i>
                            </button>   
                            <modal-component type="deletePaymentTransaction">
                                <reject-payment-transaction-form-component :data="item" section="section" class="text-center"></reject-payment-transaction-form-component>
                            </modal-component>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import componentHandler from '../../../general/mixins/componentHandler';
    export default {
        data(){
            return {
                selected_id: '',
            }
        },
        methods: {
            selectedID(id){
                this.selected_id = id;
            }
        },
        mixins: [componentHandler]
    }
</script>
