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