-
Notifications
You must be signed in to change notification settings - Fork 22
feat: currency field display consistency and constraint improvements #119
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31970e2
feat: add CurrencyColumn with numeric formatting and dollar prefix
ManukMinasyan 05e0328
Fix styling
ManukMinasyan 366e35e
feat: add CurrencyEntry with numeric formatting and dollar prefix
ManukMinasyan 69389bc
Fix styling
ManukMinasyan aa7d789
fix: remove hardcoded constraints from CurrencyComponent, respect dec…
ManukMinasyan ff14d13
feat: wire CurrencyColumn/CurrencyEntry and add export transformer
ManukMinasyan 32e2535
fix: restore nullsafe operator on validation_rules access
ManukMinasyan ad3a6bb
feat: add type-specific settings for currency fields (Attio-style)
ManukMinasyan f6b4fe8
fix: use afterStateHydrated instead of default for currency settings …
ManukMinasyan 12da118
fix: preserve existing column formatters in table visibility wrapper
ManukMinasyan 3021646
fix: resolve rector violations in currency-related files
ManukMinasyan dd1f06f
fix: review fixes for currency field settings and data consistency
ManukMinasyan 3d9531e
fix: resolve rector violation in decimal places options
ManukMinasyan 023390d
Fix styling
ManukMinasyan 85879bd
feat: replace hardcoded currency list with ICU-powered CurrencyProvider
ManukMinasyan e784603
fix: address review feedback for currency field improvements
ManukMinasyan 7bdef70
fix: add declare(strict_types=1) to satisfy rector
ManukMinasyan 083cdb8
refactor: apply laravel best practices to currency field code
ManukMinasyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Data\Settings; | ||
|
|
||
| use Relaticle\CustomFields\Support\CurrencyProvider; | ||
| use Spatie\LaravelData\Attributes\MapName; | ||
| use Spatie\LaravelData\Data; | ||
| use Spatie\LaravelData\Mappers\SnakeCaseMapper; | ||
|
|
||
| #[MapName(SnakeCaseMapper::class)] | ||
| class CurrencyFieldSettingsData extends Data | ||
| { | ||
| public function __construct( | ||
| public string $currencyCode = 'USD', | ||
| public string $displayType = 'symbol', | ||
| public int $decimalPlaces = 2, | ||
| ) {} | ||
|
|
||
| public static function fromAdditional(array $additional): self | ||
| { | ||
| $code = $additional['currency_code'] ?? 'USD'; | ||
|
|
||
| return new self( | ||
| currencyCode: $code, | ||
| displayType: $additional['display_type'] ?? 'symbol', | ||
| decimalPlaces: (int) ($additional['decimal_places'] ?? CurrencyProvider::getDecimalDigits($code)), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Exceptions; | ||
|
|
||
| use Exception; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Exceptions; | ||
|
|
||
| use Exception; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Exceptions; | ||
|
|
||
| use Exception; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Facades; | ||
|
|
||
| use Illuminate\Support\Facades\Facade; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Filament/Integration/Components/Infolists/CurrencyEntry.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Relaticle\CustomFields\Filament\Integration\Components\Infolists; | ||
|
|
||
| use Filament\Infolists\Components\TextEntry as BaseTextEntry; | ||
| use Relaticle\CustomFields\Filament\Integration\Base\AbstractInfolistEntry; | ||
| use Relaticle\CustomFields\Filament\Integration\Concerns\Shared\ConfiguresCurrencyFormatting; | ||
| use Relaticle\CustomFields\Models\CustomField; | ||
|
|
||
| final class CurrencyEntry extends AbstractInfolistEntry | ||
| { | ||
| use ConfiguresCurrencyFormatting; | ||
|
|
||
| public function make(CustomField $customField): BaseTextEntry | ||
| { | ||
| $entry = BaseTextEntry::make($customField->getFieldName()) | ||
| ->label($customField->name) | ||
| ->state(fn (mixed $record) => $record->getCustomFieldValue($customField)); | ||
|
|
||
| $this->applyCurrencyFormatting($entry, $customField); | ||
|
|
||
| return $entry; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.