619 lines
9.5 KiB
JavaScript
619 lines
9.5 KiB
JavaScript
$(document).ready(function () {
|
|
|
|
$("#addImg").change(function () {
|
|
|
|
// var filename = $(this).val();
|
|
|
|
var filename = $(this).val().split("\\").pop();
|
|
|
|
$("#add_file-upload-name").html(filename);
|
|
|
|
if (filename != "") {
|
|
|
|
setTimeout(function () {
|
|
|
|
$(".upload-wrapper").addClass("uploaded");
|
|
|
|
}, 600);
|
|
|
|
setTimeout(function () {
|
|
|
|
$(".upload-wrapper").removeClass("uploaded");
|
|
|
|
$(".upload-wrapper").addClass("success");
|
|
|
|
}, 1600);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#updateImg").change(function () {
|
|
|
|
var filename1 = $(this).val().split("\\").pop();
|
|
|
|
|
|
|
|
// console.log("hello");
|
|
|
|
$("#update_file-upload-name").html(filename1);
|
|
|
|
// var dataId = $('#update_file-upload-name').val($(this).data('id'));
|
|
|
|
// var x = $('#update_file-upload-name').html(filename1);
|
|
|
|
console.log("hello1");
|
|
|
|
// console.log(x);
|
|
|
|
console.log("hello2");
|
|
|
|
|
|
|
|
if (filename1 != "") {
|
|
|
|
setTimeout(function () {
|
|
|
|
$(".upload-wrapper").addClass("uploaded");
|
|
|
|
}, 600);
|
|
|
|
setTimeout(function () {
|
|
|
|
$(".upload-wrapper").removeClass("uploaded");
|
|
|
|
$(".upload-wrapper").addClass("success");
|
|
|
|
}, 1600);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// var table = $("#company-table").DataTable({
|
|
|
|
// dom: "Bfrtip",
|
|
|
|
// buttons: [
|
|
|
|
// {
|
|
|
|
// extend: "excel",
|
|
|
|
// title: "Company List",
|
|
|
|
// text: "Export Search Results",
|
|
|
|
// className: "btn btn-default",
|
|
|
|
// exportOptions: {
|
|
|
|
// columns: ":not(.notexport)",
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// ],
|
|
|
|
// // exportOptions: {
|
|
|
|
// // columns: ':not(.notexport)'
|
|
|
|
// // }
|
|
|
|
// });
|
|
|
|
// $("#ExportReporttoExcel").on("click", function () {
|
|
|
|
// table.button(".buttons-excel").trigger();
|
|
|
|
// });
|
|
|
|
// $("#searchbox").keyup(function () {
|
|
|
|
// table.search($(this).val()).draw();
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
|
|
|
|
// function getExcel(){
|
|
|
|
// $.ajax({
|
|
|
|
// url: "/manage-investments/companies/export-companies",
|
|
|
|
// type: "GET",
|
|
|
|
// data: {
|
|
|
|
// // id: id,
|
|
|
|
// },
|
|
|
|
// // processData: false,
|
|
|
|
// // contentType: false,
|
|
|
|
// dataType: "json",
|
|
|
|
// success: function (result) {
|
|
|
|
// // if (result.status == 200) {
|
|
|
|
// // $("#edit_company_id").val(id);
|
|
|
|
// // $("#edit_company_name").val(result.company.company_name);
|
|
|
|
// // $("#companyUpdateModal").modal("show");
|
|
|
|
// // }
|
|
|
|
// // if (result.status == 400) {
|
|
|
|
// // toastr.warning(result.message);
|
|
|
|
// // }
|
|
|
|
// // $("#edit_company_id").val(id);
|
|
|
|
// // $("#edit_company_name").val(result.company.company_name);
|
|
|
|
// // $("#kt_modal_edit_user").modal("show");
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
function getExcel() {
|
|
|
|
var query = {
|
|
|
|
// location: $('#location').val(),
|
|
|
|
// area: $('#area').val(),
|
|
|
|
// booth: $('#booth').val()
|
|
|
|
// location: 'mumbai',
|
|
|
|
// area: 'bhandup',
|
|
|
|
search: $("#searchbox").val() ?? "",
|
|
|
|
status: $("#filterDropdown option:selected").val() ?? "",
|
|
|
|
};
|
|
|
|
var url =
|
|
|
|
"/manage-investments/companies/export-companies?" + $.param(query);
|
|
|
|
window.location = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCompany(id) {
|
|
|
|
$.ajax({
|
|
|
|
url: "/manage-investments/companies/get",
|
|
|
|
type: "GET",
|
|
|
|
data: {
|
|
|
|
id: id,
|
|
|
|
},
|
|
|
|
// processData: false,
|
|
|
|
// contentType: false,
|
|
|
|
dataType: "json",
|
|
|
|
success: function (result) {
|
|
|
|
if (result.status == 200) {
|
|
|
|
$("#edit_company_id").val(id);
|
|
|
|
$("#edit_company_name").val(result.company.company_name);
|
|
$(".category-dropdown-edit").val(result.categories);
|
|
$("#companyUpdateModal").modal("show");
|
|
|
|
}
|
|
|
|
if (result.status == 400) {
|
|
|
|
toastr.warning(result.message);
|
|
|
|
}
|
|
|
|
// $("#edit_company_id").val(id);
|
|
|
|
// $("#edit_company_name").val(result.company.company_name);
|
|
|
|
// $("#kt_modal_edit_user").modal("show");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#addCompanyForm").validate({
|
|
|
|
ignore: [],
|
|
|
|
debug: false,
|
|
|
|
rules: {
|
|
|
|
company_name: {
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
company_logo: {
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
company_name: {
|
|
|
|
required: "Please enter company name",
|
|
|
|
},
|
|
|
|
company_logo: {
|
|
|
|
required: "Please upload company logo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
errorPlacement: function (error, element) {
|
|
|
|
if (element.is(":file")) {
|
|
|
|
// error append here
|
|
|
|
error.insertAfter("input[name='company_logo']");
|
|
|
|
} else {
|
|
|
|
error.insertAfter(element);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
submitHandler: function (form) {
|
|
|
|
var formData = new FormData(form);
|
|
|
|
// $("#save_btn").text("Please wait...");
|
|
|
|
// $("#save_btn").attr("disabled", true);
|
|
|
|
$.ajax({
|
|
|
|
url: "/manage-investments/companies/add",
|
|
|
|
type: "POST",
|
|
|
|
data: formData,
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
dataType: "json",
|
|
|
|
success: function (result) {
|
|
|
|
if (result.status == 200) {
|
|
|
|
$("#companyAddModal").modal("hide");
|
|
|
|
toastr.success(result.message);
|
|
|
|
setTimeout(() => {
|
|
|
|
location.reload();
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
if (result.status == 400) {
|
|
|
|
toastr.warning(result.message);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
function companyStatus(id, status) {
|
|
|
|
$.ajax({
|
|
|
|
url: "/manage-investments/companies/status",
|
|
|
|
type: "POST",
|
|
|
|
data: {
|
|
|
|
id: id,
|
|
|
|
status: status,
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
|
|
},
|
|
|
|
dataType: "json",
|
|
|
|
success: function (result) {
|
|
|
|
if (result.status == 200) {
|
|
|
|
toastr.success(result.message);
|
|
|
|
setTimeout(function(){
|
|
|
|
window.location.reload();
|
|
|
|
},3000);
|
|
|
|
}
|
|
|
|
if (result.status == 400) {
|
|
|
|
toastr.warning(result.message);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#editCompanyForm").validate({
|
|
|
|
ignore: [],
|
|
|
|
debug: false,
|
|
|
|
rules: {
|
|
|
|
company_name: {
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
company_name: {
|
|
|
|
required: "Please enter company name",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
submitHandler: function (form) {
|
|
|
|
var formData = new FormData(form);
|
|
|
|
// $("#save_btn").text("Please wait...");
|
|
|
|
// $("#save_btn").attr("disabled", true);
|
|
|
|
$.ajax({
|
|
|
|
url: "/manage-investments/companies/edit",
|
|
|
|
type: "POST",
|
|
|
|
data: formData,
|
|
|
|
headers: {
|
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
|
|
},
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
dataType: "json",
|
|
|
|
success: function (result) {
|
|
|
|
if (result.status == 200) {
|
|
|
|
toastr.success(result.message);
|
|
|
|
// $("#kt_modal_edit_user").modal("hide");
|
|
|
|
setTimeout(() => {
|
|
|
|
location.reload();
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
if (result.status == 400) {
|
|
|
|
toastr.warning(result.message);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
function deleteCompanyModal(id) {
|
|
|
|
// alert(id);
|
|
|
|
$("#delete_company_id").val(id);
|
|
|
|
$("#companyDeleteModal").modal("show");
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#deleteCompanyForm").submit(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
var id = $("#delete_company_id").val();
|
|
|
|
$.ajax({
|
|
|
|
url: "/manage-investments/companies/delete",
|
|
|
|
type: "delete",
|
|
|
|
headers: {
|
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
company_id: id,
|
|
|
|
},
|
|
|
|
dataType: "json",
|
|
|
|
success: function (result) {
|
|
|
|
if (result.status == 200) {
|
|
|
|
toastr.success(result.message);
|
|
|
|
setTimeout(() => {
|
|
|
|
location.reload();
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
if (result.status == 400) {
|
|
|
|
toastr.warning(result.message);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// function deleteCompany(id) {
|
|
|
|
// $.ajax({
|
|
|
|
// url: "/manage-investments/companies/delete",
|
|
|
|
// type: "post",
|
|
|
|
// headers: {
|
|
|
|
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
|
|
// },
|
|
|
|
// data: {
|
|
|
|
// id: id,
|
|
|
|
// },
|
|
|
|
// dataType: "json",
|
|
|
|
// success: function (result) {
|
|
|
|
// if (result.status == 200) {
|
|
|
|
// toastr.success(result.message);
|
|
|
|
// setTimeout(() => {
|
|
|
|
// location.reload();
|
|
|
|
// }, 1000);
|
|
|
|
// }
|
|
|
|
// if(result.status == 400){
|
|
|
|
// toastr.success(result.message);
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
// }
|
|
|