Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc 0.14 #263

Merged
merged 65 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0e663f4
- Fixed serialising luxon structures.
TPReal Sep 16, 2024
a92f57d
Renamed a function to fix unit tests.
TPReal Sep 16, 2024
25cb12c
Merge branch 'RC-0.13' into develop
TPReal Sep 18, 2024
86476fc
allow requests with __keYs
mblajek Sep 18, 2024
6c014ab
Merge remote-tracking branch 'origin/develop' into develop
mblajek Sep 18, 2024
c7ca66f
Selecting client groups on meeting form.
TPReal Sep 21, 2024
c590607
Merge branch 'develop' of https://github.com/mblajek/Memo into develop
TPReal Sep 21, 2024
33e7296
Visual improvements in the client group selection on meeting form.
TPReal Sep 21, 2024
8358b16
Update README.md
TPReal Sep 21, 2024
8d6c0f3
Merge branch 'RC-0.13' into develop
TPReal Sep 22, 2024
2004bc5
Some fixes in time zones.
TPReal Sep 23, 2024
46aa7e8
Remove the weekdays calculator and rely on luxon with useLocaleWeeks.…
TPReal Sep 23, 2024
d3e5ec7
Fix setting last login facility for users that only have one facility…
TPReal Sep 23, 2024
d007b26
Added a button on admin user edit form to expire password in 7 days o…
TPReal Sep 23, 2024
bba0d24
Changed the logic of refreshing the pages:
TPReal Sep 24, 2024
8a42578
Fix the effect created without owner.
TPReal Sep 24, 2024
e35d865
Some persistent data fixes.
TPReal Sep 24, 2024
5dbcaf5
Login page improvements.
TPReal Sep 25, 2024
5b855d5
Replaced zag dialog with a custom modal implementation.
TPReal Sep 26, 2024
e57a5cd
Checkbox style fix.
TPReal Sep 27, 2024
40e0ecd
Removed zag hover card and implemented it using floating-ui directly.
TPReal Sep 27, 2024
08cac1a
Simplified using the floating-ui logic. Some more util functions.
TPReal Sep 27, 2024
dadc9b6
Got rid of zag popover.
TPReal Sep 28, 2024
48e5e36
Login page improvements.
TPReal Sep 28, 2024
bc9e8bf
Colors improvements.
TPReal Sep 29, 2024
cdfd5ee
npm packages update
TPReal Sep 30, 2024
35045a5
Switched to the new SCSS compiler.
TPReal Sep 30, 2024
d691309
Fixed a problem with the Float component where reference and floating…
TPReal Oct 3, 2024
efc5d3c
Some improvements to attendance client groups. Created docs.
TPReal Oct 4, 2024
91745e2
Change the user storage API endpoints usage to use JSON.
TPReal Oct 4, 2024
9ab4e32
Some fixes in meeting client groups in view mode.
TPReal Oct 5, 2024
fb92ee7
Optimised the attendant form client group for a meeting with one client.
TPReal Oct 5, 2024
a0b368d
Fix initial focus of the columns search.
TPReal Oct 5, 2024
95dc7fc
Fixed the problem with ScrollableCell component.
TPReal Oct 6, 2024
d2fbf03
Make use of the new iterator methods like filter.
TPReal Oct 6, 2024
a5dd33a
Declared support for Firefox in the docs.
TPReal Oct 6, 2024
6e7a822
Workaround for input with type month for firefox.
TPReal Oct 6, 2024
45451c8
Style fix.
TPReal Oct 6, 2024
f54e970
Bumped version to 0.14.
TPReal Oct 6, 2024
1ecac01
composer update, pint
mblajek Oct 6, 2024
bd4cfa5
Reduced login modal flickering.
TPReal Oct 7, 2024
8d3b898
Fixed opening meeting details on month view.
TPReal Oct 7, 2024
5d33ec1
Small fix on weekly work time table dates range selector.
TPReal Oct 7, 2024
5941e29
Fixed docs link for meeting context client groups.
TPReal Oct 7, 2024
98d89ac
fix regexp
mblajek Oct 7, 2024
29bb019
fix regexp
mblajek Oct 7, 2024
5ba7d24
Meeting attendants control: in separate client groups mode only show …
TPReal Oct 7, 2024
084dede
Persist the selected client group on client details in history.
TPReal Oct 7, 2024
4711348
Better GitHub commit link on the about page.
TPReal Oct 8, 2024
5222417
Fix translation use in reports help page.
TPReal Oct 8, 2024
c64dbb6
Fixed a bug where the login page was stuck if already logged in.
TPReal Oct 8, 2024
7b5b94a
Styling fixes in meetings tables on user details.
TPReal Oct 8, 2024
25a8956
Fix calculating whether attribute value is empty, and deduplicate code.
TPReal Oct 8, 2024
eea409f
Improved displaying of document links, especially long ones.
TPReal Oct 8, 2024
0b8431a
Improved displaying of document links, especially long ones.
TPReal Oct 8, 2024
91e989e
Merge branch 'RC-0.14' into develop
TPReal Oct 8, 2024
75b9d1b
change document links attribute to text
mblajek Oct 8, 2024
5504189
Fix missing arrow on hover titles.
TPReal Oct 9, 2024
a43035e
Improved documents links docs.
TPReal Oct 9, 2024
96785e8
Enable filtering document links by null.
TPReal Oct 9, 2024
e7fc2fe
Fix the bug where attribute column visibility state was lost.
TPReal Oct 9, 2024
477394c
Allow scrolling to columns from the columns selector.
TPReal Oct 9, 2024
59ccb01
attribute metadata kinda hotfix
Oct 9, 2024
f58f30c
Added support for the isMultiLine attribute metadata.
TPReal Oct 9, 2024
66fe584
pint, composer update, version
mblajek Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- kalendarzem wizyt klientów
- grafikami pracy pracowników fundacji

