mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Refactor email body out into a template
- Will be useful in the future when more email functionality is implemented
This commit is contained in:
		
							
								
								
									
										43
									
								
								InvenTree/templates/email/email.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								InvenTree/templates/email/email.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					{% load i18n %}
 | 
				
			||||||
 | 
					{% load static %}
 | 
				
			||||||
 | 
					{% load inventree_extras %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<table style='border-collapse: collapse; width: 85%; margin-left: 10%; font-size: 1rem; border: 1px solid #68686a; border-radius: 2px;'>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {% block header %}
 | 
				
			||||||
 | 
					    <tr style='background: #eef3f7; height: 4rem; text-align: center;'>
 | 
				
			||||||
 | 
					        <th colspan="100%" style="padding-bottom: 1rem; color: #68686a;">
 | 
				
			||||||
 | 
					            {% block header_row %}
 | 
				
			||||||
 | 
					            <p style='font-size: 1.25rem;'>{% block title %}<!-- email title goes here -->{% endblock %}</p>
 | 
				
			||||||
 | 
					            {% block subtitle %}
 | 
				
			||||||
 | 
					            <!-- email subtitle goes here -->
 | 
				
			||||||
 | 
					            {% endblock %}
 | 
				
			||||||
 | 
					            {% endblock %}
 | 
				
			||||||
 | 
					        </th>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    {% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {% block body %}
 | 
				
			||||||
 | 
					    <tr style="height: 3rem; border-bottom: 1px solid #68686a;">
 | 
				
			||||||
 | 
					        {% block body_row %}
 | 
				
			||||||
 | 
					        <!-- email body goes here -->
 | 
				
			||||||
 | 
					        {% endblock %}
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    {% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {% block footer %}
 | 
				
			||||||
 | 
					    <tr style='background: #eef3f7; height: 2rem;'>
 | 
				
			||||||
 | 
					        <td colspan="100%" style="padding-top:1rem; text-align: center">
 | 
				
			||||||
 | 
					            {% block footer_prefix %}
 | 
				
			||||||
 | 
					            <!-- Custom footer information goes here -->
 | 
				
			||||||
 | 
					            {% endblock %}
 | 
				
			||||||
 | 
					            <p><em><small>{% trans "InvenTree version" %}: {% inventree_version %} - <a href='https://inventree.readthedocs.io'>inventree.readthedocs.io</a></small></em></p>
 | 
				
			||||||
 | 
					            {% block footer_suffix %}
 | 
				
			||||||
 | 
					            <!-- Custom footer information goes here -->
 | 
				
			||||||
 | 
					            {% endblock %}
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					    {% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</table>
 | 
				
			||||||
@@ -1,35 +1,29 @@
 | 
				
			|||||||
 | 
					{% extends "email/email.html" %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% load i18n %}
 | 
					{% load i18n %}
 | 
				
			||||||
{% load inventree_extras %}
 | 
					{% load inventree_extras %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<table style="border-collapse:collapse; width: 80%;margin-left: 10%; font-size: 1rem">
 | 
					{% block title %}
 | 
				
			||||||
 | 
					{% blocktrans with part=part.name %} The available stock for {{ part }} has fallen below the configured minimum level{% endblocktrans %}
 | 
				
			||||||
 | 
					{% if link %}
 | 
				
			||||||
 | 
					<p>{% trans "Click on the following link to view this part" %}: <a href="{{ link }}">{{ link }}</a></p>
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <tr style="background: aliceblue; height: 4rem;">
 | 
					{% block subtitle %}
 | 
				
			||||||
        <th colspan="3" style="padding-bottom: 1rem; font-size: 1.25rem; color:rgb(210, 20, 20)">
 | 
					<p><em>{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.</em></p>
 | 
				
			||||||
            <p>{% blocktrans with part=part.name %} The available stock for {{ part }} has fallen below the configured minimum level{% endblocktrans %}</p> 
 | 
					{% endblock %}
 | 
				
			||||||
            {% if link %}
 | 
					 | 
				
			||||||
            <p>{% trans "Click on the following link to view this part" %}: <a href="{{ link }}">{{ link }}</a></p>
 | 
					 | 
				
			||||||
            {% endif %}
 | 
					 | 
				
			||||||
        </th>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <tr style="height: 3rem; border-bottom: 1px solid">
 | 
					{% block body %}
 | 
				
			||||||
        <th>{% trans "Part Name" %}</th>
 | 
					<tr style="height: 3rem; border-bottom: 1px solid">
 | 
				
			||||||
        <th>{% trans "Available Quantity" %}</th>
 | 
					    <th>{% trans "Part Name" %}</th>
 | 
				
			||||||
        <th>{% trans "Minimum Quantity" %}</th>
 | 
					    <th>{% trans "Available Quantity" %}</th>
 | 
				
			||||||
    </tr>
 | 
					    <th>{% trans "Minimum Quantity" %}</th>
 | 
				
			||||||
 | 
					</tr>
 | 
				
			||||||
    <tr style="height: 3rem">
 | 
					 | 
				
			||||||
        <td style="text-align: center;">{{ part.full_name }}</td>
 | 
					 | 
				
			||||||
        <td style="text-align: center;">{{ part.total_stock }}</td>
 | 
					 | 
				
			||||||
        <td style="text-align: center;">{{ part.minimum_stock }}</td>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <tr style="background-color: aliceblue;height: 4rem;">
 | 
					 | 
				
			||||||
        <td colspan="3" style="padding-top:1rem; text-align: center">
 | 
					 | 
				
			||||||
            <p><em>{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.</em></p>
 | 
					 | 
				
			||||||
            <p><em><small>{% trans "InvenTree version" %}: {% inventree_version %}</small></em></p>
 | 
					 | 
				
			||||||
        </td>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
</table>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<tr style="height: 3rem">
 | 
				
			||||||
 | 
					    <td style="text-align: center;">{{ part.full_name }}</td>
 | 
				
			||||||
 | 
					    <td style="text-align: center;">{{ part.total_stock }}</td>
 | 
				
			||||||
 | 
					    <td style="text-align: center;">{{ part.minimum_stock }}</td>
 | 
				
			||||||
 | 
					</tr>
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user