show supplier user-interface update

This commit is contained in:
wvengen 2014-02-24 14:33:05 +01:00
parent 0014435663
commit 0fa9bebac9
11 changed files with 94 additions and 60 deletions

View file

@ -11,6 +11,7 @@ class SuppliersController < ApplicationController
def show
@supplier = Supplier.find(params[:id])
@deliveries = @supplier.deliveries.recent
@orders = @supplier.orders.recent
end
# new supplier

View file

@ -31,6 +31,8 @@ class Order < ActiveRecord::Base
scope :closed, -> { where(state: 'closed').order('ends DESC') }
scope :stockit, -> { where(supplier_id: 0).order('ends DESC') }
scope :recent, -> { order('starts DESC').limit(10) }
def stockit?
supplier_id == 0
end

View file

@ -8,7 +8,7 @@
%th= t('.name')
%th= t('.end')
%th= t('.state')
%th= t('.last_edited_by')
%th= heading_helper Order, :updated_by
%th
%tbody
- @orders.each do |order|

View file

@ -1,55 +0,0 @@
- title @supplier.name
.row-fluid
.span6
- if shared_supplier = @supplier.shared_supplier
.alert.alert-info
= t 'suppliers.shared_supplier_note'
%dl.dl-horizontal
%dt= heading_helper(Supplier, :address) + ':'
%dd= @supplier.address
%dt= heading_helper(Supplier, :phone) + ':'
%dd= @supplier.phone
%dt= heading_helper(Supplier, :phone2) + ':'
%dd= @supplier.phone2
%dt= heading_helper(Supplier, :fax) + ':'
%dd= @supplier.fax
%dt= heading_helper(Supplier, :email) + ':'
%dd= @supplier.email
%dt= heading_helper(Supplier, :url) + ':'
%dd= link_to @supplier.url, @supplier.url
%dt= heading_helper(Supplier, :contact_person) + ':'
%dd= @supplier.contact_person
%dt= heading_helper(Supplier, :customer_number) + ':'
%dd= @supplier.customer_number
%dt= heading_helper(Supplier, :delivery_days) + ':'
%dd= @supplier.delivery_days
%dt= heading_helper(Supplier, :order_howto) + ':'
%dd= @supplier.order_howto
%dt= heading_helper(Supplier, :note) + ':'
%dd= @supplier.note
%dt= heading_helper(Supplier, :min_order_quantity) + ':'
%dd= @supplier.min_order_quantity
.clearfix
- if @current_user.role_suppliers?
.form-actions
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
= link_to t('ui.delete'), @supplier, :data => {:confirm => t('.confirm_delete')}, :method => :delete, class: 'btn btn-danger'
.span6
%h2= t '.last_deliveries'
%table.table.table-horizontal
%thead
%tr
%th= heading_helper Delivery, :date
%th= heading_helper Delivery, :amount
%tbody
- for delivery in @deliveries
%tr
%td= link_to delivery.delivered_on, [@supplier, delivery]
%td= link_to_invoice(delivery)
.form-actions
= link_to t('.new_delivery'), new_supplier_delivery_path(@supplier), class: 'btn'
= link_to t('.show_deliveries'), supplier_deliveries_path(@supplier)

View file

@ -0,0 +1,85 @@
- title @supplier.name
- content_for :actionbar do
= link_to t('suppliers.index.articles', count: @supplier.articles.undeleted.count), supplier_articles_path(@supplier), class: 'btn'
- if @supplier.stock_articles.undeleted.count > 0
= link_to t('suppliers.index.stock', count: @supplier.stock_articles.undeleted.count), stock_articles_path, class: 'btn'
.row-fluid
.span6
- if shared_supplier = @supplier.shared_supplier
.alert.alert-info
= t 'suppliers.shared_supplier_note'
%dl.dl-horizontal
%dt= heading_helper(Supplier, :address) + ':'
%dd= @supplier.address
%dt= heading_helper(Supplier, :phone) + ':'
%dd= @supplier.phone
%dt= heading_helper(Supplier, :phone2) + ':'
%dd= @supplier.phone2
%dt= heading_helper(Supplier, :fax) + ':'
%dd= @supplier.fax
%dt= heading_helper(Supplier, :email) + ':'
%dd= @supplier.email
%dt= heading_helper(Supplier, :url) + ':'
%dd= link_to @supplier.url, @supplier.url
%dt= heading_helper(Supplier, :contact_person) + ':'
%dd= @supplier.contact_person
%dt= heading_helper(Supplier, :customer_number) + ':'
%dd= @supplier.customer_number
%dt= heading_helper(Supplier, :delivery_days) + ':'
%dd= @supplier.delivery_days
%dt= heading_helper(Supplier, :order_howto) + ':'
%dd= @supplier.order_howto
%dt= heading_helper(Supplier, :note) + ':'
%dd= @supplier.note
%dt= heading_helper(Supplier, :min_order_quantity) + ':'
%dd= @supplier.min_order_quantity
.clearfix
- if @current_user.role_suppliers?
.form-actions
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
= link_to t('ui.delete'), @supplier, :data => {:confirm => t('.confirm_delete')}, :method => :delete, class: 'btn btn-danger'
- if @deliveries.count > 0
.span6
.pull-right
= link_to t('.show_deliveries'), supplier_deliveries_path(@supplier), class: 'btn'
= link_to t('.new_delivery'), new_supplier_delivery_path(@supplier), class: 'btn'
%h2= t '.last_deliveries'
%table.table.table-horizontal
%thead
%tr
%th= heading_helper Delivery, :date
%th= heading_helper Delivery, :amount
%tbody
- for delivery in @deliveries
%tr
%td= link_to delivery.delivered_on, [@supplier, delivery]
%td= link_to_invoice(delivery)
- if @orders.count > 0
.span6
%h2= t '.last_orders'
%table.table.table-horizontal
%thead
%tr
%th= heading_helper Order, :starts
%th= heading_helper Order, :ends
%th= heading_helper Order, :status
%th= heading_helper Order, :updated_by
%tbody
- for order in @orders
%tr
- if current_user.role_orders?
%td= link_to format_time(order.starts), order_path(order)
- else
%td= format_time(order.starts)
%td= format_time(order.ends) unless order.ends.nil?
- if current_user.role_finance? and not order.open?
%td= link_to I18n.t("orders.state.#{order.state}"), new_finance_order_path(order_id: order.id)
- else
%td= I18n.t("orders.state.#{order.state}")
%td= show_user(order.updated_by)

View file

@ -79,6 +79,7 @@ en:
starts: Starts at
status: Status
supplier: Supplier
updated_by: Last edited by
order_article:
article: Article
missing_units: Missing units
@ -559,7 +560,6 @@ en:
confirm: Do you really want to settle the order?
end: End
ended: closed
last_edited_by: Last edited by
name: Supplier
no_closed_orders: At the moment there are no closed orders.
state: State
@ -1430,9 +1430,10 @@ en:
title: External lists
show:
confirm_delete: Are you sure?
last_deliveries: Last deliveries
new_delivery: Create new delivery
show_deliveries: Show all deliveries
last_deliveries: Recent deliveries
last_orders: Last orders
new_delivery: New delivery
show_deliveries: Show all
update:
notice: Supplier was updated
tasks: