<template>
  <transition
      name="list-edit-transition"
      tag="div"
      class="list-edit-container"
  >
    <div v-if="show" class="list-edit">
      <div class="icon-container"><ph-selection size="24"/><span class="number-circle">{{selectCount}}</span></div>


      <basic-button icon="package" @click="handleAction('material')">Material</basic-button>
      <basic-button icon="tag" @click="handleAction('price')">Price</basic-button>
      <basic-button icon="vectorThree" @click="handleAction('packaging')">Packaging</basic-button>
      <basic-button icon="stack" @click="handleAction('amount')">Annual quantity</basic-button>
      <basic-button icon="MapPin" @click="handleAction('routes')">Routes</basic-button>


      <basic-button icon="X" @click="handleAction('deselect')">Cancel</basic-button>

    </div>
  </transition>

</template>

<script>
import IconButton from "@/components/UI/IconButton.vue";
import {PhPencilSimple, PhSelection} from "@phosphor-icons/vue";
import BasicButton from "@/components/UI/BasicButton.vue";

export default{
  name: "MassEditDialog",
  components: {BasicButton, PhSelection, PhPencilSimple, IconButton},
  emits: ['action'],
  props: {
    show: {
      type: Boolean,
      default: false
    },
    selectCount: {
      type: Number,
      default: 1
    }
  },
  methods: {
    handleAction(action) {
      this.$emit('action', action);
    }
  }
}
</script>

<style scoped>

.list-edit-container {
  position: fixed;
  bottom: 2rem;
  left:  50%;
  transform: translate(-50%, 0);
  z-index: 1000;
}


.list-edit-button {
  padding: 0.8rem;
  text-wrap: nowrap;
}

.list-edit-button:hover {
  color: #FFFFFF;
  background-color: #002F54;
  border-radius: 0.8rem;
  cursor: pointer;
}

.list-edit {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  background-color: #5AF0B4;
  border-radius: 0.8rem;
  flex: 0 0 auto;
  padding: 0.8rem 1.6rem;
  box-shadow: 0 0.4rem 0.6rem -0.1rem rgba(0, 0, 0, 0.1);
  font-size: 1.4rem;

}

.icon-container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.number-circle {
  position: relative;
  top: 0.8rem;
  left: -1.8rem;
  display: inline-block;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  /*background-color: #002F54;
  color: white;*/
  color: #002F54;
  text-align: center;
  line-height: 1.6rem;
  font-size: 1.2rem;
  font-weight: 500;
}


/* Transition animations */
.list-edit-transition-enter-active {
  transition: all 0.3s ease;
}

.list-edit-transition-leave-active {
  transition: all 0.3s ease;
}

.list-edit-transition-enter-from {
  opacity: 0;
  transform: translate(-50%, 100%); /* beide Transforms kombinieren */
}

.list-edit-transition-leave-to {
  opacity: 0;
  transform: translate(-50%, 100%); /* beide Transforms kombinieren */
}

.list-edit-transition-move {
  transition: transform 0.3s ease;
}

</style>