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

Open in your IDE?
  1. {% extends '@ProductsNotifications/base--full.html.twig' %}
  2. {% form_theme form '@ui2022/schoolnow/forms/themes/default.html.twig' %}
  3. {% block styles %}uilib bg-white{% endblock %}
  4. {% block topbar %}
  5.     {% set steps =
  6.         [
  7.             {
  8.                 text: 'Create message',
  9.                 button: {
  10.                     button: 'form',
  11.                     type: 'submit',
  12.                     styles: 'wizard',
  13.                     form: {
  14.                         name: form.action.vars.full_name,
  15.                         value: 'save',
  16.                         form: form.vars.id,
  17.                         formaction: path('app.notifications.dashboard.messages.manage', {
  18.                             message: message.id,
  19.                             jump: path('app.notifications.dashboard.messages.update', {
  20.                                 message: message.id,
  21.                             }),
  22.                         }),
  23.                     },
  24.                 },
  25.             },
  26.             {
  27.                 active: true,
  28.                 text: 'Review and test',
  29.             },
  30.         ]
  31.     %}
  32.     {% include '@ui2022/topbar--wizard.html.twig' with {
  33.         steps: steps,
  34.         subactions: [
  35.             {
  36.                 text: 'Exit',
  37.                 link: path('app.notifications.dashboard.messages.main'),
  38.                 styles: 'lighter md',
  39.                 attr: {
  40.                     id: 'btn__exit',
  41.                 },
  42.             },
  43.             {
  44.                 button: 'form',
  45.                 type: 'submit',
  46.                 text: 'Save',
  47.                 styles: 'lighter md',
  48.                 form: {
  49.                     name: form.action.vars.full_name,
  50.                     value: 'save',
  51.                     form: form.vars.id,
  52.                     formaction: path('app.notifications.dashboard.messages.manage', {
  53.                         message: message.id,
  54.                         saved: false
  55.                     }),
  56.                 },
  57.             },
  58.         ],
  59.         actions: [
  60.             {
  61.                 button: 'a',
  62.                 text: 'Send test',
  63.                 link: path('app.notifications.dashboard.messages.test', {
  64.                     message: message.id,
  65.                 }),
  66.                 styles: 'lighter md',
  67.                 modal: 'modal__test',
  68.             },
  69.             {
  70.                 text: 'Send',
  71.                 styles: 'orange wide md',
  72.                 modal: 'modal__send',
  73.             },
  74.         ],
  75.     } %}
  76. {% endblock %}
  77. {% block content %}
  78.     {% set isWebsiteAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__WEBSITE')) %}
  79.     {% set isFacebookAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__FACEBOOK')) %}
  80.     {% set isTwitterAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__TWITTER')) %}
  81.     {% set isInstagramAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__INSTAGRAM')) %}
  82.     {% set isEmailAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__EMAIL')) %}
  83.     {% set isVoiceAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__VOICE')) %}
  84.     {% set isSmsAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__SMS')) %}
  85.     {% set isAppAllowed = message.hasStarterChannel(constant('Products\\NotificationsBundle\\Entity\\Notifications\\Channels\\ChannelsInterface::CHANNELS__APP')) %}
  86.     {{ form_start(form) }}
  87.     {% include '@ui2022/schoolnow/review__schedule.html.twig' with {
  88.         form: form.scheduled,
  89.         picker: form.scheduledAt,
  90.     } %}
  91.     {% embed '@ui2022/schoolnow/review__feature.html.twig' with {
  92.         title: message.title,
  93.     } %}
  94.         {% block content %}
  95.             <p>
  96.                 <a
  97.                     id="edit-message"
  98.                     class="font-14 featured__link"
  99.                     href="{{- path('app.notifications.dashboard.messages.update', { message: message.id }) -}}"
  100.                     data-url="{{-
  101.                         path('app.notifications.dashboard.messages.manage', {
  102.                             message: message.id,
  103.                             saved: false,
  104.                             jump: path('app.notifications.dashboard.messages.update', {
  105.                                 message: message.id,
  106.                             }),
  107.                         })
  108.                     -}}"
  109.                 >
  110.                     Edit Message
  111.                 </a>
  112.             </p>
  113.         {% endblock %}
  114.     {% endembed %}
  115.     <div class="container-md">
  116.         {% embed '@ui2022/schoolnow/review__block--grid.html.twig' with {
  117.             title: 'Contacts',
  118.         } %}
  119.             {% block content %}
  120.                 {% include '@ui2022/schoolnow/review__cell--icon.html.twig' with {
  121.                     icon: 'icon-contacts-user',
  122.                 } %}
  123.                 {% include '@ui2022/schoolnow/review__cell--list.html.twig' with {
  124.                     items: message.lists|map(list => "#{list.name} (#{counts.lists[list.id]|number_format})"),
  125.                 } %}
  126.                 {% include '@ui2022/schoolnow/review__cell--count.html.twig' with {
  127.                     text: counts.total|number_format,
  128.                 } %}
  129.             {% endblock %}
  130.         {% endembed %}
  131.         {% embed '@ui2022/schoolnow/review__block--grid.html.twig' with {
  132.             title: 'Translations',
  133.         } %}
  134.             {% block content %}
  135.                 {% include '@ui2022/schoolnow/review__cell--icon.html.twig' with {
  136.                     icon: 'icon-translations',
  137.                 } %}
  138.                 {% embed '@ui2022/schoolnow/review__cell--content.html.twig' %}
  139.                     {% block content %}
  140.                         {% for language in languages %}
  141.                             <a
  142.                                 class="lang_pill mb-2 {% if language['isActive'] %}active{% endif %}"
  143.                                 href="#"
  144.                                 data-locale="{{ language['locale'] }}"
  145.                                 data-toggle="sidepanel"
  146.                                 data-target="{{ '#translation-sidepanel-' ~ language['locale'] }}"
  147.                             >
  148.                                 {{- language['humanReadableLocaleName'] -}}
  149.                             </a>
  150.                         {% endfor %}
  151.                     {% endblock %}
  152.                 {% endembed %}
  153.             {% endblock %}
  154.         {% endembed %}
  155.         {% embed '@ui2022/schoolnow/review__block--grid.html.twig' with {
  156.             title: 'Branding',
  157.         } %}
  158.             {% block content %}
  159.                 <div class="col-12 container">
  160.                     {{ form_widget(form.branding) }}
  161.                 </div>
  162.             {% endblock %}
  163.         {% endembed %}
  164.         {% embed '@ui2022/schoolnow/review__block.html.twig' with {
  165.             title: 'Share to',
  166.             attr: {
  167.                 class: 'review-sharing-block',
  168.             },
  169.         } %}
  170.             {% block content %}
  171.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  172.                     active: true,
  173.                     show: isWebsiteAllowed,
  174.                 } %}
  175.                     {% block content %}
  176.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  177.                             form: form.channels.website,
  178.                             locked: (not isWebsiteAllowed),
  179.                         } %}
  180.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  181.                             src: asset('/ui2022/images/website-alert-active.svg'),
  182.                         } %}
  183.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  184.                             title: 'Website Alert',
  185.                             details:
  186.                                 (message.websiteDepartments)
  187.                                 ?
  188.                                 message.websiteDepartments|map(
  189.                                     department => department.name
  190.                                 )|join(', ')
  191.                                 :
  192.                                 null,
  193.                         } %}
  194.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  195.                             {% block content %}
  196.                                 {% for department in message.websiteDepartments %}
  197.                                     <div class="socialpreview__head">
  198.                                         <span class="socialpreview__head--pic" style="border-radius: 0%;">
  199.                                             <i class="far fa-2x fa-folder"></i>
  200.                                         </span>
  201.                                         <span class="socialpreview__head--title">{{ department.name }}</span>
  202.                                     </div>
  203.                                 {% endfor %}
  204.                                 {{ form_row(form.websiteEndDateTime) }}
  205.                                 {{ form_row(form.websiteLevel) }}
  206.                                 {{ form_row(form.websiteBehavior) }}
  207.                             {% endblock %}
  208.                         {% endembed %}
  209.                     {% endblock %}
  210.                 {% endembed %}
  211.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  212.                     active: true,
  213.                     show: isFacebookAllowed,
  214.                 } %}
  215.                     {% block content %}
  216.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  217.                             form: form.channels.facebook,
  218.                             locked: (not isFacebookAllowed),
  219.                         } %}
  220.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  221.                             src: asset('/ui2022/images/facebook-active.svg'),
  222.                         } %}
  223.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  224.                             title: 'Facebook',
  225.                             details:
  226.                                 (message.facebookSocialAccounts)
  227.                                 ?
  228.                                 message.facebookSocialAccounts|map(
  229.                                     account => account.name
  230.                                 )|join(', ')
  231.                                 :
  232.                                 null,
  233.                         } %}
  234.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  235.                             {% block content %}
  236.                                 {% for facebook in message.facebookSocialAccounts %}
  237.                                     <div class="socialpreview__head">
  238.                                         <span class="socialpreview__head--pic">
  239.                                             <img src="{{- path('app.notifications.dashboard.default.social_avatar', {
  240.                                                 account: facebook.id,
  241.                                             }) -}}" width="48" height="47" />
  242.                                         </span>
  243.                                         <span class="socialpreview__head--title">{{ facebook.name }}</span>
  244.                                         <span class="socialpreview__head--icon socialpreview__head--fb">
  245.                                             <i class="icon-facebook-circle"></i>
  246.                                         </span>
  247.                                     </div>
  248.                                 {% endfor %}
  249.                                 <div class="socialpreview__comment">
  250.                                     {{ form_widget(form.facebookNote, {
  251.                                         attr: {
  252.                                             placeholder: 'Add comment',
  253.                                             class: 'clearstyle',
  254.                                         },
  255.                                     }) }}
  256.                                 </div>
  257.                                 <div class="socialpreview__view">
  258.                                     {% if message.media|length > 0 %}
  259.                                         <img class="img-fluid d-block mx-auto" src="{{- (message.media.feature|decorate_media)._urls.medium -}}" width="594" height="417" alt="Facebook Preview" />
  260.                                     {% endif %}
  261.                                     <div class="socialpreview__meta">
  262.                                         <span class="socialpreview__url">www.schoolnow.com</span>
  263.                                         <span class="socialpreview__title">{{ message.title }}</span>
  264.                                         <span class="socialpreview__desc text-truncate">{{ message.description|striptags }}</span>
  265.                                     </div>
  266.                                 </div>
  267.                             {% endblock %}
  268.                         {% endembed %}
  269.                     {% endblock %}
  270.                 {% endembed %}
  271.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  272.                     active: true,
  273.                     show: isTwitterAllowed,
  274.                 } %}
  275.                     {% block content %}
  276.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  277.                             form: form.channels.twitter,
  278.                             locked: (not isTwitterAllowed),
  279.                         } %}
  280.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  281.                             src: asset('/ui2022/images/twitter-active.svg'),
  282.                         } %}
  283.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  284.                             title: 'Twitter',
  285.                             details:
  286.                                 (message.twitterSocialAccounts)
  287.                                 ?
  288.                                 message.twitterSocialAccounts|map(
  289.                                     account => '@%s'|format(account.twitterUserName)
  290.                                 )|join(', ')
  291.                                 :
  292.                                 null,
  293.                         } %}
  294.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  295.                             {% block content %}
  296.                                 {% for social in message.twitterSocialAccounts %}
  297.                                     <div class="socialpreview__head">
  298.                                         <span class="socialpreview__head--pic">
  299.                                             <img src="{{- path('app.notifications.dashboard.default.social_avatar', {
  300.                                                 account: social.id,
  301.                                             }) -}}" width="48" height="47" />
  302.                                         </span>
  303.                                         <span class="socialpreview__head--title">
  304.                                             {{ social.name }}
  305.                                             <span class="text-body font-14 d-block text-semibold">@{{ social.twitterUserName }}</span>
  306.                                         </span>
  307.                                         <span class="socialpreview__head--icon socialpreview__head--fb">
  308.                                             <i class="icon-twitter-circle"></i>
  309.                                         </span>
  310.                                     </div>
  311.                                 {% endfor %}
  312.                                 <div class="socialpreview__comment">
  313.                                     {{ form_widget(form.twitterNote, {
  314.                                         attr: {
  315.                                             placeholder: 'Add comment',
  316.                                             class: 'clearstyle',
  317.                                         },
  318.                                     }) }}
  319.                                 </div>
  320.                                 <div class="socialpreview__view">
  321.                                     {% if message.media|length > 0 %}
  322.                                         <img class="img-fluid d-block mx-auto" src="{{- (message.media.feature|decorate_media)._urls.medium -}}" width="594" height="417" alt="Twitter Preview" />
  323.                                     {% endif %}
  324.                                     <div class="socialpreview__meta">
  325.                                         <span class="socialpreview__url">www.schoolnow.com</span>
  326.                                         <span class="socialpreview__title">{{ message.title }}</span>
  327.                                         <span class="socialpreview__desc text-truncate">{{ message.description|striptags }}</span>
  328.                                     </div>
  329.                                 </div>
  330.                             {% endblock %}
  331.                         {% endembed %}
  332.                     {% endblock %}
  333.                 {% endembed %}
  334.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  335.                     active: true,
  336.                     show: isInstagramAllowed,
  337.                 } %}
  338.                     {% block content %}
  339.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  340.                             form: form.channels.instagram,
  341.                             locked: ( (not isInstagramAllowed) or (not message.media|length) ),
  342.                         } %}
  343.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  344.                             src: asset('/ui2022/images/instagram-active.svg'),
  345.                         } %}
  346.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  347.                             title: 'Instagram',
  348.                             details:
  349.                                 (message.instagramSocialAccounts)
  350.                                 ?
  351.                                 message.instagramSocialAccounts|map(
  352.                                     account => account.name
  353.                                 )|join(', ')
  354.                                 :
  355.                                 null,
  356.                         } %}
  357.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  358.                             {% block content %}
  359.                                 {% for social in message.instagramSocialAccounts %}
  360.                                     <div class="socialpreview__head">
  361.                                         <span class="socialpreview__head--pic">
  362.                                             <img src="{{- path('app.notifications.dashboard.default.social_avatar', {
  363.                                                 account: social.id,
  364.                                             }) -}}" width="48" height="47" />
  365.                                         </span>
  366.                                         <span class="socialpreview__head--title">@{{ social.name }}</span>
  367.                                         <span class="socialpreview__head--icon socialpreview__head--fb">
  368.                                             <i class="fab fa-instagram"></i>
  369.                                         </span>
  370.                                     </div>
  371.                                 {% endfor %}
  372.                                 <div class="socialpreview__view">
  373.                                     {% if message.media|length > 0 %}
  374.                                         <img class="img-fluid d-block mx-auto" src="{{- (message.media.feature|decorate_media)._urls.medium -}}" width="594" height="417" alt="Instagram Preview" />
  375.                                     {% endif %}
  376.                                     <div class="socialpreview__meta">
  377.                                         <span class="socialpreview__url">www.schoolnow.com</span>
  378.                                         <span class="socialpreview__title">{{ message.title }}</span>
  379.                                         <span class="socialpreview__desc text-truncate"></span>
  380.                                     </div>
  381.                                 </div>
  382.                             {% endblock %}
  383.                         {% endembed %}
  384.                     {% endblock %}
  385.                 {% endembed %}
  386.                 {% if isEmailAllowed or isVoiceAllowed or isSmsAllowed or isAppAllowed %}
  387.                     {% include '@ui2022/schoolnow/review__row--title.html.twig' with {
  388.                         text: 'Send to',
  389.                     } %}
  390.                 {% endif %}
  391.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  392.                     active: true,
  393.                     show: isEmailAllowed,
  394.                     disabled: (not message.isUrgent),
  395.                 } %}
  396.                     {% block content %}
  397.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  398.                             form: form.channels.email,
  399.                         } %}
  400.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  401.                             src: asset('/ui2022/images/email-active.svg'),
  402.                         } %}
  403.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  404.                             title: 'Email',
  405.                             details: (message.emailName and message.emailFrom) ? ('From: ' ~ message.emailName ~ ' <' ~ message.emailFrom ~ '>'),
  406.                         } %}
  407.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  408.                             {% block content %}
  409.                                 <div>
  410.                                     <h6>Subject:</h6>
  411.                                     <p>{{ message.emailSubject }}</p>
  412.                                 </div>
  413.                                 <div class="pt-3 mb-4">
  414.                                     <h6>Email:</h6>
  415.                                     <div class="email__box border pt-2">
  416.                                         <iframe
  417.                                             id="{{ form.channels.email.vars.id }}__preview"
  418.                                             scrolling="no"
  419.                                             style="width: 100%; border: 0;"
  420.                                             src="{{-
  421.                                                 path('app.notifications.dashboard.messages.email_preview', {
  422.                                                     message: message.id,
  423.                                                 })
  424.                                             -}}">
  425.                                         </iframe>
  426.                                         <script type="text/javascript">
  427.                                             (function (window, document, $, undefined) {
  428.                                                 $(function () {
  429.                                                     var $frame = $('#{{ form.channels.email.vars.id }}__preview');
  430.                                                     $frame.closest('.blocklist__panel').on('show.bs.collapse', function (e) {
  431.                                                         setTimeout(function () {
  432.                                                             $frame.height($($frame[0].contentWindow.document).height());
  433.                                                         }, 1);
  434.                                                     });
  435.                                                 });
  436.                                             })(window, document, jQuery);
  437.                                         </script>
  438.                                     </div>
  439.                                 </div>
  440.                             {% endblock %}
  441.                         {% endembed %}
  442.                     {% endblock %}
  443.                 {% endembed %}
  444.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  445.                     active: true,
  446.                     show: isVoiceAllowed,
  447.                 } %}
  448.                     {% block content %}
  449.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  450.                             form: form.channels.voice,
  451.                             locked: (not isVoiceAllowed or not message.isUrgent or not message.recording),
  452.                         } %}
  453.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  454.                             src: asset('/ui2022/images/voice-active.svg'),
  455.                         } %}
  456.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  457.                             title: 'Voice',
  458.                             details: 'From: %s %s'|format(
  459.                                 configs.twilio
  460.                                 ? configs.twilio.incomingPhoneNumber|phone_number_format
  461.                                 : '?',
  462.                                 (message.voiceCallerId) ? 'Caller ID: %s'|format(message.voiceCallerId.phoneNumber|phone_number_format) : null
  463.                             )|trim,
  464.                         } %}
  465.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  466.                             {% block content %}
  467.                                 {% if message.recording and message.recording.recorded %}
  468.                                     <audio id="{{ form.channels.voice.vars.id }}__playback" controls class="w-100">
  469.                                         <source src="{{ blobs(message.recording).recordingUrl(message.recording)|escape('html_attr') }}"></source>
  470.                                     </audio>
  471.                                     <script type="text/javascript">
  472.                                         (function (window, document, $, undefined) {
  473.                                             $(function () {
  474.                                                 var $panel = $('#{{ form.channels.voice.vars.id }}__blocklist__panel'),
  475.                                                 $playback = $('#{{ form.channels.voice.vars.id }}__playback');
  476.                                                 $panel.on('hide.bs.collapse', function (e) {
  477.                                                     $playback[0].pause();
  478.                                                     $playback[0].currentTime = 0;
  479.                                                 });
  480.                                             });
  481.                                         })(window, document, jQuery);
  482.                                     </script>
  483.                                     {% if message.recording.methodName is same as('speech') %}
  484.                                         <blockqoute></blockqoute>
  485.                                         <div class="sms__thread">
  486.                                             <div class="row flex-nowrap row--10 sms__row">
  487.                                                 <div class="col">
  488.                                                     <div class="sms__msg">
  489.                                                         <p>{{ message.recording.speechText }}</p>
  490.                                                     </div>
  491.                                                 </div>
  492.                                             </div>
  493.                                         </div>
  494.                                     {% endif %}
  495.                                 {% endif %}
  496.                             {% endblock %}
  497.                         {% endembed %}
  498.                     {% endblock %}
  499.                 {% endembed %}
  500.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  501.                     active: true,
  502.                     show: isSmsAllowed,
  503.                     disabled: (not message.isUrgent),
  504.                 } %}
  505.                     {% block content %}
  506.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  507.                             form: form.channels.sms,
  508.                         } %}
  509.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  510.                             src: asset('/ui2022/images/text-active.svg'),
  511.                         } %}
  512.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  513.                             title: 'SMS',
  514.                             details: 'From: %s'|format(
  515.                                 configs.twilio
  516.                                     ? configs.twilio.incomingPhoneNumber|phone_number_format
  517.                                     : '?'
  518.                             ),
  519.                         } %}
  520.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  521.                             {% block content %}
  522.                                 <div class="sms__thread">
  523.                                     <div class="row flex-nowrap row--10 sms__row">
  524.                                         <div class="col-auto">
  525.                                             <div class="sms__avatar">
  526.                                                 <img class="sms__avatar--img" src="/ui2022/images/send-message-avatar.svg" width="30" height="34" alt="" />
  527.                                             </div>
  528.                                         </div>
  529.                                         <div class="col">
  530.                                             <div class="sms__msg">
  531.                                                 <p>{{ message.smsContent }} <a href="#">https://cmps.st/{{ token(8) }}</a></p>
  532.                                             </div>
  533.                                         </div>
  534.                                     </div>
  535.                                 </div>
  536.                             {% endblock %}
  537.                         {% endembed %}
  538.                     {% endblock %}
  539.                 {% endembed %}
  540.                 {% embed '@ui2022/schoolnow/review__row.html.twig' with {
  541.                     active: true,
  542.                     show: isAppAllowed,
  543.                 } %}
  544.                     {% block content %}
  545.                         {% include '@ui2022/schoolnow/review__cell--checkmark.html.twig' with {
  546.                             form: form.channels.app,
  547.                         } %}
  548.                         {% include '@ui2022/schoolnow/review__cell--svg.html.twig' with {
  549.                             src: asset('/ui2022/images/mobile-app-active.svg'),
  550.                         } %}
  551.                         {% include '@ui2022/schoolnow/review__cell--title.html.twig' with {
  552.                             title: 'Mobile App',
  553.                             details: '',
  554.                         } %}
  555.                         {% embed '@ui2022/schoolnow/review__cell--collapse.html.twig' %}
  556.                             {% block content %}
  557.                                 <div class="sms__thread">
  558.                                     <div class="row flex-nowrap row--10 sms__row">
  559.                                         <div class="col-auto">
  560.                                             <div class="sms__avatar">
  561.                                                 <img class="sms__avatar--img" src="/ui2022/images/send-message-avatar.svg" width="30" height="34" alt="" />
  562.                                             </div>
  563.                                         </div>
  564.                                         <div class="col">
  565.                                             <div class="sms__msg">
  566.                                                 <p>{{ message.appBody }}</p>
  567.                                             </div>
  568.                                         </div>
  569.                                     </div>
  570.                                 </div>
  571.                             {% endblock %}
  572.                         {% endembed %}
  573.                     {% endblock %}
  574.                 {% endembed %}
  575.             {% endblock %}
  576.         {% endembed %}
  577.     </div>
  578.     {% if form.translations.translations is empty %}
  579.         <div class="d-none">
  580.             {{ form_label(form.translations) }}
  581.             {{ form_widget(form.translations) }}
  582.         </div>
  583.     {% else %}
  584.         {% for translationForm in form.translations.translations %}
  585.             {% set locale = translationForm.vars.value.locale %}
  586.             {% set humanReadableLocale = humanReadableLocales[locale] is defined ? humanReadableLocales[locale] : locale %}
  587.             {% embed '@ui2022/schoolnow/modal--sidepanel.html.twig' with {
  588.                 attr: {
  589.                     id: ('translation-sidepanel-' ~ locale),
  590.                     class: 'translation-sidepanel',
  591.                     'data-locale': locale,
  592.                 },
  593.             } %}
  594.                 {% block header %}
  595.                     <div class="sidepanel__head-left">
  596.                         <h2 class="text-an-demibold">{{ humanReadableLocale }}</h2>
  597.                     </div>
  598.                     <div class="sidepanel__head--right">
  599.                         {% include '@ui2022/button--button.html.twig' with {
  600.                             text: 'Hide',
  601.                             styles: 'lighter',
  602.                             attr: {
  603.                                 'data-dismiss': 'sidepanel',
  604.                             },
  605.                         } %}
  606.                     </div>
  607.                 {% endblock %}
  608.                 {% block content %}
  609.                     <div class="mb-3">
  610.                         {{ form_label(translationForm.title) }}
  611.                         {{ form_widget(translationForm.title) }}
  612.                     </div>
  613.                     <div class="mb-3 text-black">
  614.                         {{ form_label(translationForm.description) }}
  615.                         {{ form_widget(translationForm.description) }}
  616.                     </div>
  617.                     <div class="{% if not isVoiceAllowed %}d-none{% endif %}">
  618.                         {% if translationForm.script is defined and translationForm.recording is defined %}
  619.                             <div class="mb-3">
  620.                                 {{ form_label(translationForm.script) }}
  621.                                 {{ form_widget(translationForm.script) }}
  622.                             </div>
  623.                             <div class="mb-3">
  624.                                 {{ form_label(translationForm.recording) }}
  625.                                 {{ form_widget(translationForm.recording, {
  626.                                     row_attr: {
  627.                                         class: 'pt-0 mb-5',
  628.                                     },
  629.                                 }) }}
  630.                                 <script type="text/javascript">
  631.                                     (function (window, document, $, undefined) {
  632.                                         $(function () {
  633.                                             {% if translationForm.script is defined and translationForm.recording is defined %}
  634.                                                 $('#{{ translationForm.script.vars.id }}').on('input', function (e) {
  635.                                                     let $target = $(e.currentTarget),
  636.                                                         react = $('#{{ translationForm.recording.vars.id }}').data('react');
  637.                                                     react.api.setSpeech($target.val());
  638.                                                 });
  639.                                                 $('#{{ translationForm.script.vars.id }}').trigger('input');
  640.                                             {% endif %}
  641.                                         });
  642.                                     })(window, document, jQuery);
  643.                                 </script>
  644.                             </div>
  645.                         {% endif %}
  646.                     </div>
  647.                     {{ form_rest(translationForm) }}
  648.                 {% endblock %}
  649.             {% endembed %}
  650.         {% endfor %}
  651.     {% endif %}
  652.     {{ form_rest(form) }}
  653.     {{ form_end(form) }}
  654.     <script type="text/javascript">
  655.         (function (window, document, $, undefined) {
  656.             $(function () {
  657.                 $('#edit-message').on('click', function (e) {
  658.                     e.preventDefault();
  659.                     const form = $(this).closest('form');
  660.                     const redirectUrl = $(this).data('url');
  661.                     form.attr('action', redirectUrl);
  662.                     form.submit();
  663.                 });
  664.                 {% if app.request.get('saved') == 1 %}
  665.                     toastr.options = {
  666.                         positionClass: "toast-top-left mt-5 pt-4",
  667.                         fadeIn: 1000,
  668.                         timeOut: 3000,
  669.                         fadeOut: 1000,
  670.                     };
  671.                     toastr.success('Saved');
  672.                 {% endif %}
  673.                 var initialState = $('#{{ form.vars.id }}').serialize();
  674.                 $('#btn__exit').on('click', function (e) {
  675.                     var $this = $(this),
  676.                         $modal = $('#modal__exit'),
  677.                         currentState = $('#{{ form.vars.id }}').serialize();
  678.                     if (currentState !== initialState) {
  679.                         $modal.modal();
  680.                         return false;
  681.                     }
  682.                 });
  683.                 $('.translation_voice_player').click(function (event) {
  684.                     event.preventDefault();
  685.                     const locale = $(this).data('locale');
  686.                     $('#translation_voice_' + locale + '__container').addClass('d-none');
  687.                     $('#translation_voice_recorder_' + locale).removeClass('d-none');
  688.                 });
  689.                 $('.translation-sidepanel').on('do-show.cs.sidepanel', function (e) {
  690.                     toastr.clear();
  691.                 })
  692.                 $('.translation-sidepanel').on('do-hide.cs.sidepanel', function (e) {
  693.                     toastr.clear();
  694.                     const speechRadioButtons = $(this).find('.systab__btn[value="speech"]');
  695.                     if (speechRadioButtons.length !== 1) {
  696.                         return;
  697.                     }
  698.                     const isModeTextToSpeech = speechRadioButtons.first().is(":checked");
  699.                     const textToSpeechButtons = $(this).find('.btn-text-to-speech');
  700.                     if (textToSpeechButtons.length !== 1) {
  701.                         return;
  702.                     }
  703.                     const textToSpeechButton = textToSpeechButtons.first();
  704.                     const hasPendingTextChanges = ( (textToSpeechButton) && (!textToSpeechButtons.first().is(":disabled")) );
  705.                     if (isModeTextToSpeech && hasPendingTextChanges) {
  706.                         toastr.options = {
  707.                             positionClass: "toast-top-left mt-5 pt-4",
  708.                             timeOut: 0,
  709.                             tapToDismiss: true,
  710.                             fadeOut: 0,
  711.                         };
  712.                         const recordingError =
  713.                             '<h5 class="text-white">Voice transcript has changed</h5>' +
  714.                             '<p>Click <i>"Convert text to speech"</i></p>';
  715.                         toastr.error(recordingError);
  716.                         textToSpeechButton.on('click', function () {
  717.                             toastr.clear();
  718.                         });
  719.                         return false;
  720.                     }
  721.                 })
  722.                 $('.translation-sidepanel').on('hidden.cs.sidepanel', function (e) {
  723.                     toastr.clear();
  724.                     const locale = $(this).data('locale');
  725.                     const audioPlayers = $(this).find('audio');
  726.                     for (let i = 0; i < audioPlayers.length; i++) {
  727.                         audioPlayers[i].pause();
  728.                         audioPlayers[i].currentTime = 0;
  729.                     }
  730.                     const form = $('#message_channels_form').first();
  731.                     const url = '/_dashboard/notifications/messages/' + {{ message.id }} + '/' + locale + '/is_translation_modified';
  732.                     $.ajax({
  733.                         type: "POST",
  734.                         url: url,
  735.                         data: form.serialize(),
  736.                         success: function(data)
  737.                         {
  738.                             const localeTagElement = $('.lang_pill[data-locale='+locale+']').first();
  739.                             if (data.isModifiedOverall === true) {
  740.                                 localeTagElement.addClass('active');
  741.                             } else {
  742.                                 localeTagElement.removeClass('active');
  743.                             }
  744.                             if (data.isScriptModified === true && data.isRecordingModified !== true) {
  745.                                 toastr.options = {
  746.                                     positionClass: "toast-top-left mt-5 pt-4",
  747.                                     timeOut: 0,
  748.                                     tapToDismiss: true,
  749.                                     fadeOut: 0,
  750.                                 };
  751.                                 const recordingWarning =
  752.                                     '<h5 class="text-white">Forgot recording?</h5>' +
  753.                                     '<p>Voice transcript changed,<br />but recording not updated.</p>' +
  754.                                     '<p>' +
  755.                                     '<button type="button" class="btn btn-sm btn-light mr-3 flash-edit-translation">Edit translation</button>' +
  756.                                     '<button type="button" class="btn btn-sm btn-light flash-hide">Hide</button>' +
  757.                                     '</p>';
  758.                                 toastr.warning(recordingWarning);
  759.                                 $('.flash-edit-translation').off('click').on('click', function () {
  760.                                     toastr.clear();
  761.                                     localeTagElement.click();
  762.                                 })
  763.                                 $('.flash-hide').off('click').on('click', function () {
  764.                                     toastr.clear();
  765.                                 })
  766.                             }
  767.                         }
  768.                     })
  769.                 });
  770.                 $('#{{ form.branding.vars.id }}').on('change', function (e) {
  771.                     const url = '{{- path('app.notifications.dashboard.messages.email_preview', {message: message.id}) -}}' + ($(this).val() ? '/' + $(this).val() : '');
  772.                     $('#{{ form.channels.email.vars.id }}__preview').attr('src', url);
  773.                 });
  774.                 $('#{{ form.branding.vars.id }}').trigger('change');
  775.             });
  776.         })(window, document, jQuery);
  777.     </script>
  778. {% endblock %}
  779. {% block modals %}
  780.     {{ parent() }}
  781.     {% include '@ui2022/modal.html.twig' with {
  782.         attr: {
  783.             id: 'modal__test',
  784.             class: 'modal-ajax',
  785.         },
  786.         dialog_styles: 'dialog--createmsg dialog--testmsg dialog--scrollable',
  787.     } %}
  788.     {% embed '@ui2022/modal.html.twig' with {
  789.         attr: {
  790.             id: 'modal__exit',
  791.         },
  792.     } %}
  793.         {% block content %}
  794.             {% embed '@ui2022/modal__content.html.twig' with {
  795.                 styles: 'bg-danger',
  796.             } %}
  797.                 {% block body %}
  798.                     <div class="crmsg__dialogs">
  799.                         <img class="crmsg__icon" src="/ui2022/images/icon-createmsg-exit.svg" width="77.48" height="71.37" />
  800.                         <h2 class="crmsg__title">
  801.                             You have unsaved changes
  802.                         </h2>
  803.                         <p class="crmsg__desc font-18">
  804.                             Would you like to save changes or exit?
  805.                         </p>
  806.                         <div class="crmsg__btngroup">
  807.                             {% include '@ui2022/button--a.html.twig' with {
  808.                                 text: 'Just Exit',
  809.                                 link: path('app.notifications.dashboard.messages.main'),
  810.                                 styles: 'danger',
  811.                                 attr: {
  812.                                     class: 'mr-4',
  813.                                 },
  814.                             } %}
  815.                             {% include '@ui2022/button--form.html.twig' with {
  816.                                 type: 'submit',
  817.                                 text: 'Save & Exit',
  818.                                 styles: 'white',
  819.                                 form: {
  820.                                     name: form.action.vars.full_name,
  821.                                     value: 'save',
  822.                                     form: form.vars.id,
  823.                                     formaction: path('app.notifications.dashboard.messages.manage', {
  824.                                         message: message.id,
  825.                                         saved: false,
  826.                                         jump: path('app.notifications.dashboard.messages.main'),
  827.                                     }),
  828.                                 },
  829.                             } %}
  830.                         </div>
  831.                     </div>
  832.                 {% endblock %}
  833.             {% endembed %}
  834.         {% endblock %}
  835.     {% endembed %}
  836.     {% embed '@ui2022/modal.html.twig' with {
  837.         attr: {
  838.             id: 'modal__send',
  839.         },
  840.     } %}
  841.         {% block content %}
  842.             {% embed '@ui2022/modal__content.html.twig' with {
  843.                 styles: 'bg-orange',
  844.             } %}
  845.                 {% block body %}
  846.                     <div class="crmsg__dialogs">
  847.                         <img class="crmsg__icon" src="/ui2022/images/icon-send-msg.svg" width="85" height="85" />
  848.                         <h2 class="crmsg__title">
  849.                             Confirm you are ready to send!
  850.                         </h2>
  851.                         <p class="crmsg__desc font-18">
  852.                             Please confirm you would like to proceed.
  853.                         </p>
  854.                         <div class="crmsg__btngroup">
  855.                             {% include '@ui2022/button--form.html.twig' with {
  856.                                 type: 'submit',
  857.                                 text: 'Send now',
  858.                                 styles: 'orange',
  859.                                 form: {
  860.                                     name: form.action.vars.full_name,
  861.                                     value: 'send',
  862.                                     form: form.vars.id,
  863.                                 },
  864.                             } %}
  865.                         </div>
  866.                     </div>
  867.                 {% endblock %}
  868.             {% endembed %}
  869.         {% endblock %}
  870.     {% endembed %}
  871. {% endblock %}