Merge branch 'vacation-request-ui-polishing' into #22-vacation-calendar
This commit is contained in:
commit
75506dfb6d
@ -16,7 +16,7 @@ class VacationDaysCalculator
|
|||||||
$period = CarbonPeriod::create($from, $to);
|
$period = CarbonPeriod::create($from, $to);
|
||||||
$holidays = $yearPeriod->holidays()->pluck("date");
|
$holidays = $yearPeriod->holidays()->pluck("date");
|
||||||
|
|
||||||
$validDays = collect();
|
$validDays = new Collection();
|
||||||
|
|
||||||
foreach ($period as $day) {
|
foreach ($period as $day) {
|
||||||
if ($this->passes($day, $holidays)) {
|
if ($this->passes($day, $holidays)) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
@ -11,7 +11,7 @@ use Toby\Eloquent\Models\VacationRequest;
|
|||||||
return new class() extends Migration {
|
return new class() extends Migration {
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create("vacations", function (Blueprint $table) {
|
Schema::create("vacations", function (Blueprint $table): void {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignIdFor(User::class)->constrained()->cascadeOnDelete();
|
$table->foreignIdFor(User::class)->constrained()->cascadeOnDelete();
|
||||||
$table->foreignIdFor(VacationRequest::class)->constrained()->cascadeOnDelete();
|
$table->foreignIdFor(VacationRequest::class)->constrained()->cascadeOnDelete();
|
||||||
|
@ -80,17 +80,17 @@ class DatabaseSeeder extends Seeder
|
|||||||
->sequence(fn() => [
|
->sequence(fn() => [
|
||||||
"year_period_id" => $yearPeriods->random()->id,
|
"year_period_id" => $yearPeriods->random()->id,
|
||||||
])
|
])
|
||||||
->afterCreating(function (VacationRequest $vacationRequest) {
|
->afterCreating(function (VacationRequest $vacationRequest): void {
|
||||||
$days = app(VacationDaysCalculator::class)->calculateDays(
|
$days = app(VacationDaysCalculator::class)->calculateDays(
|
||||||
$vacationRequest->yearPeriod,
|
$vacationRequest->yearPeriod,
|
||||||
$vacationRequest->from,
|
$vacationRequest->from,
|
||||||
$vacationRequest->to
|
$vacationRequest->to,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
$vacationRequest->vacations()->create([
|
$vacationRequest->vacations()->create([
|
||||||
"date" => $day,
|
"date" => $day,
|
||||||
"user_id" => $vacationRequest->user->id
|
"user_id" => $vacationRequest->user->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -144,7 +144,7 @@ import { DotsVerticalIcon, PencilIcon, TrashIcon } from '@heroicons/vue/solid'
|
|||||||
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HolidayINdex',
|
name: 'HolidayIndex',
|
||||||
components: {
|
components: {
|
||||||
DotsVerticalIcon,
|
DotsVerticalIcon,
|
||||||
PencilIcon,
|
PencilIcon,
|
||||||
|
@ -54,9 +54,18 @@
|
|||||||
<dt class="text-sm font-medium text-gray-500">
|
<dt class="text-sm font-medium text-gray-500">
|
||||||
Komentarz
|
Komentarz
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
<dd
|
||||||
|
v-if="request.comment != null"
|
||||||
|
class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"
|
||||||
|
>
|
||||||
{{ request.comment }}
|
{{ request.comment }}
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd
|
||||||
|
v-else
|
||||||
|
class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"
|
||||||
|
>
|
||||||
|
-
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
<dt class="text-sm font-medium text-gray-500">
|
<dt class="text-sm font-medium text-gray-500">
|
||||||
@ -183,37 +192,37 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-gray-200 px-4 py-4">
|
<div class="border-t border-gray-200 px-4 py-4">
|
||||||
<!-- <ul>-->
|
<!-- <ul>-->
|
||||||
<!-- <li-->
|
<!-- <li-->
|
||||||
<!-- v-for="(activity, index) in activities.data"-->
|
<!-- v-for="(activity, index) in activities.data"-->
|
||||||
<!-- :key="activity.id"-->
|
<!-- :key="activity.id"-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- <div :class="{'relative pb-8': index !== activities.data.length - 1}">-->
|
<!-- <div :class="{'relative pb-8': index !== activities.data.length - 1}">-->
|
||||||
<!-- <span-->
|
<!-- <span-->
|
||||||
<!-- v-if="(index !== activities.data.length - 1)"-->
|
<!-- v-if="(index !== activities.data.length - 1)"-->
|
||||||
<!-- class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"-->
|
<!-- class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"-->
|
||||||
<!-- />-->
|
<!-- />-->
|
||||||
<!-- <div class="relative flex space-x-3">-->
|
<!-- <div class="relative flex space-x-3">-->
|
||||||
<!-- <div>-->
|
<!-- <div>-->
|
||||||
<!-- <span-->
|
<!-- <span-->
|
||||||
<!-- class="bg-blumilk-500 h-8 w-8 rounded-full flex items-center justify-center ring-8 ring-white">-->
|
<!-- class="bg-blumilk-500 h-8 w-8 rounded-full flex items-center justify-center ring-8 ring-white">-->
|
||||||
<!-- <ThumbUpIcon class="w-5 h-5 text-white"/>-->
|
<!-- <ThumbUpIcon class="w-5 h-5 text-white"/>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4">-->
|
<!-- <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4">-->
|
||||||
<!-- <div>-->
|
<!-- <div>-->
|
||||||
<!-- <p class="text-sm text-gray-500">-->
|
<!-- <p class="text-sm text-gray-500">-->
|
||||||
<!-- {{ activity.to }}-->
|
<!-- {{ activity.to }}-->
|
||||||
<!-- </p>-->
|
<!-- </p>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <div class="text-right text-sm whitespace-nowrap text-gray-500">-->
|
<!-- <div class="text-right text-sm whitespace-nowrap text-gray-500">-->
|
||||||
<!-- <time>{{ activity.date }}</time>-->
|
<!-- <time>{{ activity.date }}</time>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </li>-->
|
<!-- </li>-->
|
||||||
<!-- </ul>-->
|
<!-- </ul>-->
|
||||||
<ul>
|
<ul>
|
||||||
<li
|
<li
|
||||||
v-for="(status, index) in statuses"
|
v-for="(status, index) in statuses"
|
||||||
@ -236,14 +245,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4">
|
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4">
|
||||||
<div>
|
<div class="flex flex-col items-start">
|
||||||
<p class="text-sm text-gray-500">
|
<div class="text-sm font-medium text-gray-700">
|
||||||
{{ status.name }}
|
{{ status.name }}
|
||||||
</p>
|
</div>
|
||||||
</div>
|
<div class="text-right text-sm whitespace-nowrap font-medium text-gray-400">
|
||||||
<div class="text-right text-sm whitespace-nowrap text-gray-500">
|
Jan Kowalski
|
||||||
<time>4 lutego 2022</time>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-right text-sm whitespace-nowrap text-gray-500 flex flex-col">
|
||||||
|
<time>29.10.2022</time>
|
||||||
|
<time>09:04</time>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user