- @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