<template>
    <div class="dsi-form-group">
        <label>{{ msg.select_caddie }}</label>
        <div class="dsi-form-group-content">
            <select v-model="data.caddieId" required>
                <option value="" disabled>{{ msg.select_caddie_default }}</option>
                <option v-for="(caddie, i) in recordCaddies" :value="caddie.idcaddie" :key="i" :disabled="!caddie.is_authorized">{{ caddie.name }}</option>
            </select>
        </div>
    </div>
</template>

<script>
export default {
    name : "RecordCaddieSelector",
    props : ["data", "msg"],
    data : function() {
        return {
            recordCaddies : []
        }
    },
    created : async function() {
        this.recordCaddies = await this.ws.get("items", "record/caddies");
    }
}
</script>