var search = '';
var activeTab = '';
var showpeople = "";
var komite_list = "";
var widthpage = $(window).width();
// provincesId = [];
$(document).ready(function () {
console.log("wide", widthpage)
all_RandDCounter();
$("#darhaleejra").click();
activeTab = $("#darhaleejra").data('active')
$.ajax({
type: "GET",
url: "/RandD/research_members",
success: function (res) {
var people = res.data;
for (let i = 0; i < people.length; i++) {
showpeople =
showpeople +
'
\
\
' +
people[i].member_name +
' \
' +
people[i].member_duty +
' \
' +
people[i].member_office +
" " +
"
" +
" ";
}
$("#splide__list").append(showpeople);
if (widthpage > 1000) {
new Splide("#splide", {
type: "loop",
perPage: 3,
direction: "rtl",
height: "200px",
autoplay: true,
pauseOnHover: false,
cover: true,
breakpoints: {
height: "6rem",
},
}).mount();
} else if (widthpage < 1000 && widthpage > 801) {
new Splide("#splide", {
type: "loop",
perPage: 3,
direction: "rtl",
height: "200px",
autoplay: true,
pauseOnHover: false,
cover: true,
breakpoints: {
height: "6rem",
},
}).mount();
} else if (widthpage < 800 && widthpage > 501) {
new Splide("#splide", {
type: "loop",
perPage: 2,
direction: "rtl",
height: "200px",
autoplay: true,
pauseOnHover: false,
cover: true,
breakpoints: {
height: "6rem",
},
}).mount();
} else if (widthpage < 500) {
new Splide("#splide", {
type: "loop",
perPage: 1,
direction: "rtl",
height: "200px",
autoplay: true,
pauseOnHover: false,
cover: true,
breakpoints: {
height: "6rem",
},
}).mount();
}
},
});
$.ajax({
type: "GET",
url: "/RandD/interface_members",
success: function (res) {
append_interface(res)
},
});
});
function all_RandDCounter() {
$.ajax({
url: "/RandD/statics",
type: "GET",
beforeSend: function () {
showLoaderScreen();
},
success: function (result) {
$(".countup1").each(function () {
var $this = $(this),
countTo = result.statics.ejra;
$({
countNum: $this.text()
}).animate({
countNum: countTo,
}, {
duration: 2000,
easing: "linear",
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
},
});
});
$(".countup2").each(function () {
var $this = $(this),
countTo = result.statics.end;
$({
countNum: $this.text()
}).animate({
countNum: countTo,
}, {
duration: 2000,
easing: "linear",
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
},
});
});
$(".countup3").each(function () {
var $this = $(this),
countTo = result.statics.comite;
$({
countNum: $this.text()
}).animate({
countNum: countTo,
}, {
duration: 2000,
easing: "linear",
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
},
});
});
hideLoaderScreen();
},
error: function (error) {
// console.log(error);
},
});
}
function showLoaderScreen() {
$(".divloader").css("display", "flex").hide().fadeIn();
}
function hideLoaderScreen() {
$(".divloader").fadeOut();
}
//در حال اجرا
$("#darhaleejra").on("click", function () {
activeTab = $(this).data('active');
$("body").find("#body_khateme").addClass("stylescroll");
$("#khatemeyafte").css("background-color", "#ff5c0f");
$("#darhaleejra").css("background-color", "#015688");
$("#tahtebaresi").css("background-color", "#ff5c0f");
$("#body_filter").css("display", "block");
$("#body_khateme").empty();
$("#body_khateme").append(`در حال دریافت اطلاعات ...
`);
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/homepage",
success: function (data) {
ejra = data.data;
$("#body_khateme").empty();
for (let index = 0; index < ejra.length; index++) {
if (ejra[index].contract_status == 1) {
function returnejra() {
return (
'\
\
عنوان پروژه:
' + ejra[index].project_title +
'
اداره کل:
' + ejra[index].province_fa +
'
حوزه:
' + ejra[index].domain_fa +
'
مجری:
' + ejra[index].project_agent +
'
شماره قرارداد:
' + ejra[index].contract_number +
'
مدت قرار داد(ماه):
' + ejra[index].contract_term +
'
مبلغ قرارداد:
' + ejra[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnejra());
}
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=1",
success: function (data) {
ejra = data.data;
$("#body_khateme").empty();
for (let index = 0; index < ejra.length; index++) {
function returnejra() {
return (
'\
\
عنوان پروژه:
' + ejra[index].project_title +
'
اداره کل:
' + ejra[index].province_fa +
'
حوزه:
' + ejra[index].domain_fa +
'
مجری:
' + ejra[index].project_agent +
'
شماره قرارداد:
' + ejra[index].contract_number +
'
مدت قرار داد(ماه):
' + ejra[index].contract_term +
'
مبلغ قرارداد:
' + ejra[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnejra());
}
}
});
}
});
//خاتمه یافته
$("#khatemeyafte").on("click", function () {
activeTab = $(this).data('active');
$("body").find("#body_khateme").addClass("stylescroll");
$("#khatemeyafte").css("background-color", "#015688");
$("#darhaleejra").css("background-color", "#ff5c0f");
$("#tahtebaresi").css("background-color", "#ff5c0f");
$("#body_filter").css("display", "block");
$("#body_khateme").empty();
$("#body_khateme").append(`در حال دریافت اطلاعات ...
`);
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/homepage",
success: function (data) {
khateme = data.data;
console.log("all", khateme[0]);
$("#body_khateme").empty();
for (let index = 0; index < khateme.length; index++) {
if (khateme[index].contract_status == 2) {
function returnkhateme() {
var btnFiles = '';
if (khateme[index].final_report_one) btnFiles += ` `
if (khateme[index].final_report_two) btnFiles += ` `
if (khateme[index].final_report_three) btnFiles += ` `
if (khateme[index].final_report_four) btnFiles += ` `
return (
'\
\
عنوان پروژه:
' + khateme[index].project_title +
'
' + btnFiles + '
اداره کل:
' + khateme[index].province_fa +
'
حوزه:
' + khateme[index].domain_fa +
'
مجری:
' + khateme[index].project_agent +
'
شماره قرارداد:
' + khateme[index].contract_number +
'
مدت قرار داد(ماه):
' + khateme[index].contract_term +
'
مبلغ قرارداد:
' + khateme[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnkhateme());
}
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=2",
success: function (data) {
khateme = data.data;
console.log("all", khateme[0]);
$("#body_khateme").empty();
for (let index = 0; index < khateme.length; index++) {
function returnkhateme() {
var btnFiles = '';
if (khateme[index].final_report_one) btnFiles += ` `
if (khateme[index].final_report_two) btnFiles += ` `
if (khateme[index].final_report_three) btnFiles += ` `
if (khateme[index].final_report_four) btnFiles += ` `
return (
'\
\
عنوان پروژه:
' + khateme[index].project_title +
'
' + btnFiles + '
اداره کل:
' + khateme[index].province_fa +
'
حوزه:
' + khateme[index].domain_fa +
'
مجری:
' + khateme[index].project_agent +
'
شماره قرارداد:
' + khateme[index].contract_number +
'
مدت قرار داد(ماه):
' + khateme[index].contract_term +
'
مبلغ قرارداد:
' + khateme[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnkhateme());
}
}
});
}
});
//تحت بررسی
$("#tahtebaresi").on("click", function () {
activeTab = $(this).data('active');
$("body").find("#body_khateme").addClass("stylescroll");
$("#khatemeyafte").css("background-color", "#ff5c0f");
$("#darhaleejra").css("background-color", "#ff5c0f");
$("#tahtebaresi").css("background-color", "#015688");
$("#body_filter").css("display", "block");
$("#body_khateme").empty();
$("#body_khateme").append(`در حال دریافت اطلاعات ...
`);
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/committee_projects",
success: function (data) {
baresi = data.data;
console.log("all", baresi[0]);
$("#body_khateme").empty();
for (let index = 0; index < baresi.length; index++) {
function returnbaresi() {
return (
'\
\
عنوان پروژه:
' + baresi[index].title +
'
اداره کل:
' + baresi[index].province_fa +
'
حوزه:
' + baresi[index].domain_fa +
'
نام ثبت کننده:
' + baresi[index].fname_creator + ' ' + baresi[index].lname_creator +
'
شماره تماس ثبت کننده:
' + baresi[index].phone_creator +
'
\
'
);
}
$("#body_khateme").append(returnbaresi());
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=3",
success: function (data) {
baresi = data.data;
console.log("all", baresi[0]);
$("#body_khateme").empty();
for (let index = 0; index < baresi.length; index++) {
function returnbaresi() {
return (
'\
\
عنوان پروژه:
' + baresi[index].title +
'
اداره کل:
' + baresi[index].province_fa +
'
حوزه:
' + baresi[index].domain_fa +
'
نام ثبت کننده:
' + baresi[index].fname_creator + ' ' + baresi[index].lname_creator +
'
شماره تماس ثبت کننده:
' + baresi[index].phone_creator +
'
\
'
);
}
$("#body_khateme").append(returnbaresi());
}
}
});
}
});
$("#body_filter").addClass("stylescroll");
$(".shakhsi").on("click", function () {
$("#modalCenter").modal("show");
$.ajax({
type: "GET",
url: "/RandD/statics",
success: function (data) {
komite = data.data.aazaye_comite;
console.log("all", komite[0]);
for (let index = 0; index < komite.length; index++) {
function etelaateaza() {
return (
'\
نام:
\
' + komite[index].member_name + '
\
\
سمت:
\
' + komite[index].member_duty + '
\
\
محل فعالیت:
\
' + komite[index].member_office + '
\
'
);
}
$(".modal-body").append(etelaateaza());
}
}
});
});
$.ajax({
type: "GET",
url: "/RandD/setad-province/all",
success: function (data) {
allpro = data.data;
// console.log("all", );
for (let index = 0; index < allpro.length; index++) {
function provincegiri() {
return (
'\
\
\
' + allpro[index].name_fa +
'\
\
\
'
);
}
$(".province-filter").append(provincegiri());
}
}
});
$("#modalCenter .close").on("click", function () {
$(".modal-body").empty();
});
$(".modal-footer .btn-secondary").on("click", function () {
$(".modal-body").empty();
});
$("body").on("click", function () {
$(".modal-body").empty();
});
$(".title_filter").on("click", function () {
if ($(".province-filter").css("display") == "block") {
$(".province-filter").slideUp(500);
$(".title_filter").css("background-color", "#ff5c0f");
} else {
$(".province-filter").slideDown(500);
$(".title_filter").css("background-color", "#015688");
}
});
$(".title_filter2").on("click", function () {
if ($(".hoze_filter").css("display") == "block") {
$(".hoze_filter").slideUp(500);
$(".title_filter2").css("background-color", "#ff5c0f");
} else {
$(".hoze_filter").slideDown(500);
$(".title_filter2").css("background-color", "#015688");
}
});
$('#input-search').on('input', function () {
search = $(this).val();
$("body").find("#body_khateme").addClass("stylescroll");
$("#body_khateme").empty();
$("#body_khateme").append(`در حال دریافت اطلاعات ...
`);
switch (activeTab) {
case 'ejra':
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/homepage",
success: function (data) {
ejra = data.data;
$("#body_khateme").empty();
for (let index = 0; index < ejra.length; index++) {
if (ejra[index].contract_status == 1) {
function returnejra() {
return (
'\
\
عنوان پروژه:
' + ejra[index].project_title +
'
اداره کل:
' + ejra[index].province_fa +
'
حوزه:
' + ejra[index].domain_fa +
'
مجری:
' + ejra[index].project_agent +
'
شماره قرارداد:
' + ejra[index].contract_number +
'
مدت قرار داد(ماه):
' + ejra[index].contract_term +
'
مبلغ قرارداد:
' + ejra[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnejra());
}
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=1",
success: function (data) {
ejra = data.data;
$("#body_khateme").empty();
for (let index = 0; index < ejra.length; index++) {
function returnejra() {
return (
'\
\
عنوان پروژه:
' + ejra[index].project_title +
'
اداره کل:
' + ejra[index].province_fa +
'
حوزه:
' + ejra[index].domain_fa +
'
مجری:
' + ejra[index].project_agent +
'
شماره قرارداد:
' + ejra[index].contract_number +
'
مدت قرار داد(ماه):
' + ejra[index].contract_term +
'
مبلغ قرارداد:
' + ejra[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnejra());
}
}
});
}
break;
case 'khateme':
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/homepage",
success: function (data) {
khateme = data.data;
console.log("all", khateme[0]);
$("#body_khateme").empty();
for (let index = 0; index < khateme.length; index++) {
if (khateme[index].contract_status == 2) {
function returnkhateme() {
var btnFiles = '';
if (khateme[index].final_report_one) btnFiles += ` `
if (khateme[index].final_report_two) btnFiles += ` `
if (khateme[index].final_report_three) btnFiles += ` `
if (khateme[index].final_report_four) btnFiles += ` `
return (
'\
\
عنوان پروژه:
' + khateme[index].project_title +
'
' + btnFiles + '
اداره کل:
' + khateme[index].province_fa +
'
حوزه:
' + khateme[index].domain_fa +
'
مجری:
' + khateme[index].project_agent +
'
شماره قرارداد:
' + khateme[index].contract_number +
'
مدت قرار داد(ماه):
' + khateme[index].contract_term +
'
مبلغ قرارداد:
' + khateme[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnkhateme());
}
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=2",
success: function (data) {
khateme = data.data;
console.log("all", khateme[0]);
$("#body_khateme").empty();
for (let index = 0; index < khateme.length; index++) {
function returnkhateme() {
var btnFiles = '';
if (khateme[index].final_report_one) btnFiles += ` `
if (khateme[index].final_report_two) btnFiles += ` `
if (khateme[index].final_report_three) btnFiles += ` `
if (khateme[index].final_report_four) btnFiles += ` `
return (
'\
\
عنوان پروژه:
' + khateme[index].project_title +
'
' + btnFiles + '
اداره کل:
' + khateme[index].province_fa +
'
حوزه:
' + khateme[index].domain_fa +
'
مجری:
' + khateme[index].project_agent +
'
شماره قرارداد:
' + khateme[index].contract_number +
'
مدت قرار داد(ماه):
' + khateme[index].contract_term +
'
مبلغ قرارداد:
' + khateme[index].contract_amount +
'
\
'
);
}
$("#body_khateme").append(returnkhateme());
}
}
});
}
break;
case 'komite':
if (search == '') {
$.ajax({
type: "GET",
url: "/RandD/committee_projects",
success: function (data) {
baresi = data.data;
console.log("all", baresi[0]);
$("#body_khateme").empty();
for (let index = 0; index < baresi.length; index++) {
function returnbaresi() {
return (
'\
\
عنوان پروژه:
' + baresi[index].title +
'
اداره کل:
' + baresi[index].province_fa +
'
حوزه:
' + baresi[index].domain_fa +
'
نام ثبت کننده:
' + baresi[index].fname_creator + ' ' + baresi[index].lname_creator +
'
شماره تماس ثبت کننده:
' + baresi[index].phone_creator +
'
\
'
);
}
$("#body_khateme").append(returnbaresi());
}
}
});
} else {
$.ajax({
type: "GET",
url: "/RandD/search?search=" + search + "&type=3",
success: function (data) {
baresi = data.data;
console.log("all", baresi[0]);
$("#body_khateme").empty();
for (let index = 0; index < baresi.length; index++) {
function returnbaresi() {
return (
'\
\
عنوان پروژه:
' + baresi[index].title +
'
اداره کل:
' + baresi[index].province_fa +
'
حوزه:
' + baresi[index].domain_fa +
'
نام ثبت کننده:
' + baresi[index].fname_creator + ' ' + baresi[index].lname_creator +
'
شماره تماس ثبت کننده:
' + baresi[index].phone_creator +
'
\
'
);
}
$("#body_khateme").append(returnbaresi());
}
}
});
}
break;
}
});
if (widthpage < 800) {
$(".counters-div1").css("border-left", "0px");
$(".counters-div2").css("border-left", "0px");
}
if (widthpage < 990) {
$(".check-res-header2").removeClass("container");
$(".check-res-header2").addClass("container-fluid");
}
if (widthpage < 460) {
$(".header-for-projectpart").addClass("d-flex");
$(".header-for-projectpart").addClass("flex-column");
$("#body_khateme").removeClass("mt-2");
}
function append_interface(res) {
var test = ""
var data_inter = res.data
// for (var i=0 ; i${i}`
// }
for (let i = 0; i < data_inter.length; i++) {
test = test + `${data_inter[i].member_name} ${data_inter[i].member_duty}
`
}
$(".owl-carousel").append(test)
var el = $('.owl-carousel');
var carousel;
var carouselOptions = {
margin: 20,
nav: true,
dots: true,
slideBy: 'page',
autoplay: true,
autoplayTimeout: 3000,
autoplayHoverPause: true,
loop: true,
rtl: true,
responsive: {
0: {
items: 1,
rows: 2 //custom option not used by Owl Carousel, but used by the algorithm below
},
768: {
items: 2,
rows: 3 //custom option not used by Owl Carousel, but used by the algorithm below
},
991: {
items: 3,
rows: 2 //custom option not used by Owl Carousel, but used by the algorithm below
},
1200: {
items: 5,
rows: 2 //custom option not used by Owl Carousel, but used by the algorithm below
},
}
};
//Taken from Owl Carousel so we calculate width the same way
var viewport = function () {
var width;
if (carouselOptions.responsiveBaseElement) {
width = $(carouselOptions.responsiveBaseElement).width();
} else if (window.innerWidth) {
width = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientWidth) {
width = document.documentElement.clientWidth;
} else {
console.warn('Can not detect viewport width.');
}
return width;
};
var severalRows = false;
var orderedBreakpoints = [];
for (var breakpoint in carouselOptions.responsive) {
if (carouselOptions.responsive[breakpoint].rows > 1) {
severalRows = true;
}
orderedBreakpoints.push(parseInt(breakpoint));
}
//Custom logic is active if carousel is set up to have more than one row for some given window width
if (severalRows) {
orderedBreakpoints.sort(function (a, b) {
return b - a;
});
var slides = el.find('[data-slide-index]');
var slidesNb = slides.length;
if (slidesNb > 0) {
var rowsNb;
var previousRowsNb = undefined;
var colsNb;
var previousColsNb = undefined;
//Calculates number of rows and cols based on current window width
var updateRowsColsNb = function () {
var width = viewport();
for (var i = 0; i < orderedBreakpoints.length; i++) {
var breakpoint = orderedBreakpoints[i];
if (width >= breakpoint || i == (orderedBreakpoints.length - 1)) {
var breakpointSettings = carouselOptions.responsive['' + breakpoint];
rowsNb = breakpointSettings.rows;
colsNb = breakpointSettings.items;
break;
}
}
};
var updateCarousel = function () {
updateRowsColsNb();
//Carousel is recalculated if and only if a change in number of columns/rows is requested
if (rowsNb != previousRowsNb || colsNb != previousColsNb) {
var reInit = false;
if (carousel) {
//Destroy existing carousel if any, and set html markup back to its initial state
carousel.trigger('destroy.owl.carousel');
carousel = undefined;
slides = el.find('[data-slide-index]').detach().appendTo(el);
el.find('.fake-col-wrapper').remove();
reInit = true;
}
//This is the only real 'smart' part of the algorithm
//First calculate the number of needed columns for the whole carousel
var perPage = rowsNb * colsNb;
var pageIndex = Math.floor(slidesNb / perPage);
var fakeColsNb = pageIndex * colsNb + (slidesNb >= (pageIndex * perPage + colsNb) ? colsNb : (slidesNb % colsNb));
//Then populate with needed html markup
var count = 0;
for (var i = 0; i < fakeColsNb; i++) {
//For each column, create a new wrapper div
var fakeCol = $('
').appendTo(el);
for (var j = 0; j < rowsNb; j++) {
//For each row in said column, calculate which slide should be present
var index = Math.floor(count / perPage) * perPage + (i % colsNb) + j * colsNb;
if (index < slidesNb) {
//If said slide exists, move it under wrapper div
slides.filter('[data-slide-index=' + index + ']').detach().appendTo(fakeCol);
}
count++;
}
}
//end of 'smart' part
previousRowsNb = rowsNb;
previousColsNb = colsNb;
if (reInit) {
//re-init carousel with new markup
carousel = el.owlCarousel(carouselOptions);
}
}
};
//Trigger possible update when window size changes
$(window).on('resize', updateCarousel);
//We need to execute the algorithm once before first init in any case
updateCarousel();
}
}
//init
carousel = el.owlCarousel(carouselOptions);
}