Adding payment method
This commit is contained in:
@@ -1,2 +1,14 @@
|
|||||||
class DeliveryDestination < ActiveRecord::Base
|
class DeliveryDestination < ActiveRecord::Base
|
||||||
|
def get_payment_string
|
||||||
|
case self.payment_method
|
||||||
|
when 'cash_on_delivery'
|
||||||
|
'Pouzecem'
|
||||||
|
when 'paypal'
|
||||||
|
'Paypal'
|
||||||
|
when 'pikpay'
|
||||||
|
'Pikpay'
|
||||||
|
else
|
||||||
|
'Nepoznato'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
.tg td{ }
|
.tg td{ }
|
||||||
.tg th{ }
|
.tg th{ }
|
||||||
</style>
|
</style>
|
||||||
<%
|
<%
|
||||||
dd = @record.delivery_destination
|
dd = @record.delivery_destination
|
||||||
c = @record
|
c = @record
|
||||||
%>
|
%>
|
||||||
<p>
|
<p>
|
||||||
<p><strong>Ime:</strong> <%= dd.name %><br /><br /></p>
|
<p><strong>Ime:</strong> <%= dd.name %><br /><br /></p>
|
||||||
|
|
||||||
<p><strong>Adresa:</strong><br />
|
<p><strong>Adresa:</strong><br />
|
||||||
<%= dd.address %><br />
|
<%= dd.address %><br />
|
||||||
<%= dd.place.to_s.strip %> <%= Place.name_from_code(dd.place.to_s) %><br />
|
<%= dd.place.to_s.strip %> <%= Place.name_from_code(dd.place.to_s) %><br />
|
||||||
Bosna i Hercegovina<br /><br />
|
Bosna i Hercegovina<br /><br />
|
||||||
@@ -22,6 +22,8 @@ Bosna i Hercegovina<br /><br />
|
|||||||
<p><strong>Telefon: </strong> +387 <%= dd.phone %><br /><br />
|
<p><strong>Telefon: </strong> +387 <%= dd.phone %><br /><br />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p><strong>Plaćanje: </strong><%= dd.get_payment_string %></p><br />
|
||||||
|
|
||||||
<p><strong>Napomena: </strong><br />
|
<p><strong>Napomena: </strong><br />
|
||||||
<%= dd.note %><br /><br />
|
<%= dd.note %><br /><br />
|
||||||
</p>
|
</p>
|
||||||
@@ -29,8 +31,8 @@ Bosna i Hercegovina<br /><br />
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Naručeno:</strong> <%= c.confirmed_at.in_time_zone("Europe/Sarajevo").strftime("%A %d.%m.%Y. %H:%M") %>
|
<strong>Naručeno:</strong> <%= c.confirmed_at.in_time_zone("Europe/Sarajevo").strftime("%A %d.%m.%Y. %H:%M") %>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
<% if dd.instant_delivery %>
|
<% if dd.instant_delivery %>
|
||||||
<p style="font-size: 120%;">
|
<p style="font-size: 120%;">
|
||||||
@@ -47,7 +49,7 @@ OVO JE NARUDŽBA ZA INSTANT DOSTAVU
|
|||||||
<th style="text-align: right; ">Total</th>
|
<th style="text-align: right; ">Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% @record.item_in_carts.each do |iic| %>
|
<% @record.item_in_carts.each do |iic| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tg-031e"><%= iic.item.code %></td>
|
<td class="tg-031e"><%= iic.item.code %></td>
|
||||||
<td class="tg-031e"><%= iic.item.name %></td>
|
<td class="tg-031e"><%= iic.item.name %></td>
|
||||||
<td style="text-align: right; "><%= iic.count %></td>
|
<td style="text-align: right; "><%= iic.count %></td>
|
||||||
@@ -70,15 +72,6 @@ OVO JE NARUDŽBA ZA INSTANT DOSTAVU
|
|||||||
<td style="text-align: right; "><%= money(c.total) %></td>
|
<td style="text-align: right; "><%= money(c.total) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><strong> </strong></td></tr>
|
<tr><td><strong> </strong></td></tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddPaymentMethodToDeliveryDestination < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :delivery_destinations, :payment_method, :string, default: 'cash_on_delivery'
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,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: 20151124061357) do
|
ActiveRecord::Schema.define(version: 20160108081208) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -62,11 +62,12 @@ ActiveRecord::Schema.define(version: 20151124061357) do
|
|||||||
t.boolean "phone_verified"
|
t.boolean "phone_verified"
|
||||||
t.string "phone_verification_code"
|
t.string "phone_verification_code"
|
||||||
t.string "email_verification_code"
|
t.string "email_verification_code"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "anonymous_id_string"
|
t.string "anonymous_id_string"
|
||||||
t.boolean "instant_delivery", default: false
|
t.boolean "instant_delivery", default: false
|
||||||
|
t.string "payment_method", default: "cash_on_delivery"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "delivery_time_estimations", force: :cascade do |t|
|
create_table "delivery_time_estimations", force: :cascade do |t|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class DeliveryDestination < ActiveRecord::Base
|
class DeliveryDestination < ActiveRecord::Base
|
||||||
has_one :cart
|
has_one :cart
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
@@ -11,4 +11,17 @@ class DeliveryDestination < ActiveRecord::Base
|
|||||||
result = DeliveryDestination.create!(attributes)
|
result = DeliveryDestination.create!(attributes)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_payment_string
|
||||||
|
case self.payment_method
|
||||||
|
when 'cash_on_delivery'
|
||||||
|
'Pouzecem'
|
||||||
|
when 'paypal'
|
||||||
|
'Paypal'
|
||||||
|
when 'pikpay'
|
||||||
|
'Pikpay'
|
||||||
|
else
|
||||||
|
'Nepoznato'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
<%
|
<%
|
||||||
dd = @cart.delivery_destination
|
dd = @cart.delivery_destination
|
||||||
c = @cart
|
c = @cart
|
||||||
%>
|
%>
|
||||||
|
|
||||||
**Ime:** <%= dd.name %>
|
**Ime:** <%= dd.name %>
|
||||||
|
|
||||||
**Adresa:**
|
**Adresa:**
|
||||||
<%= dd.address %>
|
<%= dd.address %>
|
||||||
@@ -17,6 +17,8 @@ Bosna i Hercegovina
|
|||||||
|
|
||||||
**Telefon: ** +387 <%= dd.phone %>
|
**Telefon: ** +387 <%= dd.phone %>
|
||||||
|
|
||||||
|
**Plaćanje: ** <%= dd.get_payment_string %>
|
||||||
|
|
||||||
**Napomena: **
|
**Napomena: **
|
||||||
<%= dd.note %>
|
<%= dd.note %>
|
||||||
|
|
||||||
@@ -37,16 +39,7 @@ Bosna i Hercegovina
|
|||||||
|
|
||||||
Dostava
|
Dostava
|
||||||
1 x <%= Helper.money(c.delivery_cost) %> = <%= Helper.money(c.delivery_cost) %>
|
1 x <%= Helper.money(c.delivery_cost) %> = <%= Helper.money(c.delivery_cost) %>
|
||||||
|
|
||||||
**UKUPNO:** <%= Helper.money(c.total) %>
|
**UKUPNO:** <%= Helper.money(c.total) %>
|
||||||
|
|
||||||
[Pogledati OVAJ LINK](https://www.ribica.ba/backoffice/carts/<%= @cart.id %>)
|
[Pogledati OVAJ LINK](https://www.ribica.ba/backoffice/carts/<%= @cart.id %>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user