<template>
<v-dialog v-model="dialog_select_item" persistent width="60vw">
    <v-card class="style-limit-heightcard">
        <v-card-title class="headline grey lighten-2" primary title>
            TAMBAH ITEM REQUEST
        </v-card-title>
        <v-card-text class="style-limit-heightcontent">
            <v-flex xs12>
                <v-text-field
                    label="Cari" hide-details outline
                    v-model="keyword" placeholder="Nama item, nomor request"
                    readonly
                ></v-text-field>
            </v-flex>
            <v-flex xs12 mt-2>
                <v-data-table
                    :headers="headers" :items="requested_asset.records"
                    class="elevation-1" hide-actions
                >
                    <template v-slot:items="props">
                    <tr>
                        <td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
                        <td class="text-xs-start pa-2">
                            {{ props.item.Requestedby }} <br>
                            {{ props.item.M_BranchName }}
                        </td>
                        <td class="text-xs-start pa-2">
                            {{ props.item.M_ItemCode }} <br>
                            {{ props.item.M_ItemDesc }}
                        </td>
                        <td class="text-xs-center pa-2">{{ props.item.ItemUnitName }}</td>
                        <td class="text-xs-center pa-2">{{ props.item.RequestQty }}</td>
                    </tr>
                    </template>
                </v-data-table>
            </v-flex>
        </v-card-text>
        <v-card-actions>
            <v-spacer></v-spacer>
            <v-btn @click="dialog_select_item = false" color="error" class="white--text">Tutup</v-btn>
        </v-card-actions>
    </v-card>
</v-dialog>
</template>

<style scoped>
.style-limit-heightcard {
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.style-limit-heightcontent {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
</style>

<script>
module.exports = {
    data() {
        return {
            dialog_select_item: false,
            keyword: "",
            requested_asset: {
                records: [],
                total: 0
            },
            headers: [
                {
                    text: "NO PURCHASE REQ", align: "center", sortable: false,
                    value: "noreq", width: "20%", class: "pa-1 blue lighten-3 white--text",
                },
                {
                    text: "REQUESTER", align: "center", sortable: false,
                    value: "kode", width: "20%", class: "pa-1 blue lighten-3 white--text",
                },
                {
                    text: "ITEM", align: "center", sortable: false,
                    value: "serve", width: "20%", class: "pa-1 blue lighten-3 white--text",
                },
                {
                    text: "SATUAN", align: "center", sortable: false,
                    value: "unit", width: "20%", class: "pa-1 blue lighten-3 white--text",
                },
                {
                    text: "REQ QTY", align: "center", sortable: false,
                    value: "qty", width: "10%", class: "pa-1 blue lighten-3 white--text",
                },
            ],
        }
    }
}
</script>
