|
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 : |
<div class="banner" style="padding-top: 10px;"></div>
<div class="container margin_top_48px margin_bottom_48px">
<div class="row" style="padding-bottom:50px;">
<div class="col-sm-2 order-sm-1 order-2" style="border-right:1px solid #ccc;">
<?= Modules::run('myaccount_menu'); ?>
</div><!-- end col-sm-2-->
<div class="col-sm-10 order-sm-2 order-1">
<h4><?= strtoupper(lang('my_order_history')); ?></h4>
<?= $this->session->flashdata('success'); //to display success message
?>
<div class="table-responsive orderHistory hidden-xs-down">
<table class="table table-striped">
<thead>
<tr>
<th><?= ucwords(lang('order_no')); ?></th>
<th><?= ucwords(lang('order_date')); ?></th>
<th><?= ucwords(lang('recipient')); ?></th>
<th>Total</th>
<th>
<?php
$reseller_id = $this->db->select('reseller_id')->from('customers')->where('id_customers', $this->session->userdata('customer')['customer_id'])->get()->row()->reseller_id;
if ($reseller_id == NULL) : ?>
<?php else : ?>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search item..." id="itemSearchInput" oninput="searchItems()">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="itemSearchButton">
<i class="fa fa-search"></i>
</button>
</div>
</div>
<?php endif; ?>
<?= ucwords(lang('item_details')); ?>
</th>
<th>Status Order</th>
</tr>
</thead>
<?php foreach ($order_history as $item) : ?>
<?php
$order_id = $item->id_orders;
$this->db->select('*');
$this->db->from('orders_detail');
$this->db->where('orders_id', $order_id);
$query = $this->db->get();
$orders_detail = $query->result();
$isFullyPaid = false;
$isReadyToSend = false;
$thisHasIndent = false;
$firstPayment = 0;
$secondPayment = 0;
$indent_dp = 0;
foreach ($orders_detail as $key) {
if ($key->indent_message != null) {
$thisHasIndent = true;
$firstPayment = 0;
}
if ($key->status == 1) {
$isReadyToSend = true;
}
if ($key->status == 3) {
$isFullyPaid = true;
}
}
?>
<!-- Form Start -->
<?php echo form_open('account/payment_confirmation'); ?>
<input type="hidden" name="order_id" value="<?= $item->id_orders; ?>">
<tr>
<td style="padding:3px;"><?= $item->id_orders; ?></td>
<td style="padding:3px;">
<?php
$order_date = strtotime($item->order_date);
$new_date = date('j/m/Y', $order_date);
echo $new_date;
?>
</td>
<td>
<?php if ($item->recipient_name != null) : ?>
<?= ucwords($item->recipient_name); ?><br>
<?php endif; ?>
<?= ucwords($item->address); ?><br>
<?= ucwords($item->district); ?>, <?= ucwords($item->subdistrict); ?><br><?= ucwords($item->province); ?> <?= ucwords($item->postcode); ?>
</td>
<td style="padding:3px;">
<?php
$final_grand_total = 0;
$finalshippingfee = 0;
$calculate_finalshippingfee = $item->shipping_fee - $item->free_shipping_fee;
if ($calculate_finalshippingfee > 0) {
$finalshippingfee = $calculate_finalshippingfee;
}
// if ($item->first == 1) {
// if ($item->order_date >= '2024-08-01') {
// if (empty($item->referral)) {
// $first_discount = $item->total_amount * 0.05;
// } else {
// $first_discount = $item->total_amount * 0.1;
// }
// } else {
// $first_discount = $item->total_amount * 0.05;
// }
// }
$first_discount = 0; // Inisialisasi diskon pertama
$disc_first = 0.05;
$referral = $item->referral; // Ambil referral dari order
// Cek kategori affiliator berdasarkan referral
$affiliator = $this->db->select('kategori')
->from('affiliator_register')
->where('referral', $referral) // Pastikan kolom ini sesuai dengan database
->get()
->row();
if ($item->first == 1) { // Jika ini adalah pembelian pertama
if ($item->order_date >= '2024-08-01') {
if (!empty($referral)) {
// Cek kategori affiliator jika ditemukan
if ($affiliator) {
switch ($affiliator->kategori) {
case 'asmaradoor':
$disc_first = 0.10; // Diskon 10% untuk asmaradoor
break;
case 'asmarasana':
$disc_first = 0.05; // Diskon 5% untuk asmarasana
break;
}
}
}
// Hitung diskon pertama berdasarkan total_amount
$first_discount = $item->total_amount * $disc_first;
} else {
// Diskon default 5% untuk order sebelum 2024-08-01
$first_discount = $item->total_amount * 0.05;
}
}
$grand_total = ($item->total_amount - $item->redeemed_voucher_amount - $item->minus_reward_amount - $first_discount) + ($finalshippingfee);
if ($grand_total > 0) {
$final_grand_total = $grand_total;
}
echo "<p style='margin-top: 10px;'>";
echo "Rp " . number_format($final_grand_total);
foreach ($orders_detail as $key) {
if ($key->indent_message != null) {
$indent_dp = ($key->quantity * $key->item_price) * ($key->dp_percentage / 100);
}
}
$firstPayment = ($item->total_amount - $item->redeemed_voucher_amount - $item->minus_reward_amount) - $indent_dp;
$secondPayment = $item->indent_remaining + $item->indent_shipping_fee;
if ($thisHasIndent == true) {
echo '<br><br>Pembayaran ke-1 : <br>';
echo 'Rp ' . number_format($firstPayment);
echo '<br>Pembayaran ke-2 : <br>';
echo 'Rp ' . number_format($secondPayment);
}
if ($final_grand_total == 0) {
echo " (Free Order)";
}
echo "</p>";
?>
</td>
<td>
<?php foreach ($orders_detail as $order_detail) :
if ($key->indent_message != null) {
$indent_dp = ($order_detail->quantity * $order_detail->item_price) * ($order_detail->dp_percentage / 100);
}
?>
<p><?= $order_detail->item_name; ?> <?= $order_detail->quantity; ?> pcs <br>@Rp <?= number_format($order_detail->item_price); ?>
<?php
if ($order_detail->indent_message != null) {
?>
<?= "<br><small>Indent DP Rp " . number_format($indent_dp) . "</small>"; ?>
<?php } ?>
</p>
<?php endforeach; ?>
<?php
$sub_totalIndent_Remaining = 0;
foreach ($orders_detail as $key) {
if ($key->status == 1) {
$isReadyToSend = true;
if ($key->indent_message != null) {
// echo "<br>";
// echo "Ready to send<br>";
echo "<small>
Indent Sisa: <br>
IDR " . number_format(($key->item_price * ($key->dp_percentage) / 100)) . "<br>
Indent Ongkos Kirim: <br>
IDR " . number_format($key->shipping_fee) . "
</small>";
}
$sub_totalIndent_Remaining += (($key->item_price * $key->quantity) * ($key->dp_percentage) / 100) + $key->shipping_fee;
}
}
if ($thisHasIndent == true && $isReadyToSend == true && $isFullyPaid != true) {
echo "<br><br><small>Sisa Total: <br>
IDR " . number_format($sub_totalIndent_Remaining) . "</small><br>";
}
?>
</td>
<td>
<!-- tes_ID:(<?= $item->payment_status; ?>)<br> -->
<?php if ($item->payment_status == 0) : ?>
<?= ucwords(lang('pending')); ?>
<?php endif; ?>
<?php if ($item->payment_status == 1) : ?>
<?= ucwords(lang('status_paid_no')); ?>
<?php if ($item->payment_confirm == 0) : ?>
<br><input type="submit" name="confirm_payment" value="<?= strtoupper(lang('confirm')); ?>" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px; ">
<?php else : ?>
<br><input type="submit" name="confirm_payment" value="<?= strtoupper(lang('already_confirm')); ?>" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;">
<?php endif; ?>
<?php elseif ($item->payment_status == 3) : ?>
<?= ucwords(lang('status_paid_yes')); ?>
<?php elseif ($item->payment_status == 4) : ?>
<?php
if ($isReadyToSend == true && $isFullyPaid != true) {
echo "Ready to send<br>";
if ($thisHasIndent == true && $item->payment_confirm_remaining == 0) {
echo '<input type="submit" name="confirm_payment" value="' . strtoupper('Konfirmasi') . '" style="background:' . $primary_colortheme . '; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;">';
} else {
if ($thisHasIndent == true) {
echo '<input type="submit" name="confirm_payment" value="' . strtoupper('Sudah Konfirmasi') . '" style="background:' . $primary_colortheme . '; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;">';
}
}
} else if ($isFullyPaid == true) {
?> <?= ucwords(lang('ready')); ?>
<?php
} else {
?> <?= ucwords(lang('proses_status')); ?> <?php
}
?>
<!-- <br><input type="submit" name="confirm_payment" value="<?= strtoupper(lang('confirm')); ?>" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;"> -->
<?php elseif (($item->payment_status == 5)) : ?>
<?= ucwords(lang('sent')); ?> <br>
<?php
$reseller_id = $this->db->select('reseller_id')->from('customers')->where('id_customers', $this->session->userdata('customer')['customer_id'])->get()->row()->reseller_id;
if ($reseller_id == NULL) : ?>
<?php else : ?>
<a href="#" class="open-modal-button" data-toggle="modal" data-target="#terimaPesananModal<?= $item->id_orders; ?>" data-order-id="<?= $item->id_orders; ?>" data-order-content="<?= htmlspecialchars(json_encode($orderContentArray[$item->id_orders])); ?>" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;" type="submit">
<?= ucwords(lang('finishyourorder')); ?>
</a>
<br><br>
<a href="#" class="open-modal-button" data-toggle="modal" data-target="#komplainPesananModal<?= $item->id_orders; ?>" data-order-id="<?= $item->id_orders; ?>" data-order-content="<?= htmlspecialchars(json_encode($orderContentArray[$item->id_orders])); ?>" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px;" type="submit">
<?= ucwords(lang('complaintbtn')); ?>
</a>
<?php endif; ?>
<?php elseif (($item->payment_status == 8)) : ?>
<?= ucwords(lang('done')); ?>
<a href="<?= base_url() . 'Account/generate_invoice/' . $item->id_orders; ?>" target="_blank" style="background:<?= $primary_colortheme; ?>; color:white; cursor: pointer; border:none; padding:2px; padding-left:5px; padding-right:5px; " type="submit">
Print Invoice
</a><br>
<?php elseif ($item->payment_status == 2) : ?>
<?= ucwords(lang('cancel')); ?>
<?php elseif ($item->payment_status == 9) : ?>
<?= ucwords(lang('complaint')); ?>
<br> <br>
<?= ucwords(lang('complaintdescstatus')); ?> <?= number_format($item->creditclaimamount); ?>
<?php elseif ($item->payment_status == 6) : ?>
<?= ucwords(lang('part_paid')); ?>
<?php endif; ?>
</td>
</tr>
<?php echo form_close(); ?>
<?php endforeach; ?>
</table>
</div><!-- end class="table-responsive" -->
</div><!-- end col-sm-8-->
</div><!-- end row-->
</div><!-- end container -->
<!-- Modal Start -->
<?php foreach ($order_history as $item) : ?>
<?php
// Ambil detail pesanan untuk item saat ini
$this->db->select('*');
$this->db->from('orders_detail');
$this->db->where('orders_id', $item->id_orders);
$query = $this->db->get();
$orders_detail = $query->result();
?>
<div class="modal fade" id="terimaPesananModal<?= $item->id_orders; ?>" tabindex="-1" role="dialog" aria-labelledby="terimaPesananModalLabel<?= $item->id_orders; ?>" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="terimaPesananModalLabel<?= $item->id_orders; ?>"><?= ucwords(lang('finishyourorder')); ?> #<?= $item->id_orders; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<strong>
<p><?= ucwords(lang('finishyourorderdesc')); ?></p>
</strong>
<table class="table">
<thead>
<tr>
<th>Item Name</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php foreach ($orders_detail as $order_detail) : ?>
<tr>
<td><?= $order_detail->item_name; ?></td>
<td><?= $order_detail->quantity; ?> pcs</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="modal-footer">
<?php echo form_open('account/ubah_status_pesanan'); ?>
<input type="hidden" name="orderID" id="orderID<?= $item->id_orders; ?>" value="<?= $item->id_orders; ?>">
<input type="hidden" name="new_status" value="8"> <!-- Status baru untuk pesanan selesai -->
<button type="submit" onclick="return confirm('Apakah Anda yakin ingin menyelesaikan pesanan ini?')"><?= ucwords(lang('finishyourorder')); ?></button>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php foreach ($order_history as $item) : ?>
<?php
// Ambil detail pesanan untuk item saat ini
$this->db->select('*');
$this->db->from('orders_detail');
$this->db->where('orders_id', $item->id_orders);
$query = $this->db->get();
$orders_detail = $query->result();
?>
<div class="modal fade" id="komplainPesananModal<?= $item->id_orders; ?>" tabindex="-1" role="dialog" aria-labelledby="terimaPesananModalLabel<?= $item->id_orders; ?>" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="terimaPesananModalLabel<?= $item->id_orders; ?>"><?= ucwords(lang('complaintbtn')); ?> #<?= $item->id_orders; ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php echo form_open_multipart('account/komplain_pesanan'); ?>
<div class="modal-body">
<strong>
<p><?= ucwords(lang('complaindesc')); ?></p>
</strong>
<table class="table">
<thead>
<tr>
<th>Item Name</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<?php foreach ($orders_detail as $order_detail) : ?>
<tr>
<td><?= $order_detail->item_name; ?></td>
<td>
<input class="form-control" type="number" name="quantity[<?= $order_detail->id_orders_detail; ?>]" value="<?= $order_detail->quantity; ?>" min="1">
<input class="form-control" type="hidden" name="item_price[<?= $order_detail->id_orders_detail; ?>]" value="<?= $order_detail->item_price; ?>">
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<label for="linkclaim">Link Video Unboxing:</label>
<input required class="form-control" type="text" name="linkclaim" placeholder="<?= ucwords(lang('complaintdescplaceholder')); ?>">
<p><?= ucwords(lang('complaintdescupload')); ?></p>
<input type="hidden" name="orderID" value="<?= $item->id_orders; ?>">
<input type="hidden" name="new_status" value="9">
</div>
<div class="modal-footer">
<button type="submit" onclick="return confirm('Apakah Anda yakin ingin komplain pesanan ini?')"><?= ucwords(lang('complaintbtn')); ?></button>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
<?php endforeach; ?>
<!-- Modal End -->
<script>
var modals = document.querySelectorAll(".modal");
var modalTitle = document.querySelectorAll(".modal-title");
var btns = document.querySelectorAll(".open-modal-button");
var span = document.querySelectorAll(".close");
for (var i = 0; i < btns.length; i++) {
btns[i].addEventListener("click", function() {
var orderId = this.getAttribute("data-order-id");
var modalId = "terimaPesananModal" + orderId;
var modal = document.getElementById(modalId);
for (var j = 0; j < modals.length; j++) {
modals[j].style.display = "none";
}
modal.style.display = "block";
});
}
for (var i = 0; i < span.length; i++) {
span[i].addEventListener("click", function() {
for (var j = 0; j < modals.length; j++) {
modals[j].style.display = "none";
}
});
}
window.addEventListener("click", function(event) {
for (var i = 0; i < modals.length; i++) {
if (event.target == modals[i]) {
modals[i].style.display = "none";
}
}
});
</script>
<script>
function searchItems() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("itemSearchInput");
filter = input.value.toUpperCase();
table = document.querySelector(".table");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[4]; // Assuming the "Item Details" column is at index 4
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>