0
0
Fork 0

WorkerTimeForm set initial data

This commit is contained in:
William Buezas 2024-04-02 09:30:59 -03:00
parent 772959ff81
commit 026588c03d
2 changed files with 13 additions and 4 deletions

View File

@ -49,7 +49,8 @@ const weekTotalHours = ref(null);
const workerTimeControlMails = ref([]); const workerTimeControlMails = ref([]);
const workerTimeFormProps = reactive({ const workerTimeFormProps = reactive({
dated: null, dated: null,
formType: null, entryId: null,
entryCode: null,
}); });
// Array utilizado por QCalendar para seleccionar un rango de fechas // Array utilizado por QCalendar para seleccionar un rango de fechas
@ -357,7 +358,8 @@ const getMailStates = async (date) => {
const showWorkerTimeForm = (propValue, formType) => { const showWorkerTimeForm = (propValue, formType) => {
const isEditForm = formType === 'edit'; const isEditForm = formType === 'edit';
workerTimeFormProps.entryId = isEditForm ? propValue : null; workerTimeFormProps.entryId = isEditForm ? propValue.id : null;
workerTimeFormProps.entryCode = isEditForm ? propValue.entryCode : null;
workerTimeFormProps.dated = isEditForm ? null : propValue; workerTimeFormProps.dated = isEditForm ? null : propValue;
workerTimeFormDialogRef.value.show(); workerTimeFormDialogRef.value.show();
@ -556,7 +558,10 @@ onMounted(async () => {
:id="hour.id" :id="hour.id"
@on-hour-entry-deleted="updateData()" @on-hour-entry-deleted="updateData()"
@show-worker-time-form=" @show-worker-time-form="
showWorkerTimeForm(hour.id, 'edit') showWorkerTimeForm(
{ id: hour.id, entryCode: hour.direction },
'edit'
)
" "
class="hour-chip" class="hour-chip"
/> />

View File

@ -12,6 +12,10 @@ const $props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
entryCode: {
type: String,
default: null,
},
dated: { dated: {
type: Date, type: Date,
default: true, default: true,
@ -54,7 +58,7 @@ const urlCreate = computed(() =>
onBeforeMount(() => { onBeforeMount(() => {
workerHourEntry = isEditMode.value workerHourEntry = isEditMode.value
? {} ? { direction: $props.entryCode }
: { : {
timed: new Date($props.dated), timed: new Date($props.dated),
workerFk: route.params.id, workerFk: route.params.id,