Let quick sale quantities be typed and specify quick sale production

Each line on the quick sale page gets a quantity field beside the
minus and plus buttons: the typed quantity is saved on change or
Enter, 0 removes the line and an invalid value keeps the old one
with an error.

The specification gets section 19.7 for phase 5: products with a
production process are sold as orders that go to a machine's work
list, are marked made at the machine (booking material and hours)
and are then paid in cash or by card.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 07:22:14 +02:00
co-authored by Claude Sonnet 5.5
parent 42b470d01c
commit 290936d8de
6 changed files with 123 additions and 20 deletions
@@ -99,6 +99,22 @@ it('adds a product with each press and lowers or removes it from the list', func
->assertSee(__('sales.sell.cart_empty'));
});
it('sets a quantity typed in the line field, removes the line with 0 and keeps it on an invalid value', function () {
Livewire::test('sales::sell')
->call('addProduct', $this->photos->id)
->call('addProduct', $this->prints->id)
->call('setQuantity', $this->photos->id, ' 12 ')
->assertSet('quantities', [$this->photos->id => 12, $this->prints->id => 1])
->assertSet('cartMessage', "Passikuvat: 12. Yhteensä 180,50\u{00A0}€.")
->call('setQuantity', $this->photos->id, '1000')
->assertHasErrors(['quantities' => [__('sales.errors.quantity')]])
->call('setQuantity', $this->photos->id, '-2')
->assertHasErrors(['quantities' => [__('sales.errors.quantity')]])
->assertSet('quantities', [$this->photos->id => 12, $this->prints->id => 1])
->call('setQuantity', $this->prints->id, '0')
->assertSet('quantities', [$this->photos->id => 12]);
});
it('rejects an empty sale and products that are not consumer products or no longer sold', function () {
$other = ProductModel::factory()->create();