<template>
    <div>
        <p>Problem Description: <span v-text="this.data.probdesc"></span></p>
        <p>Suggested Solution: <span v-text="this.data.suggested"></span></p>
        <p>Work Order ID: <span v-text="this.data.woid"></span></p>
        <p>Store: <span v-text="this.data.storeid"></span></p>
        <p>Check-in Date: 
            <span class="dashed-underline" data-toggle="tooltip" data-placement="bottom" v-bind:title=this.getHRDate(this.data.dropdate)>
                {{ Math.floor(this.daysSinceToday(this.data.dropdate)) }} days ago
            </span>
        </p>
        <p>Check-out Date: 
            <span class="dashed-underline" data-toggle="tooltip" data-placement="bottom" v-if="!this.isZero(this.data.pickupdate)" v-bind:tittle=this.getHRDate(this.data.pickupdate)>
                {{ Math.floor(this.daysSinceToday(this.data.pickupdate)) }} days ago
            </span>
        </p>
        <p>Accessories: <span v-text="this.data.custassets"></span></p>
    </div>
</template>
<script>
    import dateMixin from '../mixins/dateMixin'
    export default {
        mixins: [dateMixin],
        props: ['workOrder'],
        data() {
            return {
                data: JSON.parse(this.workOrder),
            }
        },
        mounted() {
            Echo.channel('work-orders')
                .listen('WorkOrderUpdated', (e) => {
                    this.data = JSON.parse(e.data);
                });
        }
    }
</script>