Add admin UI for SupplierCategories
This commit is contained in:
parent
7e8c1d041d
commit
708f85a839
10 changed files with 108 additions and 0 deletions
|
@ -5,6 +5,7 @@ class Admin::FinancesController < Admin::BaseController
|
||||||
@bank_accounts = BankAccount.order('name')
|
@bank_accounts = BankAccount.order('name')
|
||||||
@bank_gateways = BankGateway.order('name')
|
@bank_gateways = BankGateway.order('name')
|
||||||
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||||
|
@supplier_categories = SupplierCategory.order('name')
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_bank_accounts
|
def update_bank_accounts
|
||||||
|
@ -21,4 +22,9 @@ class Admin::FinancesController < Admin::BaseController
|
||||||
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_supplier_categories
|
||||||
|
@supplier_categories = SupplierCategory.order('name')
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
41
app/controllers/admin/supplier_categories_controller.rb
Normal file
41
app/controllers/admin/supplier_categories_controller.rb
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
class Admin::SupplierCategoriesController < Admin::BaseController
|
||||||
|
inherit_resources
|
||||||
|
|
||||||
|
def new
|
||||||
|
@supplier_category = SupplierCategory.new(params[:supplier_category])
|
||||||
|
render layout: false
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@supplier_category = SupplierCategory.new(params[:supplier_category])
|
||||||
|
if @supplier_category.valid? && @supplier_category.save
|
||||||
|
redirect_to update_supplier_categories_admin_finances_url, status: :see_other
|
||||||
|
else
|
||||||
|
render action: 'new', layout: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@supplier_category = SupplierCategory.find(params[:id])
|
||||||
|
render action: 'new', layout: false
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@supplier_category = SupplierCategory.find(params[:id])
|
||||||
|
|
||||||
|
if @supplier_category.update(params[:supplier_category])
|
||||||
|
redirect_to update_supplier_categories_admin_finances_url, status: :see_other
|
||||||
|
else
|
||||||
|
render action: 'new', layout: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@supplier_category = SupplierCategory.find(params[:id])
|
||||||
|
@supplier_category.destroy
|
||||||
|
redirect_to update_supplier_categories_admin_finances_url, status: :see_other
|
||||||
|
rescue StandardError => e
|
||||||
|
flash.now[:alert] = e.message
|
||||||
|
render template: 'shared/alert'
|
||||||
|
end
|
||||||
|
end
|
13
app/views/admin/finances/_supplier_categories.html.haml
Normal file
13
app/views/admin/finances/_supplier_categories.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th= heading_helper SupplierCategory, :name
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- @supplier_categories.each do |supplier_category|
|
||||||
|
%tr
|
||||||
|
%td= supplier_category.name
|
||||||
|
%td
|
||||||
|
= link_to t('ui.edit'), edit_admin_supplier_category_path(supplier_category), remote: true, class: 'btn btn-mini'
|
||||||
|
= link_to t('ui.delete'), [:admin, supplier_category], :method => :delete, :data => {:confirm => t('ui.confirm_delete', name: supplier_category.name)},
|
||||||
|
remote: true, class: 'btn btn-mini btn-danger'
|
|
@ -4,6 +4,7 @@
|
||||||
= link_to t('.new_financial_transaction_class'), new_admin_financial_transaction_class_path, remote: true, class: 'btn btn-primary'
|
= link_to t('.new_financial_transaction_class'), new_admin_financial_transaction_class_path, remote: true, class: 'btn btn-primary'
|
||||||
= link_to t('.new_bank_account'), new_admin_bank_account_path, remote: true, class: 'btn'
|
= link_to t('.new_bank_account'), new_admin_bank_account_path, remote: true, class: 'btn'
|
||||||
= link_to t('.new_bank_gateway'), new_admin_bank_gateway_path, remote: true, class: 'btn'
|
= link_to t('.new_bank_gateway'), new_admin_bank_gateway_path, remote: true, class: 'btn'
|
||||||
|
= link_to t('.new_supplier_category'), new_admin_supplier_category_path, remote: true, class: 'btn'
|
||||||
|
|
||||||
- content_for :sidebar do
|
- content_for :sidebar do
|
||||||
%p= t('.first_paragraph').html_safe
|
%p= t('.first_paragraph').html_safe
|
||||||
|
@ -16,3 +17,6 @@
|
||||||
|
|
||||||
%h2= t('.bank_gateways')
|
%h2= t('.bank_gateways')
|
||||||
#bank_gateways_table= render 'bank_gateways'
|
#bank_gateways_table= render 'bank_gateways'
|
||||||
|
|
||||||
|
%h2= t('.supplier_categories')
|
||||||
|
#supplier_categories_table= render 'supplier_categories'
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('#supplier_categories_table').html('#{escape_javascript(render("admin/finances/supplier_categories"))}');
|
||||||
|
$('#modalContainer').modal('hide');
|
12
app/views/admin/supplier_categories/_form.html.haml
Normal file
12
app/views/admin/supplier_categories/_form.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
= simple_form_for [:admin, @supplier_category], :validate => true, :remote => true do |f|
|
||||||
|
.modal-header
|
||||||
|
= close_button :modal
|
||||||
|
%h3= @supplier_category.new_record? ? t('.title_new') : t('.title_edit')
|
||||||
|
.modal-body
|
||||||
|
= f.input :name
|
||||||
|
= f.input :description
|
||||||
|
= f.association :financial_transaction_class, :include_blank => false
|
||||||
|
= f.association :bank_account, :include_blank => false
|
||||||
|
.modal-footer
|
||||||
|
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= f.submit class: 'btn btn-primary'
|
2
app/views/admin/supplier_categories/new.js.haml
Normal file
2
app/views/admin/supplier_categories/new.js.haml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
$('#modalContainer').html('#{j(render("form"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -193,6 +193,11 @@ de:
|
||||||
phone2: Telefon 2
|
phone2: Telefon 2
|
||||||
shared_sync_method: Syncronisierungsmethode
|
shared_sync_method: Syncronisierungsmethode
|
||||||
url: Webseite
|
url: Webseite
|
||||||
|
supplier_category:
|
||||||
|
name: Name
|
||||||
|
description: Beschreibung
|
||||||
|
financial_transaction_class: Kontotransaktionsklasse
|
||||||
|
bank_account: Bankkonto
|
||||||
task:
|
task:
|
||||||
created_by: Erstellt von
|
created_by: Erstellt von
|
||||||
created_on: Erstellt am
|
created_on: Erstellt am
|
||||||
|
@ -267,6 +272,7 @@ de:
|
||||||
stock_article: Lagerartikel
|
stock_article: Lagerartikel
|
||||||
stock_taking: Inventur
|
stock_taking: Inventur
|
||||||
supplier: Lieferant
|
supplier: Lieferant
|
||||||
|
supplier_category: Lieferantenkategorie
|
||||||
task: Aufgabe
|
task: Aufgabe
|
||||||
user: Benutzerinnen
|
user: Benutzerinnen
|
||||||
workgroup: Arbeitsgruppe
|
workgroup: Arbeitsgruppe
|
||||||
|
@ -328,8 +334,11 @@ de:
|
||||||
first_paragraph: Hier kannst du die Kontotransaktionsklassen und die dazugehörigen Kontotransaktionstypen verwalten. Jede Finanztansaktion hat einen bestimmten Typ, den du bei jeder Transaktion auswählen muss, falls du mehr als einen Typ angelegt hast. Die Kontotransaktionsklassen können zur Gruppierung der Kontotransaktionstypen verwendet werden und werden in der Kontoübersicht als weitere Spalten angezeigt, falls mehrere angelegt wurden.
|
first_paragraph: Hier kannst du die Kontotransaktionsklassen und die dazugehörigen Kontotransaktionstypen verwalten. Jede Finanztansaktion hat einen bestimmten Typ, den du bei jeder Transaktion auswählen muss, falls du mehr als einen Typ angelegt hast. Die Kontotransaktionsklassen können zur Gruppierung der Kontotransaktionstypen verwendet werden und werden in der Kontoübersicht als weitere Spalten angezeigt, falls mehrere angelegt wurden.
|
||||||
new_bank_account: Neues Bankkonto anlegen
|
new_bank_account: Neues Bankkonto anlegen
|
||||||
new_financial_transaction_class: Neue Kontotransaktionsklasse anlegen
|
new_financial_transaction_class: Neue Kontotransaktionsklasse anlegen
|
||||||
|
new_bank_gateway: Neuen Bank Gateway anlegen
|
||||||
title: Finanzen
|
title: Finanzen
|
||||||
transaction_types: Kontotransaktionstypen
|
transaction_types: Kontotransaktionstypen
|
||||||
|
supplier_categories: Lieferantenkategorien
|
||||||
|
new_supplier_category: Neue Lieferantenkategorie anlegen
|
||||||
transaction_types:
|
transaction_types:
|
||||||
name: Name
|
name: Name
|
||||||
new_financial_transaction_type: Neuen Kontotransaktionstyp anlegen
|
new_financial_transaction_type: Neuen Kontotransaktionstyp anlegen
|
||||||
|
@ -428,6 +437,10 @@ de:
|
||||||
workgroups:
|
workgroups:
|
||||||
members: Mitglieder
|
members: Mitglieder
|
||||||
name: Name
|
name: Name
|
||||||
|
supplier_categories:
|
||||||
|
form:
|
||||||
|
title_new: Neue Lieferantenkategorie anlegen
|
||||||
|
title_edit: Lieferantenkategorie bearbeiten
|
||||||
application:
|
application:
|
||||||
controller:
|
controller:
|
||||||
error_authn: Anmeldung erforderlich!
|
error_authn: Anmeldung erforderlich!
|
||||||
|
|
|
@ -193,6 +193,11 @@ en:
|
||||||
phone2: Phone 2
|
phone2: Phone 2
|
||||||
shared_sync_method: How to synchronize
|
shared_sync_method: How to synchronize
|
||||||
url: Homepage
|
url: Homepage
|
||||||
|
supplier_category:
|
||||||
|
name: Name
|
||||||
|
description: Description
|
||||||
|
financial_transaction_class: Financial transacton class
|
||||||
|
bank_account: Bank account
|
||||||
task:
|
task:
|
||||||
created_by: Created by
|
created_by: Created by
|
||||||
created_on: Created at
|
created_on: Created at
|
||||||
|
@ -267,6 +272,7 @@ en:
|
||||||
stock_article: Stock article
|
stock_article: Stock article
|
||||||
stock_taking: Stock taking
|
stock_taking: Stock taking
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
|
supplier_category: Supplier category
|
||||||
task: Task
|
task: Task
|
||||||
user: User
|
user: User
|
||||||
workgroup: Workgroup
|
workgroup: Workgroup
|
||||||
|
@ -328,8 +334,11 @@ en:
|
||||||
first_paragraph: Here you can manage the financial transaction classes and the corresponding financial transaction types. Every financial transaction has a type, which you have to select at every transaction, if you created more than one type. The financial transaction classes can be use to group the financial transaction types and will be shown as additional columns in the account overview, if there have been created more than one.
|
first_paragraph: Here you can manage the financial transaction classes and the corresponding financial transaction types. Every financial transaction has a type, which you have to select at every transaction, if you created more than one type. The financial transaction classes can be use to group the financial transaction types and will be shown as additional columns in the account overview, if there have been created more than one.
|
||||||
new_bank_account: Add new bank account
|
new_bank_account: Add new bank account
|
||||||
new_financial_transaction_class: Add new financial transaction class
|
new_financial_transaction_class: Add new financial transaction class
|
||||||
|
new_bank_gateway: Add new bank gateway
|
||||||
title: Finances
|
title: Finances
|
||||||
transaction_types: Financial transaction types
|
transaction_types: Financial transaction types
|
||||||
|
supplier_categories: Supplier categories
|
||||||
|
new_supplier_category: New supplier category
|
||||||
transaction_types:
|
transaction_types:
|
||||||
name: Name
|
name: Name
|
||||||
new_financial_transaction_type: Add new financial transaction type
|
new_financial_transaction_type: Add new financial transaction type
|
||||||
|
@ -428,6 +437,10 @@ en:
|
||||||
workgroups:
|
workgroups:
|
||||||
members: members
|
members: members
|
||||||
name: name
|
name: name
|
||||||
|
supplier_categories:
|
||||||
|
form:
|
||||||
|
title_new: Add supplier category
|
||||||
|
title_edit: Edit supplier category
|
||||||
application:
|
application:
|
||||||
controller:
|
controller:
|
||||||
error_authn: Authentication required!
|
error_authn: Authentication required!
|
||||||
|
|
|
@ -226,12 +226,14 @@ Rails.application.routes.draw do
|
||||||
get :update_bank_accounts, on: :collection
|
get :update_bank_accounts, on: :collection
|
||||||
get :update_bank_gateways, on: :collection
|
get :update_bank_gateways, on: :collection
|
||||||
get :update_transaction_types, on: :collection
|
get :update_transaction_types, on: :collection
|
||||||
|
get :update_supplier_categories, on: :collection
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :bank_accounts
|
resources :bank_accounts
|
||||||
resources :bank_gateways
|
resources :bank_gateways
|
||||||
resources :financial_transaction_classes
|
resources :financial_transaction_classes
|
||||||
resources :financial_transaction_types
|
resources :financial_transaction_types
|
||||||
|
resources :supplier_categories
|
||||||
|
|
||||||
resources :users do
|
resources :users do
|
||||||
post :restore, on: :member
|
post :restore, on: :member
|
||||||
|
|
Loading…
Reference in a new issue