'); printWindow.document.close(); var image = printWindow.document.createElement('img'); image.alt = 'Thiệp HAPPYCO — ' + prepared.result.data.name; image.onload = function () { printWindow.focus(); printWindow.print(); }; image.src = prepared.canvas.toDataURL('image/png'); printWindow.document.body.append(image); try { await record('card_print', {type: currentType, year: Number(year), dataAsOf: snapshotDate}); showMessage('Đã mở bản in. Chọn máy in hoặc lưu PDF trong hộp thoại của trình duyệt.', false, true); } catch (error) { showMessage('Đã mở bản in, nhưng chưa lưu được lịch sử: ' + error.message, true); } } } function fallbackCopy(value) { var area = document.createElement('textarea'); area.value = value; area.style.position = 'fixed'; area.style.left = '-9999px'; document.body.append(area); area.select(); var copied = document.execCommand('copy'); area.remove(); if (!copied) throw new Error('Trình duyệt chưa cho phép sao chép. Vui lòng cấp quyền clipboard hoặc thử trình duyệt khác.'); } function fileName(data) { var slug = data.name.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[đĐ]/g, 'd').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 80) || data.customerId; var kind = data.type === 'rank' ? data.tier : data.type; return (data.demo ? 'DEMO_' : '') + 'HAPPYCO_' + slug + '_' + kind + '_' + data.year + '_' + (data.dataAsOf || 'chua-cap-nhat') + '.png'; } root.CardStudio = {open: open, close: close, render: render, makeMessage: makeMessage, buildData: buildData, defaultGreeting: defaultGreeting, fileName: fileName, DEFAULT_GREETINGS: Object.assign({}, DEFAULT_GREETINGS)}; }(typeof window !== 'undefined' ? window : globalThis));

Đang mở HAPPYCO...