<template>
  <section :class="[darkMode ? 'section-darkmode' : 'section-lightmode']">
    <pre :class="['title', darkMode ? 'title-darkmode' : 'title-lightmode']">Department name</pre>
    <div class="data-group">
      <div class="data-field" id="id">
        <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">ID:</pre>
        <pre :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']">...</pre>
      </div>
      <div class="data-field" id="customer-id">
        <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Customer ID:</pre>
        <pre :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']">...</pre>
      </div>
      <div class="data-field" id="head">
        <pre :class="['label', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Head:</pre>
        <pre :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']">...</pre>
      </div>
    </div>
    <div class="notes">
      <pre :class="['area-title', darkMode ? 'pre-darkmode' : 'pre-lightmode']">Notes:</pre>
      <pre :class="['data', darkMode ? 'data-darkmode' : 'data-lightmode']" id="notes">...</pre>
    </div>
  </section>
</template>



<script setup>
import { ref, onMounted, watch } from 'vue';
import { useStore } from 'vuex';
import { computed } from 'vue';

const store = useStore();
const modeChanged = computed(() => store.state.updateDarkMode);

const darkMode = ref('')

const getSession = async () => {
  const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
  if (loggedInUserDarkModeBool == 1) {
    darkMode.value = true;
  } else {
    darkMode.value = false;
  }
}

function getItem(item) {
  if (process.client) {
    return localStorage.getItem(item)
  } else {
    return undefined
  }
}

watch(modeChanged, getSession)

onMounted(async () => {
  await getSession();
});
</script>

<script>
export default {
  name: "CustomerDepartment",
};
</script>



<style scoped>
* {
  box-sizing: border-box;
  margin: 0;
}


section {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.875rem;
  border-radius: 0.625rem;
  box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
  align-items: stretch;
  justify-content: center;
}

.section-darkmode {
  background-color: #2c2c2c;
}

.section-lightmode {
  background-color: #ffffff;
}


.title {
  padding: 1.25rem 0;
  letter-spacing: 0.04rem;
  text-decoration-line: underline;
  font: italic 400 1rem/1.875rem Overpass, sans-serif;
}

.title-darkmode {
  color: #ffffff;
}

.title-lightmode {
  color: #000000;
}



.data-group {
  display: flex;
  flex: auto;
  width: 100%;
  flex-direction: row;
  padding: 0.625rem 0;
  align-items: center;
  justify-content: stretch;
}


.data-field {
  display: flex;
  flex: auto;
  width: 30%;
  flex-direction: row;
  padding: 0.8rem 1.875rem;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
}

#head {
  width: 40%;
}

.label {
  letter-spacing: 0.02rem;
  font: 400 0.875rem/1.875rem Overpass, sans-serif;
}

.pre-darkmode {
  color: #ffffff;
}

.pre-lightmode {
  color: #000000;
}

.data {
  display: flex;
  flex-direction: row;
  padding: 0 0.625rem;
  border-radius: 0.3125rem;
  box-shadow: 0.0625rem 0.0625rem 0.25rem 0rem rgba(0, 0, 0, 0.25) inset;
  background-color: #212121;
  align-items: center;
  justify-content: flex-start;
  letter-spacing: 0.02rem;
  font: 400 0.75rem/1.875rem Overpass, sans-serif;
}

.data-darkmode {
  background-color: #212121;
  color: #ffffff;
}

.data-lightmode {
  background-color: #ebebeb;
  color: #000000;
}


.notes {
  display: flex;
  flex: auto;
  flex-direction: column;
  padding: 1.25rem 1.875rem 0.625rem;
  align-items: flex-start;
  justify-content: center;
  gap: 0.625rem;
}

.area-title {
  letter-spacing: 0.03rem;
  font: 400 0.875rem/1.875rem Overpass, sans-serif;
}

#notes {
  align-self: stretch;
}
</style>