summaryrefslogtreecommitdiff
path: root/app/views/tenants
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tenants')
-rw-r--r--app/views/tenants/_admin_area.de.html.haml118
-rw-r--r--app/views/tenants/_admin_area.html.haml116
-rw-r--r--app/views/tenants/_form.html.haml24
-rw-r--r--app/views/tenants/_form_core.html.haml3
-rw-r--r--app/views/tenants/_index_core.html.haml17
-rw-r--r--app/views/tenants/edit.html.haml3
-rw-r--r--app/views/tenants/index.html.haml6
-rw-r--r--app/views/tenants/new.html.haml3
-rw-r--r--app/views/tenants/show.html.haml14
9 files changed, 304 insertions, 0 deletions
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
new file mode 100644
index 0000000..b9b47d5
--- /dev/null
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -0,0 +1,118 @@
+%p
+ Sie sind Mitglied der
+ = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins'))
+ und haben deshalb besondere Rechte. Aber wie Peter Parker schon sagte: "With great power comes great responsibility."
+
+%p
+ Dieser Mandant hat
+ = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant)
+ - if @tenant.user_groups.count < 5
+ = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})"
+ die in Summe
+ = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant)
+ verwalten.
+ Das System kann
+ = PhoneModel.count
+ verschiedene Telefonmodelle von den folgenden Herstellern verwalten:
+ - Manufacturer.all.each do |manufacturer|
+ - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ', ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ' und ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - else
+ = succeed '.' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+
+%h3 SIP-Konten und Telefone
+
+%table
+ %tr{:class => 'even'}
+ %th
+ %th
+ = @tenant
+ %th
+ Alle Benutzer von
+ = "\"#{@tenant}\""
+ %tr{:class => 'odd'}
+ %td
+ SIP-Konten
+ %td
+ = link_to @tenant.sip_accounts.count.to_s, tenant_sip_accounts_path(@tenant)
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => SipAccount}
+ %td= @tenant.users_sip_accounts.count.to_s
+ %tr{:class => 'even'}
+ %td
+ Telefone
+ %td
+ = link_to @tenant.phones.count.to_s, tenant_phones_path(@tenant)
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Phone}
+ %td= @tenant.users_phones.count.to_s
+
+%h3 Allgemein
+
+%table
+ %tr{:class => 'even'}
+ %th
+ Funktion
+ %th
+ Anzahl
+ %th
+ %tr{:class => 'odd'}
+ %td
+ Callthrough
+ %td
+ = link_to @tenant.callthroughs.count.to_s, tenant_callthroughs_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Callthrough}
+ %tr{:class => 'even'}
+ %td
+ Konferenzen
+ %td
+ = link_to @tenant.conferences.count.to_s, tenant_conferences_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Conference}
+ %tr{:class => 'odd'}
+ %td
+ Rufgruppen
+ %td
+ = link_to @tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => HuntGroup}
+ %tr{:class => 'even'}
+ %td
+ Warteschleifen
+ %td
+ = link_to @tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => AutomaticCallDistributor}
+ %tr{:class => 'odd'}
+ %td
+ Oberflächen-Funktionen
+ %td
+ = link_to GuiFunction.count.to_s, gui_functions_path
+ %td
+
+-# Phone books
+-#
+- if GuiFunction.display?('show_phone_books_in_user_show_view', current_user)
+ - if can?( :index, PhoneBook )
+ %h2=t("phone_books.index.page_title")
+ = render "phone_books/index_core", :phone_books => @tenant.phone_books
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook}
+
+- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ %h3= t('phone_number_ranges.index.page_title')
+
+ - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0
+ Der Mandant
+ = "\"#{@tenant}\""
+ wurde erst vor
+ = distance_of_time_in_words_to_now(@tenant.created_at)
+ erstellt. Es gibt immer noch nicht abgeschlossene
+ = pluralize(Delayed::Job.count, 'Hintergrundprozesse')
+ \. Bitte warten Sie noch ein paar Minuten und laden anschließend diese Seite erneut.
+ - else
+ =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => SERVICE_NUMBERS))
+ =render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneNumberRange}
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml
new file mode 100644
index 0000000..d648143
--- /dev/null
+++ b/app/views/tenants/_admin_area.html.haml
@@ -0,0 +1,116 @@
+%p
+ You belong to the
+ = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins'))
+ and therefore have super powers. But always remember Peter Parker's: "With great power comes great responsibility."
+
+%p
+ = succeed '.' do
+ This tenant has
+ = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant)
+ - if @tenant.user_groups.count < 5
+ = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})"
+ which handle a total of
+ = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant)
+ This system can setup
+ = PhoneModel.count
+ different phone models from the manufacturers
+ - Manufacturer.all.each do |manufacturer|
+ - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ', ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ' and ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - else
+ = succeed '.' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+
+%h3 SIP-Accounts and Phones
+
+%table
+ %tr{:class => 'even'}
+ %th
+ %th
+ = @tenant
+ %th
+ All users of
+ = "\"#{@tenant}\""
+ %tr{:class => 'odd'}
+ %td
+ SIP accounts
+ %td
+ = link_to @tenant.sip_accounts.count.to_s, tenant_sip_accounts_path(@tenant)
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => SipAccount}
+ %td= @tenant.users_sip_accounts.count.to_s
+ %tr{:class => 'even'}
+ %td
+ Phones
+ %td
+ = link_to @tenant.phones.count.to_s, tenant_phones_path(@tenant)
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Phone}
+ %td= @tenant.users_phones.count.to_s
+
+%h3 Misc
+
+%table
+ %tr{:class => 'even'}
+ %th
+ Feature
+ %th
+ Counter
+ %th
+ %tr{:class => 'odd'}
+ %td
+ Callthroughs
+ %td
+ = link_to @tenant.callthroughs.count.to_s, tenant_callthroughs_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Callthrough}
+ %tr{:class => 'even'}
+ %td
+ Conferences
+ %td
+ = link_to @tenant.conferences.count.to_s, tenant_conferences_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Conference}
+ %tr{:class => 'odd'}
+ %td
+ Hunt groups
+ %td
+ = link_to @tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => HuntGroup}
+ %tr{:class => 'even'}
+ %td
+ ACDs
+ %td
+ = link_to @tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(@tenant)
+ %td
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => AutomaticCallDistributor}
+ %tr{:class => 'odd'}
+ %td
+ GUI functions
+ %td
+ = link_to GuiFunction.count.to_s, gui_functions_path
+ %td
+
+-# Phone books
+-#
+- if GuiFunction.display?('show_phone_books_in_user_show_view', current_user)
+ - if can?( :index, PhoneBook )
+ %h2=t("phone_books.index.page_title")
+ = render "phone_books/index_core", :phone_books => @tenant.phone_books
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook}
+
+- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ %h3= t('phone_number_ranges.index.page_title')
+
+ - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0
+ This tenant was created
+ = distance_of_time_in_words_to_now(@tenant.created_at)
+ ago. There are still
+ = pluralize(Delayed::Job.count, 'background job')
+ not finished. This can take a couple of minutes. Please reload this page later.
+ - else
+ =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => SERVICE_NUMBERS))
+ =render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneNumberRange}
diff --git a/app/views/tenants/_form.html.haml b/app/views/tenants/_form.html.haml
new file mode 100644
index 0000000..2ca8a69
--- /dev/null
+++ b/app/views/tenants/_form.html.haml
@@ -0,0 +1,24 @@
+= simple_form_for(@tenant) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ = f.association :country, :label => t('tenants.form.country_id.label'), :hint => conditional_hint('tenants.form.country_id.hint'), :include_blank => false
+ = f.association :language, :label => t('tenants.form.language_id.label'), :hint => conditional_hint('tenants.form.language_id.hint'), :include_blank => false
+
+ = f.association :sip_domain, :label => t('tenants.form.sip_domain.label'), :hint => conditional_hint('tenants.form.sip_domain.hint'), :include_blank => false
+
+ = f.input :from_field_voicemail_email, :label => t('tenants.form.from_field_voicemail_email.label'), :hint => conditional_hint('tenants.form.from_field_voicemail_email.hint')
+ = f.input :from_field_pin_change_email, :label => t('tenants.form.from_field_pin_change_email.label'), :hint => conditional_hint('tenants.form.from_field_pin_change_email.hint')
+
+ - if STRICT_INTERNAL_EXTENSION_HANDLING == true || STRICT_DID_HANDLING == true
+ %h2= t('tenants.form.phone_numbers')
+ %p= t('tenants.form.intro')
+
+ - if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ = f.input :internal_extension_ranges, :label => t('tenants.form.internal_extension_ranges.label'), :hint => conditional_hint('tenants.form.internal_extension_ranges.hint')
+ - if STRICT_DID_HANDLING == true
+ = f.input :did_list, :label => t('tenants.form.did_list.label'), :hint => conditional_hint('tenants.form.did_list.hint')
+
+ .actions
+ = f.button :submit, conditional_t('tenants.form.submit') \ No newline at end of file
diff --git a/app/views/tenants/_form_core.html.haml b/app/views/tenants/_form_core.html.haml
new file mode 100644
index 0000000..4eb2ccc
--- /dev/null
+++ b/app/views/tenants/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :name, :label => t('tenants.form.name.label'), :hint => conditional_hint('tenants.form.name.hint')
+ = f.input :description, :label => t('tenants.form.description.label'), :hint => conditional_hint('tenants.form.description.hint')
diff --git a/app/views/tenants/_index_core.html.haml b/app/views/tenants/_index_core.html.haml
new file mode 100644
index 0000000..60afeee
--- /dev/null
+++ b/app/views/tenants/_index_core.html.haml
@@ -0,0 +1,17 @@
+%table
+ %tr
+ %th= t('tenants.index.name')
+ %th= t('tenants.index.description')
+
+ - reset_cycle
+ - for tenant in tenants
+ %tr{:class => cycle('odd', 'even')}
+ %td= tenant.name
+ %td= tenant.description
+ %td
+ - if current_user && current_user.current_tenant != tenant && current_user.tenants.include?(tenant)
+ = simple_form_for([current_user.current_tenant, current_user]) do |f|
+ = f.hidden_field :current_tenant_id, :value => tenant.id
+ .actions
+ = f.button :submit, conditional_t('tenants.switch_to_tenant')
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => tenant} \ No newline at end of file
diff --git a/app/views/tenants/edit.html.haml b/app/views/tenants/edit.html.haml
new file mode 100644
index 0000000..159f4fd
--- /dev/null
+++ b/app/views/tenants/edit.html.haml
@@ -0,0 +1,3 @@
+- title t("tenants.edit.page_title", :resource => @tenant )
+
+= render "form"
diff --git a/app/views/tenants/index.html.haml b/app/views/tenants/index.html.haml
new file mode 100644
index 0000000..1783825
--- /dev/null
+++ b/app/views/tenants/index.html.haml
@@ -0,0 +1,6 @@
+- title t("tenants.index.page_title")
+
+- if @tenants.count > 0
+ = render "index_core", :tenants => @tenants
+
+= render :partial => 'shared/create_link', :locals => {:child_class => Tenant} \ No newline at end of file
diff --git a/app/views/tenants/new.html.haml b/app/views/tenants/new.html.haml
new file mode 100644
index 0000000..dca3809
--- /dev/null
+++ b/app/views/tenants/new.html.haml
@@ -0,0 +1,3 @@
+- title t("tenants.new.page_title")
+
+= render "form"
diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml
new file mode 100644
index 0000000..cb2b895
--- /dev/null
+++ b/app/views/tenants/show.html.haml
@@ -0,0 +1,14 @@
+- title t("tenants.show.page_title")
+
+%p
+ %strong= t('tenants.show.name') + ":"
+ = @tenant.name
+- if !@tenant.description.blank?
+ %p
+ %strong= t('tenants.show.description') + ":"
+ = @tenant.description
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant }
+
+- if @tenant.user_groups.where(:name => 'Admins').count > 0 && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user)
+ = render 'admin_area' \ No newline at end of file