Skip to content

Commit

Permalink
big update
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Jun 22, 2022
1 parent 6a9fe84 commit ea68cf5
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions views/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
?>
<?= \yii\helpers\Html::beginTag('div', $widget->options); ?>

<?php
$shopDiscounts = \skeeks\cms\shop\models\ShopDiscount::find()->cmsSite()->select(['id']);

if(\skeeks\cms\shop\models\ShopDiscountCoupon::find()->andWhere([
'shop_discount_id' => $shopDiscounts
])->active()->exists()) : ?>

<? if ($shopUser->discountCoupons) : ?>
<ul class="list-unstyled sx-applyed-coupons">
<? foreach ($shopUser->discountCoupons as $discountCoupon) : ?>
Expand All @@ -34,7 +41,7 @@ class="sx-main-text-color g-color-primary--hover g-text-underline--none--hover">
</div>
<a href='#' style="font-size: 11px;" data-toggle="tooltip" title='<?= \Yii::t('skeeks/shop-dicount-coupon', 'Remove coupon'); ?>'
class="sx-btn-remove-coupon pull-right g-color-primary--hover g-text-underline--none--hover my-auto sx-color-silver"
onclick="sx.Shop.removeDiscountCoupon(<?= $discountCoupon->id; ?>); return false;">
data-id="<?= $discountCoupon->id; ?>">
<i class="hs-icon hs-icon-close"></i>
</a>
</div>
Expand Down Expand Up @@ -88,6 +95,8 @@ class="sx-btn-remove-coupon pull-right g-color-primary--hover g-text-underline--
{
sx.Shop.trigger('change');
}, 800);
window.location.reload();
});
Expand All @@ -97,10 +106,24 @@ class="sx-btn-remove-coupon pull-right g-color-primary--hover g-text-underline--
self.JMessageError.empty().show().append(response.message);
});
ajaxQuery.execute();
ajaxQuery.execxute();
return false;
});
$(".sx-btn-remove-coupon").on("click", function() {
var id = $(this).data("id");
var ajaxQuery = sx.Shop.createAjaxRemoveDiscountCoupon(id);
ajaxQuery.on("success", function () {
window.location.reload();
return false;
});
ajaxQuery.execute();
return false;
});
}
});
Expand Down Expand Up @@ -142,4 +165,6 @@ class="sx-btn-remove-coupon pull-right g-color-primary--hover g-text-underline--
]); ?>
<? $widget::end(); ?>

<?php endif; ?>

<?= \yii\helpers\Html::endTag('div'); ?>

0 comments on commit ea68cf5

Please sign in to comment.