Merge pull request 'fix(timesheet-approval): fix oversight to modify employee timesheet from approval module' (#63) from dev/nicolas/staging-prep into main

Reviewed-on: Targo/targo_frontend#63
This commit is contained in:
Nicolas 2026-01-26 09:58:45 -05:00
commit cd29f4c3ad
5 changed files with 37 additions and 14 deletions

View File

@ -224,6 +224,7 @@ export default {
error: { error: {
no_data_found: "no data found", no_data_found: "no data found",
no_search_results: "no results matching search", no_search_results: "no results matching search",
generic_error: "An error occured",
}, },
label: { label: {
search: "search", search: "search",
@ -284,6 +285,7 @@ export default {
apply_preset: "auto-fill", apply_preset: "auto-fill",
apply_preset_day: "Apply schedule to day", apply_preset_day: "Apply schedule to day",
apply_preset_week: "Apply schedule to week", apply_preset_week: "Apply schedule to week",
save_successful: "timesheets saved",
nav_button: { nav_button: {
calendar_date_picker: "Calendar", calendar_date_picker: "Calendar",
current_week: "This week", current_week: "This week",
@ -359,6 +361,7 @@ export default {
SHIFT_TYPE_REQUIRED: "Shift type required", SHIFT_TYPE_REQUIRED: "Shift type required",
TIMESHEET_NOT_FOUND: "No timesheet found with provided data", TIMESHEET_NOT_FOUND: "No timesheet found with provided data",
UPDATE_ERROR: "Error while updating data", UPDATE_ERROR: "Error while updating data",
ERROR_SAVING_SHIFTS: "Timesheet changes were not saved",
}, },
}, },

View File

@ -224,6 +224,7 @@ export default {
error: { error: {
no_data_found: 'aucune donnée à afficher', no_data_found: 'aucune donnée à afficher',
no_search_results: 'aucun résultat ne correspond à la recherche', no_search_results: 'aucun résultat ne correspond à la recherche',
generic_error: "Une erreur est survenue",
}, },
label: { label: {
search: 'recherche', search: 'recherche',
@ -284,6 +285,7 @@ export default {
apply_preset: "auto-remplir", apply_preset: "auto-remplir",
apply_preset_day: "Appliquer horaire pour la journée", apply_preset_day: "Appliquer horaire pour la journée",
apply_preset_week: "Appliquer horaire pour la semaine", apply_preset_week: "Appliquer horaire pour la semaine",
save_successful: "feuilles de temps enregistrées",
nav_button: { nav_button: {
calendar_date_picker: "Calendrier", calendar_date_picker: "Calendrier",
current_week: "Semaine actuelle", current_week: "Semaine actuelle",
@ -359,6 +361,7 @@ export default {
SHIFT_TYPE_REQUIRED: "Type requis", SHIFT_TYPE_REQUIRED: "Type requis",
TIMESHEET_NOT_FOUND: "Aucune feuille de temps ne correspond au détails fournis", TIMESHEET_NOT_FOUND: "Aucune feuille de temps ne correspond au détails fournis",
UPDATE_ERROR: "Une erreur est survenu lors de la mise à jour", UPDATE_ERROR: "Une erreur est survenu lors de la mise à jour",
ERROR_SAVING_SHIFTS: "les changements aux feuilles de temps n'ont pas été enregistrés",
}, },
}, },

View File

@ -2,7 +2,6 @@
setup setup
lang="ts" lang="ts"
> >
/* eslint-disable */
import ShiftList from 'src/modules/timesheets/components/shift-list.vue'; import ShiftList from 'src/modules/timesheets/components/shift-list.vue';
import ShiftListScrollable from 'src/modules/timesheets/components/shift-list-scrollable.vue'; import ShiftListScrollable from 'src/modules/timesheets/components/shift-list-scrollable.vue';
import LoadingOverlay from 'src/modules/shared/components/loading-overlay.vue'; import LoadingOverlay from 'src/modules/shared/components/loading-overlay.vue';
@ -13,14 +12,15 @@
import ShiftListWeeklyOverview from 'src/modules/timesheets/components/shift-list-weekly-overview.vue'; import ShiftListWeeklyOverview from 'src/modules/timesheets/components/shift-list-weekly-overview.vue';
import ShiftListWeeklyOverviewMobile from 'src/modules/timesheets/components/mobile/shift-list-weekly-overview-mobile.vue'; import ShiftListWeeklyOverviewMobile from 'src/modules/timesheets/components/mobile/shift-list-weekly-overview-mobile.vue';
import { useI18n } from 'vue-i18n';
import { computed, onMounted } from 'vue'; import { computed, onMounted } from 'vue';
import { useShiftApi } from 'src/modules/timesheets/composables/use-shift-api'; import { useShiftApi } from 'src/modules/timesheets/composables/use-shift-api';
import { useTimesheetApi } from 'src/modules/timesheets/composables/use-timesheet-api'; import { useTimesheetApi } from 'src/modules/timesheets/composables/use-timesheet-api';
import { useExpensesStore } from 'src/stores/expense-store'; import { useExpensesStore } from 'src/stores/expense-store';
import { useTimesheetStore } from 'src/stores/timesheet-store'; import { useTimesheetStore } from 'src/stores/timesheet-store';
import { date } from 'quasar'; import { date, Notify } from 'quasar';
const { t } = useI18n();
const expenses_store = useExpensesStore(); const expenses_store = useExpensesStore();
const timesheet_store = useTimesheetStore(); const timesheet_store = useTimesheetStore();
const timesheet_api = useTimesheetApi(); const timesheet_api = useTimesheetApi();
@ -41,13 +41,25 @@
sum + timesheet.weekly_expenses.expenses sum + timesheet.weekly_expenses.expenses
+ timesheet.weekly_expenses.on_call + timesheet.weekly_expenses.on_call
+ timesheet.weekly_expenses.per_diem, + timesheet.weekly_expenses.per_diem,
0) //initial value 0 //initial value
); ));
const { mode = 'normal' } = defineProps<{ const { mode = 'normal' } = defineProps<{
mode?: 'approval' | 'normal'; mode?: 'approval' | 'normal';
}>(); }>();
const onClickSaveTimesheets = async () => {
if (mode === 'normal') {
await shift_api.saveShiftChanges();
Notify.create({
message: t('timesheet.save_successful'),
color: 'accent',
});
} else {
await shift_api.saveShiftChanges(timesheet_store.current_pay_period_overview?.email);
}
}
onMounted(async () => { onMounted(async () => {
if (mode === 'normal') if (mode === 'normal')
await timesheet_api.getTimesheetsByDate(date.formatDate(new Date(), 'YYYY-MM-DD')); await timesheet_api.getTimesheetsByDate(date.formatDate(new Date(), 'YYYY-MM-DD'));
@ -97,7 +109,10 @@
v-if="!$q.platform.is.mobile" v-if="!$q.platform.is.mobile"
class="col-xs-6 col-md-4 col-xl-3 q-pa-md" class="col-xs-6 col-md-4 col-xl-3 q-pa-md"
> >
<ShiftListWeeklyOverview mode="off-hours" :timesheet-mode="mode" /> <ShiftListWeeklyOverview
mode="off-hours"
:timesheet-mode="mode"
/>
</div> </div>
</div> </div>
@ -116,7 +131,10 @@
/> />
<!-- mobile expenses button --> <!-- mobile expenses button -->
<div v-if="($q.platform.is.mobile && ($q.screen.width < $q.screen.height))" class="col q-pl-lg"> <div
v-if="($q.platform.is.mobile && ($q.screen.width < $q.screen.height))"
class="col q-pl-lg"
>
<q-btn <q-btn
push push
rounded rounded
@ -150,7 +168,7 @@
icon="upload" icon="upload"
:label="$t('shared.label.save')" :label="$t('shared.label.save')"
:class="$q.platform.is.mobile && ($q.screen.width < $q.screen.height) ? 'full-width' : 'q-ml-md'" :class="$q.platform.is.mobile && ($q.screen.width < $q.screen.height) ? 'full-width' : 'q-ml-md'"
@click="shift_api.saveShiftChanges" @click="onClickSaveTimesheets"
/> />
</div> </div>
@ -204,7 +222,7 @@
:label="$t('shared.label.save')" :label="$t('shared.label.save')"
class="col-auto absolute-bottom shadow-up-10" class="col-auto absolute-bottom shadow-up-10"
style="height: 50px;" style="height: 50px;"
@click="shift_api.saveShiftChanges" @click="onClickSaveTimesheets"
/> />
<ExpenseDialog <ExpenseDialog

View File

@ -18,11 +18,11 @@ export const useShiftApi = () => {
timesheet_store.is_loading = false; timesheet_store.is_loading = false;
}; };
const saveShiftChanges = async () => { const saveShiftChanges = async (employee_email?: string) => {
timesheet_store.is_loading = true; timesheet_store.is_loading = true;
const update_success = await shift_store.updateShifts(); const update_success = await shift_store.updateShifts(employee_email);
const create_success = await shift_store.createNewShifts(); const create_success = await shift_store.createNewShifts(employee_email);
if (create_success || update_success){ if (create_success || update_success){
await timesheet_store.getTimesheetsByOptionalEmployeeEmail(auth_store.user?.email ?? ''); await timesheet_store.getTimesheetsByOptionalEmployeeEmail(auth_store.user?.email ?? '');

View File

@ -54,7 +54,6 @@ export const useShiftStore = defineStore('shift_store', () => {
} }
} }
Notify.create('No shifts to update')
return false; return false;
} catch (error) { } catch (error) {
Notify.create('Error updating shifts'); Notify.create('Error updating shifts');