<template>
  <div>
    <v-layout row wrap  fill-height align-center class="colornav pt-1">
      <v-flex xs12 sm10 offset-sm1>
        <v-toolbar flat color="#0d253d"> <!--v-if="page == 'app'"-->
          <v-toolbar-title class="">
            <router-link to="/"><img src="../../../public/images/logocoop.png" class="" width="140"></router-link>
          </v-toolbar-title>
          <v-spacer></v-spacer>
          <router-link to="/employer">
            <v-btn v-if="!responsive" flat color="white" class="mx-2 px-2 body-2 font-weight-bold">
              <span class="body-2 font-weight-bold">หน้าสมาชิก</span>
            </v-btn>
          </router-link>
          <router-link to="/">
          <v-btn v-if="!responsive" flat color="white" class="mx-1 px-1 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">สำหรับผู้สมัครงาน</span>
          </v-btn>
          </router-link>
          <v-btn v-if="!currentEmployer" flat color="white" class="mx-1 px-1 body-2 font-weight-bold" @click.stop="login()">
            <span class="body-2 font-weight-bold">เข้าสู่ระบบ</span>
          </v-btn>
          <v-btn v-if="!currentUser" flat color="white" class="mx-1 px-1 body-2 font-weight-bold" @click.stop="register()">
            <span class="body-2 font-weight-bold">สมัครสมาชิก</span>
          </v-btn>
          <v-btn v-else dark color="yellow darken-2" @click="logout()" class="black--text">
            <v-icon>account_circle</v-icon>&nbsp;{{ currentUser }}
          </v-btn>
        </v-toolbar>
      </v-flex>
    </v-layout>
    <v-layout row wrap white>
      <v-flex xs12 sm10 offset-sm1>
        <v-toolbar flat color="white" height="40">
          <v-spacer></v-spacer>
          <v-btn small="" dark color="blue darken-3" class="elevation-0" @click="$router.push('/')">สำหรับผู้สมัครงาน</v-btn>
          <v-divider inset vertical></v-divider>
          <v-btn round  small outline color="blue darken-3" @click="$router.push('/employer/login')">
            เข้าสู่ระบบ/ลงทะเบียน
          </v-btn>
          <v-btn v-else small outline color="blue darken-3" @click="logout()">
            <v-icon>account_circle</v-icon>&nbsp;{{ currentEmployer }}
          </v-btn>
        </v-toolbar>
      </v-flex>
    </v-layout>
    <v-layout row wrap white>
      <v-flex xs12 sm10 offset-sm1>
        <v-toolbar flat color="white"  >
          <v-toolbar-title>
            <router-link to="/"><img src="../../../public/img/logologin.png" class="my-2" width="150"></router-link>
          </v-toolbar-title>
          <v-spacer></v-spacer>
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0">
            <v-icon>home</v-icon>
            <span class="body-2 font-weight-bold">หน้าหลัก</span>
          </v-btn>   
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-btn v-if="!responsive" flat color="black" class="m x-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-btn v-if="!responsive" flat color="black" class="mx-0 px-0 body-2 font-weight-bold">
            <span class="body-2 font-weight-bold">เกี่ยวกับเรา</span>
          </v-btn>
          <v-menu left bottom v-if="responsive">
            <template v-slot:activator="{ on }">
              <v-toolbar-side-icon v-on="on"></v-toolbar-side-icon>
            </template>
            <v-list>
              <v-list-tile>
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
              <v-list-tile>
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
              <v-list-tile >
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
              <v-list-tile >
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
              <v-list-tile >
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
              <v-list-tile >
                <v-list-tile-title>หน้าหลัก</v-list-tile-title>
              </v-list-tile>
            </v-list>
          </v-menu>
        </v-toolbar>
      </v-flex>
    </v-layout>
  </div>
</template>

<script>
export default {
  data () {
    return {
      responsive: false
    }
  },
  computed: {
    currentEmployer () {
      return this.$store.getters.getEmployer.username
    }
  },
  methods: {
    logout () {
      this.$store.dispatch('logoutEmployer')
      this.$router.push('/employer/login')
    }
  }
}
</script>

<style lang="scss" scoped>
  .colornav{
    background-color:#0d253d;
  }
</style>
