mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 03:02:15 +01:00
Compare commits
14 Commits
v0.8.0
...
feature/fo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e08e61832 | ||
|
|
dbf03fe515 | ||
|
|
361ccea472 | ||
|
|
67a06d3dbd | ||
|
|
fd4849c789 | ||
|
|
4a9e3e3ca2 | ||
|
|
9b1e181614 | ||
|
|
ff9672e155 | ||
|
|
77ff4d88be | ||
|
|
a076bb2fb0 | ||
|
|
f69bc28316 | ||
|
|
c1d43bcc67 | ||
|
|
b8d9bc5b7e | ||
|
|
f5b0f40b23 |
3
.github/workflows/build-private.yml
vendored
3
.github/workflows/build-private.yml
vendored
@@ -10,8 +10,6 @@ on:
|
|||||||
- '.github/workflows/build-private.yml'
|
- '.github/workflows/build-private.yml'
|
||||||
- 'docker/prod/**'
|
- 'docker/prod/**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
name: Build - Private
|
name: Build - Private
|
||||||
jobs:
|
jobs:
|
||||||
@@ -19,7 +17,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Check out code"
|
- name: "Check out code"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
16
.github/workflows/build-public.yml
vendored
16
.github/workflows/build-public.yml
vendored
@@ -11,12 +11,6 @@ on:
|
|||||||
- 'docker/prod/**'
|
- 'docker/prod/**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
attestations: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKERHUB_REPO: solidtime/solidtime
|
DOCKERHUB_REPO: solidtime/solidtime
|
||||||
GHCR_REPO: ghcr.io/solidtime-io/solidtime
|
GHCR_REPO: ghcr.io/solidtime-io/solidtime
|
||||||
@@ -32,6 +26,11 @@ jobs:
|
|||||||
- runs-on: "ubuntu-24.04"
|
- runs-on: "ubuntu-24.04"
|
||||||
platform: "linux/amd64"
|
platform: "linux/amd64"
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
attestations: write
|
||||||
|
id-token: write
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -164,6 +163,11 @@ jobs:
|
|||||||
|
|
||||||
merge:
|
merge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
attestations: write
|
||||||
|
id-token: write
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
|
|||||||
3
.github/workflows/generate-api-docs.yml
vendored
3
.github/workflows/generate-api-docs.yml
vendored
@@ -3,9 +3,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
api_docs:
|
api_docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/npm-build.yml
vendored
2
.github/workflows/npm-build.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: NPM Build
|
name: NPM Build
|
||||||
|
|
||||||
on: [push]
|
on: [push]
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
2
.github/workflows/npm-lint.yml
vendored
2
.github/workflows/npm-lint.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: NPM Lint
|
name: NPM Lint
|
||||||
|
|
||||||
on: [push]
|
on: [push]
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
2
.github/workflows/npm-publish-api.yml
vendored
2
.github/workflows/npm-publish-api.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: Publish API package to NPM
|
name: Publish API package to NPM
|
||||||
on:
|
on:
|
||||||
workflow_dispatch
|
workflow_dispatch
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/npm-publish-ui.yml
vendored
2
.github/workflows/npm-publish-ui.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: Publish UI package to NPM
|
name: Publish UI package to NPM
|
||||||
on:
|
on:
|
||||||
workflow_dispatch
|
workflow_dispatch
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
3
.github/workflows/npm-typecheck.yml
vendored
3
.github/workflows/npm-typecheck.yml
vendored
@@ -1,8 +1,7 @@
|
|||||||
name: NPM Typecheck
|
name: NPM Typecheck
|
||||||
|
|
||||||
on: [push]
|
on: [push]
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/phpstan.yml
vendored
2
.github/workflows/phpstan.yml
vendored
@@ -1,7 +1,5 @@
|
|||||||
name: Static code analysis (PHPStan)
|
name: Static code analysis (PHPStan)
|
||||||
on: push
|
on: push
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
phpstan:
|
phpstan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/phpunit.yml
vendored
2
.github/workflows/phpunit.yml
vendored
@@ -1,7 +1,5 @@
|
|||||||
name: PHPUnit Tests
|
name: PHPUnit Tests
|
||||||
on: push
|
on: push
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
phpunit:
|
phpunit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/pint.yml
vendored
2
.github/workflows/pint.yml
vendored
@@ -1,7 +1,5 @@
|
|||||||
name: PHP Linting
|
name: PHP Linting
|
||||||
on: push
|
on: push
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
pint:
|
pint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/playwright.yml
vendored
2
.github/workflows/playwright.yml
vendored
@@ -1,7 +1,5 @@
|
|||||||
name: Playwright Tests
|
name: Playwright Tests
|
||||||
on: [push]
|
on: [push]
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Console\Commands\SelfHost;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Database\Query\Builder;
|
|
||||||
use Illuminate\Database\Query\JoinClause;
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class SelfHostDatabaseConsistency extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'self-host:database-consistency';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*/
|
|
||||||
public function handle(): int
|
|
||||||
{
|
|
||||||
$hadAProblem = false;
|
|
||||||
|
|
||||||
// Task need to be part of project in time entries
|
|
||||||
$problems = DB::table('time_entries')
|
|
||||||
->select(['time_entries.id as id'])
|
|
||||||
->join('tasks', 'time_entries.task_id', '=', 'tasks.id')
|
|
||||||
->where('tasks.project_id', '!=', DB::raw('time_entries.project_id'))
|
|
||||||
->get();
|
|
||||||
$this->logProblems($problems, 'Time entries have a task that does not belong to the project of the time entry', $hadAProblem);
|
|
||||||
|
|
||||||
// Client id is the client id of the project
|
|
||||||
$problems = DB::table('time_entries')
|
|
||||||
->select(['time_entries.id as id'])
|
|
||||||
->join('projects', 'time_entries.project_id', '=', 'projects.id')
|
|
||||||
->where(DB::raw('coalesce(projects.client_id::varchar, \'\')'), '!=', DB::raw('coalesce(time_entries.client_id::varchar, \'\')'))
|
|
||||||
->get();
|
|
||||||
$this->logProblems($problems, 'Time entries have a client that does not match the client of the project', $hadAProblem);
|
|
||||||
|
|
||||||
// Client id can only be not null if the project id is not null
|
|
||||||
$problems = DB::table('time_entries')
|
|
||||||
->select(['time_entries.id as id'])
|
|
||||||
->whereNotNull('client_id')
|
|
||||||
->whereNull('project_id')
|
|
||||||
->get();
|
|
||||||
$this->logProblems($problems, 'Time entries have a client but no project', $hadAProblem);
|
|
||||||
|
|
||||||
// Every user needs to be a member of at least one organization
|
|
||||||
$problems = DB::table('users')
|
|
||||||
->select(['users.id as id'])
|
|
||||||
->leftJoin('members', 'users.id', '=', 'members.user_id')
|
|
||||||
->whereNull('members.id')
|
|
||||||
->get();
|
|
||||||
$this->logProblems($problems, 'Users are not member of any organization', $hadAProblem);
|
|
||||||
|
|
||||||
// Every organization needs at least an owner
|
|
||||||
$problems = DB::table('organizations')
|
|
||||||
->select(['organizations.id as id'])
|
|
||||||
->leftJoin('members', function (JoinClause $join): void {
|
|
||||||
$join->on('organizations.id', '=', 'members.organization_id')
|
|
||||||
->where('members.role', '=', 'owner');
|
|
||||||
})
|
|
||||||
->whereNull('members.id')
|
|
||||||
->get();
|
|
||||||
$this->logProblems($problems, 'Organizations without an owner', $hadAProblem);
|
|
||||||
|
|
||||||
// Every member can only have one running time entry
|
|
||||||
$problems = DB::table('time_entries')
|
|
||||||
->select(['user_id as id'])
|
|
||||||
->whereNull('end')
|
|
||||||
->groupBy('user_id')
|
|
||||||
->havingRaw('count(*) > 1')
|
|
||||||
->get(['user_id', DB::raw('count(*) as count')]);
|
|
||||||
$this->logProblems($problems, 'Users with more than one running time entry', $hadAProblem);
|
|
||||||
|
|
||||||
// Users have a current organization that they are not a member of
|
|
||||||
$problems = DB::table('users')
|
|
||||||
->select(['users.id as id'])
|
|
||||||
->whereNotNull('current_team_id')
|
|
||||||
->whereNotIn('current_team_id', function (Builder $query): void {
|
|
||||||
$query->select('organization_id')
|
|
||||||
->from('members')
|
|
||||||
->whereColumn('members.user_id', 'users.id');
|
|
||||||
})->get();
|
|
||||||
$this->logProblems($problems, 'Users have a current organization that they are not a member of', $hadAProblem);
|
|
||||||
|
|
||||||
return $hadAProblem ? self::FAILURE : self::SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Collection<int, \stdClass> $problems
|
|
||||||
*/
|
|
||||||
private function logProblems(Collection $problems, string $message, bool &$hadAProblem): void
|
|
||||||
{
|
|
||||||
$message = 'Consistency problem: '.$message;
|
|
||||||
if ($problems->isNotEmpty()) {
|
|
||||||
$ids = $problems->pluck('id');
|
|
||||||
$hadAProblem = true;
|
|
||||||
Log::error($message, [
|
|
||||||
'ids' => $ids,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$error = $message;
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
$error .= "\n - ".$id;
|
|
||||||
}
|
|
||||||
$this->error($error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,10 +25,6 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('self-host:telemetry')
|
$schedule->command('self-host:telemetry')
|
||||||
->when(fn (): bool => config('scheduling.tasks.self_hosting_telemetry'))
|
->when(fn (): bool => config('scheduling.tasks.self_hosting_telemetry'))
|
||||||
->twiceDaily();
|
->twiceDaily();
|
||||||
|
|
||||||
$schedule->command('self-host:database-consistency')
|
|
||||||
->when(fn (): bool => config('scheduling.tasks.self_hosting_database_consistency'))
|
|
||||||
->twiceDaily();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Events;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
|
|
||||||
class DatabaseSeederAfterSeed
|
|
||||||
{
|
|
||||||
use Dispatchable;
|
|
||||||
|
|
||||||
public function __construct() {}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Events;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
|
|
||||||
class DatabaseSeederBeforeDelete
|
|
||||||
{
|
|
||||||
use Dispatchable;
|
|
||||||
|
|
||||||
public function __construct() {}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,6 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Filters\TernaryFilter;
|
use Filament\Tables\Filters\TernaryFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
@@ -208,14 +207,6 @@ class UserResource extends Resource
|
|||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->bulkActions([
|
||||||
Tables\Actions\BulkAction::make('Resend verification email')
|
|
||||||
->icon('heroicon-o-paper-airplane')
|
|
||||||
->action(function (Collection $records): void {
|
|
||||||
foreach ($records as $user) {
|
|
||||||
/** @var User $user */
|
|
||||||
$user->sendEmailVerificationNotification();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ class TimeEntryController extends Controller
|
|||||||
'start' => $request->getStart()->timezone($timezone),
|
'start' => $request->getStart()->timezone($timezone),
|
||||||
'end' => $request->getEnd()->timezone($timezone),
|
'end' => $request->getEnd()->timezone($timezone),
|
||||||
'localization' => $localizationService,
|
'localization' => $localizationService,
|
||||||
'showBillableRate' => $showBillableRate,
|
|
||||||
]);
|
]);
|
||||||
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf-footer.blade.php'));
|
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf-footer.blade.php'));
|
||||||
if ($footerViewFile === false) {
|
if ($footerViewFile === false) {
|
||||||
@@ -429,7 +428,6 @@ class TimeEntryController extends Controller
|
|||||||
'end' => $request->getEnd()->timezone($timezone),
|
'end' => $request->getEnd()->timezone($timezone),
|
||||||
'debug' => $debug,
|
'debug' => $debug,
|
||||||
'localization' => $localizationService,
|
'localization' => $localizationService,
|
||||||
'showBillableRate' => $showBillableRate,
|
|
||||||
]);
|
]);
|
||||||
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf-footer.blade.php'));
|
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf-footer.blade.php'));
|
||||||
if ($footerViewFile === false) {
|
if ($footerViewFile === false) {
|
||||||
@@ -458,7 +456,7 @@ class TimeEntryController extends Controller
|
|||||||
->putFileAs($folderPath, new File($tempFolder->path($filenameTemp)), $filename);
|
->putFileAs($folderPath, new File($tempFolder->path($filenameTemp)), $filename);
|
||||||
} else {
|
} else {
|
||||||
Excel::store(
|
Excel::store(
|
||||||
new TimeEntriesReportExport($aggregatedData, $format, $currency, $group, $subGroup, $showBillableRate),
|
new TimeEntriesReportExport($aggregatedData, $format, $currency, $group, $subGroup),
|
||||||
$path,
|
$path,
|
||||||
config('filesystems.private'),
|
config('filesystems.private'),
|
||||||
$format->getExportPackageType(),
|
$format->getExportPackageType(),
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\ApiToken;
|
namespace App\Http\Requests\V1\ApiToken;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ApiTokenStoreRequest extends BaseFormRequest
|
class ApiTokenStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Http\Requests\V1;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class BaseFormRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return list<string>
|
|
||||||
*/
|
|
||||||
protected function moneyRules(bool $bigInt = false): array
|
|
||||||
{
|
|
||||||
$rules = [
|
|
||||||
'integer',
|
|
||||||
'min:0',
|
|
||||||
];
|
|
||||||
if ($bigInt) {
|
|
||||||
$rules[] = 'max:9223372036854775807';
|
|
||||||
} else {
|
|
||||||
$rules[] = 'max:2147483647';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Client;
|
namespace App\Http\Requests\V1\Client;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ClientIndexRequest extends BaseFormRequest
|
class ClientIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Client;
|
namespace App\Http\Requests\V1\Client;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ClientStoreRequest extends BaseFormRequest
|
class ClientStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Client;
|
namespace App\Http\Requests\V1\Client;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
* @property Client|null $client Client from model binding
|
* @property Client|null $client Client from model binding
|
||||||
*/
|
*/
|
||||||
class ClientUpdateRequest extends BaseFormRequest
|
class ClientUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Import;
|
namespace App\Http\Requests\V1\Import;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ImportRequest extends BaseFormRequest
|
class ImportRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Invitation;
|
namespace App\Http\Requests\V1\Invitation;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class InvitationIndexRequest extends BaseFormRequest
|
class InvitationIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ declare(strict_types=1);
|
|||||||
namespace App\Http\Requests\V1\Invitation;
|
namespace App\Http\Requests\V1\Invitation;
|
||||||
|
|
||||||
use App\Enums\Role;
|
use App\Enums\Role;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\OrganizationInvitation;
|
use App\Models\OrganizationInvitation;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class InvitationStoreRequest extends BaseFormRequest
|
class InvitationStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Member;
|
namespace App\Http\Requests\V1\Member;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class MemberIndexRequest extends BaseFormRequest
|
class MemberIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Member;
|
namespace App\Http\Requests\V1\Member;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class MemberMergeIntoRequest extends BaseFormRequest
|
class MemberMergeIntoRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ declare(strict_types=1);
|
|||||||
namespace App\Http\Requests\V1\Member;
|
namespace App\Http\Requests\V1\Member;
|
||||||
|
|
||||||
use App\Enums\Role;
|
use App\Enums\Role;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class MemberUpdateRequest extends BaseFormRequest
|
class MemberUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -27,12 +27,12 @@ class MemberUpdateRequest extends BaseFormRequest
|
|||||||
'string',
|
'string',
|
||||||
Rule::enum(Role::class),
|
Rule::enum(Role::class),
|
||||||
],
|
],
|
||||||
'billable_rate' => array_merge(
|
'billable_rate' => [
|
||||||
[
|
'nullable',
|
||||||
'nullable',
|
'integer',
|
||||||
],
|
'min:0',
|
||||||
$this->moneyRules()
|
'max:2147483647',
|
||||||
),
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ use App\Enums\DateFormat;
|
|||||||
use App\Enums\IntervalFormat;
|
use App\Enums\IntervalFormat;
|
||||||
use App\Enums\NumberFormat;
|
use App\Enums\NumberFormat;
|
||||||
use App\Enums\TimeFormat;
|
use App\Enums\TimeFormat;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class OrganizationUpdateRequest extends BaseFormRequest
|
class OrganizationUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -30,12 +30,12 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
|||||||
'string',
|
'string',
|
||||||
'max:255',
|
'max:255',
|
||||||
],
|
],
|
||||||
'billable_rate' => array_merge(
|
'billable_rate' => [
|
||||||
[
|
'nullable',
|
||||||
'nullable',
|
'integer',
|
||||||
],
|
'min:0',
|
||||||
$this->moneyRules()
|
'max:2147483647',
|
||||||
),
|
],
|
||||||
'employees_can_see_billable_rates' => [
|
'employees_can_see_billable_rates' => [
|
||||||
'boolean',
|
'boolean',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Project;
|
namespace App\Http\Requests\V1\Project;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ProjectIndexRequest extends BaseFormRequest
|
class ProjectIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Project;
|
namespace App\Http\Requests\V1\Project;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Rules\ColorRule;
|
use App\Rules\ColorRule;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
@@ -18,7 +18,7 @@ use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
|||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ProjectStoreRequest extends BaseFormRequest
|
class ProjectStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -55,12 +55,12 @@ class ProjectStoreRequest extends BaseFormRequest
|
|||||||
'required',
|
'required',
|
||||||
'boolean',
|
'boolean',
|
||||||
],
|
],
|
||||||
'billable_rate' => array_merge(
|
'billable_rate' => [
|
||||||
[
|
'nullable',
|
||||||
'nullable',
|
'integer',
|
||||||
],
|
'min:0',
|
||||||
$this->moneyRules()
|
'max:2147483647',
|
||||||
),
|
],
|
||||||
// ID of the client
|
// ID of the client
|
||||||
'client_id' => [
|
'client_id' => [
|
||||||
'present',
|
'present',
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Project;
|
namespace App\Http\Requests\V1\Project;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Rules\ColorRule;
|
use App\Rules\ColorRule;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
@@ -19,7 +19,7 @@ use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
|||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
* @property Project|null $project Project from model binding
|
* @property Project|null $project Project from model binding
|
||||||
*/
|
*/
|
||||||
class ProjectUpdateRequest extends BaseFormRequest
|
class ProjectUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -68,11 +68,12 @@ class ProjectUpdateRequest extends BaseFormRequest
|
|||||||
return $builder->whereBelongsTo($this->organization, 'organization');
|
return $builder->whereBelongsTo($this->organization, 'organization');
|
||||||
})->uuid(),
|
})->uuid(),
|
||||||
],
|
],
|
||||||
'billable_rate' => array_merge([
|
'billable_rate' => [
|
||||||
'nullable',
|
'nullable',
|
||||||
|
'integer',
|
||||||
|
'min:0',
|
||||||
|
'max:2147483647',
|
||||||
],
|
],
|
||||||
$this->moneyRules()
|
|
||||||
),
|
|
||||||
// Estimated time in seconds
|
// Estimated time in seconds
|
||||||
'estimated_time' => [
|
'estimated_time' => [
|
||||||
'nullable',
|
'nullable',
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\ProjectMember;
|
namespace App\Http\Requests\V1\ProjectMember;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ProjectMemberStoreRequest extends BaseFormRequest
|
class ProjectMemberStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -31,12 +31,12 @@ class ProjectMemberStoreRequest extends BaseFormRequest
|
|||||||
return $builder->whereBelongsTo($this->organization, 'organization');
|
return $builder->whereBelongsTo($this->organization, 'organization');
|
||||||
})->uuid(),
|
})->uuid(),
|
||||||
],
|
],
|
||||||
'billable_rate' => array_merge(
|
'billable_rate' => [
|
||||||
[
|
'nullable',
|
||||||
'nullable',
|
'integer',
|
||||||
],
|
'min:0',
|
||||||
$this->moneyRules()
|
'max:2147483647',
|
||||||
),
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\ProjectMember;
|
namespace App\Http\Requests\V1\ProjectMember;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ProjectMemberUpdateRequest extends BaseFormRequest
|
class ProjectMemberUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
@@ -21,12 +21,12 @@ class ProjectMemberUpdateRequest extends BaseFormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'billable_rate' => array_merge(
|
'billable_rate' => [
|
||||||
[
|
'nullable',
|
||||||
'nullable',
|
'integer',
|
||||||
],
|
'min:0',
|
||||||
$this->moneyRules()
|
'max:2147483647',
|
||||||
),
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ namespace App\Http\Requests\V1\Report;
|
|||||||
use App\Enums\TimeEntryAggregationType;
|
use App\Enums\TimeEntryAggregationType;
|
||||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||||
use App\Enums\Weekday;
|
use App\Enums\Weekday;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\Rule as LegacyValidationRule;
|
use Illuminate\Contracts\Validation\Rule as LegacyValidationRule;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ReportStoreRequest extends BaseFormRequest
|
class ReportStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Report;
|
namespace App\Http\Requests\V1\Report;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class ReportUpdateRequest extends BaseFormRequest
|
class ReportUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Tag;
|
namespace App\Http\Requests\V1\Tag;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TagStoreRequest extends BaseFormRequest
|
class TagStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Tag;
|
namespace App\Http\Requests\V1\Tag;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
* @property Tag|null $tag Tag from model binding
|
* @property Tag|null $tag Tag from model binding
|
||||||
*/
|
*/
|
||||||
class TagUpdateRequest extends BaseFormRequest
|
class TagUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Task;
|
namespace App\Http\Requests\V1\Task;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Service\PermissionStore;
|
use App\Service\PermissionStore;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TaskIndexRequest extends BaseFormRequest
|
class TaskIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Task;
|
namespace App\Http\Requests\V1\Task;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TaskStoreRequest extends BaseFormRequest
|
class TaskStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\Task;
|
namespace App\Http\Requests\V1\Task;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
* @property Task|null $task Task from model binding
|
* @property Task|null $task Task from model binding
|
||||||
*/
|
*/
|
||||||
class TaskUpdateRequest extends BaseFormRequest
|
class TaskUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace App\Http\Requests\V1\TimeEntry;
|
|||||||
use App\Enums\ExportFormat;
|
use App\Enums\ExportFormat;
|
||||||
use App\Enums\TimeEntryAggregationType;
|
use App\Enums\TimeEntryAggregationType;
|
||||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
@@ -17,6 +16,7 @@ use App\Models\Task;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
@@ -24,7 +24,7 @@ use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
|||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class TimeEntryAggregateExportRequest extends BaseFormRequest
|
class TimeEntryAggregateExportRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Enums\TimeEntryAggregationType;
|
use App\Enums\TimeEntryAggregationType;
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
@@ -15,6 +14,7 @@ use App\Models\Task;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
@@ -22,7 +22,7 @@ use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
|||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class TimeEntryAggregateRequest extends BaseFormRequest
|
class TimeEntryAggregateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TimeEntryDestroyMultipleRequest extends BaseFormRequest
|
class TimeEntryDestroyMultipleRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
@@ -13,12 +12,13 @@ use App\Models\Tag;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization
|
* @property Organization $organization
|
||||||
*/
|
*/
|
||||||
class TimeEntryIndexRequest extends BaseFormRequest
|
class TimeEntryIndexRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
@@ -12,12 +11,13 @@ use App\Models\Tag;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TimeEntryStoreRequest extends BaseFormRequest
|
class TimeEntryStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
@@ -12,12 +11,13 @@ use App\Models\Tag;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TimeEntryUpdateMultipleRequest extends BaseFormRequest
|
class TimeEntryUpdateMultipleRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Requests\V1\TimeEntry;
|
namespace App\Http\Requests\V1\TimeEntry;
|
||||||
|
|
||||||
use App\Http\Requests\V1\BaseFormRequest;
|
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
@@ -12,12 +11,13 @@ use App\Models\Tag;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Organization $organization Organization from model binding
|
* @property Organization $organization Organization from model binding
|
||||||
*/
|
*/
|
||||||
class TimeEntryUpdateRequest extends BaseFormRequest
|
class TimeEntryUpdateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
|
|||||||
@@ -100,18 +100,12 @@ class DeletionService
|
|||||||
|
|
||||||
// Make sure all users have at least one organization and delete placeholders
|
// Make sure all users have at least one organization and delete placeholders
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
/** @var User $user */
|
|
||||||
if ($ignoreUser !== null && $user->is($ignoreUser)) {
|
if ($ignoreUser !== null && $user->is($ignoreUser)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($user->is_placeholder) {
|
if ($user->is_placeholder) {
|
||||||
$user->delete();
|
$user->delete();
|
||||||
} else {
|
} else {
|
||||||
if ($user->current_team_id === $organization->getKey()) {
|
|
||||||
$user->currentOrganization()->disassociate();
|
|
||||||
$user->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->userService->makeSureUserHasAtLeastOneOrganization($user);
|
$this->userService->makeSureUserHasAtLeastOneOrganization($user);
|
||||||
$this->userService->makeSureUserHasCurrentOrganization($user);
|
$this->userService->makeSureUserHasCurrentOrganization($user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class LocalizationService
|
|||||||
if ($this->intervalFormat === IntervalFormat::Decimal) {
|
if ($this->intervalFormat === IntervalFormat::Decimal) {
|
||||||
$interval->cascade();
|
$interval->cascade();
|
||||||
|
|
||||||
return $this->formatNumber($interval->totalHours).' h';
|
return $this->formatNumber($interval->totalHours);
|
||||||
} elseif ($this->intervalFormat === IntervalFormat::HoursMinutes) {
|
} elseif ($this->intervalFormat === IntervalFormat::HoursMinutes) {
|
||||||
$interval->cascade();
|
$interval->cascade();
|
||||||
|
|
||||||
|
|||||||
@@ -164,11 +164,6 @@ class MemberService
|
|||||||
public function makeMemberToPlaceholder(Member $member, bool $makeSureUserHasAtLeastOneOrganization = true): void
|
public function makeMemberToPlaceholder(Member $member, bool $makeSureUserHasAtLeastOneOrganization = true): void
|
||||||
{
|
{
|
||||||
$user = $member->user;
|
$user = $member->user;
|
||||||
if ($user->current_team_id === $member->organization_id) {
|
|
||||||
$user->currentTeam()->disassociate();
|
|
||||||
$user->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
$placeholderUser = $user->replicate();
|
$placeholderUser = $user->replicate();
|
||||||
$placeholderUser->is_placeholder = true;
|
$placeholderUser->is_placeholder = true;
|
||||||
$placeholderUser->save();
|
$placeholderUser->save();
|
||||||
@@ -180,7 +175,6 @@ class MemberService
|
|||||||
$this->userService->assignOrganizationEntitiesToDifferentUser($member->organization, $user, $placeholderUser);
|
$this->userService->assignOrganizationEntitiesToDifferentUser($member->organization, $user, $placeholderUser);
|
||||||
if ($makeSureUserHasAtLeastOneOrganization) {
|
if ($makeSureUserHasAtLeastOneOrganization) {
|
||||||
$this->userService->makeSureUserHasAtLeastOneOrganization($user);
|
$this->userService->makeSureUserHasAtLeastOneOrganization($user);
|
||||||
$this->userService->makeSureUserHasCurrentOrganization($user);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ class TimeEntriesReportExport implements FromView, ShouldAutoSize, WithCustomCsv
|
|||||||
|
|
||||||
private TimeEntryAggregationType $subGroup;
|
private TimeEntryAggregationType $subGroup;
|
||||||
|
|
||||||
private bool $showBillableRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array{
|
* @param array{
|
||||||
* grouped_type: string|null,
|
* grouped_type: string|null,
|
||||||
@@ -68,14 +66,13 @@ class TimeEntriesReportExport implements FromView, ShouldAutoSize, WithCustomCsv
|
|||||||
* cost: int|null
|
* cost: int|null
|
||||||
* } $data
|
* } $data
|
||||||
*/
|
*/
|
||||||
public function __construct(array $data, ExportFormat $exportFormat, string $currency, TimeEntryAggregationType $group, TimeEntryAggregationType $subGroup, bool $showBillableRate)
|
public function __construct(array $data, ExportFormat $exportFormat, string $currency, TimeEntryAggregationType $group, TimeEntryAggregationType $subGroup)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->exportFormat = $exportFormat;
|
$this->exportFormat = $exportFormat;
|
||||||
$this->currency = $currency;
|
$this->currency = $currency;
|
||||||
$this->group = $group;
|
$this->group = $group;
|
||||||
$this->subGroup = $subGroup;
|
$this->subGroup = $subGroup;
|
||||||
$this->showBillableRate = $showBillableRate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view(): View
|
public function view(): View
|
||||||
@@ -86,7 +83,6 @@ class TimeEntriesReportExport implements FromView, ShouldAutoSize, WithCustomCsv
|
|||||||
'group' => $this->group,
|
'group' => $this->group,
|
||||||
'subGroup' => $this->subGroup,
|
'subGroup' => $this->subGroup,
|
||||||
'exportFormat' => $this->exportFormat,
|
'exportFormat' => $this->exportFormat,
|
||||||
'showBillableRate' => $this->showBillableRate,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,15 +114,13 @@ class UserService
|
|||||||
|
|
||||||
public function makeSureUserHasCurrentOrganization(User $user): void
|
public function makeSureUserHasCurrentOrganization(User $user): void
|
||||||
{
|
{
|
||||||
if ($user->current_team_id !== null) {
|
if ($user->currentOrganization !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$organization = $user->organizations()->first();
|
$organization = $user->organizations()->first();
|
||||||
if ($organization !== null) {
|
$user->currentOrganization()->associate($organization);
|
||||||
$user->currentOrganization()->associate($organization);
|
$user->save();
|
||||||
$user->save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ return [
|
|||||||
'time_entry_send_still_running_mails' => (bool) env('SCHEDULING_TASK_TIME_ENTRY_SEND_STILL_RUNNING_MAILS', true),
|
'time_entry_send_still_running_mails' => (bool) env('SCHEDULING_TASK_TIME_ENTRY_SEND_STILL_RUNNING_MAILS', true),
|
||||||
'self_hosting_check_for_update' => (bool) env('SCHEDULING_TASK_SELF_HOSTING_CHECK_FOR_UPDATE', true),
|
'self_hosting_check_for_update' => (bool) env('SCHEDULING_TASK_SELF_HOSTING_CHECK_FOR_UPDATE', true),
|
||||||
'self_hosting_telemetry' => (bool) env('SCHEDULING_TASK_SELF_HOSTING_TELEMETRY', true),
|
'self_hosting_telemetry' => (bool) env('SCHEDULING_TASK_SELF_HOSTING_TELEMETRY', true),
|
||||||
'self_hosting_database_consistency' => (bool) env('SCHEDULING_TASK_SELF_HOSTING_DATABASE_CONSISTENCY', false),
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
<?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
|
|
||||||
{
|
|
||||||
DB::statement('
|
|
||||||
update users
|
|
||||||
set current_team_id = null
|
|
||||||
where id in (
|
|
||||||
select users.id from users
|
|
||||||
left join organizations on users.current_team_id = organizations.id
|
|
||||||
where users.current_team_id is not null and organizations.id is null
|
|
||||||
)
|
|
||||||
');
|
|
||||||
Schema::table('users', function (Blueprint $table): void {
|
|
||||||
$table->foreign('current_team_id', 'organizations_current_organization_id_foreign')
|
|
||||||
->references('id')
|
|
||||||
->on('organizations')
|
|
||||||
->onDelete('restrict')
|
|
||||||
->onUpdate('cascade');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('users', function (Blueprint $table): void {
|
|
||||||
$table->dropForeign('organizations_current_organization_id_foreign');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -5,8 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Enums\Role;
|
use App\Enums\Role;
|
||||||
use App\Events\DatabaseSeederAfterSeed;
|
|
||||||
use App\Events\DatabaseSeederBeforeDelete;
|
|
||||||
use App\Models\Audit;
|
use App\Models\Audit;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
@@ -186,13 +184,10 @@ class DatabaseSeeder extends Seeder
|
|||||||
'email' => 'admin@example.com',
|
'email' => 'admin@example.com',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DatabaseSeederAfterSeed::dispatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function deleteAll(): void
|
private function deleteAll(): void
|
||||||
{
|
{
|
||||||
DatabaseSeederBeforeDelete::dispatch();
|
|
||||||
|
|
||||||
// Laravel Passport tables
|
// Laravel Passport tables
|
||||||
DB::table((new RefreshToken)->getTable())->delete();
|
DB::table((new RefreshToken)->getTable())->delete();
|
||||||
DB::table((new Token)->getTable())->delete();
|
DB::table((new Token)->getTable())->delete();
|
||||||
@@ -218,9 +213,6 @@ class DatabaseSeeder extends Seeder
|
|||||||
DB::table((new Client)->getTable())->delete();
|
DB::table((new Client)->getTable())->delete();
|
||||||
DB::table((new Member)->getTable())->delete();
|
DB::table((new Member)->getTable())->delete();
|
||||||
DB::table((new OrganizationInvitation)->getTable())->delete();
|
DB::table((new OrganizationInvitation)->getTable())->delete();
|
||||||
DB::table((new User)->getTable())->update([
|
|
||||||
'current_team_id' => null,
|
|
||||||
]);
|
|
||||||
DB::table((new Organization)->getTable())->delete();
|
DB::table((new Organization)->getTable())->delete();
|
||||||
DB::table((new User)->getTable())->delete();
|
DB::table((new User)->getTable())->delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ test('test that organization billable rate can be updated with all existing time
|
|||||||
await page
|
await page
|
||||||
.locator('form')
|
.locator('form')
|
||||||
.filter({ hasText: 'Organization Billable' })
|
.filter({ hasText: 'Organization Billable' })
|
||||||
.getByRole('button', { name: 'Save' })
|
.getByRole('button')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@@ -179,9 +179,7 @@ test('test that format settings are reflected in the dashboard', async ({
|
|||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
// check that 0h 00min is displayed
|
// check that 0h 00min is displayed
|
||||||
await expect(
|
await expect(page.getByText('0h 00min', { exact: true }).nth(0)).toBeVisible();
|
||||||
page.getByText('0h 00min', { exact: true }).nth(0)
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// First set the format settings
|
// First set the format settings
|
||||||
await goToOrganizationSettings(page);
|
await goToOrganizationSettings(page);
|
||||||
@@ -232,17 +230,11 @@ test('test that format settings are reflected in the dashboard', async ({
|
|||||||
// check that 00:00 is displayed
|
// check that 00:00 is displayed
|
||||||
await expect(page.getByText('0:00', { exact: true }).nth(0)).toBeVisible();
|
await expect(page.getByText('0:00', { exact: true }).nth(0)).toBeVisible();
|
||||||
// check that 0h 00min is not displayed
|
// check that 0h 00min is not displayed
|
||||||
await expect(
|
await expect(page.getByText('0h 00min', { exact: true }).nth(0)).not.toBeVisible();
|
||||||
page.getByText('0h 00min', { exact: true }).nth(0)
|
|
||||||
).not.toBeVisible();
|
|
||||||
|
|
||||||
// check that the current date is displayed in the dd/mm/yyyy format on the time page
|
// check that the current date is displayed in the dd/mm/yyyy format on the time page
|
||||||
await page.goto(PLAYWRIGHT_BASE_URL + '/time');
|
await page.goto(PLAYWRIGHT_BASE_URL + '/time');
|
||||||
await expect(
|
await expect(page.getByText(new Date().toLocaleDateString('en-GB'), { exact: true }).nth(0)).toBeVisible();
|
||||||
page
|
|
||||||
.getByText(new Date().toLocaleDateString('en-GB'), { exact: true })
|
|
||||||
.nth(0)
|
|
||||||
).toBeVisible();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Test 12-hour clock format
|
// TODO: Test 12-hour clock format
|
||||||
@@ -9,8 +9,7 @@ return [
|
|||||||
'2. In the same preferences page change the language of Clockfiy to English.<br>'.
|
'2. In the same preferences page change the language of Clockfiy to English.<br>'.
|
||||||
'3. Go to REPORTS -> TIME -> Detailed in the navigation on the left. <br>'.
|
'3. Go to REPORTS -> TIME -> Detailed in the navigation on the left. <br>'.
|
||||||
'4. Now select the date range that you want to export in the right top. '.
|
'4. Now select the date range that you want to export in the right top. '.
|
||||||
'In the free Clockify plan it\'s currently not possible to select more than one year. '.
|
'It is currently not possible to select more than one year. You can export each year separately and import them one after another .'.
|
||||||
'You can export each year separately and import them one after another.'.
|
|
||||||
'<br> 4. Now click Export -> Save as CSV. The Export dropdown is in the header of the export table left of the printer symbol. '.
|
'<br> 4. Now click Export -> Save as CSV. The Export dropdown is in the header of the export table left of the printer symbol. '.
|
||||||
'<br><br>Before you import make sure that the Timezone settings in Clockify are the same as in solidtime.',
|
'<br><br>Before you import make sure that the Timezone settings in Clockify are the same as in solidtime.',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -43,9 +43,6 @@
|
|||||||
|
|
||||||
--theme-color-input-select-active: rgb(var(--color-accent-300));
|
--theme-color-input-select-active: rgb(var(--color-accent-300));
|
||||||
--theme-color-input-select-active-hover: rgb(var(--color-accent-200));
|
--theme-color-input-select-active-hover: rgb(var(--color-accent-200));
|
||||||
|
|
||||||
--color-accent-default: rgba(var(--color-accent-300), 0.2);
|
|
||||||
--color-accent-foreground: rgb(var(--color-accent-100));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:root.light {
|
:root.light {
|
||||||
@@ -89,9 +86,6 @@
|
|||||||
|
|
||||||
--theme-color-input-select-active: rgb(var(--color-accent-400));
|
--theme-color-input-select-active: rgb(var(--color-accent-400));
|
||||||
--theme-color-input-select-active-hover: rgb(var(--color-accent-500));
|
--theme-color-input-select-active-hover: rgb(var(--color-accent-500));
|
||||||
|
|
||||||
--color-accent-default: rgb(var(--color-accent-100));
|
|
||||||
--color-accent-foreground: rgb(var(--color-accent-800));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
|||||||
@@ -26,12 +26,10 @@ const createClient = ref(false);
|
|||||||
<ClientTableHeading></ClientTableHeading>
|
<ClientTableHeading></ClientTableHeading>
|
||||||
<div
|
<div
|
||||||
v-if="clients.length === 0"
|
v-if="clients.length === 0"
|
||||||
class="col-span-3 py-24 text-center">
|
class="col-span-2 py-24 text-center">
|
||||||
<UserCircleIcon
|
<UserCircleIcon
|
||||||
class="w-8 text-icon-default inline pb-2"></UserCircleIcon>
|
class="w-8 text-icon-default inline pb-2"></UserCircleIcon>
|
||||||
<h3 class="text-text-primary font-semibold">
|
<h3 class="text-text-primary font-semibold">No clients found</h3>
|
||||||
No clients found
|
|
||||||
</h3>
|
|
||||||
<p v-if="canCreateClients()" class="pb-5">
|
<p v-if="canCreateClients()" class="pb-5">
|
||||||
Create your first client now!
|
Create your first client now!
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ const roleDescription = computed(() => {
|
|||||||
class="flex-1">
|
class="flex-1">
|
||||||
<InputLabel
|
<InputLabel
|
||||||
for="memberBillableRate"
|
for="memberBillableRate"
|
||||||
|
class="mb-2"
|
||||||
value="Billable Rate" />
|
value="Billable Rate" />
|
||||||
<BillableRateInput
|
<BillableRateInput
|
||||||
v-model="
|
v-model="
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const project = ref<CreateProjectBody>({
|
|||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (props.originalProject.billable_rate !== project.value.billable_rate) {
|
if (props.originalProject.billable_rate !== project.value.billable_rate) {
|
||||||
// make sure that the alert modal is not immediately submitted when user presses enter
|
//
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showBillableRateModal.value = true;
|
showBillableRateModal.value = true;
|
||||||
}, 0);
|
}, 0);
|
||||||
@@ -133,7 +133,7 @@ async function submitBillableRate() {
|
|||||||
</ClientDropdown>
|
</ClientDropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="lg:grid grid-cols-2 gap-12">
|
||||||
<div>
|
<div>
|
||||||
<ProjectEditBillableSection
|
<ProjectEditBillableSection
|
||||||
v-model:is-billable="project.is_billable"
|
v-model:is-billable="project.is_billable"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { h, ref } from 'vue';
|
|||||||
import type { CreateReportBodyProperties } from '@/packages/api/src';
|
import type { CreateReportBodyProperties } from '@/packages/api/src';
|
||||||
import { isAllowedToPerformPremiumAction } from '@/utils/billing';
|
import { isAllowedToPerformPremiumAction } from '@/utils/billing';
|
||||||
import UpgradeModal from '@/Components/Common/UpgradeModal.vue';
|
import UpgradeModal from '@/Components/Common/UpgradeModal.vue';
|
||||||
import { canCreateReports } from '@/utils/permissions';
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
reportProperties: CreateReportBodyProperties;
|
reportProperties: CreateReportBodyProperties;
|
||||||
}>();
|
}>();
|
||||||
@@ -34,10 +33,7 @@ function onSaveReportClick() {
|
|||||||
<strong>Sharable Reports</strong> is only available in solidtime
|
<strong>Sharable Reports</strong> is only available in solidtime
|
||||||
Professional.
|
Professional.
|
||||||
</UpgradeModal>
|
</UpgradeModal>
|
||||||
<SecondaryButton
|
<SecondaryButton :icon="SaveIcon" @click="onSaveReportClick"
|
||||||
v-if="canCreateReports()"
|
|
||||||
:icon="SaveIcon"
|
|
||||||
@click="onSaveReportClick"
|
|
||||||
>Save Report</SecondaryButton
|
>Save Report</SecondaryButton
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ const xAxisLabels = computed(() => {
|
|||||||
if (props.groupedType === 'week') {
|
if (props.groupedType === 'week') {
|
||||||
return props?.groupedData?.map((el) => formatWeek(el.key));
|
return props?.groupedData?.map((el) => formatWeek(el.key));
|
||||||
}
|
}
|
||||||
return props?.groupedData?.map((el) =>
|
return props?.groupedData?.map((el) => formatDate(el.key ?? '', organization?.value?.date_format));
|
||||||
formatDate(el.key ?? '', organization?.value?.date_format)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
||||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
||||||
|
|||||||
@@ -28,10 +28,8 @@ const activeClass = computed(() => {
|
|||||||
activeClass
|
activeClass
|
||||||
)
|
)
|
||||||
">
|
">
|
||||||
<component
|
<component :is="icon" class="-ml-0.5 h-4 w-4 text-text-quaternary"></component>
|
||||||
:is="icon"
|
<span> {{ title }} </span>
|
||||||
class="-ml-0.5 h-4 w-4 text-text-quaternary"></component>
|
|
||||||
<span class="text-nowrap"> {{ title }} </span>
|
|
||||||
<div
|
<div
|
||||||
v-if="count"
|
v-if="count"
|
||||||
class="bg-accent-300/20 w-5 h-5 font-medium rounded flex items-center transition justify-center">
|
class="bg-accent-300/20 w-5 h-5 font-medium rounded flex items-center transition justify-center">
|
||||||
|
|||||||
@@ -107,10 +107,6 @@ function getFilterAttributes(): AggregatedTimeEntriesQueryParams {
|
|||||||
: undefined,
|
: undefined,
|
||||||
tag_ids: selectedTags.value.length > 0 ? selectedTags.value : undefined,
|
tag_ids: selectedTags.value.length > 0 ? selectedTags.value : undefined,
|
||||||
billable: billable.value !== null ? billable.value : undefined,
|
billable: billable.value !== null ? billable.value : undefined,
|
||||||
member_id:
|
|
||||||
getCurrentRole() === 'employee'
|
|
||||||
? getCurrentMembershipId()
|
|
||||||
: undefined,
|
|
||||||
};
|
};
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const forwardedProps = useForwardProps(delegatedProps)
|
|||||||
:class="cn(
|
:class="cn(
|
||||||
buttonVariants({ variant: 'ghost' }),
|
buttonVariants({ variant: 'ghost' }),
|
||||||
'h-8 w-8 p-0 font-normal',
|
'h-8 w-8 p-0 font-normal',
|
||||||
'[&[data-today]:not([data-selected])]:border-accent [&[data-today]:not([data-selected])]:border [&[data-today]:not([data-selected])]:text-accent-foreground',
|
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground',
|
||||||
// Selected
|
// Selected
|
||||||
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:opacity-100 data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground',
|
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:opacity-100 data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground',
|
||||||
// Disabled
|
// Disabled
|
||||||
|
|||||||
@@ -34,18 +34,11 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|||||||
v-bind="forwarded"
|
v-bind="forwarded"
|
||||||
:class="
|
:class="
|
||||||
cn(
|
cn(
|
||||||
'fixed top-0 left-0 z-50 w-screen h-screen flex items-start pt-6 md:pt-20 xl:pt-32 justify-center overflow-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
'fixed left-1/2 top-1/3 bg-default-background z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
||||||
|
|
||||||
)"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
:class="cn(
|
|
||||||
'bg-default-background grid w-full max-w-lg border shadow-lg duration-200 sm:rounded-lg',
|
|
||||||
props.class,
|
props.class,
|
||||||
)"
|
)"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</DialogPortal>
|
</DialogPortal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const forwardedProps = useForwardProps(delegatedProps)
|
|||||||
:class="cn(
|
:class="cn(
|
||||||
buttonVariants({ variant: 'ghost' }),
|
buttonVariants({ variant: 'ghost' }),
|
||||||
'h-8 w-8 p-0 font-normal data-[selected]:opacity-100',
|
'h-8 w-8 p-0 font-normal data-[selected]:opacity-100',
|
||||||
'[&[data-today]:not([data-selected])]:border-accent [&[data-today]:not([data-selected])]:border [&[data-today]:not([data-selected])]:text-accent-foreground',
|
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground',
|
||||||
// Selection Start
|
// Selection Start
|
||||||
'data-[selection-start]:bg-primary data-[selection-start]:text-primary-foreground data-[selection-start]:hover:bg-primary data-[selection-start]:hover:text-primary-foreground data-[selection-start]:focus:bg-primary data-[selection-start]:focus:text-primary-foreground',
|
'data-[selection-start]:bg-primary data-[selection-start]:text-primary-foreground data-[selection-start]:hover:bg-primary data-[selection-start]:hover:text-primary-foreground data-[selection-start]:focus:bg-primary data-[selection-start]:focus:text-primary-foreground',
|
||||||
// Selection End
|
// Selection End
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import FormSection from '@/Components/FormSection.vue';
|
import FormSection from '@/Components/FormSection.vue';
|
||||||
import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue';
|
import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue';
|
||||||
import {computed, ref, inject, type ComputedRef} from 'vue';
|
import {computed, ref} from 'vue';
|
||||||
import InputLabel from '@/packages/ui/src/Input/InputLabel.vue';
|
import InputLabel from '@/packages/ui/src/Input/InputLabel.vue';
|
||||||
import {
|
import {
|
||||||
api,
|
api,
|
||||||
@@ -23,7 +23,6 @@ import {useNotificationsStore} from "@/utils/notification";
|
|||||||
import {useClipboard} from "@vueuse/core";
|
import {useClipboard} from "@vueuse/core";
|
||||||
import { formatDateTimeLocalized} from "../../../packages/ui/src/utils/time";
|
import { formatDateTimeLocalized} from "../../../packages/ui/src/utils/time";
|
||||||
import {ClockIcon} from "@heroicons/vue/20/solid";
|
import {ClockIcon} from "@heroicons/vue/20/solid";
|
||||||
import type { Organization } from '@/packages/api/src';
|
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
@@ -35,8 +34,6 @@ const newToken = ref('');
|
|||||||
|
|
||||||
const { copy, copied, isSupported } = useClipboard();
|
const { copy, copied, isSupported } = useClipboard();
|
||||||
|
|
||||||
const organization = inject<ComputedRef<Organization>>('organization');
|
|
||||||
|
|
||||||
async function createApiToken(){
|
async function createApiToken(){
|
||||||
await handleApiRequestNotifications(
|
await handleApiRequestNotifications(
|
||||||
() =>
|
() =>
|
||||||
@@ -216,10 +213,10 @@ const revokeApiTokenMutation = useMutation({
|
|||||||
<div>{{ token.name }}</div>
|
<div>{{ token.name }}</div>
|
||||||
<div class="text-sm text-text-tertiary space-x-3">
|
<div class="text-sm text-text-tertiary space-x-3">
|
||||||
<span v-if="token.created_at">
|
<span v-if="token.created_at">
|
||||||
Created at {{ formatDateTimeLocalized(token.created_at, organization?.date_format, organization?.time_format) }}
|
Created at {{ formatDateTimeLocalized(token.created_at) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="token.expires_at">
|
<span v-if="token.expires_at">
|
||||||
Expires at {{ formatDateTimeLocalized(token.expires_at, organization?.date_format, organization?.time_format) }}
|
Expires at {{ formatDateTimeLocalized(token.expires_at) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="token.revoked">
|
<span v-if="token.revoked">
|
||||||
Revoked
|
Revoked
|
||||||
|
|||||||
@@ -57,12 +57,7 @@ const reportNumberFormat = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const reportCurrencyFormat = computed(() => {
|
const reportCurrencyFormat = computed(() => {
|
||||||
return (sharedReportResponseData.value?.currency_format ??
|
return (sharedReportResponseData.value?.currency_format ?? 'symbol-before') as CurrencyFormat;
|
||||||
'symbol-before') as CurrencyFormat;
|
|
||||||
});
|
|
||||||
|
|
||||||
const reportDateFormat = computed(() => {
|
|
||||||
return sharedReportResponseData.value?.date_format;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const reportCurrencySymbol = computed(() => {
|
const reportCurrencySymbol = computed(() => {
|
||||||
@@ -76,7 +71,6 @@ provide(
|
|||||||
'interval_format': reportIntervalFormat.value,
|
'interval_format': reportIntervalFormat.value,
|
||||||
'currency_format': reportCurrencyFormat.value,
|
'currency_format': reportCurrencyFormat.value,
|
||||||
'currency_symbol': reportCurrencySymbol.value,
|
'currency_symbol': reportCurrencySymbol.value,
|
||||||
'date_format': reportDateFormat.value,
|
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -160,7 +154,10 @@ const tableData = computed(() => {
|
|||||||
cost: el.cost,
|
cost: el.cost,
|
||||||
description:
|
description:
|
||||||
el.description ??
|
el.description ??
|
||||||
emptyPlaceholder[entry.grouped_type ?? 'project'],
|
emptyPlaceholder[
|
||||||
|
aggregatedTableTimeEntries.value
|
||||||
|
?.grouped_type ?? 'project'
|
||||||
|
],
|
||||||
};
|
};
|
||||||
}) ?? [],
|
}) ?? [],
|
||||||
};
|
};
|
||||||
@@ -255,7 +252,7 @@ onMounted(async () => {
|
|||||||
aggregatedTableTimeEntries.cost,
|
aggregatedTableTimeEntries.cost,
|
||||||
reportCurrency,
|
reportCurrency,
|
||||||
reportCurrencyFormat,
|
reportCurrencyFormat,
|
||||||
reportCurrencySymbol
|
reportCurrencySymbol,
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,18 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PlusCircleIcon } from '@heroicons/vue/20/solid';
|
import { PlusCircleIcon } from '@heroicons/vue/20/solid';
|
||||||
import { computed, nextTick, ref, watch } from 'vue';
|
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||||
|
import { type Component, computed, nextTick, ref, watch } from 'vue';
|
||||||
import ClientDropdownItem from '@/packages/ui/src/Client/ClientDropdownItem.vue';
|
import ClientDropdownItem from '@/packages/ui/src/Client/ClientDropdownItem.vue';
|
||||||
import type { CreateClientBody, Client } from '@/packages/api/src';
|
import type { CreateClientBody, Client } from '@/packages/api/src';
|
||||||
import {
|
|
||||||
ComboboxAnchor,
|
|
||||||
ComboboxContent,
|
|
||||||
ComboboxInput,
|
|
||||||
ComboboxItem,
|
|
||||||
ComboboxRoot,
|
|
||||||
ComboboxViewport,
|
|
||||||
} from 'radix-vue';
|
|
||||||
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
|
|
||||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
|
||||||
|
|
||||||
const model = defineModel<string | null>({
|
const model = defineModel<string | null>({
|
||||||
default: null,
|
default: null,
|
||||||
@@ -23,8 +14,10 @@ const props = defineProps<{
|
|||||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const searchInput = ref<HTMLElement | null>(null);
|
const searchInput = ref<HTMLInputElement | null>(null);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
const dropdownViewport = ref<Component | null>(null);
|
||||||
|
|
||||||
const searchValue = ref('');
|
const searchValue = ref('');
|
||||||
|
|
||||||
function isClientSelected(id: string) {
|
function isClientSelected(id: string) {
|
||||||
@@ -34,8 +27,7 @@ function isClientSelected(id: string) {
|
|||||||
watch(open, (isOpen) => {
|
watch(open, (isOpen) => {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// @ts-expect-error We need to access the actual HTML Element to focus as radix-vue does not support any other way right now
|
searchInput.value?.focus();
|
||||||
searchInput.value?.$el?.focus();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -56,89 +48,132 @@ async function addClientIfNoneExists() {
|
|||||||
if (newClient) {
|
if (newClient) {
|
||||||
model.value = newClient.id;
|
model.value = newClient.id;
|
||||||
searchValue.value = '';
|
searchValue.value = '';
|
||||||
open.value = false;
|
}
|
||||||
|
} else {
|
||||||
|
if (highlightedItemId.value) {
|
||||||
|
model.value = highlightedItemId.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentClient = computed(() => {
|
watch(filteredClients, () => {
|
||||||
return (
|
if (filteredClients.value.length > 0) {
|
||||||
props.clients.find((client) => client.id === model.value) ?? {
|
highlightedItemId.value = filteredClients.value[0].id;
|
||||||
id: null,
|
}
|
||||||
name: 'No Client',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function updateSearchValue(event: Event) {
|
||||||
|
const newInput = (event.target as HTMLInputElement).value;
|
||||||
|
if (newInput === ' ') {
|
||||||
|
searchValue.value = '';
|
||||||
|
const highlightedClientId = highlightedItemId.value;
|
||||||
|
if (highlightedClientId) {
|
||||||
|
const highlightedClient = props.clients.find(
|
||||||
|
(client) => client.id === highlightedClientId
|
||||||
|
);
|
||||||
|
if (highlightedClient) {
|
||||||
|
model.value = highlightedClient.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
searchValue.value = newInput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'changed']);
|
const emit = defineEmits(['update:modelValue', 'changed']);
|
||||||
|
|
||||||
function updateValue(client: { id: string | null; name: string }) {
|
function updateClient(newValue: string) {
|
||||||
model.value = client.id;
|
model.value = newValue;
|
||||||
emit('changed');
|
nextTick(() => {
|
||||||
|
emit('changed');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveHighlightUp() {
|
||||||
|
if (highlightedItem.value) {
|
||||||
|
const currentHightlightedIndex = filteredClients.value.indexOf(
|
||||||
|
highlightedItem.value
|
||||||
|
);
|
||||||
|
if (currentHightlightedIndex === 0) {
|
||||||
|
highlightedItemId.value =
|
||||||
|
filteredClients.value[filteredClients.value.length - 1].id;
|
||||||
|
} else {
|
||||||
|
highlightedItemId.value =
|
||||||
|
filteredClients.value[currentHightlightedIndex - 1].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveHighlightDown() {
|
||||||
|
if (highlightedItem.value) {
|
||||||
|
const currentHightlightedIndex = filteredClients.value.indexOf(
|
||||||
|
highlightedItem.value
|
||||||
|
);
|
||||||
|
if (currentHightlightedIndex === filteredClients.value.length - 1) {
|
||||||
|
highlightedItemId.value = filteredClients.value[0].id;
|
||||||
|
} else {
|
||||||
|
highlightedItemId.value =
|
||||||
|
filteredClients.value[currentHightlightedIndex + 1].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const highlightedItemId = ref<string | null>(null);
|
||||||
|
const highlightedItem = computed(() => {
|
||||||
|
return props.clients.find(
|
||||||
|
(client) => client.id === highlightedItemId.value
|
||||||
|
);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dropdown v-model="open" align="start" width="60">
|
<Dropdown v-model="open" width="120" :close-on-content-click="true">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<slot name="trigger"></slot>
|
<slot name="trigger"></slot>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<UseFocusTrap
|
<input
|
||||||
v-if="open"
|
ref="searchInput"
|
||||||
:options="{ immediate: true, allowOutsideClick: true }">
|
:value="searchValue"
|
||||||
<ComboboxRoot
|
data-testid="client_dropdown_search"
|
||||||
v-model:search-term="searchValue"
|
class="bg-card-background border-0 placeholder-muted text-sm text-text-primary py-2.5 focus:ring-0 border-b border-card-background-separator focus:border-card-background-separator w-full"
|
||||||
:open="open"
|
placeholder="Search for a client..."
|
||||||
:model-value="currentClient"
|
@input="updateSearchValue"
|
||||||
class="relative"
|
@keydown.enter="addClientIfNoneExists"
|
||||||
@update:model-value="updateValue">
|
@keydown.up.prevent="moveHighlightUp"
|
||||||
<ComboboxAnchor>
|
@keydown.down.prevent="moveHighlightDown" />
|
||||||
<ComboboxInput
|
<div ref="dropdownViewport" class="w-60 max-h-60 overflow-y-scroll">
|
||||||
ref="searchInput"
|
<div
|
||||||
class="bg-card-background border-0 placeholder-muted text-sm text-text-primary py-2.5 focus:ring-0 border-b border-card-background-separator focus:border-card-background-separator w-full"
|
v-if="
|
||||||
placeholder="Search for a client..." />
|
searchValue.length > 0 && filteredClients.length === 0
|
||||||
</ComboboxAnchor>
|
"
|
||||||
<ComboboxContent>
|
class="bg-card-background-active"
|
||||||
<ComboboxViewport
|
@click="addClientIfNoneExists">
|
||||||
class="w-60 max-h-60 overflow-y-scroll">
|
<div
|
||||||
<ComboboxItem
|
class="flex space-x-3 items-center px-4 py-3 text-xs text-text-primary font-medium border-t rounded-b-lg border-card-background-separator">
|
||||||
:value="{ id: null, name: 'No Client' }"
|
<PlusCircleIcon
|
||||||
class="data-[highlighted]:bg-card-background-active">
|
class="w-5 flex-shrink-0"></PlusCircleIcon>
|
||||||
<ClientDropdownItem
|
<span>Add "{{ searchValue }}" as a new Client</span>
|
||||||
:selected="model === null"
|
</div>
|
||||||
name="No Client" />
|
</div>
|
||||||
</ComboboxItem>
|
<div v-else></div>
|
||||||
<ComboboxItem
|
<div
|
||||||
v-for="client in filteredClients"
|
v-for="client in filteredClients"
|
||||||
:key="client.id"
|
:key="client.id"
|
||||||
:value="client"
|
role="option"
|
||||||
class="data-[highlighted]:bg-card-background-active"
|
:value="client.id"
|
||||||
:data-client-id="client.id">
|
:class="{
|
||||||
<ClientDropdownItem
|
'bg-card-background-active':
|
||||||
:selected="isClientSelected(client.id)"
|
client.id === highlightedItemId,
|
||||||
:name="client.name" />
|
}"
|
||||||
</ComboboxItem>
|
data-testid="client_dropdown_entries"
|
||||||
<div
|
:data-client-id="client.id">
|
||||||
v-if="
|
<ClientDropdownItem
|
||||||
searchValue.length > 0 &&
|
:selected="isClientSelected(client.id)"
|
||||||
filteredClients.length === 0
|
:name="client.name"
|
||||||
"
|
@click="updateClient(client.id)"></ClientDropdownItem>
|
||||||
class="bg-card-background-active">
|
</div>
|
||||||
<div
|
</div>
|
||||||
class="flex space-x-3 items-center px-4 py-3 text-xs text-text-primary font-medium border-t rounded-b-lg border-card-background-separator"
|
|
||||||
@click="addClientIfNoneExists">
|
|
||||||
<PlusCircleIcon class="w-5 flex-shrink-0" />
|
|
||||||
<span
|
|
||||||
>Add "{{ searchValue }}" as a new
|
|
||||||
Client</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ComboboxViewport>
|
|
||||||
</ComboboxContent>
|
|
||||||
</ComboboxRoot>
|
|
||||||
</UseFocusTrap>
|
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import TextInput from '@/packages/ui/src/Input/TextInput.vue';
|
||||||
|
import { formatCents } from '@/packages/ui/src/utils/money';
|
||||||
|
import { ref, watch, inject, type ComputedRef } from 'vue';
|
||||||
import { useFocus } from '@vueuse/core';
|
import { useFocus } from '@vueuse/core';
|
||||||
import {
|
import type { Organization } from '@/packages/api/src';
|
||||||
NumberField,
|
|
||||||
NumberFieldContent,
|
|
||||||
NumberFieldDecrement,
|
|
||||||
NumberFieldIncrement,
|
|
||||||
NumberFieldInput,
|
|
||||||
} from '@/Components/ui/number-field';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
name: string;
|
name: string;
|
||||||
@@ -15,6 +11,8 @@ const props = defineProps<{
|
|||||||
currency: string;
|
currency: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const organization = inject<ComputedRef<Organization>>('organization');
|
||||||
|
|
||||||
const model = defineModel<number | null>({
|
const model = defineModel<number | null>({
|
||||||
default: null,
|
default: null,
|
||||||
});
|
});
|
||||||
@@ -22,32 +20,82 @@ const model = defineModel<number | null>({
|
|||||||
const billableRateInput = ref<HTMLInputElement | null>(null);
|
const billableRateInput = ref<HTMLInputElement | null>(null);
|
||||||
useFocus(billableRateInput, { initialValue: props.focus });
|
useFocus(billableRateInput, { initialValue: props.focus });
|
||||||
|
|
||||||
function formatValue(modelValue: number | null) {
|
function cleanUpDecimalValue(value: string) {
|
||||||
return modelValue ? modelValue / 100 : 0;
|
value = value.replace(/,/g, '');
|
||||||
|
value = value.replace(props.currency, '');
|
||||||
|
return value.replace(/\./g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRate(value: string) {
|
||||||
|
value = value.trim();
|
||||||
|
if (value.includes(',')) {
|
||||||
|
const parts = value.split(',');
|
||||||
|
const lastPart = (parts[parts.length - 1] = parts[parts.length - 1]);
|
||||||
|
if (lastPart.length === 2) {
|
||||||
|
// we detected a decimal number with 2 digits after the comma
|
||||||
|
value = cleanUpDecimalValue(value);
|
||||||
|
model.value = parseInt(value);
|
||||||
|
}
|
||||||
|
} else if (value.includes('.')) {
|
||||||
|
const parts = value.split('.');
|
||||||
|
const lastPart = (parts[parts.length - 1] = parts[parts.length - 1]);
|
||||||
|
if (lastPart.length === 2) {
|
||||||
|
value = cleanUpDecimalValue(value);
|
||||||
|
model.value = parseInt(value);
|
||||||
|
}
|
||||||
|
} else if (value === '') {
|
||||||
|
model.value = 0;
|
||||||
|
} else {
|
||||||
|
// if it doesn't contain a comma or a dot, it's probably a whole number so let's convert it to cents
|
||||||
|
const parsedValue = parseInt(cleanUpDecimalValue(value)) * 100;
|
||||||
|
if (parsedValue) {
|
||||||
|
model.value = parsedValue;
|
||||||
|
} else {
|
||||||
|
model.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputValue.value = formatValue(model.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatValue(modelValue: number | null) {
|
||||||
|
const formattedValue = formatCents(
|
||||||
|
modelValue ?? 0,
|
||||||
|
props.currency,
|
||||||
|
organization?.value?.currency_format,
|
||||||
|
organization?.value?.currency_symbol,
|
||||||
|
organization?.value?.number_format
|
||||||
|
);
|
||||||
|
return formattedValue
|
||||||
|
?.replace(organization?.value?.currency_symbol ?? '', '')
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(model, (newValue) => {
|
||||||
|
inputValue.value = formatValue(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
const inputValue = ref(formatValue(model.value));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<NumberField
|
<TextInput
|
||||||
:id="name"
|
:id="name"
|
||||||
ref="billableRateInput"
|
ref="billableRateInput"
|
||||||
:model-value="formatValue(model)"
|
v-model="inputValue"
|
||||||
:step-snapping="false"
|
type="text"
|
||||||
|
:name="name"
|
||||||
|
placeholder="Billable Rate"
|
||||||
class="block w-full"
|
class="block w-full"
|
||||||
:format-options="{
|
autocomplete="teamMemberRate"
|
||||||
style: 'currency',
|
@blur="updateRate($event.target.value)"
|
||||||
currency: currency,
|
@keydown.enter="updateRate($event.target.value)" />
|
||||||
currencyDisplay: 'code',
|
<div
|
||||||
currencySign: 'accounting',
|
class="absolute top-0 right-0 h-full flex items-center px-4 font-medium pointer-events-none">
|
||||||
}"
|
<span>
|
||||||
@update:model-value="(value) => (model = value * 100)">
|
{{ currency }}
|
||||||
<NumberFieldContent>
|
</span>
|
||||||
<NumberFieldDecrement />
|
</div>
|
||||||
<NumberFieldInput placeholder="Billable Rate" />
|
|
||||||
<NumberFieldIncrement />
|
|
||||||
</NumberFieldContent>
|
|
||||||
</NumberField>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import {
|
|||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/Components/ui/popover';
|
} from '@/Components/ui/popover';
|
||||||
import { RangeCalendar } from '@/Components/ui/range-calendar';
|
import { RangeCalendar } from '@/Components/ui/range-calendar';
|
||||||
import { CalendarDate } from '@internationalized/date';
|
import {
|
||||||
|
CalendarDate,
|
||||||
|
getLocalTimeZone,
|
||||||
|
} from '@internationalized/date';
|
||||||
import { CalendarIcon } from 'lucide-vue-next';
|
import { CalendarIcon } from 'lucide-vue-next';
|
||||||
import { computed, ref, inject, type ComputedRef, watch } from 'vue';
|
import { computed, ref, inject, type ComputedRef, watch } from 'vue';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
@@ -13,9 +16,8 @@ import {
|
|||||||
getDayJsInstance,
|
getDayJsInstance,
|
||||||
getLocalizedDayJs,
|
getLocalizedDayJs,
|
||||||
} from '@/packages/ui/src/utils/time';
|
} from '@/packages/ui/src/utils/time';
|
||||||
|
import { formatDateLocalized } from '@/packages/ui/src/utils/time';
|
||||||
import { type Organization } from '@/packages/api/src';
|
import { type Organization } from '@/packages/api/src';
|
||||||
import { getUserTimezone } from '@/packages/ui/src/utils/settings';
|
|
||||||
import { formatDate } from '@/packages/ui/src/utils/time';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
start: string;
|
start: string;
|
||||||
@@ -57,13 +59,12 @@ const modelValue = computed<CalendarDateRange>({
|
|||||||
}),
|
}),
|
||||||
set: (newValue) => {
|
set: (newValue) => {
|
||||||
if (newValue.start) {
|
if (newValue.start) {
|
||||||
console.log(newValue.start);
|
const date = newValue.start.toDate(getLocalTimeZone());
|
||||||
const date = newValue.start.toDate(getUserTimezone());
|
emit('update:start', getDayJsInstance()(date).format('YYYY-MM-DD'));
|
||||||
emit('update:start', getLocalizedDayJs(date.toString()).format());
|
|
||||||
}
|
}
|
||||||
if (newValue.end) {
|
if (newValue.end) {
|
||||||
const date = newValue.end.toDate(getUserTimezone());
|
const date = newValue.end.toDate(getLocalTimeZone());
|
||||||
emit('update:end', getLocalizedDayJs(date.toString()).format());
|
emit('update:end', getDayJsInstance()(date).format('YYYY-MM-DD'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -218,27 +219,12 @@ watch(open, (value) => {
|
|||||||
<CalendarIcon class="mr-2 h-4 w-4" />
|
<CalendarIcon class="mr-2 h-4 w-4" />
|
||||||
<template v-if="modelValue.start">
|
<template v-if="modelValue.start">
|
||||||
<template v-if="modelValue.end">
|
<template v-if="modelValue.end">
|
||||||
{{
|
{{ formatDateLocalized(modelValue.start.toString(), organization?.date_format) }}
|
||||||
formatDate(
|
|
||||||
modelValue.start.toString(),
|
|
||||||
organization?.date_format
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
-
|
-
|
||||||
{{
|
{{ formatDateLocalized(modelValue.end.toString(), organization?.date_format) }}
|
||||||
formatDate(
|
|
||||||
modelValue.end.toString(),
|
|
||||||
organization?.date_format
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{
|
{{ formatDateLocalized(modelValue.start.toString(), organization?.date_format) }}
|
||||||
formatDate(
|
|
||||||
modelValue.start.toString(),
|
|
||||||
organization?.date_format
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-else> Pick a date </template>
|
<template v-else> Pick a date </template>
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ const currentClientName = computed(() => {
|
|||||||
</ClientDropdown>
|
</ClientDropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="lg:grid grid-cols-2 gap-12">
|
||||||
<div>
|
<div>
|
||||||
<ProjectEditBillableSection
|
<ProjectEditBillableSection
|
||||||
v-model:is-billable="project.is_billable"
|
v-model:is-billable="project.is_billable"
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ const emit = defineEmits(['submit']);
|
|||||||
v-model="billableRateSelect"
|
v-model="billableRateSelect"
|
||||||
class="mt-2"></ProjectBillableSelect>
|
class="mt-2"></ProjectBillableSelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="billableRateSelect === 'custom-rate'">
|
<div
|
||||||
|
v-if="billableRateSelect === 'custom-rate'"
|
||||||
|
class="sm:max-w-[120px]">
|
||||||
<InputLabel for="billableRate" value="Billable Rate" class="mb-2" />
|
<InputLabel for="billableRate" value="Billable Rate" class="mb-2" />
|
||||||
<BillableRateInput
|
<BillableRateInput
|
||||||
v-model="billableRate"
|
v-model="billableRate"
|
||||||
|
|||||||
@@ -146,9 +146,8 @@ export function formatDateLocalized(date: string, format: DateFormat = 'point-se
|
|||||||
return getLocalizedDayJs(date).format(dateFormatMap[format]);
|
return getLocalizedDayJs(date).format(dateFormatMap[format]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateTimeLocalized(date: string, dateFormat?: DateFormat, timeFormat?: TimeFormat): string {
|
export function formatDateTimeLocalized(date: string): string {
|
||||||
const format = `${dateFormatMap[dateFormat ?? 'point-separated-d-m-yyyy']} ${timeFormat === '12-hours' ? 'hh:mm A' : 'HH:mm'}`;
|
return getLocalizedDayJs(date).format('DD.MM.YYYY HH:mm');
|
||||||
return getLocalizedDayJs(date).format(format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatWeek(date: string | null): string {
|
export function formatWeek(date: string | null): string {
|
||||||
|
|||||||
@@ -125,6 +125,4 @@ export function canViewAllTimeEntries() {
|
|||||||
export function canViewInvoices() {
|
export function canViewInvoices() {
|
||||||
return currentUserHasPermission('invoices:view');
|
return currentUserHasPermission('invoices:view');
|
||||||
}
|
}
|
||||||
export function canCreateReports() {
|
|
||||||
return currentUserHasPermission('reports:create');
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ import type {
|
|||||||
AggregatedTimeEntriesQueryParams,
|
AggregatedTimeEntriesQueryParams,
|
||||||
ReportingResponse,
|
ReportingResponse,
|
||||||
} from '@/packages/api/src';
|
} from '@/packages/api/src';
|
||||||
import {
|
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||||
getCurrentOrganizationId,
|
|
||||||
getCurrentRole,
|
|
||||||
getCurrentUser,
|
|
||||||
} from '@/utils/useUser';
|
|
||||||
import { useNotificationsStore } from '@/utils/notification';
|
import { useNotificationsStore } from '@/utils/notification';
|
||||||
import { useProjectsStore } from '@/utils/useProjects';
|
import { useProjectsStore } from '@/utils/useProjects';
|
||||||
import { useMembersStore } from '@/utils/useMembers';
|
import { useMembersStore } from '@/utils/useMembers';
|
||||||
@@ -110,9 +106,6 @@ export const useReportingStore = defineStore('reporting', () => {
|
|||||||
return projects.value.find((project) => project.id === key)?.name;
|
return projects.value.find((project) => project.id === key)?.name;
|
||||||
}
|
}
|
||||||
if (type === 'user') {
|
if (type === 'user') {
|
||||||
if (getCurrentRole() === 'employee') {
|
|
||||||
return getCurrentUser().name;
|
|
||||||
}
|
|
||||||
const memberStore = useMembersStore();
|
const memberStore = useMembersStore();
|
||||||
const { members } = storeToRefs(memberStore);
|
const { members } = storeToRefs(memberStore);
|
||||||
return members.value.find((member) => member.user_id === key)?.name;
|
return members.value.find((member) => member.user_id === key)?.name;
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ function getCurrentUserId() {
|
|||||||
return page.props.auth.user.id;
|
return page.props.auth.user.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentUser() {
|
|
||||||
return page.props.auth.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentOrganizationId() {
|
function getCurrentOrganizationId() {
|
||||||
return page.props.auth.user.current_team_id;
|
return page.props.auth.user.current_team_id;
|
||||||
}
|
}
|
||||||
@@ -35,5 +31,4 @@ export {
|
|||||||
getCurrentUserId,
|
getCurrentUserId,
|
||||||
getCurrentMembershipId,
|
getCurrentMembershipId,
|
||||||
getCurrentRole,
|
getCurrentRole,
|
||||||
getCurrentUser,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
@use('Brick\Math\BigDecimal')
|
@use('Brick\Math\BigDecimal')
|
||||||
@use('Brick\Money\Money')
|
@use('Brick\Money\Money')
|
||||||
@use('Illuminate\Support\Carbon')
|
@use('PhpOffice\PhpSpreadsheet\Cell\DataType')
|
||||||
@use('Carbon\CarbonInterval')
|
@use('Carbon\CarbonInterval')
|
||||||
@inject('colorService', 'App\Service\ColorService')
|
@inject('colorService', 'App\Service\ColorService')
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8" />
|
||||||
<title>Report</title>
|
<title>Report</title>
|
||||||
<style>
|
<style>
|
||||||
html, body, div, span, applet, object, iframe,
|
html, body, div, span, applet, object, iframe,
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
@if($debug)
|
@if($debug)
|
||||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||||
<link href="https://fonts.bunny.net/css?family=outfit:200,300,400,500,600,700,800" rel="stylesheet"/>
|
<link href="https://fonts.bunny.net/css?family=outfit:200,300,400,500,600,700,800" rel="stylesheet" />
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@@ -152,13 +152,12 @@
|
|||||||
<div
|
<div
|
||||||
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
|
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
|
||||||
</div>
|
</div>
|
||||||
@if($showBillableRate)
|
|
||||||
<div style="padding: 8px 12px; border-radius: 8px;">
|
<div style="padding: 8px 12px; border-radius: 8px;">
|
||||||
<div style="color: #71717a; font-weight: 600;">Total cost</div>
|
<div style="color: #71717a; font-weight: 600;">Total cost</div>
|
||||||
<div
|
<div
|
||||||
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }} </div>
|
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }} </div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<div id="main-chart" style="width: 700px; height: 300px; margin: 20px auto;"></div>
|
<div id="main-chart" style="width: 700px; height: 300px; margin: 20px auto;"></div>
|
||||||
|
|
||||||
@@ -178,9 +177,7 @@
|
|||||||
{{ $group->description() }}
|
{{ $group->description() }}
|
||||||
</th>
|
</th>
|
||||||
<th>Duration</th>
|
<th>Duration</th>
|
||||||
@if($showBillableRate)
|
|
||||||
<th style="text-align: right;">Cost</th>
|
<th style="text-align: right;">Cost</th>
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@foreach($aggregatedData['grouped_data'] as $group1Entry)
|
@foreach($aggregatedData['grouped_data'] as $group1Entry)
|
||||||
@@ -191,21 +188,23 @@
|
|||||||
}};">
|
}};">
|
||||||
</div>
|
</div>
|
||||||
<span style="padding-left: 8px;">
|
<span style="padding-left: 8px;">
|
||||||
|
|
||||||
@if($group->is(\App\Enums\TimeEntryAggregationType::Billable))
|
@if($group->is(\App\Enums\TimeEntryAggregationType::Billable))
|
||||||
{{ $group1Entry['key'] === '1' ? 'Billable' : 'Non-billable' }}
|
{{ $group1Entry['key'] === '1' ? 'Billable' : 'Non-billable' }}
|
||||||
@else
|
@else
|
||||||
{{ $group1Entry['description'] ?? $group1Entry['key'] ?? 'No '.Str::lower($group->description()) }}
|
{{ $group1Entry['description'] ?? $group1Entry['key'] ?? 'No '.Str::lower($group->description()) }}
|
||||||
@endif
|
@endif
|
||||||
</span>
|
|
||||||
|
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: left;">
|
<td style="text-align: left;">
|
||||||
{{ $localization->formatInterval(CarbonInterval::seconds($group1Entry['seconds'])) }}
|
{{ $localization->formatInterval(CarbonInterval::seconds($group1Entry['seconds'])) }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td style="text-align: right;">
|
<td style="text-align: right;">
|
||||||
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($group1Entry['cost'], 2)->__toString(), $currency)) }}
|
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($group1Entry['cost'], 2)->__toString(), $currency)) }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
<tfoot>
|
<tfoot>
|
||||||
@@ -216,11 +215,9 @@
|
|||||||
<td style="font-weight: 500;color: #18181b;">
|
<td style="font-weight: 500;color: #18181b;">
|
||||||
{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }}
|
{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td style="text-align: right; font-weight: 500;color: #18181b;">
|
<td style="text-align: right; font-weight: 500;color: #18181b;">
|
||||||
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }}
|
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -256,11 +253,9 @@
|
|||||||
<th>
|
<th>
|
||||||
Duration (h)
|
Duration (h)
|
||||||
</th>
|
</th>
|
||||||
@if($showBillableRate)
|
|
||||||
<th>
|
<th>
|
||||||
Cost
|
Cost
|
||||||
</th>
|
</th>
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -287,17 +282,13 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ $localization->formatNumber($duration->totalHours) }}
|
{{ $localization->formatNumber($duration->totalHours) }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td>
|
<td>
|
||||||
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString(), $currency)) }}
|
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString(), $currency)) }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
@php
|
@php
|
||||||
$totalDuration += $group2Entry['seconds'];
|
$totalDuration += $group2Entry['seconds'];
|
||||||
if ($showBillableRate) {
|
$totalCost += $group2Entry['cost'];
|
||||||
$totalCost += $group2Entry['cost'];
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -365,12 +356,7 @@
|
|||||||
animation: false,
|
animation: false,
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
data: {!!
|
data: ['{!! collect($dataHistoryChart['grouped_data'])->pluck('key')->implode("', '") !!}'],
|
||||||
json_encode(collect($dataHistoryChart['grouped_data'])
|
|
||||||
->pluck('key')
|
|
||||||
->map(fn($value) => $localization->formatDate(Carbon::parse($value)))
|
|
||||||
->toArray())
|
|
||||||
!!},
|
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
@@ -395,16 +381,26 @@
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
show: false,
|
show: false,
|
||||||
inside: true,
|
inside: true,
|
||||||
|
formatter: function(value, index) {
|
||||||
|
let totalSeconds = value;
|
||||||
|
let hours = Math.floor(totalSeconds / 3600);
|
||||||
|
if (hours < 10) {
|
||||||
|
hours = "0" + hours;
|
||||||
|
}
|
||||||
|
totalSeconds %= 3600;
|
||||||
|
let minutes = Math.floor(totalSeconds / 60);
|
||||||
|
if (minutes < 10) {
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
}
|
||||||
|
return hours + ":" + minutes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: "time",
|
name: "time",
|
||||||
type: "bar",
|
type: "bar",
|
||||||
data: {!! json_encode(collect($dataHistoryChart['grouped_data'])->map(fn($value) => (object) [
|
data: [{!! collect($dataHistoryChart['grouped_data'])->pluck('seconds')->implode(', ') !!}],
|
||||||
'value' => $value['seconds'],
|
|
||||||
'name' => ((int) $value['seconds']) === 0 ? '' : $localization->formatInterval(CarbonInterval::seconds((int) $value['seconds']))
|
|
||||||
])->toArray()) !!},
|
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderColor: "#7dd3fc",
|
borderColor: "#7dd3fc",
|
||||||
color: "#7dd3fc"
|
color: "#7dd3fc"
|
||||||
@@ -417,8 +413,22 @@
|
|||||||
@endif
|
@endif
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
position: "top",
|
position: "top",
|
||||||
formatter: function (params) {
|
formatter: function(params) {
|
||||||
return params.name;
|
let value = params.value;
|
||||||
|
if (value === 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
let totalSeconds = value;
|
||||||
|
let hours = Math.floor(totalSeconds / 3600);
|
||||||
|
if (hours < 10) {
|
||||||
|
hours = "0" + hours;
|
||||||
|
}
|
||||||
|
totalSeconds %= 3600;
|
||||||
|
let minutes = Math.floor(totalSeconds / 60);
|
||||||
|
if (minutes < 10) {
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
}
|
||||||
|
return hours + ":" + minutes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,11 +62,9 @@
|
|||||||
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
||||||
{{ round($duration->totalHours, 2) }}
|
{{ round($duration->totalHours, 2) }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
||||||
{{ round(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->toFloat(), 2) }}
|
{{ round(BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->toFloat(), 2) }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
@else
|
@else
|
||||||
@if ($group === TimeEntryAggregationType::Billable)
|
@if ($group === TimeEntryAggregationType::Billable)
|
||||||
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_STRING }}">
|
||||||
@@ -94,20 +92,16 @@
|
|||||||
data-format="{{ NumberFormat::FORMAT_NUMBER_00 }}">
|
data-format="{{ NumberFormat::FORMAT_NUMBER_00 }}">
|
||||||
{{ $duration->totalHours }}
|
{{ $duration->totalHours }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_NUMERIC }}"
|
<td style="border: 1px solid black;" data-type="{{ DataType::TYPE_NUMERIC }}"
|
||||||
data-format="{{ NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1 }}">
|
data-format="{{ NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1 }}">
|
||||||
{{ BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString() }}
|
{{ BigDecimal::ofUnscaledValue($group2Entry['cost'], 2)->__toString() }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@php
|
@php
|
||||||
++$counter;
|
++$counter;
|
||||||
$totalDuration += $group2Entry['seconds'];
|
$totalDuration += $group2Entry['seconds'];
|
||||||
if ($showBillableRate) {
|
$totalCost += $group2Entry['cost'];
|
||||||
$totalCost += $group2Entry['cost'];
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
@endforeach
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -126,11 +120,9 @@
|
|||||||
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_STRING }}">
|
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_STRING }}">
|
||||||
{{ round($totalDurationInterval->totalHours, 2) }}
|
{{ round($totalDurationInterval->totalHours, 2) }}
|
||||||
</td>
|
</td>
|
||||||
@if($showBillableRate)
|
|
||||||
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_STRING }}">
|
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_STRING }}">
|
||||||
{{ round(BigDecimal::ofUnscaledValue($totalCost, 2)->toFloat(), 2) }}
|
{{ round(BigDecimal::ofUnscaledValue($totalCost, 2)->toFloat(), 2) }}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
|
||||||
@else
|
@else
|
||||||
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_FORMULA }}"
|
<td style="border: 1px solid black; font-weight: bold;" data-type="{{ DataType::TYPE_FORMULA }}"
|
||||||
data-format="[hh]:mm:ss">
|
data-format="[hh]:mm:ss">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@use('Brick\Math\BigDecimal')
|
@use('Brick\Math\BigDecimal')
|
||||||
@use('Brick\Money\Money')
|
@use('Brick\Money\Money')
|
||||||
|
@use('PhpOffice\PhpSpreadsheet\Cell\DataType')
|
||||||
@use('Carbon\CarbonInterval')
|
@use('Carbon\CarbonInterval')
|
||||||
@inject('interval', 'App\Service\IntervalService')
|
@inject('interval', 'App\Service\IntervalService')
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -140,14 +141,12 @@
|
|||||||
<div
|
<div
|
||||||
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
|
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatInterval(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
|
||||||
</div>
|
</div>
|
||||||
@if($showBillableRate)
|
|
||||||
<div style="padding: 8px 12px; border-radius: 8px;">
|
<div style="padding: 8px 12px; border-radius: 8px;">
|
||||||
<div style="color: #71717a; font-weight: 600;">Total cost</div>
|
<div style="color: #71717a; font-weight: 600;">Total cost</div>
|
||||||
<div style="font-size: 24px; font-weight: 500; margin-top: 2px;">
|
<div
|
||||||
{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }}
|
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $localization->formatCurrency(Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)) }} </div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table style="width: 100%;">
|
<table style="width: 100%;">
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ export default {
|
|||||||
"800": "rgba(var(--color-accent-800), <alpha-value>)",
|
"800": "rgba(var(--color-accent-800), <alpha-value>)",
|
||||||
"900": "rgba(var(--color-accent-900), <alpha-value>)",
|
"900": "rgba(var(--color-accent-900), <alpha-value>)",
|
||||||
"950": "rgba(var(--color-accent-950), <alpha-value>)",
|
"950": "rgba(var(--color-accent-950), <alpha-value>)",
|
||||||
DEFAULT: "var(--color-accent-default)",
|
DEFAULT: "var(--color-bg-tertiary)",
|
||||||
foreground: "var(--color-accent-foreground)",
|
foreground: "rgb(var(--color-accent-200))"
|
||||||
},
|
},
|
||||||
"button-primary-background": "var(--theme-color-button-primary-background)",
|
"button-primary-background": "var(--theme-color-button-primary-background)",
|
||||||
"button-primary-background-hover": "var(--theme-color-button-primary-background-hover)",
|
"button-primary-background-hover": "var(--theme-color-button-primary-background-hover)",
|
||||||
|
|||||||
@@ -56,12 +56,10 @@ abstract class TestCaseWithDatabase extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @return object{user: User, organization: Organization, member: Member, owner: User, ownerMember: Member}
|
* @return object{user: User, organization: Organization, member: Member, owner: User, ownerMember: Member}
|
||||||
*/
|
*/
|
||||||
public function createUserWithRole(Role $role, bool $employeesCanSeeBillableRates = false): object
|
public function createUserWithRole(Role $role): object
|
||||||
{
|
{
|
||||||
$owner = User::factory()->create();
|
$owner = User::factory()->create();
|
||||||
$organization = Organization::factory()->withOwner($owner)->create([
|
$organization = Organization::factory()->withOwner($owner)->create();
|
||||||
'employees_can_see_billable_rates' => $employeesCanSeeBillableRates,
|
|
||||||
]);
|
|
||||||
$ownerMember = Member::factory()->forUser($owner)->forOrganization($organization)->role(Role::Owner)->create();
|
$ownerMember = Member::factory()->forUser($owner)->forOrganization($organization)->role(Role::Owner)->create();
|
||||||
$owner->currentOrganization()->associate($organization);
|
$owner->currentOrganization()->associate($organization);
|
||||||
$owner->save();
|
$owner->save();
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Tests\Unit\Console\Commands\SelfHost;
|
|
||||||
|
|
||||||
use App\Console\Commands\SelfHost\SelfHostDatabaseConsistency;
|
|
||||||
use App\Enums\Role;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Organization;
|
|
||||||
use App\Models\Project;
|
|
||||||
use App\Models\Task;
|
|
||||||
use App\Models\TimeEntry;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use PHPUnit\Framework\Attributes\CoversClass;
|
|
||||||
use PHPUnit\Framework\Attributes\UsesClass;
|
|
||||||
use Tests\TestCaseWithDatabase;
|
|
||||||
|
|
||||||
#[CoversClass(SelfHostDatabaseConsistency::class)]
|
|
||||||
#[UsesClass(SelfHostDatabaseConsistency::class)]
|
|
||||||
class SelfHostDatabaseConsistencyCommandTest extends TestCaseWithDatabase
|
|
||||||
{
|
|
||||||
public function test_checks_that_task_need_to_be_part_of_project_in_time_entries(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$project1 = Project::factory()->forOrganization($user->organization)->create();
|
|
||||||
$project2 = Project::factory()->forOrganization($user->organization)->create();
|
|
||||||
$task = Task::factory()->forOrganization($user->organization)->forProject($project1)->create();
|
|
||||||
$timeEntry = TimeEntry::factory()->forMember($user->member)->forTask($task)->forProject($project2)->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Time entries have a task that does not belong to the project of the time entry\n - ".$timeEntry->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_client_id_is_the_client_id_of_the_project(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$client1 = Client::factory()->forOrganization($user->organization)->create();
|
|
||||||
$client2 = Client::factory()->forOrganization($user->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($user->organization)->forClient($client1)->create();
|
|
||||||
$timeEntry = TimeEntry::factory()->forMember($user->member)->forProject($project)->create([
|
|
||||||
'client_id' => $client2->id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Time entries have a client that does not match the client of the project\n - ".$timeEntry->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_client_id_is_the_client_id_of_the_project_with_no_client_in_time_entry(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$client1 = Client::factory()->forOrganization($user->organization)->create();
|
|
||||||
$client2 = Client::factory()->forOrganization($user->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($user->organization)->forClient($client1)->create();
|
|
||||||
$timeEntry = TimeEntry::factory()->forMember($user->member)->forProject($project)->create([
|
|
||||||
'client_id' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Time entries have a client that does not match the client of the project\n - ".$timeEntry->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_client_id_is_only_null_if_project_is_also_null(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$client1 = Client::factory()->forOrganization($user->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($user->organization)->forClient($client1)->create();
|
|
||||||
$timeEntry = TimeEntry::factory()->forMember($user->member)->create([
|
|
||||||
'client_id' => $client1->getKey(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Time entries have a client but no project\n - ".$timeEntry->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_every_user_needs_to_be_a_member_of_at_least_one_organization(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = User::factory()->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Users are not member of any organization\n - ".$user->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_every_organization_needs_at_least_an_owner(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$organization = Organization::factory()->withOwner($user->user)->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Organizations without an owner\n - ".$organization->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_every_member_can_only_have_one_running_time_entry(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user = $this->createUserWithRole(Role::Owner);
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forMember($user->member)->active()->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forMember($user->member)->active()->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Users with more than one running time entry\n - ".$user->user->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_checks_that_users_have_a_current_organization_that_they_are_not_a_member_of(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$user1 = $this->createUserWithRole(Role::Owner);
|
|
||||||
$user2 = $this->createUserWithRole(Role::Owner);
|
|
||||||
$user1->user->currentOrganization()->associate($user2->organization);
|
|
||||||
$user1->user->save();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:database-consistency');
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertSame(Command::FAILURE, $exitCode);
|
|
||||||
$output = Artisan::output();
|
|
||||||
$this->assertSame("Consistency problem: Users have a current organization that they are not a member of\n - ".$user1->user->getKey()."\n", $output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -686,10 +686,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
'time-entries:view:all',
|
'time-entries:view:all',
|
||||||
]);
|
]);
|
||||||
Passport::actingAs($data->user);
|
Passport::actingAs($data->user);
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$this->actAsOrganizationWithSubscription();
|
$this->actAsOrganizationWithSubscription();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -704,192 +700,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
$this->assertResponseCode($response, 200);
|
$this->assertResponseCode($response, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_csv_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::CSV,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_ods_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::ODS,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_xlxs_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::XLSX,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_pdf_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$this->actAsOrganizationWithSubscription();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::PDF,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_csv_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::CSV,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_ods_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::ODS,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_xlxs_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::XLSX,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_index_export_endpoint_can_create_a_detailed_time_entry_report_in_format_pdf_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$this->actAsOrganizationWithSubscription();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.index-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::PDF,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->id,
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_fails_if_user_no_permission_to_view_time_entries(): void
|
public function test_aggregate_export_endpoints_fails_if_user_no_permission_to_view_time_entries(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
@@ -1005,58 +815,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
$this->assertResponseCode($response, 200);
|
$this->assertResponseCode($response, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_csv_report_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::CSV,
|
|
||||||
'group' => TimeEntryAggregationType::Client,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_csv_report_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::CSV,
|
|
||||||
'group' => TimeEntryAggregationType::Client,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_xlsx_report(): void
|
public function test_aggregate_export_endpoints_can_create_a_xlsx_report(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
@@ -1084,58 +842,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
$this->assertResponseCode($response, 200);
|
$this->assertResponseCode($response, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_xlsx_report_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::XLSX,
|
|
||||||
'group' => TimeEntryAggregationType::Client,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_xlsx_report_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::XLSX,
|
|
||||||
'group' => TimeEntryAggregationType::Client,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_ods_report(): void
|
public function test_aggregate_export_endpoints_can_create_a_ods_report(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
@@ -1163,58 +869,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
$this->assertResponseCode($response, 200);
|
$this->assertResponseCode($response, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_ods_report_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::ODS,
|
|
||||||
'group' => TimeEntryAggregationType::User,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_ods_report_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::ODS,
|
|
||||||
'group' => TimeEntryAggregationType::User,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoint_fails_if_pdf_renderer_is_not_configured_but_a_user_want_a_pdf_report(): void
|
public function test_aggregate_export_endpoint_fails_if_pdf_renderer_is_not_configured_but_a_user_want_a_pdf_report(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
@@ -1273,60 +927,6 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
|||||||
$this->assertResponseCode($response, 200);
|
$this->assertResponseCode($response, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_pdf_report_as_employee_role_with_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, true);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
$this->actAsOrganizationWithSubscription();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::PDF,
|
|
||||||
'group' => TimeEntryAggregationType::User,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_export_endpoints_can_create_a_pdf_report_as_employee_role_without_show_billable_rate(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$data = $this->createUserWithRole(Role::Employee, false);
|
|
||||||
$client = Client::factory()->forOrganization($data->organization)->create();
|
|
||||||
$project = Project::factory()->forOrganization($data->organization)->forClient($client)->create();
|
|
||||||
$timeEntry1 = TimeEntry::factory()->forOrganization($data->organization)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
$timeEntry2 = TimeEntry::factory()->forOrganization($data->organization)->forProject($project)->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create();
|
|
||||||
Passport::actingAs($data->user);
|
|
||||||
$this->actAsOrganizationWithSubscription();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$response = $this->getJson(route('api.v1.time-entries.aggregate-export', [
|
|
||||||
$data->organization->getKey(),
|
|
||||||
'format' => ExportFormat::PDF,
|
|
||||||
'group' => TimeEntryAggregationType::User,
|
|
||||||
'sub_group' => TimeEntryAggregationType::Project,
|
|
||||||
'history_group' => TimeEntryAggregationTypeInterval::Month,
|
|
||||||
'start' => Carbon::now()->startOfYear()->toIso8601ZuluString(),
|
|
||||||
'end' => Carbon::now()->endOfYear()->toIso8601ZuluString(),
|
|
||||||
'member_id' => $data->member->getKey(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertResponseCode($response, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_aggregate_endpoint_fails_if_user_has_only_access_to_own_time_entries_but_does_not_filter_for_this(): void
|
public function test_aggregate_endpoint_fails_if_user_has_only_access_to_own_time_entries_but_does_not_filter_for_this(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|||||||
@@ -150,24 +150,6 @@ class DeletionServiceTest extends TestCaseWithDatabase
|
|||||||
$this->assertSame($specialCase ? 7 : 6, TimeEntry::query()->whereBelongsTo($organization, 'organization')->count());
|
$this->assertSame($specialCase ? 7 : 6, TimeEntry::query()->whereBelongsTo($organization, 'organization')->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_delete_organization_resets_the_current_organization_of_users_that_had_the_deleted_organization_as_current_organization(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$userOwner = User::factory()->create();
|
|
||||||
$organization = Organization::factory()->withOwner($userOwner)->create();
|
|
||||||
$userOwner->currentOrganization()->associate($organization);
|
|
||||||
$userOwner->save();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$this->deletionService->deleteOrganization($organization);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$this->assertOrganizationDeleted($organization);
|
|
||||||
$userOwner->refresh();
|
|
||||||
$this->assertNull($userOwner->current_team_id);
|
|
||||||
$this->assertNotSame($organization->id, $userOwner->current_team_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_delete_organization_deletes_all_resources_of_the_organization_but_does_not_delete_other_resources(): void
|
public function test_delete_organization_deletes_all_resources_of_the_organization_but_does_not_delete_other_resources(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class LocalizationServiceTest extends TestCaseWithDatabase
|
|||||||
$formatted = $this->localizationService->formatInterval($interval);
|
$formatted = $this->localizationService->formatInterval($interval);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
$this->assertSame('30,001.05 h', $formatted);
|
$this->assertSame('30,001.05', $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_format_interval_with_type_decimal_and_number_format_thousands_space_decimal_point(): void
|
public function test_format_interval_with_type_decimal_and_number_format_thousands_space_decimal_point(): void
|
||||||
@@ -61,7 +61,7 @@ class LocalizationServiceTest extends TestCaseWithDatabase
|
|||||||
$formatted = $this->localizationService->formatInterval($interval);
|
$formatted = $this->localizationService->formatInterval($interval);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
$this->assertSame('30 001.05 h', $formatted);
|
$this->assertSame('30 001.05', $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_format_interval_with_type_decimal_and_number_format_thousands_point_decimal_comma(): void
|
public function test_format_interval_with_type_decimal_and_number_format_thousands_point_decimal_comma(): void
|
||||||
@@ -75,7 +75,7 @@ class LocalizationServiceTest extends TestCaseWithDatabase
|
|||||||
$formatted = $this->localizationService->formatInterval($interval);
|
$formatted = $this->localizationService->formatInterval($interval);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
$this->assertSame('30.001,05 h', $formatted);
|
$this->assertSame('30.001,05', $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_format_interval_with_type_decimal_and_number_format_thousands_apostrophe_decimal_point(): void
|
public function test_format_interval_with_type_decimal_and_number_format_thousands_apostrophe_decimal_point(): void
|
||||||
@@ -89,7 +89,7 @@ class LocalizationServiceTest extends TestCaseWithDatabase
|
|||||||
$formatted = $this->localizationService->formatInterval($interval);
|
$formatted = $this->localizationService->formatInterval($interval);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
$this->assertSame('30\'001.05 h', $formatted);
|
$this->assertSame('30\'001.05', $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_format_interval_with_type_hours_minutes(): void
|
public function test_format_interval_with_type_hours_minutes(): void
|
||||||
|
|||||||
@@ -114,41 +114,6 @@ class MemberServiceTest extends TestCaseWithDatabase
|
|||||||
$this->assertSame(1, $otherUser->organizations()->count());
|
$this->assertSame(1, $otherUser->organizations()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_make_member_to_placeholder_resets_current_organization_of_user_if_user_is_no_longer_member_to_newly_created_organization(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$organization = Organization::factory()->create();
|
|
||||||
$user = User::factory()->forCurrentOrganization($organization)->create();
|
|
||||||
$member = Member::factory()->forOrganization($organization)->forUser($user)->role(Role::Employee)->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$this->memberService->makeMemberToPlaceholder($member);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$user->refresh();
|
|
||||||
$this->assertNotNull($user->current_team_id);
|
|
||||||
$this->assertNotSame($organization->id, $user->current_team_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_make_member_to_placeholder_resets_current_organization_of_user_if_user_is_no_longer_member_to_already_existing_other_organization(): void
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
$organization = Organization::factory()->create();
|
|
||||||
$user = User::factory()->forCurrentOrganization($organization)->create();
|
|
||||||
$member = Member::factory()->forOrganization($organization)->forUser($user)->role(Role::Employee)->create();
|
|
||||||
|
|
||||||
$otherOrganization = Organization::factory()->create();
|
|
||||||
$otherMember = Member::factory()->forOrganization($otherOrganization)->forUser($user)->role(Role::Employee)->create();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
$this->memberService->makeMemberToPlaceholder($member);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
$user->refresh();
|
|
||||||
$this->assertNotNull($user->current_team_id);
|
|
||||||
$this->assertSame($otherOrganization->id, $user->current_team_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_assign_organization_entities_to_different_member_without_any_entries(): void
|
public function test_assign_organization_entities_to_different_member_without_any_entries(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|||||||
Reference in New Issue
Block a user