diff --git a/lang/es.json b/lang/es.json index 9d71af0c..9845cae4 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1240,7 +1240,6 @@ "Pink": "Rosa", "Platform": "Plataforma", "Please describe the problem and what you were doing when it happened. Keep the details below — they help us debug.": "Describe el problema y qué estabas haciendo cuando ocurrió. Conserva los detalles de abajo: nos ayudan a depurar.", - "Please enter a balance": "Por favor, ingresa un balance", "Please enter a bank name.": "Por favor, ingresa un nombre de banco.", "Please enter an account name.": "Por favor, ingresa un nombre de cuenta.", "Please enter your new password below": "Por favor ingresa tu nueva contraseña a continuación", diff --git a/lang/fr.json b/lang/fr.json index 4413b29e..136cf517 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -1199,7 +1199,6 @@ "Pink": "Rose", "Platform": "Plate-forme", "Please describe the problem and what you were doing when it happened. Keep the details below — they help us debug.": "Décrivez le problème et ce que vous faisiez lorsqu'il s'est produit. Conservez les détails ci-dessous : ils nous aident à déboguer.", - "Please enter a balance": "Veuillez saisir un solde", "Please enter a bank name.": "Veuillez saisir un nom de banque.", "Please enter an account name.": "Veuillez saisir un nom de compte.", "Please enter your new password below": "Veuillez entrer votre nouveau mot de passe ci-dessous", diff --git a/resources/js/components/transactions/import-step-mapping.tsx b/resources/js/components/transactions/import-step-mapping.tsx index 81970cd9..2b784af0 100644 --- a/resources/js/components/transactions/import-step-mapping.tsx +++ b/resources/js/components/transactions/import-step-mapping.tsx @@ -428,7 +428,6 @@ export function ImportStepMapping({ value={referenceBalance ?? 0} onChange={onReferenceBalanceChange} currencyCode={currencyCode} - required /> {referenceBalancePrefilled && (

diff --git a/tests/Feature/AccountBalanceControllerTest.php b/tests/Feature/AccountBalanceControllerTest.php index 550a3ca1..819d76ee 100644 --- a/tests/Feature/AccountBalanceControllerTest.php +++ b/tests/Feature/AccountBalanceControllerTest.php @@ -280,6 +280,47 @@ it('can store balance without invested_amount', function () { ]); }); +it('can store a zero balance', function () { + $user = User::factory()->create(); + $account = Account::factory()->for($user)->create(); + + $response = $this->actingAs($user)->postJson("/api/accounts/{$account->id}/balances", [ + 'balance' => 0, + 'balance_date' => now()->subDays(5)->toDateString(), + ]); + + $response->assertStatus(201) + ->assertJsonPath('data.balance', 0); + + $this->assertDatabaseHas('account_balances', [ + 'account_id' => $account->id, + 'balance' => 0, + ]); +}); + +it('can update the current balance to zero', function () { + $user = User::factory()->create(); + $account = Account::factory()->for($user)->create(); + + AccountBalance::factory()->for($account)->create([ + 'balance_date' => now()->toDateString(), + 'balance' => 100000, + ]); + + $response = $this->actingAs($user)->putJson("/api/accounts/{$account->id}/balance/current", [ + 'balance' => 0, + ]); + + $response->assertSuccessful() + ->assertJsonPath('data.balance', 0); + + $this->assertDatabaseHas('account_balances', [ + 'account_id' => $account->id, + 'balance_date' => now()->toDateString(), + 'balance' => 0, + ]); +}); + it('validates store balance must be an integer', function () { $user = User::factory()->create(); $account = Account::factory()->for($user)->create();