/*
* jfrm-jfrm.js - v1.5.01 ||
* 13.04.2012
* minimized
*/
/**
* jfrm js library
* banner.class.php
* 2021.03.10
* @version v01.2
*
* jifrm
*@version v01.2 {2021.03.10}
*@version v01.2 {2021.11.28}
*/
function pushGtagEvent(dataLayerText){
//console.log(dataLayerText);
//gtag('event',dataLayerText);
window.dataLayer.push({ecommerce :null});
window.dataLayer.push({dataLayerText});
}
/**
*
*/
function removePack(elemID){
$('#'+elemID).append('
');
$('#'+elemID).animate({
overflow :'hidden',
height :'0px',
},1000 ,function(){
$('#'+elemID).remove();
});
// $('#'+elemID).slideUp(1200);
}
function afterActionDirect(link){
setTimeout(function(){
window.location.href = link;
},300);
}
/**2021.02.21
* [jfrmJaxFormOverlayRestart description]
* @return {[type]} [description]
*/
function jfrmJaxFormOverlayRestart(){
$(".jfrmJaxFormOverlay").each(function(index, value){
$(this).remove();
});
$(".jfrmJaxForm").each(function(index, value){
jfrmJaxFormOverlay($(this));
});
}
/**2021.02.21
* [jfrmJaxFormOverlay description]
* @param {[object]} elem [description]
*/
function jfrmJaxFormOverlay(elem){
var thisOverlay='';
elem.prepend(thisOverlay);
}
/*
* Last Update : 2021.02.20
*/
function jaxFormResponse(response){
//console.log(response);
if(response.jaxRequest){jaxRequest=response.jaxRequest;}
if(jaxRequest.formID){formID=jaxRequest.formID;}
jxForm=null;
if(response.control){
if(response.action!=''){
//console.log('action var');
$('#'+formID).jfrmDisposable(response.status,response.alert);
if(response.action){
doAction=response.action;
coffee=response.coffee;
aLen = doAction.length;
}
else { aLen=0;}
// doAction=response.action;
// coffee=response.coffee;
// aLen = doAction.length;
for (i=0;i80){message=message.slice(0,90)}
$('#jfrmDisposableHome').data('muchdis',newDis);
var random=Math.floor(Math.random() * 1001);
ID='jfrmNewDisposable_'+random;
newDom=''+message+'
';
$('#jfrmDisposableHome').prepend(newDom);
$(".jfrmDisposable").not("#"+ID).animate({top:"+=75"});
elem=$("#"+ID);
elem.addClass('open');
(function(elem) {
setTimeout(function(){
elem.remove();
},7000);
}(elem));
};
}(jQuery));
/**
*/
/** document ready **/
$(function(){
/****
** officers
*/
/**
* Approve Button
*/
$(document).on('click', '.officerApproveButton', function(){
if($(this).hasClass("active")){ return true;}
else {
//console.log("officerApproveButton:run");
$(this).addClass("active");
ID=$(this).attr('id');
elem=$("#"+ID);
$(document).on('mouseleave','.officerApproveButton',function(){
(function(elem){
setTimeout(function(){
$(elem).removeClass("active");
},4000);
}(elem));
});
}// else
}); // click officerApproveButton
$(document).on('click', '.officerApproveButton.active .yes, .officerApproveButton.active .no ', function(event){
event.preventDefault();
event.stopImmediatePropagation();
//console.log('yes or no');
reply=$(this).data('reply');
formID=$(this).data('formid');
ID=$(this).attr('id');
elem=$("#"+ID);
if(reply=='yes'){
$('#'+formID).submit();
}
else {
elem.addClass('reply');
setTimeout(function(){
elem.parent(".officerApproveButton").removeClass("active");
elem.removeClass('reply');
},1500);
}//else
}); // click officerApproveButton yes / no
/**
* Open Close Arrow
*/
$(document).on('click','.officerOpenClose, .jfrmOpenClose',function(event){
//tag=event.target.tagName;
isA=$(this).is("a");
if(isA){
event.preventDefault();
event.stopImmediatePropagation();
}
var handle =$(this).data("handle");
if($(this).hasClass("active")){
$(this).removeClass("active");
$('#'+handle).slideUp("800");
}
else {
$(this).addClass("active");
$('#'+handle).slideDown("800");
}
});
/**
* Open Close Group Arrow
*/
$(document).on('click','.officerOpenCloseGroup',function(event){
event.preventDefault();
event.stopImmediatePropagation();
var handle =$(this).data("handle");
var closeclass =$(this).data("close");
if(closeclass!=''){
$('.'+closeclass).not(handle).slideUp('800').removeClass("active");
$('.officerOpenCloseGroup[data-close="'+closeclass+'"]').not(this).removeClass("active");
}
if($(this).hasClass("active")){
console.log("has active");
$(this).removeClass("active");
$('#'+handle).slideUp('800').removeClass("active");
}
else {
console.log("not has active");
$(this).addClass("active");
$('#'+handle).slideDown('800').addClass("active");
}
});
/**
* officer check all
*/
$(document).on('change',".officerCheckAll",function(){
var doClass=$(this).data('checkall'); // delete old value
check=$(this).is(':checked');
$("."+doClass).each(function(index, value){
$(this).prop("checked",check).change();
});
});
/** end of officers::
**/
/**
* Batch Process Checkbox
*/
$(document).on('change',".bulkCheck",function(){
$(".bulkValuePool").val(''); // delete old value
check=$(this).is(':checked');
$(".bulkCheckKid").each(function(index, value){
$(this).prop("checked",check).change();
});
});
/**
* Bulk process checkboxes
*/
$(document).on('change','.bulkCheckKid',function(){
value=$(this).val();
check=$(this).is(':checked');
actionValue=value+",";
oldVal=$(".bulkValuePool").val();
if(check){
var newVal=oldVal+actionValue;
}
else {
var newVal=oldVal.replace(actionValue,"");
}
$(".bulkValuePool").val(newVal);
});
/**
* Bulk Process Form Controller
*/
$(document).on('submit','#bulkRecordsForm',function(){
value=$(":hidden#bulkValuePool").val();
if($('#bulkProcessType-selectfa')){deg=$("#bulkProcessType-selectfa option:selected").val();}
else deg=1;
if(value=="" || deg==""){
var err=$("#bulkRecordsForm").data('bulkerror');
$("#bulkRecordsForm").jfrmDisposable("error",err);
return false;
}
else {
return true ;
}
});
/**
*
*/
$(document).on('keyup','.countLetters',function(){
entery=$(this).val().length;
fillID=$(this).data('fillcou');
$('#'+fillID).html(entery);
});
/**
* jfrm Check Trigger
* data-jfrmtask="disable/check"
* data-jfrmway="direct/reverse"
* data-jfrmto=string -className .className, - ID #elemID
* data-jfrmrel=string group for changed elem
*/
$(document).on('change','.jfrmCheckTrigger',function(){
jfrmCheckTrigger($(this));
console.log("this");
if($(this).data('jfrmrel')){
rel=$(this).data('jfrmrel');
$('.jfrmCheckTrigger[data-jfrmrel="'+rel+'"]').not(this).each(function(index, value){
jfrmCheckTrigger($(this));
});
}
});
/**
* On File Input Change
*/
$(".adminForm .inputFile").on("change",function(){
//fileName = $(this).prop('files')[0];
fileName = $(this)[0].files[0];
fileNamer=fileName['name'];
label=$(this).data('lab');
var newText=' Seçildi';
$('#'+label).html(newText);
//console.log(fileNamer);
});
/**
*
* @param {[type]} index [description]
* @param {[type]} value [description]
*/
$(".jfrmJaxForm").each(function(index, value){
//var thisOverlay='';
//$(this).prepend(thisOverlay);
jfrmJaxFormOverlay($(this));
});
}); // document ready
$(document).on("click",".jfrmOpenCloseElem",function(event){
event.preventDefault();
event.stopImmediatePropagation();
var handle=$(this).data("handle");
$(this).toggleClass("active");
$("#"+handle).slideToggle("300");
$("#"+handle).toggleClass("active");
setTimeout(function(){
//$("#"+handle).toggleClass("active");
},400);
});
function jfrmCheckTrigger(elem){
check=elem.is(':checked');
task=elem.data("jfrmtask");
way=elem.data("jfrmway");
to=elem.data("jfrmto");
if(way=='direct'){doAction=check;}
else {
if(check==true) doAction=false;
else doAction=true;
}
if(task=='disable'){doTask="disabled";}
else {doTask="checked";}
console.log(doTask);
////console.log(way+' '+doTask+" "+doAction);
$(to).prop(doTask,doAction);
setSelect();
} // jfrmCheckTrigger
/**
* [setFixedHeight description]
* @param string elemID [description]
* @param {Number} [addVal=0] [description]
*/
function setFixedHeight(elemID,addVal=0){
var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var header=50;
var footer=50;
totalIn=header+footer+addVal;
setHeight=height-totalIn;
console.log(elemID, setHeight);
$("#"+elemID).css({"height":setHeight+"px"});
}
function callbackRefresh(response){
content=response.content;
$("#"+content.elemID).html(content.value);
}
/**
* added at 2022.03.17
* add jfrmTaskDisableSelect class and add data-task=".className|#elemID" to selectbox
* @version 1.00;
*/
$(document).on("change",".jfrmTaskDisableSelect",function(){
var val=$(this).val();
var task=$(this).data("task");
if(val=='p'){
$(task).prop("disabled",true);
}
else{
$(task).prop("disabled",false);
}
setSelect();
})
var y=null;
const jfrmFlashMessage=(status,message)=>{
elem=$("#jfrmFlashMessage");
var msgHtml=''+message+'';
if($("#jfrmFlashMessage")){
$("#jfrmFlashMessage").removeClass("active").remove();
}
$("body").append(msgHtml);
$("#jfrmFlashMessage").addClass(status).addClass("active");
if(y!=null){clearTimeout(y);}
var y=setTimeout(function(){
$("#jfrmFlashMessage").removeClass("active");
},1500);
}