Fixed minor issues
This commit is contained in:
parent
af79a30497
commit
567e994b71
|
@ -34,7 +34,7 @@
|
|||
icon="mdi-pencil"
|
||||
@click="editType({ id: props.row.id, name: props.row.name })"
|
||||
/>
|
||||
<q-btn round icon="mdi-delete" @click="deleteType(props.row.name)" />
|
||||
<q-btn round icon="mdi-delete" @click="deleteType(props.row.id)" />
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
|
@ -114,8 +114,8 @@ export default defineComponent({
|
|||
edittype.value = false;
|
||||
}
|
||||
|
||||
function deleteType(name: string) {
|
||||
void store.dispatch('schedule/removeEventType', name);
|
||||
function deleteType(id: number) {
|
||||
void store.dispatch('schedule/removeEventType', id);
|
||||
}
|
||||
return {
|
||||
columns,
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { defineComponent, ref } from '@vue/composition-api';
|
||||
import { defineComponent, ref, onBeforeMount } from '@vue/composition-api';
|
||||
import { Store } from 'vuex';
|
||||
import { StateInterface } from 'src/store';
|
||||
import { date } from 'quasar';
|
||||
|
@ -100,8 +100,14 @@ export default defineComponent({
|
|||
|
||||
const users = ref(state.users);
|
||||
function refresh() {
|
||||
root.$router.go(0);
|
||||
refreshKey.value += 1;
|
||||
}
|
||||
onBeforeMount(() => {
|
||||
store.dispatch('user/getUsers').catch(error => {
|
||||
console.warn(error);
|
||||
});
|
||||
});
|
||||
|
||||
function isUserEnrolled(job: FG.Job) {
|
||||
return (
|
||||
|
|
|
@ -66,8 +66,8 @@ const mutations: MutationTree<ScheduleInterface> = {
|
|||
addEventType(state, eventType: EventType) {
|
||||
state.eventTypes.unshift(eventType);
|
||||
},
|
||||
removeEventType(state, name: string) {
|
||||
const index = state.eventTypes.findIndex(item => item.name == name);
|
||||
removeEventType(state, id: number) {
|
||||
const index = state.eventTypes.findIndex(item => item.id == id);
|
||||
state.eventTypes.splice(index, 1);
|
||||
},
|
||||
setEventType(state, eventType: EventType) {
|
||||
|
@ -83,8 +83,12 @@ const mutations: MutationTree<ScheduleInterface> = {
|
|||
state.events = events;
|
||||
},
|
||||
updateEvent(state, event: FG.Event) {
|
||||
let eventToChange = state.events.find(ev => ev.id == event.id);
|
||||
eventToChange = event;
|
||||
/*let eventToChange = state.events.find(ev => ev.id == event.id);
|
||||
eventToChange = event; */
|
||||
const index = state.events.findIndex(ev => ev.id == event.id);
|
||||
if (index > -1) {
|
||||
state.events[index] = event;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -157,7 +161,7 @@ const actions: ActionTree<ScheduleInterface, StateInterface> = {
|
|||
console.warn(err);
|
||||
});
|
||||
},
|
||||
removeEventType({ commit }, data: string) {
|
||||
removeEventType({ commit }, data: number) {
|
||||
axios
|
||||
.delete(`/schedule/event-types/${data}`)
|
||||
.then(() => {
|
||||
|
@ -199,6 +203,7 @@ const actions: ActionTree<ScheduleInterface, StateInterface> = {
|
|||
updateInformation.service
|
||||
)
|
||||
.then((response: AxiosResponse<FG.Event>) => {
|
||||
response.data.start = new Date(response.data.start);
|
||||
commit('updateEvent', response.data);
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
Loading…
Reference in New Issue