Add form on the new voucher page

This commit is contained in:
Gaetan Craig-Riou
2023-02-22 12:06:13 +11:00
parent f9f6793d10
commit a4add889a8
2 changed files with 24 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ module Admin
def new
@enterprise = Enterprise.find_by permalink: params[:enterprise_id]
@voucher = Voucher.new
end
end
end

View File

@@ -1,22 +1,23 @@
.row
.sixteen.columns.alpha
.four.columns.alpha.text-right
%a.button{ href: "#{edit_admin_enterprise_path(@enterprise)}#!#vouchers_panel"}
= t('.back')
.twelve.columns.omega
.row
.eight.columns.text-center
%legend= t(".legend")
.four.columns.text-right
%input.red{ type: "button", value: t('.save') }
.row
.alpha.four.columns
= label :voucher, :code, t('.voucher_code')
.omega.eight.columns
%textarea.fullwidth{ id: 'voucher_code', name: 'voucher_code', rows: 6 }
.row
.alpha.four.columns
= label :voucher, :amount, t('.voucher_amount')
.omega.eight.columns
$
%input{ type: 'text', id: 'voucher_amount', name: 'voucher_amount', value: 10, disabled: true }
= form_with model: @voucher, url: admin_enterprise_vouchers_path(@enterprise), html: { name: "voucher_form" } do |f|
.row
.sixteen.columns.alpha
.four.columns.alpha.text-right
%a.button{ href: "#{edit_admin_enterprise_path(@enterprise)}#!#vouchers_panel"}
= t('.back')
.twelve.columns.omega
.row
.eight.columns.text-center
%legend= t(".legend")
.four.columns.text-right
= f.submit t('.save'), class: 'red'
.row
.alpha.four.columns
= f.label :code, t('.voucher_code')
.omega.eight.columns
= f.text_area :code, rows: 6, class: 'fullwidth'
.row
.alpha.four.columns
= f.label :amount, t('.voucher_amount')
.omega.eight.columns
$
= f.text_field :amount, value: 10, disabled: true