Files
torsearch/templates/broadcast/Monitor.stream.html.twig

86 lines
4.3 KiB
Twig

{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #}
{% block create %}
<turbo-stream action="remove" target="active_monitors_no_monitors">
</turbo-stream>
<turbo-stream action="append" target="monitors">
<template>
<tr id="monitor_{{ entity.id }}">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-stone-800 min-w-[50ch] max-w-[50ch] truncate">
{{ entity.title }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.searchCount }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.createdAt|date('m/d/Y h:i a') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.lastSearch|date('m/d/Y h:i a') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{% if entity.status == "New" %}
<twig:StatusBadge color="orange" status="{{ entity.status }}" />
{% elseif entity.status == "In Progress" or entity.status == "Active" %}
<twig:StatusBadge color="purple" status="{{ entity.status }}" />
{% else %}
<twig:StatusBadge color="green" status="{{ entity.status }}" />
{% endif %}
</td>
<td class="px-6 py-4 flex flex-row align-middle justify-center">
<button {{ stimulus_action('monitor_list', 'deleteMonitor', 'click', {id: entity.id}) }}>
<twig:ux:icon
name="ic:twotone-cancel" width="18px"
class="rounded-full align-middle text-red-600"
title="Remove {{ entity.title }} from your Monitor list."
/>
</button>
</td>
</tr>
</template>
</turbo-stream>
{% endblock %}
{% block update %}
<turbo-stream action="prepend" target="monitors">
<template>
<tr id="monitor_{{ entity.id }}">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-stone-800 min-w-[50ch] max-w-[50ch] truncate">
{{ entity.title }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.searchCount }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.createdAt|date('m/d/Y h:i a') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{{ entity.lastSearch|date('m/d/Y h:i a') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
{% if entity.status == "New" %}
<twig:StatusBadge color="orange" status="{{ entity.status }}" />
{% elseif entity.status == "In Progress" or entity.status == "Active" %}
<twig:StatusBadge color="purple" status="{{ entity.status }}" />
{% else %}
<twig:StatusBadge color="green" status="{{ entity.status }}" />
{% endif %}
</td>
<td class="px-6 py-4 flex flex-row align-middle justify-center">
<button {{ stimulus_action('monitor_list', 'deleteMonitor', 'click', {id: entity.id}) }}>
<twig:ux:icon
name="ic:twotone-cancel" width="18px"
class="rounded-full align-middle text-red-600"
title="Remove {{ entity.title }} from your Monitor list."
/>
</button>
</td>
</tr>
</template>
</turbo-stream>
{% endblock %}
{% block remove %}
<turbo-stream action="remove" target="monitor_{{ id }}"></turbo-stream>
{% endblock %}