update add order for popup qty

This commit is contained in:
Aung Myo
2017-11-16 14:23:51 +06:30
parent d107577ea7
commit 6360a914b4
6 changed files with 94 additions and 29 deletions

View File

@@ -339,13 +339,14 @@ $(function(){
$(".sx_item_set_detailModal").css({ 'display': "none" });
}else{
$(".sx_item_set_detailModal").css({ 'display': "block" });
$.alert({
title: 'Alert!',
content: 'Please Select Minimum ' + min_qty + " items",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal("Alert !", 'Please Select Minimum ' + min_qty + " items", "warning");
// $.alert({
// title: 'Alert!',
// content: 'Please Select Minimum ' + min_qty + " items",
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}
}); //End add order Click
@@ -420,7 +421,7 @@ $(function(){
for(var field in attributes) {
value = attributes[field]["values"];
type = attributes[field]["type"]
row = "<h4>"+attributes[field]["type"]+"</h4>";
row = "<h5>"+attributes[field]["type"]+"</h5>";
$(value).each(function(i){
disabled = ""
@@ -794,11 +795,10 @@ $(function(){
// Get Selected Class
function change_qty_plus_minus(id,plus,minus) {
var count = 1;
var count = parseInt($('#'+id).val())
var countEl = document.getElementById(id);
$('#'+plus).on("click", function(){
count++;
countEl.value = count;
@@ -852,6 +852,37 @@ $(function(){
}
})
}
$('.keypress_qty').keyup(function(e){
id = $(this).attr('id');
value = $(this).val();
if (id=="count") {
price = $("#unit_price").text();
$("#total_price").text(value*price);
}else{
var item_row = $('.selected-instance');
price = $("#set_unit_price").text();
set_total_price = $("#set_total_price").text();
$("#set_count").val(value);
if (item_row.length > 1) {
total = 0 ;
$(item_row).each(function(i){
total += value * $(item_row[i]).attr('data-price');
total_price = total;
});
}else{
total_price = value*price;
}
$("#set_total_price").text(total_price);
}
});
/* $("input").keypress(function(){
$("span").text(i += 1);
});*/
// $("#set_change_qty").change(function(){
// qty = $(this).val();
// price = $("#set_total_price").text();

View File

@@ -152,6 +152,6 @@ section.content{
}
#count {
#count ,#set_count{
text-align: center;
}

View File

@@ -77,12 +77,12 @@
<span><%= t :transactions %></span>
</a>
<ul class="ml-menu">
<% if can? :menage, Booking %>
<% if can? :menage, Booking %>
<li>
<a href="<%= transactions_bookings_path %>"><%= t :bookings %></a>
</li>
<% end %>
<% if can? :menage, Order %>
<% if can? :menage, Order %>
<li>
<a href="<%= transactions_orders_path %>"><%= t :orders %></a>
</li>
@@ -97,6 +97,11 @@
<a href="<%= transactions_credit_notes_path %>"><%= (t :credit) %></a>
</li>
<% end %>
<% if can? :menage, Sale %>
<li>
<a href="<%= transactions_shift_sales_path %>"><%= (t :shiftsale) %></a>
</li>
<% end %>
</ul>
</li>
<li>

View File

@@ -33,7 +33,7 @@
<br>
<div class="card-header">
<div>
<strong id="order-title">ORDER DETAILS </strong>| Table<%=@table.name%>
<strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
@@ -98,8 +98,16 @@
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal" id="save">Update</button>
<div class="row">
<div class="col-md-5">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-primary " data-dismiss="modal" id="save">Update</button>
</div>
</div>
</div>
</div>
</div>
@@ -110,7 +118,7 @@
<div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
@@ -131,7 +139,7 @@
</button>
</span>
<input type="text" value="1" id="count" class="change_qty form-control col-md-12 ">
<input type="number" value="1" id="count" class="change_qty keypress_qty form-control col-md-12 ">
<span class="input-group-btn">
<button type="button" class="btn btn-success btn-number" value="+" id="plus">
<i class="material-icons">add</i>
@@ -147,13 +155,15 @@
<p class="hidden" id="item_code"></p>
</div>
<div class="col-md-7 item-detail">
<strong style="font-size: 18px;">Attributes</strong>
<h5>Attributes</h5>
<div class="attributes-list">
</div>
<strong style="font-size: 18px;">Options</strong>
<hr>
<h5>Options</h5>
<div class="options-list">
</div>
<hr>
</div>
</div>
</div>
@@ -161,8 +171,18 @@
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="total_price"></span></h4>
</div>
<button type="button" class="btn btn-primary m-r-20" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success add_to_order m-r-10" data-dismiss="modal" id="add_to_order">Add to Order</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary add_to_order " data-dismiss="modal" id="add_to_order">Add to Order</button>
</div>
</div>
</div>
</div>
</div>
@@ -173,7 +193,7 @@
<div class=" modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
<div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
@@ -193,7 +213,7 @@
<i class="material-icons">remove</i>
</button>
</span>
<input type="text" value="1" id="set_count" class="set_change_qty form-control col-md-12 ">
<input type="number" value="1" id="set_count" class="set_change_qty keypress_qty form-control col-md-12 ">
<span class="input-group-btn">
<button type="button" class="btn btn-success btn-number" value="+" id="set_plus">
<i class="material-icons">add</i>
@@ -222,8 +242,17 @@
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
</div>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success set_order" data-dismiss="modal" id="set_order">Add to Order</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div>
</div>
</div>
</div>
</div>

View File

@@ -6,7 +6,7 @@
<div class="form-inputs p-l-15">
<%= f.input :name %>
<%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %>
<%= f.input :emp_id, :as => :integer, :label => "Employee Numberic ID (*Unique)" %>
<%= f.input :emp_id, :label => "Employee Numberic ID (*Unique)" %>
<%= f.input :password %>
</div>

View File

@@ -10,7 +10,7 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-box-body clearfix p-l-5 p-r-5">
<div class="table-responsive">
<!-- <div class="table-responsive">
<table class="table table-">
<tbody>
<tr>
@@ -40,7 +40,7 @@
</tr>
</tbody>
</table>
</div>
</div> -->
<div class="card">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">