<template>
    <div class="container-fluid">
        <section class="content">
            <div class="header pb-2">
                <div class="header-body">
                    <div class="row align-items-center py-4">
                        <div class="col-lg-6 col-7">
                            <nav
                                aria-label="breadcrumb"
                                class="d-none d-md-inline-block ml-md-4"
                            >
                                <ol class="breadcrumb breadcrumb-links">
                                    <li class="breadcrumb-item">
                                        <a href="#"
                                            ><i class="fas fa-home"></i
                                        ></a>
                                    </li>
                                    <li class="breadcrumb-item">
                                        <a href="#">Dashboards</a>
                                    </li>
                                    <li
                                        class="breadcrumb-item active"
                                        aria-current="page"
                                    >
                                        ລາຍງານ ປະຫວັດຜູ້ໃຊ້
                                    </li>
                                </ol>
                            </nav>
                        </div>
                        <div class="col-lg-6 col-5 text-right"></div>
                    </div>
                </div>
            </div>
            <div class="row" v-if="isLoggedIn">
                <div class="col-md-5">
                    <div class="card">
                        <div class="card-header">
                            <div class="md:flex md:justify-between">
                                <div class="md:flex">
                                    <div class="sm:w-auto flex justify-center">
                                        <div class="grid grid-rows-2">
                                            {{ chdatere }}
                                            <label
                                                >ເລືອກວັນທີ່, ເດືອນ, ງວດ,
                                                ປີ.</label
                                            >
                                            <div
                                                class="btn-group h-9 w-auto mb-2"
                                                role="group"
                                                aria-label="Basic"
                                            >
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="sem"
                                                    @click="selectdtype('m')"
                                                >
                                                    ເດືອນ
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se3"
                                                    @click="selectdtype('m1-3')"
                                                >
                                                    ງວດ1
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se6"
                                                    @click="selectdtype('m4-6')"
                                                >
                                                    ງວດ2
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se9"
                                                    @click="selectdtype('m7-9')"
                                                >
                                                    ງວດ3
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se12"
                                                    @click="
                                                        selectdtype('m10-12')
                                                    "
                                                >
                                                    ງວດ4
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="sey"
                                                    @click="selectdtype('y')"
                                                >
                                                    ປີ
                                                </button>
                                            </div>
                                            <flat-pickr
                                                :config="config"
                                                v-model="dmy"
                                                class="form-control form-control-sm w-auto mb-2"
                                                placeholder="ເລືອກວັນທີ່"
                                            />
                                        </div>
                                    </div>
                                </div>
                                <div class="h-auto flex justify-center">
                                    <div class>
                                        <button
                                            type="button"
                                            class="btn btn-success btn-sm"
                                            @click="CreateReport()"
                                        >
                                            <i class="fas fa-file-alt"></i>
                                            ສ້າງໃບລາຍງານ
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-7">
                    <div class="card">
                        <div class="card-header">
                            <div class="md:flex md:justify-between">
                                <div class="md:flex">
                                    <div class="sm:w-auto flex justify-center">
                                        <div class="grid grid-rows-2">
                                            {{ chdatere }}
                                            <label
                                                >ເລືອກວັນທີ່, ເດືອນ, ງວດ,
                                                ປີ.</label
                                            >
                                            <div
                                                class="btn-group h-9 w-auto mb-2"
                                                role="group"
                                                aria-label="Basic"
                                            >
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="sem"
                                                    @click="selectdtype('m')"
                                                >
                                                    ເດືອນ
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se3"
                                                    @click="selectdtype('m1-3')"
                                                >
                                                    ງວດ1
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se6"
                                                    @click="selectdtype('m4-6')"
                                                >
                                                    ງວດ2
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se9"
                                                    @click="selectdtype('m7-9')"
                                                >
                                                    ງວດ3
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="se12"
                                                    @click="
                                                        selectdtype('m10-12')
                                                    "
                                                >
                                                    ງວດ4
                                                </button>
                                                <button
                                                    type="button"
                                                    class="btn btn-info btn-outline btn-sm"
                                                    :class="sey"
                                                    @click="selectdtype('y')"
                                                >
                                                    ປີ
                                                </button>
                                            </div>
                                            <flat-pickr
                                                :config="config"
                                                v-model="dmy"
                                                class="form-control form-control-sm w-auto mb-2"
                                                placeholder="ເລືອກວັນທີ່"
                                            />
                                        </div>
                                    </div>
                                </div>
                                <div class="h-auto flex justify-center">
                                    <div class>
                                        <button
                                            type="button"
                                            class="btn btn-success btn-sm"
                                            @click="CreateReport()"
                                        >
                                            <i class="fas fa-file-alt"></i>
                                            ສ້າງໃບລາຍງານ
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</template>

<script>
import reportstore from "../../components/ReportStoreComponent.vue";

export default {
    name: "Store",

    data() {
        return {
            isLoggedIn: false,
            reportType: {
                type: "store",
            },
        };
    },
    components: {
        reportstore,
    },
    mounted() {},

    methods: {},
    created() {
        this.$axios.get(`/api/users/checkauth`).then((response) => {
            if (!response.data.isLogin) {
                window.location.href = "/";
            }
        });

        if (window.Laravel.isLoggedin) {
            this.isLoggedIn = true;
        }
    },
};
</script>

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