-<table class="table table-sm mb-0">
- <thead>
- <tr>
- <th></th>
- <th class="text-right">{{ _("Duration") }}</th>
- </tr>
- </thead>
-
- <tbody>
- {% for c in cdr %}
+{% if cdr %}
+ <table class="table table-sm mb-0">
+ <thead>
<tr>
- <td>
- {% if c.direction == "inbound" %}
- <span class="fas fa-arrow-right text-danger"></span>
+ <th></th>
+ <th class="text-right">{{ _("Duration") }}</th>
+ </tr>
+ </thead>
- <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
- {% if c.callee %}
- {{ c.callee }}
- {% else %}
- {{ format_phone_number(c.callee_number) }}
- {% end %}
- </a>
- {% elif c.direction == "outbound" %}
- <span class="fas fa-arrow-left text-success"></span>
+ <tbody>
+ {% for c in cdr %}
+ <tr>
+ <td>
+ {% if c.direction == "inbound" %}
+ <span class="fas fa-arrow-right text-danger"></span>
- <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
- {% if c.caller %}
- {{ c.caller }}
- {% else %}
- {{ format_phone_number(c.caller_number) }}
- {% end %}
- </a>
- {% end %}
+ <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
+ {% if c.callee %}
+ {{ c.callee }}
+ {% else %}
+ {{ format_phone_number(c.callee_number) }}
+ {% end %}
+ </a>
+ {% elif c.direction == "outbound" %}
+ <span class="fas fa-arrow-left text-success"></span>
- <br>
+ <a href="/users/{{ account.uid }}/calls/{{ c.uuid }}">
+ {% if c.caller %}
+ {{ c.caller }}
+ {% else %}
+ {{ format_phone_number(c.caller_number) }}
+ {% end %}
+ </a>
+ {% end %}
- {% module MOS(c) %}
- </td>
+ <br>
- <td class="text-right">
- {{ locale.format_date(c.time_start, relative=False) }} <br>
+ {% module MOS(c) %}
+ </td>
- {% if c.time_answered %}
- <span class="text-muted">{{ format_time(c.duration) }}</span>
- {% else %}
- <span class="text-danger">{{ _("Not Answered") }}</span>
- {% end %}
- </td>
- </tr>
- {% end %}
- </tbody>
-</table>
+ <td class="text-right">
+ {{ locale.format_date(c.time_start, relative=False) }} <br>
+
+ {% if c.time_answered %}
+ <span class="text-muted">{{ format_time(c.duration) }}</span>
+ {% else %}
+ <span class="text-danger">{{ _("Not Answered") }}</span>
+ {% end %}
+ </td>
+ </tr>
+ {% end %}
+ </tbody>
+ </table>
+{% else %}
+ <p class="text-muted text-center my-5">
+ {{ _("There are no calls") }}
+ </p>
+{% end %}
def render(self, account, date=None, limit=None):
cdr = account.get_cdr(date=date, limit=limit)
- return self.render_string("people/modules/cdr.html", account=account, cdr=cdr)
+ return self.render_string("people/modules/cdr.html",
+ account=account, cdr=list(cdr))
class ChannelsModule(ui_modules.UIModule):