Merge branch 'adminbsb_ui_changes' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
phyusin
2018-09-28 15:55:24 +06:30
18 changed files with 313 additions and 63 deletions

View File

@@ -404,7 +404,9 @@ $(document).on('turbolinks:load', function() {
success: function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
@@ -428,7 +430,9 @@ $(document).on('turbolinks:load', function() {
success: function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}

View File

@@ -111,6 +111,26 @@ $(document).ready(function() {
railBorderRadius: '0',
touchScrollStep : 50
});
$('#process-reservation-slimscroll').slimScroll({
height: height-$('#process-reservation-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#reservation-info-slimscroll').slimScroll({
height: height-$('#reservation-info-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
// $('.delete').click(function(){
// var method = $(this).attr('data-method');
// var url = $(this).attr('data-ref');

View File

@@ -1,6 +1,7 @@
//= require custom.js
$(function(){
$(".room_type").hide();
/*new customer UI func:*/
//Initialize tooltips
$('.nav-tabs > li a[title]').tooltip();
@@ -21,6 +22,7 @@ $(function(){
nextTab($active);
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
});
$(".prev-step").click(function (e) {
var $active = $('.wizard .nav-tabs li a.active');
@@ -28,6 +30,28 @@ $(function(){
});
/*new customer UI func:*/
$(".reservation_type").on("click", function(){
if($(this).val() == "Dine-in"){
$(".dining_type").show();
$(".room_type").hide();
}else{
$(".dining_type").hide();
$(".room_type").show();
}
});
$(".number_limit").on("click", function(){
if(parseInt($(this).val()) <= 0){
if($(this).attr("data-type") == "room"){
$("#room_count").val(1);
}else if($(this).attr("data-type") == "adult"){
$("#adult_count").val(1);
}else{
$("#child_count").val(1);
}
}
});
});
/*customer UI tab btn*/

View File

@@ -76,7 +76,6 @@ class Origami::CustomersController < BaseOrigamiController
filter = params[:filter]
if filter.nil?
puts params[:page]
@crm_customers = Customer.order("customer_id") #.page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else

View File

@@ -1,6 +1,45 @@
class Origami::ReservationController < BaseOrigamiController
def index
@reservations = Reservation.all
end
def show
end
def new
end
def edit
end
def create
end
def update
end
# DELETE /crm/customers/1
# DELETE /crm/customers/1.json
def destroy
@reservation.destroy
respond_to do |format|
format.html { redirect_to origami_reservation_url, notice: 'Reservation was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_origami_reservation
@reservation = Reservation.find(params[:reservation_id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def customer_params
params.require(:reservation).permit(:reservation_id)
end
end

15
app/models/reservation.rb Normal file
View File

@@ -0,0 +1,15 @@
class Reservation < ApplicationRecord
self.primary_key = "reservation_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
has_many :reservation_items
scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
private
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "RS")
end
end

View File

@@ -0,0 +1,13 @@
class ReservationItem < ApplicationRecord
self.primary_key = "reservation_items_id"
#primary key - need to be unique
before_create :generate_custom_id
belongs_to :reservation, autosave: true
private
def generate_custom_id
self.reservation_items_id = SeedGenerator.generate_id(self.class.name, "RSI")
end
end

View File

@@ -958,7 +958,9 @@
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -1011,9 +1013,11 @@
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
});
@@ -1214,7 +1218,9 @@
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami/';
}
@@ -1321,7 +1327,9 @@
console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami/';
}

View File

@@ -1146,7 +1146,9 @@ var trans_flag = <%= @trans_flag %>;
success:function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
if (pdf_view ==1) {
@@ -1439,7 +1441,9 @@ var trans_flag = <%= @trans_flag %>;
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
@@ -1482,7 +1486,9 @@ var trans_flag = <%= @trans_flag %>;
customer_display_view(null,"reload");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
@@ -1522,7 +1528,9 @@ var trans_flag = <%= @trans_flag %>;
// console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){

View File

@@ -324,7 +324,9 @@ $(document).ready(function(){
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -433,7 +435,9 @@ function check_emp_access_code(access_code,type) {
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}

View File

@@ -5,7 +5,7 @@
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<div class="card" id="make-reservation-slimscroll" data-height="-50">
<div class="card-header">
<h5 class="card-title text-center"><%= t :make_reservation %></h5>
<h5 class="card-title text-center bg-faded"><%= t :make_reservation %></h5>
</div>
<div class="card-body">
<div class="wizard">
@@ -14,7 +14,7 @@
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="nav-item">
<div class="connecting-line border-right"></div>
<a href="#step1" class="nav-link active" data-toggle="tab" aria-controls="reservation" role="tab" title="Reservation">
<a href="#reservation" class="nav-link active" data-toggle="tab" aria-controls="reservation" role="tab" title="Reservation">
<span class="round-tab">
1
</span>
@@ -22,7 +22,7 @@
</li>
<li role="presentation" class="nav-item disabled">
<div class="connecting-line"></div>
<a href="#complete" class="nav-link disable" data-toggle="tab" aria-controls="personal_detail" role="tab" title="Personal Detail">
<a href="#personal_detail" class="nav-link disable" data-toggle="tab" aria-controls="personal_detail" role="tab" title="Personal Detail">
<span class="round-tab">
2
</span>
@@ -35,70 +35,114 @@
<div class="form-row">
<div class="col-sm-12 col-md-12 col-lg-12">
<label class="font-12 radio-inline">
<input type="radio" name="type" checked class="radio-col-indigo" value="0"><%= t("views.right_panel.detail.dine_in") %>
<input type="radio" name="reservation_type" checked class="radio-col-indigo reservation_type" value="0"><%= t("views.right_panel.detail.dine_in") %>
</label>&nbsp;
<label class="font-12 radio-inline">
<input type="radio" name="type" class="radio-col-indigo" value="1"><%= t :room %>
<input type="radio" name="reservation_type" class="radio-col-indigo reservation_type" value="1"><%= t :room %>
</label>
</div>
</div>
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_in_date" name="from" id="from" type="text" placeholder="Check In Date">
<div class="dining_type">
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_in_date datepicker" name="check_in_date" id="check_in_date" type="text" placeholder="Check-in Date">
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_out_date datepicker" name="check_out_date" id="check_out_date" type="text" placeholder="Check Out Date">
</div>
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_out_date" name="from" id="from" type="text" placeholder="Check Out Date">
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_in_time timepicker" name="check_in_time" id="check_in_time" type="text" placeholder="Check-in Time">
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_out_time timepicker" name="check_out_time" id="check_out_time" type="text" placeholder="Check Out Time">
</div>
</div>
</div>
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_in_time" name="from" id="from" type="text" placeholder="Check In Time">
<div class="room_type">
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_in_date datepicker" name="check_in_date" id="check_in_date" type="text" placeholder="Check-in Date">
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_out_date datepicker" name="check_out_date" id="check_out_date" type="text" placeholder="Check Out Date">
</div>
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<input class="form-control check_out_time" name="from" id="from" type="text" placeholder="Check Out Time">
</div>
</div>
<div class="form-row clearfix">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<label for="room_count" class="control-label">ROOMS</label>
<input type="number" class="form-control" name="room_count">
<div class="form-row clearfix">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<label for="room_count" class="control-label">ROOMS</label>
<input type="number" class="form-control number_limit" name="room_count" id="room_count" data-type="room" value="1">
</div>
</div>
</div>
<div class="form-row clearfix">
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<label for="adult_count" class="control-label">ADULT</label>
<input type="number" class="form-control" name="adult_count">
<input type="number" class="form-control number_limit" name="adult_count" id="adult_count" data-type="adult" value="1">
</div>
<div class="form-group col-sm-6 col-md-6 col-lg-6">
<label for="child_count" class="control-label">CHILD</label>
<input type="number" class="form-control" name="child_count">
<input type="number" class="form-control number_limit" name="child_count" id="child_count" data-type="child">
</div>
</div>
<div class="row text-center">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<button class="btn bg-blue btn-lg waves-effect next-step">CHECK AVAILABLE</button>
<button class="btn bg-blue btn-lg waves-effect">CHECK AVAILABLE</button>
<button class="btn bg-blue btn-lg waves-effect next-step">NEXT</button>
</div>
</div>
</div><!-- .end.tab-content .reservation -->
</div><!-- .end.tab-panel .reservation -->
<div class="tab-pane" role="tabpanel" id="personal_detail">
<div class="form-row">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<input class="form-control" name="name" id="name" type="text" placeholder="NAME">
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<input class="form-control" name="contact_no" id="contact_no" type="number" placeholder="PHONE NUMBER">
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<input class="form-control" name="address" id="address" type="text" placeholder="ADDRESS">
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<label for="reservation_note" class="control-label">RESERVATION NOTE</label>
<textarea rows="3" id="reservation_note" name="reservation_note" class="form-control"></textarea>
</div>
</div>
<div class="row text-center">
<div class="form-group col-sm-12 col-md-12 col-lg-12">
<button class="btn bg-blue btn-lg prev-step">PREV</button>
<button class="btn bg-blue btn-lg">SUBMIT</button>
</div>
</div>
</div>
</div><!-- .end.tab-content .personal_detail -->
</div> <!-- .end.wizard -->
</div>
</div>
</div>
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
<div class="card font-13">
<div class="row">
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card font-13">
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
<div class="card font-13">
<div class="row clearfix">
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5" id="process-reservation-slimscroll" data-height="-80">
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4" id="reservation-info-slimscroll" data-height="-80">
</div>
</div>
</div>
</div>
</div>

View File

@@ -1052,7 +1052,9 @@ $("#first_bill").on('click', function(){
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -1090,7 +1092,9 @@ $(".choose_payment").on('click', function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
@@ -1317,7 +1321,9 @@ $('#add_invoice').on('click',function(){
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami/';
}
@@ -1406,7 +1412,9 @@ $('#add_invoice').on('click',function(){
console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami/';
}

View File

@@ -435,7 +435,9 @@ $('#reprint').on('click', function () {
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -536,7 +538,9 @@ $(document).on('click', '.access_modal', function(event){
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}

View File

@@ -370,7 +370,9 @@ $(document).ready(function(){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -403,7 +405,9 @@ $(document).ready(function(){
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
@@ -475,7 +479,9 @@ $('#void').on('click',function () {
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
}
@@ -512,7 +518,9 @@ $('#foc').click(function() {
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
});

View File

@@ -406,7 +406,9 @@
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/transactions/sales/';
}

View File

@@ -326,7 +326,7 @@ scope "(:locale)", locale: /en|mm/ do
# get 'sale/:sale_id/:type/credit_payment/others_payment/GiftVoucher' => "gift_voucher#index"
#------------- Start Reservation -------------------#
get '/reservation' => "reservation#index"
resources :reservation
#------------- End Reservation -------------------#
end

View File

@@ -0,0 +1,24 @@
class CreateReservations < ActiveRecord::Migration[5.1]
def change
create_table :reservations, :id => false do |t|
t.string :reservation_id, :limit => 16, :primary_key => true
t.string :source, :null => false, :default => "Cashier"
t.string :reservation_type, :null => false
t.string :customer_id, :null => false
t.datetime :checkin_datetime, :null => false
t.datetime :checkout_datetime
t.json :reservation_info
t.string :remark
t.string :status, :null => false, :default => "new"
t.datetime :action_at, :null => false
t.string :action_by, :null => false
t.datetime :modify_at
t.string :modify_by
t.timestamps
end
end
def down
drop_table :reservations
end
end

View File

@@ -0,0 +1,26 @@
class CreateReservationItems < ActiveRecord::Migration[5.1]
def change
create_table :reservation_items, :id => false do |t|
t.string :reservation_items_id, :limit => 16, :primary_key => true
t.string :reservation_id, foreign_key: true, :null => false, :limit => 16
t.string :item_status, :null => false, :default => "new"
t.string :item_code, :null => false
t.string :item_instance_code
t.string :item_name, :null => false
t.string :alt_name, :null => false
t.json :set_menu_items
t.integer :account_id, :limit => 8, :null => false, :default => 1
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :remark
t.string :options
t.boolean :taxable, :null => false, :default => true
t.timestamps
end
end
def down
drop_table :reservation_items
end
end