<div class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-midnightblue">
<div class="panel-heading">
<h4>Order Detail (#<?php echo $order_id ?>)</h4>
</div>
<div class="panel-body">
<?php
$this->load->view("admin/messages");
?>
<div class="row">
<div class="col-md-12">
<?php
$this->common_lib->render_modal_window("Edit Shipping Address","order_shipping_form");
$this->common_lib->render_modal_window("Edit Item","edit_item_form");
$this->common_lib->render_modal_window("Add Item","add_item_form");
?>
<script type="text/javascript">
$(function(){
$(document).on("click",".order_shipping_form",function(e){
e.preventDefault();
var uid = $(this).data('id');
$.getJSON('<?php echo site_url("admin/ajax/order_shipping_form") ?>',{token:uid}, function(response){
$('#order_shipping_form').modal('show', {backdrop: 'static'});
$('#order_shipping_form .modal-body').html(response.html);
});
});
$(document).on("click",".edit_item_link",function(e){
e.preventDefault();
var uid = $(this).data('id');
$.getJSON('<?php echo site_url("admin/ajax/item_edit_layout") ?>',{token:uid}, function(response){
$('#edit_item_form').modal('show', {backdrop: 'static'});
$('#edit_item_form .modal-body').html(response.html);
});
});
$(document).on("click","#add_new_order_item",function(e){
e.preventDefault();
var uid = $("#oid").val();
$.getJSON('<?php echo site_url("admin/ajax/add_order_item_form") ?>',{token:uid}, function(response){
$('#add_item_form').modal('show', {backdrop: 'static'});
$('#add_item_form .modal-body').html(response.html);
});
});
$(".change_order_status").on("click",function(){
var orderObj = $(this);
bootbox.confirm("Do you also want to change order item(s) status to <b>" + $(this).text() + "?</b>", function(result) {
$.post("<?php echo site_url("admin/ajax/change_order_status") ?>",{token:$("#oid").val(),os:orderObj.data("status"),mode:result},function(response){
window.location.reload();
});
});
return false;
});
});
</script>
<input type="hidden" id="oid" value="<?php echo $this->common_lib->encode($order_id) ?>" />
<a href="#" class="btn btn-default order_shipments">Order Detail</a>
<a href="<?php echo site_url("admin/reports/shipments/$order_id") ?>" class="btn btn-primary order_shipments">Add Shipments</a>
<div class="btn-group">
<button type="button" class="btn btn-success">Change Order Status </button>
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("A")?>">Approved</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("C")?>">Cancelled</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("D")?>">Done</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("I")?>">InProcess/Packaging</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("K")?>">Packed</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("L")?>">Delivered</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("P")?>">Pending</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("R")?>">Ready for Shipment</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("S")?>">Shipped</a></li>
<li><a class="change_order_status" href="#" data-status="<?php echo $this->common_lib->encode("X")?>">Deleted</a></li>
</ul>
</div>
<b>Current Status:</b> <code><?php echo $this->common_lib->get_status_detail($order_data[0]->order_status); ?></code>
<h2>Order Number: #<?php echo $order_id?></h2>
<h3><?php echo $this->common_lib->date_detail_format($order_data[0]->order_date,false) ?></h3>
<div class="table-wrapper-responsive">
<table summary="Order Detail" class="table table-condensed">
<tr>
<th>Actions</th>
<th colspan="2" class="goods-page-description goods-page-image">Item Detail</th>
<th class="goods-page-quantity text-right">Quantity</th>
<th class="goods-page-quantity text-right">Qty Shipped</th>
<th class="goods-page-quantity text-right">Qty Remaining</th>
<th class="goods-page-quantity text-right">Qty. OH.</th>
<th class="goods-page-price text-right">Unit price</th>
<th class="goods-page-quantity text-right">Printing Price</th>
<th class="goods-page-quantity text-right">Shipping Price</th>
<!--th style="width: 150px;" class="goods-page-quantity text-right">Choose Seller</th-->
<th class="goods-page-total text-right">Total</th>
</tr>
<?php
$this->load->model("commonm");
$sellers = $this->commonm->get_all("sellers");
foreach($order_item_data as $items){
$product_id = $items->product_id;
$product_detail = $this->common_lib->get_product_detail($items->product_id);
$product_detail = $product_detail[0];
$size_detail = "";
if($items->size_id > 0){
$size_detail = $this->commonm->get_all("sizes",array("size_id"=>$items->size_id));
if(count($size_detail) > 0){
$size_detail = $size_detail[0]->size;
}
}
?>
<tr id="<?php $items->order_item_id ?>" class="<?php echo $this->common_lib->get_status_class($items->item_status) ?>">
<td style="width:100px;">
<div class="margin-btm"><code><?php echo $this->common_lib->get_status_detail($items->item_status); ?></code></div>
<?php
if(true || !in_array($items->item_status,$this->config->item("hide_edit_item_status"))){
?>
<button type="button" class="btn btn-danger btn-sm btn-block edit_item_link" data-id="<?php echo $this->common_lib->encode($items->order_item_id) ?>">Edit Item</button>
<?php
}
?>
</td>
<td class="goods-page-image" style="width:80px;">
<a target="_blank" href="<?php echo $this->common_lib->get_product_detail_url($product_detail)?>">
<img width="75" src="<?php echo $this->common_lib->get_product_image($product_detail,'small') ?>" alt="<?php echo $product_detail->product_name ?>" />
</a>
</td>
<td class="goods-page-description">
<a target="_blank" href="<?php echo $this->common_lib->get_product_detail_url($product_detail)?>"><?php echo $product_detail->product_name ?></a>
<div><strong>Size: </strong><?php echo $size_detail ?></div>
<div><strong>Item Code: </strong><?php echo $product_detail->sku?></div>
<?php
$general_settings = $this->common_lib->get_product_setting("show_required_date",true);
if($general_settings->show_required_date == 1){
?>
<div><strong>Required Date: </strong> <code><?php echo $items->date_required?></code></div>
<div><strong>Performance Date: </strong> <code><?php echo $items->performance_date?></code></div>
<div><strong>Promising Date: </strong> <code><?php echo $items->promising_date?></code></div>
<?php
}
?>
</td>
<td class="goods-page-quantity text-right">
<div class="product-quantity"><?php echo $items->quantity ?></div>
</td>
<td class="goods-page-quantity text-right">
<div class="product-quantity"><?php echo $items->qty_shipped ?></div>
</td>
<td class="goods-page-quantity text-right">
<div class="product-quantity"><?php echo $items->qty_remaining ?></div>
</td>
<td class="goods-page-quantity text-right">
<div class="product-quantity"><?php echo $items->size_available ?></div>
</td>
<!--td class="goods-page-quantity text-right">
<?php
echo $this->common_lib->render_dropdown($sellers,"seller_id","first_name","sellers");
?>
</td-->
<td class="goods-page-price text-right">
<strong><?php echo $this->common_lib->currency_price($items->price) ?></strong>
</td>
<td class="goods-page-price text-right">
<strong><?php echo $this->common_lib->currency_price($items->product_print_price) ?></strong>
</td>
<td class="goods-page-price text-right">
<strong><?php echo $this->common_lib->currency_price($items->product_shipp_price) ?></strong>
</td>
<td class="goods-page-total text-right">
<strong><?php echo $this->common_lib->currency_price($items->price * $items->quantity + $items->product_shipp_price + $items->product_print_price)?></strong>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="11">
<button class="btn btn-success" type="button" id="add_new_order_item">Add New Item</button>
</td>
</tr>
<tr>
<td rowspan="5" colspan="8">
<div><label><input type="radio" name="order_type" value="online" checked=""> Online Order</label></div>
<div><label><input type="radio" name="order_type" value="telephone"> Telephone Order</label></div>
<div><label><input type="radio" name="order_type" value="fax"> Fax Order</label></div>
<div><label><input type="radio" name="order_type" value="regular"> Regular Order</label></div>
<div><label><input type="radio" name="order_type" value="email"> Email Order</label></div>
</td>
<td colspan="2" class="text-right">SUB TOTAL</td>
<td class="text-right"><?php echo $this->common_lib->currency_price($order_data[0]->sub_total)?></td>
</tr>
<tr>
<td colspan="2" class="text-right">SHIPPING</td>
<td class="text-right"><?php echo $this->common_lib->currency_price($order_data[0]->shipping)?></td>
</tr>
<tr>
<td colspan="2" class="text-right">PROMO DISCOUNT</td>
<td class="text-right"><?php echo $this->common_lib->currency_price($order_data[0]->promo_discount)?></td>
</tr>
<tr>
<td colspan="2" class="text-right">TOTAL</td>
<td class="text-right"><?php echo $this->common_lib->currency_price($order_data[0]->order_amount)?></td>
</tr>
<tr>
<td colspan="2" class="text-right">AMOUNT REMAINING</td>
<td class="text-right"><?php echo $this->common_lib->currency_price($order_data[0]->amount_remaining)?></td>
</tr>
<tr>
<td colspan="3">
<div class="well">
<h4>Personal Detail</h4>
<div class="login_user_name"><b><?php echo $user_detail[0]->first_name." ".$user_detail[0]->last_name ?></b></div>
<div class="login_user_address"><i><?php echo $user_detail[0]->address ?></i></div>
<div class="login_user_address"><i><?php echo $user_detail[0]->address1 ?></i></div>
<div class="login_user_address"><i><?php echo $user_detail[0]->city ?>, <?php echo $user_detail[0]->state ?> - <?php echo $this->common_lib->get_country_by_id($user_detail[0]->country) ?>, <?php echo $user_detail[0]->zipcode ?></i></div>
<div class="login_user_phone"><b>Ph:</b> <?php echo $user_detail[0]->mobile ?></div>
<div class="login_user_phone"><b>Email:</b> <?php echo $user_detail[0]->email ?></div>
</div>
</td>
<td colspan="4"></td>
<td colspan="3" class="text-right">
<div class="well" id="order_shipping_address">
<h4>Delivery Detail</h4>
<div class="login_user_name"><b><?php echo $order_data[0]->ship_first_name." ".$order_data[0]->ship_last_name ?></b></div>
<div class="login_user_address"><i><?php echo $order_data[0]->ship_address ?></i></div>
<div class="login_user_address"><i><?php echo $order_data[0]->ship_address1 ?></i></div>
<div class="login_user_address"><i><?php echo $order_data[0]->ship_city ?>, <?php echo $order_data[0]->ship_state ?> - <?php echo $this->common_lib->get_country_by_id($order_data[0]->ship_country) ?>, <?php echo $order_data[0]->ship_zipcode ?></i></div>
<div class="login_user_phone"><b>Ph:</b> <?php echo $order_data[0]->ship_mobile ?></div>
<a href="#order_shipping_form" data-id="<?php echo $this->common_lib->encode($order_data[0]->order_id) ?>" type="button" class="btn btn-danger btn-sm order_shipping_form" >Edit Address</a>
</div>
</td>
</tr>
<tr>
<td colspan="10">
<div class="form-group">
<div class="table-responsive">
<h3><strong>Order Notes</strong></h3>
<div class="notes_wrapper">
<table class="table table-condensed">
<tbody>
<?php
foreach($order_notes as $notes){
?>
<tr>
<td>
<span class="date"><?php echo $this->common_lib->date_detail_format($notes->added_date,false) ?></span>
<p><strong><?php echo $notes->notes ?></strong></p>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<form class="form-inline1">
<div class="col-lg-6">
<input type="text" class="form-control col-lg-12" id="order_notes" />
</div>
<input type="button" class="btn btn-primary" data-loading-text="Saving..." value="Save Notes" id="save_notes" />
</form>
<script type="text/javascript">
$(function(){
$("#save_notes").on("click",function(){
$("#error_box").slideUp().html("");
var clicker = $(this);
clicker.button('loading');
$.getJSON("<?php echo site_url("admin/ajax/save_order_notes") ?>",{token:$("#oid").val(),notes:$("#order_notes").val()},function(response){
clicker.button('reset');
if(response.error != undefined){
$("#error_box").html(response.error);
pNotify('Error',response.error,'error');
}
if(response.message != undefined){
pNotify('Success',response.message,'success');
}
if(response.html != undefined){
$(".notes_wrapper table tbody").append(response.html);
$("#order_notes").val("");
}
});
});
})
</script>
</div>
</td>
</tr>
</table>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@KyuuKazami