src/Products/NotificationsBundle/Resources/views/dashboard/default/main.html.twig line 1

Open in your IDE?
  1. {% extends '@ProductsNotifications/base.html.twig' %}
  2. {% set isGrantedSend = maybe_granted(['app.notifications.messaging.general', 'app.notifications.messaging.urgent']) %}
  3. {% set isGrantedReview = maybe_granted(['app.notifications.contacts.admin', 'app.notifications.contacts.view'])  %}
  4. {% do dom_title_section('Dashboard') %}
  5. {% block header %}
  6.     {% embed '@ui2022/page__header.html.twig' %}
  7.         {% block actions %}
  8.             {% if isGrantedSend %}
  9.                 {% include '@ui2022/button--a.html.twig' with {
  10.                     text: 'Create Message',
  11.                     link: path('app.notifications.dashboard.default.select_modal'),
  12.                     icon: 'icon-message-plane',
  13.                     styles: 'primary',
  14.                     modal: 'modal__new_broadcast',
  15.                 } %}
  16.             {% endif %}
  17.         {% endblock %}
  18.     {% endembed %}
  19. {% endblock %}
  20. {% block content %}
  21.     {% embed '@ui2022/card__infostats.html.twig' %}
  22.         {% block area1 %}
  23.             {% include '@ui2022/card__infostats__header.html.twig' with {
  24.                 title: 'Student reachability',
  25.                 subtitle: 'Current records for students',
  26.             } %}
  27.             {% if stats.contacts.total == 0 %}
  28.                 <p>There are no students in the system yet.</p>
  29.             {% else %}
  30.                 <div class="d-flex justify-content-center justify-content-sm-start flex-wrap mt-1 pt-2">
  31.                     {% include '@ui2022/chart--donut.html.twig' with {
  32.                         legend: stats.contacts|filter((v,k) => k is not same as('total'))|map((v,k) => {
  33.                             label: 'app.notifications.stats.reachability.labels.%s'|format(k)|trans,
  34.                             color: 'app.notifications.stats.reachability.colors.%s'|format(k)|trans([], 'styles', 'app'),
  35.                         }),
  36.                         dataset: stats.contacts|filter((v,k) => k is not same as('total')),
  37.                     } %}
  38.                     {% include '@ui2022/legend.html.twig' with {
  39.                         items: [
  40.                             {
  41.                                 title: stats.contacts['reachable']|number_format,
  42.                                 icon: 'icon-contact-reachable',
  43.                                 styles: 'reachable',
  44.                                 subtitle: 'app.notifications.stats.reachability.labels.reachable'|trans,
  45.                                 tooltip: 'Tooltip text here...',
  46.                                 action: isGrantedReview ? {
  47.                                     text: 'Review',
  48.                                     link: path('app.notifications.dashboard.students.main', {
  49.                                         'query[filter]': 'reachable',
  50.                                     }),
  51.                                 } : null,
  52.                             },
  53.                             {
  54.                                 title: stats.contacts['unreachable']|number_format,
  55.                                 icon: 'icon-contact-unreachable',
  56.                                 styles: 'unreachable',
  57.                                 subtitle: 'app.notifications.stats.reachability.labels.unreachable'|trans,
  58.                                 tooltip: 'Tooltip text here...',
  59.                                 action: isGrantedReview ? {
  60.                                     text: 'Review',
  61.                                     link: path('app.notifications.dashboard.students.main', {
  62.                                         'query[filter]': 'unreachable',
  63.                                     }),
  64.                                 } : null,
  65.                             },
  66.                             {
  67.                                 title: stats.contacts['no-contact']|number_format,
  68.                                 icon: 'icon-contact-warning',
  69.                                 styles: 'warning',
  70.                                 subtitle: 'app.notifications.stats.reachability.labels.no-contact'|trans,
  71.                                 tooltip: 'Tooltip text here...',
  72.                                 action: isGrantedReview ? {
  73.                                     text: 'Review',
  74.                                     link: path('app.notifications.dashboard.students.main', {
  75.                                         'query[filter]': 'no-contact',
  76.                                     }),
  77.                                 }: null,
  78.                             },
  79.                         ],
  80.                     } %}
  81.                 </div>
  82.             {% endif %}
  83.         {% endblock %}
  84.         {% block area2 %}
  85.             {% include '@ui2022/card__infostats__header.html.twig' with {
  86.                 title: 'Communication',
  87.                 subtitle: 'User managed preferences for recieving messages',
  88.             } %}
  89.             <div class="dashboard__progress mt-1 pt-2">
  90.                 <div class="progress__chart">
  91.                     {% include '@ui2022/progress-item.html.twig' with {
  92.                         title: 'Email',
  93.                         value: stats.communication['total'] ? (stats.communication['email'] / stats.communication['total']) : 0,
  94.                     } %}
  95.                     {% include '@ui2022/progress-item.html.twig' with {
  96.                         title: 'Text',
  97.                         value: stats.communication['total'] ? (stats.communication['sms'] / stats.communication['total']) : 0,
  98.                     } %}
  99.                     {% include '@ui2022/progress-item.html.twig' with {
  100.                         title: 'Voice',
  101.                         value: stats.communication['total'] ? (stats.communication['voice'] / stats.communication['total']) : 0,
  102.                     } %}
  103.                     {% include '@ui2022/progress-item.html.twig' with {
  104.                         title: 'App',
  105.                         value: stats.communication['total'] ? (stats.communication['app'] / stats.communication['total']) : 0,
  106.                     } %}
  107.                 </div>
  108.             </div>
  109.         {% endblock %}
  110.         {% block area3 %}
  111.             {% include '@ui2022/card__infostats__header.html.twig' with {
  112.                 title: 'Contacts per segment',
  113.             } %}
  114.             <div class="mt-3">
  115.                 {% include '@ui2022/infostats--cps.html.twig' with {
  116.                     datasets: array_combine(
  117.                         stats.debugging|map((v,k) => 'app.notifications.profiles.types.%s'|format(k)|trans),
  118.                         stats.debugging|map((v) => {
  119.                             'Reachable': {
  120.                                 value: v['reachable']|number_format,
  121.                                 status: 'sent',
  122.                             },
  123.                             'Unreachable': {
  124.                                 value: v['unreachable']|number_format,
  125.                                 status: 'unreachable',
  126.                             },
  127.                             'No Contact': {
  128.                                 value: v['no-contact']|number_format,
  129.                                 status: 'red',
  130.                             },
  131.                             'Total': {
  132.                                 value: v['total']|number_format,
  133.                                 status: 'gray',
  134.                             },
  135.                         })
  136.                     ),
  137.                 } %}
  138.             </div>
  139.         {% endblock %}
  140.     {% endembed %}
  141.     {% embed '@ui2022/cards__infocards.html.twig' %}
  142.         {% block row1 %}
  143.             <div class="col-12 col-sm-6 col-lg-4 mb-4 mb-lg-0">
  144.                 {% include '@ui2022/card__infobox.html.twig' with {
  145.                     icon: 'icon-templates',
  146.                     details: {
  147.                         title: stats.callouts.sis,
  148.                         subtitle: 'SIS Records',
  149.                         action: isGrantedReview ? {
  150.                             link: path('app.notifications.dashboard.sis.main'),
  151.                             text: 'Review',
  152.                         } : null,
  153.                         content: 'Required updates to contacts in the SIS',
  154.                     },
  155.                 } %}
  156.             </div>
  157.             <div class="col-12 col-sm-6 col-lg-4 mb-4 mb-lg-0">
  158.                 {% include '@ui2022/card__infobox.html.twig' with {
  159.                     icon: 'icon-contacts',
  160.                     details: {
  161.                         title: sync ? 'app.oneroster.vendors.%s'|format(sync.vendor)|trans : null,
  162.                         subtitle: 'Data Source',
  163.                         action: null,
  164.                         content: (sync and sync.lastJob) ? 'Database last synced on %s'|format(
  165.                             sync.lastJob.timestampedAt|ui_datetime
  166.                         ) : 'Database not yet synced.',
  167.                     },
  168.                 } %}
  169.             </div>
  170.             <div class="col-12 col-sm-6 col-lg-4 mb-4 mb-lg-0">
  171.                 {% include '@ui2022/card__infobox.html.twig' with {
  172.                     icon: 'icon-school-activities-report',
  173.                     details: {
  174.                         title: stats.callouts.schools,
  175.                         subtitle: 'Schools',
  176.                         action: {
  177.                             link: path('app.notifications.dashboard.reports.main'),
  178.                             text: 'Review',
  179.                         },
  180.                         content: 'Activities and reports for each school',
  181.                     },
  182.                 } %}
  183.             </div>
  184.         {% endblock %}
  185.     {% endembed %}
  186.     {% if isGrantedSend and messages|length > 0 %}
  187.         {% embed '@ui2022/subheader.html.twig' with {
  188.             title: 'Recent Messages',
  189.         } %}
  190.             {% block actions %}
  191.                 {% if isGrantedSend %}
  192.                     {% include '@ui2022/button--a.html.twig' with {
  193.                         text: 'Go to messages',
  194.                         link: path('app.notifications.dashboard.messages.main'),
  195.                         styles: 'shrunk white',
  196.                     } %}
  197.                 {% endif %}
  198.             {% endblock %}
  199.         {% endembed %}
  200.         <div>
  201.             {% include '@ProductsNotifications/dashboard/messages/includes/_results.html.twig' with {
  202.                 searchable: false,
  203.             } %}
  204.         </div>
  205.     {% endif %}
  206. {% endblock %}
  207. {% block modals %}
  208.     {{ parent() }}
  209.     {% include '@ui2022/modal.html.twig' with {
  210.         dialog_styles: 'scrollable centered',
  211.         attr: {
  212.             id: 'modal__new_broadcast',
  213.             class: 'modal-ajax',
  214.         },
  215.     } %}
  216. {% endblock %}