1<template>
2  <overview-card
3    :title="$t('pageOverview.inventory')"
4    :to="`/hardware-status/inventory`"
5  >
6    <b-row class="mt-3">
7      <b-col sm="6">
8        <dl sm="6">
9          <dt>{{ $t('pageOverview.systemIdentifyLed') }}</dt>
10          <dd>
11            <b-form-checkbox
12              id="identifyLedSwitch"
13              v-model="systems.locationIndicatorActive"
14              data-test-id="overviewInventory-checkbox-identifyLed"
15              switch
16              @change="toggleIdentifyLedSwitch"
17            >
18              <span v-if="systems.locationIndicatorActive">
19                {{ $t('global.status.on') }}
20              </span>
21              <span v-else>{{ $t('global.status.off') }}</span>
22            </b-form-checkbox>
23          </dd>
24        </dl>
25      </b-col>
26    </b-row>
27  </overview-card>
28</template>
29
30<script>
31import OverviewCard from './OverviewCard';
32import BVToastMixin from '@/components/Mixins/BVToastMixin';
33
34export default {
35  name: 'Inventory',
36  components: {
37    OverviewCard,
38  },
39  mixins: [BVToastMixin],
40  computed: {
41    systems() {
42      let systemData = this.$store.getters['system/systems'][0];
43      return systemData ? systemData : {};
44    },
45  },
46  created() {
47    this.$store.dispatch('system/getSystem').finally(() => {
48      this.$root.$emit('overview-inventory-complete');
49    });
50  },
51  methods: {
52    toggleIdentifyLedSwitch(state) {
53      this.$store
54        .dispatch('system/changeIdentifyLedState', state)
55        .then((message) => this.successToast(message))
56        .catch(({ message }) => this.errorToast(message));
57    },
58  },
59};
60</script>
61