#157 - added support for the date parameter

This commit is contained in:
Kamil Niemczycki 2022-06-02 12:40:35 +02:00
parent 4309e8104b
commit 6fdd2ca049
2 changed files with 4 additions and 1 deletions

View File

@ -180,6 +180,7 @@ class VacationRequestController extends Controller
"createOnBehalfOfEmployee" => $request->user()->can("createOnBehalfOfEmployee", VacationRequest::class), "createOnBehalfOfEmployee" => $request->user()->can("createOnBehalfOfEmployee", VacationRequest::class),
"skipFlow" => $request->user()->can("skipFlow", VacationRequest::class), "skipFlow" => $request->user()->can("skipFlow", VacationRequest::class),
], ],
"vacationStartDate" => $request->get("start_date"),
]); ]);
} }

View File

@ -343,13 +343,14 @@ const props = defineProps({
users: Object, users: Object,
holidays: Object, holidays: Object,
can: Object, can: Object,
vacationStartDate: [String, null],
}) })
const form = useForm({ const form = useForm({
user: props.can.createOnBehalfOfEmployee user: props.can.createOnBehalfOfEmployee
? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0] ? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0]
: props.auth.user, : props.auth.user,
from: null, from: props.vacationStartDate,
to: null, to: null,
vacationType: null, vacationType: null,
comment: null, comment: null,
@ -399,6 +400,7 @@ function createForm() {
} }
function onFromChange(selectedDates, dateStr) { function onFromChange(selectedDates, dateStr) {
console.log(form.from)
if (form.to === null) { if (form.to === null) {
form.to = dateStr form.to = dateStr