"use strict"; // const List_product = [ { productId: 1, product_name: 'Combo Bàn phím và Chuột không dây MOFII CANDY Milk Tea', productUrl: '/', image: 'https://mygear.vn/media/product/589-1.jpg', price: 1250000, retail_price: 500000, quantity: 20, sale_quantity: 10, quantity_member: 5, from_time: 1703213170286, to_time: 1703955500000, status: 'started', category_info: [ { id: 1, name_category: 'Chuột' }, { id: 2, name_category: 'Bàn phím' }, ], list_group: [ { group_id: 1, name_group: 'Hura săn sale', product_id: 1, productUrl: '/', product_image: 'https://mygear.vn/media/product/589-1.jpg', product_name: 'Combo Bàn phím và Chuột không dây MOFII CANDY Milk Tea', price: 3190000, quantity: 20, sale_quantity: 10, quantity_member: 5, retail_price: 2190000, to_time: 1703955600000, list_member: [ { id_member: 1, name_member: 'Hồng Vũ', email_member: 'hongvt@hurasoft.com' }, { id_member: 2, name_member: 'Ánh trần', email_member: 'anhtt@hurasoft.com' }, { id_member: 3, name_member: 'Đức Quân', email_member: 'ducnq@hurasoft.com' }, ] } ] }, { productId: 2, product_name: 'Chuột không dây logitech M590 Wireless Bluetooth', productUrl: '/', image: 'https://mygear.vn/media/product/1634-chu---t-kh--ng-d--y-logitech-m590-wireless-bluetooth.jpg', price: 570000, retail_price: 300000, quantity: 30, sale_quantity: 10, quantity_member: 5, from_time: 1703213170286, to_time: 1703955600000, status: 'started', category_info: [ { id: 1, name_category: 'Chuột' }, { id: 2, name_category: 'Bàn phím' }, ], list_group: [] }, { productId: 3, product_name: 'Bàn phím cơ VGN VXE75 Trans Purple RGB (Bluetooth, 2.4GHz Wireless, Type-A)', productUrl: '/', image: 'https://mygear.vn/media/product/4793-vgn-vxe75-trans-purple.jpg', price: 3190000, retail_price: 2190000, quantity: 30, sale_quantity: 10, quantity_member: 5, from_time: 1703696400000, to_time: 1703955600000, status: 'coming', category_info: [ { id: 2, name_category: 'Bàn phím' }, ], list_group: [] }, { productId: 4, product_name: 'Màn hình Gaming Samsung Odyssey G5 LS27CG510EEXXV 27" QHD VA 165Hz (HDMI,Displayport)', productUrl: '/', image: 'https://mygear.vn/media/product/3761-samsung-odyssey-g5-ls27cg510eexxv.jpg', price: 4700000, retail_price: 4500000, quantity: 30, sale_quantity: 30, quantity_member: 5, from_time: 1703213170286, to_time: 1703955600000, status: 'out_stock', category_info: [ { id: 5, name_category: 'Màn hình' }, ], list_group: [] }, { productId: 5, product_name: 'Kit bàn phím cơ MonsGeek M1 QMK (Full Nhôm – Mạch xuôi – QMK / VIA – PCB Stab) - (Silver)', productUrl: '/', image: 'https://mygear.vn/media/product/3613-monsgeek-m1-qmk-6.jpg', price: 2290000, retail_price: 2000000, quantity: 20, sale_quantity: 20, quantity_member: 5, from_time: 1703213170286, to_time: 1703955600000, status: 'out_stock', category_info: [ { id: 2, name_category: 'Bàn phím' }, ], list_group: [], } ]; const User = [ { leaderId: 1, leaderName: 'Hiếu Nguyễn', leaderEmail: 'hieunguyen@hurasoft.com', list_group: [ { group_id: 1, name_group: 'Hura săn sale', product_id: 1, productUrl: '/', product_image: 'https://mygear.vn/media/product/589-1.jpg', product_name: 'Combo Bàn phím và Chuột không dây MOFII CANDY Milk Tea', price: 3190000, retail_price: 2190000, quantity: 20, sale_quantity: 10, quantity_member: 5, to_time: 1703955600000, list_member: [ { id_member: 1, name_member: 'Hồng Vũ', email_member: 'hongvt@hurasoft.com' }, { id_member: 2, name_member: 'Ánh trần', email_member: 'anhtt@hurasoft.com' }, { id_member: 3, name_member: 'Đức Quân', email_member: 'ducnq@hurasoft.com' } ] } ] } ]; function formatPrice(price) { var b = price.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1.").toString(); var len = b.length; b = b.substring(0, len - 3); return b; } function countDown(iid, endTime) { const updateCountdown = () => { const now = Date.now(); const distance = endTime - now; if (distance > 0) { const [days, hours, minutes, seconds] = getTimeComponents(distance); displayCountdown(iid, days, hours, minutes, seconds); } else { clearInterval(timer); } }; // Initial update to avoid delay updateCountdown(); const timer = setInterval(updateCountdown, 1000); } function getTimeComponents(distance) { const days = Math.floor(distance / (1000 * 60 * 60 * 24)); const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((distance % (1000 * 60)) / 1000); return [days, hours, minutes, seconds]; } function displayCountdown(iid, days, hours, minutes, seconds) { const element = document.querySelector(`.${iid}`); if (element) { if (days > 0) { element.innerHTML = ` ${formatTimeComponent(days)} ${formatTimeComponent(hours)} ${formatTimeComponent(minutes)} ${formatTimeComponent(seconds)}`; } else { element.innerHTML = ` ${formatTimeComponent(hours)} ${formatTimeComponent(minutes)} ${formatTimeComponent(seconds)}`; } } } function formatTimeComponent(component) { return component <= 9 ? '0' + component : component.toString(); } function formatTime(timestamp) { const date = new Date(timestamp); const formattedTime = date.toLocaleString('en-US', { day: 'numeric', month: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }); return formattedTime; } function formatName(name) { // Extract the first letter and capitalize it const formattedName = name.charAt(0).toUpperCase(); return formattedName; } const AddGroupTemplate = `
Hoặc bạn có thể mời bạn bè của bạn bằng cách nhập email
+ Thêm emailThông tin thanh toán sẽ được gửi qua email của bạn.
ok