Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/application/views/account/ |
Upload File : |
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?> <div class="account-affiliate-container"> <?php if ($affiliate_status == "approve"): ?> <!-- <h1><?= ucfirst(lang('affiliate_title')) ?></h1> --> <!-- <p><?= ucfirst(lang('affiliate_sub_title')) ?></p> --> <div class="tabs"> <div class="tab-buttons"> <button class="tab-btn active" onclick="showTab('performance-summary')"><?= lang('tab_dashboard_title') ?></button> <button class="tab-btn" onclick="showTab('referred-users')"><?= lang('tab_customers_title') ?></button> <button class="tab-btn" onclick="showTab('referred-transactions')"><?= lang('tab_transactions_title') ?></button> <button class="tab-btn" onclick="showTab('referral-info')"><?= lang('tab_referral_title') ?></button> <button class="tab-btn" onclick="showTab('withdrawal-history')"><?= lang('tab_withdrawal_title') ?></button> </div> <div id="performance-summary" class="tab-content active"> <div class="summary-container"> <!-- <h2>Affiliate Performance Summary</h2> --> <div class="summary-grid"> <div class="summary-card" id="total-earnings"> <h3>Total Earnings</h3> <p id="earnings-value">IDR <?= number_format($total_affiliate_earnings, 0, ',', '.') ?></p> <small>Updated: <?= date('F Y') ?></small> </div> <div class="summary-card" id="total-clicks"> <h3>Total Clicks</h3> <p id="clicks-value"><?= $total_affiliate_link_clicks ?></p> <small>Updated: <?= date('F Y') ?></small> </div> <div class="summary-card" id="total-transactions"> <h3>Total Transactions</h3> <p id="transactions-value"><?= $total_affiliate_transactions ?></p> <small>Updated: <?= date('F Y') ?></small> </div> <div class="summary-card" id="conversion-rate"> <h3>Conversion Rate</h3> <p id="conversion-value"><?= $affiliate_conversion_rate ?>%</p> <small>Updated: <?= date('F Y') ?></small> </div> </div> <h2>Click Statistic</h2> <div class="filter-container"> <label for="start_date">Start Date:</label> <input type="date" id="start_date" aria-label="Select start date"> <label for="end_date">End Date:</label> <input type="date" id="end_date" aria-label="Select end date"> <button id="filter_button" aria-label="Apply date filter">Filter</button> </div> <!-- Grafik Klik Harian --> <div class="chart-container"> <canvas id="affiliateClicksChart" width="400" height="200" aria-label="Affiliate clicks chart"></canvas> </div> </div> </div> <div id="referred-users" class="tab-content"> <div class="referred-container"> <div class="referred-grid"> <div class="referred-card" id="total-earnings"> <h3>Total Customers</h3> <p id="earnings-value"><?= $total_referred_customers ?></p> <small>Updated: <?= date('F Y') ?></small> </div> </div> <div class="referred-customers-container"> <h2>Customers Referred by You</h2> <div class="referred-search-container"> <input type="text" id="referred-search" placeholder="Search by name or email" onkeyup="filterCustomers()"> </div> <ul class="referred-list" id="referredList"> <?php if (!empty($referred_customers)): ?> <?php foreach ($referred_customers as $customer): ?> <li class="referred-customer-item"> <div class="referred-customer-info"> <span class="referred-customer-name"><?= $customer['name'] ?></span> <span class="referred-customer-email"><?= $customer['email'] ?></span> </div> <div class="referred-customer-join-date"> Joined <?= date('d M Y', strtotime($customer['join_date'])) ?> </div> </li> <?php endforeach; ?> <?php else: ?> <li>Belum ada pelanggan yang direferensikan oleh Kamu.</li> <?php endif; ?> </ul> </div> </div> </div> <div id="referred-transactions" class="tab-content"> <div class="referred-container"> <!-- <h2>Affiliate Performance Summary</h2> --> <div class="referred-grid"> <div class="referred-card" id="total-earnings"> <h3>Total Transactions</h3> <p id="earnings-value"><?= $total_affiliate_transactions ?></p> <small>Updated: <?= date('F Y') ?></small> </div> </div> <div class="table-container"> <table id="referred-table"> <thead> <tr> <th>ID Orders</th> <th data-sort="customer_name">Customer Name</th> <th data-sort="order_date">Order Date</th> <th data-sort="total_amount">Total</th> <th data-sort="commission">Commission <?= $affiliate_data->kategori ?></th> </tr> </thead> <tbody> <?php if (!empty($affiliate_transactions_data)): ?> <?php foreach ($affiliate_transactions_data as $transaction): ?> <tr> <td><?= $transaction['id_orders'] ?></td> <td><?= $transaction['customer_name'] ?></td> <td><?= date('d M Y', strtotime($transaction['order_date'])) ?></td> <td>IDR <?= number_format($transaction['total_amount'], 0, ',', '.') ?></td> <td>IDR <?= number_format(($affiliate_data->kategori == 'asmaradoor' ? 0.1 : 0.2) * $transaction['total_amount'], 0, ',', '.') ?></td> </tr> <?php endforeach; ?> <?php else: ?> <tr> <td colspan="5">Belum ada transaksi yang dilakukan dengan kode referral Kamu.</td> </tr> <?php endif; ?> </tbody> </table> </div> </div> </div> <div id="referral-info" class="tab-content"> <div class="referred-container"> <h1><?= ucfirst(lang('affiliate_referral_summary')) ?></h1> <p><?= ucfirst(lang('affiliate_referral_code')) ?>: <b><?= $referral_code ?></b></p> <?php if ($pending_commission < 10000): ?> <div class="commission_alert commission_alert_warning" role="alert"> <div class="commission_alert_icon"> <i data-feather="alert-circle"></i> </div> <div class="commission_alert_content"> <p><?= lang('alert_minimum_withdrawal') ?></p> </div> </div> <?php endif; ?> <div class="summary-grid"> <div class="summary-card" id="total-earnings"> <h3>Total Sales</h3> <p id="earnings-value">IDR <?= number_format($total_sales, 0, ',', '.') ?></p> <small>Updated: <?= date('F Y') ?></small> </div> <div class="summary-card" id="total-earnings"> <h3>Sales Commission</h3> <p id="earnings-value">IDR <?= number_format($total_sales_commission, 0, ',', '.') ?></p> <small>Updated: <?= date('F Y') ?></small> </div> <div class="summary-card" id="total-earnings"> <h3>Link Clicks</h3> <p id="earnings-value"><?= $total_affiliate_link_clicks ?></p> <small>Total Link Clicks</small> </div> <div class="summary-card" id="total-earnings"> <h3>Link Commission</h3> <p id="earnings-value">IDR <?= number_format($click_commission, 0, ',', '.') ?></p> <small>Link commission</small> </div> <div class="summary-card" id="total-earnings"> <h3>Pending Commission</h3> <p id="earnings-value">IDR <?= number_format($pending_commission, 0, ',', '.') ?></p> <small>Undrawn commission</small> </div> <div class="summary-card" id="total-earnings"> <h3>Earned Commission</h3> <p id="earnings-value">IDR <?= number_format($earned_commission, 0, ',', '.') ?></p> <small>Withdrawn commission</small> </div> </div> </div> <!-- Table link sales --> <div class="table-container"> <table id="referred-table"> <thead> <tr> <th>ID Link</th> <th>Product Name</th> <th>Status</th> <th>Total Open</th> <th>Open Link Comission</th> <th>Sales Commission</th> <th>Copy Link</th> </tr> </thead> <tbody> <?php foreach ($affiliate_link_sales as $affiliate_link): ?> <tr> <td><?= $affiliate_link['id_link'] ?></td> <td><?= $affiliate_link['product_name'] ?></td> <td><?= $affiliate_link['status'] ?></td> <td><?= $affiliate_link['clicks'] ?></td> <td>IDR <?= number_format($affiliate_link['clicks'] * 50) ?></td> <td>IDR <?= number_format($total_sales_commission) ?></td> <td> <input type="text" value="<?= $affiliate_link['link'] ?>" id="link-<?= $affiliate_link['id_link'] ?>" readonly style="display:none;"> <button class="commission_copy_btn" onclick="copyLink('link-<?= $affiliate_link['id_link'] ?>')"> <i data-feather="copy"></i> </button> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <div id="withdrawal-history" class="tab-content"> <div class="referred-container"> <form id="bankInformationForm"> <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>"> <div class="account-form-group"> <label for="bank_name">Bank Name</label> <input type="text" id="bank_name" name="bank_name" value="<?= $affiliate_data->account_type ?>"> </div> <div class="account-form-group"> <label for="account_name">Account Name</label> <input type="text" id="account_name" name="account_name" value="<?= $affiliate_data->account_name ?>"> </div> <div class="account-form-group"> <label for="account_number">Account Number</label> <input type="text" id="account_number" name="account_number" value="<?= $affiliate_data->account_number ?>"> </div> <div class="account-form-actions"> <button type="submit" id="bankInformationButton" class="account-btn">Save Changes</button> </div> </form> <h1><?= ucfirst(lang('affiliate_withdrawal_title')) ?></h1> <p><?= ucfirst(lang('affiliate_withdrawal_subtitle')) ?></p> <div class="table-container"> <table id="referred-table"> <thead> <tr> <th>ID</th> <th>Bank</th> <th>Account Name</th> <th>Account Number</th> <th>Tanggal</th> <th>Commission</th> <th>Proof of Transfer</th> </tr> </thead> <tbody> <?php foreach ($affiliate_withdrawals_data as $affiliate_withdrawal): ?> <tr> <td><?= $affiliate_withdrawal['id_commision'] ?></td> <td><?= $affiliate_withdrawal['account_type'] ?></td> <td><?= $affiliate_withdrawal['account_name'] ?></td> <td><?= $affiliate_withdrawal['account_number'] ?></td> <td><?= date('d M Y', strtotime($affiliate_withdrawal['created'])) ?></td> <td>IDR <?= number_format($affiliate_withdrawal['commission']) ?></td> <td><?php if ($affiliate_withdrawal['proof']): ?> <button class="btn-view-proof" data-image="<?= base_url('uploads/commision_proof/' . $affiliate_withdrawal['proof']) ?>"> View Proof </button> <?php else: ?> <span>No Proof</span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> <?php elseif ($affiliate_status == "waiting"): ?> <div class="choice-container"> <h2><?= ucfirst(lang('select_affiliate_program')); ?></h2> <div class="choice-grid"> <div class="choice-box" id="asmaradoor-box" onclick="showAsmarasana()"> <h3>AsmaraSana</h3> <p><?= ucfirst(lang('asmarasana_program')); ?></p> </div> <div class="choice-box" id="asmarasana-box" onclick="showAsmaradoor()"> <h3>Asmaradoor</h3> <p><?= ucfirst(lang('asmaradoor_program')); ?></p> </div> </div> </div> <!-- asmarasana content --> <div id="asmarasana-content" style="display: none;"> <p><?= ucfirst(lang('what_is_asmarasana')); ?></p> </div> <!-- Asmaradoor --> <div id="asmaradoor-content" style="display: none;"> <p><?= ucfirst(lang('what_is')); ?></p> <p><?= ucfirst(lang('benefit')); ?></p> <p><?= ucfirst(lang('affiliate_notes')); ?></p> <div class="progress-container"> <div class="progress-step active"> <div class="progress-icon"> <i data-feather="user-plus"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('daftar')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('daftar_decs')); ?></p> </div> <div class="progress-line"> <div class="progress-line-inner"></div> </div> <div class="progress-step active"> <div class="progress-icon"> <i data-feather="clock"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('proses')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('proses_decs')); ?></p> </div> <div class="progress-line"> <div class="progress-line-inner"></div> </div> <div class="progress-step"> <div class="progress-icon"> <i data-feather="check-circle"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('disetujui')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('disetujui_decs')); ?></p> </div> </div> </div> <?php else: ?> <div class="choice-container"> <h2><?= ucfirst(lang('select_affiliate_program')); ?></h2> <div class="choice-grid"> <div class="choice-box" id="asmaradoor-box" onclick="showAsmarasana()"> <h3>AsmaraSana</h3> <p><?= ucfirst(lang('asmarasana_program')); ?></p> </div> <div class="choice-box" id="asmarasana-box" onclick="showAsmaradoor()"> <h3>Asmaradoor</h3> <p><?= ucfirst(lang('asmaradoor_program')); ?></p> </div> </div> </div> <!-- asmarasana content --> <div id="asmarasana-content" style="display: none;"> <p><?= ucfirst(lang('what_is_asmarasana')); ?></p> </div> <!-- Asmaradoor --> <div id="asmaradoor-content" style="display: none;"> <p><?= ucfirst(lang('what_is')); ?></p> <p><?= ucfirst(lang('benefit')); ?></p> <p><?= ucfirst(lang('affiliate_notes')); ?></p> <div class="progress-container"> <div class="progress-step active"> <div class="progress-icon"> <i data-feather="user-plus"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('daftar')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('daftar_decs')); ?></p> </div> <div class="progress-line"> <div class="progress-line-inner"></div> </div> <div class="progress-step"> <div class="progress-icon"> <i data-feather="clock"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('proses')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('proses_decs')); ?></p> </div> <div class="progress-line"> <div class="progress-line-inner"></div> </div> <div class="progress-step"> <div class="progress-icon"> <i data-feather="check-circle"></i> </div> <h5 class="progress-title"><?= ucfirst(lang('disetujui')); ?></h5> <p class="progress-desc"><?= ucfirst(lang('disetujui_decs')); ?></p> </div> </div> <form id="affiliateForm"> <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>"> <input type="hidden" name="kategori" id="kategori" value="asmaradoor"> <div class="account-form-group"> <label for="nama">Name</label> <input type="text" id="nama" name="nama" required> </div> <div class="account-form-group"> <label for="no_hp">No Telepon</label> <input type="tel" id="no_hp" name="no_hp" required> </div> <div class="account-form-group"> <label for="email">Email</label> <input type="email" id="email" name="email" required> </div> <div class="account-form-group"> <label for="link_sosmed">Link Sosial Media</label> <input type="text" id="link_sosmed" name="link_sosmed" required> </div> <div class="account-form-group terms-checkbox"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="termsCheck" required> <label class="custom-control-label" for="termsCheck"> <span class="terms-text"> <a href="#" class="terms-link" id="showTerms">Baca Dulu Dan Setuju Persyaratan Dan Ketentuan</a> </span> </label> </div> </div> <div class="account-form-actions"> <button type="submit" id="registerAffiliate" class="account-btn" disabled>Daftar</button> </div> </form> </div> <?php endif; ?> </div> <div class="affiliate-regist-modal hidden" id="termsModal"> <div class="affiliate-regist-modal-content"> <h4 class="affiliate-regist-modal-title"> <?php if ($this->session->userdata('site_lang') == 'english') : ?> <b>Asmaradoor Terms & Conditions</b> <?php else : ?> <b>Syarat dan Ketentuan Asmaradoor</b> <?php endif; ?> </h4> <button type="button" class="affiliate-regist-close-btn btn btn-danger" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true" id="closeModal">×</span> </button> <div class="affiliate-regist-modal-body"> <?php if ($this->session->userdata('site_lang') == 'english') : ?> <ol> <li> Agreement By participating in the Asmaradoor Affiliate Program, you agree to comply with the terms and conditions outlined herein. </li> <li> Affiliate Eligibility <ol type="a"> <li>Individuals or entities must be of legal age (21 years old).</li> <li>Affiliates must have active and legitimate social media platforms with engaged audiences.</li> </ol> </li> <li> Affiliate Responsibilities <ol type="a"> <li>Affiliates are responsible for creating and publishing their own content related to Laci Asmara products on their social media platforms.</li> <li>Affiliates must adhere to all applicable laws, regulations, and guidelines regarding content creation and promotion on affiliated social media, including but not limited to prohibitions on the use of visual media that leads to consumer protection, privacy, pornography and action porn, certain beliefs, racism, and etc.</li> <li>Affiliates are prohibited from engaging in any activities that may harm the reputation or brand image of Laci Asmara.</li> </ol> </li> <li> Relationship Participation in the Affiliate Program does not create any partnership, joint venture, agency, franchise, sales representative, or employment relationship between the affiliate and Laci Asmara </li> <li> Content Creation <ol type="a"> <li> Affiliates are solely responsible for the creation, accuracy, and legality of their content, including but not limited to product descriptions, reviews, and promotional materials.</li> <li> Laci Asmara shall not be held responsible for any claims, damages, or liabilities arising from the content created or published by affiliates.</li> </ol> </li> <li> Product Promotion <ol type="a"> <li>Affiliates are permitted to use images, logos, and other marketing materials provided by Laci Asmara for the purpose of promoting Laci Asmara products.</li> <li>Affiliates are prohibited from misrepresenting Laci Asmara products as medical devices, or therapeutic purposes of medical condition nor making false claims about their features, benefits, or effectiveness.</li> </ol> </li> <li> Compensation <ol type="a"> <li> Affiliates may earn commissions for sales generated through their unique affiliate links, as outlined in the affiliate agreement.</li> <li>Laci Asmara reserves the right to modify commission rates, payment terms, or eligibility criteria at any time without prior notice.</li> </ol> </li> <li> Termination <ol type="a"> <li> Laci Asmara reserves the right to terminate or suspend an affiliate's participation in the program at any time and for any reason, without liability.</li> <li> Upon termination, affiliates must immediately cease all promotional activities related to Laci Asmara products and remove any content featuring Laci Asmara products from their social media platforms. </li> </ol> </li> <li> Limitation of Liability In no event shall Laci Asmara be liable for any indirect, incidental, special, consequential, or punitive damages arising out of or related to the Affiliate Program. </li> <li> Governing Law These terms and conditions shall be governed by and construed in accordance with the laws of The Republic of Indonesia, without regard to its conflict of law principles. </li> <li> Modification<br> Laci Asmara reserves the right to modify or amend these terms and conditions at any time. Affiliates will be notified of any changes via email or through the Affiliate Program portal. </li> <li> Acceptance By participating in the Asmaradoor Affiliate Program, you acknowledge that you have read, understood, and agree to be bound by these terms and conditions. </li> </ol> <?php else : ?> <ol> <li> Persetujuan Dengan berpartisipasi dalam Program Afiliasi Asmaradoor, Anda setuju untuk mematuhi syarat dan ketentuan yang diuraikan di sini. </li> <li> Kelayakan Afiliasi <ol type="a"> <li>Individu atau entitas harus berusia minimum 21 tahun keatas.</li> <li>Afiliasi harus memiliki platform media sosial yang aktif dan sah dengan audiens yang terlibat.</li> </ol> </li> <li> Tanggung Jawab Afiliasi <ol type="a"> <li>Afiliasi bertanggung jawab atas pembuatan dan publikasi konten mereka sendiri yang terkait dengan produk-produk Laci Asmara di platform media sosial mereka.</li> <li>harus mematuhi semua hukum, peraturan perundangan, dan pedoman yang berlaku mengenai pembuatan konten dan promosi di media sosial afiliasi, termasuk namun tidak terbatas pada larangan penggunaan media visual yang mengarah kepada perlindungan konsumen, privasi, pornografi dan porno aksi, keyakinan tertentu, rasisme, dan sebagainya.</li> <li>Afiliasi dilarang melakukan segala aktivitas yang dapat merugikan reputasi atau citra merek Laci Asmara.</li> </ol> </li> <li> Hubungan Partisipasi dalam Program Afiliasi tidak menciptakan hubungan mitra, kemitraan, agen, waralaba, perwakilan penjualan, atau hubungan kerja antara afiliasi dan Laci Asmara. </li> <li> Pembuatan Konten <ol type="a"> <li> Afiliasi bertanggung jawab sepenuhnya atas pembuatan, keakuratan, dan legalitas konten mereka, termasuk namun tidak terbatas pada deskripsi produk, ulasan, dan materi promosi.</li> <li> Laci Asmara tidak akan bertanggung jawab atas klaim, kerusakan, atau kewajiban yang timbul dari konten yang dibuat atau dipublikasikan oleh afiliasi.</li> </ol> </li> <li> Promosi Produk <ol type="a"> <li>Afiliasi diizinkan menggunakan gambar, logo, dan materi pemasaran lainnya yang disediakan oleh Laci Asmara untuk tujuan mempromosikan produk-produk Laci Asmara. </li> <li>Afiliasi dilarang untuk menyesatkan produk-produk Laci Asmara,menyebutkan sebagai alat terapi, alat kesehatan atau membuat klaim palsu tentang fitur, manfaat, atau efektivitasnya.</li> </ol> </li> <li> Kompensasi <ol type="a"> <li>Afiliasi dapat menghasilkan komisi untuk penjualan yang dihasilkan melalui tautan afiliasi unik mereka, sesuai dengan yang diuraikan dalam perjanjian afiliasi. </li> <li>Laci Asmara berhak untuk memodifikasi tingkat komisi, syarat pembayaran, atau kriteria kelayakan kapan saja tanpa pemberitahuan sebelumnya. </li> </ol> </li> <li> Pemutusan <ol type="a"> <li> Laci Asmara berhak untuk mengakhiri atau menangguhkan partisipasi afiliasi dalam program kapan saja dan atas alasan apa pun, tanpa tanggung jawab. </li> <li> Apabila pemutusan terjadi dikarenakan afiliasi tidak mematuhi dan melakukan unsur pada pasal 3, maka konpensasi komisi tidak akan di limpahkan dan Laciasmara akan memutuskan program afiliasi sepihak. </li> <li> Setelah pemutusan, afiliasi harus segera menghentikan semua aktivitas promosi yang terkait dengan produk-produk Laci Asmara dan menghapus semua konten yang menampilkan produk-produk Laci Asmara dari platform media sosial mereka. </li> </ol> </li> <li> Batasan Tanggung Jawab Dalam hal apapun Laci Asmara tidak bertanggung jawab atas kerugian tidak langsung, insidental, khusus, konsekuensial, atau punitive yang timbul dari atau terkait dengan Program Afiliasi. </li> <li> Hukum yang Berlaku Syarat dan ketentuan ini akan diatur dan ditafsirkan sesuai dengan hukum Republik Indonesia, tanpa memperhatikan prinsip-prinsip konflik hukumnya. </li> <li> Modifikasi<br> Laci Asmara berhak untuk memodifikasi atau mengubah syarat dan ketentuan ini kapan saja. Afiliasi akan diberitahu tentang perubahan melalui email atau melalui portal Program Afiliasi. </li> <li> Penerimaan Dengan berpartisipasi dalam Program Afiliasi Asmaradoor, Anda mengakui bahwa Anda telah membaca, memahami, dan menyetujui untuk terikat oleh syarat dan ketentuan ini. </li> </ol> <?php endif; ?> </div> <div class="affiliate-regist-modal-footer"> <button type="button" class="btn btn-primary" id="agreeButton"> <?php if ($this->session->userdata('site_lang') == 'english') : ?> I Agree <?php else : ?> Saya Setuju <?php endif; ?> </button> </div> </div> </div> <div id="proofModal" class="proof-modal"> <div class="proof-modal-content"> <span class="proof-modal-close">×</span> <img id="proofImage" alt="Proof of Transfer"> </div> </div> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> let chart = null; function drawChart(labels, data) { const ctx = document.getElementById('affiliateClicksChart').getContext('2d'); if (chart) { chart.destroy(); } chart = new Chart(ctx, { type: 'line', data: { labels: labels, datasets: [{ label: 'Total Click', data: data, borderColor: '#7A4397', backgroundColor: 'rgba(122, 67, 151, 0.2)', fill: false, }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true } } } }); } async function fetchAndDisplayData() { const startDate = document.getElementById('start_date').value; const endDate = document.getElementById('end_date').value; if (!startDate || !endDate) { alert('Pilih tanggal mulai dan akhir.'); return; } const response = await fetch(`<?= base_url('account/get_affiliate_clicks') ?>?start_date=${startDate}&end_date=${endDate}&referral=${'<?= $referral_code ?>'}`); const data = await response.json(); const labels = data.map(item => item.date); const clicksData = data.map(item => item.unique_visits); drawChart(labels, clicksData); } // Function to filter customers based on search input function filterCustomers() { const searchInput = document.getElementById("referred-search").value.toLowerCase(); const customerItems = document.querySelectorAll(".referred-customer-item"); customerItems.forEach(item => { const name = item.querySelector(".referred-customer-name").textContent.toLowerCase(); const email = item.querySelector(".referred-customer-email").textContent.toLowerCase(); if (name.includes(searchInput) || email.includes(searchInput)) { item.style.display = ""; } else { item.style.display = "none"; } }); } // Copy Link function copyLink(linkId) { var copyText = document.getElementById(linkId); var textToCopy = copyText.value; navigator.clipboard.writeText(textToCopy).then(function() { notyf.success('Link copied to clipboard!'); }).catch(function(error) { notyf.error('Failed to copy the link.'); }); } function showAsmaradoor() { document.getElementById("asmaradoor-content").style.display = "block"; document.getElementById("asmarasana-content").style.display = "none"; document.querySelectorAll('.choice-box').forEach(box => { box.classList.remove('active'); }); document.getElementById('asmarasana-box').classList.add('active'); } function showAsmarasana() { document.getElementById("asmaradoor-content").style.display = "none"; document.getElementById("asmarasana-content").style.display = "block"; document.querySelectorAll('.choice-box').forEach(box => { box.classList.remove('active'); }); document.getElementById('asmaradoor-box').classList.add('active'); } function showTab(tabId) { document.querySelectorAll('.tab-content').forEach(content => { content.classList.remove('active'); }); document.querySelectorAll('.tab-btn').forEach(btn => { btn.classList.remove('active'); }); document.getElementById(tabId).classList.add('active'); document.querySelector(`[onclick="showTab('${tabId}')"]`).classList.add('active'); } const notyf = new Notyf({ duration: 3000, position: { x: 'right', y: 'top' }, types: [{ type: 'success', background: '#7A4397', icon: { className: 'fas fa-check', tagName: 'i', color: 'white' } }, { type: 'error', background: '#dc3545', icon: { className: 'fas fa-times', tagName: 'i', color: 'white' } } ] }); document.addEventListener("DOMContentLoaded", function() { const termsModal = document.getElementById("termsModal"); const showTermsLink = document.getElementById("showTerms"); const closeModal = document.getElementById("closeModal"); const urlParams = new URLSearchParams(window.location.search); const selected = urlParams.get('selected'); if (selected === 'asmaradoor') { if (document.getElementById("asmaradoor-content") && document.getElementById("asmarasana-content")) { showAsmaradoor(); } } else { if (document.getElementById("asmaradoor-content") && document.getElementById("asmarasana-content")) { showAsmarasana(); } } // document.getElementById('refresh-button').addEventListener('click', function() { // alert('Refreshing data... (placeholder for real functionality)'); // // Placeholder: Fetch updated data from the backend and update values // }); // Filter Graph if (document.getElementById("filter_button")) { document.getElementById("filter_button").addEventListener("click", fetchAndDisplayData); } // Menampilkan modal saat link diklik if (showTermsLink) { showTermsLink.addEventListener("click", function(event) { event.preventDefault(); if (termsModal) { termsModal.classList.remove("hidden"); } }); } // Menutup modal saat tombol close diklik if (closeModal) { closeModal.addEventListener("click", function() { if (termsModal) { termsModal.classList.add("hidden"); } }); } // Menutup modal jika area luar diklik window.addEventListener("click", function(event) { if (event.target === termsModal) { termsModal.classList.add("hidden"); } }); document.getElementById('agreeButton').addEventListener('click', function() { // Tutup modal document.getElementById('termsModal').classList.add('hidden'); }); // Submit Regist const form = document.getElementById('affiliateForm'); const registButton = document.getElementById('registerAffiliate'); // Enable button only when all inputs are filled and checkbox is checked if (form && registButton) { form.addEventListener("input", () => { const isFormValid = [...form.querySelectorAll("input[required]")].every(input => input.value.trim() !== '') && document.getElementById("termsCheck").checked; registButton.disabled = !isFormValid; }); form.addEventListener("submit", async (event) => { event.preventDefault(); const formData = new FormData(form); const baseUrl = '<?= base_url(); ?>'; try { const response = await fetch(baseUrl + 'account/register_affiliator', { method: 'POST', body: formData }); const data = await response.json(); if (data.status === 'success') { notyf.success(data.message); registButton.disabled = true; form.reset(); // Reload after 1.5 seconds setTimeout(() => { window.location.reload(); }, 1500) } else { notyf.error(data.message); } } catch (error) { notyf.error('An error occurred while saving changes. Please try again.'); } }); } }); document.addEventListener('DOMContentLoaded', () => { const bankInformationForm = document.getElementById('bankInformationForm'); if (bankInformationForm) { bankInformationForm.addEventListener('submit', async (event) => { event.preventDefault(); const formData = new FormData(bankInformationForm); const baseUrl = '<?= base_url(); ?>'; const csrfToken = formData.get('<?= $this->security->get_csrf_token_name(); ?>'); try { const response = await fetch(baseUrl + 'account/update_bank_information', { method: 'POST', headers: { 'X-Requested-With': 'XMLHttpRequest', 'X-CSRF-TOKEN': csrfToken, }, body: formData, }); if (!response.ok) { throw new Error('Network response was not ok'); } const data = await response.json(); if (data.status === 'success') { notyf.success(data.message); window.location.reload(); } else { notyf.error(data.message); } } catch (error) { notyf.error('An error occurred while saving changes. Please try again.'); console.error('Error:', error); } }); } else { console.error('Bank information form not found'); } const buttons = document.querySelectorAll('.btn-view-proof'); const modal = document.getElementById('proofModal'); const modalImage = document.getElementById('proofImage'); const modalClose = document.querySelector('.proof-modal-close'); buttons.forEach(button => { button.addEventListener('click', () => { const imageUrl = button.getAttribute('data-image'); modalImage.src = imageUrl; modal.style.display = 'block'; }); }); // Tutup modal saat tombol close diklik modalClose.addEventListener('click', () => { modal.style.display = 'none'; modalImage.src = ''; }); window.addEventListener('click', (event) => { if (event.target === modal) { modal.style.display = 'none'; modalImage.src = ''; } }); }); const table = document.getElementById('referred-table'); const headers = table.querySelectorAll('thead th'); const tbody = table.querySelector('tbody'); headers.forEach(header => { header.addEventListener('click', () => { const sortKey = header.getAttribute('data-sort'); const isAscending = header.classList.contains('sort-asc'); const direction = isAscending ? -1 : 1; const rows = Array.from(tbody.querySelectorAll('tr')); rows.sort((rowA, rowB) => { const cellA = rowA.querySelector(`td:nth-child(${header.cellIndex + 1})`).innerText; const cellB = rowB.querySelector(`td:nth-child(${header.cellIndex + 1})`).innerText; // Handle numeric and text sorting const valueA = isNaN(cellA.replace(/[^0-9.-]+/g, "")) ? cellA : parseFloat(cellA.replace(/[^0-9.-]+/g, "")); const valueB = isNaN(cellB.replace(/[^0-9.-]+/g, "")) ? cellB : parseFloat(cellB.replace(/[^0-9.-]+/g, "")); return valueA > valueB ? direction : valueA < valueB ? -direction : 0; }); // Remove all rows and append sorted rows tbody.innerHTML = ''; rows.forEach(row => tbody.appendChild(row)); // Reset classes and apply new sort direction headers.forEach(h => h.classList.remove('sort-asc', 'sort-desc')); header.classList.add(isAscending ? 'sort-desc' : 'sort-asc'); }); }); </script>