Change view headers; add useful contextual information
This commit is contained in:
parent
2dca39e38d
commit
6634eeae55
95
stoptime.rb
95
stoptime.rb
|
@ -702,8 +702,11 @@ module StopTime::Controllers
|
||||||
# Views#overview.
|
# Views#overview.
|
||||||
def get
|
def get
|
||||||
@tasks = {}
|
@tasks = {}
|
||||||
|
@task_count = 0
|
||||||
Customer.all.each do |customer|
|
Customer.all.each do |customer|
|
||||||
@tasks[customer] = customer.unbilled_tasks.sort_by { |t| t.name }
|
tasks = customer.unbilled_tasks.sort_by { |t| t.name }
|
||||||
|
@tasks[customer] = tasks
|
||||||
|
@task_count += tasks.count
|
||||||
end
|
end
|
||||||
render :overview
|
render :overview
|
||||||
end
|
end
|
||||||
|
@ -1161,6 +1164,7 @@ module StopTime::Controllers
|
||||||
@hourly_rate_tasks[task] = time_entries
|
@hourly_rate_tasks[task] = time_entries
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@none_found = @hourly_rate_tasks.empty? and @fixed_cost_tasks.empty?
|
||||||
render :invoice_select_form
|
render :invoice_select_form
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1307,11 +1311,15 @@ module StopTime::Controllers
|
||||||
# them using Views#invoices.
|
# them using Views#invoices.
|
||||||
def get
|
def get
|
||||||
@invoices = {}
|
@invoices = {}
|
||||||
|
@invoice_count = 0
|
||||||
Customer.all.each do |customer|
|
Customer.all.each do |customer|
|
||||||
@invoices[customer.name] = customer.invoices
|
invoices = customer.invoices
|
||||||
customer.invoices.each do |i|
|
next if invoices.empty?
|
||||||
|
@invoices[customer.name] = invoices
|
||||||
|
invoices.each do |i|
|
||||||
@input["paid_#{i.number}"] = true if i.paid?
|
@input["paid_#{i.number}"] = true if i.paid?
|
||||||
end
|
end
|
||||||
|
@invoice_count += invoices.count
|
||||||
end
|
end
|
||||||
render :invoices
|
render :invoices
|
||||||
end
|
end
|
||||||
|
@ -1445,9 +1453,10 @@ module StopTime::Views
|
||||||
|
|
||||||
# The main overview showing accumulated time per task per customer.
|
# The main overview showing accumulated time per task per customer.
|
||||||
def overview
|
def overview
|
||||||
header do
|
header.page_header do
|
||||||
div.container do
|
h1 do
|
||||||
h2 "Overview"
|
text! "Overview"
|
||||||
|
small "#{@tasks.count} customers, #{@task_count} active projects/tasks"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
div.row do
|
div.row do
|
||||||
|
@ -1500,11 +1509,14 @@ module StopTime::Views
|
||||||
# it will be assumed it is used as a partial view.
|
# it will be assumed it is used as a partial view.
|
||||||
# FIXME: This should be done in a nicer way.
|
# FIXME: This should be done in a nicer way.
|
||||||
def time_entries(task_id=nil)
|
def time_entries(task_id=nil)
|
||||||
header do
|
if task_id.present?
|
||||||
if task_id.present?
|
h2 "Registered #{@task.billed? ? "billed" : "unbilled"} time"
|
||||||
h2 "Registered #{@task.billed? ? "billed" : "unbilled"} time"
|
else
|
||||||
else
|
header.page_header do
|
||||||
h2 "Timeline"
|
h1 do
|
||||||
|
text! "Timeline"
|
||||||
|
small "#{@time_entries.count} time entries"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.table.table_condensed.table_striped.table_hover do
|
table.table.table_condensed.table_striped.table_hover do
|
||||||
|
@ -1591,8 +1603,11 @@ module StopTime::Views
|
||||||
|
|
||||||
# Form for editing a time entry (Models::TimeEntry).
|
# Form for editing a time entry (Models::TimeEntry).
|
||||||
def time_entry_form
|
def time_entry_form
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Time Entry Information"
|
h1 do
|
||||||
|
text! "Time Entry Information"
|
||||||
|
small @input["comment"]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
div.alert do
|
div.alert do
|
||||||
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
||||||
|
@ -1645,8 +1660,8 @@ module StopTime::Views
|
||||||
|
|
||||||
# The main overview of the list of customers.
|
# The main overview of the list of customers.
|
||||||
def customers
|
def customers
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Customers"
|
h1 "Customers"
|
||||||
end
|
end
|
||||||
if @customers.empty?
|
if @customers.empty?
|
||||||
p do
|
p do
|
||||||
|
@ -1718,9 +1733,15 @@ module StopTime::Views
|
||||||
# for adding/editing/deleting tasks and showing a list of invoices for
|
# for adding/editing/deleting tasks and showing a list of invoices for
|
||||||
# the customer.
|
# the customer.
|
||||||
def customer_form
|
def customer_form
|
||||||
|
header.page_header do
|
||||||
|
h1 do
|
||||||
|
text! "Customer Information"
|
||||||
|
small @input["name"]
|
||||||
|
end
|
||||||
|
end
|
||||||
div.row do
|
div.row do
|
||||||
div.span6 do
|
div.span6 do
|
||||||
h2 "Customer Information"
|
h2 "Details"
|
||||||
form.form_horizontal.form_condensed :action => R(*@target), :method => :post do
|
form.form_horizontal.form_condensed :action => R(*@target), :method => :post do
|
||||||
_form_input_with_label("Name", "name", :text)
|
_form_input_with_label("Name", "name", :text)
|
||||||
_form_input_with_label("Short name", "short_name", :text)
|
_form_input_with_label("Short name", "short_name", :text)
|
||||||
|
@ -1774,8 +1795,11 @@ module StopTime::Views
|
||||||
|
|
||||||
# Form for updating the properties of a task (Models::Task).
|
# Form for updating the properties of a task (Models::Task).
|
||||||
def task_form
|
def task_form
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Task Information"
|
h1 do
|
||||||
|
text! "Task Information"
|
||||||
|
small @task.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
div.alert do
|
div.alert do
|
||||||
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
||||||
|
@ -1831,8 +1855,11 @@ module StopTime::Views
|
||||||
|
|
||||||
# The main overview of the existing invoices.
|
# The main overview of the existing invoices.
|
||||||
def invoices
|
def invoices
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Invoices"
|
h1 do
|
||||||
|
text! "Invoices"
|
||||||
|
small "#{@invoices.count} customers, #{@invoice_count} invoices"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
div.row do
|
div.row do
|
||||||
div.span7 do
|
div.span7 do
|
||||||
|
@ -1856,8 +1883,8 @@ module StopTime::Views
|
||||||
# invoice (Models::Invoice) that also allows for updating the "+paid+"
|
# invoice (Models::Invoice) that also allows for updating the "+paid+"
|
||||||
# property.
|
# property.
|
||||||
def invoice_form
|
def invoice_form
|
||||||
header do
|
header.page_header do
|
||||||
h2 do
|
h1 do
|
||||||
text! "Invoice for "
|
text! "Invoice for "
|
||||||
a @customer.name, :href => R(CustomersN, @customer.id)
|
a @customer.name, :href => R(CustomersN, @customer.id)
|
||||||
end
|
end
|
||||||
|
@ -1991,15 +2018,23 @@ module StopTime::Views
|
||||||
# Form for selecting fixed cost tasks and registered time for tasks with
|
# Form for selecting fixed cost tasks and registered time for tasks with
|
||||||
# an hourly rate that need to be billed.
|
# an hourly rate that need to be billed.
|
||||||
def invoice_select_form
|
def invoice_select_form
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Registered Time"
|
h1 do
|
||||||
|
text! "Create Invoice for "
|
||||||
|
a @customer.name, :href => R(CustomersN, @customer.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
div.row do
|
div.row do
|
||||||
div.span10 do
|
div.span10 do
|
||||||
|
if @none_found
|
||||||
|
div.alert.alert_info do
|
||||||
|
"No fixed costs tasks or tasks with an hourly rate found!"
|
||||||
|
end
|
||||||
|
end
|
||||||
form.form_horizontal :action => R(CustomersNInvoices, @customer.id),
|
form.form_horizontal :action => R(CustomersNInvoices, @customer.id),
|
||||||
:method => :post do
|
:method => :post do
|
||||||
h3 "Projects/Tasks with an Hourly Rate"
|
|
||||||
unless @hourly_rate_tasks.empty?
|
unless @hourly_rate_tasks.empty?
|
||||||
|
h3 "Projects/Tasks with an Hourly Rate"
|
||||||
table.table.table_striped.table_condensed do
|
table.table.table_striped.table_condensed do
|
||||||
col.flag
|
col.flag
|
||||||
col.date
|
col.date
|
||||||
|
@ -2084,7 +2119,8 @@ module StopTime::Views
|
||||||
|
|
||||||
div.form_actions do
|
div.form_actions do
|
||||||
button.btn.btn_primary "Create invoice", :type => :submit,
|
button.btn.btn_primary "Create invoice", :type => :submit,
|
||||||
:name => "create", :value => "Create invoice"
|
:name => "create", :value => "Create invoice",
|
||||||
|
:disabled => @none_found
|
||||||
button.btn "Cancel", :type => :submit,
|
button.btn "Cancel", :type => :submit,
|
||||||
:name => "cancel", :value => "Cancel"
|
:name => "cancel", :value => "Cancel"
|
||||||
end
|
end
|
||||||
|
@ -2095,8 +2131,11 @@ module StopTime::Views
|
||||||
|
|
||||||
# Form for editing the company information stored in Models::CompanyInfo.
|
# Form for editing the company information stored in Models::CompanyInfo.
|
||||||
def company_form
|
def company_form
|
||||||
header do
|
header.page_header do
|
||||||
h2 "Company Information"
|
h1 do
|
||||||
|
text! "Company Information"
|
||||||
|
small @company.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
div.alert.alert_error.alert_block do
|
div.alert.alert_error.alert_block do
|
||||||
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
button.close(:type => "button", "data-dismiss" => "alert") { "×" }
|
||||||
|
|
Loading…
Reference in New Issue