diff --git a/app/Classes/ValueObjects/Constants/BankAccountType.php b/app/Classes/ValueObjects/Constants/BankAccountType.php index 0393091f..8885f2db 100644 --- a/app/Classes/ValueObjects/Constants/BankAccountType.php +++ b/app/Classes/ValueObjects/Constants/BankAccountType.php @@ -12,4 +12,29 @@ final class BankAccountType { public const ALIPAY_RECIPIENT = 4; + /** + * Get all account type labels. + * + * @return array + */ + public static function labels(): array + { + return [ + self::PERSONAL => 'PERSONAL', + self::EXTERNAL => 'EXTERNAL', + self::ALIPAY_1688 => 'ALIPAY_1688', + self::ALIPAY_RECIPIENT => 'ALIPAY_RECIPIENT', + ]; + } + + /** + * Get label for a specific account type. + * + * @param int|string $type + * @return string + */ + public static function label($type): string + { + return self::labels()[(int) $type] ?? 'Unknown'; + } } diff --git a/app/Http/Resources/BankResource.php b/app/Http/Resources/BankResource.php index f3de3038..5e6e2e17 100644 --- a/app/Http/Resources/BankResource.php +++ b/app/Http/Resources/BankResource.php @@ -2,6 +2,7 @@ namespace App\Http\Resources; +use App\Classes\ValueObjects\Constants\BankAccountType; use Illuminate\Http\Resources\Json\JsonResource; class BankResource extends JsonResource @@ -27,6 +28,7 @@ class BankResource extends JsonResource 'country_id' => $this->country_id, 'default' => $this->default, 'status' => $this->status, + 'bank_account_type_label' => BankAccountType::label($this->type), ]; } } diff --git a/resources/assets/vue/components/banks/forms/DeleteBankAccountFormComponent.vue b/resources/assets/vue/components/banks/forms/DeleteBankAccountFormComponent.vue index 3414c75f..88fccb2b 100644 --- a/resources/assets/vue/components/banks/forms/DeleteBankAccountFormComponent.vue +++ b/resources/assets/vue/components/banks/forms/DeleteBankAccountFormComponent.vue @@ -8,6 +8,7 @@