Voivodeship and country for orders
This commit is contained in:
parent
3ef5187b03
commit
d289397f40
|
|
@ -75,6 +75,7 @@ class CheckoutController < ShopController
|
||||||
def order_params
|
def order_params
|
||||||
params.require(:order)
|
params.require(:order)
|
||||||
.permit(:email, :message_from_client, :terms_of_service_acceptance,
|
.permit(:email, :message_from_client, :terms_of_service_acceptance,
|
||||||
:first_name, :last_name, :phone, :street, :city, :zip_code)
|
:first_name, :last_name, :phone, :street, :city, :zip_code,
|
||||||
|
:voivodeship, :country, :shipping_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,12 @@ class Order < ApplicationRecord
|
||||||
7 => '<span class="badge bg-orange-active">Anulowane</span>'
|
7 => '<span class="badge bg-orange-active">Anulowane</span>'
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
VOIVOIDSHIPS = ['dolnośląskie', 'kujawsko-pomorskie', 'lubelskie', 'lubuskie',
|
||||||
|
'łódzkie', 'małopolskie', 'mazowieckie', 'opolskie',
|
||||||
|
'podkarpackie', 'podlaskie', 'pomorskie', 'śląskie',
|
||||||
|
'świętokrzyskie', 'warmińsko-mazurskie', 'wielkopolskie',
|
||||||
|
'zachodniopomorskie'].freeze
|
||||||
|
|
||||||
def order_summary
|
def order_summary
|
||||||
order_value + shipping.price
|
order_value + shipping.price
|
||||||
end
|
end
|
||||||
|
|
@ -80,7 +86,8 @@ class Order < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def address
|
def address
|
||||||
"#{street}\n#{zip_code} #{city}\n\ntel: #{phone}"
|
"#{street}\n#{zip_code} #{city}\n"\
|
||||||
|
"woj. #{voivodeship}\n#{country}\n\ntel: #{phone}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def order_value
|
def order_value
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,20 @@
|
||||||
<!-- end col -->
|
<!-- end col -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end row -->
|
<!-- end row -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<select class="form-control">
|
<label>Województwo: </label>
|
||||||
<option value="pl">Polska</option>
|
</div>
|
||||||
</select>
|
</div>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<div class="form-group">
|
||||||
|
<%= select(:order, :voivodeship, options_for_select(Order::VOIVOIDSHIPS), {}, {class: 'form-control'}) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= select(:order, :country, options_for_select(['Polska']), {}, {class: 'form-control'}) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddVoivodeshipAndCountryToOrder < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
add_column :orders, :voivodeship, :string, after: 'zip_code'
|
||||||
|
add_column :orders, :country, :string, after: 'voivodeship'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20180119145343) do
|
ActiveRecord::Schema.define(version: 20180605061228) do
|
||||||
|
|
||||||
create_table "admins", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
create_table "admins", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
|
|
@ -157,6 +157,7 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "orders", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
create_table "orders", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||||
|
t.integer "order_number"
|
||||||
t.bigint "cart_id", null: false
|
t.bigint "cart_id", null: false
|
||||||
t.integer "shipping_id"
|
t.integer "shipping_id"
|
||||||
t.integer "payment_method_id"
|
t.integer "payment_method_id"
|
||||||
|
|
@ -168,6 +169,8 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
||||||
t.string "street"
|
t.string "street"
|
||||||
t.string "city", limit: 80
|
t.string "city", limit: 80
|
||||||
t.string "zip_code", limit: 10
|
t.string "zip_code", limit: 10
|
||||||
|
t.string "voivodeship"
|
||||||
|
t.string "country"
|
||||||
t.text "message_from_client"
|
t.text "message_from_client"
|
||||||
t.integer "status", default: 0, null: false
|
t.integer "status", default: 0, null: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
|
|
@ -239,6 +242,7 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
||||||
t.text "index_page_second_info", limit: 4294967295
|
t.text "index_page_second_info", limit: 4294967295
|
||||||
t.text "index_page_content", limit: 4294967295
|
t.text "index_page_content", limit: 4294967295
|
||||||
t.text "shop_owners_emails"
|
t.text "shop_owners_emails"
|
||||||
|
t.boolean "recaptcha_chk", default: false, null: false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "updated_by"
|
t.integer "updated_by"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue