{
total_price = $event.detail.total_price;
calculateProgress();
})"
x-init="calculateProgress();"
x-data="{
total_price: 0,
threshold_standard: 3500,
threshold_expedited: 7500,
remaining_standard: '
$35',
remaining_expedited: '
$75',
progress_percentage: 0,
expedited_enabled: true,
standard_message_before: `당신은$ x
무료 배송 까지`,
standard_message_after: `축하합니다! 무료 배송이 잠금 해제되었습니다!`,
expedited_message_before: `Add $x more for expedited shipping`,
expedited_message_after: `Congratulations! You've unlocked expedited shipping`,
calculateProgress() {
this.total_price = parseFloat(this.total_price) || 0;
const max_threshold = this.expedited_enabled ? this.threshold_expedited : this.threshold_standard;
this.progress_percentage = Math.min((this.total_price / max_threshold) * 100, 100);
// Calculate remaining amounts
const remaining_standard_cents = Math.max(this.threshold_standard - this.total_price, 0);
const remaining_expedited_cents = Math.max(this.threshold_expedited - this.total_price, 0);
this.remaining_standard = Unick.marketMoney(remaining_standard_cents/100);
this.remaining_expedited = Unick.marketMoney(remaining_expedited_cents/100);
}
}">