update conflicx reset.css

This commit is contained in:
Aung Myo
2017-10-25 14:05:15 +06:30
3 changed files with 136 additions and 74 deletions

View File

@@ -213,5 +213,12 @@ section.content {
.m-t-7{
margin-top: 7px;
}
/* FORM */
.input-group-addon {
padding: 0rem 0rem;
}
/* END FORM */
/* End Reset Theme */
/* *************************************************** */

View File

@@ -1,41 +1,14 @@
class SeedGenerator < ApplicationRecord
# Generate ID for Tables
def self.generate_id(model, prefix)
seed = SeedGenerator.find_by_model(model)
new_receipt_no = 0
if (seed.nil?)
seed = SeedGenerator.new()
seed.model = model
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
cur_val, next_val = self.update_seed(model)
if (cur_val == 0)
cur_val, next_val = self.execute_query(model)
end
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
end
@@ -88,22 +61,41 @@ class SeedGenerator < ApplicationRecord
return next_code
end
def self.update_seed(model, current, inc)
cur_val = 0
next_val = 0
nex = current + inc
def self.execute_query(model)
current = 0
nex = 0
update_sql = "update seed_generators set current= #{current}, next= #{nex} where model='#{model}';";
sql = "INSERT INTO seed_generators (model, created_at, updated_at)
VALUES('#{ model }', NOW(), NOW())
ON DUPLICATE KEY UPDATE current = current + 1, next = next + 1;"
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}';"
update_result = ActiveRecord::Base.connection.execute(update_sql);
select_result = ActiveRecord::Base.connection.execute(select_sql);
select_result.each do |row|
cur_val = row [3]
next_val = row[4]
current = row [3]
nex = row[4]
end
return cur_val, next_val
return current, nex
end
end

View File

@@ -6,40 +6,80 @@
<div class="form-inputs p-l-15">
<div class="div-border">
<div class="row">
<div class="col-md-6"><%= f.input :promo_code %></div>
<div class="col-md-6"></div>
<div class="col-md-6">
<label>*Promo Code</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">vpn_key</i>
</span>
<input type="text" name="promotion[promo_code]" value="<%= @promotion.promo_code%>" class="form-control" id="promotion_promo_code">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<span>* Promo Start Date</span>
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control datepicker"%>
<br>
</div>
<div class="col-md-6">
<span>* Promo End Date</span>
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control datepicker"%>
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- <span>* Promo Start Hour</span> -->
<% if !@promotion.promo_start_hour.nil?%>
<%= f.input :promo_start_hour, as: :string, input_html: { :value => @promotion.promo_start_hour.utc.strftime('%H:%M') } %>
<label>* Start Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@promotion.promo_start_date.nil?%>
<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...">
<% else %>
<%= f.input :promo_start_hour, as: :string, input_html: { } %>
<input type="text" name="promotion[promo_start_date]" class="datepicker form-control" placeholder="Start Date...">
<% end %>
<!-- <span>Promo Start Hour</span>
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
</div>
</div>
<div class="col-md-6">
<!-- <span>* Promo End Hour</span> -->
<label>* End Date</label>
<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" %>
<% else %>
<%= f.input :promo_end_hour, as: :string, input_html: {},:class=>"form-control timepicker" %>
<% end %>
<% end %> -->
</div>
</div>
<br>
<div class="row checkboxes">
<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>
<br>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_type,input_html: { class: "" },
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "Promotion Type" %>
<select name="promotion[promo_type]" class="form-control">
<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 class="row">
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
@@ -182,18 +229,31 @@ $(document).ready(function(){
// format:'H:m'
// });
$('#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').on('change', function(event) {
// $('#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) {
$('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
$('.timepicker').bootstrapMaterialDatePicker({
format: 'HH:mm',
clearButton: true,
date: false
});
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
jQuery.each( dayy.split(","), function( i, d ) {
$("input.selectDay[value='"+d+"']").prop( "checked", true );
});
// var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
// jQuery.each( dayy.split(","), function( i, d ) {
// $("input.selectDay[value='"+d+"']").prop( "checked", true );
// });
var form = document.getElementById("new_promotion");
var inputs = $("input");
@@ -202,7 +262,6 @@ $(document).ready(function(){
var day = "[";
$(".selectDay").click(function() {
// debugger;
day = "[";
for (var j = 8; j <=15; j += 1){
@@ -226,6 +285,7 @@ $(".selectDay").click(function() {
$("#promotion_original_product").select2();
$(".item_code_place").select2();
$(".item_code_place").on('change', function(event) {
var ajax_url = "<%= settings_find_item_instance_path %>";
var item_code = this.value;
@@ -244,9 +304,12 @@ $(".selectDay").click(function() {
}
});
});
$(".promotion_promotion_products_item_code select").select2();
$(".item_code_place1").select2();
callforpromoproduct();
$(".addProduct").on('click', function(event) {
setTimeout(function(){
$(".promotion_promotion_products_item_code select").select2();