{% load cosinnus_tags %}

{% if notes %}
  <table class="table table-striped table-hover table-condensed">
    {% for note in notes %}
      <tr>
          <td><a href="{% group_url 'cosinnus:note:note' group=note.group slug=note.slug %}">{{ note.title }}</a></td>
          <td>{{ note.created }}</td>
      </tr>
    {% endfor %}
  </table>
{% else %}
  {{ no_data }}
{% endif %}
<form id="widgetform{{ widget_id }}">
  {% csrf_token %}
  {{ form.as_p }}
  <input type="submit" value="Send"/>
</form>
<script type="text/javascript">
    var frm = $("#widgetform{{ widget_id }}");
    frm.submit(function (ev) {
        $.ajax({
            type: "POST",
            url: "{% url "cosinnus:widget-detail" id=widget_id %}",
            data: frm.serialize(),
            success: function (data) {
                var widget = $("div[data-widget-id={{ widget_id }}]");
                Cosinnus.dashboard.load(widget);
            }
        });

        ev.preventDefault();
    });
</script>
