update conflicx reset.css
This commit is contained in:
@@ -213,5 +213,12 @@ section.content {
|
|||||||
.m-t-7{
|
.m-t-7{
|
||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FORM */
|
||||||
|
.input-group-addon {
|
||||||
|
padding: 0rem 0rem;
|
||||||
|
}
|
||||||
|
/* END FORM */
|
||||||
|
|
||||||
/* End Reset Theme */
|
/* End Reset Theme */
|
||||||
/* *************************************************** */
|
/* *************************************************** */
|
||||||
@@ -1,42 +1,15 @@
|
|||||||
class SeedGenerator < ApplicationRecord
|
class SeedGenerator < ApplicationRecord
|
||||||
# Generate ID for Tables
|
# Generate ID for Tables
|
||||||
def self.generate_id(model, prefix)
|
def self.generate_id(model, prefix)
|
||||||
seed = SeedGenerator.find_by_model(model)
|
cur_val, next_val = self.update_seed(model)
|
||||||
new_receipt_no = 0
|
|
||||||
|
|
||||||
if (seed.nil?)
|
if (cur_val == 0)
|
||||||
seed = SeedGenerator.new()
|
cur_val, next_val = self.execute_query(model)
|
||||||
seed.model = model
|
end
|
||||||
new_receipt_no = seed.next
|
|
||||||
seed.save
|
|
||||||
else
|
|
||||||
next_no = seed.next
|
|
||||||
current_no = seed.next
|
|
||||||
seed.next = seed.next + seed.increase_by
|
|
||||||
seed.current = current_no
|
|
||||||
seed.save
|
|
||||||
# cur_val, next_val = self.update_seed(model, seed.next, seed.increase_by)
|
|
||||||
|
|
||||||
# if next_no == cur_val
|
|
||||||
# puts "SSS"
|
|
||||||
# puts next_val
|
|
||||||
# cur_val2, next_val2 = self.update_seed(model, next_val, seed.increase_by)
|
|
||||||
# puts next_val2
|
|
||||||
# padding_len = 15 - prefix.length
|
|
||||||
# saleOrderId = prefix +"-"+ cur_val2.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
|
||||||
# puts saleOrderId
|
|
||||||
# return saleOrderId
|
|
||||||
# end
|
|
||||||
|
|
||||||
# padding_len = 15 - prefix.length
|
|
||||||
# saleOrderId = prefix +"-"+ cur_val.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
|
||||||
# return saleOrderId
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
padding_len = 15 - prefix.length
|
padding_len = 15 - prefix.length
|
||||||
saleOrderId = prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
saleOrderId = prefix +"-"+ cur_val.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||||
return saleOrderId
|
return saleOrderId
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate Receipt No
|
# Generate Receipt No
|
||||||
@@ -88,22 +61,41 @@ class SeedGenerator < ApplicationRecord
|
|||||||
return next_code
|
return next_code
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.update_seed(model, current, inc)
|
def self.execute_query(model)
|
||||||
cur_val = 0
|
current = 0
|
||||||
next_val = 0
|
nex = 0
|
||||||
nex = current + inc
|
|
||||||
|
sql = "INSERT INTO seed_generators (model, created_at, updated_at)
|
||||||
|
VALUES('#{ model }', NOW(), NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE current = current + 1, next = next + 1;"
|
||||||
|
|
||||||
update_sql = "update seed_generators set current= #{current}, next= #{nex} where model='#{model}';";
|
select_sql = "select * from seed_generators where model='#{model}';"
|
||||||
|
ActiveRecord::Base.connection.execute(sql);
|
||||||
|
select_result = ActiveRecord::Base.connection.execute(select_sql);
|
||||||
|
|
||||||
|
select_result.each do |row|
|
||||||
|
current = row [3]
|
||||||
|
nex = row[4]
|
||||||
|
end
|
||||||
|
|
||||||
|
return current, nex
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.update_seed(model)
|
||||||
|
current = 0
|
||||||
|
nex = 0
|
||||||
|
|
||||||
|
update_sql = "UPDATE seed_generators set current = current + 1, next = next + 1 WHERE model='#{model}';"
|
||||||
select_sql = "select * from seed_generators where model='#{model}';"
|
select_sql = "select * from seed_generators where model='#{model}';"
|
||||||
update_result = ActiveRecord::Base.connection.execute(update_sql);
|
update_result = ActiveRecord::Base.connection.execute(update_sql);
|
||||||
|
|
||||||
select_result = ActiveRecord::Base.connection.execute(select_sql);
|
select_result = ActiveRecord::Base.connection.execute(select_sql);
|
||||||
|
|
||||||
select_result.each do |row|
|
select_result.each do |row|
|
||||||
cur_val = row [3]
|
current = row [3]
|
||||||
next_val = row[4]
|
nex = row[4]
|
||||||
end
|
end
|
||||||
|
|
||||||
return cur_val, next_val
|
return current, nex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,41 +5,81 @@
|
|||||||
|
|
||||||
<div class="form-inputs p-l-15">
|
<div class="form-inputs p-l-15">
|
||||||
<div class="div-border">
|
<div class="div-border">
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6"><%= f.input :promo_code %></div>
|
|
||||||
<div class="col-md-6"></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<span>* Promo Start Date</span>
|
<label>*Promo Code</label>
|
||||||
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control datepicker"%>
|
<div class="input-group">
|
||||||
<br>
|
<span class="input-group-addon">
|
||||||
</div>
|
<i class="material-icons">vpn_key</i>
|
||||||
<div class="col-md-6">
|
</span>
|
||||||
<span>* Promo End Date</span>
|
<input type="text" name="promotion[promo_code]" value="<%= @promotion.promo_code%>" class="form-control" id="promotion_promo_code">
|
||||||
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control datepicker"%>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<!-- <span>* Promo Start Hour</span> -->
|
<label>* Start Date</label>
|
||||||
<% if !@promotion.promo_start_hour.nil?%>
|
<div class="input-group">
|
||||||
<%= f.input :promo_start_hour, as: :string, input_html: { :value => @promotion.promo_start_hour.utc.strftime('%H:%M') } %>
|
<span class="input-group-addon">
|
||||||
<% else %>
|
<i class="material-icons">date_range</i>
|
||||||
<%= f.input :promo_start_hour, as: :string, input_html: { } %>
|
</span>
|
||||||
<% end %>
|
<% if !@promotion.promo_start_date.nil?%>
|
||||||
<!-- <span>Promo Start Hour</span>
|
<input type="text" name="promotion[promo_start_date]" value="<%= @promotion.promo_start_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control" placeholder="Start Date...">
|
||||||
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
|
<% else %>
|
||||||
|
<input type="text" name="promotion[promo_start_date]" class="datepicker form-control" placeholder="Start Date...">
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<!-- <span>* Promo End Hour</span> -->
|
<label>* End Date</label>
|
||||||
<% if !@promotion.promo_end_hour.nil?%>
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">
|
||||||
|
<i class="material-icons">date_range</i>
|
||||||
|
</span>
|
||||||
|
<% if !@promotion.promo_end_date.nil?%>
|
||||||
|
<input type="text" name="promotion[promo_end_date]" value="<%= @promotion.promo_end_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control" placeholder="Start Date...">
|
||||||
|
<% else %>
|
||||||
|
<input type="text" name="promotion[promo_end_date]" class="datepicker form-control" placeholder="End Date...">
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="control-label">* Start Hour</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">
|
||||||
|
<i class="material-icons">access_time</i>
|
||||||
|
</span>
|
||||||
|
<% if !@promotion.promo_start_hour.nil?%>
|
||||||
|
<input type="text" name="promotion[promo_start_hour]" value="<%= @promotion.promo_start_hour.utc.strftime('%H:%M') %>" class="timepicker form-control" placeholder="Start Time...">
|
||||||
|
<% else %>
|
||||||
|
<input type="text" name="promotion[promo_start_hour]" class="timepicker form-control" placeholder="Start Time...">
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="control-label">* End Hour</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">
|
||||||
|
<i class="material-icons">access_time</i>
|
||||||
|
</span>
|
||||||
|
<% if !@promotion.promo_end_hour.nil?%>
|
||||||
|
<input type="text" name="promotion[promo_end_hour]" value="<%= @promotion.promo_end_hour.utc.strftime('%H:%M') %>" class="timepicker form-control" placeholder="End Time...">
|
||||||
|
<% else %>
|
||||||
|
<input type="text" name="promotion[promo_end_hour]" class="timepicker form-control" placeholder="End Time...">
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<!-- <% if !@promotion.promo_end_hour.nil?%>
|
||||||
<%= f.input :promo_end_hour, as: :string, input_html: {:value => @promotion.promo_end_hour.utc.strftime('%H:%M') },:class=>"form-control timepicker" %>
|
<%= f.input :promo_end_hour, as: :string, input_html: {:value => @promotion.promo_end_hour.utc.strftime('%H:%M') },:class=>"form-control timepicker" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= f.input :promo_end_hour, as: :string, input_html: {},:class=>"form-control timepicker" %>
|
<%= f.input :promo_end_hour, as: :string, input_html: {},:class=>"form-control timepicker" %>
|
||||||
<% end %>
|
<% end %> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="row checkboxes">
|
<div class="row checkboxes">
|
||||||
<div class="col-md-2"><label class="control-label"><abbr title="required">*</abbr> Promotion Day</label></div>
|
<div class="col-md-2"><label class="control-label"><abbr title="required">*</abbr> Promotion Day</label></div>
|
||||||
@@ -53,12 +93,19 @@
|
|||||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6"> Sat</label></div>
|
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6"> Sat</label></div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<%= f.input :promo_type,input_html: { class: "" },
|
<select name="promotion[promo_type]" class="form-control">
|
||||||
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %>
|
<option>Quantity</option>
|
||||||
|
<option>Net_off</option>
|
||||||
|
<option>Net_price</option>
|
||||||
|
<option>Percentage</option>
|
||||||
|
</select>
|
||||||
|
<!-- <%= f.input :promo_type, collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||||
@@ -182,18 +229,31 @@ $(document).ready(function(){
|
|||||||
// format:'H:m'
|
// format:'H:m'
|
||||||
// });
|
// });
|
||||||
|
|
||||||
$('#promotion_promo_start_hour').on('change', function(event) {
|
// $('#promotion_promo_start_hour').on('change', function(event) {
|
||||||
$('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
// $('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
||||||
|
// });
|
||||||
|
|
||||||
|
// $('#promotion_promo_end_hour').on('change', function(event) {
|
||||||
|
// $('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
|
||||||
|
// });
|
||||||
|
|
||||||
|
$('.datepicker').bootstrapMaterialDatePicker({
|
||||||
|
format: 'dddd DD MM YYYY',
|
||||||
|
clearButton: true,
|
||||||
|
weekStart: 1,
|
||||||
|
time: false
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#promotion_promo_end_hour').on('change', function(event) {
|
$('.timepicker').bootstrapMaterialDatePicker({
|
||||||
$('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
|
format: 'HH:mm',
|
||||||
|
clearButton: true,
|
||||||
|
date: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
// var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
||||||
jQuery.each( dayy.split(","), function( i, d ) {
|
// jQuery.each( dayy.split(","), function( i, d ) {
|
||||||
$("input.selectDay[value='"+d+"']").prop( "checked", true );
|
// $("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||||
});
|
// });
|
||||||
|
|
||||||
var form = document.getElementById("new_promotion");
|
var form = document.getElementById("new_promotion");
|
||||||
var inputs = $("input");
|
var inputs = $("input");
|
||||||
@@ -202,7 +262,6 @@ $(document).ready(function(){
|
|||||||
var day = "[";
|
var day = "[";
|
||||||
|
|
||||||
$(".selectDay").click(function() {
|
$(".selectDay").click(function() {
|
||||||
|
|
||||||
// debugger;
|
// debugger;
|
||||||
day = "[";
|
day = "[";
|
||||||
for (var j = 8; j <=15; j += 1){
|
for (var j = 8; j <=15; j += 1){
|
||||||
@@ -226,6 +285,7 @@ $(".selectDay").click(function() {
|
|||||||
|
|
||||||
$("#promotion_original_product").select2();
|
$("#promotion_original_product").select2();
|
||||||
$(".item_code_place").select2();
|
$(".item_code_place").select2();
|
||||||
|
|
||||||
$(".item_code_place").on('change', function(event) {
|
$(".item_code_place").on('change', function(event) {
|
||||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||||
var item_code = this.value;
|
var item_code = this.value;
|
||||||
@@ -244,9 +304,12 @@ $(".selectDay").click(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".promotion_promotion_products_item_code select").select2();
|
$(".promotion_promotion_products_item_code select").select2();
|
||||||
$(".item_code_place1").select2();
|
$(".item_code_place1").select2();
|
||||||
|
|
||||||
callforpromoproduct();
|
callforpromoproduct();
|
||||||
|
|
||||||
$(".addProduct").on('click', function(event) {
|
$(".addProduct").on('click', function(event) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$(".promotion_promotion_products_item_code select").select2();
|
$(".promotion_promotion_products_item_code select").select2();
|
||||||
|
|||||||
Reference in New Issue
Block a user