@ -8,18 +8,22 @@
Edit Staff
< / h1 >
< form method = "POST" action = "{% url ' save_staff' %}" enctype = "multipart/form-data" >
< form method = "POST" action = "{% url ' editstaff' staff.staff_id %}" enctype = "multipart/form-data" >
{% csrf_token %}
< div class = "w-full flex flex-col gap-3 justify-center items-center mt-5" >
< div class = "w-[100px] h-[100px] rounded-full border border-gray-200" id = "image-container" >
< div class = "w-[100px] h-[100px] rounded-full border border-gray-200 mt-2" id = "image-container" >
{% if staff.image %}
< img src = "{{staff.image.url}}" alt = "" srcset = "" id = "" class = "rounded-full w-full h-full" >
{% else %}
< img src = "{% static 'images/default-user.png' %}" alt = "" srcset = "" id = "" class = "rounded-full w-full h-full" >
{% endif %}
< / div >
< div class = "inbox-box border border-gray-300 py-1 px-3 w-full rounded-md" >
< div class = "flex items-center justify-between" >
< input name = "image" type = "file" id = "actual-btn" accept = "image/*" hidden / >
< span id = "file-name" class = "text-gray-500 text-base focus:outline-none outline-none" > Upload
Profile Picture< / span >
New Profile Picture< / span >
< label for = "actual-btn"
class="bg-transparent text-gray-500 border border-white px-4 py-2 h-14 cursor-pointer flex items-center">< i
class="fa fa-upload" style="font-size: 20px;">< / i > < / label >
@ -65,52 +69,60 @@
< / script >
< input name = "first_name" type = "text" placeholder = "First Name"
value="Nataly"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full mt-4" >
< label class = "text-gray-500 text-xl" > First Name:< / label >
< input name = "first_name" type = "text" placeholder = "First Name"
value="{{staff.user.first_name}}"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-2" required>
< / div >
< input name = "last_name" type = "text" placeholder = "Last Name"
value="Ab"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full mt-4" >
< label class = "text-gray-500 text-xl" > Last Name:< / label >
< input name = "last_name" type = "text" placeholder = "Last Name"
value="{{staff.user.last_name}}"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-2" required>
< / div >
< input name = "email" type = "email" placeholder = "Email"
value="nataly.aw@ositcom.com"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full mt-4" >
< label class = "text-gray-500 text-xl" > Email:< / label >
< input name = "email" type = "email" placeholder = "Email"
value="{{staff.user.email}}"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-2" required>
< / div >
< input name = "mobile_number" type = "number" placeholder = "Mobile Number"
value="71196733"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full mt-4" >
< label class = "text-gray-500 text-xl" > Mobile Number:< / label >
< input name = "mobile_number" type = "number" placeholder = "Mobile Number"
value="{{staff.mobile_number}}"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-2" required>
< / div >
< input name = "position" type = "text" placeholder = "Position"
value="Developer"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full mt-4" >
< label class = "text-gray-500 text-xl" > Position:< / label >
< select name = "staff_position" id = ""
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md text-gray-500 mt-2">
{% for position in positions %}
< option { % if current_position and current_position . id = = position . id % } selected { % endif % } value = "{{position.id}}" > {{position.name}}< / option >
{% endfor %}
< / select >
< / div >
< div class = "w-full flex justify-start items-center gap-2" >
< input name = "active" type = "checkbox" id = "activeCheckbox" onchange = "updateCheckbox('activeCheckbox')" >
< p class = "text-gray-500" > Active< / p >
< / div >
< div class = "w-full flex justify-start items-center gap-2" >
< input name = "intern" type = "checkbox" id = "internCheckbox" onchange = "updateCheckbox('internCheckbox')" >
< p class = "text-gray-500" > Intern< / p >
< / div >
< script >
function updateCheckbox(checkboxId) {
const checkbox = document.getElementById(checkboxId);
const inputName = checkbox.getAttribute('name');
const inputValue = checkbox.checked ? 'True' : 'False';
// Set the input field value based on checkbox state
const inputField = document.querySelector(`input[name="${inputName}"]`);
inputField.value = inputValue;
}
< / script >
< div class = "w-full flex justify-start items-center gap-2 mt-2" >
< input { % if staff . active % } checked { % endif % } type = "checkbox" >
< p class = "text-gray-500 text-xl" > Active< / p >
< input type = "hidden" name = "active" value = "False" >
< / div >
< div class = "w-full flex justify-start items-center gap-2 mt-2" >
< input { % if staff . intern % } checked { % endif % } type = "checkbox" >
< p class = "text-gray-500 text-xl" > Intern< / p >
< input type = "hidden" name = "intern" value = "False" >
< / div >
< input name = "password" type = "password" placeholder = "Password"
value="12345677"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md" required>
< div class = "w-full flex justify-center items-center mt-3" >
< button type = "submit"