some updates
This commit is contained in:
parent
e2a41f3ed4
commit
ae70fce290
37
index.php
37
index.php
@ -8049,23 +8049,6 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
<div id="nextTierInfo" class="smaller text-muted mt-1"><?= $lang === 'ar' ? 'أنفق المزيد للوصول إلى الفضي' : 'Spend more to unlock Silver' ?></div>
|
<div id="nextTierInfo" class="smaller text-muted mt-1"><?= $lang === 'ar' ? 'أنفق المزيد للوصول إلى الفضي' : 'Spend more to unlock Silver' ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if (($data['settings']['manual_discount_enabled'] ?? '0') === '1'): ?>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="small fw-bold mb-1" data-en="Manual Discount" data-ar="الخصم اليدوي"><?= $lang === 'ar' ? 'الخصم اليدوي' : 'Manual Discount' ?></label>
|
|
||||||
<div class="input-group input-group-sm">
|
|
||||||
<span class="input-group-text"><?= __('currency') ?></span>
|
|
||||||
<input type="number" id="manualDiscountAmount" class="form-control" value="0.000" min="0" step="0.001" oninput="cart.onManualDiscountChange()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div>
|
|
||||||
<label class="small fw-bold mb-1" data-en="Discount Code" data-ar="رمز الخصم"><?= $lang === 'ar' ? 'رمز الخصم' : 'Discount Code' ?></label>
|
|
||||||
<div class="input-group input-group-sm">
|
|
||||||
<input type="text" id="discountCode" class="form-control" placeholder="<?= $lang === 'ar' ? 'الرمز' : 'Code' ?>" data-en="Code" data-ar="الرمز">
|
|
||||||
<button class="btn btn-outline-primary" type="button" onclick="cart.applyDiscount()" data-en="Apply" data-ar="تطبيق"><?= $lang === 'ar' ? 'تطبيق' : 'Apply' ?></button>
|
|
||||||
</div>
|
|
||||||
<div id="appliedDiscountInfo" class="smaller text-primary mt-1" style="display:none"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cart-items" id="cartItems">
|
<div class="cart-items" id="cartItems">
|
||||||
@ -8077,6 +8060,16 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cart-total">
|
<div class="cart-total">
|
||||||
|
<?php if (($data['settings']['manual_discount_enabled'] ?? '0') === '1'): ?>
|
||||||
|
<div class="mb-3 pb-3 border-bottom">
|
||||||
|
<label class="small fw-bold mb-1" data-en="Discount" data-ar="الخصم"><?= $lang === 'ar' ? 'الخصم' : 'Discount' ?></label>
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<span class="input-group-text"><?= __('currency') ?></span>
|
||||||
|
<input type="number" id="manualDiscountAmount" class="form-control text-end" value="0.000" min="0" step="0.001" oninput="cart.onManualDiscountChange()">
|
||||||
|
</div>
|
||||||
|
<div id="manualDiscountLimitInfo" class="smaller text-muted mt-1"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<div class="d-flex justify-content-between mb-1">
|
<div class="d-flex justify-content-between mb-1">
|
||||||
<span data-en="Subtotal (Excl. VAT)" data-ar="المجموع (بدون الضريبة)"><?= $lang === 'ar' ? 'المجموع (بدون الضريبة)' : 'Subtotal (Excl. VAT)' ?></span>
|
<span data-en="Subtotal (Excl. VAT)" data-ar="المجموع (بدون الضريبة)"><?= $lang === 'ar' ? 'المجموع (بدون الضريبة)' : 'Subtotal (Excl. VAT)' ?></span>
|
||||||
<span id="posSubtotal"><?= __('currency') ?> 0.000</span>
|
<span id="posSubtotal"><?= __('currency') ?> 0.000</span>
|
||||||
@ -8489,7 +8482,9 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
async applyDiscount() {
|
async applyDiscount() {
|
||||||
const code = document.getElementById('discountCode').value.trim();
|
const discountInput = document.getElementById('discountCode');
|
||||||
|
if (!discountInput) return;
|
||||||
|
const code = discountInput.value.trim();
|
||||||
if (!code) return;
|
if (!code) return;
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`index.php?action=validate_discount&code=${code}`);
|
const resp = await fetch(`index.php?action=validate_discount&code=${code}`);
|
||||||
@ -8499,8 +8494,10 @@ runtime_debug_mark('page:rendering', ['page' => (string)$page]);
|
|||||||
const manualDiscountInput = document.getElementById('manualDiscountAmount');
|
const manualDiscountInput = document.getElementById('manualDiscountAmount');
|
||||||
if (manualDiscountInput) manualDiscountInput.value = '0.000';
|
if (manualDiscountInput) manualDiscountInput.value = '0.000';
|
||||||
const info = document.getElementById('appliedDiscountInfo');
|
const info = document.getElementById('appliedDiscountInfo');
|
||||||
info.innerText = `${posT('Applied', 'تم تطبيق')}: ${this.discount.code} (${this.discount.type === 'percentage' ? this.discount.value + '%' : '<?= __('currency') ?> ' + parseFloat(this.discount.value).toFixed(3)})`;
|
if (info) {
|
||||||
info.style.display = 'block';
|
info.innerText = `${posT('Applied', 'تم تطبيق')}: ${this.discount.code} (${this.discount.type === 'percentage' ? this.discount.value + '%' : '<?= __('currency') ?> ' + parseFloat(this.discount.value).toFixed(3)})`;
|
||||||
|
info.style.display = 'block';
|
||||||
|
}
|
||||||
this.render();
|
this.render();
|
||||||
} else {
|
} else {
|
||||||
Swal.fire(posT('Error', 'خطأ'), res.error, 'error');
|
Swal.fire(posT('Error', 'خطأ'), res.error, 'error');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user