{% load wcs %}
{% with parametres=cards|objects:"pn-v2-parametres-generaux"|get_full|first|get:"fields" data=json.data.0 %}
<h2>Personnalisez votre tableau de bord</h2>

<p class="text">
{{ text }}
</p>

<div>
{% if data %}
<a class="pk-button" href="{{ eservices_url }}{{ parametres|get:"uri_inscription" }}">Gérer mes notifications</a>
{% else %}
<a class="pk-button" href="{{ eservices_url }}{{ parametres|get:"uri_inscription" }}">M’abonner aux notifications</a>
{% endif %}

<a class="pk-button" href="/services/">Ajouter des services en favoris</a>
</div>
<script>
$(function() {
  const has_notif_settings = {% if data %}true{% else %}false{% endif %};
  if (! has_notif_settings && $('.dashboard-content .cell').length == 0) {
    var $pn_home = $('.pn-home').clone();
    $pn_home.prependTo($('#columns')).show();;
  } else {
    $('.pn-home').show();
  }
});
</script>
{% endwith %}
