src/Products/NotificationsBundle/Resources/views/dashboard/messages/report.html.twig line 1

Open in your IDE?
  1. {% extends '@ProductsNotifications/base.html.twig' %}
  2. {% do dom_title_section('Messages') %}
  3. {% block wrap %}content__area--uilib reports{% endblock %}
  4. {% block header %}
  5.     {% embed '@ui2022/schoolnow/header.html.twig' with {
  6.         title: message.title,
  7.         back: {
  8.             text: 'Back to Messages',
  9.             link: path('app.notifications.dashboard.messages.main'),
  10.         },
  11.     } %}
  12.         {% block actions %}
  13.             {% include '@ui2022/button--a.html.twig' with {
  14.                 text: 'Clone message',
  15.                 link: path('app.notifications.dashboard.messages.create', {
  16.                     clone: message.id,
  17.                 }),
  18.                 styles: 'gray',
  19.             } %}
  20.         {% endblock %}
  21.     {% endembed %}
  22. {% endblock %}
  23. {% block content %}
  24.     {% if not message.firstJob %}
  25.         <div class="content__data reports__message pt-2">
  26.             <div class="blockgroup">
  27.                 <label class="blockgroup__label">Message</label>
  28.                 <h2 class="h4">{{- message.title -}}</h2>
  29.             </div>
  30.         </div>
  31.     {% else %}
  32.         {% set stats = message.firstJob.summarize %}
  33.         <div class="content__data reports__message pt-2">
  34.             {% embed '@ui2022/tabs--static.html.twig' with {
  35.                 items: [
  36.                     {
  37.                         text: 'Summary',
  38.                         link: path('app.notifications.dashboard.messages.report', {
  39.                             message: message.id,
  40.                         }),
  41.                         active: (app.request.attributes.get('_route') is same as('app.notifications.dashboard.messages.report')),
  42.                     },
  43.                     {
  44.                         text: 'Logs',
  45.                         link: path('app.notifications.dashboard.messages.logs', {
  46.                             message: message.id,
  47.                         }),
  48.                         active: (app.request.attributes.get('_route') is same as('app.notifications.dashboard.messages.logs')),
  49.                     },
  50.                     {
  51.                         text: 'Debugging',
  52.                         link: path('app.notifications.dashboard.messages.debugging', {
  53.                             message: message.id,
  54.                         }),
  55.                         active: (app.request.attributes.get('_route') is same as('app.notifications.dashboard.messages.debugging')),
  56.                     },
  57.                     {
  58.                         text: 'Details',
  59.                         link: path('app.notifications.dashboard.messages.details', {
  60.                             message: message.id,
  61.                         }),
  62.                         active: (app.request.attributes.get('_route') is same as('app.notifications.dashboard.messages.details')),
  63.                     },
  64.                 ],
  65.             } %}
  66.                 {% block tab %}
  67.                     {% include '@ui2022/subheader.html.twig' with {
  68.                         title: 'Summary',
  69.                         classes: 'mt-4 pt-4',
  70.                     } %}
  71.                     <div class="three-column-section">
  72.                         <div class="three-column-inner-section">
  73.                             {% include '@ui2022/schoolnow/stat.html.twig' with {
  74.                                 title: 'Sent',
  75.                                 subtitle: message.firstJob.firstActivityAt|ui_datetime,
  76.                                 value: (message.sending and stats.all.total > 0) ? ((((stats.all.succeeded + stats.all.failed) / stats.all.total) * 100)|round(0, 'ceil') ~ '%') : stats.all.total|number_format,
  77.                                 label: 'Contacts',
  78.                                 link: ((stats.all.succeeded + stats.all.failed) > 0)
  79.                                     ? path('app.notifications.dashboard.messages.filtered_logs', {
  80.                                         message: message.id,
  81.                                         query: {
  82.                                             filter: 'all',
  83.                                             state: 'all',
  84.                                             sort: 'timestamp',
  85.                                             direction: 'DESC'
  86.                                         }
  87.                                     })
  88.                                     : null,
  89.                                 dataToggle: ((stats.all.succeeded + stats.all.failed) > 0) ? 'sidepanel' : null,
  90.                                 dataTarget: ((stats.all.succeeded + stats.all.failed) > 0) ? '#sidepanel__filtered_logs' : null,
  91.                             } %}
  92.                             {% set interval = message.firstJob.activityInterval|ui_relativeDate(true)|split(' ') %}
  93.                             {% include '@ui2022/schoolnow/stat.html.twig' with {
  94.                                 title: message.sending ? 'Running' : 'Completed',
  95.                                 subtitle: message.firstJob.lastActivityAt|ui_datetime,
  96.                                 value: interval[1] is defined ? interval[0]|number_format : interval[0],
  97.                                 label: interval[1]|default(''),
  98.                             } %}
  99.                             {% include '@ui2022/schoolnow/stat.html.twig' with {
  100.                                 title: 'Errors',
  101.                                 subtitle: 'Message not delivered',
  102.                                 value: stats.all.failed|number_format,
  103.                                 label: 'Contacts',
  104.                                 link: (stats.all.failed > 0)
  105.                                     ? path('app.notifications.dashboard.messages.filtered_logs', {
  106.                                         message: message.id,
  107.                                         query: {
  108.                                             filter: 'all',
  109.                                             state: 'failed',
  110.                                             sort: 'timestamp',
  111.                                             direction: 'DESC'
  112.                                         }
  113.                                     })
  114.                                     : null,
  115.                                 dataToggle: (stats.all.failed > 0) ? 'sidepanel' : null,
  116.                                 dataTarget: (stats.all.failed > 0) ? '#sidepanel__filtered_logs' : null,
  117.                             } %}
  118.                         </div>
  119.                     </div>
  120.                     <div class="section__infostats mb-4">
  121.                         <div class="card card__charts">
  122.                             <div class="row row-10">
  123.                                 <div class="col-12 col-md-6">
  124.                                     <h4 class="infostats__title">Delivery methods</h4>
  125.                                     <div class="d-flex justify-content-center justify-content-sm-start flex-wrap mt-1 pt-2">
  126.                                         {% include '@ui2022/chart--donut.html.twig' with {
  127.                                             legend: stats.message_channels|filter((v,k) => v.total > 0)|map((v,k) => {
  128.                                                 label: 'app.notifications.stats.reporting.labels.%s'|format(k)|trans,
  129.                                                 color: 'app.notifications.stats.reporting.colors.%s'|format(k)|trans([], 'styles', 'app'),
  130.                                             }),
  131.                                             dataset: stats.message_channels|filter((v,k) => v.total > 0)|map((v) => v.total),
  132.                                             label: 'Total contacts',
  133.                                         } %}
  134.                                     </div>
  135.                                 </div>
  136.                                 {% if constant('DISCR', message) is same as(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Message::DISCR')) %}
  137.                                     <div class="col-12 mt-4 mt-lg-0 col-md-6">
  138.                                         <h4 class="infostats__title">Targeted audience</h4>
  139.                                         <div class="targetlist">
  140.                                             {% if message.lists|length %}
  141.                                                 {% include '@ui2022/targetlist__item.html.twig' with {
  142.                                                     title: 'Contact lists',
  143.                                                     icon: 'icon-contact-reachable',
  144.                                                     items: message.lists|map((list) => {
  145.                                                         text: list.name,
  146.                                                         link: path('app.notifications.dashboard.lists.view', {
  147.                                                             list: list.id,
  148.                                                         }),
  149.                                                     }),
  150.                                                 } %}
  151.                                             {% endif %}
  152.                                             {% if message.facebookSocialAccounts|length %}
  153.                                                 {% include '@ui2022/targetlist__item.html.twig' with {
  154.                                                     title: 'Facebook pages',
  155.                                                     icon: 'icon-facebook-fill',
  156.                                                     items: message.facebookSocialAccounts|map((social) => {
  157.                                                         text: social.name,
  158.                                                         target: '_blank',
  159.                                                         link: 'https://www.facebook.com/%s'|format(
  160.                                                             social.facebookPageId,
  161.                                                         ),
  162.                                                     }),
  163.                                                 } %}
  164.                                             {% endif %}
  165.                                             {% if message.twitterSocialAccounts|length %}
  166.                                                 {% include '@ui2022/targetlist__item.html.twig' with {
  167.                                                     title: 'Twitter profiles',
  168.                                                     icon: 'icon-twitter-fill',
  169.                                                     items: message.twitterSocialAccounts|map((social) => {
  170.                                                         text: social.name,
  171.                                                         target: '_blank',
  172.                                                         link: 'https://www.twitter.com/%s'|format(
  173.                                                             social.twitterUserName,
  174.                                                         ),
  175.                                                     }),
  176.                                                 } %}
  177.                                             {% endif %}
  178.                                             {% if message.instagramSocialAccounts|length %}
  179.                                                 {% include '@ui2022/targetlist__item.html.twig' with {
  180.                                                     title: 'Instagram accounts',
  181.                                                     icon: 'fab fa-instagram',
  182.                                                     items: message.instagramSocialAccounts|map((social) => {
  183.                                                         text: social.name,
  184.                                                         target: '_blank',
  185.                                                         link: 'https://www.instagram.com/%s'|format(
  186.                                                             social.name,
  187.                                                         ),
  188.                                                     }),
  189.                                                 } %}
  190.                                             {% endif %}
  191.                                             {% if message.websiteDepartments|length %}
  192.                                                 {% include '@ui2022/targetlist__item.html.twig' with {
  193.                                                     title: 'Website departments',
  194.                                                     icon: 'icon-website',
  195.                                                     items: message.websiteDepartments|map((department) => {
  196.                                                         text: department.name,
  197.                                                         target: '_blank',
  198.                                                         link: web_url_catchall(department, '/'),
  199.                                                     }),
  200.                                                 } %}
  201.                                             {% endif %}
  202.                                         </div>
  203.                                     </div>
  204.                                 {% endif %}
  205.                             </div>
  206.                         </div>
  207.                     </div>
  208.                     {% for channel in message.usedChannels(true) %}
  209.                         {% if channel == constant('CHANNELS__EMAIL', message) and message.firstJob.emailTotal %}
  210.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  211.                                 icon: 'icon-activity-mail',
  212.                                 title: 'Email',
  213.                                 stats: [
  214.                                     {
  215.                                         label: 'Total sent',
  216.                                         value: message.firstJob.emailSucceeded|number_format,
  217.                                         link: (message.firstJob.emailSucceeded > 0)
  218.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  219.                                                 message: message.id,
  220.                                                 query: {
  221.                                                     filter: 'email',
  222.                                                     sort: 'timestamp',
  223.                                                     direction: 'DESC'
  224.                                                 }
  225.                                             })
  226.                                             : null,
  227.                                         dataToggle: (message.firstJob.emailSucceeded > 0) ? 'sidepanel' : null,
  228.                                         dataTarget: (message.firstJob.emailSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  229.                                     },
  230.                                     {
  231.                                         label: 'Delivery verified',
  232.                                         value: message.firstJob.emailDelivered|number_format,
  233.                                         link: (message.firstJob.emailDelivered > 0)
  234.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  235.                                                 message: message.id,
  236.                                                 query: {
  237.                                                     filter: 'email',
  238.                                                     state: 'completed',
  239.                                                     sort: 'timestamp',
  240.                                                     direction: 'DESC'
  241.                                                 }
  242.                                             })
  243.                                             : null,
  244.                                         dataToggle: (message.firstJob.emailDelivered > 0) ? 'sidepanel' : null,
  245.                                         dataTarget: (message.firstJob.emailDelivered > 0) ? '#sidepanel__filtered_logs' : null,
  246.                                     },
  247.                                     {
  248.                                         label: 'Bounces',
  249.                                         value: (message.firstJob.emailUndelivered + message.firstJob.emailFailed)|number_format,
  250.                                         link: ((message.firstJob.emailUndelivered + message.firstJob.emailFailed) > 0)
  251.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  252.                                                 message: message.id,
  253.                                                 query: {
  254.                                                     filter: 'email',
  255.                                                     state: 'failed',
  256.                                                     sort: 'timestamp',
  257.                                                     direction: 'DESC'
  258.                                                 }
  259.                                             })
  260.                                             : null,
  261.                                         dataToggle: ((message.firstJob.emailUndelivered + message.firstJob.emailFailed) > 0) ? 'sidepanel' : null,
  262.                                         dataTarget: ((message.firstJob.emailUndelivered + message.firstJob.emailFailed) > 0) ? '#sidepanel__filtered_logs' : null,
  263.                                     },
  264.                                     {
  265.                                         label: 'Open rate',
  266.                                         value: (message.firstJob.emailSucceeded ? (message.firstJob.emailOpened / message.firstJob.emailSucceeded) : 0)|percentage,
  267.                                         progress: message.firstJob.emailSucceeded ? (message.firstJob.emailOpened / message.firstJob.emailSucceeded) : 0,
  268.                                     },
  269.                                 ],
  270.                             } %}
  271.                                 {% block content %}
  272.                                     <table class="table-clear border-0 text-gray-dark">
  273.                                         <tbody>
  274.                                             <tr>
  275.                                                 <td class="text-semibold pr-3 pb-2">Subject:</td>
  276.                                                 <td class="pb-3 pb-sm-2">
  277.                                                     <span>{{ message.emailSubject }}</span>
  278.                                                     <a class="text-body text-underline" href="#" title="View email" data-toggle="modal" data-target="#modal__email_preview">View email</a>
  279.                                                 </td>
  280.                                             </tr>
  281.                                             <tr>
  282.                                                 <td class="text-semibold pr-3">From:</td>
  283.                                                 <td>
  284.                                                     <span class="emailid">{{ message.emailName }} &lt;{{ message.emailFrom }}&gt;</span>
  285.                                                 </td>
  286.                                             </tr>
  287.                                         </tbody>
  288.                                     </table>
  289.                                 {% endblock %}
  290.                             {% endembed %}
  291.                         {% elseif channel == constant('CHANNELS__SMS', message) and message.firstJob.smsTotal %}
  292.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  293.                                 icon: 'icon-activity-text',
  294.                                 title: 'SMS',
  295.                                 stats: [
  296.                                     {
  297.                                         label: 'Total sent',
  298.                                         value: message.firstJob.smsSucceeded|number_format,
  299.                                         link: (message.firstJob.smsSucceeded > 0)
  300.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  301.                                                 message: message.id,
  302.                                                 query: {
  303.                                                     filter: 'sms',
  304.                                                     state: 'all',
  305.                                                     sort: 'timestamp',
  306.                                                     direction: 'DESC'
  307.                                                 }
  308.                                             })
  309.                                             : null,
  310.                                         dataToggle: (message.firstJob.smsSucceeded > 0) ? 'sidepanel' : null,
  311.                                         dataTarget: (message.firstJob.smsSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  312.                                     },
  313.                                     {
  314.                                         label: 'Delivery verified',
  315.                                         value: message.firstJob.smsDelivered|number_format,
  316.                                         link: (message.firstJob.smsDelivered > 0)
  317.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  318.                                                 message: message.id,
  319.                                                 query: {
  320.                                                     filter: 'sms',
  321.                                                     state: 'completed',
  322.                                                     sort: 'timestamp',
  323.                                                     direction: 'DESC'
  324.                                                 }
  325.                                             })
  326.                                             : null,
  327.                                         dataToggle: (message.firstJob.smsDelivered > 0) ? 'sidepanel' : null,
  328.                                         dataTarget: (message.firstJob.smsDelivered > 0) ? '#sidepanel__filtered_logs' : null,
  329.                                     },
  330.                                     {
  331.                                         label: 'Bounces',
  332.                                         value: (message.firstJob.smsUndelivered + message.firstJob.smsFailed)|number_format,
  333.                                         link: ((message.firstJob.smsUndelivered + message.firstJob.smsFailed) > 0)
  334.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  335.                                                 message: message.id,
  336.                                                 query: {
  337.                                                     filter: 'sms',
  338.                                                     state: 'failed',
  339.                                                     sort: 'timestamp',
  340.                                                     direction: 'DESC'
  341.                                                 }
  342.                                             })
  343.                                             : null,
  344.                                         dataToggle: ((message.firstJob.smsUndelivered + message.firstJob.smsFailed) > 0) ? 'sidepanel' : null,
  345.                                         dataTarget: ((message.firstJob.smsUndelivered + message.firstJob.smsFailed) > 0) ? '#sidepanel__filtered_logs' : null,
  346.                                     },
  347.                                 ],
  348.                             } %}
  349.                                 {% block content %}
  350.                                     <table class="table-clear border-0 text-gray-dark">
  351.                                         <tbody>
  352.                                             <tr>
  353.                                                 <td class="text-semibold pr-3 pb-2">Message:</td>
  354.                                                 <td class="pb-3 pb-sm-2">
  355.                                                     <span>{{ message.smsText }}</span>
  356.                                                     {% if message.smsUrl %}
  357.                                                         <a class="text-body text-underline" href="{{ message.smsUrl }}">{{ message.smsUrl }}</a>
  358.                                                     {% endif %}
  359.                                                 </td>
  360.                                             </tr>
  361.                                             <tr>
  362.                                                 <td class="text-semibold pr-3">From:</td>
  363.                                                 <td>
  364.                                                     <span class="emailid">{{ configs.twilio.incomingPhoneNumber|phone_number_format }}</span>
  365.                                                 </td>
  366.                                             </tr>
  367.                                         </tbody>
  368.                                     </table>
  369.                                 {% endblock %}
  370.                             {% endembed %}
  371.                         {% elseif channel == constant('CHANNELS__VOICE', message) and message.firstJob.voiceTotal %}
  372.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  373.                                 icon: 'icon-activity-voice',
  374.                                 title: 'Phone',
  375.                                 stats: [
  376.                                     {
  377.                                         label: 'Total sent',
  378.                                         value: message.firstJob.voiceSucceeded|number_format,
  379.                                         link: (message.firstJob.voiceSucceeded > 0)
  380.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  381.                                                 message: message.id,
  382.                                                 query: {
  383.                                                     filter: 'voice',
  384.                                                     state: 'all',
  385.                                                     sort: 'timestamp',
  386.                                                     direction: 'DESC'
  387.                                                 }
  388.                                             })
  389.                                             : null,
  390.                                         dataToggle: (message.firstJob.voiceSucceeded > 0) ? 'sidepanel' : null,
  391.                                         dataTarget: (message.firstJob.voiceSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  392.                                     },
  393.                                     {
  394.                                         label: 'Delivery verified',
  395.                                         value: message.firstJob.voiceDelivered|number_format,
  396.                                         link: (message.firstJob.voiceDelivered > 0)
  397.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  398.                                                 message: message.id,
  399.                                                 query: {
  400.                                                     filter: 'voice',
  401.                                                     state: 'completed',
  402.                                                     sort: 'timestamp',
  403.                                                     direction: 'DESC'
  404.                                                 }
  405.                                             })
  406.                                             : null,
  407.                                         dataToggle: (message.firstJob.voiceDelivered > 0) ? 'sidepanel' : null,
  408.                                         dataTarget: (message.firstJob.voiceDelivered > 0) ? '#sidepanel__filtered_logs' : null,
  409.                                     },
  410.                                     {
  411.                                         label: 'Bounces',
  412.                                         value: (message.firstJob.voiceUndelivered + message.firstJob.voiceFailed)|number_format,
  413.                                         link: ((message.firstJob.voiceUndelivered + message.firstJob.voiceFailed) > 0)
  414.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  415.                                                 message: message.id,
  416.                                                 query: {
  417.                                                     filter: 'voice',
  418.                                                     state: 'failed',
  419.                                                     sort: 'timestamp',
  420.                                                     direction: 'DESC'
  421.                                                 }
  422.                                             })
  423.                                             : null,
  424.                                         dataToggle: ((message.firstJob.voiceUndelivered + message.firstJob.voiceFailed) > 0) ? 'sidepanel' : null,
  425.                                         dataTarget: ((message.firstJob.voiceUndelivered + message.firstJob.voiceFailed) > 0) ? '#sidepanel__filtered_logs' : null,
  426.                                     },
  427.                                     {
  428.                                         label: 'Answer rate',
  429.                                         value: (message.firstJob.voiceSucceeded ? (message.firstJob.voiceAnswered / message.firstJob.voiceSucceeded) : 0)|percentage,
  430.                                         progress: message.firstJob.voiceSucceeded ? (message.firstJob.voiceAnswered / message.firstJob.voiceSucceeded) : 0,
  431.                                     },
  432.                                 ],
  433.                             } %}
  434.                                 {% block content %}
  435.                                     <table class="table-clear border-0 text-gray-dark">
  436.                                         <tbody>
  437.                                             <tr>
  438.                                                 <td class="text-semibold pr-3 pb-2">Message:</td>
  439.                                                 <td class="pb-3 pb-sm-2">
  440.                                                     <audio controls="" class="d-block ml-md-auto">
  441.                                                         <source src="{{ blobs(message.recording).recordingUrl(message.recording)|escape('html_attr') }}" type="audio/mpeg" />
  442.                                                         Your browser does not support the audio element.
  443.                                                     </audio>
  444.                                                 </td>
  445.                                             </tr>
  446.                                             <tr>
  447.                                                 <td class="text-semibold pr-3">From:</td>
  448.                                                 <td>
  449.                                                     <span class="emailid">
  450.                                                         {{- (message.voiceCallerId ? message.voiceCallerId.phoneNumber : configs.twilio.incomingPhoneNumber)|phone_number_format -}}
  451.                                                     </span>
  452.                                                 </td>
  453.                                             </tr>
  454.                                         </tbody>
  455.                                     </table>
  456.                                 {% endblock %}
  457.                             {% endembed %}
  458.                         {% elseif channel == constant('CHANNELS__APP', message) and message.firstJob.appTotal %}
  459.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  460.                                 icon: 'icon-deviceapp',
  461.                                 title: 'Mobile app',
  462.                                 stats: [
  463.                                     {
  464.                                         label: 'Total sent',
  465.                                         value: message.firstJob.appSucceeded|number_format,
  466.                                         link: (message.firstJob.appSucceeded > 0)
  467.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  468.                                                 message: message.id,
  469.                                                 query: {
  470.                                                     filter: 'app',
  471.                                                     state: 'pending',
  472.                                                     sort: 'timestamp',
  473.                                                     direction: 'DESC'
  474.                                                 }
  475.                                             })
  476.                                             : null,
  477.                                         dataToggle: (message.firstJob.appSucceeded > 0) ? 'sidepanel' : null,
  478.                                         dataTarget: (message.firstJob.appSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  479.                                     },
  480.                                     {
  481.                                         label: 'Delivery verified',
  482.                                         value: message.firstJob.appDelivered|number_format,
  483.                                     },
  484.                                     {
  485.                                         label: 'Bounces',
  486.                                         value: (message.firstJob.appUndelivered + message.firstJob.appFailed)|number_format,
  487.                                         link: ((message.firstJob.appUndelivered + message.firstJob.appFailed) > 0)
  488.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  489.                                                 message: message.id,
  490.                                                 query: {
  491.                                                     filter: 'app',
  492.                                                     state: 'failed',
  493.                                                     sort: 'timestamp',
  494.                                                     direction: 'DESC'
  495.                                                 }
  496.                                             })
  497.                                             : null,
  498.                                         dataToggle: ((message.firstJob.appUndelivered + message.firstJob.appFailed) > 0) ? 'sidepanel' : null,
  499.                                         dataTarget: ((message.firstJob.appUndelivered + message.firstJob.appFailed) > 0) ? '#sidepanel__filtered_logs' : null,
  500.                                     },
  501.                                 ],
  502.                             } %}
  503.                                 {% block content %}
  504.                                     <table class="table-clear border-0 text-gray-dark">
  505.                                         <tbody>
  506.                                             <tr>
  507.                                                 <td class="text-semibold pr-3 pb-2">Message:</td>
  508.                                                 <td class="pb-3 pb-sm-2">
  509.                                                     <span>{{ message.appTitle }}</span>
  510.                                                 </td>
  511.                                             </tr>
  512.                                         </tbody>
  513.                                     </table>
  514.                                 {% endblock %}
  515.                             {% endembed %}
  516.                         {% elseif channel == constant('CHANNELS__FACEBOOK', message) and message.firstJob.facebookTotal %}
  517.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  518.                                 icon: 'icon-facebook-fill',
  519.                                 title: 'Facebook',
  520.                                 stats: [
  521.                                     {
  522.                                         label: 'Total posts',
  523.                                         value: message.firstJob.facebookTotal|number_format,
  524.                                         link: (message.firstJob.facebookTotal > 0)
  525.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  526.                                                 message: message.id,
  527.                                                 query: {
  528.                                                     filter: 'facebook',
  529.                                                     state: 'all',
  530.                                                     sort: 'timestamp',
  531.                                                     direction: 'DESC'
  532.                                                 }
  533.                                             })
  534.                                             : null,
  535.                                         dataToggle: (message.firstJob.facebookTotal > 0) ? 'sidepanel' : null,
  536.                                         dataTarget: (message.firstJob.facebookTotal > 0) ? '#sidepanel__filtered_logs' : null,
  537.                                     },
  538.                                     {
  539.                                         label: 'Successful posts',
  540.                                         value: message.firstJob.facebookSucceeded|number_format,
  541.                                         link: (message.firstJob.facebookSucceeded > 0)
  542.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  543.                                                 message: message.id,
  544.                                                 query: {
  545.                                                     filter: 'facebook',
  546.                                                     state: 'completed',
  547.                                                     sort: 'timestamp',
  548.                                                     direction: 'DESC'
  549.                                                 }
  550.                                             })
  551.                                             : null,
  552.                                         dataToggle: (message.firstJob.facebookSucceeded > 0) ? 'sidepanel' : null,
  553.                                         dataTarget: (message.firstJob.facebookSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  554.                                     },
  555.                                     {
  556.                                         label: 'Errors',
  557.                                         value: message.firstJob.facebookFailed|number_format,
  558.                                         link: (message.firstJob.facebookFailed > 0)
  559.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  560.                                                 message: message.id,
  561.                                                 query: {
  562.                                                     filter: 'facebook',
  563.                                                     state: 'failed',
  564.                                                     sort: 'timestamp',
  565.                                                     direction: 'DESC'
  566.                                                 }
  567.                                             })
  568.                                             : null,
  569.                                         dataToggle: (message.firstJob.facebookFailed > 0) ? 'sidepanel' : null,
  570.                                         dataTarget: (message.firstJob.facebookFailed > 0) ? '#sidepanel__filtered_logs' : null,
  571.                                     },
  572.                                 ],
  573.                             } %}{% endembed %}
  574.                         {% elseif channel == constant('CHANNELS__TWITTER', message) and message.firstJob.twitterTotal %}
  575.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  576.                                 icon: 'icon-twitter-fill',
  577.                                 title: 'Twitter',
  578.                                 stats: [
  579.                                     {
  580.                                         label: 'Total posts',
  581.                                         value: message.firstJob.twitterTotal|number_format,
  582.                                         link: (message.firstJob.twitterTotal > 0)
  583.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  584.                                                 message: message.id,
  585.                                                 query: {
  586.                                                     filter: 'twitter',
  587.                                                     state: 'all',
  588.                                                     sort: 'timestamp',
  589.                                                     direction: 'DESC'
  590.                                                 }
  591.                                             })
  592.                                             : null,
  593.                                         dataToggle: (message.firstJob.twitterTotal > 0) ? 'sidepanel' : null,
  594.                                         dataTarget: (message.firstJob.twitterTotal > 0) ? '#sidepanel__filtered_logs' : null,
  595.                                     },
  596.                                     {
  597.                                         label: 'Successful posts',
  598.                                         value: message.firstJob.twitterSucceeded|number_format,
  599.                                         link: (message.firstJob.twitterSucceeded > 0)
  600.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  601.                                                 message: message.id,
  602.                                                 query: {
  603.                                                     filter: 'twitter',
  604.                                                     state: 'completed',
  605.                                                     sort: 'timestamp',
  606.                                                     direction: 'DESC'
  607.                                                 }
  608.                                             })
  609.                                             : null,
  610.                                         dataToggle: (message.firstJob.twitterSucceeded > 0) ? 'sidepanel' : null,
  611.                                         dataTarget: (message.firstJob.twitterSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  612.                                     },
  613.                                     {
  614.                                         label: 'Errors',
  615.                                         value: message.firstJob.twitterFailed|number_format,
  616.                                         link: (message.firstJob.twitterFailed > 0)
  617.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  618.                                                 message: message.id,
  619.                                                 query: {
  620.                                                     filter: 'twitter',
  621.                                                     state: 'failed',
  622.                                                     sort: 'timestamp',
  623.                                                     direction: 'DESC'
  624.                                                 }
  625.                                             })
  626.                                             : null,
  627.                                         dataToggle: (message.firstJob.twitterFailed > 0) ? 'sidepanel' : null,
  628.                                         dataTarget: (message.firstJob.twitterFailed > 0) ? '#sidepanel__filtered_logs' : null,
  629.                                     },
  630.                                 ],
  631.                             } %}{% endembed %}
  632.                         {% elseif channel == constant('CHANNELS__INSTAGRAM', message) and message.firstJob.instagramTotal %}
  633.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  634.                                 icon: 'fab fa-instagram',
  635.                                 title: 'Instagram',
  636.                                 stats: [
  637.                                     {
  638.                                         label: 'Total posts',
  639.                                         value: message.firstJob.instagramTotal|number_format,
  640.                                         link: (message.firstJob.instagramTotal > 0)
  641.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  642.                                                 message: message.id,
  643.                                                 query: {
  644.                                                     filter: 'instagram',
  645.                                                     state: 'all',
  646.                                                     sort: 'timestamp',
  647.                                                     direction: 'DESC'
  648.                                                 }
  649.                                             })
  650.                                             : null,
  651.                                         dataToggle: (message.firstJob.instagramTotal > 0) ? 'sidepanel' : null,
  652.                                         dataTarget: (message.firstJob.instagramTotal > 0) ? '#sidepanel__filtered_logs' : null,
  653.                                     },
  654.                                     {
  655.                                         label: 'Successful posts',
  656.                                         value: message.firstJob.instagramSucceeded|number_format,
  657.                                         link: (message.firstJob.instagramSucceeded > 0)
  658.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  659.                                                 message: message.id,
  660.                                                 query: {
  661.                                                     filter: 'instagram',
  662.                                                     state: 'completed',
  663.                                                     sort: 'timestamp',
  664.                                                     direction: 'DESC'
  665.                                                 }
  666.                                             })
  667.                                             : null,
  668.                                         dataToggle: (message.firstJob.instagramSucceeded > 0) ? 'sidepanel' : null,
  669.                                         dataTarget: (message.firstJob.instagramSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  670.                                     },
  671.                                     {
  672.                                         label: 'Errors',
  673.                                         value: message.firstJob.instagramFailed|number_format,
  674.                                         link: (message.firstJob.instagramFailed > 0)
  675.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  676.                                                 message: message.id,
  677.                                                 query: {
  678.                                                     filter: 'instagram',
  679.                                                     state: 'failed',
  680.                                                     sort: 'timestamp',
  681.                                                     direction: 'DESC'
  682.                                                 }
  683.                                             })
  684.                                             : null,
  685.                                         dataToggle: (message.firstJob.instagramFailed > 0) ? 'sidepanel' : null,
  686.                                         dataTarget: (message.firstJob.instagramFailed > 0) ? '#sidepanel__filtered_logs' : null,
  687.                                     },
  688.                                 ],
  689.                             } %}{% endembed %}
  690.                         {% elseif channel == constant('CHANNELS__WEBSITE', message) and message.firstJob.websiteTotal %}
  691.                             {% embed '@ui2022/card__deliverymethods.html.twig' with {
  692.                                 icon: 'icon-website',
  693.                                 title: 'Website',
  694.                                 stats: [
  695.                                     {
  696.                                         label: 'Total posts',
  697.                                         value: message.firstJob.websiteTotal|number_format,
  698.                                         link: (message.firstJob.websiteTotal > 0)
  699.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  700.                                                 message: message.id,
  701.                                                 query: {
  702.                                                     filter: 'website',
  703.                                                     state: 'all',
  704.                                                     sort: 'timestamp',
  705.                                                     direction: 'DESC'
  706.                                                 }
  707.                                             })
  708.                                             : null,
  709.                                         dataToggle: (message.firstJob.websiteTotal > 0) ? 'sidepanel' : null,
  710.                                         dataTarget: (message.firstJob.websiteTotal > 0) ? '#sidepanel__filtered_logs' : null,
  711.                                     },
  712.                                     {
  713.                                         label: 'Successful posts',
  714.                                         value: message.firstJob.websiteSucceeded|number_format,
  715.                                         link: (message.firstJob.websiteSucceeded > 0)
  716.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  717.                                                 message: message.id,
  718.                                                 query: {
  719.                                                     filter: 'website',
  720.                                                     state: 'completed',
  721.                                                     sort: 'timestamp',
  722.                                                     direction: 'DESC'
  723.                                                 }
  724.                                             })
  725.                                             : null,
  726.                                         dataToggle: (message.firstJob.websiteSucceeded > 0) ? 'sidepanel' : null,
  727.                                         dataTarget: (message.firstJob.websiteSucceeded > 0) ? '#sidepanel__filtered_logs' : null,
  728.                                     },
  729.                                     {
  730.                                         label: 'Errors',
  731.                                         value: message.firstJob.websiteFailed|number_format,
  732.                                         link: (message.firstJob.websiteFailed > 0)
  733.                                             ? path('app.notifications.dashboard.messages.filtered_logs', {
  734.                                                 message: message.id,
  735.                                                 query: {
  736.                                                     filter: 'website',
  737.                                                     state: 'failed',
  738.                                                     sort: 'timestamp',
  739.                                                     direction: 'DESC'
  740.                                                 }
  741.                                             })
  742.                                             : null,
  743.                                         dataToggle: (message.firstJob.websiteFailed > 0) ? 'sidepanel' : null,
  744.                                         dataTarget: (message.firstJob.websiteFailed > 0) ? '#sidepanel__filtered_logs' : null,
  745.                                     },
  746.                                 ],
  747.                             } %}{% endembed %}
  748.                         {% endif %}
  749.                     {% endfor %}
  750.                 {% endblock %}
  751.             {% endembed %}
  752.         </div>
  753.     {% endif %}
  754. {% endblock %}
  755. {% block modals %}
  756.     {{ parent() }}
  757.     {% embed '@ui2022/modal.html.twig' with {
  758.         attr: {
  759.             id: 'modal__email_preview',
  760.         },
  761.     } %}
  762.         {% block content %}
  763.             {% embed '@ui2022/modal__content.html.twig' with {
  764.                 title: 'Email Preview',
  765.             } %}
  766.                 {% block body %}
  767.                     <iframe
  768.                         id="preview-email-iframe"
  769.                         loading="lazy"
  770.                         src="{{ path('app.notifications.dashboard.messages.email_preview', {message: message.id}) }}"
  771.                         frameborder="0"
  772.                         style="width: 100%; height: 500px"
  773.                     >
  774.                     </iframe>
  775.                 {% endblock %}
  776.             {% endembed %}
  777.         {% endblock %}
  778.     {% endembed %}
  779.     {% include '@ui2022/schoolnow/modal--sidepanel.html.twig' with {
  780.         attr: {
  781.             id: 'sidepanel__filtered_logs',
  782.         },
  783.     } %}
  784.     <script type="text/javascript">
  785.         (function (window, document, $, undefined) {
  786.             $(function () {
  787.                 $('#sidepanel__filtered_logs').on('updated.cs.modal', function (e) {
  788.                     const pageHeight = $(window).height();
  789.                     const headerHeight = $('.sidepanel__head').outerHeight();
  790.                     $('.sidepanel__content').height((pageHeight - 3 * headerHeight) + 'px');
  791.                 });
  792.             });
  793.         })(window, document, jQuery);
  794.     </script>
  795. {% endblock %}