<script setup>
import axios from "axios"
const {ownTenant} = storeToRefs(useDataStore())


const setupPrinter = async () => {
  console.log(ownTenant.value.labelPrinterIp)
  let printerUri = `http://${ownTenant.value.labelPrinterIp}/pstprnt`
  labelPrinterURI.value = printerUri
  console.log(printerUri)
}


/*const printLabel = async () => {
  axios
      .post(labelPrinterURI.value, `^XA^FO10,20^BCN,100^FD${}^XZ` )
      .then(console.log)
      .catch(console.log)


}*/



const labelPrinterURI = ref("")

</script>

<template>
  <UPage>
    <UCard>
      <template #header>
        Etikettendrucker
      </template>

      <UFormGroup
        label="IP-Adresse:"
      >
        <UInput
          v-model="labelPrinterURI"
        />
      </UFormGroup>

      <UButton
        @click="setupPrinter"
      >
        Drucker Setup
      </UButton>
      <UButton
        @click="printLabel"
      >
        Druck
      </UButton>

    </UCard>
<!--    <UCard>
      <template #header>
        A4 Drucker
      </template>
    </UCard>-->
  </UPage>
</template>

<style scoped>

</style>