16a192d52SDixsie Wolmers<template>
26a192d52SDixsie Wolmers  <overview-card
36a192d52SDixsie Wolmers    :title="$t('pageOverview.inventory')"
46a192d52SDixsie Wolmers    :to="`/hardware-status/inventory`"
56a192d52SDixsie Wolmers  >
66a192d52SDixsie Wolmers    <b-row class="mt-3">
76a192d52SDixsie Wolmers      <b-col sm="6">
86a192d52SDixsie Wolmers        <dl sm="6">
96a192d52SDixsie Wolmers          <dt>{{ $t('pageOverview.systemIdentifyLed') }}</dt>
106a192d52SDixsie Wolmers          <dd>
116a192d52SDixsie Wolmers            <b-form-checkbox
126a192d52SDixsie Wolmers              id="identifyLedSwitch"
136a192d52SDixsie Wolmers              v-model="systems.locationIndicatorActive"
146a192d52SDixsie Wolmers              data-test-id="overviewInventory-checkbox-identifyLed"
156a192d52SDixsie Wolmers              switch
166a192d52SDixsie Wolmers              @change="toggleIdentifyLedSwitch"
176a192d52SDixsie Wolmers            >
186a192d52SDixsie Wolmers              <span v-if="systems.locationIndicatorActive">
196a192d52SDixsie Wolmers                {{ $t('global.status.on') }}
206a192d52SDixsie Wolmers              </span>
216a192d52SDixsie Wolmers              <span v-else>{{ $t('global.status.off') }}</span>
226a192d52SDixsie Wolmers            </b-form-checkbox>
236a192d52SDixsie Wolmers          </dd>
246a192d52SDixsie Wolmers        </dl>
256a192d52SDixsie Wolmers      </b-col>
266a192d52SDixsie Wolmers    </b-row>
276a192d52SDixsie Wolmers  </overview-card>
286a192d52SDixsie Wolmers</template>
296a192d52SDixsie Wolmers
306a192d52SDixsie Wolmers<script>
316a192d52SDixsie Wolmersimport OverviewCard from './OverviewCard';
32*f11a1901SNikhil Ashokaimport BVToastMixin from '@/components/Mixins/BVToastMixin';
336a192d52SDixsie Wolmers
346a192d52SDixsie Wolmersexport default {
356a192d52SDixsie Wolmers  name: 'Inventory',
366a192d52SDixsie Wolmers  components: {
376a192d52SDixsie Wolmers    OverviewCard,
386a192d52SDixsie Wolmers  },
39*f11a1901SNikhil Ashoka  mixins: [BVToastMixin],
406a192d52SDixsie Wolmers  computed: {
416a192d52SDixsie Wolmers    systems() {
426a192d52SDixsie Wolmers      let systemData = this.$store.getters['system/systems'][0];
436a192d52SDixsie Wolmers      return systemData ? systemData : {};
446a192d52SDixsie Wolmers    },
456a192d52SDixsie Wolmers  },
466a192d52SDixsie Wolmers  created() {
476a192d52SDixsie Wolmers    this.$store.dispatch('system/getSystem').finally(() => {
486a192d52SDixsie Wolmers      this.$root.$emit('overview-inventory-complete');
496a192d52SDixsie Wolmers    });
506a192d52SDixsie Wolmers  },
516a192d52SDixsie Wolmers  methods: {
526a192d52SDixsie Wolmers    toggleIdentifyLedSwitch(state) {
536a192d52SDixsie Wolmers      this.$store
546a192d52SDixsie Wolmers        .dispatch('system/changeIdentifyLedState', state)
55*f11a1901SNikhil Ashoka        .then((message) => this.successToast(message))
566a192d52SDixsie Wolmers        .catch(({ message }) => this.errorToast(message));
576a192d52SDixsie Wolmers    },
586a192d52SDixsie Wolmers  },
596a192d52SDixsie Wolmers};
606a192d52SDixsie Wolmers</script>
61