summaryrefslogtreecommitdiff
path: root/app/views/switchboards/show.html.erb
blob: 3bc4da41f7c3c58b599f9944ed684ae53311df41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<% content_for :title, "Switchboard #{@switchboard.name}" %>

<script>
  var switchboard_id = <%= @switchboard.id %>;
  var show_avatars = <%= @switchboard.show_avatars.to_s %>;
  var reload_interval = <%= @switchboard.reload_interval.nil? ? 0 : @switchboard.reload_interval %>;
  var amount_of_displayed_phone_numbers = <%= @switchboard.amount_of_displayed_phone_numbers %>;
</script>

<div class='row'>
  <div class='span12'>
    <div id='emberjs-container'></div>

    <script type="text/x-handlebars">
      {{outlet}}
    </script>

    <script type="text/x-handlebars" data-template-name="switchboard">
      {{#if activeCalls.length}}
        {{#each activeCall in activeCalls}}
          <div {{bindAttr class=":alert activeCall.isActive:alert-success"}}>
            {{#if activeCall.isRinging}}<i class="icon-bell"></i> Neuer {{/if}}
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            Anruf von {{activeCall.b_caller_id_number}} an {{activeCall.destination}} ({{from_now activeCall.start_stamp}}).
          </div>
        {{/each}}
      {{/if}}


      {{#if switchboardEntrys.length}}
        <ul class="thumbnails">
          {{#each switchboardEntry in switchboardEntrys}}
            <li class="span2">
              <div class="thumbnail">
                {{#if switchboardEntry.switchboard.show_avatars}}
                  {{avatar_img switchboardEntry.avatar_src}}
                {{/if}}
                <small>
                <p></p>
                  {{#if switchboardEntry.name}}
                    <p class="text-center">
                      <span class="label">{{switchboardEntry.name}}</span>
                    </p>
                  {{/if}}

                  {{#if switchboardEntry.sipAccount.is_registrated}}
                    {{#if switchboardEntry.switchable}}
                      <p>
                      {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
                        <span class="label">
                          {{phoneNumber.number}}
                        </span>
                      {{/each}}
                      </p>
                    {{else}}
                      <p>
                      {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
                        <span class="label">
                          {{phoneNumber.number}}
                        </span>

                        {{#if dispatchableIncomingCalls.length}}
                          <p>
                            {{#each dispatchableIncomingCall in dispatchableIncomingCalls}}
                              {{#if switchboardEntry.switchboard.blind_transfer_activated}}
                                <button {{action transfer_blind dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Transfer</button>
                              {{/if}}
                              {{#if switchboardEntry.switchboard.attended_transfer_activated}}
                                <button {{action transfer_attended dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Attended Transfer</button>
                              {{/if}}
                            {{/each}}
                          </p>
                        {{/if}}
                      {{/each}}
                      </p>
                    {{/if}}

                    {{#if switchboardEntry.sipAccount.calls.length}}
                      <p>
                        {{#each call in switchboardEntry.sipAccount.calls}}
                          <span {{bindAttr class=":label call.isRinging:label-warning:label-success"}}>
                            {{#if call.isRinging}}<i class="icon-bell icon-white"></i>{{/if}}
                            von {{call.b_caller_id_number}} an {{call.destination}}
                          </span>
                        {{/each}}
                      </p>
                    {{/if}}
                {{else}}
                  <p>
                    {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
                      <span class="label">
                        {{phoneNumber.number}}
                      </span>
                    {{/each}}
                  </p>

                  <p>
                    <span class="label label-warning">
                      offline
                    </span>
                  </p>
                {{/if}}
                </small>
              </div>
            </li>
          {{/each}}
        </ul>
      {{/if}}
    </script>

  </div>
</div>

<script src="/js/libs/moment/moment.min.js"></script>
<script src="/js/libs/moment/lang/de.js"></script>
<script src="/js/libs/handlebars.js"></script>
<script src="/js/libs/ember.js"></script>
<script src="/js/libs/ember-data.js"></script>
<script src="/js/app.js"></script>