<template>
    <a :href="'/single/'+ad.id">
        <div class="part_3">
            <div class="row">
                <div class="col-lg-4">
                    <div class="back_right_3">
                        <img :src="ad.attachmentsImage.length?'/files?uid='+ad.attachmentsImage[0].uid+'&width=250&height=150':'/images/default-image.png'">
                        <div class="slide_text">
                            <span  v-if="ad.price">{{ad.price|priceFormat}} تومان</span>
                            <span v-else>تماس بگیرید</span>
                            <div class="icons">
                                <span>{{ad.attachmentsImage.length}} <i class="o-icon o-camera-18"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-8">
                    <div class="back_left">
                        <div class="text">
                            <span>{{ad.title}}</span>
                            <strong>آگهی دهنده: {{ad.user.fname}} {{ad.user.lname}}</strong>
                            <strong>تاریخ: {{ad.created_at|persian_date}}</strong>
                        </div>
                        <div class="d-flex flex-column flex-sm-row margin-top-20">
                            <div class="info_related">
                                <div v-for="(detail,index) in ad.category.items.filter((tec)=>{return tec.technical==1})" v-if="index < 4">
                                    <div v-if="detail.important == 1">
                                        <span>{{detail.title}}:</span>
                                        <span>{{detail.type=='switch'?JSON.parse(ad.data)[detail.id]==1?'بله':'خیر':JSON.parse(ad.data)[detail.id]}}</span>
                                    </div>
                                </div>
                            </div>
                            <div class="border_shadow"></div>
                            <div class="info_related">
                                <div  v-for="(detail,index) in ad.category.items.filter((tec)=>{return tec.technical==0})" v-if="index < 4">
                                    <div v-if="detail.important == 1">
                                        <span>{{detail.title}}:</span>
                                        <span>{{detail.type=='switch'?JSON.parse(ad.data)[detail.id]==1?'بله':'خیر':JSON.parse(ad.data)[detail.id]}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </a>
</template>

<script>
    export default {
        data() {
            return {

            }
        },
        props:['ad'],
        watch:{

        },
        mounted() {

        },
        methods:{

        },
    }
</script>
