You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

353 lines
16 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Job Posting</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
.Admin_client{
body {
font-family: Arial, sans-serif;
}
.container {
width: 45rem;
margin: auto;
padding: 20px;
border-radius: 10px;
overflow: hidden;
}
.two-col {
display: flex;
white-space: nowrap;
}
.three-col .col1,
.three-col .col2 {
flex: 0 0 22%;
}
.two-col .form-group {
margin-bottom: 15px;
}
.two-col input,
.two-col select {
width: calc(100% - 50px);
padding: 10px;
border-radius: 10px;
border: 1px solid #ccc;
}
label.required::after {
content: "*";
color: red;
margin-left: 5px;
}
h1 {
text-align: center;
}
.footer {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.form-group {
display: flex;
flex-direction: row-reverse;
align-items: center;
}
.form-group label {
margin-left: 10px;
}
#Address {
margin-left: 40px;
height: 20px;
border-radius: 10px;
}
ul {
list-style-type: none;
padding: 0;
margin-bottom: 20px;
margin-left: 300px;
}
li {
float:left;
margin-bottom: 20px;
margin-left: -10px;
}
li a {
display: block;
color: black;
text-align: center;
padding: 1px;
text-decoration: underline;
margin-top: 20px;
margin-left: 60px;
}
a:hover {
color:red;
}
.container1 {
margin-left: 500px;
width: 900px;
}
.add p {
margin-left: 470px;
margin-top: 3px;
}
.add a {
text-decoration: none;
}
.container1 input[type="text"] {
width: calc(100% - 20px);
margin-right: 10px;
}
.add span {
display: inline-block;
width: 25px;
height: 25px;
border: 2px solid black; /* Add border property */
border-radius: 50%;
text-align: center;
line-height: 30px;
margin-left: 530px;
color: black;
}}
</style>
</head>
<body>
<div class="Admin_client">
<div class="container">
<form id="addClientForm" action="{% url 'save_details' %}?admin_id={{ admin_id }}" method="post">
{% csrf_token %}
<div class="two-col">
<div class="col1">
<div class="form-group">
<input type="text" id="ParentCompany" name="ParentCompany" required placeholder="Eg. Oracle in India" tabindex="1">
<label for="ParentCompany" class="required" style="width: 200px;" >Parent Company</label>
</div>
<div class="form-group">
<input type="text" id="Location" name="Location" required placeholder="Eg. Hyderabad" tabindex="3">
<label for="Location" class="required" style="margin-left: 70px;" >Location</label>
</div>
<div class="form-group">
<input type="text" id="Department" name="Department" required placeholder="" tabindex="5">
<label for="Department" class="required" style="margin-left: 47px;" >Department</label>
</div>
</div>
<div class="col2">
<div class="form-group">
<input type="text" id="GSTNo" name="GSTNo" required placeholder="Eg. LSB009876L1" tabindex="2">
<label for="GSTNo" class="" style="margin-left: 10px;" >GST No.</label>
</div>
<div class="form-group">
<textarea id="Address" rows="2" cols="30" name="Address" required style="margin-left:5px; height: 70px; padding: 5px;" tabindex="4" ></textarea>
<label for="Address" class="required" >Address</label>
</div>
</div>
</div>
<h3 id="subLocationHeader" style="text-align: center;">Admin Department Contact person Name for the Above office location*</h3>
<div class="two-col" style="margin-left: 150px;">
<div class="col1">
<div class="form-group">
<input type="text" id="Admin_FirstName" name="Admin_FirstName" required placeholder="First Name*" width="300px" class="required" tabindex="6">
<label for="FirstName"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_PhoneNo1" name="Admin_PhoneNo1" required placeholder="Phone No1*" class="required" tabindex="8">
<label for="Admin_PhoneNo1"></label>
</div>
<div class="form-group">
<input type="email" id="Admin_CompanyEmail" name="Admin_CompanyEmail" required placeholder="Company Email*" class="required" tabindex="10">
<label for="Admin_CompanyEmail"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Designation" name="Admin_Designation" required placeholder="Designation*" class="required" tabindex="12">
<label for="Admin_Designation"></label>
</div>
</div>
<div class="col2">
<div class="form-group">
<input type="text" id="Admin_LastName" name="Admin_LastName" required placeholder="Last Name*" class="required" tabindex="7">
<label for="Admin_LastName"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_PhoneNo2" name="Admin_PhoneNo2" required placeholder="Phone No2" tabindex="9">
<label for="Admin_PhoneNo2"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Location" name="Admin_Location" required placeholder="Location*" class="required" tabindex="11">
<label for="Admin_Location"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Department" name="Admin_Department" required placeholder="Department*" class="required" tabindex="13">
<label for="Admin_Department"></label>
</div>
</div>
</div>
<button type="button" onclick="saveClient()" style="border-radius: 5px; background-color:lightgreen; width: 100px; margin-left:310px; margin-top: -20px; padding: 5px;"> Save</button>
</form>
<div class="add" id="addSubLocation">
<a href="#" onclick="toggleaddSubLocation()">
<span class="circle"><i class="fas fa-plus" style="margin-top: -10px;"></i></span>
<p>Add New sub location</p>
</a>
</div>
<div id="subClientsLocationsForm" style="display: none;">
<form id="addSubClientForm" action="{% url 'save-details-subcompany' %}?admin_id={{ admin_id }}" method="post">
{% csrf_token %}
<div class="two-col">
<div class="col1">
<div class="form-group">
<select id="ParentCompany" name="ParentCompany" required tabindex="1">
<option value=""tabindex="1" >Select Client</option>
{% for client in clients %}
<option value="{{ client.parent_company}}">{{ client.parent_company }}</option>
{% endfor %}
</select>
<label for="ParentCompany" class="required" style="width: 200px;">Parent Company:</label>
</div>
<div class="form-group">
<input type="text" id="SubCompany" name="SubCompany" required placeholder="Eg. oracle India" tabindex="3">
<label for="SubCompany" class="required" style="margin-left: 28px;">Sub Company:</label>
</div>
<div class="form-group">
<input type="text" id="Location" name="Location" required placeholder="Eg. bangalore"tabindex="5" >
<label for="Location" class="required" style="margin-left: 70px;">Location:</label>
</div>
<div class="form-group">
<input type="text" id="Department" name="Department" required placeholder="Eg. Billing or Accouts or Hiring" tabindex="6">
<label for="Department" class="required" style="margin-left: 47px;">Department:</label>
</div>
</div>
<div class="col2">
<div class="form-group">
<input type="text" id="GSTNo" name="GSTNo" required placeholder="Eg.234567H23LS" tabindex="2">
<label for="GSTNo" class="required" style="margin-left: 10px;">GST No.</label>
</div>
<div class="form-group">
<textarea id="Address" rows="2" cols="30" name="Address" required style="margin-left:5px; height: 70px; padding: 5px;" tabindex="4"></textarea>
<label for="Address" class="required">Address</label>
</div>
</div>
</div>
<h3 id="subLocationHeader" style="text-align: center;">Admin Department Contact person Name for the Above office location*</h3>
<div class="two-col" style="margin-left: 170px;">
<div class="col1">
<div class="form-group">
<input type="text" id="Admin_FirstName" name="Admin_FirstName" required placeholder="First Name*" width="200px" class="required" tabindex="7">
<label for="Admin_FirstName"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_PhoneNo1" name="Admin_PhoneNo1" required placeholder="Phone No1*" class="required" tabindex="9">
<label for="Admin_PhoneNo1"></label>
</div>
<div class="form-group">
<input type="email" id="Admin_CompanyEmail" name="Admin_CompanyEmail" required placeholder="Company Email*" class="required" tabindex="11">
<label for="Admin_CompanyEmail"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Designation" name="Admin_Designation" required placeholder="Designation*" class="required" tabindex="13">
<label for="Admin_Designation"></label>
</div>
</div>
<div class="col2">
<div class="form-group">
<input type="text" id="Admin_LastName" name="Admin_LastName" required placeholder="Last Name*" class="required" tabindex="8">
<label for="Admin_LastName"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_PhoneNo2" name="Admin_PhoneNo2" required placeholder="Phone No2" tabindex="10">
<label for="Admin_PhoneNo2"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Location" name="Admin_Location" required placeholder="Location*" class="required" tabindex="12">
<label for="Admin_Location"></label>
</div>
<div class="form-group">
<input type="text" id="Admin_Department" name="Admin_Department" required placeholder="Department*" class="required" tabindex="14">
<label for="Admin_Department"></label>
</div>
</div>
</div>
<button type="button" onclick="saveSubClient()" style="border-radius: 5px; background-color:lightgreen; width: 100px; margin-left:330px; margin-top: -20px; padding: 5px;"> Save</button>
</form>
</div>
</div>
</div>
<script>
function toggleaddSubLocation() {
var mainForm = document.getElementById("addClientForm");
var subForm = document.getElementById("subClientsLocationsForm");
var addButton = document.getElementById("addSubLocation");
mainForm.style.display = "none";
subForm.style.display = "block";
addButton.style.display = "none";
}
function saveClient() {
const form = document.getElementById('addClientForm');
const formData = new FormData(form);
// Ensure this retrieves the correct URL
const url = form.getAttribute('action');
console.log('CSRF Token:', '{{ csrf_token }}');
console.log('Form action URL:', url);
fetch(url, {
method: 'POST',
body: formData,
headers: {
'X-CSRFToken': '{{ csrf_token }}', // Assuming you have CSRF token available
},
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Success:', data);
alert('Client saved successfully.');
})
.catch(error => {
console.error('Error:', error);
alert('An error occurred while saving the job posting.');
});
}
function saveSubClient() {
const form = document.getElementById('addSubClientForm');
const formData = new FormData(form);
// Ensure this retrieves the correct URL
const url = form.getAttribute('action');
console.log('CSRF Token:', '{{ csrf_token }}');
console.log('Form action URL:', url);
fetch(url, {
method: 'POST',
body: formData,
headers: {
'X-CSRFToken': '{{ csrf_token }}', // Assuming you have CSRF token available
},
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('Success:', data);
alert('Client saved successfully.');
})
.catch(error => {
console.error('Error:', error);
alert('An error occurred while saving the job posting.');
});
}
</script>
</body>
</html>