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

View File

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