aboutsummaryrefslogtreecommitdiff
path: root/resources/js/components/reservation.vue
blob: ec430abc732033a85b7d31dbb91b5e596f369931 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
  <tr>
    <td v-text="reservation.id"></td>
    <td><input type="checkbox" v-model="reservation.approved"/></td>
    <td><input type="text" v-model="reservation.operatorCall"></td>
    <td><input type="text" v-model="reservation.qso"></td>
    <td><input type="text" v-model="reservation.fromTime"></td>
    <td><input type="text" v-model="reservation.toTime"></td>
    <td><input type="text" v-model="reservation.specialCall"></td>
    <td><input type="text" v-model="reservation.frequencies"></td>
    <td><input type="text" v-model="reservation.modes"></td>
    <td><input type="text" v-model="reservation.operatorName"></td>
    <td><input type="text" v-model="reservation.operatorEmail"></td>
    <td><input type="text" v-model="reservation.operatorPhone"></td>
    <td>
      <button class="btn btn-primary mr-2" @click="updateRow">Update</button>
      <button class="btn btn-warning mr-2" @click="restoreRow">Restore</button>
      <button class="btn btn-danger" @click="deleteRow">Delete</button>
    </td>
  </tr>
</template>

<script>
export default {
  props: [ 'reservationIndex' ],
  data() {
    return {
      reservation: this.$store.getters.getDataRow(this.reservationIndex)
    }
  },
  methods: {
    updateRow() {
      this.$store.dispatch('pushReservation', {
        index: this.reservationIndex,
        reservation: this.reservation
      });
    },
    restoreRow() {
      this.reservation = this.$store.getters.getDataRow(this.reservationIndex);
    },
    deleteRow() {
      this.$store.dispatch('removeReservation', this.reservationIndex);
    }
  }
}
</script>

<style scoped>
td {
  text-align: center;
  vertical-align: middle;
}
input {
  background-color: white;
  border: 1px solid lightgray;
  border-radius: 3px;
  padding: 0.2em;
}
</style>