add new field in order reservation

This commit is contained in:
phyusin
2018-09-07 15:05:44 +06:30
parent 2789240fc9
commit 9fcbe6c27a
4 changed files with 17 additions and 8 deletions

View File

@@ -296,10 +296,6 @@ function show_order_detail(url,sr_no){
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
var newPickupDate = new Date(data.pickup_time);
var pickup_time = timeFormat(newPickupDate);
var pickup_datetime = getOrderMonth(newPickupDate.getMonth()) +' '+ (newPickupDate.getDate() >= 10? newPickupDate.getDate() : '0' + newPickupDate.getDate()) +', '+newPickupDate.getFullYear()+'('+getOrderDay(newPickupDate.getDay())+')'+' '+pickup_time;
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
// var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate);
@@ -311,6 +307,18 @@ function show_order_detail(url,sr_no){
$('#expected_time').text('');
}
if((data.pickup_time!=undefined) && (data.pickup_time!=null)){
var newPickupDate = new Date(data.pickup_time);
var pickup_time = timeFormat(newPickupDate);
var pickup_datetime = getOrderMonth(newPickupDate.getMonth()) +' '+ (newPickupDate.getDate() >= 10? newPickupDate.getDate() : '0' + newPickupDate.getDate()) +', '+newPickupDate.getFullYear()+'('+getOrderDay(newPickupDate.getDay())+')'+' '+pickup_time;
$('.pickup-time').show();
$('#pickup_time').text(pickup_datetime? pickup_datetime : '');
}else{
$('.pickup-time').hide();
$('#pickup_time').text('');
}
item_list.empty();
if(items!=undefined && items!=""){
@@ -365,7 +373,6 @@ function show_order_detail(url,sr_no){
address += ", (" +delivery.direction_address+")";
}
$('#requested_time').text(requested_date);
$('#pickup_time').text(pickup_datetime);
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);

View File

@@ -1,7 +1,7 @@
if @order
json.(@order, :order_reservation_id,:order_reservation_type,:customer_id,
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:requested_time,:pickup_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:remark,:sale_id)

View File

@@ -430,7 +430,7 @@
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<td colspan="2" class="body-td align-left pickup-time">
<span class="font-13">PICK-UP TIME</span><br>
<b id="pickup_time"></b>
</td>

View File

@@ -4,7 +4,8 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.string :order_reservation_id, :limit => 16, :primary_key => true
t.string :order_reservation_type, :null => false
t.string :customer_id, :null => false
t.datetime :requested_time, :null => false
t.datetime :requested_time, :null => false
t.datetime :pickup_time, :null => false
t.string :callback_url, :null => false
t.string :transaction_ref, :null => false
t.string :sale_id
@@ -23,6 +24,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.string :status, :null => false, :default => "new"
t.string :order_remark
t.string :remark
t.json :action_times
t.timestamps
end
end