Fix product edit combination in basket

This commit is contained in:
Roman Pyrih
2026-05-12 11:50:21 +02:00
parent 91e85aaba2
commit d177dc3298
7 changed files with 5275 additions and 5160 deletions

2
.vscode/ftp-kr.json vendored
View File

@@ -6,7 +6,7 @@
"protocol": "ftp", "protocol": "ftp",
"port": 0, "port": 0,
"fileNameEncoding": "utf8", "fileNameEncoding": "utf8",
"autoUpload": false, "autoUpload": true,
"autoDelete": false, "autoDelete": false,
"autoDownload": false, "autoDownload": false,
"ignoreRemoteModification": true, "ignoreRemoteModification": true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -9,8 +9,7 @@ $cGray: #f6f6f6;
$cGrayLight: #eceff1; $cGrayLight: #eceff1;
$cComment: #c3c3c3; $cComment: #c3c3c3;
$form_gray: #e7e7e7; $form_gray: #e7e7e7;
$font_nunito: 'Nunito', $font_nunito: 'Nunito', sans-serif;
sans-serif;
@import '_mixins'; @import '_mixins';
@@ -760,7 +759,6 @@ input:-webkit-autofill:active {
@include respond-above(xxl) { @include respond-above(xxl) {
.product-mini { .product-mini {
&:nth-child(11), &:nth-child(11),
&:nth-child(12) { &:nth-child(12) {
display: none; display: none;
@@ -2564,6 +2562,60 @@ ul.pager {
} }
#transport-methods { #transport-methods {
.free-delivery-bar {
background: #3a3a3a;
border-radius: 8px;
padding: 15px 20px;
margin-top: 15px;
display: flex;
align-items: center;
gap: 15px;
color: #fff;
&.success {
background: #28a745;
}
&__icon {
font-size: 28px;
flex-shrink: 0;
}
&__content {
flex: 1;
}
&__text {
font-size: 14px;
font-weight: 600;
margin-bottom: 8px;
}
&__progress {
height: 8px;
background: #555;
border-radius: 4px;
overflow: hidden;
}
&__progress-fill {
height: 100%;
background: linear-gradient(90deg, #28a745, #5cb85c);
border-radius: 4px;
transition: width 0.3s ease;
}
&__remaining {
font-size: 12px;
margin-top: 5px;
color: #ccc;
strong {
color: #ff9800;
}
}
}
@include respond-below(sm) { @include respond-below(sm) {
width: 100%; width: 100%;
margin-bottom: 15px; margin-bottom: 15px;
@@ -3632,7 +3684,6 @@ ul.pager {
} }
.pager { .pager {
.first, .first,
.last { .last {
display: none; display: none;
@@ -3670,10 +3721,8 @@ ul.pager {
background: #fff; background: #fff;
width: 100%; width: 100%;
max-width: 800px; max-width: 800px;
box-shadow: box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2),
0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 13px 19px 2px rgba(0, 0, 0, 0.14), 0 5px 24px 4px rgba(0, 0, 0, 0.12);
0 13px 19px 2px rgba(0, 0, 0, 0.14),
0 5px 24px 4px rgba(0, 0, 0, 0.12);
max-height: 100%; max-height: 100%;
.shop-alert-title { .shop-alert-title {
@@ -4207,7 +4256,8 @@ ul.pager {
margin-bottom: 30px; margin-bottom: 30px;
} }
.content {} .content {
}
} }
} }
@@ -5193,7 +5243,6 @@ ul.pager {
ul { ul {
li { li {
a, a,
.menu-trigger { .menu-trigger {
text-transform: none; text-transform: none;
@@ -5559,7 +5608,6 @@ ul.pager {
.products-related { .products-related {
.owl-carousel { .owl-carousel {
.owl-nav { .owl-nav {
.owl-prev, .owl-prev,
.owl-next { .owl-next {
span { span {
@@ -5694,7 +5742,6 @@ ul.pager {
border-radius: 10px; border-radius: 10px;
.jconfirm-buttons { .jconfirm-buttons {
.btn.btn-blue, .btn.btn-blue,
.btn.btn-orange { .btn.btn-orange {
background-color: $cRed !important; background-color: $cRed !important;
@@ -5721,7 +5768,6 @@ ul.pager {
#basket { #basket {
.basket-product { .basket-product {
.buttons { .buttons {
.int-format.form-control:focus, .int-format.form-control:focus,
.int-format.form-control:active { .int-format.form-control:active {
border: 2px solid #000; border: 2px solid #000;
@@ -5732,7 +5778,8 @@ ul.pager {
} }
.row { .row {
.col-12 {} .col-12 {
}
} }
} }
@@ -5743,7 +5790,6 @@ ul.pager {
#basket { #basket {
.basket-bottom { .basket-bottom {
.basket-message { .basket-message {
.form-control:focus, .form-control:focus,
.form-control:active { .form-control:active {
border: 2px solid #000; border: 2px solid #000;
@@ -6305,7 +6351,6 @@ ul.pager {
} }
.swiper { .swiper {
.swiper-button-prev, .swiper-button-prev,
.swiper-button-next { .swiper-button-next {
width: 40px; width: 40px;
@@ -6464,3 +6509,14 @@ ul.pager {
display: none; display: none;
} }
} }
.btn-save-custom-fields {
color: #fff !important;
border-radius: 10px;
transition: 0.3s;
margin-top: 20px;
&:hover {
background-color: $cText;
}
}

View File

@@ -45,7 +45,7 @@
</div> </div>
<? endforeach; ?> <? endforeach; ?>
<div style="margin-top: 5px;"> <div style="margin-top: 5px;">
<a href="#" class="btn btn-sm btn-primary btn-save-custom-fields">Zapisz</a> <a href="#" class="btn btn-sm btn-success btn-save-custom-fields">Zapisz</a>
<a href="#" class="btn btn-sm btn-default btn-cancel-custom-fields">Anuluj</a> <a href="#" class="btn btn-sm btn-default btn-cancel-custom-fields">Anuluj</a>
</div> </div>
</div> </div>

View File

@@ -45,7 +45,8 @@
<hr> <hr>
<? endif; ?> <? endif; ?>
<?= \Shared\Tpl\Tpl::view( 'shop-basket/_partials/product-custom-fields', [ <?= \Shared\Tpl\Tpl::view( 'shop-basket/_partials/product-custom-fields', [
'custom_fields' => $position['custom_fields'] 'custom_fields' => $position['custom_fields'],
'product_code' => $position_hash
] ); ?> ] ); ?>
<? if ( $product['additional_message'] ):?> <? if ( $product['additional_message'] ):?>
<div class="basket-product-message"> <div class="basket-product-message">

View File

@@ -537,4 +537,62 @@
console.warn('#orlen_point_id nie został znaleziony.'); console.warn('#orlen_point_id nie został znaleziony.');
} }
}); });
// edycja personalizacji produktu w koszyku
$(document).on('click', '.btn-edit-custom-fields', function(e) {
e.preventDefault();
var $display = $(this).closest('.custom-fields-display');
var productCode = $display.data('product-code');
$display.hide();
$display.siblings('.custom-fields-edit[data-product-code="' + productCode + '"]').show();
});
$(document).on('click', '.btn-cancel-custom-fields', function(e) {
e.preventDefault();
var $edit = $(this).closest('.custom-fields-edit');
var productCode = $edit.data('product-code');
$edit.hide();
$edit.siblings('.custom-fields-display[data-product-code="' + productCode + '"]').show();
});
$(document).on('click', '.btn-save-custom-fields', function(e) {
e.preventDefault();
var $edit = $(this).closest('.custom-fields-edit');
var productCode = $edit.data('product-code');
var valid = true;
$edit.find('input[required]').each(function() {
if ($.trim($(this).val()) === '') {
$(this).css('border-color', 'red');
valid = false;
} else {
$(this).css('border-color', '');
}
});
if (!valid) {
alert('Wypełnij wszystkie wymagane pola');
return;
}
var formData = { product_code: productCode };
$edit.find('input[name^="custom_field"]').each(function() {
formData[$(this).attr('name')] = $(this).val();
});
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/basket_update_custom_fields',
data: formData,
success: function(response) {
var data = jQuery.parseJSON(response);
if (data.result === 'ok') {
location.reload();
} else {
alert(data.message || 'Wystąpił błąd');
}
}
});
});
</script> </script>