forked from verdnatura/salix-front
WorkerTimeForm set initial data
This commit is contained in:
parent
772959ff81
commit
026588c03d
|
@ -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"
|
||||
/>
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue