{##
# Powered by box
#}
{# Modification of this template or removal of the "Powered by X-Cart" label are forbidden for X-Cart Free Edition. #}
<div class="powered-by">
<p class="copyright">© {{ this.getCompanyYear() }} {{ this.get('config').Company.company_name }}. {{ t('All rights reserved.') }}</p>
<p class="powered-by-label">{{ this.getMessage()|raw }}</p>
</div>
<div class="modal fade" id="jobModal" tabindex="-1" role="dialog" aria-labelledby="jobModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">New project list</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="addform">
<div class="form-group">
<label for="exampleInputEmail1">Project list name</label>
<input type="text" class="form-control" id="project_list_name" name="project_list_name" aria-describedby="emailHelp" placeholder="Enter List name">
<input type="hidden" class="form-control" id="project_id" name="project_id">
<div class="text-danger" id='project_list_name-err'></div>
<small id="emailHelp" class="form-text text-muted">The name must contain at least 1 character and at most 60 characters
</small>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="addjoblist">Create Job List</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="jobModal1" tabindex="-1" role="dialog" aria-labelledby="jobModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add item to a product list</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="addform1">
<div class="row">
<div class='col-md-9'>
<input type='hidden' id="product_id" name="product_id" />
<input type='hidden' id="quantity" name="quantity" />
<label for="exampleInputEmail1">Project list name</label>
<input type="text" class="form-control" id="project_list_name" name="project_list_name" aria-describedby="emailHelp" placeholder="Enter List name">
<div class="text-danger" id='project_list_name-err'></div>
<small id="emailHelp" class="form-text text-muted">The name must contain at least 1 character and at most 60 characters
</small>
</div>
<div class='col-md-3'>
<label for="exampleInputEmail1"></label>
<button type="button" class="btn btn-primary" id="addjoblists1">Create Job List</button>
</div>
</div>
</form>
<div id="loadcontent"></div>
</div>
</div>
</div>
</div>
{# <div class="modal fade" id="jobModal2" tabindex="-1" role="dialog" aria-labelledby="jobModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add item to a product list</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="addform2">
<div class="row">
<div class='col-md-9'>
<label for="exampleInputEmail1">Project list name</label>
<input type="text" class="form-control" id="project_list_name" name="project_list_name" aria-describedby="emailHelp" placeholder="Enter List name">
<div class="text-danger" id='project_list_name-err'></div>
<small id="emailHelp" class="form-text text-muted">The name must contain at least 1 character and at most 60 characters
</small>
</div>
<div class='col-md-3'>
<label for="exampleInputEmail1"></label>
<button type="button" class="btn btn-primary" id="addjoblist2">Create Job List</button>
</div>
</div>
</form>
<input type='hidden' id="product_id" name="product_id" />
<div id="loadcontent2"></div>
</div>
</div>
</div>
</div> #}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
//$("#addjob").attr("class","add-product-to-joblist");
$('.add-to-wishlist').removeClass('add-to-wishlist').addClass('add-product-to-joblists');
})
$(document).on("click","#addjob",function() {
$("#quantity").val(1);
var $this = jQuery(this);
if($this.hasClass('must-be-logged-in')){
jQuery('a.log-in').first().click();
}else{
var productid = $(this).data("productid");
var quantity = $(this).closest('.buttons-row').find(".quantity").val();
loaddata(productid);
$("#jobModal1").modal("show")
$(".modal-backdrop").modal("hide")
$("#product_id").val(productid);
$("#quantity").val(quantity);
}
})
$(document).on("click",".add-product-to-joblist",function() {
$("#quantity").val(1);
var $this = jQuery(this);
if($this.hasClass('must-be-logged-in')){
jQuery('a.log-in').first().click();
}else{
var productid = $(this).data("productid");
var quantity = $(this).closest('.buttons-container').find(".qty-in-cart").val();
loaddata(productid);
$("#jobModal1").modal("show")
$(".modal-backdrop").modal("hide")
$("#product_id").val(productid);
$("#quantity").val(quantity);
}
})
$(document).on("click","#addjoblists1",function(event) {
event.preventDefault();
console.log("1");
if($("#addform1 #project_list_name").val() == ""){
$("#addform1 #project_list_name-err").text("Project list name is required!")
return true;
}else if($("#addform1 #project_list_name").val().length > 60){
$("#addform1 #project_list_name-err").text("Project list name is maximum 60 character!")
}else{
$("#addform1 #project_list_name-err").text("")
var formdata = new FormData();
var productid = $("#addform1 #product_id").val();
var quantity = $("#addform1 #quantity").val();
formdata.append("project_list_name",$("#addform1 #project_list_name").val())
formdata.append("product_id",productid)
formdata.append("quantity",quantity)
$.ajax({
type: 'POST',
url: '?target=job_list&action=add',
processData:false,
contentType:false,
dataType:'json',
data: formdata,
success: function(response) {
if(response.success){
$("#addform1 #project_list_name").val("")
loaddata(productid);
}else{
$("#addform1 #project_list_name-err").text(response.message)
}
console.log(response)
},
error: function(xhr, status, error) {
console.log(error)
}
});
}
})
function loaddata(productid){
var formdata2 = new FormData();
formdata2.append("product_id",productid);
$("#loadcontent").html("")
$.ajax({
type: 'POST',
processData:false,
contentType:false,
dataType:'json',
data: formdata2,
url: '?target=job_list&action=list',
success: function(response) {
if(response.success){
for(let x=0; x<response.datas.length;x++){
if(response.datas[x].exists == "yes"){
var button=`<a href="javascript:void(0)" class="btn btn-primary" style='background-color:#16704a' ><i class='fa fa-check-circle'></i> Product Added</a>`;
}else{
var button=`<a href="javascript:void(0)" class="btn btn-primary addproducttojoblists" data-id="${response.datas[x].id}">Add Product</a>`;
}
$("#loadcontent").append(`<div class="row mb-3" style="margin-bottom:20px">
<div class="card " >
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="50" viewBox="0 0 40 40"><path d="M0 24h36a4 4 0 0 1 4 4v12H4a4 4 0 0 1-4-4V24z" fill="#DEDEDE" fill-rule="evenodd" style="fill: rgb(56, 191, 199);"></path>
<path d="M28 9v28H4V9h24zm-1.333 1.333H5.333v25.334h21.334V10.333zm8-9.333v36h-8V10.373l-.69-.04H5.333v-2a2 2 0 0 1 2-2h7.334V1h20zM18 27.667a2 2 0 0 1 1.99 1.807l.01.193V37h-8v-7.333a2 2 0 0 1 1.807-1.991l.193-.01h4zM33.333 2.333H16V6.21l8.689.095.19.011a2 2 0 0 1 1.788 1.989V9h2a2 2 0 0 1 1.99 1.807l.01.193v2.667a2 2 0 0 1-1.808 1.99l-.192.01H28v2.666h.667a2 2 0 0 1 1.99 1.808l.01.192V23a2 2 0 0 1-1.808 1.99l-.192.01H28v2.667h.667a2 2 0 0 1 1.99 1.807l.01.193v2.666a2 2 0 0 1-1.808 1.991l-.192.01H28v1.333h5.333V2.333zM18 29h-4c-.327 0-.6.236-.656.547l-.01.12v6h5.333v-6c0-.287-.18-.53-.434-.625l-.113-.031L18 29zm10.667 0H28v4h.667c.327 0 .6-.236.656-.547l.01-.12v-2.666c0-.328-.236-.6-.546-.656l-.12-.011zm-16-8a2 2 0 0 1 1.99 1.807l.01.193v1.333a2 2 0 0 1-1.808 1.991l-.192.01h-1.334a2 2 0 0 1-1.99-1.808l-.01-.193V23a2 2 0 0 1 1.808-1.99l.192-.01h1.334zm8 0a2 2 0 0 1 1.99 1.807l.01.193v1.333a2 2 0 0 1-1.808 1.991l-.192.01h-1.334a2 2 0 0 1-1.99-1.808l-.01-.193V23a2 2 0 0 1 1.808-1.99l.192-.01h1.334zm-8 1.333h-1.334c-.327 0-.6.236-.656.547l-.01.12v1.333c0 .328.236.6.546.656l.12.011h1.334c.327 0 .6-.236.656-.547l.01-.12V23c0-.327-.236-.6-.546-.656l-.12-.01zm8 0h-1.334c-.327 0-.6.236-.656.547l-.01.12v1.333c0 .328.236.6.546.656l.12.011h1.334c.327 0 .6-.236.656-.547l.01-.12V23c0-.327-.236-.6-.546-.656l-.12-.01zm8-2.666H28v4h.667c.327 0 .6-.236.656-.547l.01-.12v-2.667c0-.327-.236-.6-.546-.656l-.12-.01zm-16-5.334a2 2 0 0 1 1.99 1.808l.01.192v1.334a2 2 0 0 1-1.808 1.99l-.192.01h-1.334a2 2 0 0 1-1.99-1.808l-.01-.192v-1.334a2 2 0 0 1 1.808-1.99l.192-.01h1.334zm8 0a2 2 0 0 1 1.99 1.808l.01.192v1.334a2 2 0 0 1-1.808 1.99l-.192.01h-1.334a2 2 0 0 1-1.99-1.808l-.01-.192v-1.334a2 2 0 0 1 1.808-1.99l.192-.01h1.334zm-8 1.334h-1.334c-.327 0-.6.236-.656.546l-.01.12v1.334c0 .327.236.6.546.656l.12.01h1.334c.327 0 .6-.236.656-.546l.01-.12v-1.334c0-.327-.236-.6-.546-.656l-.12-.01zm8 0h-1.334c-.327 0-.6.236-.656.546l-.01.12v1.334c0 .327.236.6.546.656l.12.01h1.334c.327 0 .6-.236.656-.546l.01-.12v-1.334c0-.327-.236-.6-.546-.656l-.12-.01zm8-5.334H28v4h.667c.327 0 .6-.236.656-.546l.01-.12V11c0-.327-.236-.6-.546-.656l-.12-.01zm-4-2.666H7.333l-.12.01a.667.667 0 0 0-.546.656V9h18.666v-.667a.667.667 0 0 0-.666-.666z" fill="#303545" fill-rule="nonzero"></path>
</svg>
<div class="card-body">
<h3 class="card-title">${response.datas[x].project_name}</h3>
${button}
</div>
</div>
</div>`)
}
}
console.log(response)
},
error: function(xhr, status, error) {
console.log(error)
}
});
}
$(document).on("click",".addproducttojoblists",function(){
var button = $(this)
var id = $(this).data("id");
var productid = $("#product_id").val();
var quantity = $("#addform1 #quantity").val();
var formdata = new FormData();
formdata.append("job_list_id",id)
formdata.append("product_id",productid)
formdata.append("quantity",quantity)
$.ajax({
type: 'POST',
url: '?target=job_list&action=AddProduct',
processData:false,
contentType:false,
dataType:'json',
data: formdata,
success: function(response) {
if(response.success){
button.css("background-color","#16704a").html("<i class='fa fa-check-circle'></i> Product Added")
}else{
button.css("background-color","#16704a").html("<i class='fa fa-check-circle'></i> Product Already Added")
}
button.removeClass('addproducttojoblists').addClass('');
},
error: function(xhr, status, error) {
console.log(error)
}
});
})
$(document).ready(function(){
var jobList = $(".job_list");
var makeAnOffer = $(".make-an-offer");
jobList.insertBefore(makeAnOffer);
});
</script>