mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 16:22:16 +01:00
Compare commits
37 Commits
dependabot
...
feature/vo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fbf7b87bb | ||
|
|
114a32536d | ||
|
|
ff8a0f065b | ||
|
|
44fd0ffb91 | ||
|
|
c07c62bfab | ||
|
|
f599757761 | ||
|
|
e54fd2460c | ||
|
|
e997a2b39f | ||
|
|
f0de89b0e8 | ||
|
|
024283273a | ||
|
|
f01ab5fd9d | ||
|
|
4fb18f343f | ||
|
|
ba374c0371 | ||
|
|
e302421765 | ||
|
|
c90c1ed8fa | ||
|
|
75f5144b45 | ||
|
|
53ecc58509 | ||
|
|
ac68091d3e | ||
|
|
a97c02542b | ||
|
|
a56942abcf | ||
|
|
61a0a7db5a | ||
|
|
bc5af14a75 | ||
|
|
95bfb45978 | ||
|
|
2207f676ee | ||
|
|
981bcbe091 | ||
|
|
ccf3cec8c0 | ||
|
|
23ea1500b0 | ||
|
|
4bbde04e28 | ||
|
|
caa36d2875 | ||
|
|
58d7b33366 | ||
|
|
50f57f6997 | ||
|
|
ab9f6e6afb | ||
|
|
2a40bb7edb | ||
|
|
365f672cfc | ||
|
|
25f30fa820 | ||
|
|
37a8f43b23 | ||
|
|
c94aa8038d |
54
.dockerignore
Normal file
54
.dockerignore
Normal file
@@ -0,0 +1,54 @@
|
||||
.git
|
||||
**/.git
|
||||
.gitmodules
|
||||
**/.gitmodules
|
||||
.github
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
.vscode
|
||||
*.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
k8s
|
||||
docs
|
||||
e2e
|
||||
tests
|
||||
|
||||
docker-compose.yml
|
||||
docker/local
|
||||
|
||||
.phpunit.cache
|
||||
.phpunit.result.cache
|
||||
coverage
|
||||
test-results
|
||||
playwright-report
|
||||
blob-report
|
||||
playwright/.cache
|
||||
openapi.json
|
||||
playwright
|
||||
playwright.config.ts
|
||||
vitest.config.ts
|
||||
phpunit.xml
|
||||
phpstan.neon
|
||||
pint.json
|
||||
eslint.config.mjs
|
||||
tsconfig.json
|
||||
jsconfig.json
|
||||
postcss.config.js
|
||||
tailwind.config.js
|
||||
|
||||
node_modules
|
||||
extensions/*/node_modules
|
||||
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
.env.backup
|
||||
.rnd
|
||||
|
||||
_ide_helper.php
|
||||
.phpstorm.meta.php
|
||||
|
||||
storage/logs/*
|
||||
storage/*.key
|
||||
23
.github/VOUCHED.td
vendored
Normal file
23
.github/VOUCHED.td
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Vouched contributors for solidtime.
|
||||
#
|
||||
# One handle per line, without the leading @, sorted alphabetically.
|
||||
# Prefix a handle with - to denounce them, optionally followed by a reason.
|
||||
# Format reference: https://github.com/mitchellh/vouch
|
||||
#
|
||||
# Maintainers do not need to edit this file by hand. Comment "vouch @user",
|
||||
# "unvouch @user" or "denounce @user <reason>" on any issue, pull request or
|
||||
# discussion and the vouch workflows will update this file.
|
||||
#
|
||||
# Collaborators with write access and bots are always allowed and do not need
|
||||
# an entry here.
|
||||
#
|
||||
# Seeded 2026-07-25 from the authors of every merged pull request.
|
||||
|
||||
agross
|
||||
candideu
|
||||
KasparRosin
|
||||
korridor
|
||||
Onatcer
|
||||
ShrootBuck
|
||||
smileBeda
|
||||
utlark
|
||||
19
.github/workflows/build-onpremise.yml
vendored
19
.github/workflows/build-onpremise.yml
vendored
@@ -8,6 +8,8 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build-onpremise.yml'
|
||||
- '.dockerignore'
|
||||
- 'extensions/manifest.json'
|
||||
- 'docker/prod/**'
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -35,7 +37,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -91,14 +93,23 @@ jobs:
|
||||
if: steps.cache-vendor.outputs.cache-hit != 'true' # Skip if cache hit
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: "Read extension manifest"
|
||||
id: extension-manifest
|
||||
run: |
|
||||
{
|
||||
echo "invoicing_repository=$(jq -r '.Invoicing.repository' extensions/manifest.json)"
|
||||
echo "invoicing_ref=$(jq -r '.Invoicing.ref' extensions/manifest.json)"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: "Checkout invoicing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: solidtime-io/extension-invoicing
|
||||
repository: ${{ steps.extension-manifest.outputs.invoicing_repository }}
|
||||
ref: ${{ steps.extension-manifest.outputs.invoicing_ref }}
|
||||
path: extensions/Invoicing
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_INVOICING_EXTENSION }}
|
||||
|
||||
|
||||
33
.github/workflows/build-private.yml
vendored
33
.github/workflows/build-private.yml
vendored
@@ -8,6 +8,8 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build-private.yml'
|
||||
- '.dockerignore'
|
||||
- 'extensions/manifest.json'
|
||||
- 'docker/prod/**'
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
@@ -22,7 +24,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -68,14 +70,27 @@ jobs:
|
||||
run: cat .env
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: "Read extension manifest"
|
||||
id: extension-manifest
|
||||
run: |
|
||||
{
|
||||
echo "billing_repository=$(jq -r '.Billing.repository' extensions/manifest.json)"
|
||||
echo "billing_ref=$(jq -r '.Billing.ref' extensions/manifest.json)"
|
||||
echo "services_repository=$(jq -r '.Services.repository' extensions/manifest.json)"
|
||||
echo "services_ref=$(jq -r '.Services.ref' extensions/manifest.json)"
|
||||
echo "invoicing_repository=$(jq -r '.Invoicing.repository' extensions/manifest.json)"
|
||||
echo "invoicing_ref=$(jq -r '.Invoicing.ref' extensions/manifest.json)"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: "Checkout billing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: solidtime-io/extension-billing
|
||||
repository: ${{ steps.extension-manifest.outputs.billing_repository }}
|
||||
ref: ${{ steps.extension-manifest.outputs.billing_ref }}
|
||||
path: extensions/Billing
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_BILLING_EXTENSION }}
|
||||
|
||||
@@ -93,9 +108,10 @@ jobs:
|
||||
run: cd extensions/Billing && npm ci
|
||||
|
||||
- name: "Checkout services extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: solidtime-io/extension-services
|
||||
repository: ${{ steps.extension-manifest.outputs.services_repository }}
|
||||
ref: ${{ steps.extension-manifest.outputs.services_ref }}
|
||||
path: extensions/Services
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_SERVICES_EXTENSION }}
|
||||
|
||||
@@ -111,9 +127,10 @@ jobs:
|
||||
run: cd extensions/Services && npm ci
|
||||
|
||||
- name: "Checkout invoicing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: solidtime-io/extension-invoicing
|
||||
repository: ${{ steps.extension-manifest.outputs.invoicing_repository }}
|
||||
ref: ${{ steps.extension-manifest.outputs.invoicing_ref }}
|
||||
path: extensions/Invoicing
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_INVOICING_EXTENSION }}
|
||||
|
||||
|
||||
5
.github/workflows/build-public.yml
vendored
5
.github/workflows/build-public.yml
vendored
@@ -8,6 +8,7 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build-public.yml'
|
||||
- '.dockerignore'
|
||||
- 'docker/prod/**'
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -36,7 +37,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -92,7 +93,7 @@ jobs:
|
||||
if: steps.cache-vendor.outputs.cache-hit != 'true' # Skip if cache hit
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
2
.github/workflows/generate-api-docs.yml
vendored
2
.github/workflows/generate-api-docs.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
4
.github/workflows/npm-build.yml
vendored
4
.github/workflows/npm-build.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup PHP (for Ziggy)"
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
run: composer install -n --prefer-dist
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
4
.github/workflows/npm-format-check.yml
vendored
4
.github/workflows/npm-format-check.yml
vendored
@@ -9,10 +9,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
4
.github/workflows/npm-lint.yml
vendored
4
.github/workflows/npm-lint.yml
vendored
@@ -11,10 +11,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
4
.github/workflows/npm-publish-api.yml
vendored
4
.github/workflows/npm-publish-api.yml
vendored
@@ -11,11 +11,11 @@ jobs:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
# Setup .npmrc file to publish to npm
|
||||
- name: Install root project dependencies
|
||||
run: npm ci
|
||||
- uses: actions/setup-node@v6
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
4
.github/workflows/npm-publish-ui.yml
vendored
4
.github/workflows/npm-publish-ui.yml
vendored
@@ -11,9 +11,9 @@ jobs:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v6
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
4
.github/workflows/npm-test-unit.yml
vendored
4
.github/workflows/npm-test-unit.yml
vendored
@@ -13,10 +13,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
4
.github/workflows/npm-typecheck.yml
vendored
4
.github/workflows/npm-typecheck.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup PHP (for Ziggy)"
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
run: composer install -n --prefer-dist
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
2
.github/workflows/phpstan.yml
vendored
2
.github/workflows/phpstan.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
4
.github/workflows/phpunit.yml
vendored
4
.github/workflows/phpunit.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
--health-retries 5
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- name: "Run composer install"
|
||||
run: composer install -n --prefer-dist
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
2
.github/workflows/pint.yml
vendored
2
.github/workflows/pint.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Check code style"
|
||||
uses: aglipanci/laravel-pint-action@2.6
|
||||
|
||||
8
.github/workflows/playwright.yml
vendored
8
.github/workflows/playwright.yml
vendored
@@ -35,10 +35,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
@@ -99,10 +99,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
75
.github/workflows/vouch-check-pr.yml
vendored
Normal file
75
.github/workflows/vouch-check-pr.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: Vouch (check PR)
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, synchronize]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
if: >-
|
||||
github.event_name == 'pull_request_target' ||
|
||||
(github.event_name == 'issue_comment' &&
|
||||
github.event.issue.pull_request &&
|
||||
contains(github.event.comment.body, '/recheck'))
|
||||
|
||||
steps:
|
||||
# Pull requests of 50 changed lines or fewer skip the vouch requirement.
|
||||
- name: "Measure diff size"
|
||||
id: size
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
PR: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
|
||||
# Changes to these files do not count towards the 50-line limit.
|
||||
# One extended regex per line, matched against the whole repo-relative
|
||||
# path, so use a leading .* to match a file in any directory.
|
||||
IGNORED: |
|
||||
package-lock\.json
|
||||
composer\.lock
|
||||
tests/.*
|
||||
e2e/.*
|
||||
.*\.(test|spec)\.(ts|js|vue)
|
||||
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# An empty list yields "^()$", which matches no filename. grep exits
|
||||
# 1 on an empty list, so swallow that rather than fail the step.
|
||||
join() { { grep -vE '^[[:space:]]*$' || true; } | paste -sd'|' -; }
|
||||
ignored="^($(join <<<"$IGNORED"))$"
|
||||
|
||||
total=$(gh api --paginate "repos/$REPO/pulls/$PR/files" \
|
||||
--jq '.[] | [.filename, .additions + .deletions] | @tsv' |
|
||||
awk -F'\t' -v ignored="$ignored" '
|
||||
$1 ~ ignored { next }
|
||||
{ n += $2 }
|
||||
END { print n+0 }')
|
||||
echo "total=$total" >> "$GITHUB_OUTPUT"
|
||||
echo "Countable diff size: $total line(s)"
|
||||
|
||||
- name: "Small patch (denounced users still blocked)"
|
||||
if: fromJSON(steps.size.outputs.total) <= 50
|
||||
uses: mitchellh/vouch/action/check-pr@v1.5.0
|
||||
with:
|
||||
pr-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
auto-close: true
|
||||
require-vouch: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Full vouch required"
|
||||
if: fromJSON(steps.size.outputs.total) > 50
|
||||
uses: mitchellh/vouch/action/check-pr@v1.5.0
|
||||
with:
|
||||
pr-number: ${{ github.event.pull_request.number || github.event.issue.number }}
|
||||
auto-close: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
33
.github/workflows/vouch-manage-by-discussion.yml
vendored
Normal file
33
.github/workflows/vouch-manage-by-discussion.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Vouch (manage by discussion)
|
||||
|
||||
# Same commands as vouch-manage-by-issue.yml, but for discussion comments.
|
||||
|
||||
on:
|
||||
discussion_comment:
|
||||
types: [created]
|
||||
|
||||
concurrency:
|
||||
group: vouch-manage
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
manage:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Apply vouch command"
|
||||
uses: mitchellh/vouch/action/manage-by-discussion@v1.5.0
|
||||
with:
|
||||
discussion-number: ${{ github.event.discussion.number }}
|
||||
comment-node-id: ${{ github.event.comment.node_id }}
|
||||
roles: admin,maintain,write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
35
.github/workflows/vouch-manage-by-issue.yml
vendored
Normal file
35
.github/workflows/vouch-manage-by-issue.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Vouch (manage by issue)
|
||||
|
||||
# Maintainers comment "vouch @user", "unvouch @user" or "denounce @user <reason>"
|
||||
# on any issue or pull request, and this workflow updates .github/VOUCHED.td.
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
concurrency:
|
||||
group: vouch-manage
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
manage:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: "Apply vouch command"
|
||||
uses: mitchellh/vouch/action/manage-by-issue@v1.5.0
|
||||
with:
|
||||
issue-id: ${{ github.event.issue.number }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
roles: admin,maintain,write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -26,9 +26,10 @@ yarn-error.log
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
/coverage
|
||||
/extensions
|
||||
/extensions/*
|
||||
!/extensions/.gitkeep
|
||||
!/extensions/extensions_autoload.php
|
||||
!/extensions/manifest.json
|
||||
/auth.json
|
||||
/modules_statuses.json
|
||||
/k8s
|
||||
|
||||
@@ -12,6 +12,22 @@ In order to keep the issues of the repository clean we decided to only use them
|
||||
|
||||
To respect your time and help us manage contributions effectively, please open an issue or start a discussion and wait for approval before submitting a pull request (PR). This does not apply to tiny fixes or changes however, please keep in mind that we might not merge PRs for various reasons.
|
||||
|
||||
### Vouched contributors
|
||||
|
||||
Pull requests from authors who are not vouched are closed automatically. This lets us keep up with the volume of AI slop pull requests without a maintainer having to triage every one of them by hand.
|
||||
|
||||
Your pull request is not affected if any of the following applies:
|
||||
|
||||
- You have write access to this repository.
|
||||
- Someone with write access has vouched for you. The list lives in [.github/VOUCHED.td](.github/VOUCHED.td).
|
||||
- Your pull request changes 50 lines or fewer. Test files and lockfiles do not count towards that number, so a small fix that comes with tests still qualifies.
|
||||
|
||||
To get vouched, open an issue or discussion before you start and explain how you intend to implement the change. We will discuss the approach with you, and only once we have agreed on the implementation does a maintainer comment `vouch @your-handle`, which puts you on the list from then on.
|
||||
|
||||
Being vouched only stops your pull requests from being closed automatically. [Only work on approved issues](#only-work-on-approved-issues) still applies to every pull request you send.
|
||||
|
||||
Contributors who abuse this are denounced, and their pull requests are closed regardless of size.
|
||||
|
||||
### Contributor License Agreement
|
||||
|
||||
You'll also notice that we’ve set up a [Contributor License Agreement (CLA)](https://cla-assistant.io/solidtime-io/solidtime), which must be signed before any PR can be merged. Don’t worry - the process is quick and only takes a few clicks.
|
||||
|
||||
@@ -39,6 +39,8 @@ Please open an issue or start a discussion and wait for approval before submitti
|
||||
|
||||
**If you submit an AI slop pull request (especially without following the proper procedure), you will be banned from future contributions to solidtime.**
|
||||
|
||||
To keep that manageable, pull requests from authors who are not vouched are closed automatically, unless they change 50 lines or fewer. To get vouched, open an issue or discussion first and explain how you intend to implement the change. Once we have agreed on the approach, we vouch for you. See [Vouched contributors](./CONTRIBUTING.md#vouched-contributors).
|
||||
|
||||
Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) before sumbitting a Pull Request.
|
||||
|
||||
We do accept contributions in the [documentation repository](https://github.com/solidtime-io/docs) f.e. to add new self-hosting guides.
|
||||
|
||||
16
app/Enums/TagMatchType.php
Normal file
16
app/Enums/TagMatchType.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Datomatic\LaravelEnumHelper\LaravelEnumHelper;
|
||||
|
||||
enum TagMatchType: string
|
||||
{
|
||||
use LaravelEnumHelper;
|
||||
|
||||
case Contains = 'contains';
|
||||
|
||||
case NotContains = 'not_contains';
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class UserResource extends Resource
|
||||
->ignore($record?->getKey()),
|
||||
])
|
||||
->rule([
|
||||
'email',
|
||||
'email:rfc,strict',
|
||||
])
|
||||
->maxLength(255),
|
||||
Forms\Components\Toggle::make('is_placeholder')
|
||||
|
||||
@@ -43,7 +43,8 @@ class ClientController extends Controller
|
||||
|
||||
$clientsQuery = Client::query()
|
||||
->whereBelongsTo($organization, 'organization')
|
||||
->orderBy('created_at', 'desc');
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id');
|
||||
|
||||
if (! $canViewAllClients) {
|
||||
$clientsQuery->visibleByEmployee($user);
|
||||
|
||||
@@ -42,6 +42,7 @@ class InvitationController extends Controller
|
||||
|
||||
$invitations = $organization->organizationInvitations()
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
return InvitationCollection::make($invitations);
|
||||
|
||||
@@ -61,6 +61,7 @@ class MemberController extends Controller
|
||||
->whereBelongsTo($organization, 'organization')
|
||||
->with(['user'])
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
return MemberCollection::make($members);
|
||||
|
||||
@@ -62,6 +62,7 @@ class ProjectController extends Controller
|
||||
|
||||
$projects = $projectsQuery
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
$showBillableRate = $this->member($organization)->role !== Role::Employee->value || $organization->employees_can_see_billable_rates;
|
||||
|
||||
@@ -49,6 +49,7 @@ class ProjectMemberController extends Controller
|
||||
$projectMembers = ProjectMember::query()
|
||||
->whereBelongsTo($project, 'project')
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
return new ProjectMemberCollection($projectMembers);
|
||||
|
||||
@@ -59,7 +59,7 @@ class ReportController extends Controller
|
||||
$filter->addBillable($properties->billable);
|
||||
$filter->addMemberIdsFilter($properties->memberIds?->toArray());
|
||||
$filter->addProjectIdsFilter($properties->projectIds?->toArray());
|
||||
$filter->addTagIdsFilter($properties->tagIds?->toArray());
|
||||
$filter->addTagIdsFilter($properties->tagIds?->toArray(), $properties->tagMatchType);
|
||||
$filter->addTaskIdsFilter($properties->taskIds?->toArray());
|
||||
$filter->addClientIdsFilter($properties->clientIds?->toArray());
|
||||
$timeEntriesQuery = $filter->get();
|
||||
|
||||
@@ -47,6 +47,7 @@ class ReportController extends Controller
|
||||
|
||||
$reports = Report::query()
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->whereBelongsTo($organization, 'organization')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
@@ -96,6 +97,7 @@ class ReportController extends Controller
|
||||
$properties->setClientIds($request->input('properties.client_ids', null));
|
||||
$properties->setProjectIds($request->input('properties.project_ids', null));
|
||||
$properties->setTagIds($request->input('properties.tag_ids', null));
|
||||
$properties->setTagMatchType($request->getPropertyTagMatchType());
|
||||
$properties->setTaskIds($request->input('properties.task_ids', null));
|
||||
$properties->weekStart = $request->has('properties.week_start') ? Weekday::from($request->input('properties.week_start')) : $user->week_start;
|
||||
$timezone = $user->timezone;
|
||||
|
||||
@@ -42,6 +42,7 @@ class TagController extends Controller
|
||||
$tags = Tag::query()
|
||||
->whereBelongsTo($organization, 'organization')
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
return new TagCollection($tags);
|
||||
|
||||
@@ -84,6 +84,7 @@ class TaskController extends Controller
|
||||
|
||||
$tasks = $query
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('id')
|
||||
->paginate(config('app.pagination_per_page_default'));
|
||||
|
||||
return new TaskCollection($tasks);
|
||||
|
||||
@@ -67,7 +67,7 @@ class TimeEntryController extends Controller
|
||||
|
||||
$query = TimeEntry::query()
|
||||
->where('organization_id', $organization->getKey())
|
||||
->where('user_id', $member->user_id)
|
||||
->where('member_id', $member->getKey())
|
||||
->when($exclude !== null, function (Builder $q) use ($exclude): void {
|
||||
$q->where('id', '!=', $exclude->getKey());
|
||||
})
|
||||
@@ -107,8 +107,8 @@ class TimeEntryController extends Controller
|
||||
/**
|
||||
* Get time entries in organization
|
||||
*
|
||||
* If you only need time entries for a specific user, you can filter by `user_id`.
|
||||
* Users with the permission `time-entries:view:own` can only use this endpoint with their own user ID in the user_id filter.
|
||||
* If you only need time entries for a specific user, you can filter by `member_id`.
|
||||
* Users with the permission `time-entries:view:own` can only use this endpoint with their own member ID in the member_id filter.
|
||||
*
|
||||
* @return TimeEntryCollection<TimeEntryResource>
|
||||
*
|
||||
@@ -118,16 +118,17 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function index(Organization $organization, TimeEntryIndexRequest $request): JsonResource
|
||||
{
|
||||
/** @var Member|null $member */
|
||||
$member = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($member !== null && $member->user_id === Auth::id()) {
|
||||
$member = $this->member($organization);
|
||||
/** @var Member|null $memberFilter */
|
||||
$memberFilter = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($memberFilter !== null && $memberFilter->getKey() === $member->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:view:own');
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:view:all');
|
||||
}
|
||||
|
||||
$canAccessPremiumFeatures = $this->canAccessPremiumFeatures($organization);
|
||||
$timeEntriesQuery = $this->getTimeEntriesQuery($organization, $request, $member, $canAccessPremiumFeatures);
|
||||
$timeEntriesQuery = $this->getTimeEntriesQuery($organization, $request, $memberFilter, $canAccessPremiumFeatures);
|
||||
|
||||
$totalCount = $timeEntriesQuery->count();
|
||||
|
||||
@@ -158,7 +159,7 @@ class TimeEntryController extends Controller
|
||||
if ($timeEntries->count() === 0) {
|
||||
Log::warning('User has has more than '.$limit.' time entries on one date', [
|
||||
'date' => $lastDate->toDateString(),
|
||||
'user_id' => $request->input('user_id'),
|
||||
'member_id' => $request->input('member_id'),
|
||||
'auth_user_id' => Auth::id(),
|
||||
'limit' => $limit,
|
||||
]);
|
||||
@@ -194,7 +195,8 @@ class TimeEntryController extends Controller
|
||||
$timeEntriesQuery = TimeEntry::query()
|
||||
->whereBelongsTo($organization, 'organization')
|
||||
->select($select)
|
||||
->orderBy('start', 'desc');
|
||||
->orderBy('time_entries.start', 'desc')
|
||||
->orderBy('time_entries.id');
|
||||
|
||||
$filter = new TimeEntryFilter($timeEntriesQuery);
|
||||
$filter->addStartFilter($request->input('start'));
|
||||
@@ -203,7 +205,7 @@ class TimeEntryController extends Controller
|
||||
$filter->addMemberIdFilter($member);
|
||||
$filter->addMemberIdsFilter($request->input('member_ids'));
|
||||
$filter->addProjectIdsFilter($request->input('project_ids'));
|
||||
$filter->addTagIdsFilter($request->input('tag_ids'));
|
||||
$filter->addTagIdsFilter($request->input('tag_ids'), $request->getTagMatchType());
|
||||
$filter->addTaskIdsFilter($request->input('task_ids'));
|
||||
$filter->addClientIdsFilter($request->input('client_ids'));
|
||||
$filter->addBillableFilter($request->input('billable'));
|
||||
@@ -220,9 +222,10 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function indexExport(Organization $organization, TimeEntryIndexExportRequest $request, TimeEntryAggregationService $timeEntryAggregationService): JsonResponse
|
||||
{
|
||||
/** @var Member|null $member */
|
||||
$member = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($member !== null && $member->user_id === Auth::id()) {
|
||||
$member = $this->member($organization);
|
||||
/** @var Member|null $memberFilter */
|
||||
$memberFilter = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($memberFilter !== null && $memberFilter->getKey() === $member->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:view:own');
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:view:all');
|
||||
@@ -239,7 +242,7 @@ class TimeEntryController extends Controller
|
||||
$roundingType = $canAccessPremiumFeatures ? $request->getRoundingType() : null;
|
||||
$roundingMinutes = $canAccessPremiumFeatures ? $request->getRoundingMinutes() : null;
|
||||
|
||||
$timeEntriesQuery = $this->getTimeEntriesQuery($organization, $request, $member, $canAccessPremiumFeatures);
|
||||
$timeEntriesQuery = $this->getTimeEntriesQuery($organization, $request, $memberFilter, $canAccessPremiumFeatures);
|
||||
$timeEntriesQuery->with([
|
||||
'task',
|
||||
'client',
|
||||
@@ -262,7 +265,7 @@ class TimeEntryController extends Controller
|
||||
if ($viewFile === false) {
|
||||
throw new \LogicException('View file not found');
|
||||
}
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $member);
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $memberFilter);
|
||||
$aggregatedData = $timeEntryAggregationService->getAggregatedTimeEntries(
|
||||
$timeEntriesAggregateQuery,
|
||||
null,
|
||||
@@ -369,9 +372,10 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function aggregate(Organization $organization, TimeEntryAggregateRequest $request, TimeEntryAggregationService $timeEntryAggregationService): array
|
||||
{
|
||||
/** @var Member|null $member */
|
||||
$member = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($member !== null && $member->user_id === Auth::id()) {
|
||||
$member = $this->member($organization);
|
||||
/** @var Member|null $memberFilter */
|
||||
$memberFilter = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($memberFilter !== null && $memberFilter->getKey() === $member->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:view:own');
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:view:all');
|
||||
@@ -382,7 +386,7 @@ class TimeEntryController extends Controller
|
||||
|
||||
$group1Type = $request->getGroup();
|
||||
$group2Type = $request->getSubGroup();
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $member);
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $memberFilter);
|
||||
$roundingType = $canAccessPremiumFeatures ? $request->getRoundingType() : null;
|
||||
$roundingMinutes = $canAccessPremiumFeatures ? $request->getRoundingMinutes() : null;
|
||||
|
||||
@@ -418,9 +422,10 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function aggregateExport(Organization $organization, TimeEntryAggregateExportRequest $request, TimeEntryAggregationService $timeEntryAggregationService): JsonResponse
|
||||
{
|
||||
/** @var Member|null $member */
|
||||
$member = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($member !== null && $member->user_id === Auth::id()) {
|
||||
$member = $this->member($organization);
|
||||
/** @var Member|null $memberFilter */
|
||||
$memberFilter = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($memberFilter !== null && $memberFilter->getKey() === $member->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:view:own');
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:view:all');
|
||||
@@ -436,7 +441,7 @@ class TimeEntryController extends Controller
|
||||
|
||||
$group = $request->getGroup();
|
||||
$subGroup = $request->getSubGroup();
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $member);
|
||||
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $memberFilter);
|
||||
$roundingType = $canAccessPremiumFeatures ? $request->getRoundingType() : null;
|
||||
$roundingMinutes = $canAccessPremiumFeatures ? $request->getRoundingMinutes() : null;
|
||||
|
||||
@@ -559,7 +564,7 @@ class TimeEntryController extends Controller
|
||||
$filter->addMemberIdFilter($member);
|
||||
$filter->addMemberIdsFilter($request->input('member_ids'));
|
||||
$filter->addProjectIdsFilter($request->input('project_ids'));
|
||||
$filter->addTagIdsFilter($request->input('tag_ids'));
|
||||
$filter->addTagIdsFilter($request->input('tag_ids'), $request->getTagMatchType());
|
||||
$filter->addTaskIdsFilter($request->input('task_ids'));
|
||||
$filter->addClientIdsFilter($request->input('client_ids'));
|
||||
$filter->addBillableFilter($request->input('billable'));
|
||||
@@ -579,7 +584,7 @@ class TimeEntryController extends Controller
|
||||
{
|
||||
/** @var Member $member */
|
||||
$member = Member::query()->findOrFail($request->input('member_id'));
|
||||
if ($member->user_id === Auth::id()) {
|
||||
if ($member->getKey() === $this->member($organization)->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:create:own');
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:create:all');
|
||||
@@ -626,9 +631,10 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function update(Organization $organization, TimeEntry $timeEntry, TimeEntryUpdateRequest $request): JsonResource
|
||||
{
|
||||
/** @var Member|null $member */
|
||||
$member = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($timeEntry->member->user_id === Auth::id() && ($member === null || $member->user_id === Auth::id())) {
|
||||
$member = $this->member($organization);
|
||||
/** @var Member|null $newMember */
|
||||
$newMember = $request->has('member_id') ? Member::query()->findOrFail($request->input('member_id')) : null;
|
||||
if ($timeEntry->member_id === $member->getKey() && ($newMember === null || $newMember->getKey() === $member->getKey())) {
|
||||
$this->checkPermission($organization, 'time-entries:update:own', $timeEntry);
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:update:all', $timeEntry);
|
||||
@@ -660,6 +666,10 @@ class TimeEntryController extends Controller
|
||||
}
|
||||
|
||||
$timeEntry->fill($request->validated());
|
||||
if ($newMember !== null) {
|
||||
$timeEntry->member()->associate($newMember);
|
||||
$timeEntry->user()->associate($newMember->user);
|
||||
}
|
||||
$timeEntry->description = $request->input('description', $timeEntry->description) ?? '';
|
||||
$timeEntry->setComputedAttributeValue('billable_rate');
|
||||
$timeEntry->save();
|
||||
@@ -689,6 +699,7 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function updateMultiple(Organization $organization, TimeEntryUpdateMultipleRequest $request): JsonResponse
|
||||
{
|
||||
$member = $this->member($organization);
|
||||
$this->checkAnyPermission($organization, ['time-entries:update:all', 'time-entries:update:own']);
|
||||
$canAccessAll = $this->hasPermission($organization, 'time-entries:update:all');
|
||||
|
||||
@@ -713,6 +724,9 @@ class TimeEntryController extends Controller
|
||||
throw new AuthorizationException;
|
||||
}
|
||||
|
||||
/** @var Member|null $newMember */
|
||||
$newMember = isset($changes['member_id']) ? Member::query()->findOrFail($changes['member_id']) : null;
|
||||
|
||||
$project = null;
|
||||
$client = null;
|
||||
$overwriteClient = false;
|
||||
@@ -739,7 +753,7 @@ class TimeEntryController extends Controller
|
||||
|
||||
continue;
|
||||
}
|
||||
if (! $canAccessAll && $timeEntry->user_id !== Auth::id()) {
|
||||
if (! $canAccessAll && $timeEntry->member_id !== $member->getKey()) {
|
||||
$error->push($id);
|
||||
|
||||
continue;
|
||||
@@ -749,6 +763,10 @@ class TimeEntryController extends Controller
|
||||
$oldTask = $timeEntry->task;
|
||||
|
||||
$timeEntry->fill($changes);
|
||||
if ($newMember !== null) {
|
||||
$timeEntry->member()->associate($newMember);
|
||||
$timeEntry->user_id = $newMember->user_id;
|
||||
}
|
||||
// If project is changed, but task is not, we remove the old task from the time entry
|
||||
if ($oldProject !== null && $project !== null && $oldProject->isNot($project) && $task === null) {
|
||||
$timeEntry->task()->disassociate();
|
||||
@@ -789,7 +807,8 @@ class TimeEntryController extends Controller
|
||||
*/
|
||||
public function destroy(Organization $organization, TimeEntry $timeEntry): JsonResponse
|
||||
{
|
||||
if ($timeEntry->member->user_id === Auth::id()) {
|
||||
$member = $this->member($organization);
|
||||
if ($timeEntry->member_id === $member->getKey()) {
|
||||
$this->checkPermission($organization, 'time-entries:delete:own', $timeEntry);
|
||||
} else {
|
||||
$this->checkPermission($organization, 'time-entries:delete:all', $timeEntry);
|
||||
@@ -846,7 +865,7 @@ class TimeEntryController extends Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $canDeleteAll && $timeEntry->user_id !== Auth::id()) {
|
||||
if (! $canDeleteAll && $timeEntry->member_id !== $this->member($organization)->getKey()) {
|
||||
$error->push($id);
|
||||
|
||||
continue;
|
||||
|
||||
@@ -25,7 +25,7 @@ class InvitationStoreRequest extends BaseFormRequest
|
||||
return [
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'email:rfc,strict',
|
||||
],
|
||||
'role' => [
|
||||
'required',
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\Report;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
@@ -124,6 +125,11 @@ class ReportStoreRequest extends BaseFormRequest
|
||||
}
|
||||
},
|
||||
],
|
||||
'properties.tag_match_type' => [
|
||||
'nullable',
|
||||
'string',
|
||||
Rule::enum(TagMatchType::class),
|
||||
],
|
||||
'properties.task_ids' => [
|
||||
'nullable',
|
||||
'array',
|
||||
@@ -249,6 +255,15 @@ class ReportStoreRequest extends BaseFormRequest
|
||||
return TimeEntryAggregationTypeInterval::from($this->input('properties.history_group'));
|
||||
}
|
||||
|
||||
public function getPropertyTagMatchType(): ?TagMatchType
|
||||
{
|
||||
if (! $this->has('properties.tag_match_type') || $this->input('properties.tag_match_type') === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return TagMatchType::from($this->input('properties.tag_match_type'));
|
||||
}
|
||||
|
||||
public function getPropertyRoundingType(): ?TimeEntryRoundingType
|
||||
{
|
||||
if (! $this->has('properties.rounding_type') || $this->input('properties.rounding_type') === null) {
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Http\Requests\V1\TimeEntry;
|
||||
|
||||
use App\Enums\ExportFormat;
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
@@ -139,6 +140,10 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
|
||||
})->uuid()->validate($attribute, $value, $fail);
|
||||
},
|
||||
],
|
||||
'tag_match_type' => [
|
||||
'string',
|
||||
Rule::enum(TagMatchType::class),
|
||||
],
|
||||
// Filter by task IDs, task IDs are OR combined
|
||||
'task_ids' => [
|
||||
'array',
|
||||
@@ -246,6 +251,15 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
|
||||
return ExportFormat::from($this->validated('format'));
|
||||
}
|
||||
|
||||
public function getTagMatchType(): ?TagMatchType
|
||||
{
|
||||
if (! $this->has('tag_match_type') || $this->validated('tag_match_type') === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return TagMatchType::from($this->validated('tag_match_type'));
|
||||
}
|
||||
|
||||
public function getRoundingType(): ?TimeEntryRoundingType
|
||||
{
|
||||
if (! $this->has('rounding_type') || $this->validated('rounding_type') === null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\TimeEntry;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
use App\Http\Requests\V1\BaseFormRequest;
|
||||
@@ -125,6 +126,10 @@ class TimeEntryAggregateRequest extends BaseFormRequest
|
||||
})->uuid()->validate($attribute, $value, $fail);
|
||||
},
|
||||
],
|
||||
'tag_match_type' => [
|
||||
'string',
|
||||
Rule::enum(TagMatchType::class),
|
||||
],
|
||||
// Filter by task IDs, task IDs are OR combined
|
||||
'task_ids' => [
|
||||
'array',
|
||||
@@ -208,6 +213,15 @@ class TimeEntryAggregateRequest extends BaseFormRequest
|
||||
return $this->input('end') !== null ? Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('end'), 'UTC') : null;
|
||||
}
|
||||
|
||||
public function getTagMatchType(): ?TagMatchType
|
||||
{
|
||||
if (! $this->has('tag_match_type') || $this->validated('tag_match_type') === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return TagMatchType::from($this->validated('tag_match_type'));
|
||||
}
|
||||
|
||||
public function getRoundingType(): ?TimeEntryRoundingType
|
||||
{
|
||||
if (! $this->has('rounding_type') || $this->validated('rounding_type') === null) {
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Http\Requests\V1\TimeEntry;
|
||||
|
||||
use App\Enums\ExportFormat;
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
use App\Models\Client;
|
||||
use App\Models\Member;
|
||||
@@ -110,6 +111,10 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
|
||||
})->uuid()->validate($attribute, $value, $fail);
|
||||
},
|
||||
],
|
||||
'tag_match_type' => [
|
||||
'string',
|
||||
Rule::enum(TagMatchType::class),
|
||||
],
|
||||
// Filter by task IDs, task IDs are OR combined
|
||||
'task_ids' => [
|
||||
'array',
|
||||
@@ -215,6 +220,15 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
|
||||
return ExportFormat::from($this->validated('format'));
|
||||
}
|
||||
|
||||
public function getTagMatchType(): ?TagMatchType
|
||||
{
|
||||
if (! $this->has('tag_match_type') || $this->validated('tag_match_type') === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return TagMatchType::from($this->validated('tag_match_type'));
|
||||
}
|
||||
|
||||
public function getRoundingType(): ?TimeEntryRoundingType
|
||||
{
|
||||
if (! $this->has('rounding_type') || $this->validated('rounding_type') === null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\TimeEntry;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
use App\Http\Requests\V1\BaseFormRequest;
|
||||
use App\Models\Client;
|
||||
@@ -103,6 +104,10 @@ class TimeEntryIndexRequest extends BaseFormRequest
|
||||
})->uuid()->validate($attribute, $value, $fail);
|
||||
},
|
||||
],
|
||||
'tag_match_type' => [
|
||||
'string',
|
||||
Rule::enum(TagMatchType::class),
|
||||
],
|
||||
// Filter by task IDs, task IDs are OR combined
|
||||
'task_ids' => [
|
||||
'array',
|
||||
@@ -190,6 +195,15 @@ class TimeEntryIndexRequest extends BaseFormRequest
|
||||
return $this->has('offset') ? (int) $this->validated('offset', 0) : 0;
|
||||
}
|
||||
|
||||
public function getTagMatchType(): ?TagMatchType
|
||||
{
|
||||
if (! $this->has('tag_match_type') || $this->validated('tag_match_type') === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return TagMatchType::from($this->validated('tag_match_type'));
|
||||
}
|
||||
|
||||
public function getRoundingType(): ?TimeEntryRoundingType
|
||||
{
|
||||
if (! $this->has('rounding_type') || $this->validated('rounding_type') === null) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class UserUpdateRequest extends BaseFormRequest
|
||||
'max:255',
|
||||
],
|
||||
'email' => [
|
||||
'email',
|
||||
'email:rfc,strict',
|
||||
'max:255',
|
||||
UniqueEloquent::make(User::class, 'email')->ignore($this->user->id)->query(function (Builder $query) {
|
||||
/** @var Builder<User> $query */
|
||||
|
||||
@@ -56,6 +56,8 @@ class DetailedReportResource extends BaseResource
|
||||
'project_ids' => $this->resource->properties->projectIds?->toArray(),
|
||||
/** @var array<string>|null $tags_ids Filter by tag IDs, tag IDs are OR combined */
|
||||
'tag_ids' => $this->resource->properties->tagIds?->toArray(),
|
||||
/** @var string|null $tag_match_type Tag match type */
|
||||
'tag_match_type' => $this->resource->properties->tagMatchType?->value,
|
||||
/** @var array<string>|null $task_ids Filter by task IDs, task IDs are OR combined */
|
||||
'task_ids' => $this->resource->properties->taskIds?->toArray(),
|
||||
/** @var string|null $rounding_type Rounding type for time entries */
|
||||
|
||||
@@ -20,6 +20,11 @@ class RecalculateSpentTimeForProject implements ShouldDispatchAfterCommit, Shoul
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Delete the job if its models no longer exist.
|
||||
*/
|
||||
public bool $deleteWhenMissingModels = true;
|
||||
|
||||
public Project $project;
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,11 @@ class RecalculateSpentTimeForTask implements ShouldDispatchAfterCommit, ShouldQu
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Delete the job if its models no longer exist.
|
||||
*/
|
||||
public bool $deleteWhenMissingModels = true;
|
||||
|
||||
public Task $task;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Dto;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
@@ -56,6 +57,8 @@ class ReportPropertiesDto implements Castable
|
||||
*/
|
||||
public ?Collection $tagIds = null;
|
||||
|
||||
public ?TagMatchType $tagMatchType = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, string>|null
|
||||
*/
|
||||
@@ -115,6 +118,7 @@ class ReportPropertiesDto implements Castable
|
||||
$dto->clientIds = $data->clientIds !== null ? ReportPropertiesDto::idArrayToCollection($data->clientIds) : null;
|
||||
$dto->projectIds = $data->projectIds !== null ? ReportPropertiesDto::idArrayToCollection($data->projectIds) : null;
|
||||
$dto->tagIds = $data->tagIds !== null ? ReportPropertiesDto::idArrayToCollection($data->tagIds) : null;
|
||||
$dto->tagMatchType = isset($data->tagMatchType) ? TagMatchType::from($data->tagMatchType) : null;
|
||||
$dto->taskIds = $data->taskIds ? ReportPropertiesDto::idArrayToCollection($data->taskIds) : null;
|
||||
$dto->group = TimeEntryAggregationType::from($data->group);
|
||||
$dto->subGroup = TimeEntryAggregationType::from($data->subGroup);
|
||||
@@ -144,6 +148,7 @@ class ReportPropertiesDto implements Castable
|
||||
'clientIds' => $value->clientIds?->toArray(),
|
||||
'projectIds' => $value->projectIds?->toArray(),
|
||||
'tagIds' => $value->tagIds?->toArray(),
|
||||
'tagMatchType' => $value->tagMatchType?->value,
|
||||
'taskIds' => $value->taskIds?->toArray(),
|
||||
'group' => $value->group->value,
|
||||
'subGroup' => $value->subGroup->value,
|
||||
@@ -216,6 +221,11 @@ class ReportPropertiesDto implements Castable
|
||||
$this->tagIds = $tagIds !== null ? ReportPropertiesDto::idArrayToCollection($tagIds) : null;
|
||||
}
|
||||
|
||||
public function setTagMatchType(?TagMatchType $tagMatchType): void
|
||||
{
|
||||
$this->tagMatchType = $tagMatchType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed>|null $taskIds
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Service\Import\Importers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use League\Csv\Exception as CsvException;
|
||||
use League\Csv\Reader;
|
||||
@@ -24,10 +25,12 @@ class ClockifyProjectsImporter extends DefaultImporter
|
||||
$header = $reader->getHeader();
|
||||
$this->validateHeader($header);
|
||||
$billableRateKey = $this->getBillableRateKey($header);
|
||||
$tasksKey = $this->getTasksKey($header);
|
||||
$records = $reader->getRecords();
|
||||
foreach ($records as $record) {
|
||||
$clientId = null;
|
||||
if ($record['Client'] !== '') {
|
||||
// Newer Clockify exports no longer contain a "Client" column.
|
||||
if (($record['Client'] ?? '') !== '') {
|
||||
$clientId = $this->clientImportHelper->getKey([
|
||||
'name' => $record['Client'],
|
||||
'organization_id' => $this->organization->id,
|
||||
@@ -43,12 +46,13 @@ class ClockifyProjectsImporter extends DefaultImporter
|
||||
'color' => $this->colorService->getRandomColor(),
|
||||
'is_billable' => $record['Billability'] === 'Yes',
|
||||
'billable_rate' => $billableRateKey !== null && $record[$billableRateKey] !== '' ? (int) (((float) $record[$billableRateKey]) * 100) : null,
|
||||
'estimated_time' => $record['Estimated (h)'] !== '' && is_numeric($record['Estimated (h)']) ? (int) ($record['Estimated (h)'] * 3600) : null,
|
||||
'estimated_time' => isset($record['Estimated (h)']) && is_numeric($record['Estimated (h)']) ? (int) ($record['Estimated (h)'] * 3600) : null,
|
||||
'archived_at' => $record['Status'] === 'Archived' ? Carbon::now() : null,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($record['Task'] !== '') {
|
||||
$tasks = explode(', ', $record['Task']);
|
||||
if ($tasksKey !== null && $record[$tasksKey] !== '') {
|
||||
$tasks = explode(', ', $record[$tasksKey]);
|
||||
foreach ($tasks as $task) {
|
||||
$this->taskImportHelper->getKey([
|
||||
'name' => $task,
|
||||
@@ -77,17 +81,36 @@ class ClockifyProjectsImporter extends DefaultImporter
|
||||
{
|
||||
$requiredFields = [
|
||||
'Project',
|
||||
'Client',
|
||||
'Status',
|
||||
'Visibility',
|
||||
'Billability',
|
||||
'Task',
|
||||
];
|
||||
foreach ($requiredFields as $requiredField) {
|
||||
if (! in_array($requiredField, $header, true)) {
|
||||
throw new ImportException('Invalid CSV header, missing field: '.$requiredField);
|
||||
}
|
||||
}
|
||||
// Clockify names the tasks column "Task", "Tasks" or "Activities" depending on the export; accept any.
|
||||
if ($this->getTasksKey($header) === null) {
|
||||
throw new ImportException('Invalid CSV header, missing field: Tasks');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clockify names the tasks column differently depending on the export
|
||||
* version: "Task" (older), "Tasks" (newer) or "Activities".
|
||||
*
|
||||
* @param array<string> $header
|
||||
*/
|
||||
private function getTasksKey(array $header): ?string
|
||||
{
|
||||
foreach (['Tasks', 'Task', 'Activities'] as $field) {
|
||||
if (in_array($field, $header, true)) {
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,7 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
$reader->setEscape('');
|
||||
$header = $reader->getHeader();
|
||||
$this->validateHeader($header);
|
||||
$taskKey = $this->getTaskKey($header);
|
||||
$records = $reader->getRecords();
|
||||
foreach ($records as $record) {
|
||||
$userId = $this->userImportHelper->getKey([
|
||||
@@ -71,7 +72,7 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
]);
|
||||
$member = $this->memberImportHelper->getModelById($memberId);
|
||||
$clientId = null;
|
||||
if ($record['Client'] !== '') {
|
||||
if (($record['Client'] ?? '') !== '') {
|
||||
$clientId = $this->clientImportHelper->getKey([
|
||||
'name' => $record['Client'],
|
||||
'organization_id' => $this->organization->id,
|
||||
@@ -96,9 +97,9 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
]);
|
||||
}
|
||||
$taskId = null;
|
||||
if ($record['Task'] !== '') {
|
||||
if ($taskKey !== null && $record[$taskKey] !== '') {
|
||||
$taskId = $this->taskImportHelper->getKey([
|
||||
'name' => $record['Task'],
|
||||
'name' => $record[$taskKey],
|
||||
'project_id' => $projectId,
|
||||
'organization_id' => $this->organization->id,
|
||||
]);
|
||||
@@ -116,10 +117,12 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
throw new ImportException('Time entry description is too long');
|
||||
}
|
||||
$timeEntry->description = $record['Description'];
|
||||
if (! in_array($record['Billable'], ['Yes', 'No'], true)) {
|
||||
throw new ImportException('Invalid billable value');
|
||||
if (isset($record['Billable'])) {
|
||||
if (! in_array($record['Billable'], ['Yes', 'No'], true)) {
|
||||
throw new ImportException('Invalid billable value');
|
||||
}
|
||||
$timeEntry->billable = $record['Billable'] === 'Yes';
|
||||
}
|
||||
$timeEntry->billable = $record['Billable'] === 'Yes';
|
||||
$timeEntry->tags = $this->getTags($record['Tags']);
|
||||
$timeEntry->is_imported = true;
|
||||
|
||||
@@ -212,14 +215,11 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
{
|
||||
$requiredFields = [
|
||||
'Project',
|
||||
'Client',
|
||||
'Description',
|
||||
'Task',
|
||||
'User',
|
||||
'Group',
|
||||
'Email',
|
||||
'Tags',
|
||||
'Billable',
|
||||
'Start Date',
|
||||
'Start Time',
|
||||
'End Date',
|
||||
@@ -230,6 +230,26 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
throw new ImportException('Invalid CSV header, missing field: '.$requiredField);
|
||||
}
|
||||
}
|
||||
// Clockify names the task column "Task" or "Activity" depending on the export; accept either.
|
||||
if ($this->getTaskKey($header) === null) {
|
||||
throw new ImportException('Invalid CSV header, missing field: Task');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clockify names the task column "Task" or "Activity" depending on the export version.
|
||||
*
|
||||
* @param array<string> $header
|
||||
*/
|
||||
private function getTaskKey(array $header): ?string
|
||||
{
|
||||
foreach (['Task', 'Activity'] as $field) {
|
||||
if (in_array($field, $header, true)) {
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
|
||||
@@ -171,7 +171,7 @@ abstract class DefaultImporter implements ImporterContract
|
||||
}, validate: [
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'email:rfc,strict',
|
||||
'max:255',
|
||||
],
|
||||
]);
|
||||
|
||||
@@ -123,6 +123,7 @@ class TogglDataImporter extends DefaultImporter
|
||||
}
|
||||
|
||||
foreach ($projects as $project) {
|
||||
$projectExternalId = $this->guardExternalIdentifier($project->id);
|
||||
$clientId = null;
|
||||
if ($project->client_id !== null) {
|
||||
$clientId = $this->clientImportHelper->getKeyByExternalIdentifier((string) $project->client_id);
|
||||
@@ -146,16 +147,16 @@ class TogglDataImporter extends DefaultImporter
|
||||
'billable_rate' => $project->rate !== null ? (int) ($project->rate * 100) : null,
|
||||
], (string) $project->id);
|
||||
|
||||
if (! file_exists($temporaryDirectory->path('projects_users/'.$project->id.'.json'))) {
|
||||
throw new ImportException('File "projects_users/'.$project->id.'.json" missing in ZIP');
|
||||
if (! file_exists($temporaryDirectory->path('projects_users/'.$projectExternalId.'.json'))) {
|
||||
throw new ImportException('File "projects_users/'.$projectExternalId.'.json" missing in ZIP');
|
||||
}
|
||||
$projectMembersFileContent = file_get_contents($temporaryDirectory->path('projects_users/'.$project->id.'.json'));
|
||||
$projectMembersFileContent = file_get_contents($temporaryDirectory->path('projects_users/'.$projectExternalId.'.json'));
|
||||
if ($projectMembersFileContent === false) {
|
||||
throw new ImportException('File "projects_users/'.$project->id.'.json" can not be opened');
|
||||
throw new ImportException('File "projects_users/'.$projectExternalId.'.json" can not be opened');
|
||||
}
|
||||
$projectMembers = json_decode($projectMembersFileContent);
|
||||
if ($projectMembers === null) {
|
||||
throw new ImportException('File "projects_users/'.$project->id.'.json" is empty');
|
||||
throw new ImportException('File "projects_users/'.$projectExternalId.'.json" is empty');
|
||||
}
|
||||
foreach ($projectMembers as $projectMember) {
|
||||
$userId = $this->userImportHelper->getKeyByExternalIdentifier((string) $projectMember->user_id);
|
||||
@@ -170,6 +171,7 @@ class TogglDataImporter extends DefaultImporter
|
||||
}
|
||||
$projectIds = $this->projectImportHelper->getExternalIds();
|
||||
foreach ($projectIds as $projectIdExternal) {
|
||||
$projectIdExternal = $this->guardExternalIdentifier($projectIdExternal);
|
||||
if (! file_exists($temporaryDirectory->path('tasks/'.$projectIdExternal.'.json'))) {
|
||||
continue;
|
||||
}
|
||||
@@ -209,6 +211,30 @@ class TogglDataImporter extends DefaultImporter
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure an externally-sourced identifier can be safely used inside a
|
||||
* filesystem path. The identifiers originate from the untrusted uploaded
|
||||
* ZIP, and Spatie's TemporaryDirectory::path() auto-creates any missing
|
||||
* parent directory of the resolved path, so an unfiltered "../" sequence
|
||||
* would escape the import sandbox and create/probe arbitrary paths on the
|
||||
* host (CWE-22). Toggl identifiers are numeric, so restricting them to a
|
||||
* conservative allow-list rejects traversal without affecting real data.
|
||||
*
|
||||
* @throws ImportException
|
||||
*/
|
||||
private function guardExternalIdentifier(mixed $id): string
|
||||
{
|
||||
if (! is_string($id) && ! is_int($id)) {
|
||||
throw new ImportException('Invalid identifier in import data');
|
||||
}
|
||||
$id = (string) $id;
|
||||
if (preg_match('/^[A-Za-z0-9_-]+$/', $id) !== 1) {
|
||||
throw new ImportException('Invalid identifier in import data');
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function getName(): string
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Models\Member;
|
||||
use App\Models\TimeEntry;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -192,15 +193,21 @@ class TimeEntryFilter
|
||||
/**
|
||||
* @param array<string>|null $tagIds
|
||||
*/
|
||||
public function addTagIdsFilter(?array $tagIds): self
|
||||
public function addTagIdsFilter(?array $tagIds, ?TagMatchType $tagMatchType = TagMatchType::Contains): self
|
||||
{
|
||||
if ($tagIds === null) {
|
||||
return $this;
|
||||
}
|
||||
$tagMatchType ??= TagMatchType::Contains;
|
||||
$includeNone = in_array(self::NONE_VALUE, $tagIds, true);
|
||||
$tagIds = array_values(array_filter($tagIds, fn (string $id): bool => $id !== self::NONE_VALUE));
|
||||
// An empty selection (no tag IDs and not filtering for "none") is no constraint, so apply nothing.
|
||||
// This also prevents the not-contains branch from collapsing into "only entries with null tags".
|
||||
if (count($tagIds) === 0 && ! $includeNone) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->builder->where(function (Builder $builder) use ($tagIds, $includeNone): void {
|
||||
$tagCondition = function (Builder $builder) use ($tagIds, $includeNone): void {
|
||||
foreach ($tagIds as $tagId) {
|
||||
$builder->orWhereJsonContains('tags', $tagId);
|
||||
}
|
||||
@@ -209,7 +216,18 @@ class TimeEntryFilter
|
||||
$query->whereJsonLength('tags', 0)->orWhereNull('tags');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if ($tagMatchType === TagMatchType::NotContains) {
|
||||
$this->builder->where(function (Builder $builder) use ($tagCondition, $includeNone): void {
|
||||
$builder->whereNot($tagCondition);
|
||||
if (! $includeNone) {
|
||||
$builder->orWhereNull('tags');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$this->builder->where($tagCondition);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
328
composer.lock
generated
328
composer.lock
generated
@@ -3020,26 +3020,25 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "7.12.1",
|
||||
"version": "7.10.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425"
|
||||
"reference": "47ba23c7a55247e2e1b7407aca90e9bbed0d9d86"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d34627490fbc03bf5c5d7cfed81f2faa19519425",
|
||||
"reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/47ba23c7a55247e2e1b7407aca90e9bbed0d9d86",
|
||||
"reference": "47ba23c7a55247e2e1b7407aca90e9bbed0d9d86",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/promises": "^2.5",
|
||||
"guzzlehttp/psr7": "^2.12.1",
|
||||
"guzzlehttp/promises": "^2.3",
|
||||
"guzzlehttp/psr7": "^2.8",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
"symfony/deprecation-contracts": "^2.2 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-client-implementation": "1.0"
|
||||
@@ -3048,7 +3047,7 @@
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"ext-curl": "*",
|
||||
"guzzle/client-integration-tests": "3.0.2",
|
||||
"guzzlehttp/test-server": "^0.5.1",
|
||||
"guzzlehttp/test-server": "^0.3.2",
|
||||
"php-http/message-factory": "^1.1",
|
||||
"phpunit/phpunit": "^8.5.52 || ^9.6.34",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0"
|
||||
@@ -3128,7 +3127,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/guzzle/issues",
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.12.1"
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.10.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3144,25 +3143,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T14:12:49+00:00"
|
||||
"time": "2026-05-20T22:59:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "2.5.0",
|
||||
"version": "2.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "4360e982f87f5f258bf872d094647791db2f4c8e"
|
||||
"reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/4360e982f87f5f258bf872d094647791db2f4c8e",
|
||||
"reference": "4360e982f87f5f258bf872d094647791db2f4c8e",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/09e8a212562fb1fb6a512c4156ed71525969d6c2",
|
||||
"reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0"
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
@@ -3212,7 +3210,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/promises/issues",
|
||||
"source": "https://github.com/guzzle/promises/tree/2.5.0"
|
||||
"source": "https://github.com/guzzle/promises/tree/2.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3228,29 +3226,27 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-02T12:23:43+00:00"
|
||||
"time": "2026-05-20T22:57:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "2.12.1",
|
||||
"version": "2.10.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7"
|
||||
"reference": "73ab136360b5dfd858006eae9795e8fe43c80361"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7",
|
||||
"reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/73ab136360b5dfd858006eae9795e8fe43c80361",
|
||||
"reference": "73ab136360b5dfd858006eae9795e8fe43c80361",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.1 || ^2.0",
|
||||
"ralouphie/getallheaders": "^3.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
"ralouphie/getallheaders": "^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-factory-implementation": "1.0",
|
||||
@@ -3331,7 +3327,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/psr7/issues",
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.12.1"
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.10.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3347,20 +3343,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T09:49:37+00:00"
|
||||
"time": "2026-05-20T09:27:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/uri-template",
|
||||
"version": "v1.0.7",
|
||||
"version": "v1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/uri-template.git",
|
||||
"reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529"
|
||||
"reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/7fe811c23a9e3cd712b4389eaeb50b5456d8c529",
|
||||
"reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529",
|
||||
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/4f4bbd4e7172148801e76e3decc1e559bdee34e1",
|
||||
"reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3369,7 +3365,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.52 || ^9.6.34",
|
||||
"phpunit/phpunit": "^8.5.44 || ^9.6.25",
|
||||
"uri-template/tests": "1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
@@ -3417,7 +3413,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/uri-template/issues",
|
||||
"source": "https://github.com/guzzle/uri-template/tree/v1.0.7"
|
||||
"source": "https://github.com/guzzle/uri-template/tree/v1.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3433,7 +3429,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-12T21:33:43+00:00"
|
||||
"time": "2025-08-22T14:27:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "inertiajs/inertia-laravel",
|
||||
@@ -4197,16 +4193,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v12.61.1",
|
||||
"version": "v12.60.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d"
|
||||
"reference": "b8b55ce32175cc00f834a56eeb6316f18ed6ea39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/b8b55ce32175cc00f834a56eeb6316f18ed6ea39",
|
||||
"reference": "b8b55ce32175cc00f834a56eeb6316f18ed6ea39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4415,7 +4411,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2026-06-04T14:22:52+00:00"
|
||||
"time": "2026-05-20T11:48:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/octane",
|
||||
@@ -6676,16 +6672,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.13.0",
|
||||
"version": "3.11.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CarbonPHP/carbon.git",
|
||||
"reference": "40f6618f052df16b545f626fbf9a878e6497d16a"
|
||||
"reference": "e890471a3494740f7d9326d72ce6a8c559ffee60"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/40f6618f052df16b545f626fbf9a878e6497d16a",
|
||||
"reference": "40f6618f052df16b545f626fbf9a878e6497d16a",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/e890471a3494740f7d9326d72ce6a8c559ffee60",
|
||||
"reference": "e890471a3494740f7d9326d72ce6a8c559ffee60",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6777,7 +6773,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T13:49:15+00:00"
|
||||
"time": "2026-04-07T09:57:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/schema",
|
||||
@@ -7796,16 +7792,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpspreadsheet",
|
||||
"version": "1.30.5",
|
||||
"version": "1.30.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
|
||||
"reference": "97bcabd32a64924688487dcd64aceaf158affb5c"
|
||||
"reference": "02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/97bcabd32a64924688487dcd64aceaf158affb5c",
|
||||
"reference": "97bcabd32a64924688487dcd64aceaf158affb5c",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9",
|
||||
"reference": "02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -7898,9 +7894,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.5"
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.4"
|
||||
},
|
||||
"time": "2026-05-31T05:13:11+00:00"
|
||||
"time": "2026-04-19T06:00:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
@@ -7979,16 +7975,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "3.0.55",
|
||||
"version": "3.0.52",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "db9744e6d47e742b1f974e965ad49bdd041105af"
|
||||
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db9744e6d47e742b1f974e965ad49bdd041105af",
|
||||
"reference": "db9744e6d47e742b1f974e965ad49bdd041105af",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2adaefc83df2ec548558307690f376dd7d4f4fce",
|
||||
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8069,7 +8065,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpseclib/phpseclib/issues",
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.55"
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.52"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8085,7 +8081,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-14T23:24:10+00:00"
|
||||
"time": "2026-04-27T07:02:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
@@ -9023,20 +9019,20 @@
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "4.9.3",
|
||||
"version": "4.9.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/uuid.git",
|
||||
"reference": "1df15849d00943a67d677dc9cfd80795f038c9f8"
|
||||
"reference": "8429c78ca35a09f27565311b98101e2826affde0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/1df15849d00943a67d677dc9cfd80795f038c9f8",
|
||||
"reference": "1df15849d00943a67d677dc9cfd80795f038c9f8",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0",
|
||||
"reference": "8429c78ca35a09f27565311b98101e2826affde0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"brick/math": ">=0.8.16 <=0.18",
|
||||
"brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
|
||||
"php": "^8.0",
|
||||
"ramsey/collection": "^1.2 || ^2.0"
|
||||
},
|
||||
@@ -9095,9 +9091,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ramsey/uuid/issues",
|
||||
"source": "https://github.com/ramsey/uuid/tree/4.9.3"
|
||||
"source": "https://github.com/ramsey/uuid/tree/4.9.2"
|
||||
},
|
||||
"time": "2026-06-18T03:57:49+00:00"
|
||||
"time": "2025-12-14T04:43:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise",
|
||||
@@ -10134,16 +10130,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217"
|
||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/85095d2573eaefaf35e40b9513a9bf09f72cd217",
|
||||
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ed0107e43ab452aa77ae99e005b95e56b556e075",
|
||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10208,7 +10204,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/console/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10228,7 +10224,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T08:56:14+00:00"
|
||||
"time": "2026-05-13T12:04:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@@ -10757,16 +10753,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/html-sanitizer",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/html-sanitizer.git",
|
||||
"reference": "761f6c49dfd103ee08b3cd09ece588b069e18ec9"
|
||||
"reference": "51cb4f68195883f7ac403abb58ecf7adc74e0f9e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/761f6c49dfd103ee08b3cd09ece588b069e18ec9",
|
||||
"reference": "761f6c49dfd103ee08b3cd09ece588b069e18ec9",
|
||||
"url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/51cb4f68195883f7ac403abb58ecf7adc74e0f9e",
|
||||
"reference": "51cb4f68195883f7ac403abb58ecf7adc74e0f9e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10807,7 +10803,7 @@
|
||||
"sanitizer"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/html-sanitizer/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/html-sanitizer/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10827,20 +10823,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "bc354f47c62301e990b7874fa662326368508e2c"
|
||||
"reference": "9381209597ec66c25be154cbf2289076e64d1eab"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/bc354f47c62301e990b7874fa662326368508e2c",
|
||||
"reference": "bc354f47c62301e990b7874fa662326368508e2c",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/9381209597ec66c25be154cbf2289076e64d1eab",
|
||||
"reference": "9381209597ec66c25be154cbf2289076e64d1eab",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10889,7 +10885,7 @@
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.4.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10909,20 +10905,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-03-24T13:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "9df847980c436451f4f51d1284491bb4356dd989"
|
||||
"reference": "7922b53e70d2ba2027af8bb6a59d91eb3541ea4d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/9df847980c436451f4f51d1284491bb4356dd989",
|
||||
"reference": "9df847980c436451f4f51d1284491bb4356dd989",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/7922b53e70d2ba2027af8bb6a59d91eb3541ea4d",
|
||||
"reference": "7922b53e70d2ba2027af8bb6a59d91eb3541ea4d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11008,7 +11004,7 @@
|
||||
"description": "Provides a structured process for converting a Request into a Response",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11028,7 +11024,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T08:31:43+00:00"
|
||||
"time": "2026-05-20T09:27:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
@@ -11116,16 +11112,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "a845722765c4f6b2ce88beaf4f4479975b186770"
|
||||
"reference": "b198dd66c211c97119bcaaff7c13431dbbb5e470"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/a845722765c4f6b2ce88beaf4f4479975b186770",
|
||||
"reference": "a845722765c4f6b2ce88beaf4f4479975b186770",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/b198dd66c211c97119bcaaff7c13431dbbb5e470",
|
||||
"reference": "b198dd66c211c97119bcaaff7c13431dbbb5e470",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11181,7 +11177,7 @@
|
||||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/mime/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11201,7 +11197,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T16:22:37+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
@@ -11288,16 +11284,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
|
||||
"reference": "e9247d281d694a5120554d9afaf54e070e88a603"
|
||||
"reference": "4864388bfbd3001ce88e234fab652acd91fdc57e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603",
|
||||
"reference": "e9247d281d694a5120554d9afaf54e070e88a603",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e",
|
||||
"reference": "4864388bfbd3001ce88e234fab652acd91fdc57e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11346,7 +11342,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11366,20 +11362,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T05:58:03+00:00"
|
||||
"time": "2026-04-26T13:13:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "dc21118016c039a66235cf93d96b435ffb282412"
|
||||
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/dc21118016c039a66235cf93d96b435ffb282412",
|
||||
"reference": "dc21118016c039a66235cf93d96b435ffb282412",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3",
|
||||
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11433,7 +11429,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11453,20 +11449,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-25T15:22:23+00:00"
|
||||
"time": "2024-09-10T14:38:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.38.0",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b"
|
||||
"reference": "3833d7255cc303546435cb650316bff708a1c75c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b",
|
||||
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
|
||||
"reference": "3833d7255cc303546435cb650316bff708a1c75c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11518,7 +11514,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11538,20 +11534,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-25T13:48:31+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.38.2",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6"
|
||||
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
|
||||
"reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
|
||||
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11603,7 +11599,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11623,7 +11619,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T06:59:30+00:00"
|
||||
"time": "2026-04-10T17:25:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
@@ -11791,16 +11787,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php81.git",
|
||||
"reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7"
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/6bfb9c766cacffbc8e118cb87217d08ed84e5cd7",
|
||||
"reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11847,7 +11843,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11867,20 +11863,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T12:45:58+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.38.2",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php83.git",
|
||||
"reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8"
|
||||
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/796a26abb75ce49f3a84433cd81bf1009d73d5f8",
|
||||
"reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/3600c2cb22399e25bb226e4a135ce91eeb2a6149",
|
||||
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11927,7 +11923,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.38.2"
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11947,20 +11943,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T06:51:48+00:00"
|
||||
"time": "2026-04-10T17:25:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php84",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php84.git",
|
||||
"reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa"
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa",
|
||||
"reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12007,7 +12003,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12027,20 +12023,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T12:51:13+00:00"
|
||||
"time": "2026-04-10T18:47:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php85",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php85.git",
|
||||
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1"
|
||||
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
|
||||
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee",
|
||||
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12087,7 +12083,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php85/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12107,7 +12103,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T02:25:22+00:00"
|
||||
"time": "2026-04-26T13:10:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-uuid",
|
||||
@@ -12194,16 +12190,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "f5804be144caceb570f6747519999636b664f24c"
|
||||
"reference": "d9593c9efa40499eb078b81144de42cbc28a31f0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/f5804be144caceb570f6747519999636b664f24c",
|
||||
"reference": "f5804be144caceb570f6747519999636b664f24c",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/d9593c9efa40499eb078b81144de42cbc28a31f0",
|
||||
"reference": "d9593c9efa40499eb078b81144de42cbc28a31f0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12235,7 +12231,7 @@
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/process/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12255,7 +12251,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T16:05:06+00:00"
|
||||
"time": "2026-05-11T16:55:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/property-access",
|
||||
@@ -12518,16 +12514,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
"reference": "3a162171bb008e5e0f15dce6581373a4c0e8390d"
|
||||
"reference": "3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/3a162171bb008e5e0f15dce6581373a4c0e8390d",
|
||||
"reference": "3a162171bb008e5e0f15dce6581373a4c0e8390d",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204",
|
||||
"reference": "3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12579,7 +12575,7 @@
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/routing/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/routing/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12599,7 +12595,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/serializer",
|
||||
@@ -12794,16 +12790,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde"
|
||||
"reference": "965f7306a43383d02c6aca1e3f3bd2f0ea5dee15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/961683010db3b27ec6ebcd7308e6e1ee8fa7ffde",
|
||||
"reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/965f7306a43383d02c6aca1e3f3bd2f0ea5dee15",
|
||||
"reference": "965f7306a43383d02c6aca1e3f3bd2f0ea5dee15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12861,7 +12857,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/string/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12881,7 +12877,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T15:23:29+00:00"
|
||||
"time": "2026-05-13T12:04:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@@ -13827,16 +13823,16 @@
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webmozarts/assert.git",
|
||||
"reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70"
|
||||
"reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webmozarts/assert/zipball/2ccb7c2e821038c03a3e6e1700c570c158c55f70",
|
||||
"reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70",
|
||||
"url": "https://api.github.com/repos/webmozarts/assert/zipball/9007ea6f45ecf352a9422b36644e4bfc039b9155",
|
||||
"reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -13887,9 +13883,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webmozarts/assert/issues",
|
||||
"source": "https://github.com/webmozarts/assert/tree/2.4.1"
|
||||
"source": "https://github.com/webmozarts/assert/tree/2.4.0"
|
||||
},
|
||||
"time": "2026-06-15T15:31:57+00:00"
|
||||
"time": "2026-05-20T13:07:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wikimedia/composer-merge-plugin",
|
||||
|
||||
@@ -189,7 +189,9 @@ ENV WITH_HORIZON=false \
|
||||
WITH_SCHEDULER=false \
|
||||
WITH_REVERB=false
|
||||
|
||||
COPY --link --chown=${WWWUSER}:${WWWUSER} . .
|
||||
COPY --link --chown=${WWWUSER}:${WWWUSER} . ./
|
||||
|
||||
RUN test -z "$(find . -name .git -print -quit)"
|
||||
#COPY --link --chown=${WWWUSER}:${WWWUSER} --from=build ${ROOT}/public public
|
||||
|
||||
RUN mkdir -p \
|
||||
|
||||
@@ -246,7 +246,7 @@ test('test that sorting clients by name and status works', async ({ page, ctx })
|
||||
|
||||
test('test that sorting clients by project count works', async ({ page, ctx }) => {
|
||||
const clientWithMany = await createClientViaApi(ctx, { name: 'ManyProjects Client' });
|
||||
const clientWithNone = await createClientViaApi(ctx, { name: 'NoProjects Client' });
|
||||
await createClientViaApi(ctx, { name: 'NoProjects Client' });
|
||||
|
||||
// Create projects for the first client
|
||||
await createProjectViaApi(ctx, { name: 'Proj1', client_id: clientWithMany.id });
|
||||
@@ -374,3 +374,119 @@ test.describe('Employee Clients Restrictions', () => {
|
||||
await expect(employee.page.getByText(clientName)).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
// ──────────────────────────────────────────────────
|
||||
// Pagination Tests
|
||||
// ──────────────────────────────────────────────────
|
||||
|
||||
test.describe('Clients Pagination', () => {
|
||||
test.describe.configure({ timeout: 30000 });
|
||||
|
||||
test('test that client table paginates when there are more than 15 clients', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
// Create 17 clients with zero-padded names so alphabetical sort is predictable.
|
||||
// Page size is 15 → page 1 shows indices 00–14, page 2 shows 15–16.
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const prefix = `PaginationClient ${seed} `;
|
||||
await Promise.all(
|
||||
Array.from({ length: 17 }, (_, i) =>
|
||||
createClientViaApi(ctx, { name: prefix + String(i).padStart(2, '0') })
|
||||
)
|
||||
);
|
||||
|
||||
await goToClientsOverview(page);
|
||||
await clearClientTableState(page);
|
||||
await page.reload();
|
||||
|
||||
// Default sort is name asc; first 15 clients (00–14) on page 1.
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toBeVisible();
|
||||
// Client 15 should be on page 2, not visible on page 1.
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// Exactly 15 data rows mounted on page 1.
|
||||
await expect(page.getByRole('row')).toHaveCount(15);
|
||||
|
||||
// Navigation to page 2.
|
||||
await page.getByRole('button', { name: 'Next Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '00')).not.toBeVisible();
|
||||
// Page 2 contains the remaining 2 clients.
|
||||
await expect(page.getByRole('row')).toHaveCount(2);
|
||||
|
||||
// Back to page 1 via Previous Page.
|
||||
await page.getByRole('button', { name: 'Previous Page' }).click();
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// First / Last page jumps.
|
||||
await page.getByRole('button', { name: 'Last Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'First Page' }).click();
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// Direct page-number button navigation + selected state.
|
||||
await page.getByRole('button', { name: 'Page 2' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Page 2' })).toHaveAttribute(
|
||||
'aria-current',
|
||||
'page'
|
||||
);
|
||||
});
|
||||
|
||||
test('test that client pagination is not shown when there are 15 or fewer clients', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
await Promise.all(
|
||||
Array.from({ length: 10 }, (_, i) =>
|
||||
createClientViaApi(ctx, {
|
||||
name: `FewClient ${Math.floor(Math.random() * 100000)} ${i}`,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
await goToClientsOverview(page);
|
||||
await clearClientTableState(page);
|
||||
await page.reload();
|
||||
|
||||
await expect(page.getByTestId('client_table')).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('test that changing the sort resets client pagination to page 1', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const prefix = `SortPagClient ${seed} `;
|
||||
await Promise.all(
|
||||
Array.from({ length: 17 }, (_, i) =>
|
||||
createClientViaApi(ctx, { name: prefix + String(i).padStart(2, '0') })
|
||||
)
|
||||
);
|
||||
|
||||
await goToClientsOverview(page);
|
||||
await clearClientTableState(page);
|
||||
await page.reload();
|
||||
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Go to page 2.
|
||||
await page.getByRole('button', { name: 'Next Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
|
||||
// Sort by name descending.
|
||||
const table = page.getByTestId('client_table');
|
||||
const nameHeader = table.getByText('Name').first();
|
||||
await nameHeader.click();
|
||||
|
||||
// Pagination reset to page 1; desc order → 16, 15 visible, 00 on page 2.
|
||||
await expect(page.getByText(prefix + '16')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '00')).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,6 +117,43 @@ test('test that archiving and unarchiving projects works', async ({ page, ctx })
|
||||
await expect(page.getByText(newProjectName)).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that the client can be changed in the edit project modal', async ({ page, ctx }) => {
|
||||
const projectName = 'Edit Client Project ' + Math.floor(1 + Math.random() * 100000);
|
||||
const clientName = 'Assigned Client ' + Math.floor(1 + Math.random() * 100000);
|
||||
await createProjectViaApi(ctx, { name: projectName });
|
||||
const client = await createClientViaApi(ctx, { name: clientName });
|
||||
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/projects');
|
||||
await expect(page.getByText(projectName)).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Open the project's Edit modal.
|
||||
await page.getByRole('row').first().getByRole('button').click();
|
||||
await page.getByRole('menuitem').getByText('Edit').first().click();
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
|
||||
// Open the client dropdown (currently "No Client"), confirm it focuses, and pick the client.
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'No Client' }).click();
|
||||
const clientSearch = page.getByPlaceholder('Search for a client...');
|
||||
await expect(clientSearch).toBeFocused();
|
||||
await clientSearch.fill(clientName);
|
||||
await page.getByRole('option', { name: clientName }).click();
|
||||
|
||||
// The trigger updates to the chosen client.
|
||||
await expect(page.getByRole('dialog').getByRole('button', { name: clientName })).toBeVisible();
|
||||
|
||||
// Saving persists the client assignment.
|
||||
await Promise.all([
|
||||
page.getByRole('button', { name: 'Update Project' }).click(),
|
||||
page.waitForResponse(
|
||||
async (response) =>
|
||||
response.url().includes('/projects/') &&
|
||||
response.request().method() === 'PUT' &&
|
||||
response.status() === 200 &&
|
||||
(await response.json()).data.client_id === client.id
|
||||
),
|
||||
]);
|
||||
});
|
||||
|
||||
test('test that updating billable rate works with existing time entries', async ({ page, ctx }) => {
|
||||
const newProjectName = 'New Project ' + Math.floor(1 + Math.random() * 10000);
|
||||
const newBillableRate = Math.round(Math.random() * 10000);
|
||||
@@ -1054,3 +1091,119 @@ test.describe('Employee Billable Rate Visibility', () => {
|
||||
await expect(projectRow).toContainText('200');
|
||||
});
|
||||
});
|
||||
|
||||
// ──────────────────────────────────────────────────
|
||||
// Pagination Tests
|
||||
// ──────────────────────────────────────────────────
|
||||
|
||||
test.describe('Projects Pagination', () => {
|
||||
test.describe.configure({ timeout: 30000 });
|
||||
|
||||
test('test that project table paginates when there are more than 15 projects', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
// Create 17 projects with zero-padded names so alphabetical sort is predictable.
|
||||
// Page size is 15 → page 1 shows indices 00–14, page 2 shows 15–16.
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const prefix = `PaginationProj ${seed} `;
|
||||
await Promise.all(
|
||||
Array.from({ length: 17 }, (_, i) =>
|
||||
createProjectViaApi(ctx, { name: prefix + String(i).padStart(2, '0') })
|
||||
)
|
||||
);
|
||||
|
||||
await goToProjectsOverview(page);
|
||||
await clearProjectTableState(page);
|
||||
await page.reload();
|
||||
|
||||
// Default sort is name asc; first 15 projects (00–14) should be on page 1.
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toBeVisible();
|
||||
// Project 15 should be on page 2, not visible on page 1.
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// Exactly 15 data rows should be mounted on page 1.
|
||||
await expect(page.getByRole('row')).toHaveCount(15);
|
||||
|
||||
// Go to page 2.
|
||||
await page.getByRole('button', { name: 'Next Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '00')).not.toBeVisible();
|
||||
// Page 2 contains the remaining 2 projects (15, 16).
|
||||
await expect(page.getByRole('row')).toHaveCount(2);
|
||||
|
||||
// Return to page 1 via Previous Page.
|
||||
await page.getByRole('button', { name: 'Previous Page' }).click();
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// Jump to last page then back to first page.
|
||||
await page.getByRole('button', { name: 'Last Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'First Page' }).click();
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).not.toBeVisible();
|
||||
|
||||
// Direct page-number button navigation.
|
||||
await page.getByRole('button', { name: 'Page 2' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
// Page 2 button should be marked as selected.
|
||||
await expect(page.getByRole('button', { name: 'Page 2' })).toHaveAttribute(
|
||||
'aria-current',
|
||||
'page'
|
||||
);
|
||||
});
|
||||
|
||||
test('test that project pagination is not shown when there are 15 or fewer projects', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
await Promise.all(
|
||||
Array.from({ length: 10 }, (_, i) =>
|
||||
createProjectViaApi(ctx, {
|
||||
name: `FewProj ${Math.floor(Math.random() * 100000)} ${i}`,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
await goToProjectsOverview(page);
|
||||
await clearProjectTableState(page);
|
||||
await page.reload();
|
||||
|
||||
await expect(page.getByTestId('project_table')).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('test that changing the sort resets pagination to page 1', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const prefix = `SortPagProj ${seed} `;
|
||||
await Promise.all(
|
||||
Array.from({ length: 17 }, (_, i) =>
|
||||
createProjectViaApi(ctx, { name: prefix + String(i).padStart(2, '0') })
|
||||
)
|
||||
);
|
||||
|
||||
await goToProjectsOverview(page);
|
||||
await clearProjectTableState(page);
|
||||
await page.reload();
|
||||
|
||||
await expect(page.getByText(prefix + '00')).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Go to page 2.
|
||||
await page.getByRole('button', { name: 'Next Page' }).click();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
|
||||
// Sort by name descending: header click toggles asc → desc.
|
||||
const nameHeader = page
|
||||
.locator('[data-testid="project_table"] .select-none', { hasText: 'Name' })
|
||||
.first();
|
||||
await nameHeader.click();
|
||||
|
||||
// After sorting, pagination resets to page 1; desc order → 16, 15, ... 02 visible.
|
||||
await expect(page.getByText(prefix + '16')).toBeVisible();
|
||||
await expect(page.getByText(prefix + '15')).toBeVisible();
|
||||
// Index 00 should now be on page 2 (last in desc order).
|
||||
await expect(page.getByText(prefix + '00')).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -717,3 +717,108 @@ test('test that keyboard navigation works in multiselect dropdown', async ({ pag
|
||||
page.getByRole('button', { name: 'Projects' }).first().getByText('1')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
// ──────────────────────────────────────────────────
|
||||
// Pagination Tests
|
||||
// ──────────────────────────────────────────────────
|
||||
|
||||
test.describe('Reporting Detailed Pagination', () => {
|
||||
test('test that detailed reporting paginates when there are more than 15 time entries', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
// The detailed report paginates server-side with a page limit of 15.
|
||||
// Create 17 time entries on a single project so we get exactly 2 pages.
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `ReportPagProj ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectName });
|
||||
const descriptions = Array.from(
|
||||
{ length: 17 },
|
||||
(_, i) => `ReportPagEntry ${String(i).padStart(2, '0')} ${seed}`
|
||||
);
|
||||
await Promise.all(
|
||||
descriptions.map((description) =>
|
||||
createTimeEntryViaApi(ctx, {
|
||||
description,
|
||||
duration: '30min',
|
||||
projectId: project.id,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
await goToReportingDetailed(page);
|
||||
await expect(page.getByText(descriptions[0]!).first()).toBeVisible({
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// Pagination nav should be rendered.
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toBeVisible();
|
||||
|
||||
// Collect which descriptions are currently visible on page 1.
|
||||
const visiblePage1 = new Set<string>();
|
||||
for (const description of descriptions) {
|
||||
if ((await page.getByText(description).count()) > 0) {
|
||||
visiblePage1.add(description);
|
||||
}
|
||||
}
|
||||
// The page limit is 15 → exactly 15 entries visible on page 1.
|
||||
expect(visiblePage1.size).toBe(15);
|
||||
|
||||
// Go to page 2 and wait for the server fetch.
|
||||
await Promise.all([
|
||||
page.getByRole('button', { name: 'Next Page' }).click(),
|
||||
waitForDetailedReportingUpdate(page),
|
||||
]);
|
||||
|
||||
const visiblePage2 = new Set<string>();
|
||||
for (const description of descriptions) {
|
||||
if ((await page.getByText(description).count()) > 0) {
|
||||
visiblePage2.add(description);
|
||||
}
|
||||
}
|
||||
// Page 2 should hold the remaining 2 entries, disjoint from page 1.
|
||||
expect(visiblePage2.size).toBe(2);
|
||||
for (const description of visiblePage2) {
|
||||
expect(visiblePage1.has(description)).toBe(false);
|
||||
}
|
||||
// Across both pages, all 17 entries should have been visible.
|
||||
expect(visiblePage1.size + visiblePage2.size).toBe(17);
|
||||
|
||||
// Page 2 button is selected.
|
||||
await expect(page.getByRole('button', { name: 'Page 2' })).toHaveAttribute(
|
||||
'aria-current',
|
||||
'page'
|
||||
);
|
||||
|
||||
// Previous page returns to page 1.
|
||||
await Promise.all([
|
||||
page.getByRole('button', { name: 'Previous Page' }).click(),
|
||||
waitForDetailedReportingUpdate(page),
|
||||
]);
|
||||
expect((await page.getByText(descriptions[0]!).count()) > 0).toBe(true);
|
||||
});
|
||||
|
||||
test('test that reporting pagination is not shown when there are 15 or fewer time entries', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `FewEntriesProj ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectName });
|
||||
await Promise.all(
|
||||
Array.from({ length: 5 }, (_, i) =>
|
||||
createTimeEntryViaApi(ctx, {
|
||||
description: `FewEntries ${i} ${seed}`,
|
||||
duration: '30min',
|
||||
projectId: project.id,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
await goToReportingDetailed(page);
|
||||
await expect(page.getByText(`FewEntries 0 ${seed}`).first()).toBeVisible({
|
||||
timeout: 10000,
|
||||
});
|
||||
await expect(page.getByRole('button', { name: 'Next Page' })).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
69
e2e/reporting-tag-match.spec.ts
Normal file
69
e2e/reporting-tag-match.spec.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '../playwright/fixtures';
|
||||
import { goToReportingDetailed, waitForDetailedReportingUpdate } from './utils/reporting';
|
||||
import { createTimeEntryWithTagViaApi } from './utils/api';
|
||||
|
||||
// Each test registers a new user and creates test data via the API
|
||||
test.describe.configure({ timeout: 30000 });
|
||||
|
||||
test('detailed reporting: "Does Not Contain" excludes entries with the selected tag', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const tagA = 'MatchTagA ' + Math.floor(Math.random() * 10000);
|
||||
const tagB = 'MatchTagB ' + Math.floor(Math.random() * 10000);
|
||||
await createTimeEntryWithTagViaApi(ctx, tagA, '1h');
|
||||
await createTimeEntryWithTagViaApi(ctx, tagB, '2h');
|
||||
|
||||
await goToReportingDetailed(page);
|
||||
await expect(page.getByText(`Entry with tag ${tagA}`).first()).toBeVisible();
|
||||
await expect(page.getByText(`Entry with tag ${tagB}`).first()).toBeVisible();
|
||||
|
||||
// Open the Tags dropdown, select tagA, then switch the match mode to "Does Not Contain"
|
||||
await page.getByRole('button', { name: 'Tags' }).click();
|
||||
await Promise.all([
|
||||
waitForDetailedReportingUpdate(page),
|
||||
page.getByRole('option').filter({ hasText: tagA }).click(),
|
||||
]);
|
||||
await Promise.all([
|
||||
waitForDetailedReportingUpdate(page),
|
||||
page.getByRole('radio', { name: 'Does Not Contain', exact: true }).click(),
|
||||
]);
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
// The entry with tagA is excluded; the entry with tagB remains
|
||||
await expect(page.getByText(`Entry with tag ${tagA}`)).toHaveCount(0);
|
||||
await expect(page.getByText(`Entry with tag ${tagB}`).first()).toBeVisible();
|
||||
});
|
||||
|
||||
test('detailed reporting: toggling between "Contains" and "Does Not Contain" flips the result', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const tagA = 'ToggleTagA ' + Math.floor(Math.random() * 10000);
|
||||
const tagB = 'ToggleTagB ' + Math.floor(Math.random() * 10000);
|
||||
await createTimeEntryWithTagViaApi(ctx, tagA, '1h');
|
||||
await createTimeEntryWithTagViaApi(ctx, tagB, '2h');
|
||||
|
||||
await goToReportingDetailed(page);
|
||||
await page.getByRole('button', { name: 'Tags' }).click();
|
||||
await Promise.all([
|
||||
waitForDetailedReportingUpdate(page),
|
||||
page.getByRole('option').filter({ hasText: tagA }).click(),
|
||||
]);
|
||||
|
||||
// "Contains" tagA -> only the tagA entry is listed
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByText(`Entry with tag ${tagA}`).first()).toBeVisible();
|
||||
await expect(page.getByText(`Entry with tag ${tagB}`)).toHaveCount(0);
|
||||
|
||||
// "Does Not Contain" tagA -> flips to the tagB entry
|
||||
await page.getByRole('button', { name: 'Tags' }).click();
|
||||
await Promise.all([
|
||||
waitForDetailedReportingUpdate(page),
|
||||
page.getByRole('radio', { name: 'Does Not Contain', exact: true }).click(),
|
||||
]);
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByText(`Entry with tag ${tagB}`).first()).toBeVisible();
|
||||
await expect(page.getByText(`Entry with tag ${tagA}`)).toHaveCount(0);
|
||||
});
|
||||
@@ -96,6 +96,37 @@ test('test that project multiselect search filters the option list', async ({ pa
|
||||
await page.keyboard.press('Escape');
|
||||
});
|
||||
|
||||
test('test that the project filter virtualizes a long list (renders only a window)', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
// Create many projects so the dropdown must virtualize rather than render all of them.
|
||||
const projectNames = Array.from(
|
||||
{ length: 80 },
|
||||
(_, i) => `VirtProj ${String(i).padStart(2, '0')}`
|
||||
);
|
||||
await Promise.all(projectNames.map((name) => createProjectViaApi(ctx, { name })));
|
||||
|
||||
await goToReporting(page);
|
||||
await expect(page.getByRole('button', { name: 'Export' })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Projects' }).first().click();
|
||||
|
||||
// Only a small window of options is mounted, far fewer than the 80+ projects that exist.
|
||||
await expect(page.getByRole('option').first()).toBeVisible();
|
||||
const renderedCount = await page.getByRole('option').count();
|
||||
expect(renderedCount).toBeGreaterThan(0);
|
||||
expect(renderedCount).toBeLessThan(60);
|
||||
|
||||
// Virtualization must not drop options: searching narrows the list to the one deep match.
|
||||
// Wait for the filtered count to settle to 1 before asserting — checking the option while
|
||||
// the virtualizer is still re-rendering can transiently match a stale row (Firefox CI flake).
|
||||
await page.getByPlaceholder('Search for a Project...').fill('VirtProj 79');
|
||||
await expect(page.getByRole('option')).toHaveCount(1);
|
||||
await expect(page.getByRole('option')).toContainText('VirtProj 79');
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
});
|
||||
|
||||
test('test that selecting multiple projects shows correct badge count', async ({ page, ctx }) => {
|
||||
const project1Name = 'MultiProj1 ' + Math.floor(Math.random() * 10000);
|
||||
const project2Name = 'MultiProj2 ' + Math.floor(Math.random() * 10000);
|
||||
|
||||
@@ -152,6 +152,49 @@ test('test that editing a task name works', async ({ page, ctx }) => {
|
||||
await expect(page.getByTestId('task_table')).not.toContainText(originalTaskName);
|
||||
});
|
||||
|
||||
test('test that the project can be searched and changed in the create task modal', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const sourceProject = 'Source Project ' + Math.floor(1 + Math.random() * 100000);
|
||||
const targetProject = 'Target Project ' + Math.floor(1 + Math.random() * 100000);
|
||||
await createProjectViaApi(ctx, { name: sourceProject });
|
||||
const target = await createProjectViaApi(ctx, { name: targetProject });
|
||||
|
||||
await goToProjectsOverview(page);
|
||||
await page.getByText(sourceProject).first().click();
|
||||
await page.getByRole('button', { name: 'Create Task' }).click();
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
|
||||
// The project dropdown is pre-filled with the source project; open it.
|
||||
await page.getByRole('dialog').getByRole('button', { name: sourceProject }).click();
|
||||
|
||||
// Opening the dropdown focuses the search input; searching narrows it to the target project.
|
||||
const projectSearch = page.getByPlaceholder('Search for a project...');
|
||||
await expect(projectSearch).toBeFocused();
|
||||
await projectSearch.fill('Target Project');
|
||||
await page.getByRole('option', { name: targetProject }).click();
|
||||
|
||||
// Selecting closes the dropdown and updates the trigger to the chosen project.
|
||||
await expect(
|
||||
page.getByRole('dialog').getByRole('button', { name: targetProject })
|
||||
).toBeVisible();
|
||||
|
||||
// The new selection is what gets used when the task is created.
|
||||
const taskName = 'Switched Task ' + Math.floor(1 + Math.random() * 100000);
|
||||
await page.getByPlaceholder('Task Name').fill(taskName);
|
||||
await Promise.all([
|
||||
page.getByRole('dialog').getByRole('button', { name: 'Create Task' }).click(),
|
||||
page.waitForResponse(
|
||||
async (response) =>
|
||||
response.url().includes('/tasks') &&
|
||||
response.request().method() === 'POST' &&
|
||||
response.status() === 201 &&
|
||||
(await response.json()).data.project_id === target.id
|
||||
),
|
||||
]);
|
||||
});
|
||||
|
||||
test('test that creating a project with an existing client works', async ({ page, ctx }) => {
|
||||
const clientName = 'Existing Client ' + Math.floor(1 + Math.random() * 10000);
|
||||
const projectName = 'Project With Client ' + Math.floor(1 + Math.random() * 10000);
|
||||
|
||||
@@ -9,7 +9,14 @@ import {
|
||||
} from './utils/currentTimeEntry';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { newTagResponse } from './utils/tags';
|
||||
import { createProjectViaApi, updateOrganizationCurrencyViaWeb } from './utils/api';
|
||||
import {
|
||||
createProjectViaApi,
|
||||
createTaskViaApi,
|
||||
createClientViaApi,
|
||||
archiveProjectViaApi,
|
||||
markTaskDoneViaApi,
|
||||
updateOrganizationCurrencyViaWeb,
|
||||
} from './utils/api';
|
||||
|
||||
// Date picker button name patterns for different date formats
|
||||
const DATE_DISPLAY_PATTERN = /^\d{4}-\d{2}-\d{2}$|^\d{2}\/\d{2}\/\d{4}$|^\d{2}\.\d{2}\.\d{4}$/;
|
||||
@@ -441,3 +448,236 @@ test('test that adding a project and tag before starting timer works', async ({
|
||||
]);
|
||||
await assertThatTimerIsStopped(page);
|
||||
});
|
||||
|
||||
// ──────────────────────────────────────────────────
|
||||
// Project / Task selector dropdown
|
||||
// Regression coverage for the virtualized + lookup-map refactor of
|
||||
// TimeTrackerProjectTaskDropdown. The dropdown only (re)filters on open and on search
|
||||
// change, so we wait for the dashboard prefetch to settle before opening it.
|
||||
// ──────────────────────────────────────────────────
|
||||
|
||||
test.describe('Project Task Dropdown', () => {
|
||||
test.describe.configure({ timeout: 60_000 });
|
||||
|
||||
test('test that a project far down a long list can be found via search and selected', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
// Seed enough projects that the target sits outside the initially rendered window.
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const prefix = `VirtProj ${seed} `;
|
||||
await Promise.all(
|
||||
Array.from({ length: 30 }, (_, i) =>
|
||||
createProjectViaApi(ctx, { name: prefix + String(i).padStart(2, '0') })
|
||||
)
|
||||
);
|
||||
const target = prefix + '27';
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
await page.getByTestId('client_dropdown_search').fill(target);
|
||||
await page.getByRole('option').filter({ hasText: target }).click();
|
||||
|
||||
// The trigger now reflects the selected project.
|
||||
await expect(page.getByRole('button', { name: target })).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that expanding a project and selecting a task works', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `ExpandProj ${seed}`;
|
||||
const taskName = `ExpandTask ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectName });
|
||||
await createTaskViaApi(ctx, { name: taskName, project_id: project.id });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const projectOption = page.getByRole('option').filter({ hasText: projectName });
|
||||
await expect(projectOption).toBeVisible();
|
||||
|
||||
// Expand the project's tasks via the "N Tasks" button, then select the task.
|
||||
await projectOption.getByText(/Tasks/).click();
|
||||
await page.getByText(taskName, { exact: true }).click();
|
||||
|
||||
// Scoped to the trigger button: the closing dropdown also contains the name while animating out.
|
||||
await expect(
|
||||
page.getByRole('button', { name: `${projectName} ${taskName}` })
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that keyboard navigation selects a project', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `KbProj ${seed}`;
|
||||
await createProjectViaApi(ctx, { name: projectName });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const search = page.getByTestId('client_dropdown_search');
|
||||
// On open the search is focused and "No Project" is highlighted.
|
||||
await expect(search).toBeFocused();
|
||||
|
||||
// Arrow down from "No Project" to the project, then select it with Enter.
|
||||
await search.press('ArrowDown');
|
||||
await search.press('Enter');
|
||||
|
||||
await expect(page.getByRole('button', { name: projectName })).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that search filters the dropdown by project and client name', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const clientName = `FilterClient ${seed}`;
|
||||
const alphaProject = `AlphaProj ${seed}`;
|
||||
const betaProject = `BetaProj ${seed}`;
|
||||
const client = await createClientViaApi(ctx, { name: clientName });
|
||||
await createProjectViaApi(ctx, { name: alphaProject, client_id: client.id });
|
||||
await createProjectViaApi(ctx, { name: betaProject });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const search = page.getByTestId('client_dropdown_search');
|
||||
const alphaOption = page.getByRole('option').filter({ hasText: alphaProject });
|
||||
const betaOption = page.getByRole('option').filter({ hasText: betaProject });
|
||||
|
||||
// Both projects are visible before filtering.
|
||||
await expect(alphaOption).toBeVisible();
|
||||
await expect(betaOption).toBeVisible();
|
||||
|
||||
// Project-name search shows only the matching project.
|
||||
await search.fill('AlphaProj');
|
||||
await expect(alphaOption).toBeVisible();
|
||||
await expect(betaOption).not.toBeVisible();
|
||||
|
||||
// Client-name search shows the project that belongs to that client.
|
||||
await search.fill(clientName);
|
||||
await expect(alphaOption).toBeVisible();
|
||||
await expect(betaOption).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("test that searching by task name surfaces the task's project", async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectWithTask = `TaskSearchProj ${seed}`;
|
||||
const taskName = `Findable Task ${seed}`;
|
||||
const unrelatedProject = `Unrelated Proj ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectWithTask });
|
||||
await createTaskViaApi(ctx, { name: taskName, project_id: project.id });
|
||||
await createProjectViaApi(ctx, { name: unrelatedProject });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
await page.getByTestId('client_dropdown_search').fill(taskName);
|
||||
|
||||
// The project owning the task is shown (with the task), the unrelated project is not.
|
||||
await expect(page.getByRole('option').filter({ hasText: projectWithTask })).toBeVisible();
|
||||
await expect(page.getByText(taskName, { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('option').filter({ hasText: unrelatedProject })
|
||||
).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('test that archived projects are hidden from the dropdown', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const activeProject = `ActiveProj ${seed}`;
|
||||
const archivedProject = `ArchivedProj ${seed}`;
|
||||
await createProjectViaApi(ctx, { name: activeProject });
|
||||
const toArchive = await createProjectViaApi(ctx, { name: archivedProject });
|
||||
await archiveProjectViaApi(ctx, toArchive);
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
|
||||
// Wait for the list to load, then confirm the archived project is filtered out.
|
||||
await expect(page.getByRole('option').filter({ hasText: activeProject })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('option').filter({ hasText: archivedProject })
|
||||
).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('test that done tasks are hidden when expanding a project', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `DoneTaskProj ${seed}`;
|
||||
const activeTask = `Active Task ${seed}`;
|
||||
const doneTask = `Done Task ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectName });
|
||||
await createTaskViaApi(ctx, { name: activeTask, project_id: project.id });
|
||||
const taskToFinish = await createTaskViaApi(ctx, {
|
||||
name: doneTask,
|
||||
project_id: project.id,
|
||||
});
|
||||
await markTaskDoneViaApi(ctx, taskToFinish);
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const projectOption = page.getByRole('option').filter({ hasText: projectName });
|
||||
await expect(projectOption).toBeVisible();
|
||||
await projectOption.getByText(/Tasks/).click();
|
||||
|
||||
// Only the active task shows; the done task is filtered out.
|
||||
await expect(page.getByText(activeTask, { exact: true })).toBeVisible();
|
||||
await expect(page.getByText(doneTask, { exact: true })).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('test that keyboard navigation can expand a project and select a task', async ({
|
||||
page,
|
||||
ctx,
|
||||
}) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `KbTaskProj ${seed}`;
|
||||
const taskName = `KbTask ${seed}`;
|
||||
const project = await createProjectViaApi(ctx, { name: projectName });
|
||||
await createTaskViaApi(ctx, { name: taskName, project_id: project.id });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const search = page.getByTestId('client_dropdown_search');
|
||||
await expect(search).toBeFocused();
|
||||
|
||||
// No Project is highlighted on open: down to the project, right to expand its tasks,
|
||||
// down to the task, Enter to select it.
|
||||
await search.press('ArrowDown');
|
||||
await search.press('ArrowRight');
|
||||
await search.press('ArrowDown');
|
||||
await search.press('Enter');
|
||||
|
||||
// Scoped to the trigger button: the closing dropdown also contains the name while animating out.
|
||||
await expect(
|
||||
page.getByRole('button', { name: `${projectName} ${taskName}` })
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that pressing space selects the highlighted project', async ({ page, ctx }) => {
|
||||
const seed = Math.floor(Math.random() * 100000);
|
||||
const projectName = `SpaceProj ${seed}`;
|
||||
await createProjectViaApi(ctx, { name: projectName });
|
||||
|
||||
await goToDashboard(page);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.getByRole('button', { name: 'No Project' }).click();
|
||||
const search = page.getByTestId('client_dropdown_search');
|
||||
await expect(search).toBeFocused();
|
||||
|
||||
// Arrow down from "No Project" to the project, then the space shortcut selects it.
|
||||
await search.press('ArrowDown');
|
||||
await search.press('Space');
|
||||
|
||||
await expect(page.getByRole('button', { name: projectName })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -373,6 +373,20 @@ export async function createTaskViaApi(
|
||||
return body.data as { id: string; name: string; project_id: string };
|
||||
}
|
||||
|
||||
export async function markTaskDoneViaApi(ctx: TestContext, task: { id: string; name: string }) {
|
||||
const response = await ctx.request.put(
|
||||
`${PLAYWRIGHT_BASE_URL}/api/v1/organizations/${ctx.orgId}/tasks/${task.id}`,
|
||||
{
|
||||
data: {
|
||||
name: task.name,
|
||||
is_done: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
expect(response.status()).toBe(200);
|
||||
return (await response.json()).data;
|
||||
}
|
||||
|
||||
export async function createTagViaApi(ctx: TestContext, data: { name: string }) {
|
||||
const response = await ctx.request.post(
|
||||
`${PLAYWRIGHT_BASE_URL}/api/v1/organizations/${ctx.orgId}/tags`,
|
||||
|
||||
14
extensions/manifest.json
Normal file
14
extensions/manifest.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Billing": {
|
||||
"repository": "solidtime-io/extension-billing",
|
||||
"ref": "v0.0.3"
|
||||
},
|
||||
"Services": {
|
||||
"repository": "solidtime-io/extension-services",
|
||||
"ref": "v0.0.1"
|
||||
},
|
||||
"Invoicing": {
|
||||
"repository": "solidtime-io/extension-invoicing",
|
||||
"ref": "v0.0.1"
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ declare(strict_types=1);
|
||||
return [
|
||||
'clockify_time_entries' => [
|
||||
'name' => 'Clockify Time Entries',
|
||||
'description' => '1. First make sure that you set the Date format to "MM/DD/YYYY" and the Time format to "12-hour" in the user settings.<br>'.
|
||||
'description' => '<strong>Important:</strong> If you also want to import your projects use the "Clockify Projects" importer before this one, since that export contains more details such as billable status, billable rates and estimated time.<br><br>'.
|
||||
'1. First make sure that you set the Date format to "MM/DD/YYYY" and the Time format to "12-hour" in the user settings.<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>'.
|
||||
'4. Now select the date range that you want to export in the right top. '.
|
||||
@@ -61,7 +62,8 @@ return [
|
||||
],
|
||||
'harvest_time_entries' => [
|
||||
'name' => 'Harvest Time Entries',
|
||||
'description' => '1. Go to Settings (right top corner)<br>2. Click on "Import/Export" in the left navigation'.
|
||||
'description' => '<strong>Important:</strong> If you also want to import your projects use the "Harvest Projects" importer before this one, since that export contains more details such as billable status and estimated time.<br><br>'.
|
||||
'1. Go to Settings (right top corner)<br>2. Click on "Import/Export" in the left navigation'.
|
||||
'<br>3. Now click on "Export all time" '.
|
||||
'<br><br>Before you import make sure that the Timezone settings in Harvest are the same as in solidtime.',
|
||||
],
|
||||
|
||||
23
package-lock.json
generated
23
package-lock.json
generated
@@ -20,6 +20,7 @@
|
||||
"@tanstack/vue-query": "^5.100.10",
|
||||
"@tanstack/vue-query-devtools": "^5.91.0",
|
||||
"@tanstack/vue-table": "^8.21.3",
|
||||
"@tanstack/vue-virtual": "^3.13.24",
|
||||
"@vue/eslint-config-prettier": "^10.2.0",
|
||||
"@vue/eslint-config-typescript": "^14.7.0",
|
||||
"@vueuse/core": "^14.3.0",
|
||||
@@ -5464,17 +5465,6 @@
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-vue-next": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-vue-next/-/lucide-vue-next-1.0.0.tgz",
|
||||
"integrity": "sha512-V6SPvx1IHTj/UY+FrIYWV5faISsPSb8BnWSFDxAtezWKvWc9ZZ40PDrdu1/Qb5vg4lHWr1hs1BAMGVGm6V1Xdg==",
|
||||
"deprecated": "Package deprecated. Please use @lucide/vue instead.",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"vue": ">=3.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.21",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
@@ -8409,7 +8399,7 @@
|
||||
"version": "0.0.6",
|
||||
"license": "AGPL-3.0",
|
||||
"devDependencies": {
|
||||
"vite-plugin-dts": "^4.0.3"
|
||||
"vite-plugin-dts": "^4.5.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@zodios/core": "^10.9.6",
|
||||
@@ -8424,15 +8414,17 @@
|
||||
"version": "0.0.21",
|
||||
"license": "AGPL-3.0",
|
||||
"devDependencies": {
|
||||
"@types/chroma-js": "^3.1.0",
|
||||
"@types/chroma-js": "^3.1.2",
|
||||
"@zodios/core": "^10.9.6",
|
||||
"vite-plugin-dts": "^4.0.3",
|
||||
"zod": "^3.23.8"
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"zod": "^3.25.76"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@floating-ui/vue": "^1.1.4",
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"@internationalized/date": "^3.0.0",
|
||||
"@lucide/vue": ">=1.0.0",
|
||||
"@tanstack/vue-virtual": "^3.13.24",
|
||||
"@vitejs/plugin-vue": "^5.1.2 || ^6.0.0",
|
||||
"@vueuse/core": "^12.5.0 || ^14.0.0",
|
||||
"@vueuse/integrations": "^12.5.0 || ^14.0.0",
|
||||
@@ -8441,7 +8433,6 @@
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"focus-trap": "^7.0.0 || ^8.0.0",
|
||||
"lucide-vue-next": ">=0.453.0",
|
||||
"parse-duration": "^2.0.1",
|
||||
"radix-vue": "^1.9.0",
|
||||
"reka-ui": "^2.2.0",
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
"@tanstack/vue-query": "^5.100.10",
|
||||
"@tanstack/vue-query-devtools": "^5.91.0",
|
||||
"@tanstack/vue-table": "^8.21.3",
|
||||
"@tanstack/vue-virtual": "^3.13.24",
|
||||
"@vue/eslint-config-prettier": "^10.2.0",
|
||||
"@vue/eslint-config-typescript": "^14.7.0",
|
||||
"@vueuse/core": "^14.3.0",
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue';
|
||||
import { UserCircleIcon } from '@heroicons/vue/24/solid';
|
||||
import { PlusIcon } from '@heroicons/vue/16/solid';
|
||||
import { type Component, computed, ref } from 'vue';
|
||||
import { type Component, computed, ref, watch } from 'vue';
|
||||
import { type Client } from '@/packages/api/src';
|
||||
import ClientTableRow from '@/Components/Common/Client/ClientTableRow.vue';
|
||||
import ClientCreateModal from '@/Components/Common/Client/ClientCreateModal.vue';
|
||||
import ClientTableHeading from '@/Components/Common/Client/ClientTableHeading.vue';
|
||||
import Pagination from '@/Components/Common/Pagination.vue';
|
||||
import { canCreateClients } from '@/utils/permissions';
|
||||
import { useProjectsQuery } from '@/utils/useProjectsQuery';
|
||||
import {
|
||||
@@ -43,11 +44,14 @@ const projectCountMap = computed(() => {
|
||||
return map;
|
||||
});
|
||||
|
||||
// Name is always the secondary sort so rows with equal values render
|
||||
// alphabetically instead of in API (created_at) order.
|
||||
const sorting = computed<SortingState>(() => [
|
||||
{
|
||||
id: props.sortColumn,
|
||||
desc: props.sortDirection === 'desc',
|
||||
},
|
||||
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
|
||||
]);
|
||||
|
||||
const columns = computed(() => [
|
||||
@@ -100,6 +104,19 @@ const table = useVueTable({
|
||||
const sortedClients = computed(() => {
|
||||
return table.getRowModel().rows.map((row) => row.original);
|
||||
});
|
||||
|
||||
// Client-side pagination: the full list is in memory, only one page is mounted at a time.
|
||||
const PAGE_SIZE = 15;
|
||||
const currentPage = ref(1);
|
||||
|
||||
watch([() => props.sortColumn, () => props.sortDirection, () => props.clients], () => {
|
||||
currentPage.value = 1;
|
||||
});
|
||||
|
||||
const paginatedClients = computed(() => {
|
||||
const start = (currentPage.value - 1) * PAGE_SIZE;
|
||||
return sortedClients.value.slice(start, start + PAGE_SIZE);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -126,10 +143,14 @@ const sortedClients = computed(() => {
|
||||
>Create your First Client
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<template v-for="client in sortedClients" :key="client.id">
|
||||
<template v-for="client in paginatedClients" :key="client.id">
|
||||
<ClientTableRow :client="client"></ClientTableRow>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Pagination
|
||||
v-model:page="currentPage"
|
||||
:total="sortedClients.length"
|
||||
:items-per-page="PAGE_SIZE"></Pagination>
|
||||
</template>
|
||||
|
||||
@@ -89,11 +89,17 @@ function selectMember(member: Member) {
|
||||
</Button>
|
||||
</template>
|
||||
<template #content>
|
||||
<!-- kept open so the list stays visible during the popover close animation -->
|
||||
<ComboboxRoot
|
||||
v-model:search-term="searchValue"
|
||||
v-model:open="open"
|
||||
:open="true"
|
||||
class="relative"
|
||||
:filter-function="(val: string[]) => val">
|
||||
:filter-function="(val: string[]) => val"
|
||||
@update:open="
|
||||
(value: boolean) => {
|
||||
if (!value) open = false;
|
||||
}
|
||||
">
|
||||
<ComboboxAnchor>
|
||||
<ComboboxInput
|
||||
ref="searchInput"
|
||||
|
||||
104
resources/js/Components/Common/Pagination.vue
Normal file
104
resources/js/Components/Common/Pagination.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
PaginationEllipsis,
|
||||
PaginationFirst,
|
||||
PaginationLast,
|
||||
PaginationList,
|
||||
PaginationListItem,
|
||||
PaginationNext,
|
||||
PaginationPrev,
|
||||
PaginationRoot,
|
||||
} from 'radix-vue';
|
||||
import {
|
||||
ChevronDoubleLeftIcon,
|
||||
ChevronDoubleRightIcon,
|
||||
ChevronLeftIcon,
|
||||
ChevronRightIcon,
|
||||
EllipsisHorizontalIcon,
|
||||
} from '@heroicons/vue/20/solid';
|
||||
import { buttonVariants } from '@/packages/ui/src';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { computed, watch } from 'vue';
|
||||
|
||||
const page = defineModel<number>('page', { default: 1 });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
total: number;
|
||||
itemsPerPage?: number;
|
||||
siblingCount?: number;
|
||||
showEdges?: boolean;
|
||||
}>(),
|
||||
{
|
||||
itemsPerPage: 15,
|
||||
siblingCount: 1,
|
||||
showEdges: true,
|
||||
}
|
||||
);
|
||||
|
||||
const pageCount = computed(() => Math.max(1, Math.ceil(props.total / props.itemsPerPage)));
|
||||
|
||||
watch(page, (value) => {
|
||||
if (value > pageCount.value) {
|
||||
page.value = pageCount.value;
|
||||
}
|
||||
});
|
||||
|
||||
watch(pageCount, (value) => {
|
||||
if (page.value > value) {
|
||||
page.value = value;
|
||||
}
|
||||
});
|
||||
|
||||
// The shared buttonVariants ghost/outline hover is `bg-white/5`, which is invisible in light
|
||||
// mode. Override it with a theme-aware hover that shows in both light and dark mode.
|
||||
const hoverClass = 'hover:bg-black/5 dark:hover:bg-white/5';
|
||||
const navButtonClass = cn(buttonVariants({ variant: 'ghost', size: 'icon' }), hoverClass);
|
||||
|
||||
function pageButtonClass(isActive: boolean): string {
|
||||
return cn(
|
||||
buttonVariants({ variant: isActive ? 'outline' : 'ghost', size: 'icon' }),
|
||||
hoverClass
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationRoot
|
||||
v-if="pageCount > 1"
|
||||
v-model:page="page"
|
||||
:total="props.total"
|
||||
:items-per-page="props.itemsPerPage"
|
||||
:sibling-count="props.siblingCount"
|
||||
:show-edges="props.showEdges"
|
||||
class="mx-auto flex w-full justify-center py-8">
|
||||
<PaginationList v-slot="{ items }" class="flex items-center gap-1">
|
||||
<PaginationFirst :class="navButtonClass">
|
||||
<ChevronDoubleLeftIcon class="size-4" />
|
||||
</PaginationFirst>
|
||||
<PaginationPrev :class="navButtonClass">
|
||||
<ChevronLeftIcon class="size-4" />
|
||||
</PaginationPrev>
|
||||
<template v-for="(item, index) in items" :key="index">
|
||||
<PaginationListItem
|
||||
v-if="item.type === 'page'"
|
||||
:value="item.value"
|
||||
:class="pageButtonClass(item.value === page)">
|
||||
{{ item.value }}
|
||||
</PaginationListItem>
|
||||
<PaginationEllipsis
|
||||
v-else
|
||||
:index="index"
|
||||
class="flex size-9 items-center justify-center text-text-tertiary">
|
||||
<EllipsisHorizontalIcon class="size-4" />
|
||||
</PaginationEllipsis>
|
||||
</template>
|
||||
<PaginationNext :class="navButtonClass">
|
||||
<ChevronRightIcon class="size-4" />
|
||||
</PaginationNext>
|
||||
<PaginationLast :class="navButtonClass">
|
||||
<ChevronDoubleRightIcon class="size-4" />
|
||||
</PaginationLast>
|
||||
</PaginationList>
|
||||
</PaginationRoot>
|
||||
</template>
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
ComboboxItem,
|
||||
ComboboxRoot,
|
||||
ComboboxViewport,
|
||||
} from 'radix-vue';
|
||||
ComboboxVirtualizer,
|
||||
} from 'reka-ui';
|
||||
import { Check, Plus } from '@lucide/vue';
|
||||
import type { CreateClientBody, CreateProjectBody, Project } from '@/packages/api/src';
|
||||
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
|
||||
import ProjectCreateModal from '@/packages/ui/src/Project/ProjectCreateModal.vue';
|
||||
import { useProjectsStore } from '@/utils/useProjects';
|
||||
import { useClientsStore } from '@/utils/useClients';
|
||||
@@ -37,7 +37,16 @@ const emit = defineEmits(['update:modelValue', 'changed']);
|
||||
|
||||
const activeClients = computed(() => clients.value.filter((c) => !c.is_archived));
|
||||
|
||||
const sortedProjects = ref<Project[]>([]);
|
||||
// Pinned on open so rows don't re-sort while interacting; the project list itself stays reactive.
|
||||
const pinnedProjectId = ref<string | null>(null);
|
||||
|
||||
const sortedProjects = computed(() => {
|
||||
return [...projects.value].sort((a, b) => {
|
||||
const aPinned = pinnedProjectId.value === a.id ? 0 : 1;
|
||||
const bPinned = pinnedProjectId.value === b.id ? 0 : 1;
|
||||
return aPinned - bPinned;
|
||||
});
|
||||
});
|
||||
|
||||
const shownProjects = computed(() => {
|
||||
return sortedProjects.value.filter((project) => {
|
||||
@@ -65,9 +74,7 @@ watch(open, (isOpen) => {
|
||||
searchInput.value?.$el?.focus();
|
||||
});
|
||||
|
||||
sortedProjects.value = [...projects.value].sort((iteratingProject) => {
|
||||
return model.value === iteratingProject.id ? -1 : 1;
|
||||
});
|
||||
pinnedProjectId.value = model.value;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -103,40 +110,51 @@ function updateValue(project: Project) {
|
||||
</template>
|
||||
|
||||
<template #content>
|
||||
<UseFocusTrap v-if="open" :options="{ immediate: true, allowOutsideClick: true }">
|
||||
<!-- kept open so the list stays visible during the popover close animation -->
|
||||
<div>
|
||||
<ComboboxRoot
|
||||
v-model:search-term="searchValue"
|
||||
v-model:open="open"
|
||||
:open="true"
|
||||
:model-value="currentProject"
|
||||
class="relative"
|
||||
@update:model-value="updateValue">
|
||||
:ignore-filter="true"
|
||||
@update:model-value="updateValue"
|
||||
@update:open="
|
||||
(value: boolean) => {
|
||||
if (!value) open = false;
|
||||
}
|
||||
">
|
||||
<ComboboxAnchor>
|
||||
<ComboboxInput
|
||||
ref="searchInput"
|
||||
v-model="searchValue"
|
||||
class="bg-transparent border-0 placeholder-muted-foreground text-sm text-popover-foreground py-2 px-3 focus:ring-0 border-b border-popover-border focus:border-popover-border w-full"
|
||||
placeholder="Search for a project..." />
|
||||
</ComboboxAnchor>
|
||||
<ComboboxContent>
|
||||
<ComboboxViewport
|
||||
class="w-[--reka-popper-anchor-width] max-h-60 overflow-y-scroll p-1">
|
||||
<ComboboxItem
|
||||
v-for="project in shownProjects"
|
||||
:key="project.id"
|
||||
:value="project"
|
||||
class="relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground"
|
||||
:data-project-id="project.id">
|
||||
<span class="flex items-center gap-2">
|
||||
<ComboboxVirtualizer
|
||||
v-slot="{ option: project }"
|
||||
:options="shownProjects"
|
||||
:estimate-size="32"
|
||||
:text-content="(p: Project) => p.name">
|
||||
<ComboboxItem
|
||||
:value="project"
|
||||
class="relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground"
|
||||
:data-project-id="project.id">
|
||||
<span class="flex min-w-0 flex-1 items-center gap-2">
|
||||
<span
|
||||
:style="{ backgroundColor: project.color }"
|
||||
class="w-3 h-3 rounded-full shrink-0"></span>
|
||||
<span class="truncate">{{ project.name }}</span>
|
||||
</span>
|
||||
<span
|
||||
:style="{ backgroundColor: project.color }"
|
||||
class="w-3 h-3 rounded-full shrink-0"></span>
|
||||
<span>{{ project.name }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="isProjectSelected(project)"
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<Check class="h-4 w-4" />
|
||||
</span>
|
||||
</ComboboxItem>
|
||||
v-if="isProjectSelected(project)"
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<Check class="h-4 w-4" />
|
||||
</span>
|
||||
</ComboboxItem>
|
||||
</ComboboxVirtualizer>
|
||||
</ComboboxViewport>
|
||||
<div
|
||||
v-if="canCreateProjects()"
|
||||
@@ -150,7 +168,7 @@ function updateValue(project: Project) {
|
||||
</div>
|
||||
</ComboboxContent>
|
||||
</ComboboxRoot>
|
||||
</UseFocusTrap>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
<ProjectCreateModal
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue';
|
||||
import { FolderPlusIcon } from '@heroicons/vue/24/solid';
|
||||
import { PlusIcon } from '@heroicons/vue/16/solid';
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import ProjectCreateModal from '@/packages/ui/src/Project/ProjectCreateModal.vue';
|
||||
import ProjectTableHeading from '@/Components/Common/Project/ProjectTableHeading.vue';
|
||||
import ProjectTableRow from '@/Components/Common/Project/ProjectTableRow.vue';
|
||||
import Pagination from '@/Components/Common/Pagination.vue';
|
||||
|
||||
export type SortColumn =
|
||||
| 'name'
|
||||
@@ -56,12 +57,15 @@ const clientNameMap = computed(() => {
|
||||
return map;
|
||||
});
|
||||
|
||||
// Convert sort props to TanStack Table format
|
||||
// Convert sort props to TanStack Table format.
|
||||
// Name is always the secondary sort so rows with equal values render
|
||||
// alphabetically instead of in API (created_at) order.
|
||||
const sorting = computed<SortingState>(() => [
|
||||
{
|
||||
id: props.sortColumn,
|
||||
desc: props.sortDirection === 'desc',
|
||||
},
|
||||
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
|
||||
]);
|
||||
|
||||
// Define column accessors for sorting.
|
||||
@@ -143,6 +147,19 @@ const sortedProjects = computed(() => {
|
||||
return table.getRowModel().rows.map((row) => row.original);
|
||||
});
|
||||
|
||||
// Client-side pagination: the full list is in memory, only one page is mounted at a time.
|
||||
const PAGE_SIZE = 15;
|
||||
const currentPage = ref(1);
|
||||
|
||||
watch([() => props.sortColumn, () => props.sortDirection, () => props.projects], () => {
|
||||
currentPage.value = 1;
|
||||
});
|
||||
|
||||
const paginatedProjects = computed(() => {
|
||||
const start = (currentPage.value - 1) * PAGE_SIZE;
|
||||
return sortedProjects.value.slice(start, start + PAGE_SIZE);
|
||||
});
|
||||
|
||||
const showCreateProjectModal = ref(false);
|
||||
|
||||
async function createProject(project: CreateProjectBody): Promise<Project | undefined> {
|
||||
@@ -199,7 +216,7 @@ const gridTemplate = computed(() => {
|
||||
>Create your First Project
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
<template v-for="project in sortedProjects" :key="project.id">
|
||||
<template v-for="project in paginatedProjects" :key="project.id">
|
||||
<ProjectTableRow
|
||||
:show-billable-rate="props.showBillableRate"
|
||||
:project="project"></ProjectTableRow>
|
||||
@@ -207,4 +224,8 @@ const gridTemplate = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Pagination
|
||||
v-model:page="currentPage"
|
||||
:total="sortedProjects.length"
|
||||
:items-per-page="PAGE_SIZE"></Pagination>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { CheckCircleIcon, TagIcon, UserGroupIcon } from '@heroicons/vue/20/solid';
|
||||
import { FolderIcon } from '@heroicons/vue/16/solid';
|
||||
import { Check } from '@lucide/vue';
|
||||
import { RadioGroupIndicator, RadioGroupItem, RadioGroupRoot, type AcceptableValue } from 'reka-ui';
|
||||
import BillableIcon from '@/packages/ui/src/Icons/BillableIcon.vue';
|
||||
import ReportingRoundingControls from '@/Components/Common/Reporting/ReportingRoundingControls.vue';
|
||||
import TaskMultiselectDropdown from '@/Components/Common/Task/TaskMultiselectDropdown.vue';
|
||||
@@ -14,6 +16,7 @@ import DateRangePicker from '@/packages/ui/src/Input/DateRangePicker.vue';
|
||||
import TagDropdown from '@/packages/ui/src/Tag/TagDropdown.vue';
|
||||
import { useTagsQuery } from '@/utils/useTagsQuery';
|
||||
import { useTagsStore } from '@/utils/useTags';
|
||||
import type { TagMatchType } from '@/types/reporting';
|
||||
|
||||
type TimeEntryRoundingType = 'up' | 'down' | 'nearest';
|
||||
|
||||
@@ -22,6 +25,7 @@ const selectedProjects = defineModel<string[]>('selectedProjects', { required: t
|
||||
const selectedTasks = defineModel<string[]>('selectedTasks', { required: true });
|
||||
const selectedClients = defineModel<string[]>('selectedClients', { required: true });
|
||||
const selectedTags = defineModel<string[]>('selectedTags', { required: true });
|
||||
const tagMatchType = defineModel<TagMatchType>('tagMatchType', { required: true });
|
||||
const billable = defineModel<'true' | 'false' | null>('billable', { required: true });
|
||||
const roundingEnabled = defineModel<boolean>('roundingEnabled', { required: true });
|
||||
const roundingType = defineModel<TimeEntryRoundingType>('roundingType', { required: true });
|
||||
@@ -35,6 +39,16 @@ const emit = defineEmits<{
|
||||
|
||||
const { tags } = useTagsQuery();
|
||||
|
||||
const tagMatchOptions: { value: TagMatchType; label: string }[] = [
|
||||
{ value: 'contains', label: 'Contains' },
|
||||
{ value: 'not_contains', label: 'Does Not Contain' },
|
||||
];
|
||||
|
||||
function selectTagMatchType(value: AcceptableValue) {
|
||||
tagMatchType.value = value as TagMatchType;
|
||||
emit('submit');
|
||||
}
|
||||
|
||||
async function createTag(name: string) {
|
||||
return await useTagsStore().createTag(name);
|
||||
}
|
||||
@@ -93,6 +107,34 @@ async function createTag(name: string) {
|
||||
title="Tags"
|
||||
:icon="TagIcon" />
|
||||
</template>
|
||||
<template #content-before-list>
|
||||
<div class="mt-2 border-b border-card-background-separator pb-2">
|
||||
<div
|
||||
id="tag-match-type-label"
|
||||
class="mb-1.5 px-2 text-xs font-medium text-text-tertiary uppercase">
|
||||
Match
|
||||
</div>
|
||||
<RadioGroupRoot
|
||||
:model-value="tagMatchType"
|
||||
aria-labelledby="tag-match-type-label"
|
||||
class="space-y-1"
|
||||
@update:model-value="selectTagMatchType">
|
||||
<RadioGroupItem
|
||||
v-for="option in tagMatchOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
class="relative flex w-full items-center rounded-md py-1.5 pl-2 pr-8 text-left text-sm font-medium text-text-secondary hover:bg-card-background-active data-[state=checked]:text-text-primary">
|
||||
{{ option.label }}
|
||||
<span
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<RadioGroupIndicator>
|
||||
<Check class="h-4 w-4" />
|
||||
</RadioGroupIndicator>
|
||||
</span>
|
||||
</RadioGroupItem>
|
||||
</RadioGroupRoot>
|
||||
</div>
|
||||
</template>
|
||||
</TagDropdown>
|
||||
|
||||
<Select v-model="billable" @update:model-value="emit('submit')">
|
||||
|
||||
@@ -49,6 +49,7 @@ import type { ExportFormat } from '@/types/reporting';
|
||||
import { getRandomColorWithSeed } from '@/packages/ui/src/utils/color';
|
||||
import { useProjectsQuery } from '@/utils/useProjectsQuery';
|
||||
import { useAggregatedTimeEntriesQuery } from '@/utils/useAggregatedTimeEntriesQuery';
|
||||
import type { TagMatchType } from '@/types/reporting';
|
||||
|
||||
type TimeEntryRoundingType = 'up' | 'down' | 'nearest';
|
||||
|
||||
@@ -67,6 +68,7 @@ const selectedProjects = ref<string[]>([]);
|
||||
const selectedMembers = ref<string[]>([]);
|
||||
const selectedTasks = ref<string[]>([]);
|
||||
const selectedClients = ref<string[]>([]);
|
||||
const tagMatchType = ref<TagMatchType>('contains');
|
||||
|
||||
const billable = ref<'true' | 'false' | null>(null);
|
||||
const roundingEnabled = ref<boolean>(false);
|
||||
@@ -122,6 +124,7 @@ const filterParams = computed<AggregatedTimeEntriesQueryParams>(() => {
|
||||
task_ids: selectedTasks.value.length > 0 ? selectedTasks.value : undefined,
|
||||
client_ids: selectedClients.value.length > 0 ? selectedClients.value : undefined,
|
||||
tag_ids: selectedTags.value.length > 0 ? selectedTags.value : undefined,
|
||||
tag_match_type: selectedTags.value.length > 0 ? tagMatchType.value : undefined,
|
||||
billable: billable.value !== null ? billable.value : undefined,
|
||||
member_id: getCurrentRole() === 'employee' ? getCurrentMembershipId() : undefined,
|
||||
rounding_type: roundingEnabled.value ? roundingType.value : undefined,
|
||||
@@ -366,6 +369,7 @@ const tableData = computed(() => {
|
||||
v-model:selected-tasks="selectedTasks"
|
||||
v-model:selected-clients="selectedClients"
|
||||
v-model:selected-tags="selectedTags"
|
||||
v-model:tag-match-type="tagMatchType"
|
||||
v-model:billable="billable"
|
||||
v-model:rounding-enabled="roundingEnabled"
|
||||
v-model:rounding-type="roundingType"
|
||||
|
||||
@@ -4,15 +4,12 @@ import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
import PageTitle from '@/Components/Common/PageTitle.vue';
|
||||
import {
|
||||
ChartBarIcon,
|
||||
ChevronLeftIcon,
|
||||
ChevronDoubleLeftIcon,
|
||||
ChevronRightIcon,
|
||||
ChevronDoubleRightIcon,
|
||||
ClockIcon,
|
||||
EllipsisVerticalIcon,
|
||||
ArrowDownTrayIcon,
|
||||
LockClosedIcon,
|
||||
} from '@heroicons/vue/20/solid';
|
||||
import Pagination from '@/Components/Common/Pagination.vue';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -43,16 +40,6 @@ import { useClientsQuery } from '@/utils/useClientsQuery';
|
||||
import { useClientsStore } from '@/utils/useClients';
|
||||
import { getOrganizationCurrencyString } from '@/utils/money';
|
||||
import { useMembersQuery } from '@/utils/useMembersQuery';
|
||||
import {
|
||||
PaginationEllipsis,
|
||||
PaginationFirst,
|
||||
PaginationLast,
|
||||
PaginationList,
|
||||
PaginationListItem,
|
||||
PaginationNext,
|
||||
PaginationPrev,
|
||||
PaginationRoot,
|
||||
} from 'radix-vue';
|
||||
import { useQueryClient } from '@tanstack/vue-query';
|
||||
import { getCurrentOrganizationId, getCurrentMembershipId } from '@/utils/useUser';
|
||||
import ReportingTabNavbar from '@/Components/Common/Reporting/ReportingTabNavbar.vue';
|
||||
@@ -67,6 +54,7 @@ import ReportingFilterBar from '@/Components/Common/Reporting/ReportingFilterBar
|
||||
import { useTimeEntriesReportQuery } from '@/utils/useTimeEntriesReportQuery';
|
||||
import { useTimeEntriesMutations } from '@/utils/useTimeEntriesMutations';
|
||||
import { useOrganizationQuery } from '@/utils/useOrganizationQuery';
|
||||
import type { TagMatchType } from '@/types/reporting';
|
||||
|
||||
// TimeEntryRoundingType is now defined in ReportingRoundingControls component
|
||||
type TimeEntryRoundingType = 'up' | 'down' | 'nearest';
|
||||
@@ -84,6 +72,7 @@ const selectedProjects = ref<string[]>([]);
|
||||
const selectedMembers = ref<string[]>([]);
|
||||
const selectedTasks = ref<string[]>([]);
|
||||
const selectedClients = ref<string[]>([]);
|
||||
const tagMatchType = ref<TagMatchType>('contains');
|
||||
const billable = ref<'true' | 'false' | null>(null);
|
||||
const roundingEnabled = ref<boolean>(false);
|
||||
const roundingType = ref<TimeEntryRoundingType>('nearest');
|
||||
@@ -115,6 +104,7 @@ function getFilterAttributes() {
|
||||
task_ids: selectedTasks.value.length > 0 ? selectedTasks.value : undefined,
|
||||
client_ids: selectedClients.value.length > 0 ? selectedClients.value : undefined,
|
||||
tag_ids: selectedTags.value.length > 0 ? selectedTags.value : undefined,
|
||||
tag_match_type: selectedTags.value.length > 0 ? tagMatchType.value : undefined,
|
||||
billable: billable.value !== null ? billable.value : undefined,
|
||||
rounding_type: roundingEnabled.value ? roundingType.value : undefined,
|
||||
rounding_minutes: roundingEnabled.value ? roundingMinutes.value : undefined,
|
||||
@@ -337,6 +327,7 @@ async function downloadExport(format: ExportFormat) {
|
||||
v-model:selected-tasks="selectedTasks"
|
||||
v-model:selected-clients="selectedClients"
|
||||
v-model:selected-tags="selectedTags"
|
||||
v-model:tag-match-type="tagMatchType"
|
||||
v-model:billable="billable"
|
||||
v-model:rounding-enabled="roundingEnabled"
|
||||
v-model:rounding-type="roundingType"
|
||||
@@ -410,62 +401,6 @@ async function downloadExport(format: ExportFormat) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PaginationRoot
|
||||
v-model:page="currentPage"
|
||||
:total="totalPages"
|
||||
:items-per-page="pageLimit"
|
||||
class="flex justify-center items-center py-8"
|
||||
:sibling-count="1"
|
||||
show-edges>
|
||||
<PaginationList v-slot="{ items }" class="flex items-center space-x-1 relative">
|
||||
<div class="pr-2 flex items-center space-x-1 border-r border-border-primary mr-1">
|
||||
<PaginationFirst class="navigation-item">
|
||||
<ChevronDoubleLeftIcon class="w-4"> </ChevronDoubleLeftIcon>
|
||||
</PaginationFirst>
|
||||
<PaginationPrev class="mr-4 navigation-item">
|
||||
<ChevronLeftIcon class="w-4 text-text-tertiary hover:text-text-primary">
|
||||
</ChevronLeftIcon>
|
||||
</PaginationPrev>
|
||||
</div>
|
||||
<template v-for="(page, index) in items">
|
||||
<PaginationListItem
|
||||
v-if="page.type === 'page'"
|
||||
:key="index"
|
||||
class="pagination-item"
|
||||
:value="page.value">
|
||||
{{ page.value }}
|
||||
</PaginationListItem>
|
||||
<PaginationEllipsis
|
||||
v-else
|
||||
:key="page.type"
|
||||
:index="index"
|
||||
class="PaginationEllipsis">
|
||||
<div class="px-2">…</div>
|
||||
</PaginationEllipsis>
|
||||
</template>
|
||||
<div class="!ml-2 pl-2 flex items-center space-x-1 border-l border-border-primary">
|
||||
<PaginationNext class="navigation-item">
|
||||
<ChevronRightIcon
|
||||
class="w-4 text-text-tertiary hover:text-text-primary"></ChevronRightIcon>
|
||||
</PaginationNext>
|
||||
<PaginationLast class="navigation-item">
|
||||
<ChevronDoubleRightIcon
|
||||
class="w-4 text-text-tertiary hover:text-text-primary"></ChevronDoubleRightIcon>
|
||||
</PaginationLast>
|
||||
</div>
|
||||
</PaginationList>
|
||||
</PaginationRoot>
|
||||
<Pagination v-model:page="currentPage" :total="totalPages" :items-per-page="pageLimit" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
<style lang="postcss">
|
||||
.navigation-item {
|
||||
@apply bg-quaternary h-8 w-8 flex items-center justify-center rounded border border-border-primary text-text-tertiary hover:text-text-primary transition cursor-pointer hover:border-border-secondary hover:bg-secondary focus-visible:text-text-primary focus-visible:outline-0 focus-visible:ring-2 focus-visible:ring-ring;
|
||||
}
|
||||
|
||||
.pagination-item {
|
||||
@apply bg-secondary h-8 w-8 flex items-center justify-center rounded border border-border-tertiary text-text-secondary hover:text-text-primary transition cursor-pointer hover:border-border-secondary hover:bg-secondary focus-visible:text-text-primary focus-visible:outline-0 focus-visible:ring-2 focus-visible:ring-ring;
|
||||
}
|
||||
.pagination-item[data-selected] {
|
||||
@apply text-text-primary bg-accent-300/10 border border-accent-300/20 rounded-md font-medium hover:bg-accent-300/20 active:bg-accent-300/20 outline-0 focus-visible:ring-2 focus:ring-ring transition ease-in-out duration-150;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -448,6 +448,7 @@ const ReportStoreRequest = z
|
||||
client_ids: z.union([z.array(z.string()), z.null()]).optional(),
|
||||
project_ids: z.union([z.array(z.string()), z.null()]).optional(),
|
||||
tag_ids: z.union([z.array(z.string()), z.null()]).optional(),
|
||||
tag_match_type: z.enum(['contains', 'not_contains']).optional(),
|
||||
task_ids: z.union([z.array(z.string()), z.null()]).optional(),
|
||||
group: TimeEntryAggregationType,
|
||||
sub_group: TimeEntryAggregationType,
|
||||
@@ -481,6 +482,7 @@ const DetailedReportResource = z
|
||||
client_ids: z.union([z.array(z.string()), z.null()]),
|
||||
project_ids: z.union([z.array(z.string()), z.null()]),
|
||||
tag_ids: z.union([z.array(z.string()), z.null()]),
|
||||
tag_match_type: z.union([z.enum(['contains', 'not_contains']), z.null()]),
|
||||
task_ids: z.union([z.array(z.string()), z.null()]),
|
||||
rounding_type: z.union([z.string(), z.null()]),
|
||||
rounding_minutes: z.union([z.number(), z.null()]),
|
||||
@@ -3784,6 +3786,11 @@ Users with the permission `time-entries:view:own` can only use this en
|
||||
type: 'Query',
|
||||
schema: z.array(z.string()).min(1).optional(),
|
||||
},
|
||||
{
|
||||
name: 'tag_match_type',
|
||||
type: 'Query',
|
||||
schema: z.enum(['contains', 'not_contains']).optional(),
|
||||
},
|
||||
{
|
||||
name: 'task_ids',
|
||||
type: 'Query',
|
||||
@@ -4165,6 +4172,11 @@ If the group parameters are all set to `null` or are all missing, the
|
||||
type: 'Query',
|
||||
schema: z.array(z.string()).min(1).optional(),
|
||||
},
|
||||
{
|
||||
name: 'tag_match_type',
|
||||
type: 'Query',
|
||||
schema: z.enum(['contains', 'not_contains']).optional(),
|
||||
},
|
||||
{
|
||||
name: 'task_ids',
|
||||
type: 'Query',
|
||||
@@ -4359,6 +4371,11 @@ If the group parameters are all set to `null` or are all missing, the
|
||||
type: 'Query',
|
||||
schema: z.array(z.string()).min(1).optional(),
|
||||
},
|
||||
{
|
||||
name: 'tag_match_type',
|
||||
type: 'Query',
|
||||
schema: z.enum(['contains', 'not_contains']).optional(),
|
||||
},
|
||||
{
|
||||
name: 'task_ids',
|
||||
type: 'Query',
|
||||
@@ -4487,6 +4504,11 @@ If the group parameters are all set to `null` or are all missing, the
|
||||
type: 'Query',
|
||||
schema: z.array(z.string()).min(1).optional(),
|
||||
},
|
||||
{
|
||||
name: 'tag_match_type',
|
||||
type: 'Query',
|
||||
schema: z.enum(['contains', 'not_contains']).optional(),
|
||||
},
|
||||
{
|
||||
name: 'task_ids',
|
||||
type: 'Query',
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
"@floating-ui/vue": "^1.1.4",
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"@vitejs/plugin-vue": "^5.1.2 || ^6.0.0",
|
||||
"@tanstack/vue-virtual": "^3.13.24",
|
||||
"@vueuse/core": "^12.5.0 || ^14.0.0",
|
||||
"@vueuse/integrations": "^12.5.0 || ^14.0.0",
|
||||
"focus-trap": "^7.0.0 || ^8.0.0",
|
||||
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
ComboboxItem,
|
||||
ComboboxRoot,
|
||||
ComboboxViewport,
|
||||
} from 'radix-vue';
|
||||
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
|
||||
ComboboxVirtualizer,
|
||||
} from 'reka-ui';
|
||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||
import { Check, Plus } from '@lucide/vue';
|
||||
|
||||
@@ -26,10 +26,6 @@ const searchInput = ref<HTMLElement | null>(null);
|
||||
const open = ref(false);
|
||||
const searchValue = ref('');
|
||||
|
||||
function isClientSelected(id: string) {
|
||||
return model.value === id;
|
||||
}
|
||||
|
||||
watch(open, (isOpen) => {
|
||||
if (isOpen) {
|
||||
nextTick(() => {
|
||||
@@ -58,15 +54,23 @@ async function addClientIfNoneExists() {
|
||||
}
|
||||
}
|
||||
|
||||
const NO_CLIENT: { id: string | null; name: string } = { id: null, name: 'No Client' };
|
||||
|
||||
const currentClient = computed(() => {
|
||||
return (
|
||||
props.clients.find((client) => client.id === model.value) ?? {
|
||||
id: null,
|
||||
name: 'No Client',
|
||||
}
|
||||
);
|
||||
return props.clients.find((client) => client.id === model.value) ?? NO_CLIENT;
|
||||
});
|
||||
|
||||
type ClientRow = Client | typeof NO_CLIENT;
|
||||
|
||||
// Fold the "No Client" entry in as the first row so the whole list virtualizes through one
|
||||
// ComboboxVirtualizer. NO_CLIENT is a shared constant so currentClient and the row reference
|
||||
// the same object and single-select highlighting still matches.
|
||||
const clientRows = computed<ClientRow[]>(() => [NO_CLIENT, ...filteredClients.value]);
|
||||
|
||||
function clientRowName(row: ClientRow) {
|
||||
return row.name;
|
||||
}
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'changed']);
|
||||
|
||||
function updateValue(client: { id: string | null; name: string }) {
|
||||
@@ -81,56 +85,56 @@ function updateValue(client: { id: string | null; name: string }) {
|
||||
<slot name="trigger"></slot>
|
||||
</template>
|
||||
<template #content>
|
||||
<UseFocusTrap v-if="open" :options="{ immediate: true, allowOutsideClick: true }">
|
||||
<div>
|
||||
<ComboboxRoot
|
||||
v-model:search-term="searchValue"
|
||||
v-model:open="open"
|
||||
:open="true"
|
||||
:model-value="currentClient"
|
||||
class="relative"
|
||||
@update:model-value="updateValue">
|
||||
:ignore-filter="true"
|
||||
@update:model-value="updateValue"
|
||||
@update:open="
|
||||
(value: boolean) => {
|
||||
if (!value) open = false;
|
||||
}
|
||||
">
|
||||
<ComboboxAnchor>
|
||||
<ComboboxInput
|
||||
ref="searchInput"
|
||||
v-model="searchValue"
|
||||
class="bg-transparent border-0 placeholder-muted-foreground text-sm text-popover-foreground py-2 px-3 focus:ring-0 border-b border-popover-border focus:border-popover-border w-full"
|
||||
placeholder="Search for a client..." />
|
||||
</ComboboxAnchor>
|
||||
<ComboboxContent>
|
||||
<ComboboxViewport
|
||||
class="w-[--reka-popper-anchor-width] max-h-60 overflow-y-scroll p-1">
|
||||
<ComboboxItem
|
||||
:value="{ id: null, name: 'No Client' }"
|
||||
class="relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground">
|
||||
<span>No Client</span>
|
||||
<span
|
||||
v-if="model === null"
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<Check class="h-4 w-4" />
|
||||
</span>
|
||||
</ComboboxItem>
|
||||
<ComboboxItem
|
||||
v-for="client in filteredClients"
|
||||
:key="client.id"
|
||||
:value="client"
|
||||
class="relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground"
|
||||
:data-client-id="client.id">
|
||||
<span>{{ client.name }}</span>
|
||||
<span
|
||||
v-if="isClientSelected(client.id)"
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<Check class="h-4 w-4" />
|
||||
</span>
|
||||
</ComboboxItem>
|
||||
<div
|
||||
v-if="searchValue.length > 0 && filteredClients.length === 0"
|
||||
class="flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground"
|
||||
@click="addClientIfNoneExists">
|
||||
<Plus class="h-4 w-4 shrink-0" />
|
||||
<span>Add "{{ searchValue }}" as a new Client</span>
|
||||
</div>
|
||||
<ComboboxVirtualizer
|
||||
v-slot="{ option: row }"
|
||||
:options="clientRows"
|
||||
:estimate-size="32"
|
||||
:text-content="clientRowName">
|
||||
<ComboboxItem
|
||||
:value="row"
|
||||
class="relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground"
|
||||
:data-client-id="row.id">
|
||||
<span class="min-w-0 flex-1 truncate">{{ row.name }}</span>
|
||||
<span
|
||||
v-if="model === row.id"
|
||||
class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<Check class="h-4 w-4" />
|
||||
</span>
|
||||
</ComboboxItem>
|
||||
</ComboboxVirtualizer>
|
||||
</ComboboxViewport>
|
||||
<div
|
||||
v-if="searchValue.length > 0 && filteredClients.length === 0"
|
||||
class="flex items-center gap-2 rounded-sm mx-1 px-2 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground"
|
||||
@click="addClientIfNoneExists">
|
||||
<Plus class="h-4 w-4 shrink-0" />
|
||||
<span>Add "{{ searchValue }}" as a new Client</span>
|
||||
</div>
|
||||
</ComboboxContent>
|
||||
</ComboboxRoot>
|
||||
</UseFocusTrap>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts" generic="T">
|
||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||
import { computed, type Ref, ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import Checkbox from '@/packages/ui/src/Input/Checkbox.vue';
|
||||
import {
|
||||
ComboboxAnchor,
|
||||
@@ -9,10 +9,16 @@ import {
|
||||
ComboboxItem,
|
||||
ComboboxRoot,
|
||||
ComboboxViewport,
|
||||
} from 'radix-vue';
|
||||
ComboboxVirtualizer,
|
||||
} from 'reka-ui';
|
||||
|
||||
const NONE_ID = 'none';
|
||||
|
||||
// height of one row (px-2 py-1.5 text-sm → 12px padding + 20px line box).
|
||||
// Rows are uniform single-line, so a fixed size is exact enough for the virtualizer and avoids
|
||||
// any per-row DOM measurement.
|
||||
const ROW_HEIGHT = 32;
|
||||
|
||||
const model = defineModel<string[]>({
|
||||
default: [],
|
||||
});
|
||||
@@ -27,20 +33,25 @@ const props = defineProps<{
|
||||
|
||||
const open = ref(false);
|
||||
const searchValue = ref('');
|
||||
const sortedItems = ref<T[]>([]) as Ref<T[]>;
|
||||
// Pinned on open so rows don't re-sort while toggling; the item list itself stays reactive.
|
||||
const pinnedSelection = ref<Set<string>>(new Set());
|
||||
|
||||
watch(open, (isOpen) => {
|
||||
if (isOpen) {
|
||||
searchValue.value = '';
|
||||
sortedItems.value = [...props.items].sort((a, b) => {
|
||||
const aSelected = model.value.includes(props.getKeyFromItem(a)) ? 0 : 1;
|
||||
const bSelected = model.value.includes(props.getKeyFromItem(b)) ? 0 : 1;
|
||||
if (aSelected !== bSelected) return aSelected - bSelected;
|
||||
return props.getNameForItem(a).localeCompare(props.getNameForItem(b));
|
||||
});
|
||||
pinnedSelection.value = new Set(model.value);
|
||||
}
|
||||
});
|
||||
|
||||
const sortedItems = computed(() => {
|
||||
return [...props.items].sort((a, b) => {
|
||||
const aSelected = pinnedSelection.value.has(props.getKeyFromItem(a)) ? 0 : 1;
|
||||
const bSelected = pinnedSelection.value.has(props.getKeyFromItem(b)) ? 0 : 1;
|
||||
if (aSelected !== bSelected) return aSelected - bSelected;
|
||||
return props.getNameForItem(a).localeCompare(props.getNameForItem(b));
|
||||
});
|
||||
});
|
||||
|
||||
const filteredItems = computed(() => {
|
||||
const search = searchValue.value.toLowerCase().trim();
|
||||
if (!search) return sortedItems.value;
|
||||
@@ -56,6 +67,23 @@ const showNoItem = computed(() => {
|
||||
return props.noItemLabel.toLowerCase().includes(search);
|
||||
});
|
||||
|
||||
// A single flat list for the virtualizer. The optional "no item" entry is folded in as the
|
||||
// first row so the whole list (including it) is virtualized through one ComboboxVirtualizer.
|
||||
type Row = { kind: 'none' } | { kind: 'item'; item: T };
|
||||
|
||||
const rows = computed<Row[]>(() => {
|
||||
const itemRows = filteredItems.value.map((item): Row => ({ kind: 'item', item }));
|
||||
return showNoItem.value ? [{ kind: 'none' }, ...itemRows] : itemRows;
|
||||
});
|
||||
|
||||
function keyForRow(row: Row): string {
|
||||
return row.kind === 'none' ? NONE_ID : props.getKeyFromItem(row.item);
|
||||
}
|
||||
|
||||
function nameForRow(row: Row): string {
|
||||
return row.kind === 'none' ? (props.noItemLabel ?? '') : props.getNameForItem(row.item);
|
||||
}
|
||||
|
||||
function toggleItem(id: string) {
|
||||
if (model.value.includes(id)) {
|
||||
model.value = model.value.filter((itemId) => itemId !== id);
|
||||
@@ -74,46 +102,44 @@ const emit = defineEmits(['update:modelValue', 'changed', 'submit']);
|
||||
<slot name="trigger"></slot>
|
||||
</template>
|
||||
<template #content>
|
||||
<!-- kept open so the list stays visible during the popover close animation -->
|
||||
<ComboboxRoot
|
||||
v-model:search-term="searchValue"
|
||||
v-model:open="open"
|
||||
:open="true"
|
||||
class="p-2"
|
||||
:filter-function="(val: string[]) => val">
|
||||
:ignore-filter="true"
|
||||
@update:open="
|
||||
(value: boolean) => {
|
||||
if (!value) open = false;
|
||||
}
|
||||
">
|
||||
<ComboboxAnchor>
|
||||
<ComboboxInput
|
||||
v-model="searchValue"
|
||||
class="w-full h-8 rounded-md border border-input-border bg-input-background px-3 text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none"
|
||||
:placeholder="searchPlaceholder" />
|
||||
</ComboboxAnchor>
|
||||
<ComboboxContent
|
||||
:dismiss-able="false"
|
||||
position="inline"
|
||||
class="mt-2 min-w-60 max-w-80 max-h-60 overflow-y-auto">
|
||||
<ComboboxViewport>
|
||||
<ComboboxItem
|
||||
v-if="showNoItem"
|
||||
:value="NONE_ID"
|
||||
class="flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-text-primary data-[highlighted]:bg-card-background-active cursor-default"
|
||||
@select.prevent="toggleItem(NONE_ID)">
|
||||
<Checkbox
|
||||
:checked="model.includes(NONE_ID)"
|
||||
aria-hidden="true"
|
||||
:tabindex="-1"
|
||||
class="pointer-events-none" />
|
||||
<span class="truncate">{{ noItemLabel }}</span>
|
||||
</ComboboxItem>
|
||||
<ComboboxItem
|
||||
v-for="item in filteredItems"
|
||||
:key="getKeyFromItem(item)"
|
||||
:value="getKeyFromItem(item)"
|
||||
class="flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-text-primary data-[highlighted]:bg-card-background-active cursor-default"
|
||||
@select.prevent="toggleItem(getKeyFromItem(item))">
|
||||
<Checkbox
|
||||
:checked="model.includes(getKeyFromItem(item))"
|
||||
aria-hidden="true"
|
||||
:tabindex="-1"
|
||||
class="pointer-events-none" />
|
||||
<span class="truncate">{{ getNameForItem(item) }}</span>
|
||||
</ComboboxItem>
|
||||
class="mt-2 min-w-60 max-w-80">
|
||||
<ComboboxViewport class="max-h-60 overflow-y-auto">
|
||||
<ComboboxVirtualizer
|
||||
v-slot="{ option }"
|
||||
:options="rows"
|
||||
:estimate-size="ROW_HEIGHT"
|
||||
:text-content="nameForRow">
|
||||
<ComboboxItem
|
||||
:value="keyForRow(option)"
|
||||
class="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-text-primary data-[highlighted]:bg-card-background-active cursor-default"
|
||||
@select.prevent="toggleItem(keyForRow(option))">
|
||||
<Checkbox
|
||||
:checked="model.includes(keyForRow(option))"
|
||||
aria-hidden="true"
|
||||
:tabindex="-1"
|
||||
class="pointer-events-none" />
|
||||
<span class="truncate">{{ nameForRow(option) }}</span>
|
||||
</ComboboxItem>
|
||||
</ComboboxVirtualizer>
|
||||
</ComboboxViewport>
|
||||
</ComboboxContent>
|
||||
</ComboboxRoot>
|
||||
|
||||
@@ -9,9 +9,9 @@ defineProps<{
|
||||
<template>
|
||||
<div
|
||||
class="flex justify-between items-center w-full text-start text-sm font-medium leading-5 text-text-primary hover:bg-card-background-active focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out">
|
||||
<div class="flex space-x-3 items-center px-3 py-1.5">
|
||||
<div :style="{ backgroundColor: color }" class="w-3 h-3 rounded-full"></div>
|
||||
<span>{{ name }}</span>
|
||||
<div class="flex space-x-3 items-center px-3 py-1.5 min-w-0">
|
||||
<div :style="{ backgroundColor: color }" class="w-3 h-3 rounded-full shrink-0"></div>
|
||||
<span class="truncate">{{ name }}</span>
|
||||
</div>
|
||||
<slot name="actions"></slot>
|
||||
</div>
|
||||
|
||||
@@ -37,19 +37,24 @@ const model = defineModel<string[]>({
|
||||
|
||||
const open = ref(false);
|
||||
const searchValue = ref('');
|
||||
const sortedTags = ref<Tag[]>([]);
|
||||
// Pinned on open so rows don't re-sort while toggling; the tag list itself stays reactive.
|
||||
const pinnedSelection = ref<Set<string>>(new Set());
|
||||
|
||||
watch(open, (isOpen) => {
|
||||
if (isOpen) {
|
||||
searchValue.value = '';
|
||||
sortedTags.value = [...props.tags].sort((a, b) => {
|
||||
const aSelected = model.value.includes(a.id) ? 0 : 1;
|
||||
const bSelected = model.value.includes(b.id) ? 0 : 1;
|
||||
return aSelected - bSelected;
|
||||
});
|
||||
pinnedSelection.value = new Set(model.value);
|
||||
}
|
||||
});
|
||||
|
||||
const sortedTags = computed(() => {
|
||||
return [...props.tags].sort((a, b) => {
|
||||
const aSelected = pinnedSelection.value.has(a.id) ? 0 : 1;
|
||||
const bSelected = pinnedSelection.value.has(b.id) ? 0 : 1;
|
||||
return aSelected - bSelected;
|
||||
});
|
||||
});
|
||||
|
||||
const filteredTags = computed(() => {
|
||||
const search = searchValue.value.toLowerCase().trim();
|
||||
if (!search) return sortedTags.value;
|
||||
@@ -114,6 +119,7 @@ const showCreateTagModal = ref(false);
|
||||
class="w-full rounded-md border border-input-border bg-input-background px-3 py-1.5 text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none"
|
||||
placeholder="Search for a Tag..." />
|
||||
</ComboboxAnchor>
|
||||
<slot name="content-before-list"></slot>
|
||||
<ComboboxContent
|
||||
:dismiss-able="false"
|
||||
position="inline"
|
||||
|
||||
@@ -87,4 +87,32 @@ describe('TimeTrackerProjectTaskDropdown', () => {
|
||||
|
||||
expect(wrapper.emitted('changed')?.at(-1)).toEqual(['', null]);
|
||||
});
|
||||
|
||||
it("keeps a project's tasks visible when the search term matches the project name", async () => {
|
||||
const project = {
|
||||
id: 'p-dummy',
|
||||
name: 'dummy',
|
||||
color: '#fff',
|
||||
client_id: null,
|
||||
is_archived: false,
|
||||
} as unknown as Project;
|
||||
const tasks = [
|
||||
{ id: 't-1', name: 'design', project_id: 'p-dummy', is_done: false },
|
||||
{ id: 't-2', name: 'build', project_id: 'p-dummy', is_done: false },
|
||||
] as unknown as Task[];
|
||||
|
||||
const wrapper = mountDropdown({ projects: [project], tasks });
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
|
||||
const searchInput = wrapper.find('[data-testid="client_dropdown_search"]');
|
||||
await searchInput.setValue('dummy');
|
||||
await nextTick();
|
||||
|
||||
// project itself shows up
|
||||
expect(wrapper.find('[data-project-id="p-dummy"]').exists()).toBe(true);
|
||||
// and its tasks are still available even though they don't match "dummy":
|
||||
// the task expander keeps showing all of the project's tasks
|
||||
expect(wrapper.text()).toContain('2 Tasks');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ChevronRightIcon, ChevronDownIcon } from '@heroicons/vue/16/solid';
|
||||
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue';
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { useVirtualizer } from '@tanstack/vue-virtual';
|
||||
import ProjectDropdownItem from '@/packages/ui/src/Project/ProjectDropdownItem.vue';
|
||||
import type {
|
||||
CreateClientBody,
|
||||
@@ -29,7 +30,6 @@ const project = defineModel<string | null>('project', {
|
||||
const searchInput = ref<HTMLInputElement | null>(null);
|
||||
const open = ref(false);
|
||||
const dropdownViewport = ref<HTMLElement | null>(null);
|
||||
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
|
||||
|
||||
const searchValue = ref('');
|
||||
|
||||
@@ -85,72 +85,119 @@ const filteredProjects = computed<ProjectWithTasks[]>(() => {
|
||||
return filteredResults.value.map((client) => client.projects).flat();
|
||||
});
|
||||
|
||||
type FlatRow =
|
||||
| { kind: 'client'; key: string; name: string }
|
||||
| { kind: 'project'; key: string; project: ProjectWithTasks }
|
||||
| { kind: 'task'; key: string; task: Task };
|
||||
|
||||
// Flatten the grouped client → project → task tree into a single ordered list so it can be
|
||||
// virtualized: only the rows currently inside the viewport are mounted, which keeps the
|
||||
// dropdown responsive even with thousands of projects/tasks.
|
||||
const flatRows = computed<FlatRow[]>(() => {
|
||||
const rows: FlatRow[] = [];
|
||||
for (const client of filteredResults.value) {
|
||||
// The "No Project" group renders its project inline without a client header.
|
||||
if (client.id !== 'no_project_no_client') {
|
||||
rows.push({ kind: 'client', key: 'client-' + client.id, name: client.name });
|
||||
}
|
||||
for (const projectWithTasks of client.projects) {
|
||||
rows.push({
|
||||
kind: 'project',
|
||||
key: 'project-' + projectWithTasks.id,
|
||||
project: projectWithTasks,
|
||||
});
|
||||
if (projectWithTasks.expanded) {
|
||||
for (const taskItem of projectWithTasks.tasks) {
|
||||
rows.push({ kind: 'task', key: 'task-' + taskItem.id, task: taskItem });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
|
||||
const ROW_HEIGHT = { client: 28, project: 36, task: 32 } as const;
|
||||
|
||||
const rowVirtualizer = useVirtualizer(
|
||||
computed(() => ({
|
||||
count: flatRows.value.length,
|
||||
getScrollElement: () => dropdownViewport.value,
|
||||
estimateSize: (index: number) => {
|
||||
const row = flatRows.value[index];
|
||||
if (row?.kind === 'client') return ROW_HEIGHT.client;
|
||||
if (row?.kind === 'task') return ROW_HEIGHT.task;
|
||||
return ROW_HEIGHT.project;
|
||||
},
|
||||
getItemKey: (index: number) => flatRows.value[index]?.key ?? index,
|
||||
overscan: 12,
|
||||
}))
|
||||
);
|
||||
|
||||
const totalSize = computed(() => rowVirtualizer.value.getTotalSize());
|
||||
|
||||
const visibleRows = computed(() =>
|
||||
rowVirtualizer.value.getVirtualItems().map((virtualRow) => ({
|
||||
virtualRow,
|
||||
row: flatRows.value[virtualRow.index]!,
|
||||
}))
|
||||
);
|
||||
|
||||
// Lookup maps so filtering is O(projects + tasks + clients) instead of
|
||||
// O(projects × (tasks + clients)). They are rebuilt only when the underlying task/client
|
||||
// props change, not on every keystroke.
|
||||
const tasksByProject = computed(() => {
|
||||
const map = new Map<string, Task[]>();
|
||||
for (const taskItem of props.tasks) {
|
||||
const list = map.get(taskItem.project_id);
|
||||
if (list) {
|
||||
list.push(taskItem);
|
||||
} else {
|
||||
map.set(taskItem.project_id, [taskItem]);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
});
|
||||
|
||||
const clientsById = computed(() => {
|
||||
const map = new Map<string, Client>();
|
||||
for (const clientItem of props.clients) {
|
||||
map.set(clientItem.id, clientItem);
|
||||
}
|
||||
return map;
|
||||
});
|
||||
|
||||
function addProjectToFilterObject(
|
||||
tempFilteredClients: ClientsWithProjectsWithTasks,
|
||||
groupIndexByKey: Map<string, number>,
|
||||
project: Project,
|
||||
filteredTasks: Task[],
|
||||
expanded = false
|
||||
) {
|
||||
// check if client already exists in filter array
|
||||
const projectClientIndex = tempFilteredClients.findIndex(
|
||||
(client) => client.id === project.client_id
|
||||
);
|
||||
const client = project.client_id ? clientsById.value.get(project.client_id) : undefined;
|
||||
const groupKey = client ? client.id : 'no_client';
|
||||
const newProject: ProjectWithTasks = { ...project, expanded, tasks: filteredTasks };
|
||||
|
||||
const client = props.clients.find((client) => client.id === project.client_id);
|
||||
// O(1) group lookup instead of scanning the accumulating array for every project.
|
||||
const existingIndex = groupIndexByKey.get(groupKey);
|
||||
if (existingIndex !== undefined) {
|
||||
tempFilteredClients[existingIndex]!.projects.push(newProject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectClientIndex !== -1) {
|
||||
// client already exists in filter array
|
||||
tempFilteredClients[projectClientIndex]!.projects.push({
|
||||
...project,
|
||||
expanded: expanded,
|
||||
tasks: filteredTasks,
|
||||
});
|
||||
} else if (client) {
|
||||
// project has client but is not already in filter array
|
||||
// client is not yet in filter array
|
||||
tempFilteredClients.push({
|
||||
...client,
|
||||
projects: [
|
||||
{
|
||||
...project,
|
||||
expanded: expanded,
|
||||
tasks: filteredTasks,
|
||||
},
|
||||
],
|
||||
});
|
||||
groupIndexByKey.set(groupKey, tempFilteredClients.length);
|
||||
if (client) {
|
||||
tempFilteredClients.push({ ...client, projects: [newProject] });
|
||||
} else {
|
||||
// project has no client
|
||||
const customNoClientId = 'no_client';
|
||||
const noClientIndex = tempFilteredClients.findIndex(
|
||||
(client) => client.id === customNoClientId
|
||||
);
|
||||
|
||||
if (noClientIndex !== -1) {
|
||||
// no client group already exists in filter array
|
||||
tempFilteredClients[noClientIndex]!.projects.push({
|
||||
...project,
|
||||
expanded: expanded,
|
||||
tasks: filteredTasks,
|
||||
});
|
||||
} else {
|
||||
// no client group is not yet in filter array
|
||||
tempFilteredClients.push({
|
||||
id: customNoClientId,
|
||||
name: 'No Client',
|
||||
color: 'var(--theme-color-icon-default)',
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
value: '',
|
||||
is_archived: false,
|
||||
projects: [
|
||||
{
|
||||
...project,
|
||||
expanded: expanded,
|
||||
tasks: filteredTasks,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
tempFilteredClients.push({
|
||||
id: 'no_client',
|
||||
name: 'No Client',
|
||||
color: 'var(--theme-color-icon-default)',
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
value: '',
|
||||
is_archived: false,
|
||||
projects: [newProject],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,39 +233,50 @@ function updateFilteredResults() {
|
||||
});
|
||||
}
|
||||
|
||||
const searchTerm = searchValue.value?.toLowerCase()?.trim() || '';
|
||||
const groupIndexByKey = new Map<string, number>();
|
||||
|
||||
for (const filterProject of props.projects) {
|
||||
const projectNameIncludesSearchTerm = filterProject.name
|
||||
.toLowerCase()
|
||||
.includes(searchValue.value?.toLowerCase()?.trim() || '');
|
||||
const projectNameIncludesSearchTerm = filterProject.name.toLowerCase().includes(searchTerm);
|
||||
|
||||
const clientNameIncludesSearchTerm = props.clients
|
||||
.find((client) => client.id === filterProject.client_id)
|
||||
?.name.toLowerCase()
|
||||
.includes(searchValue.value?.toLowerCase()?.trim() || '');
|
||||
const clientName = filterProject.client_id
|
||||
? clientsById.value.get(filterProject.client_id)?.name
|
||||
: undefined;
|
||||
const clientNameIncludesSearchTerm = clientName?.toLowerCase().includes(searchTerm);
|
||||
|
||||
// check if one of the project tasks
|
||||
const projectTasks = props.tasks.filter((task) => {
|
||||
return task.project_id === filterProject.id;
|
||||
const projectTasks = tasksByProject.value.get(filterProject.id) ?? [];
|
||||
|
||||
// tasks that should be selectable regardless of the search term
|
||||
// (open tasks, plus the currently selected one even if it's done)
|
||||
const availableTasks = projectTasks.filter((filterTask) => {
|
||||
return !filterTask.is_done || filterTask.id === task.value;
|
||||
});
|
||||
|
||||
const filteredTasks = projectTasks.filter((filterTask) => {
|
||||
return (
|
||||
filterTask.name
|
||||
.toLowerCase()
|
||||
.includes(searchValue.value?.toLowerCase()?.trim() || '') &&
|
||||
(!filterTask.is_done || filterTask.id === task.value)
|
||||
);
|
||||
const filteredTasks = availableTasks.filter((filterTask) => {
|
||||
return filterTask.name.toLowerCase().includes(searchTerm);
|
||||
});
|
||||
|
||||
if (
|
||||
(projectNameIncludesSearchTerm || clientNameIncludesSearchTerm) &&
|
||||
(!filterProject.is_archived || project.value === filterProject.id)
|
||||
) {
|
||||
// search term matches project name
|
||||
addProjectToFilterObject(tempFilteredClients, filterProject, filteredTasks, false);
|
||||
// search term matches project (or client) name: show all the tasks
|
||||
addProjectToFilterObject(
|
||||
tempFilteredClients,
|
||||
groupIndexByKey,
|
||||
filterProject,
|
||||
availableTasks,
|
||||
false
|
||||
);
|
||||
} else if (filteredTasks.length > 0 && !filterProject.is_archived) {
|
||||
// search term matches task name
|
||||
addProjectToFilterObject(tempFilteredClients, filterProject, filteredTasks, true);
|
||||
addProjectToFilterObject(
|
||||
tempFilteredClients,
|
||||
groupIndexByKey,
|
||||
filterProject,
|
||||
filteredTasks,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,24 +468,18 @@ function moveHighlightDown() {
|
||||
const highlightedItemId = ref<string | null>(null);
|
||||
|
||||
watch(highlightedItemId, () => {
|
||||
const highlightedItem = dropdownViewport.value?.querySelector(
|
||||
`[data-project-id="${highlightedItemId.value}"]`
|
||||
if (highlightedItemId.value === null) {
|
||||
return;
|
||||
}
|
||||
// The highlighted row may be virtualized out of the DOM, so scroll by index
|
||||
// through the virtualizer instead of querying for the element.
|
||||
const index = flatRows.value.findIndex(
|
||||
(row) =>
|
||||
(row.kind === 'project' && row.project.id === highlightedItemId.value) ||
|
||||
(row.kind === 'task' && row.task.id === highlightedItemId.value)
|
||||
);
|
||||
if (highlightedItem) {
|
||||
highlightedItem.scrollIntoView({
|
||||
block: 'nearest',
|
||||
inline: 'nearest',
|
||||
});
|
||||
} else {
|
||||
const highlightedTask = dropdownViewport.value?.querySelector(
|
||||
`[data-task-id="${highlightedItemId.value}"]`
|
||||
);
|
||||
if (highlightedTask) {
|
||||
highlightedTask.scrollIntoView({
|
||||
block: 'nearest',
|
||||
inline: 'nearest',
|
||||
});
|
||||
}
|
||||
if (index !== -1) {
|
||||
rowVirtualizer.value.scrollToIndex(index, { align: 'auto' });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -475,6 +527,11 @@ const selectedProjectColor = computed(() => {
|
||||
return currentProject.value?.color || 'var(--theme-color-icon-default)';
|
||||
});
|
||||
|
||||
const selectedClientName = computed(() => {
|
||||
const clientId = currentProject.value?.client_id;
|
||||
return clientId ? clientsById.value.get(clientId)?.name : undefined;
|
||||
});
|
||||
|
||||
// This state prevents the selection to jump to random items when the mouse cursor is
|
||||
// over an item and some Item in the Dropdown is selected by keyboard navigation to scroll into view
|
||||
const mouseEnterHighlightActivated = ref(true);
|
||||
@@ -520,15 +577,24 @@ const showCreateProject = ref(false);
|
||||
:size="props.size"
|
||||
:class="twMerge('w-full justify-start overflow-hidden', props.class)">
|
||||
<div
|
||||
class="w-3 h-3 rounded-full shrink-0"
|
||||
class="w-2.5 h-2.5 rounded-full shrink-0"
|
||||
:style="{ backgroundColor: selectedProjectColor }"></div>
|
||||
<span class="truncate shrink-[1] text-text-primary pr-1">{{
|
||||
<span class="truncate shrink-[1] text-text-primary">{{
|
||||
selectedProjectName
|
||||
}}</span>
|
||||
<template v-if="currentTask">
|
||||
<ChevronRightIcon class="w-4 h-4 text-text-tertiary shrink-0" />
|
||||
<ChevronRightIcon class="!size-3 text-text-primary shrink-0 -mx-1" />
|
||||
<span class="truncate shrink-[100]">{{ currentTask.name }}</span>
|
||||
</template>
|
||||
<template v-if="selectedClientName">
|
||||
<span class="dark:text-text-tertiary text-text-quaternary shrink-0"
|
||||
>•</span
|
||||
>
|
||||
<span
|
||||
class="truncate shrink-[200] dark:text-text-tertiary text-text-quaternary"
|
||||
>{{ selectedClientName }}</span
|
||||
>
|
||||
</template>
|
||||
</Button>
|
||||
<button
|
||||
v-if="allowReset && project !== null"
|
||||
@@ -542,7 +608,7 @@ const showCreateProject = ref(false);
|
||||
</slot>
|
||||
</template>
|
||||
<template #content>
|
||||
<UseFocusTrap v-if="open" :options="{ immediate: true, allowOutsideClick: true }">
|
||||
<div>
|
||||
<input
|
||||
ref="searchInput"
|
||||
:value="searchValue"
|
||||
@@ -558,62 +624,63 @@ const showCreateProject = ref(false);
|
||||
@keydown.left.prevent="collapseProject" />
|
||||
<div
|
||||
ref="dropdownViewport"
|
||||
class="min-w-[350px] max-h-[350px] overflow-y-scroll relative"
|
||||
class="w-[400px] max-w-[calc(100vw-2rem)] max-h-[350px] overflow-y-scroll relative"
|
||||
@mousemove="mouseEnterHighlightActivated = true">
|
||||
<template v-for="client in filteredResults" :key="client.id">
|
||||
<div :style="{ height: `${totalSize}px`, width: '100%', position: 'relative' }">
|
||||
<div
|
||||
v-if="client.id !== 'no_project_no_client'"
|
||||
class="w-full pb-1 pt-2 px-2 text-text-tertiary text-xs font-semibold flex space-x-1 items-center">
|
||||
<span>
|
||||
{{ client.name }}
|
||||
</span>
|
||||
</div>
|
||||
<template
|
||||
v-for="projectWithTasks in client.projects"
|
||||
:key="projectWithTasks.id">
|
||||
v-for="{ virtualRow, row } in visibleRows"
|
||||
:key="row.key"
|
||||
class="absolute left-0 top-0 w-full"
|
||||
:style="{ transform: `translateY(${virtualRow.start}px)` }">
|
||||
<div
|
||||
v-if="row.kind === 'client'"
|
||||
class="w-full pb-1 pt-2 px-2 text-text-tertiary text-xs font-semibold flex space-x-1 items-center">
|
||||
<span class="truncate">{{ row.name }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="row.kind === 'project'"
|
||||
role="option"
|
||||
class="px-1 py-0.5 cursor-default"
|
||||
:value="projectWithTasks.id"
|
||||
:data-project-id="projectWithTasks.id"
|
||||
@click="selectProject(projectWithTasks.id)">
|
||||
:value="row.project.id"
|
||||
:data-project-id="row.project.id"
|
||||
@click="selectProject(row.project.id)">
|
||||
<div
|
||||
class="rounded-lg"
|
||||
:class="{
|
||||
'bg-card-background-active':
|
||||
projectWithTasks.id === highlightedItemId,
|
||||
row.project.id === highlightedItemId,
|
||||
}">
|
||||
<ProjectDropdownItem
|
||||
class="hover:!bg-transparent"
|
||||
:selected="isProjectSelected(projectWithTasks)"
|
||||
:name="projectWithTasks.name"
|
||||
:color="projectWithTasks.color"
|
||||
@mouseenter="setHighlightItemId(projectWithTasks.id)">
|
||||
:selected="isProjectSelected(row.project)"
|
||||
:name="row.project.name"
|
||||
:color="row.project.color"
|
||||
@mouseenter="setHighlightItemId(row.project.id)">
|
||||
<template #actions>
|
||||
<button
|
||||
v-if="projectWithTasks.tasks.length > 0"
|
||||
v-if="row.project.tasks.length > 0"
|
||||
tabindex="-1"
|
||||
class="px-2 py-0.5 mr-2 relative transition items-center rounded flex space-x-0.5 text-xs"
|
||||
class="px-2 py-0.5 mr-2 relative transition items-center rounded flex space-x-0.5 text-xs shrink-0"
|
||||
:class="{
|
||||
'bg-white/5 text-text-secondary':
|
||||
projectWithTasks.expanded,
|
||||
row.project.expanded,
|
||||
'hover:bg-white/5 hover:text-text-secondary text-text-tertiary':
|
||||
!projectWithTasks.expanded,
|
||||
!row.project.expanded,
|
||||
}"
|
||||
@click.prevent.stop="
|
||||
() => {
|
||||
projectWithTasks.expanded =
|
||||
!projectWithTasks.expanded;
|
||||
row.project.expanded =
|
||||
!row.project.expanded;
|
||||
searchInput?.focus();
|
||||
}
|
||||
">
|
||||
<span
|
||||
>{{ projectWithTasks.tasks.length }} Tasks</span
|
||||
<span class="whitespace-nowrap"
|
||||
>{{ row.project.tasks.length }} Tasks</span
|
||||
>
|
||||
<ChevronDownIcon
|
||||
:class="{
|
||||
'transform rotate-180':
|
||||
projectWithTasks.expanded,
|
||||
row.project.expanded,
|
||||
}"
|
||||
class="w-4"></ChevronDownIcon>
|
||||
</button>
|
||||
@@ -621,23 +688,23 @@ const showCreateProject = ref(false);
|
||||
</ProjectDropdownItem>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="projectWithTasks.expanded" class="bg-quaternary">
|
||||
<div
|
||||
v-for="task in projectWithTasks.tasks"
|
||||
:key="task.id"
|
||||
:data-task-id="task.id"
|
||||
:class="{
|
||||
'bg-card-background-active': task.id === highlightedItemId,
|
||||
}"
|
||||
class="flex items-center space-x-2 w-full px-5 py-1.5 text-start text-xs font-semibold leading-5 text-text-primary focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out"
|
||||
@click="selectTask(task.id)"
|
||||
@mouseenter="setHighlightItemId(task.id)">
|
||||
<MinusIcon class="w-3 h-3 text-text-quaternary"></MinusIcon>
|
||||
<span>{{ task.name }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="row.kind === 'task'"
|
||||
:data-task-id="row.task.id"
|
||||
class="flex items-center space-x-2 w-full px-5 py-1.5 text-start text-xs font-semibold leading-5 text-text-primary focus:outline-none transition duration-150 ease-in-out"
|
||||
:class="
|
||||
row.task.id === highlightedItemId
|
||||
? 'bg-card-background-active'
|
||||
: 'bg-quaternary'
|
||||
"
|
||||
@click="selectTask(row.task.id)"
|
||||
@mouseenter="setHighlightItemId(row.task.id)">
|
||||
<MinusIcon
|
||||
class="w-3 h-3 text-text-quaternary shrink-0"></MinusIcon>
|
||||
<span class="min-w-0 truncate">{{ row.task.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="canCreateProject" class="hover:bg-card-background-active rounded-b-lg">
|
||||
<button
|
||||
@@ -651,7 +718,7 @@ const showCreateProject = ref(false);
|
||||
<span>Create new Project</span>
|
||||
</button>
|
||||
</div>
|
||||
</UseFocusTrap>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
<ProjectCreateModal
|
||||
|
||||
@@ -199,7 +199,7 @@ body {
|
||||
--muted-foreground: var(--color-text-tertiary);
|
||||
--accent: var(--color-bg-tertiary);
|
||||
--accent-foreground: var(--color-text-primary);
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive: 0 72% 60%;
|
||||
--destructive-foreground: var(--color-text-primary);
|
||||
--border: var(--color-border-primary);
|
||||
--input: var(--color-border-tertiary);
|
||||
|
||||
@@ -18,3 +18,13 @@ window.getTimezoneSetting = vi.fn(() => 'UTC');
|
||||
window.getWeekStartSetting = vi.fn(() => 'monday');
|
||||
window.getNumberFormat = vi.fn(() => 'point');
|
||||
window.getIntervalFormat = vi.fn(() => 'hours-minutes');
|
||||
|
||||
// happy-dom has no layout engine, so every element reports offsetWidth/offsetHeight of 0.
|
||||
// TanStack Virtual (used by the project/task dropdown) measures via those properties, so
|
||||
// without a size it renders zero rows. Give elements a usable box so virtualized components
|
||||
// render their rows in component tests.
|
||||
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, get: () => 400 });
|
||||
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', {
|
||||
configurable: true,
|
||||
get: () => 350,
|
||||
});
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export type ExportFormat = 'xlsx' | 'csv' | 'ods' | 'pdf';
|
||||
export type TagMatchType = 'contains' | 'not_contains';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useQuery } from '@tanstack/vue-query';
|
||||
import { useQuery, keepPreviousData } from '@tanstack/vue-query';
|
||||
import { api, type TimeEntryResponse } from '@/packages/api/src';
|
||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||
import { computed, type Ref, type ComputedRef, unref } from 'vue';
|
||||
@@ -21,6 +21,9 @@ export function useTimeEntriesReportQuery(
|
||||
},
|
||||
queries: { ...unref(filterParams) },
|
||||
}),
|
||||
// Keep the previous page's data (incl. meta.total) while the next page loads, so
|
||||
// pagination doesn't transiently see total=1 and clamp the page back to 1.
|
||||
placeholderData: keepPreviousData,
|
||||
staleTime: 1000 * 30, // 30 seconds
|
||||
});
|
||||
}
|
||||
|
||||
3
resources/testfiles/clockify_projects_import_test_2.csv
Normal file
3
resources/testfiles/clockify_projects_import_test_2.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
"Project","Client","Status","Visibility","Billability","Tasks","Tracked (h)","Estimated (h)","Remaining (h)","Overage (h)","Tracked (USD)","Estimated (USD)","Remaining (USD)","Overage (USD)","Progress(%)","Recurring estimate","Billable (h)","Non-billable (h)","Billable Rate (USD)","Amount (USD)","Cost Rate (USD)","Expenses (USD)","Billable expenses (USD)","Non-billable expenses (USD)","Additional fields","Project members","Project manager","Note"
|
||||
"Active Project","Big Company","Active","Public","Yes","Task 1, Task 2","0.00","100.00","","","","","","","","","0.00","0.00","100.01","0.00","","0.00","0.00","0.00","","Constantin Graf","",""
|
||||
"Archived Project","","Archived","Public","Yes","","0.00","","","","","","","","","","0.00","0.00","","0.00","","0.00","0.00","0.00","","Constantin Graf","",""
|
||||
|
2
resources/testfiles/clockify_projects_import_test_3.csv
Normal file
2
resources/testfiles/clockify_projects_import_test_3.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
"Project","Client","Status","Visibility","Billability","Activities","Tracked (h)","Estimated (h)","Remaining (h)","Overage (h)","Tracked (USD)","Estimated (USD)","Remaining (USD)","Overage (USD)","Progress(%)","Recurring estimate","Billable (h)","Non-billable (h)","Billable Rate (USD)","Amount (USD)","Cost Rate (USD)","Expenses (USD)","Billable expenses (USD)","Non-billable expenses (USD)","Additional fields","Project members","Project manager","Note"
|
||||
"Project With Activities","","Active","Public","Yes","Activity A, Activity B","0.00","","","","","","","","","","0.00","0.00","","0.00","","0.00","0.00","0.00","","","",""
|
||||
|
2
resources/testfiles/clockify_projects_import_test_4.csv
Normal file
2
resources/testfiles/clockify_projects_import_test_4.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
"Project","Status","Visibility","Billability","Tasks","Tracked (h)","Estimated (h)","Remaining (h)","Overage (h)","Progress(%)","Billable (h)","Non-billable (h)","Billable Rate (USD)","Amount (USD)","Project members","Project manager","Note"
|
||||
"Project Without Client Column","Active","Public","Yes","Task 1, Task 2","0.00","100.00","","","","0.00","0.00","100.01","0.00","Constantin Graf","",""
|
||||
|
@@ -0,0 +1,3 @@
|
||||
"Project","Client","Description","Task","User","Group","Email","Tags","Start Date","Start Time","End Date","End Time","Duration (h)","Duration (decimal)","Billable Rate (USD)","Billable Amount (USD)"
|
||||
"Project without Client","","","","Peter Tester","","peter.test@email.test","Development, Backend","03/04/2024","10:23:52 AM","03/04/2024","10:23:52 AM","00:00:00","0.00","0.00","0.00"
|
||||
"Project for Big Company","Big Company","Working hard","Task 1","Peter Tester","","peter.test@email.test","","03/04/2024","10:23 AM","03/04/2024","11:23:01 AM","01:00:01","0.00","0.00","0.00"
|
||||
|
@@ -0,0 +1,3 @@
|
||||
"Project","Client","Description","Activity","User","Group","Email","Tags","Billable","Start Date","Start Time","End Date","End Time","Duration (h)","Duration (decimal)","Billable Rate (USD)","Billable Amount (USD)"
|
||||
"Project without Client","","","","Peter Tester","","peter.test@email.test","Development, Backend","No","03/04/2024","10:23:52 AM","03/04/2024","10:23:52 AM","00:00:00","0.00","0.00","0.00"
|
||||
"Project for Big Company","Big Company","Working hard","Task 1","Peter Tester","","peter.test@email.test","","Yes","03/04/2024","10:23 AM","03/04/2024","11:23:01 AM","01:00:01","0.00","0.00","0.00"
|
||||
|
@@ -0,0 +1,3 @@
|
||||
"Project","Description","Task","User","Group","Email","Tags","Billable","Start Date","Start Time","End Date","End Time","Duration (h)","Duration (decimal)","Billable Rate (USD)","Billable Amount (USD)"
|
||||
"Project A","","","Peter Tester","","peter.test@email.test","Development, Backend","No","03/04/2024","10:23:52 AM","03/04/2024","10:23:52 AM","00:00:00","0.00","0.00","0.00"
|
||||
"Project B","Working hard","Task 1","Peter Tester","","peter.test@email.test","","Yes","03/04/2024","10:23 AM","03/04/2024","11:23:01 AM","01:00:01","0.00","0.00","0.00"
|
||||
|
@@ -0,0 +1,2 @@
|
||||
"Project","Description","Task","User","Group","Email","Tags","Billable","Start Date","Start Time","End Date","End Time","Client"
|
||||
"Project A","Working hard","Task 1","Peter Tester","","peter.test@email.test","","Yes","03/04/2024","10:23 AM","03/04/2024","11:23:01 AM"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
{{ __('Your currently running time entry ":description" is now running for more than 8 hours!', ['description' => $timeEntry->description]) }}
|
||||
@endif
|
||||
|
||||
{{ __('If you forgot to stop the Time Tracker you do that in solidtime:') }}
|
||||
{{ __('If you forgot to stop the Time Tracker, you can do so in solidtime:') }}
|
||||
|
||||
@component('mail::button', ['url' => $dashboardUrl])
|
||||
{{ __('Go to solidtime') }}
|
||||
|
||||
@@ -45,7 +45,7 @@ class ClientEndpointTest extends ApiEndpointTestAbstract
|
||||
// Assert
|
||||
$response->assertStatus(200);
|
||||
$response->assertJsonCount(4, 'data');
|
||||
$clients = Client::query()->orderBy('created_at', 'desc')->get();
|
||||
$clients = Client::query()->orderBy('created_at', 'desc')->orderBy('id')->get();
|
||||
$response->assertJson(fn (AssertableJson $json) => $json
|
||||
->has('data')
|
||||
->has('links')
|
||||
@@ -84,9 +84,12 @@ class ClientEndpointTest extends ApiEndpointTestAbstract
|
||||
->has('links')
|
||||
->has('meta')
|
||||
->count('data', 2)
|
||||
->where('data.0.id', $clients->get(0)->getKey())
|
||||
->where('data.1.id', $clients->get(1)->getKey())
|
||||
);
|
||||
// Both clients share the same created_at, so their relative order is not defined.
|
||||
$this->assertEqualsCanonicalizing([
|
||||
$clients->get(0)->getKey(),
|
||||
$clients->get(1)->getKey(),
|
||||
], $response->json('data.*.id'));
|
||||
}
|
||||
|
||||
public function test_index_endpoint_without_filter_archived_returns_only_non_archived_clients(): void
|
||||
|
||||
@@ -13,6 +13,8 @@ use App\Models\ProjectMember;
|
||||
use App\Models\Task;
|
||||
use App\Models\TimeEntry;
|
||||
use App\Service\BillableRateService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Testing\Fluent\AssertableJson;
|
||||
use Laravel\Passport\Passport;
|
||||
use Mockery\MockInterface;
|
||||
@@ -81,6 +83,49 @@ class ProjectEndpointTest extends ApiEndpointTestAbstract
|
||||
$this->assertSame([$projectNewest->getKey(), $projectMiddle->getKey(), $projectOldest->getKey()], $ids);
|
||||
}
|
||||
|
||||
public function test_index_endpoint_pagination_returns_every_project_exactly_once_when_they_share_created_at(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'projects:view',
|
||||
'projects:view:all',
|
||||
]);
|
||||
config(['app.pagination_per_page_default' => 15]);
|
||||
|
||||
// Bulk import: 300 projects that all share the exact same created_at.
|
||||
$sharedCreatedAt = now()->subDay()->startOfSecond();
|
||||
$rows = [];
|
||||
for ($i = 0; $i < 300; $i++) {
|
||||
$rows[] = [
|
||||
'id' => (string) Str::uuid(),
|
||||
'name' => 'Project '.$i,
|
||||
'color' => '#000000',
|
||||
'is_billable' => false,
|
||||
'is_public' => false,
|
||||
'organization_id' => $data->organization->getKey(),
|
||||
'created_at' => $sharedCreatedAt,
|
||||
'updated_at' => $sharedCreatedAt,
|
||||
];
|
||||
}
|
||||
DB::table('projects')->insert($rows);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act - walk every page like resources/js/utils/fetchAllPages.ts does.
|
||||
$orgId = $data->organization->getKey();
|
||||
$first = $this->getJson(route('api.v1.projects.index', [$orgId]).'?page=1');
|
||||
$this->assertResponseCode($first, 200);
|
||||
$lastPage = $first->json('meta.last_page');
|
||||
$collected = collect($first->json('data.*.id'));
|
||||
for ($page = 2; $page <= $lastPage; $page++) {
|
||||
$response = $this->getJson(route('api.v1.projects.index', [$orgId]).'?page='.$page);
|
||||
$this->assertResponseCode($response, 200);
|
||||
$collected = $collected->concat($response->json('data.*.id'));
|
||||
}
|
||||
|
||||
// Assert - every project appears exactly once, none duplicated or missing.
|
||||
$this->assertEqualsCanonicalizing(array_column($rows, 'id'), $collected->all(), 'Some projects were duplicated or missing across pages');
|
||||
}
|
||||
|
||||
public function test_index_endpoint_without_filter_archived_returns_only_non_archived_projects(): void
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Api\V1\Public;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||
use App\Enums\Weekday;
|
||||
@@ -667,4 +668,58 @@ class PublicReportEndpointTest extends ApiEndpointTestAbstract
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_show_applies_not_contains_tag_match_type(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$tagA = Tag::factory()->forOrganization($organization)->create();
|
||||
$tagB = Tag::factory()->forOrganization($organization)->create();
|
||||
|
||||
// Entry with tagA (should be excluded by "does not contain tagA")
|
||||
TimeEntry::factory()->forOrganization($organization)
|
||||
->startWithDuration(now()->subDay(), 100)
|
||||
->create([
|
||||
'tags' => [$tagA->getKey()],
|
||||
]);
|
||||
// Entry with a different tag (should be included)
|
||||
TimeEntry::factory()->forOrganization($organization)
|
||||
->startWithDuration(now()->subDay(), 200)
|
||||
->create([
|
||||
'tags' => [$tagB->getKey()],
|
||||
]);
|
||||
// Entry without tags (should be included)
|
||||
TimeEntry::factory()->forOrganization($organization)
|
||||
->startWithDuration(now()->subDay(), 50)
|
||||
->create();
|
||||
|
||||
$reportDto = new ReportPropertiesDto;
|
||||
$reportDto->start = now()->subDays(2);
|
||||
$reportDto->end = now();
|
||||
$reportDto->group = TimeEntryAggregationType::Project;
|
||||
$reportDto->subGroup = TimeEntryAggregationType::Task;
|
||||
$reportDto->historyGroup = TimeEntryAggregationTypeInterval::Day;
|
||||
$reportDto->weekStart = Weekday::Monday;
|
||||
$reportDto->timezone = 'Europe/Vienna';
|
||||
$reportDto->setTagIds([$tagA->getKey()]);
|
||||
$reportDto->setTagMatchType(TagMatchType::NotContains);
|
||||
$report = Report::factory()->forOrganization($organization)->public()->create([
|
||||
'public_until' => null,
|
||||
'properties' => $reportDto,
|
||||
]);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.public.reports.show'), [
|
||||
'X-Api-Key' => $report->share_secret,
|
||||
]);
|
||||
|
||||
// Assert: tagA entry (100s) excluded; tagB (200s) + untagged (50s) included
|
||||
$response->assertOk();
|
||||
$response->assertJson([
|
||||
'data' => [
|
||||
'seconds' => 250,
|
||||
'grouped_type' => TimeEntryAggregationType::Project->value,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Api\V1;
|
||||
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
use App\Enums\Weekday;
|
||||
@@ -51,7 +52,7 @@ class ReportEndpointTest extends ApiEndpointTestAbstract
|
||||
// Assert
|
||||
$response->assertStatus(200);
|
||||
$response->assertJsonCount(4, 'data');
|
||||
$reports = Report::query()->orderBy('created_at', 'desc')->get();
|
||||
$reports = Report::query()->orderBy('created_at', 'desc')->orderBy('id')->get();
|
||||
$response->assertJson(fn (AssertableJson $json) => $json
|
||||
->has('data')
|
||||
->has('links')
|
||||
@@ -685,4 +686,64 @@ class ReportEndpointTest extends ApiEndpointTestAbstract
|
||||
'id' => $report->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_persists_tag_match_type(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'reports:create',
|
||||
]);
|
||||
$tag = Tag::factory()->forOrganization($data->organization)->create();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->withoutExceptionHandling()->postJson(route('api.v1.reports.store', [$data->organization->getKey()]), [
|
||||
'name' => 'Report with tag match type',
|
||||
'is_public' => false,
|
||||
'properties' => [
|
||||
'start' => Carbon::now()->subDays(30)->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->toIso8601ZuluString(),
|
||||
'group' => TimeEntryAggregationType::Project->value,
|
||||
'sub_group' => TimeEntryAggregationType::Task->value,
|
||||
'history_group' => TimeEntryAggregationType::Day->value,
|
||||
'tag_ids' => [$tag->getKey()],
|
||||
'tag_match_type' => TagMatchType::NotContains->value,
|
||||
],
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(201);
|
||||
/** @var Report $report */
|
||||
$report = Report::query()->findOrFail($response->json('data.id'));
|
||||
$this->assertSame(TagMatchType::NotContains, $report->properties->tagMatchType);
|
||||
// DetailedReportResource exposes the match type in the response
|
||||
$response->assertJsonPath('data.properties.tag_match_type', TagMatchType::NotContains->value);
|
||||
}
|
||||
|
||||
public function test_store_endpoint_rejects_invalid_tag_match_type(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'reports:create',
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->postJson(route('api.v1.reports.store', [$data->organization->getKey()]), [
|
||||
'name' => 'Report with invalid tag match type',
|
||||
'is_public' => false,
|
||||
'properties' => [
|
||||
'start' => Carbon::now()->subDays(30)->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->toIso8601ZuluString(),
|
||||
'group' => TimeEntryAggregationType::Project->value,
|
||||
'sub_group' => TimeEntryAggregationType::Task->value,
|
||||
'history_group' => TimeEntryAggregationType::Day->value,
|
||||
'tag_match_type' => 'invalid_value',
|
||||
],
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(422);
|
||||
$response->assertInvalid(['properties.tag_match_type']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class TagEndpointTest extends ApiEndpointTestAbstract
|
||||
// Assert
|
||||
$response->assertStatus(200);
|
||||
$response->assertJsonCount(4, 'data');
|
||||
$tags = Tag::query()->orderBy('created_at', 'desc')->get();
|
||||
$tags = Tag::query()->orderBy('created_at', 'desc')->orderBy('id')->get();
|
||||
$response->assertJson(fn (AssertableJson $json) => $json
|
||||
->has('data')
|
||||
->has('links')
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Tests\Unit\Endpoint\Api\V1;
|
||||
|
||||
use App\Enums\ExportFormat;
|
||||
use App\Enums\Role;
|
||||
use App\Enums\TagMatchType;
|
||||
use App\Enums\TimeEntryAggregationType;
|
||||
use App\Enums\TimeEntryAggregationTypeInterval;
|
||||
use App\Enums\TimeEntryRoundingType;
|
||||
@@ -23,6 +24,7 @@ use App\Models\User;
|
||||
use App\Service\TimeEntryFilter;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -90,6 +92,30 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
$response->assertJsonPath('data.0.id', $timeEntry->getKey());
|
||||
}
|
||||
|
||||
public function test_index_endpoint_filters_by_member_id_instead_of_legacy_user_id(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:own',
|
||||
]);
|
||||
$legacyUser = User::factory()->create();
|
||||
$timeEntry = TimeEntry::factory()->forMember($data->member)->create([
|
||||
'user_id' => $legacyUser->getKey(),
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$data->organization->getKey(),
|
||||
'member_id' => $data->member->getKey(),
|
||||
]));
|
||||
|
||||
// Assert
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertJsonCount(1, 'data');
|
||||
$response->assertJsonPath('data.0.id', $timeEntry->getKey());
|
||||
}
|
||||
|
||||
public function test_index_endpoint_fails_if_user_filter_is_from_different_organization(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -124,7 +150,10 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [$data->organization->getKey(), 'user_id' => $user->getKey()]));
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$data->organization->getKey(),
|
||||
'member_id' => $member->getKey(),
|
||||
]));
|
||||
|
||||
// Assert
|
||||
$this->assertResponseCode($response, 200);
|
||||
@@ -391,6 +420,59 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
);
|
||||
}
|
||||
|
||||
public function test_index_endpoint_pagination_returns_every_time_entry_exactly_once_with_rounding(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:own',
|
||||
]);
|
||||
|
||||
// Bulk import: 300 time entries that all share the exact same start.
|
||||
$sharedStart = Carbon::createFromFormat('Y-m-d H:i:s', '2020-01-01 00:00:07');
|
||||
$rows = [];
|
||||
for ($i = 0; $i < 300; $i++) {
|
||||
$rows[] = [
|
||||
'id' => (string) Str::uuid(),
|
||||
'description' => 'Entry '.$i,
|
||||
'start' => $sharedStart,
|
||||
'end' => $sharedStart,
|
||||
'billable' => false,
|
||||
'is_imported' => true,
|
||||
'user_id' => $data->member->user_id,
|
||||
'member_id' => $data->member->getKey(),
|
||||
'organization_id' => $data->organization->getKey(),
|
||||
'created_at' => $sharedStart,
|
||||
'updated_at' => $sharedStart,
|
||||
];
|
||||
}
|
||||
DB::table('time_entries')->insert($rows);
|
||||
$this->actAsOrganizationWithSubscription();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act - walk every page like the client does (limit/offset), with rounding enabled.
|
||||
$orgId = $data->organization->getKey();
|
||||
$limit = 15;
|
||||
$collected = collect();
|
||||
$offset = 0;
|
||||
do {
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$orgId,
|
||||
'member_id' => $data->member->getKey(),
|
||||
'rounding_type' => TimeEntryRoundingType::Nearest,
|
||||
'rounding_minutes' => 6,
|
||||
'limit' => $limit,
|
||||
'offset' => $offset,
|
||||
]));
|
||||
$this->assertResponseCode($response, 200);
|
||||
$ids = $response->json('data.*.id');
|
||||
$collected = $collected->concat($ids);
|
||||
$offset += $limit;
|
||||
} while (count($ids) === $limit);
|
||||
|
||||
// Assert - every time entry appears exactly once, none duplicated or missing.
|
||||
$this->assertEqualsCanonicalizing(array_column($rows, 'id'), $collected->all(), 'Some time entries were duplicated or missing across pages');
|
||||
}
|
||||
|
||||
public function test_index_endpoint_can_round_up(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -1717,6 +1799,29 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_aggregate_endpoint_filters_by_member_id_instead_of_legacy_user_id(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:own',
|
||||
]);
|
||||
$legacyUser = User::factory()->create();
|
||||
TimeEntry::factory()->forMember($data->member)->startWithDuration(Carbon::now(), 100)->create([
|
||||
'user_id' => $legacyUser->getKey(),
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.aggregate', [
|
||||
$data->organization->getKey(),
|
||||
'member_id' => $data->member->getKey(),
|
||||
]));
|
||||
|
||||
// Assert
|
||||
$response->assertSuccessful();
|
||||
$response->assertJsonPath('data.seconds', 100);
|
||||
}
|
||||
|
||||
public function test_aggregate_endpoint_groups_by_two_groups(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -2764,6 +2869,32 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_updates_user_id_when_member_id_changes(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:update:all',
|
||||
]);
|
||||
$otherUser = User::factory()->create();
|
||||
$otherMember = Member::factory()->forOrganization($data->organization)->forUser($otherUser)->role(Role::Employee)->create();
|
||||
$timeEntry = TimeEntry::factory()->forMember($data->member)->create();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->putJson(route('api.v1.time-entries.update', [$data->organization->getKey(), $timeEntry->getKey()]), [
|
||||
'member_id' => $otherMember->getKey(),
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$this->assertDatabaseHas(TimeEntry::class, [
|
||||
'id' => $timeEntry->getKey(),
|
||||
'member_id' => $otherMember->getKey(),
|
||||
'user_id' => $otherUser->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_can_update_project_and_automatically_set_client(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -3100,6 +3231,40 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_destroy_multiple_uses_member_id_for_own_permission_checks(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:delete:own',
|
||||
]);
|
||||
$otherUser = User::factory()->create();
|
||||
$otherMember = Member::factory()->forOrganization($data->organization)->forUser($otherUser)->role(Role::Employee)->create();
|
||||
$timeEntry = TimeEntry::factory()->forMember($otherMember)->create([
|
||||
'user_id' => $data->user->getKey(),
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.time-entries.destroy-multiple', [$data->organization->getKey()]), [
|
||||
'ids' => [
|
||||
$timeEntry->getKey(),
|
||||
],
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertExactJson([
|
||||
'success' => [],
|
||||
'error' => [
|
||||
$timeEntry->getKey(),
|
||||
],
|
||||
]);
|
||||
$this->assertDatabaseHas(TimeEntry::class, [
|
||||
'id' => $timeEntry->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_destroy_multiple_deletes_all_time_entries_and_fails_for_time_entries_of_other_users_and_and_other_organizations_with_all_time_entries_permission(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -3511,6 +3676,46 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_multiple_uses_member_id_for_own_permission_checks(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:update:own',
|
||||
'projects:view:all',
|
||||
]);
|
||||
$otherUser = User::factory()->create();
|
||||
$otherMember = Member::factory()->forOrganization($data->organization)->forUser($otherUser)->role(Role::Employee)->create();
|
||||
$timeEntry = TimeEntry::factory()->forMember($otherMember)->create([
|
||||
'user_id' => $data->user->getKey(),
|
||||
]);
|
||||
$timeEntriesFake = TimeEntry::factory()->forOrganization($data->organization)->make();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->patchJson(route('api.v1.time-entries.update-multiple', [$data->organization->getKey()]), [
|
||||
'ids' => [
|
||||
$timeEntry->getKey(),
|
||||
],
|
||||
'changes' => [
|
||||
'description' => $timeEntriesFake->description,
|
||||
],
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertExactJson([
|
||||
'success' => [],
|
||||
'error' => [
|
||||
$timeEntry->getKey(),
|
||||
],
|
||||
]);
|
||||
$this->assertDatabaseHas(TimeEntry::class, [
|
||||
'id' => $timeEntry->getKey(),
|
||||
'description' => $timeEntry->description,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_multiple_updates_sets_description_to_empty_if_the_client_sends_null(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -3557,6 +3762,51 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_multiple_updates_user_id_when_member_id_changes(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:update:all',
|
||||
]);
|
||||
$otherUser = User::factory()->create();
|
||||
$otherMember = Member::factory()->forOrganization($data->organization)->forUser($otherUser)->role(Role::Employee)->create();
|
||||
$timeEntry1 = TimeEntry::factory()->forMember($data->member)->create();
|
||||
$timeEntry2 = TimeEntry::factory()->forMember($data->member)->create();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->patchJson(route('api.v1.time-entries.update-multiple', [$data->organization->getKey()]), [
|
||||
'ids' => [
|
||||
$timeEntry1->getKey(),
|
||||
$timeEntry2->getKey(),
|
||||
],
|
||||
'changes' => [
|
||||
'member_id' => $otherMember->getKey(),
|
||||
],
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertValid();
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson([
|
||||
'success' => [
|
||||
$timeEntry1->getKey(),
|
||||
$timeEntry2->getKey(),
|
||||
],
|
||||
'error' => [],
|
||||
]);
|
||||
$this->assertDatabaseHas(TimeEntry::class, [
|
||||
'id' => $timeEntry1->getKey(),
|
||||
'member_id' => $otherMember->getKey(),
|
||||
'user_id' => $otherUser->getKey(),
|
||||
]);
|
||||
$this->assertDatabaseHas(TimeEntry::class, [
|
||||
'id' => $timeEntry2->getKey(),
|
||||
'member_id' => $otherMember->getKey(),
|
||||
'user_id' => $otherUser->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_multiple_updates_all_time_entries_and_fails_for_time_entries_of_other_users_and_and_other_organizations_with_all_time_entries_permission(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -4351,4 +4601,153 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
|
||||
$response->assertJsonCount(1, 'data');
|
||||
$response->assertJsonPath('data.0.id', $timeEntryWithoutTag->getKey());
|
||||
}
|
||||
|
||||
public function test_index_endpoint_with_not_contains_tag_match_type_excludes_entries_with_tag(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:all',
|
||||
]);
|
||||
$tag = Tag::factory()->forOrganization($data->organization)->create();
|
||||
$timeEntryWithTag = TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->create([
|
||||
'start' => Carbon::now()->subHour(),
|
||||
'tags' => [$tag->getKey()],
|
||||
]);
|
||||
$timeEntryWithEmptyTags = TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->create([
|
||||
'start' => Carbon::now()->subHour(),
|
||||
'tags' => [],
|
||||
]);
|
||||
$timeEntryWithNullTags = TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->create([
|
||||
'start' => Carbon::now()->subHour(),
|
||||
'tags' => null,
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$data->organization->getKey(),
|
||||
'tag_ids' => [$tag->getKey()],
|
||||
'tag_match_type' => TagMatchType::NotContains->value,
|
||||
'start' => Carbon::now()->subDay()->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->addDay()->toIso8601ZuluString(),
|
||||
]));
|
||||
|
||||
// Assert: the tagged entry is excluded; the untagged (empty + null) entries remain
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertJsonCount(2, 'data');
|
||||
$returnedIds = collect($response->json('data'))->pluck('id');
|
||||
$this->assertTrue($returnedIds->contains($timeEntryWithEmptyTags->getKey()));
|
||||
$this->assertTrue($returnedIds->contains($timeEntryWithNullTags->getKey()));
|
||||
$this->assertFalse($returnedIds->contains($timeEntryWithTag->getKey()));
|
||||
}
|
||||
|
||||
public function test_index_endpoint_with_contains_tag_match_type_returns_only_entries_with_tag(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:all',
|
||||
]);
|
||||
$tag = Tag::factory()->forOrganization($data->organization)->create();
|
||||
$timeEntryWithTag = TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->create([
|
||||
'start' => Carbon::now()->subHour(),
|
||||
'tags' => [$tag->getKey()],
|
||||
]);
|
||||
TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->create([
|
||||
'start' => Carbon::now()->subHour(),
|
||||
'tags' => [],
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$data->organization->getKey(),
|
||||
'tag_ids' => [$tag->getKey()],
|
||||
'tag_match_type' => TagMatchType::Contains->value,
|
||||
'start' => Carbon::now()->subDay()->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->addDay()->toIso8601ZuluString(),
|
||||
]));
|
||||
|
||||
// Assert: only the entry that has the tag
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertJsonCount(1, 'data');
|
||||
$response->assertJsonPath('data.0.id', $timeEntryWithTag->getKey());
|
||||
}
|
||||
|
||||
public function test_index_endpoint_rejects_invalid_tag_match_type(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:all',
|
||||
]);
|
||||
$tag = Tag::factory()->forOrganization($data->organization)->create();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.index', [
|
||||
$data->organization->getKey(),
|
||||
'tag_ids' => [$tag->getKey()],
|
||||
'tag_match_type' => 'invalid_value',
|
||||
'start' => Carbon::now()->subDay()->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->addDay()->toIso8601ZuluString(),
|
||||
]));
|
||||
|
||||
// Assert
|
||||
$this->assertResponseCode($response, 422);
|
||||
$response->assertInvalid(['tag_match_type']);
|
||||
}
|
||||
|
||||
public function test_aggregate_endpoint_with_not_contains_tag_match_type_excludes_entries_with_tag(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'time-entries:view:all',
|
||||
]);
|
||||
$tag = Tag::factory()->forOrganization($data->organization)->create();
|
||||
TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->startWithDuration(Carbon::now()->subHour(), 100)
|
||||
->create([
|
||||
'tags' => [$tag->getKey()],
|
||||
]);
|
||||
TimeEntry::factory()
|
||||
->forOrganization($data->organization)
|
||||
->forMember($data->member)
|
||||
->startWithDuration(Carbon::now()->subHour(), 200)
|
||||
->create([
|
||||
'tags' => [],
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->getJson(route('api.v1.time-entries.aggregate', [
|
||||
$data->organization->getKey(),
|
||||
'tag_ids' => [$tag->getKey()],
|
||||
'tag_match_type' => TagMatchType::NotContains->value,
|
||||
'start' => Carbon::now()->subDay()->toIso8601ZuluString(),
|
||||
'end' => Carbon::now()->addDay()->toIso8601ZuluString(),
|
||||
]));
|
||||
|
||||
// Assert: only the untagged entry (200s) is aggregated
|
||||
$response->assertValid();
|
||||
$this->assertResponseCode($response, 200);
|
||||
$response->assertJsonPath('data.seconds', 200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace Tests\Unit\Service\Import\Importers;
|
||||
|
||||
use App\Models\Organization;
|
||||
use App\Models\Project;
|
||||
use App\Models\Task;
|
||||
use App\Service\Import\Importers\ClockifyProjectsImporter;
|
||||
use App\Service\Import\Importers\DefaultImporter;
|
||||
use App\Service\Import\Importers\ImportException;
|
||||
@@ -50,4 +52,91 @@ class ClockifyProjectsImporterTest extends ImporterTestAbstract
|
||||
// Assert
|
||||
$this->checkTestScenarioProjectsOnlyAfterImport();
|
||||
}
|
||||
|
||||
public function test_import_sets_archived_at_based_on_status_column(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$timezone = 'Europe/Vienna';
|
||||
$importer = new ClockifyProjectsImporter;
|
||||
$importer->init($organization);
|
||||
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_2.csv');
|
||||
|
||||
// Act
|
||||
$importer->importData($data, $timezone);
|
||||
|
||||
// Assert
|
||||
$activeProject = Project::query()->where('organization_id', $organization->id)->where('name', 'Active Project')->firstOrFail();
|
||||
$this->assertNull($activeProject->archived_at);
|
||||
$this->assertFalse($activeProject->is_archived);
|
||||
|
||||
$archivedProject = Project::query()->where('organization_id', $organization->id)->where('name', 'Archived Project')->firstOrFail();
|
||||
$this->assertNotNull($archivedProject->archived_at);
|
||||
$this->assertTrue($archivedProject->is_archived);
|
||||
}
|
||||
|
||||
public function test_import_supports_renamed_tasks_column(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$timezone = 'Europe/Vienna';
|
||||
$importer = new ClockifyProjectsImporter;
|
||||
$importer->init($organization);
|
||||
// Newer Clockify exports rename the "Task" column to "Tasks".
|
||||
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_2.csv');
|
||||
|
||||
// Act
|
||||
$importer->importData($data, $timezone);
|
||||
|
||||
// Assert
|
||||
$activeProject = Project::query()->where('organization_id', $organization->id)->where('name', 'Active Project')->firstOrFail();
|
||||
$this->assertEqualsCanonicalizing(
|
||||
['Task 1', 'Task 2'],
|
||||
Task::query()->where('project_id', $activeProject->id)->pluck('name')->all(),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_import_of_test_file_without_client_column_succeeds(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$timezone = 'Europe/Vienna';
|
||||
$importer = new ClockifyProjectsImporter;
|
||||
$importer->init($organization);
|
||||
// Newer Clockify exports no longer contain a "Client" column.
|
||||
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_4.csv');
|
||||
|
||||
// Act
|
||||
$importer->importData($data, $timezone);
|
||||
|
||||
// Assert
|
||||
$project = Project::query()->where('organization_id', $organization->id)->where('name', 'Project Without Client Column')->firstOrFail();
|
||||
$this->assertNull($project->client_id);
|
||||
$this->assertSame(100 * 3600, $project->estimated_time);
|
||||
$this->assertEqualsCanonicalizing(
|
||||
['Task 1', 'Task 2'],
|
||||
Task::query()->where('project_id', $project->id)->pluck('name')->all(),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_import_supports_activities_column_alias_for_tasks(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$timezone = 'Europe/Vienna';
|
||||
$importer = new ClockifyProjectsImporter;
|
||||
$importer->init($organization);
|
||||
// Some Clockify exports name the tasks column "Activities".
|
||||
$data = Storage::disk('testfiles')->get('clockify_projects_import_test_3.csv');
|
||||
|
||||
// Act
|
||||
$importer->importData($data, $timezone);
|
||||
|
||||
// Assert
|
||||
$project = Project::query()->where('organization_id', $organization->id)->where('name', 'Project With Activities')->firstOrFail();
|
||||
$this->assertEqualsCanonicalizing(
|
||||
['Activity A', 'Activity B'],
|
||||
Task::query()->where('project_id', $project->id)->pluck('name')->all(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user