repos
/ timestrap-django master

timestrap-django

mirror archived upstream

Time tracking you can host anywhere, built on Django. Full export support in multiple formats and easily extensible.

djangodockerhandcodedpythonself-hostedtime-trackingtimetracker

1.2 KB · 64 lines · vue Raw History
 1<template>
 2<card
 3  :index="index"
 4  :delete_perm="$perms.delete_task"
 5  :change_perm="$perms.change_task"
 6  :add_perm="$perms.add_task"
 7  @edit="$emit('modal')"
 8  @detail="showEntries"
 9  @delete="deleteTask(task)">
10  <template slot="card-body">
11    <div class="card-title h5 font-weight-bold mb-4">
12      {{ task.name }}
13    </div>
14    <div v-if="task.hourly_rate" class="card-subtitle h6">
15      <icon :icon="['fas', 'hand-holding-usd']" class="mr-1 text-muted"/>
16      ${{ task.hourly_rate }}/hr
17    </div>
18  </template>
19</card>
20</template>
21
22
23<script>
24import {mapActions} from 'vuex';
25
26import Card from '../cards/card.vue';
27
28
29export default {
30  components: {
31    Card,
32  },
33  props: {
34    task: {
35      type: Object,
36      default: () => {
37        return {
38          id: null,
39        }
40      },
41    },
42    index: {
43      type: Number,
44      default: null,
45    },
46  },
47  methods: {
48    ...mapActions({
49      deleteTask: 'tasks/deleteTask',
50    }),
51
52    showEntries(){
53      if(!this.task.id){
54        this.$emit('modal');
55        return;
56      }
57      this.$store.commit("reports/reset");
58      this.$store.commit("reports/setTask", this.task.url);
59      this.$router.push("/reports");
60    }
61  },
62};
63</script>