{% extends "users/base.html" %}
{% block title %}Add new domain{% endblock title %}
{% block content %}
<div class="card card-default">
 <div class="card-header">
        <h2>Edit DNS</h2>
        

      </div>
<div class="card-body">
    <form method="post" enctype="multipart/form-data">
        {% csrf_token %}
        <div class="form-row">
            <div class="col-md-5">
                <div class="form-group">
                <label for="dns_name" id="labelName">Name</label>
                <input type="text" class="form-control" id="dns_name" name="dns_name" placeholder="example.com" value="{{ dns.name }}" required>
                
            </div>
            <div class="form-group">
                <label for="dns_value" id="labelValue">Address</label>
                <input type="text" class="form-control" id="dns_value" name="dns_value" placeholder="203.0.113.11" value="{{ dns.content }}" required>
                
            </div>
			<div class="form-group">
                <label for="dns_value" id="labelValue">TTL</label>
                <input type="text" class="form-control" id="ttl" name="ttl" placeholder="203.0.113.11" value="{{ dns.ttl }}" required>
                
            </div>
			
			{% if dns.type == "MX" %}
			<div class="form-group">
                <label for="dns_value" id="labelValue">Priority</label>
                <input type="text" class="form-control" id="prio" name="prio" placeholder="203.0.113.11" value="{{ dns.prio }}" required>
                
            </div>
           
        {% endif %}
			
			
			
				<div class="form-group">
    <label class="small mb-1" for="type">Select Type:</label>
    <select class="form-control" name="type" id="type">
        <option value="A" {% if dns.type == "A" %}selected{% endif %}>A</option>
        <option value="AAAA" {% if dns.type == "AAAA" %}selected{% endif %}>AAAA</option>
        <option value="CAA" {% if dns.type == "CAA" %}selected{% endif %}>CAA</option>
        <option value="CNAME" {% if dns.type == "CNAME" %}selected{% endif %}>CNAME</option>
        <option value="MX" {% if dns.type == "MX" %}selected{% endif %}>MX</option>
        <option value="SRV" {% if dns.type == "SRV" %}selected{% endif %}>SRV</option>
        <option value="TXT" {% if dns.type == "TXT" %}selected{% endif %}>TXT</option>
        <option value="SOA" {% if dns.type == "SOA" %}selected{% endif %}>SOA</option>
        <option value="NS" {% if dns.type == "NS" %}selected{% endif %}>NS</option>
    </select>
</div>

				
            </div>
        </div>
        <button type="submit" class="mb-1 btn btn-success">Save Changes</button>
    </form>
</div>
</div>
{% endblock content %}