Aktualnie system jest używany przez jedną z placówek [Fundacji Dajemy Dzieciom Siłę](http://fdds.pl/), w planie jest wdrożenie go w większej liczbie placówek.
Aktualnie system jest używany w kilku placówkach [Fundacji Dajemy Dzieciom Siłę](http://fdds.pl/).

<img height="60" src="./public/img/memo_joint_logo.png">

Expand Down
20 changes: 20 additions & 0 deletions app/Http/Controllers/Admin/DeveloperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
use App\Http\Permissions\Permission;
use App\Models\Enums\AttributeTable;
use App\Models\Member;
use App\Models\StaffMember;
use App\Rules\Valid;
use App\Utils\Date\DateHelper;
use App\Utils\Nullable;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Artisan;
Expand Down Expand Up @@ -65,4 +67,22 @@ public function overwriteMetadata(): JsonResponse
$updated = DB::table($model->value)->where('id', $id)->update($updateData);
return new JsonResponse(data: ['data' => (bool)$updated], status: 200);
}

public function patchStaff(): JsonResponse
{
$data = $this->validate([
'id' => Valid::uuid(),
'facility_id' => Valid::uuid([Rule::exists('facilities', 'id')]),
'deactivated_at' => Valid::datetime(nullable: true),
]);

$id = Member::query()->where('user_id', $data['id'])
->where('facility_id', $data['facility_id'])->firstOrFail()
->offsetGet('staff_member_id');

$updated = StaffMember::query()->where('id', $id)
->update(['deactivated_at' => Nullable::call($data['deactivated_at'], DateHelper::zuluToDbString(...))]);

return new JsonResponse(data: ['data' => (bool)$updated], status: 200);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#[OA\Info(version: ApiController::VERSION, title: 'Memo API')]
abstract class ApiController extends Controller
{
protected const string VERSION = '0.13.1';
protected const string VERSION = '0.14.2';
private readonly array $requestIn;

public function __construct(private readonly Request $request)
Expand Down
15 changes: 8 additions & 7 deletions app/Http/Middleware/TransformKeysValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@

namespace App\Http\Middleware;

use App\Exceptions\ApiException;
use App\Exceptions\ApiValidationException;
use App\Exceptions\ExceptionFactory;
use App\Utils\Transformer\ArrayKeyTransformer;
use App\Utils\Transformer\StringTransformer;
use Closure;
use Illuminate\Http\Request;
use ValueError;

class TransformKeysValidate
{
/** @throws ApiValidationException */
/** @throws ApiValidationException|ApiException */
public function handle(Request $request, Closure $next)
{
if (($content = $request->getContent())) {
$data = $request->request->all();
if (!$request->isJson() || (count($data) === 0 && !json_validate($content))) {
throw ExceptionFactory::invalidJson();
}

if (ArrayKeyTransformer::hasSnake($data)) {
throw ExceptionFactory::snakeCaseRequest();
try {
$request->replace(StringTransformer::snakeKeys($data));
} catch (ValueError) {
ExceptionFactory::snakeCaseRequest()->throw();
}

$request->replace(ArrayKeyTransformer::toSnake($data));
}

return $next($request);
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Resources/AbstractJsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Exceptions\FatalExceptionFactory;
use App\Utils\Date\DateHelper;
use App\Utils\Transformer\ArrayKeyTransformer;
use App\Utils\Transformer\StringTransformer;
use Closure;
use DateTimeInterface;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function toArray(Request $request): array
if ($this->withAttrValues()) {
$resource = $this->resource;
if (method_exists($resource, 'attrValues')) {
$result += ArrayKeyTransformer::toCamel($resource->attrValues());
$result += StringTransformer::camelKeys($resource->attrValues());
} else {
FatalExceptionFactory::unexpected()->throw();
}
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Resources/AttributeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ protected static function getMappedFields(): array
'isMultiValue' => true,
'requirementLevel' => true,
'description' => true,
// documents links
'metadata' => fn(self $attribute) => ($attribute->id === 'e1c14100-070d-4213-8927-6b7aed9617a4')
? ['isMultiLine' => false] : null,
];
}
}
21 changes: 21 additions & 0 deletions app/Utils/Nullable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Utils;

class Nullable
{
public static function call(mixed $value, callable $callable): mixed
{
return ($value !== null) ? $callable($value) : null;
}

/**
* @template TValue
* @param TValue $first
* @param TValue $other
*/
public static function equals(mixed $first, mixed $other): bool
{
return ($first === null) ? ($other === null) : ($other && $first->equals($other));
}
}
36 changes: 0 additions & 36 deletions app/Utils/Transformer/ArrayKeyTransformer.php

This file was deleted.

42 changes: 42 additions & 0 deletions app/Utils/Transformer/StringTransformer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace App\Utils\Transformer;

use ValueError;

class StringTransformer
{
private static array $camelCache = [];
private static array $snakeCache = [];

private const string CAMEL_REGEXP = '/^((?:__)?[a-z][a-z0-9]*)([a-z0-9A-Z]*)$/';
private const string SNAKE_REGEXP = '/^((?:__)?[a-z][a-z0-9]*)((?:_[a-z][a-z0-9]*)*)$/';

public static function snake(string $value): string
{
return self::$camelCache[$value] ??= preg_match(self::CAMEL_REGEXP, $value, $match)
? (($match[2] === '') ? $value : ($match[1] . strtolower(preg_replace('/([A-Z])/', '_$1', $match[2]))))
: (throw new ValueError($value));
}

public static function camel(string $value): string
{
return self::$snakeCache[$value] ??= preg_match(self::SNAKE_REGEXP, $value, $match)
? (($match[2] === '') ? $value : ($match[1] . str_replace('_', '', ucwords($match[2], '_'))))
: (throw new ValueError($value));
}

public static function snakeKeys(mixed $data): mixed
{
return (!is_array($data)) ? $data : (array_is_list($data) ? array_map(self::snakeKeys(...), $data)
: array_combine(array_map(self::snake(...), array_keys($data)), array_map(self::snakeKeys(...), $data)));
}

public static function camelKeys(mixed $data): mixed
{
return (!is_array($data)) ? $data : (array_is_list($data) ? array_map(self::camelKeys(...), $data)
: array_combine(array_map(self::camel(...), array_keys($data)), array_map(self::camelKeys(...), $data)));
}
}
Loading
Loading