<script setup>
    import { RouterLink } from 'vue-router';
    import { getDateMonthDay } from '../helpers/date_formats';

    defineProps({
        company: {
            type: Object,
            required: true,
        }
    });
</script>

<template>
    <div class="card-fixed flex-column">
        <h2>{{ company.company_name }}</h2>
        <div class="divider"></div>
        <div class="row mt-4">
            <div class="col-lg-6 col-sm-12">
                <p><span>RFC:</span> {{ company.rfc }}</p>
                <p><span>Tipo de empresa:</span> {{ company.company_type ? company.company_type.join(", ") : 'No definido' }}</p>
                <p><span>Código:</span> {{ company.company_code }}</p>
                <p><span>Empresa miembro desde: </span>{{getDateMonthDay(company.createdAt)}}</p>
                <p><span>Afiliación: </span>  {{company.membership}}</p>
            </div>
            <div class="col-lg-6 col-sm-12">
                <p><span>Segmento empresa:</span> {{ company._categories }}</p>
                <p><span>Locaciones de carga por estado: </span>{{company._company_state}}</p>
                <p><span>Locaciones de carga por municipio: </span>{{company._company_city}}</p>
                <p><span>Transportes utilizados: </span>{{company._truck_types}}</p>
                <p><span>Información general de la empresa: </span>{{company.company_description}}</p>
            </div>
        </div>
        <div class="d-flex justify-content-end">
            <RouterLink 
                class="btn-primary-sm"
                :to="{name: 'public-users', params: {id: company._id}}"
            >Ver perfil</RouterLink>
        </div>
    </div>
</template>

<style scoped>

    h2{
        font-size: 1.5rem;
        font-weight: 800;
        color: #323030;
    }

    p {
        font-size: 1rem;
        font-weight: 400;
        color: #323032;
    }

    p span {
        font-weight: 700;
    }

    @media (max-width: 768px) {
        h2{
            font-size: 1.1rem;
            font-weight: 600;
            color: #323030;
        }


        p {
            font-size: 0.9rem;
            font-weight: 400;
            color: #323032;
        }
        p span {
            font-weight: 700;
        }
    }
</style>