<template>
    <v-container fluid>
        <v-layout row wrap>
            <a
                :href="module.href"
                :class="'flex ' + module.main_class"
                v-for="( module ,key ) in getModules"
                :key="key"
            >

                <wm-tile
                    :TileClass="module.title_class"
                    :TitleEn="$_name(`${module.slug}.name_en`)"
                    :TitleFa="$_name(`${module.slug}.name`)"
                    :GradientBegin="module.gradient_begin"
                    :GradientEnd="module.gradient_end"
                    :ImageURL="module.img_url"
                    :ImageHeight="module.img_height"
                />
            </a>
        </v-layout>
        <router-link v-if="getAuthUser.is_owner == 'true' || hostname == originHostName" :to="{name: 'AddModule'}">
            <v-btn large fab color="cyan" fixed bottom left dark style="left:5%">
                <v-icon dark>WMi-plus</v-icon>
            </v-btn>
        </router-link>
    </v-container>
</template>



<script>
import Tile from "@Global/components/Tiles/Tile";
import { mapGetters, mapActions } from "vuex";
import routes from '@Global/utils/common/routes';
export default {
    data: () => ({
        hostname : window.location.hostname,
        originHostName : routes.originHostName()
    }),
    components: {
        "wm-tile": Tile,
    },
    computed: {
        ...mapGetters("rolePermission", ["getModules"]),
        ...mapGetters("auth", ["getAuthUser"]),
    },
    methods: {
        ...mapActions("rolePermission", ["loadModules"]),
    },
    created() {
        this.loadModules({ home_page: true });
    }
};
</script>

<style scoped lang="scss">
</style>
