<!-- src/pages/money/profit_year.vue -->
<template>
    <div class="flex">
    
      <div class=" w-full px-10 ">
        <div class="text-sm breadcrumbs mb-10">
          <ul>
            <li>
              <router-link :to="{ name: 'home' }">
                Home
              </router-link>
            </li>
            <li>
              <router-link :to="{ name: 'employee' }">
                employees
              </router-link>
            </li>
          </ul>
        </div>
  
        <div class="flex start pb-10 text-2xl">Profit for Year </div>
       
        <div class="col-span-12 font-bold ">
              Profit Year
            </div>
            <div class="col-span-12 mb-5 text-sm text-gray-500">
              {{ profit_year }}
            </div>


        
      </div>
    </div>
    
  </template>
  
  <script lang="ts">
  import { defineComponent } from 'vue'
  import axios from 'axios'
  import authHeader from '../../services/auth.header'
  import Header from '../../layouts/headers/headerauth.vue'
  import SideBar from '../../layouts/sidebar/sidebar.vue'
  
  export default defineComponent({
    name: 'MoneyYear',
  
    components: {
      Header,
      SideBar,
    },
  
    data() {
      return {
        token: null,
        user: null,
        employees: [],
        profit_year: 0,
      
      }
    },
  
    created() {
      this.userStatus()
    },
    mounted() {
      this.get_profit_year()
  
    },
    methods: {
    
      userStatus() {
        let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
        axios({
          method: 'get',
          url: path,
          withCredentials: true,
          headers: authHeader(),
        })
          .then((response: any) => {
            if (response.data.ok) {
              this.user = response.data.user;
            }
          })
          .catch(() => {
            this.user = null
          })
      },
      get_profit_year() {
        let path = import.meta.env.VITE_BASE_URL + '/money/profit/year';
        axios({
          method: 'get',
          url: path,
          headers: authHeader(),
        }).then((response: any) => {
          this.profit_year = response.data.total
        })
      },
    },
  })
  </script>
  
  <style scoped></style>