getnamingo-registry/cp/resources/views/admin/contacts/updateContact.twig
2024-02-19 12:52:25 +02:00

300 lines
No EOL
20 KiB
Twig

{% extends "layouts/app.twig" %}
{% block title %}{{ __('Update Contact') }} {{ contact.identifier }}{% endblock %}
{% block content %}
<div class="page-wrapper">
<!-- Page header -->
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<!-- Page pre-title -->
<div class="page-pretitle">
{{ __('Overview') }}
</div>
<h2 class="page-title">
{{ __('Update Contact') }} {{ contact.identifier }}
</h2>
</div>
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<div class="col-12">
{% include 'partials/flash.twig' %}
<div class="card">
<div class="card-body">
<form action="/contact/update" method="post">
{{ csrf.field | raw }}<input type="hidden" name="identifier" value="{{ contact.identifier }}">
{% set postal_int = null %}
{% set postal_loc = null %}
{% for postal in contactPostal %}
{% if postal.type == 'int' %}
{% set postal_int = postal %}
{% elseif postal.type == 'loc' %}
{% set postal_loc = postal %}
{% endif %}
{% endfor %}
<div class="row">
<!-- First Column: General & Internationalized Info -->
<div class="col-md-6">
<h6 class="mb-3">{{ __('General & Internationalized Info') }}</h6>
<!-- Internationalized Name -->
<div class="mb-3">
<label for="intName" class="form-label required">{{ __('Name') }}</label>
<input type="text" class="form-control" id="intName" name="intName" required="required" value="{{ postal_int.name }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseNameInt" name="disclose_name_int" {% if postal_int.disclose_name_int == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseNameInt">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Internationalized Organization -->
<div class="mb-3">
<label for="intOrg" class="form-label required">{{ __('Organization') }}</label>
<input type="text" class="form-control" id="intOrg" name="org" required="required" value="{{ postal_int.org }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseOrgInt" name="disclose_org_int" {% if postal_int.disclose_org_int == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseOrgInt">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Internationalized Address: Street Details -->
<div class="mb-3">
<label for="street1" class="form-label required">{{ __('Street') }} 1</label>
<input type="text" class="form-control" id="street1" name="street1" required="required" value="{{ postal_int.street1 }}">
</div>
<div class="mb-3">
<label for="street2" class="form-label">{{ __('Street') }} 2</label>
<input type="text" class="form-control" id="street2" name="street2" value="{{ postal_int.street2 }}">
</div>
<div class="mb-3">
<label for="street3" class="form-label">{{ __('Street') }} 3</label>
<input type="text" class="form-control" id="street3" name="street3" value="{{ postal_int.street3 }}">
</div>
<!-- Internationalized Address: City, SP, PC, CC -->
<div class="mb-3">
<label for="city" class="form-label required">{{ __('City') }}</label>
<input type="text" class="form-control" id="city" name="city" required="required" value="{{ postal_int.city }}">
</div>
<div class="mb-3">
<label for="sp" class="form-label">{{ __('State/Province') }}</label>
<input type="text" class="form-control" id="sp" name="sp" value="{{ postal_int.sp }}">
</div>
<div class="mb-3">
<label for="pc" class="form-label">{{ __('Postal Code') }}</label>
<input type="text" class="form-control" id="pc" name="pc" value="{{ postal_int.pc }}">
</div>
<div class="mb-3">
<label for="cc" class="form-label required">{{ __('Country') }}</label>
<select class="form-select" id="cc" name="cc" required="required">
{% for country in countries %}
<option value="{{ country.alpha2 }}" {% if postal_int.cc == country.alpha2 %}selected{% endif %}>{{ country.name }}</option>
{% endfor %}
</select>
</div>
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseAddrInt" name="disclose_addr_int" {% if postal_int.disclose_addr_int == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseAddrInt">{{ __('Disclose Address in WHOIS') }}</span>
</label>
</div>
<!-- Second Column: Voice, Fax, Email, and other details -->
<div class="col-md-6">
<h6 class="mb-3">{{ __('Contact Details') }}</h6>
<!-- Voice -->
<div class="mb-3">
<label for="voice" class="form-label required">{{ __('Voice') }}</label>
<input type="tel" class="form-control" id="voice" name="voice" required="required" value="{{ contact.voice }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseVoice" name="disclose_voice" {% if contact.disclose_voice == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseVoice">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Fax -->
<div class="mb-3">
<label for="fax" class="form-label">{{ __('Fax') }}</label>
<input type="tel" class="form-control" id="fax" name="fax" value="{{ contact.fax }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseFax" name="disclose_fax" {% if contact.disclose_fax == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseFax">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Email -->
<div class="mb-3">
<label for="email" class="form-label required">{{ __('Email') }}</label>
<input type="email" class="form-control" id="email" name="email" required="required" autocapitalize="none" value="{{ contact.email }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseEmail" name="disclose_email" {% if contact.disclose_email == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseEmail">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- AuthInfo for Contact -->
<div class="mb-3">
<label for="authInfo" class="form-label required">{{ __('Contact AuthInfo') }}</label>
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ contactAuth.authinfo }}">
<small class="form-text text-muted">{{ __('Authentication information for the contact') }}.</small>
</div>
<!-- NIN - National Identification Number -->
<div class="mb-3">
<label for="nin" class="form-label">{{ __('NIN - National Identification Number') }}</label>
<input type="text" class="form-control" id="nin" name="nin" value="{{ contact.nin }}">
</div>
<!-- Personal or Business Checkbox -->
<div class="mb-3">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="isBusiness" name="isBusiness" {% if contact.nin_type == 'business' %}checked{% endif %}>
<label class="form-check-label" for="isBusiness">{{ __('This is a Business Contact') }}</label>
</div>
<!-- You can invert the logic if you prefer the default to be 'Personal' instead of 'Business' -->
</div>
{% if validation_enabled is not null %}
<div class="mb-3">
<a href="/contact/validate/{{ contact.identifier }}" class="btn btn-outline-{% if contact_valid == 0 %}secondary{% elseif contact_valid == 1 %}success{% elseif contact_valid == 2 %}success{% elseif contact_valid == 3 %}info{% endif %} w-100" {% if contact_valid == 1 %}disabled{% elseif contact_valid == 2 %}disabled{% elseif contact_valid == 3 %}disabled{% endif %}>
{% if contact_valid == 0 %}
Contact Validation
{% elseif contact_valid == 1 %}
Validated by Phone
{% elseif contact_valid == 2 %}
Validated by Email
{% elseif contact_valid == 3 %}
Validated by Postal Mail
{% endif %}
</a>
</div>
{% endif %}
</div>
</div>
<!-- Localized Info Checkbox -->
<div class="mb-3">
<label class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="toggleLoc" {% if postal_loc.cc %}checked{% endif %}>
<span class="form-check-label" for="toggleLoc">{{ __('Include Localized Info') }}</span>
</label>
</div>
<!-- Hidden Localized Info Rows -->
<div class="row" id="localizedInfo" style="display: none;">
<!-- Localized Postal Info: First Column -->
<div class="col-md-6">
<h6 class="mb-3">{{ __('Localized Postal Info: Personal Details') }}</h6>
<!-- Localized Name -->
<div class="mb-3">
<label for="locName" class="form-label">{{ __('Name') }}</label>
<input type="text" class="form-control" id="locName" name="locName" value="{{ postal_loc.name }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseNameLoc" name="disclose_name_loc" {% if postal_loc.disclose_name_loc == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseNameLoc">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Localized Organization -->
<div class="mb-3">
<label for="locOrg" class="form-label">{{ __('Organization') }}</label>
<input type="text" class="form-control" id="locOrg" name="locOrg" value="{{ postal_loc.org }}">
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseOrgLoc" name="disclose_org_loc" {% if postal_loc.disclose_org_loc == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseOrgLoc">{{ __('Disclose in WHOIS') }}</span>
</label>
</div>
<!-- Localized Street Details -->
<div class="mb-3">
<label for="locStreet1" class="form-label">{{ __('Street') }} 1</label>
<input type="text" class="form-control" id="locStreet1" name="locStreet1" value="{{ postal_loc.street1 }}">
</div>
<div class="mb-3">
<label for="locStreet2" class="form-label">{{ __('Street') }} 2</label>
<input type="text" class="form-control" id="locStreet2" name="locStreet2" value="{{ postal_loc.street2 }}">
</div>
</div>
<!-- Localized Postal Info: Second Column -->
<div class="col-md-6">
<h6 class="mb-3">{{ __('Localized Postal Info: Address Details') }}</h6>
<!-- Continued Localized Street Detail -->
<div class="mb-3">
<label for="locStreet3" class="form-label">{{ __('Street') }} 3</label>
<input type="text" class="form-control" id="locStreet3" name="locStreet3" value="{{ postal_loc.street3 }}">
</div>
<!-- Localized City, SP, PC, CC -->
<div class="mb-3">
<label for="locCity" class="form-label">{{ __('City') }}</label>
<input type="text" class="form-control" id="locCity" name="locCity" value="{{ postal_loc.city }}">
</div>
<div class="mb-3">
<label for="locSP" class="form-label">{{ __('State/Province') }}</label>
<input type="text" class="form-control" id="locSP" name="locSP" value="{{ postal_loc.sp }}">
</div>
<div class="mb-3">
<label for="locPC" class="form-label">{{ __('Postal Code') }}</label>
<input type="text" class="form-control" id="locPC" name="locPC" value="{{ postal_loc.pc }}">
</div>
<div class="mb-3">
<label for="locCC" class="form-label">{{ __('Country') }}</label>
<select class="form-select" id="locCC" name="locCC">
{% for country in countries %}
<option value="{{ country.alpha2 }}" {% if postal_loc.cc == country.alpha2 %}selected{% endif %}>{{ country.name }}</option>
{% endfor %}
</select>
</div>
<label class="form-check form-switch mt-1">
<input class="form-check-input" type="checkbox" id="discloseAddrLoc" name="disclose_addr_loc" {% if postal_loc.disclose_addr_loc == '1' %}checked{% endif %}>
<span class="form-check-label" for="discloseAddrLoc">{{ __('Disclose Address in WHOIS') }}</span>
</label>
</div>
</div>
</div>
<div class="card-footer">
<div class="row align-items-center">
<div class="col-auto">
<button type="submit" class="btn btn-primary">{{ __('Update Contact') }}</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{% include 'partials/footer.twig' %}
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const toggleLocCheckbox = document.getElementById('toggleLoc');
const localizedSection = document.getElementById('localizedInfo');
// Function to toggle the visibility of the extra data
function toggleLocalizedSection() {
if (toggleLocCheckbox.checked) {
localizedSection.style.display = "flex";
} else {
localizedSection.style.display = "none";
}
}
// Event listener for checkbox state change
toggleLocCheckbox.addEventListener('change', toggleLocalizedSection);
// Call the function on page load to set the initial state
toggleLocalizedSection();
});
</script>
{% endblock %}