From 4614ea57cf06c164068c1d2bf3d06434233d7dc3 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Tue, 31 Aug 2021 23:33:10 +0200 Subject: [PATCH] fix adding price for count(prices) > 3 --- app/Repositories/Shop/PriceLists.php | 4 +++- resources/views/Admin/Shop/PriceLists/modal.blade.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Repositories/Shop/PriceLists.php b/app/Repositories/Shop/PriceLists.php index b14cf971..ff458afe 100644 --- a/app/Repositories/Shop/PriceLists.php +++ b/app/Repositories/Shop/PriceLists.php @@ -29,7 +29,9 @@ class PriceLists { $price_list = self::getFull($id)->toArray(); $n = count($price_list['price_list_values']); - $price_list['price_list_values'] += array_fill($n, 3 - $n, ''); + if ($n <= 3) { + $price_list['price_list_values'] += array_fill($n, 3 - $n, ''); + } return $price_list; } diff --git a/resources/views/Admin/Shop/PriceLists/modal.blade.php b/resources/views/Admin/Shop/PriceLists/modal.blade.php index 081d0c19..ce13fd5f 100644 --- a/resources/views/Admin/Shop/PriceLists/modal.blade.php +++ b/resources/views/Admin/Shop/PriceLists/modal.blade.php @@ -56,7 +56,7 @@ $('#add_price').click( function () { var index = $('#prices-table tbody tr').length; $.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) { - $("#prices-table").prepend(data); + $("#prices-table").append(data); }) }) }