mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-15 13:32:43 +01:00
Compare commits
7 Commits
feature/si
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
231d22a5ce | ||
|
|
b373427dc7 | ||
|
|
d2a4d60441 | ||
|
|
c3305b3df6 | ||
|
|
7584e59d0b | ||
|
|
d2f75cca6e | ||
|
|
250379d4bd |
10
app/Exceptions/Api/OverlappingTimeEntryApiException.php
Normal file
10
app/Exceptions/Api/OverlappingTimeEntryApiException.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exceptions\Api;
|
||||
|
||||
class OverlappingTimeEntryApiException extends ApiException
|
||||
{
|
||||
public const string KEY = 'overlapping_time_entry';
|
||||
}
|
||||
@@ -61,6 +61,9 @@ class OrganizationController extends Controller
|
||||
if ($request->getTimeFormat() !== null) {
|
||||
$organization->time_format = $request->getTimeFormat();
|
||||
}
|
||||
if ($request->getPreventOverlappingTimeEntries() !== null) {
|
||||
$organization->prevent_overlapping_time_entries = $request->getPreventOverlappingTimeEntries();
|
||||
}
|
||||
$hasBillableRate = $request->has('billable_rate');
|
||||
if ($hasBillableRate) {
|
||||
$oldBillableRate = $organization->billable_rate;
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Http\Controllers\Api\V1;
|
||||
use App\Enums\ExportFormat;
|
||||
use App\Enums\Role;
|
||||
use App\Exceptions\Api\FeatureIsNotAvailableInFreePlanApiException;
|
||||
use App\Exceptions\Api\OverlappingTimeEntryApiException;
|
||||
use App\Exceptions\Api\PdfRendererIsNotConfiguredException;
|
||||
use App\Exceptions\Api\TimeEntryCanNotBeRestartedApiException;
|
||||
use App\Exceptions\Api\TimeEntryStillRunningApiException;
|
||||
@@ -45,6 +46,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\File;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
@@ -56,6 +58,43 @@ use Spatie\TemporaryDirectory\TemporaryDirectory;
|
||||
|
||||
class TimeEntryController extends Controller
|
||||
{
|
||||
private function assertNoOverlap(Organization $organization, Member $member, \Illuminate\Support\Carbon $start, ?\Illuminate\Support\Carbon $end, ?TimeEntry $exclude = null): void
|
||||
{
|
||||
if (! $organization->prevent_overlapping_time_entries) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query = TimeEntry::query()
|
||||
->where('organization_id', $organization->getKey())
|
||||
->where('user_id', $member->user_id)
|
||||
->when($exclude !== null, function (Builder $q) use ($exclude): void {
|
||||
$q->where('id', '!=', $exclude->getKey());
|
||||
})
|
||||
->where(function (Builder $q) use ($start, $end): void {
|
||||
$q->where(function (Builder $q2) use ($start): void {
|
||||
$q2->where('end', '>', $start)
|
||||
->where('start', '<', $start);
|
||||
});
|
||||
|
||||
if ($end !== null) {
|
||||
$q->orWhere(function (Builder $q4) use ($end): void {
|
||||
$q4->where('start', '<', $end)
|
||||
->where('end', '>', $end);
|
||||
});
|
||||
// Check if the new entry completely surrounds an existing entry
|
||||
$q->orWhere(function (Builder $q6) use ($start, $end): void {
|
||||
$q6->where('start', '>=', $start)
|
||||
->where('end', '<=', $end);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if ($query->exists()) {
|
||||
throw new OverlappingTimeEntryApiException;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkPermission(Organization $organization, string $permission, ?TimeEntry $timeEntry = null): void
|
||||
{
|
||||
parent::checkPermission($organization, $permission);
|
||||
@@ -549,17 +588,15 @@ class TimeEntryController extends Controller
|
||||
throw new TimeEntryStillRunningApiException;
|
||||
}
|
||||
|
||||
// Overlap check for create
|
||||
$start = Carbon::parse($request->input('start'));
|
||||
$end = $request->input('end') !== null ? Carbon::parse($request->input('end')) : null;
|
||||
$this->assertNoOverlap($organization, $member, $start, $end);
|
||||
|
||||
$project = $request->input('project_id') !== null ? Project::findOrFail((string) $request->input('project_id')) : null;
|
||||
$client = $project?->client;
|
||||
$task = $request->input('task_id') !== null ? $project->tasks()->findOrFail((string) $request->input('task_id')) : null;
|
||||
|
||||
if ($project !== null) {
|
||||
RecalculateSpentTimeForProject::dispatch($project);
|
||||
}
|
||||
if ($task !== null) {
|
||||
RecalculateSpentTimeForTask::dispatch($task);
|
||||
}
|
||||
|
||||
$timeEntry = new TimeEntry;
|
||||
$timeEntry->fill($request->validated());
|
||||
$timeEntry->client()->associate($client);
|
||||
@@ -569,6 +606,13 @@ class TimeEntryController extends Controller
|
||||
$timeEntry->setComputedAttributeValue('billable_rate');
|
||||
$timeEntry->save();
|
||||
|
||||
if ($project !== null) {
|
||||
RecalculateSpentTimeForProject::dispatch($project);
|
||||
}
|
||||
if ($task !== null) {
|
||||
RecalculateSpentTimeForTask::dispatch($task);
|
||||
}
|
||||
|
||||
return new TimeEntryResource($timeEntry);
|
||||
}
|
||||
|
||||
@@ -593,6 +637,13 @@ class TimeEntryController extends Controller
|
||||
throw new TimeEntryCanNotBeRestartedApiException;
|
||||
}
|
||||
|
||||
// Overlap check for update (exclude current)
|
||||
/** @var Member $effectiveMember */
|
||||
$effectiveMember = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : $timeEntry->member;
|
||||
$effectiveStart = $request->has('start') ? Carbon::parse($request->input('start')) : $timeEntry->start;
|
||||
$effectiveEnd = $request->has('end') ? ($request->input('end') !== null ? Carbon::parse($request->input('end')) : null) : $timeEntry->end;
|
||||
$this->assertNoOverlap($organization, $effectiveMember, $effectiveStart, $effectiveEnd, $timeEntry);
|
||||
|
||||
$oldProject = $timeEntry->project;
|
||||
$oldTask = $timeEntry->task;
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ class HandleInertiaRequests extends Middleware
|
||||
{
|
||||
$hasBilling = Module::has('Billing') && Module::isEnabled('Billing');
|
||||
$hasInvoicing = Module::has('Invoicing') && Module::isEnabled('Invoicing');
|
||||
|
||||
$hasServices = Module::has('Services') && Module::isEnabled('Services');
|
||||
|
||||
/** @var BillingContract $billing */
|
||||
$billing = app(BillingContract::class);
|
||||
|
||||
@@ -50,6 +51,7 @@ class HandleInertiaRequests extends Middleware
|
||||
return array_merge(parent::share($request), [
|
||||
'has_billing_extension' => $hasBilling,
|
||||
'has_invoicing_extension' => $hasInvoicing,
|
||||
'has_services_extension' => $hasServices,
|
||||
'billing' => $currentOrganization !== null ? [
|
||||
'has_subscription' => $billing->hasSubscription($currentOrganization),
|
||||
'has_trial' => $billing->hasTrial($currentOrganization),
|
||||
|
||||
@@ -39,6 +39,9 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
||||
'employees_can_see_billable_rates' => [
|
||||
'boolean',
|
||||
],
|
||||
'prevent_overlapping_time_entries' => [
|
||||
'boolean',
|
||||
],
|
||||
'number_format' => [
|
||||
Rule::enum(NumberFormat::class),
|
||||
],
|
||||
@@ -98,4 +101,9 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
||||
{
|
||||
return $this->has('employees_can_see_billable_rates') ? $this->boolean('employees_can_see_billable_rates') : null;
|
||||
}
|
||||
|
||||
public function getPreventOverlappingTimeEntries(): ?bool
|
||||
{
|
||||
return $this->has('prevent_overlapping_time_entries') ? $this->boolean('prevent_overlapping_time_entries') : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ class OrganizationResource extends BaseResource
|
||||
'billable_rate' => $this->showBillableRate ? $this->resource->billable_rate : null,
|
||||
/** @var bool $employees_can_see_billable_rates Can members of the organization with role "employee" see the billable rates */
|
||||
'employees_can_see_billable_rates' => $this->resource->employees_can_see_billable_rates,
|
||||
/** @var bool $prevent_overlapping_time_entries Prevent creating overlapping time entries (only new entries) */
|
||||
'prevent_overlapping_time_entries' => $this->resource->prevent_overlapping_time_entries,
|
||||
/** @var string $currency Currency code (ISO 4217) */
|
||||
'currency' => $this->resource->currency,
|
||||
/** @var string $currency_symbol Currency symbol */
|
||||
|
||||
@@ -70,6 +70,7 @@ class Organization extends JetstreamTeam implements AuditableContract
|
||||
'personal_team' => 'boolean',
|
||||
'currency' => 'string',
|
||||
'employees_can_see_billable_rates' => 'boolean',
|
||||
'prevent_overlapping_time_entries' => 'boolean',
|
||||
'number_format' => NumberFormat::class,
|
||||
'currency_format' => CurrencyFormat::class,
|
||||
'date_format' => DateFormat::class,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('organizations', function (Blueprint $table): void {
|
||||
$table->boolean('prevent_overlapping_time_entries')->default(false)->after('employees_can_see_billable_rates');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('organizations', function (Blueprint $table): void {
|
||||
$table->dropColumn('prevent_overlapping_time_entries');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -14,6 +14,7 @@ use App\Exceptions\Api\OnlyOwnerCanChangeOwnership;
|
||||
use App\Exceptions\Api\OnlyPlaceholdersCanBeMergedIntoAnotherMember;
|
||||
use App\Exceptions\Api\OrganizationHasNoSubscriptionButMultipleMembersException;
|
||||
use App\Exceptions\Api\OrganizationNeedsAtLeastOneOwner;
|
||||
use App\Exceptions\Api\OverlappingTimeEntryApiException;
|
||||
use App\Exceptions\Api\PdfRendererIsNotConfiguredException;
|
||||
use App\Exceptions\Api\PersonalAccessClientIsNotConfiguredException;
|
||||
use App\Exceptions\Api\ThisPlaceholderCanNotBeInvitedUseTheMergeToolInsteadException;
|
||||
@@ -47,6 +48,7 @@ return [
|
||||
OnlyPlaceholdersCanBeMergedIntoAnotherMember::KEY => 'Only placeholders can be merged into another member',
|
||||
ThisPlaceholderCanNotBeInvitedUseTheMergeToolInsteadException::KEY => 'This placeholder can not be invited use the merge tool instead',
|
||||
InvitationForTheEmailAlreadyExistsApiException::KEY => 'The email has already been invited to the organization. Please wait for the user to accept the invitation or resend the invitation email.',
|
||||
OverlappingTimeEntryApiException::KEY => 'Overlapping time entries are not allowed.',
|
||||
],
|
||||
'unknown_error_in_admin_panel' => 'An unknown error occurred. Please check the logs.',
|
||||
];
|
||||
|
||||
@@ -203,6 +203,7 @@ return [
|
||||
'organization' => 'The :attribute does not exist.',
|
||||
'task_belongs_to_project' => 'The :attribute is not part of the given project.',
|
||||
'project_name_already_exists' => 'A project with the same name and client already exists in the organization.',
|
||||
'overlapping_time_entry' => 'Overlapping time entries are not allowed.',
|
||||
'tag_name_already_exists' => 'A tag with the same name already exists in the organization.',
|
||||
'client_name_already_exists' => 'A client with the same name already exists in the organization.',
|
||||
'task_name_already_exists' => 'A task with the same name already exists in the project.',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
aria-live="assertive"
|
||||
class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6 sm:pb-24 z-[70]">
|
||||
class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6 z-[70]">
|
||||
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
||||
<Notification
|
||||
v-for="notification in notifications"
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { ChevronDownIcon } from '@heroicons/vue/20/solid';
|
||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||
import DropdownLink from '@/Components/DropdownLink.vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
import { Link, usePage } from '@inertiajs/vue3';
|
||||
import {
|
||||
Cog6ToothIcon,
|
||||
PlusCircleIcon,
|
||||
CheckCircleIcon,
|
||||
ArrowRightIcon,
|
||||
} from '@heroicons/vue/24/solid';
|
||||
import type { Organization, User } from '@/types/models';
|
||||
import { isBillingActivated } from '@/utils/billing';
|
||||
import { canManageBilling } from '@/utils/permissions';
|
||||
import { switchOrganization } from '@/utils/useOrganization';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuTrigger,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
} from '@/Components/ui/dropdown-menu';
|
||||
|
||||
const page = usePage<{
|
||||
jetstream: {
|
||||
@@ -28,84 +39,79 @@ const switchToTeam = (organization: Organization) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dropdown v-if="page.props.jetstream.hasTeamFeatures" align="center" width="60">
|
||||
<template #trigger>
|
||||
<div
|
||||
data-testid="organization_switcher"
|
||||
class="flex hover:bg-white/10 cursor-pointer transition px-2 py-1 rounded-lg w-full items-center justify-between font-medium">
|
||||
<DropdownMenu v-if="page.props.jetstream.hasTeamFeatures">
|
||||
<DropdownMenuTrigger
|
||||
class="flex w-full text-left hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-ring cursor-pointer transition pl-2 py-1 rounded w-full items-center justify-between"
|
||||
as-child>
|
||||
<button data-testid="organization_switcher">
|
||||
<div class="flex flex-1 space-x-2 items-center w-[calc(100%-30px)]">
|
||||
<div
|
||||
class="rounded sm:rounded-lg bg-blue-900 font-semibold text-xs sm:text-sm flex-shrink-0 text-white w-5 sm:w-6 h-5 sm:h-6 flex items-center justify-center">
|
||||
class="rounded bg-blue-900 font-medium text-xs flex-shrink-0 text-white w-5 h-5 flex items-center justify-center">
|
||||
{{ page.props.auth.user.current_team.name.slice(0, 1).toUpperCase() }}
|
||||
</div>
|
||||
<span class="text-sm flex-1 truncate font-semibold">
|
||||
<span class="text-xs flex-1 truncate font-medium">
|
||||
{{ page.props.auth.user.current_team.name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="w-[30px]">
|
||||
<button
|
||||
class="p-1 transition hover:bg-white/10 rounded-full flex items-center w-8 h-8">
|
||||
<ChevronDownIcon class="w-5 sm:w-full mt-[1px]"></ChevronDownIcon>
|
||||
</button>
|
||||
<div class="p-1 rounded-full flex items-center w-6 h-6">
|
||||
<ChevronDownIcon class="w-4 sm:w-full mt-[1px]"></ChevronDownIcon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
<template #content>
|
||||
<DropdownMenuContent align="start">
|
||||
<div class="w-60">
|
||||
<!-- Organization Management -->
|
||||
<div class="block px-4 py-2 text-xs text-text-secondary">Manage Organization</div>
|
||||
<DropdownMenuLabel>Manage Organization</DropdownMenuLabel>
|
||||
|
||||
<!-- Organization Settings -->
|
||||
<DropdownLink :href="route('teams.show', page.props.auth.user.current_team.id)">
|
||||
Organization Settings
|
||||
</DropdownLink>
|
||||
<DropdownMenuItem as-child>
|
||||
<Link
|
||||
:href="route('teams.show', page.props.auth.user.current_team.id)"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<Cog6ToothIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Organization Settings</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownLink v-if="canManageBilling() && isBillingActivated()" href="/billing">
|
||||
Billing
|
||||
</DropdownLink>
|
||||
<DropdownMenuItem v-if="canManageBilling() && isBillingActivated()" as-child>
|
||||
<Link href="/billing" class="inline-flex items-center w-full"> Billing </Link>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownLink
|
||||
v-if="page.props.jetstream.canCreateTeams"
|
||||
:href="route('teams.create')">
|
||||
Create new organization
|
||||
</DropdownLink>
|
||||
<DropdownMenuItem v-if="page.props.jetstream.canCreateTeams" as-child>
|
||||
<Link
|
||||
:href="route('teams.create')"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<PlusCircleIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Create new organization</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<!-- Organization Switcher -->
|
||||
<template v-if="page.props.auth.user.all_teams.length > 1">
|
||||
<div class="border-t border-card-background-separator" />
|
||||
|
||||
<div class="block px-4 py-2 text-xs text-text-secondary">
|
||||
Switch Organizations
|
||||
</div>
|
||||
<DropdownMenuLabel>Switch Organizations</DropdownMenuLabel>
|
||||
|
||||
<template v-for="team in page.props.auth.user.all_teams" :key="team.id">
|
||||
<form @submit.prevent="switchToTeam(team)">
|
||||
<DropdownLink as="button">
|
||||
<div class="flex items-center">
|
||||
<svg
|
||||
<DropdownMenuItem
|
||||
as-child
|
||||
class="inline-flex gap-2.5 items-center w-full">
|
||||
<button type="submit">
|
||||
<CheckCircleIcon
|
||||
v-if="team.id == page.props.auth.user.current_team_id"
|
||||
class="me-2 h-5 w-5 text-green-400"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
class="h-5 w-5 text-green-400" />
|
||||
<ArrowRightIcon v-else class="h-5 w-5 text-icon-default" />
|
||||
|
||||
<div>
|
||||
<div class="w-full truncate text-left">
|
||||
{{ team.name }}
|
||||
</div>
|
||||
</div>
|
||||
</DropdownLink>
|
||||
</button>
|
||||
</DropdownMenuItem>
|
||||
</form>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</template>
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { router, usePage } from '@inertiajs/vue3';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import type { Organization, User } from '@/types/models';
|
||||
import DropdownLink from '@/Components/DropdownLink.vue';
|
||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuTrigger,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
} from '@/Components/ui/dropdown-menu';
|
||||
import {
|
||||
UserCircleIcon,
|
||||
KeyIcon,
|
||||
ArrowLeftOnRectangleIcon,
|
||||
ChatBubbleLeftRightIcon,
|
||||
} from '@heroicons/vue/24/solid';
|
||||
import { openFeedback } from '@/utils/feedback';
|
||||
|
||||
const page = usePage<{
|
||||
has_services_extension?: boolean;
|
||||
has_billing_extension?: boolean;
|
||||
jetstream: {
|
||||
canCreateTeams: boolean;
|
||||
hasTeamFeatures: boolean;
|
||||
@@ -23,60 +37,58 @@ const logout = () => {
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="ms-3 relative">
|
||||
<Dropdown align="center" width="48">
|
||||
<template #trigger>
|
||||
<button
|
||||
v-if="page.props.jetstream.managesProfilePhotos"
|
||||
data-testid="current_user_button"
|
||||
class="flex text-sm border-2 border-transparent rounded-full focus:outline-none focus:border-gray-300 transition">
|
||||
<div class="relative">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger
|
||||
class="flex text-sm border-2 outline-none border-transparent rounded-full focus-visible:ring-2 focus-visible:ring-ring transition"
|
||||
as-child>
|
||||
<button data-testid="current_user_button">
|
||||
<img
|
||||
class="h-8 w-8 rounded-full object-cover"
|
||||
class="h-7 w-7 rounded-full object-cover"
|
||||
:src="page.props.auth.user.profile_photo_url"
|
||||
:alt="page.props.auth.user.name" />
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="center" class="max-w-48">
|
||||
<DropdownMenuLabel>Manage Account</DropdownMenuLabel>
|
||||
|
||||
<span v-else class="inline-flex rounded-md">
|
||||
<DropdownMenuItem as-child>
|
||||
<Link
|
||||
:href="route('profile.show')"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<UserCircleIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Profile Settings</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownMenuItem v-if="page.props.jetstream.hasApiFeatures" as-child>
|
||||
<Link
|
||||
:href="route('api-tokens.index')"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<KeyIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>API Tokens</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownMenuItem v-if="page.props.has_services_extension" as-child>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150">
|
||||
{{ page.props.auth.user.name }}
|
||||
|
||||
<svg
|
||||
class="ms-2 -me-0.5 h-4 w-4"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
||||
</svg>
|
||||
class="inline-flex items-center gap-2.5 w-full"
|
||||
@click="openFeedback">
|
||||
<ChatBubbleLeftRightIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Feedback</span>
|
||||
</button>
|
||||
</span>
|
||||
</template>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<template #content>
|
||||
<!-- Account Management -->
|
||||
<div class="block px-4 py-2 text-xs text-gray-400">Manage Account</div>
|
||||
|
||||
<DropdownLink :href="route('profile.show')"> Profile </DropdownLink>
|
||||
|
||||
<DropdownLink
|
||||
v-if="page.props.jetstream.hasApiFeatures"
|
||||
:href="route('api-tokens.index')">
|
||||
API Tokens
|
||||
</DropdownLink>
|
||||
|
||||
<div class="border-t border-card-border" />
|
||||
|
||||
<!-- Authentication -->
|
||||
<form @submit.prevent="logout">
|
||||
<DropdownLink as="button" data-testid="logout_button"> Log Out </DropdownLink>
|
||||
<form class="w-full" @submit.prevent="logout">
|
||||
<DropdownMenuItem as-child class="inline-flex items-center gap-2.5 w-full">
|
||||
<button type="submit" data-testid="logout_button">
|
||||
<ArrowLeftOnRectangleIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Log Out</span>
|
||||
</button>
|
||||
</DropdownMenuItem>
|
||||
</form>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -19,7 +19,7 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||
<template>
|
||||
<DropdownMenuLabel
|
||||
v-bind="forwardedProps"
|
||||
:class="cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', props.class)">
|
||||
:class="cn('block px-2 py-2 text-xs text-gray-400', inset && 'pl-8', props.class)">
|
||||
<slot />
|
||||
</DropdownMenuLabel>
|
||||
</template>
|
||||
|
||||
@@ -47,6 +47,8 @@ import { api } from '@/packages/api/src';
|
||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import Button from '@/Components/ui/button/Button.vue';
|
||||
import { openFeedback } from '@/utils/feedback';
|
||||
|
||||
defineProps({
|
||||
title: String,
|
||||
@@ -94,8 +96,8 @@ onMounted(async () => {
|
||||
}, 100);
|
||||
};
|
||||
});
|
||||
|
||||
const page = usePage<{
|
||||
has_services_extension?: boolean;
|
||||
auth: {
|
||||
user: User;
|
||||
};
|
||||
@@ -106,7 +108,7 @@ const page = usePage<{
|
||||
<div v-bind="$attrs" class="flex flex-wrap bg-background text-text-secondary">
|
||||
<div
|
||||
:class="{
|
||||
'!flex bg-default-background w-full z-[9999999999]': showSidebarMenu,
|
||||
'!flex bg-default-background w-full z-30': showSidebarMenu,
|
||||
}"
|
||||
class="flex-shrink-0 h-screen hidden fixed w-[230px] 2xl:w-[250px] px-2.5 2xl:px-3 py-4 lg:flex flex-col justify-between">
|
||||
<div class="flex flex-col h-full">
|
||||
@@ -242,14 +244,23 @@ const page = usePage<{
|
||||
<div class="justify-self-end">
|
||||
<UpdateSidebarNotification></UpdateSidebarNotification>
|
||||
<ul
|
||||
class="border-t border-default-background-separator pt-3 flex justify-between pr-4 items-center">
|
||||
class="border-t border-default-background-separator pt-3 gap-1 pr-2 flex justify-between items-center">
|
||||
<UserSettingsIcon></UserSettingsIcon>
|
||||
|
||||
<NavigationSidebarItem
|
||||
class="flex-1"
|
||||
title="Profile Settings"
|
||||
:icon="Cog6ToothIcon"
|
||||
:href="route('profile.show')"></NavigationSidebarItem>
|
||||
|
||||
<UserSettingsIcon></UserSettingsIcon>
|
||||
<Button
|
||||
v-if="page.props.has_services_extension"
|
||||
variant="outline"
|
||||
size="xs"
|
||||
class="rounded-full ml-2 flex h-6 w-6 items-center text-xs text-icon-default justify-center"
|
||||
@click="openFeedback">
|
||||
?
|
||||
</Button>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ interface FormValues {
|
||||
}
|
||||
|
||||
const store = useOrganizationStore();
|
||||
const { fetchOrganization, updateOrganization } = store;
|
||||
const { updateOrganization } = store;
|
||||
const { organization } = storeToRefs(store);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -47,7 +47,6 @@ const mutation = useMutation({
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchOrganization();
|
||||
if (organization.value) {
|
||||
form.value = {
|
||||
number_format: organization.value.number_format as NumberFormat,
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<script setup lang="ts">
|
||||
import FormSection from '@/Components/FormSection.vue';
|
||||
import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import InputLabel from '@/packages/ui/src/Input/InputLabel.vue';
|
||||
import { Checkbox } from '@/packages/ui/src';
|
||||
import type { UpdateOrganizationBody } from '@/packages/api/src';
|
||||
import { useOrganizationStore } from '@/utils/useOrganization';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useMutation, useQueryClient } from '@tanstack/vue-query';
|
||||
|
||||
const store = useOrganizationStore();
|
||||
const { updateOrganization } = store;
|
||||
const { organization } = storeToRefs(store);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const form = ref<{ prevent_overlapping_time_entries: boolean }>({
|
||||
prevent_overlapping_time_entries: false,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
form.value.prevent_overlapping_time_entries =
|
||||
organization.value?.prevent_overlapping_time_entries ?? false;
|
||||
});
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (values: Partial<UpdateOrganizationBody>) => updateOrganization(values),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['organization'] });
|
||||
},
|
||||
});
|
||||
|
||||
async function submit() {
|
||||
await mutation.mutateAsync({
|
||||
prevent_overlapping_time_entries: form.value.prevent_overlapping_time_entries,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormSection>
|
||||
<template #title>Time Entry Settings</template>
|
||||
<template #description>
|
||||
Disallow overlapping time entries for members of this organization. When enabled, users
|
||||
cannot create new time entries that overlap with their existing ones. This only affects
|
||||
newly created entries.
|
||||
</template>
|
||||
|
||||
<template #form>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-4">
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
id="preventOverlappingTimeEntries"
|
||||
v-model:checked="form.prevent_overlapping_time_entries" />
|
||||
<InputLabel
|
||||
for="preventOverlappingTimeEntries"
|
||||
value="Prevent overlapping time entries (new entries only)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #actions>
|
||||
<PrimaryButton :disabled="mutation.isPending.value" @click="submit">Save</PrimaryButton>
|
||||
</template>
|
||||
</FormSection>
|
||||
</template>
|
||||
@@ -8,12 +8,25 @@ import type { Permissions, Role } from '@/types/jetstream';
|
||||
import { canUpdateOrganization } from '@/utils/permissions';
|
||||
import OrganizationBillableRate from '@/Pages/Teams/Partials/OrganizationBillableRate.vue';
|
||||
import OrganizationFormatSettings from '@/Pages/Teams/Partials/OrganizationFormatSettings.vue';
|
||||
import OrganizationTimeEntrySettings from '@/Pages/Teams/Partials/OrganizationTimeEntrySettings.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useOrganizationStore } from '@/utils/useOrganization';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
defineProps<{
|
||||
team: Organization;
|
||||
availableRoles: Role[];
|
||||
permissions: Permissions;
|
||||
}>();
|
||||
|
||||
const loading = ref(true);
|
||||
const orgStore = useOrganizationStore();
|
||||
const { organization } = storeToRefs(orgStore);
|
||||
|
||||
onMounted(async () => {
|
||||
await orgStore.fetchOrganization();
|
||||
loading.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -26,17 +39,25 @@ defineProps<{
|
||||
|
||||
<div>
|
||||
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
|
||||
<UpdateTeamNameForm :team="team" :permissions="permissions" />
|
||||
<div v-if="loading || !organization" class="py-16 text-center text-text-secondary">
|
||||
Loading organization settings...
|
||||
</div>
|
||||
<template v-else>
|
||||
<UpdateTeamNameForm :team="team" :permissions="permissions" />
|
||||
|
||||
<SectionBorder />
|
||||
<OrganizationBillableRate v-if="canUpdateOrganization()" :team="team" />
|
||||
<SectionBorder />
|
||||
<SectionBorder />
|
||||
<OrganizationBillableRate v-if="canUpdateOrganization()" :team="team" />
|
||||
<SectionBorder />
|
||||
|
||||
<OrganizationFormatSettings v-if="canUpdateOrganization()" :team="team" />
|
||||
<SectionBorder />
|
||||
<OrganizationFormatSettings v-if="canUpdateOrganization()" :team="team" />
|
||||
<SectionBorder />
|
||||
|
||||
<template v-if="permissions.canDeleteTeam && !team.personal_team">
|
||||
<DeleteTeamForm class="mt-10 sm:mt-0" :team="team" />
|
||||
<OrganizationTimeEntrySettings v-if="canUpdateOrganization()" />
|
||||
<SectionBorder />
|
||||
|
||||
<template v-if="permissions.canDeleteTeam && !team.personal_team">
|
||||
<DeleteTeamForm class="mt-10 sm:mt-0" :team="team" />
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -320,6 +320,7 @@ const OrganizationResource = z
|
||||
is_personal: z.boolean(),
|
||||
billable_rate: z.union([z.number(), z.null()]),
|
||||
employees_can_see_billable_rates: z.boolean(),
|
||||
prevent_overlapping_time_entries: z.boolean(),
|
||||
currency: z.string(),
|
||||
currency_symbol: z.string(),
|
||||
number_format: NumberFormat,
|
||||
@@ -334,6 +335,7 @@ const OrganizationUpdateRequest = z
|
||||
name: z.string().max(255),
|
||||
billable_rate: z.union([z.number(), z.null()]),
|
||||
employees_can_see_billable_rates: z.boolean(),
|
||||
prevent_overlapping_time_entries: z.boolean(),
|
||||
number_format: NumberFormat,
|
||||
currency_format: CurrencyFormat,
|
||||
date_format: DateFormat,
|
||||
|
||||
9
resources/js/utils/feedback.ts
Normal file
9
resources/js/utils/feedback.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function openFeedback(): void {
|
||||
if (
|
||||
typeof window !== 'undefined' &&
|
||||
'showChatWindow' in window &&
|
||||
typeof window.showChatWindow === 'function'
|
||||
) {
|
||||
window.showChatWindow();
|
||||
}
|
||||
}
|
||||
@@ -3393,6 +3393,241 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_blocks_overlapping_entries_when_start_overlaps(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 13, 0, 0, 'UTC');
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $baseStart->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
'end' => $baseEnd->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_blocks_overlapping_entries_when_end_overlaps(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 13, 0, 0, 'UTC');
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $baseStart->copy()->subMinutes(30)->toIso8601ZuluString(),
|
||||
'end' => $baseStart->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_blocks_overlapping_entries_when_new_entry_is_within_existing(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 13, 0, 0, 'UTC');
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $baseStart->copy()->addMinutes(15)->toIso8601ZuluString(),
|
||||
'end' => $baseStart->copy()->addMinutes(45)->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_blocks_overlapping_entries_when_new_entry_surrounds_existing(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 13, 0, 0, 'UTC');
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $baseStart->copy()->subMinutes(30)->toIso8601ZuluString(),
|
||||
'end' => $baseEnd->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_blocks_starting_active_entry_when_it_overlaps_with_existing(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 13, 0, 0, 'UTC');
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $baseStart->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
'end' => null,
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_allows_future_time_entries_even_with_running_now(): void
|
||||
{
|
||||
// Arrange
|
||||
$now = Carbon::create(2025, 1, 1, 12, 0, 0, 'UTC');
|
||||
$this->travelTo($now);
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:create:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $now->copy()->subHour(),
|
||||
'end' => null,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.time-entries.store', [$data->organization->getKey()]), [
|
||||
'member_id' => $data->member->getKey(),
|
||||
'billable' => true,
|
||||
'start' => $now->copy()->addDay()->toIso8601ZuluString(),
|
||||
'end' => $now->copy()->addDay()->addHour()->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(201);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_blocks_overlap_and_excludes_current_entry(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:update:own',
|
||||
]);
|
||||
$data->organization->prevent_overlapping_time_entries = true;
|
||||
$data->organization->save();
|
||||
$baseStart = Carbon::create(2025, 1, 1, 14, 0, 0, 'UTC');
|
||||
$baseEnd = Carbon::create(2025, 1, 1, 15, 0, 0, 'UTC');
|
||||
$base = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseStart,
|
||||
'end' => $baseEnd,
|
||||
]);
|
||||
$toUpdate = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)
|
||||
->create([
|
||||
'start' => $baseEnd->copy()->addMinutes(30),
|
||||
'end' => $baseEnd->copy()->addHour(),
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->putJson(route('api.v1.time-entries.update', [$data->organization->getKey(), $toUpdate->getKey()]), [
|
||||
'start' => $baseStart->copy()->addMinutes(30)->toIso8601ZuluString(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(400);
|
||||
$response->assertExactJson([
|
||||
'error' => true,
|
||||
'key' => 'overlapping_time_entry',
|
||||
'message' => 'Overlapping time entries are not allowed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_multiple_refreshes_billable_rate_on_updates_time_entries(): void
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user