Cleanup logic

This commit is contained in:
zandercymatics 2024-06-20 11:00:11 -06:00
parent 9da96b06c7
commit 39629a3e10
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 46 additions and 6 deletions

View file

@ -548,16 +548,29 @@ function initializeWidgetOnList(list, parentId) {
let actionNeededReasonDropdown = document.getElementById("id_action_needed_reason");
// If you need to account for the non-readonly version as well, you will need to check
// for both of these things seperately.
let actionNeededEmail = document.querySelector("#action_needed_reason_email_view_more")
let actionNeededEmail = document.querySelector("#action_needed_reason_email_view_more");
if(actionNeededReasonDropdown && actionNeededEmail) {
if (statusDropdown.value == "action needed")
handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail);
let emailContainer = actionNeededEmail.closest(".dja-textarea-container");
if (statusDropdown.value == "action needed") {
showElement(emailContainer)
}
statusDropdown.addEventListener("change", function() {
if (statusDropdown.value == "action needed") {
showElement(emailContainer)
}else {
hideElement(emailContainer)
}
});
handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail);
}
// TODO fix edge case where nothing is selected
function handleChangeActionNeededEmail(actionNeededReasonDropdown, actionNeededEmail) {
actionNeededReasonDropdown.addEventListener('change', function() {
actionNeededReasonDropdown.addEventListener("change", function() {
// TODO on change if not actionneeded on status, hide show email button
const pk = document.querySelector("#domain_request_id").value
const reason = actionNeededReasonDropdown.value

View file

@ -792,6 +792,31 @@ textarea.vLargeTextField[readonly]:hover {
cursor: not-allowed;
}
.textarea-container textarea {
width: 100%; /* Full width to fit the container */
height: 150px; /* Fixed height or as needed */
padding-right: 10px; /* Enough padding to nest the scrollbar inside */
box-sizing: border-box; /* Include padding in width and height calculations */
overflow-y: auto; /* Only show vertical scrollbar when necessary */
scrollbar-width: thin; /* Makes the scrollbar thinner */
scrollbar-color: #888 #000; /* Optional: styling the scrollbar with a thumb and track color */
}
/* For WebKit browsers like Chrome, Safari */
.textarea-container textarea::-webkit-scrollbar {
width: 8px; /* Width of the scrollbar */
}
.textarea-container textarea::-webkit-scrollbar-track {
background: #000; /* Track color */
}
.textarea-container textarea::-webkit-scrollbar-thumb {
background-color: #888; /* Color of the scrollbar thumb */
border-radius: 10px; /* Rounded corners for the scrollbar thumb */
border: 2px solid #000; /* Optional: Adds a border around the thumb */
}
.max-full {
width: 100% !important;
}

View file

@ -107,8 +107,10 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
</table>
{% if original_object.action_needed_reason_email %}
<div class="dja-textarea-container padding-1 margin-top-2">
<label class="max-full" for="action_needed_reason_email_view_more">Action needed reason email</label>
<div class="dja-textarea-container padding-1 margin-top-2 display-none">
<label class="max-full" for="action_needed_reason_email_view_more">
<strong>Action needed reason email</strong>
</label>
<textarea id="action_needed_reason_email_view_more" cols="40" rows="20" class="vLargeTextField {% if original_object.status != "action needed" %} display-none {% endif %}" readonly>
{{ original_object.action_needed_reason_email }}
</textarea>