<script setup lang="tsx">
import BoardInfo from "./BoardInfo.vue";
import {useFullscreen} from "@vueuse/core";
import {InpatientBoardKey, useInpatientBoard} from "@/views/single-page/InpatientBoardV2/index";


const store = useInpatientBoard()

provide(InpatientBoardKey, {
  store: store
})

const fullscreenEl = ref()

const {toggle} = useFullscreen(fullscreenEl)

</script>

<template>
  <div class="layout_container inpatient-board">
    <header class="main-header">
      <el-form :inline="true">
        <el-form-item label="当前病房:">
          <el-select v-model="store.current.code"
                     :ref="(el) => store.selectRef.value  = el"
                     @change="store.handleWardChange"
                     filterable
                     style="width: 120px">
            <el-option
                v-for="item in store.allWards.value"
                :label="item.name"
                :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="播放速度：">
          <div style="width: 120px">
            <el-slider v-model="store.speedBarDisplay.value"
                       :step="1"
                       :min="1"
                       :max="10"
                       @change="store.changeInterval"/>
          </div>
        </el-form-item>
        <el-form-item>
          <el-button @click="toggle">全屏</el-button>
        </el-form-item>
      </el-form>

    </header>
    <div class="layout_main layout_container layout-horizontal" ref="fullscreenEl">
      <BoardInfo/>
    </div>
  </div>
</template>

<style lang="scss">
.inpatient-board {
  font-size: 18px;

  .main-header {
    padding: 10px;
  }

  .layout_main {
    background: #0F1628;
    padding: 10px;
    color: white;
  }
}
</style>
