From 55051334ef011f6d0d8cb61b70aa60e637fd024e Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 16 Mar 2026 16:23:43 +0100 Subject: [PATCH] new: add quick edit links for article, package and tariff on offer form --- .../views/Admin/Shop/Offers/form.blade.php | 110 +++++++++++++----- 1 file changed, 80 insertions(+), 30 deletions(-) diff --git a/resources/views/Admin/Shop/Offers/form.blade.php b/resources/views/Admin/Shop/Offers/form.blade.php index 9ada131b..4988abeb 100644 --- a/resources/views/Admin/Shop/Offers/form.blade.php +++ b/resources/views/Admin/Shop/Offers/form.blade.php @@ -14,43 +14,64 @@
- @include('components.form.select', [ - 'name' => 'article_id', - 'id_name' => 'article_id', - 'list' => $articles ?? null, - 'value' => $offer['article_id'] ?? null, - 'with_empty' => '', - 'class' => 'select2 select_article', - 'label' => 'Article', - 'required' => true, - ]) +
+
+ @include('components.form.select', [ + 'name' => 'article_id', + 'id_name' => 'article_id', + 'list' => $articles ?? null, + 'value' => $offer['article_id'] ?? null, + 'with_empty' => '', + 'class' => 'select2 select_article', + 'label' => 'Article', + 'required' => true, + ]) +
+ +
- @include('components.form.select', [ - 'name' => 'variation_id', - 'id_name' => 'variation_id', - 'list' => $variations ?? null, - 'value' => $offer['variation_id'] ?? null, - 'with_empty' => '', - 'class' => 'select2 select_variation', - 'label' => __('shop.packages.name'), - 'required' => true, - ]) +
+
+ @include('components.form.select', [ + 'name' => 'variation_id', + 'id_name' => 'variation_id', + 'list' => $variations ?? null, + 'value' => $offer['variation_id'] ?? null, + 'with_empty' => '', + 'class' => 'select2 select_variation', + 'label' => __('shop.packages.name'), + 'required' => true, + ]) +
+ +
- @include('components.form.select', [ - 'name' => 'tariff_id', - 'id_name' => 'tariff_id', - 'list' => $tariffs ?? null, - 'value' => $offer['tariff_id'] ?? null, - 'with_empty' => '', - 'class' => 'select2 select_tariffs', - 'label' => 'Tarif', - 'required' => true, - ]) +
+
+ @include('components.form.select', [ + 'name' => 'tariff_id', + 'id_name' => 'tariff_id', + 'list' => $tariffs ?? null, + 'value' => $offer['tariff_id'] ?? null, + 'with_empty' => '', + 'class' => 'select2 select_tariffs', + 'label' => 'Tarif', + 'required' => true, + ]) +
+ +
@include('components.form.input', [ @@ -122,5 +143,34 @@ initChevron(); initSaveForm('#offer-form'); initSelect2(); + function updateEditLink(selectId, linkId, routeTemplate) { + var val = $('#' + selectId).val(); + var $link = $('#' + linkId); + if (val) { + $link.attr('href', routeTemplate.replace('__ID__', val)).show(); + } else { + $link.hide(); + } + } + + var articleRoute = '{{ route('Admin.Shop.Articles.edit', ['id' => '__ID__']) }}'; + var variationRoute = '{{ route('Admin.Shop.Variations.edit', ['id' => '__ID__']) }}'; + var tariffRoute = '{{ route('Admin.Shop.Tariffs.edit', ['id' => '__ID__']) }}'; + + // Init on page load + updateEditLink('article_id', 'edit-article-link', articleRoute); + updateEditLink('variation_id', 'edit-variation-link', variationRoute); + updateEditLink('tariff_id', 'edit-tariff-link', tariffRoute); + + // Update on change + $('#article_id').on('change', function() { + updateEditLink('article_id', 'edit-article-link', articleRoute); + }); + $('#variation_id').on('change', function() { + updateEditLink('variation_id', 'edit-variation-link', variationRoute); + }); + $('#tariff_id').on('change', function() { + updateEditLink('tariff_id', 'edit-tariff-link', tariffRoute); + }); @endpush