mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Cancel invoices through admin
This commit is contained in:
parent
c7e02373fa
commit
1f2f483e34
3 changed files with 18 additions and 2 deletions
|
@ -10,4 +10,14 @@ class Admin::InvoicesController < AdminController
|
||||||
def show
|
def show
|
||||||
@invoice = Invoice.find(params[:id])
|
@invoice = Invoice.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cancel
|
||||||
|
if @invoice.cancel
|
||||||
|
flash[:notice] = t('record_updated')
|
||||||
|
redirect_to([:admin, @invoice])
|
||||||
|
else
|
||||||
|
flash.now[:alert] = t('failed_to_update_record')
|
||||||
|
render :show
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
= @invoice
|
= @invoice
|
||||||
.col-sm-6
|
.col-sm-6
|
||||||
%h1.text-right.text-center-xs
|
%h1.text-right.text-center-xs
|
||||||
= link_to(t('back'), :back, class: 'btn btn-default')
|
- if !@invoice.cancelled? && !@invoice.binded?
|
||||||
|
= link_to(t(:cancel), cancel_admin_invoice_path(@invoice), method: :patch, class: 'btn btn-default')
|
||||||
|
= link_to(t('back'), admin_invoices_path, class: 'btn btn-default')
|
||||||
%hr
|
%hr
|
||||||
|
= render 'shared/full_errors', object: @invoice
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-6= render 'registrar/invoices/partials/details'
|
.col-md-6= render 'registrar/invoices/partials/details'
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -102,7 +102,9 @@ Rails.application.routes.draw do
|
||||||
patch 'bind', on: :member
|
patch 'bind', on: :member
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :invoices
|
resources :invoices do
|
||||||
|
patch 'cancel', on: :member
|
||||||
|
end
|
||||||
|
|
||||||
resources :domains do
|
resources :domains do
|
||||||
resources :domain_versions
|
resources :domain_versions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue