$(document).ready(function() {
doAJAX('daily-challenges', 'GET').promise.then((res) => {
if(res.success) {
const uploadReceiptChallenge = res.data.list.find(ch => ch.id === 6);
if(uploadReceiptChallenge) {
skaleChallenges.showChallengeItem(uploadReceiptChallenge);
} else {
console.error('Upload receipt challenge not found in the list.');
}
} else {
console.error('Failed to fetch the list of challenges.');
}
}).catch((err) => {
console.error('An error occurred while fetching the list of challenges:', err);
});
// UPDATE LANGUAGE
$('#use_voucher-modal-submit').text('Klik untuk Menebus Baucar');
$('#title').remove();
$('#voucher_usage').append('
Adakah anda pasti menggunakan baucar ini?
');
$('#promo_mech_title').remove();
$('.status-claimed').prepend('Salin dan gunakan kod Promosi ini dalam apl TnG
');
$('.h4.mt-2.text-center').text('Hooray! Anda telah berjaya menebus baucar anda');
$('#use_voucher-modal-close').text('lengkap');
$('.bottom_section.bottom_ui#notification_btn:before').text('Notis');
$('.bottom_section.bottom_ui#reward_redemption_btn:before').text('Ganjaran');
let contactLink = $('', {
class: 'bold underline',
href: 'https://ganjaranraya.pacificwestcampaigns.com/register',
text: 'Daftar Sekarang',
});
$('#signup_cta').text('Belum berdaftar dengan kami? ').append(contactLink);
$('#btn-login').text('Hantar Log Masuk OTP');
$('#btn-login-otp ').text('Hantar Log Masuk OTP');
// When the modal is about to be shown
$('#popup_login_otp').on('shown.bs.modal', function() {
const currentText = $('div[status_id="default"]').find('.text-center').find('.user-mobile');
$('div[status_id="default"]').find('.text-center').text('Anda telah masuk').append("
").append(currentText).append("
").append("Sila Masukkan pin Pengesahan 6 Digit yang dihantar ke nombor telefon bimbit anda untuk melengkapkan pengesahan");
});
$('.reward-body-container h5').text('baucar saya');
$('#voucher_single').find('a:contains("Click here to see all My Vouchers")').contents().last().replaceWith(' Klik di sini untuk melihat semua Baucar Saya');
$('#popup_rewards').on('shown.bs.modal', function() {
// Loop through all buttons in wallet-container and update the text
$('.btn-use-reward').each(function() {
let buttonText = $(this).text().trim();
if (buttonText === 'View Promo Code') {
$(this).text('Lihat Kod Promosi');
} else if (buttonText === 'Redeem') {
$(this).text('Tebus');
}
});
});
$('.voucher_single-claimable').text('Tebus');
// Replace the text of any if it contains "TNG APP"
$('span').each(function() {
if ($(this).text().includes('TNG APP')) {
$(this).text('Baucar ini hanya sah digunakan di').append('
').append('TNG APP');
}
});
// popup_challenge_result
$('#popup_challenge_result').on('shown.bs.modal', function() {
// $('#popup_challenge_result-okay').text('Tebus');
$('.voucher-card').find('.btn-use-reward').each(function() {
if ($(this).text().trim() === 'Redeem') {
$(this).text('Tebus');
}
});
});
// use_voucher-modal
$('#use_voucher-modal').on('shown.bs.modal', function() {
$('#use_voucher-modal-finish').text('Teruskan');
});
// receipt submission modal
$('#popup_upload_receipt').on('shown.bs.modal', function(){
$('.add-img.init-add-more').text('Resit terlalu panjang? Muat naik bahagian seterusnya');
$('#popup_upload_receipt-submit').text('Hantar');
$('#popup_upload_receipt-cancel').text('Kembaliā');
});
});
$(window).on('load',function(){
function initCountryCodes(dropdown_el, default_country) {
$(dropdown_el).val('60').trigger('change');
}
$(async function () {
initCountryCodes('#signup-countrycode', 'MY');
initCountryCodes('#login-countrycode', 'MY');
autoPopulateForm();
});
})