Kahve Fincanları 12 Parça
Stokta
marka: Alkhier Food
Menşe ülke: P.R.C
İletişim
`+ input['message'] +`
`);
if (! _CLICK_ && _INPUT_.data('on-validation-error-click')) {
_CLICK_ = _INPUT_.data('on-validation-error-click');
}
if (! _FOCUS_) {
_FOCUS_ = _INPUT_;
}
});
if (_CLICK_) { $(_CLICK_).click(); }
if (_FOCUS_) { _FOCUS_.focus(); }
};
BS.RESET_FORM_VALIDATION_ERRORS = function($Form) {
$Form.find( '.' + BS.CONFIG('invalidFieldCLass') ).removeClass( BS.CONFIG('invalidFieldCLass') );
$Form.find( '.' + BS.CONFIG('invalidFieldHintClass') ).remove();
};
BS.BTN_TOGGLE_LOADING = function($Btn) {
if ($Btn.hasClass('bs-loading-btn')) {
$Btn.prop('disabled', false);
$Btn.removeClass('bs-loading-btn');
$Btn.find('.bs-loading-spinner').remove();
return false;
}
$Btn.prop('disabled', true);
$Btn.addClass('bs-loading-btn');
$Btn.prepend( BS.CONFIG('loadingSpinner') );
return true;
};
BS.AJAX_FORM = function($Event, $Callbacks = {}) {
tinymce.triggerSave();
$Event.preventDefault();
var $Form = $($Event.target);
_SUBMIT = $Form.find('[type=submit]'),
_URL = $Form.attr('action') || 'javascript:;',
_METHOD = $Form.attr('method') || 'POST';
_DATA = new FormData($Event.target); //_NODE_.serialize();
var _OPT = $.extend({
keepLoadingOnSuccess: false,
}, $Form.data());
BS.RESET_FORM_VALIDATION_ERRORS($Form);
BS.BTN_TOGGLE_LOADING(_SUBMIT);
if ($Callbacks['beforeSend']) {
$Callbacks['beforeSend'].apply();
}
$.ajax({
contentType: false, // NEEDED, DON'T OMIT THIS (requires jQuery 1.6+)
processData: false, // NEEDED, DON'T OMIT THIS
url : _URL,
method : _METHOD,
data : _DATA,
statusCode: {
200: function(data) {
if ($Callbacks[ data.code ]) {
$Callbacks[ data.code ].apply(data, [$Form, _SUBMIT]);
return;
}
if (data['redirect_url'] || data['redirect']) {
window.location = data['redirect_url'] || data['redirect'];
return;
}
if (data['toastr']) {
toastr[ data['toastr']['type'] ](data['toastr']['description'], data['toastr']['title']);
}
if (data.status) {
if (! _OPT.keepLoadingOnSuccess) {
BS.BTN_TOGGLE_LOADING(_SUBMIT);
}
}
else if(data.code == '422') {
BS.SHOW_FORM_VALIDATION_ERRORS($Form, data.errors.invalid_fields);
BS.BTN_TOGGLE_LOADING(_SUBMIT);
}
else {
BS.BTN_TOGGLE_LOADING(_SUBMIT);
}
},
500: function(XHR) {
var data = JSON.parse(XHR.responseText);
if ($Callbacks['500']) {
$Callbacks['500'].apply(data, [$Form, _SUBMIT]);
return;
}
}
},
})
.done(function(data) {
if ($Callbacks['done']) {
$Callbacks['done'].apply(data, [$Form, _SUBMIT]);
return;
}
})
.fail(function(XHR) {
BS.BTN_TOGGLE_LOADING(_SUBMIT);
var data = JSON.parse(XHR.responseText);
if ($Callbacks['fail']) {
$Callbacks['fail'].apply(data, [$Form, _SUBMIT]);
return;
}
})
.always(function() {
if ($Callbacks['always']) {
$Callbacks['always'].apply(null, [$Form, _SUBMIT]);
return;
}
});
return false;
};
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('platform', 'WEB');
xhr.setRequestHeader('locale' , 'tr');
}
});
BS.EXTEND = function extend(obj, ext) {
return $.extend(obj, ext);
}
BS.reloadDatatable = function(datatable) {
datatable.ajax.reload( null, false );
}
BS.resetForm = function(btn = null, form = null) {
if (btn) {
$( btn ).closest('form').trigger("reset");
$( btn ).closest('form').find('.form-select').select2();
}
else if(form) {
$( form ).trigger("reset");
$( form ).find('.form-select').select2();
}
}
BS.DATATABLE = function(elm, opt) {
if ($(elm).exists()) {
var auto_responsive = $(elm).data('auto-responsive'), has_export = (typeof(opt.buttons) !== 'undefined' && opt.buttons) ? true : false;
var btn = (has_export) ? '<"dt-export-buttons d-flex align-center"<"dt-export-title d-none d-md-inline-block">B>' : '', btn_cls = (has_export) ? ' with-export' : '';
var dom_normal = '<"row justify-between'+btn_cls+'"<"col-6 col-sm-4 text-left"f><"col-5 col-sm-8 text-right"<"datatable-filter"<"d-flex justify-content-end g-2"'+btn+'l>>>><"datatable-wrap"t><"row align-items-center"<"col-6 col-sm-12 col-md-9"p><"col-5 col-sm-12 col-md-3 text-left text-md-right"i>>';
var dom_separate = '<"row justify-between'+btn_cls+'"<"col-6 col-sm-4 text-left"f><"col-5 col-sm-8 text-right"<"datatable-filter"<"d-flex justify-content-end g-2"'+btn+'l>>>><"my-3"t><"row align-items-center"<"col-6 col-sm-12 col-md-9"p><"col-5 col-sm-12 col-md-3 text-left text-md-right"i>>';
var dom = $(elm).hasClass('is-separate') ? dom_separate : dom_normal;
var def = {
responsive: true,
autoWidth: false,
dom: dom,
language: dataTableTranslations
},
attr = (opt) ? BS.EXTEND(def, opt) : def;
attr =(auto_responsive === false) ? BS.EXTEND(attr, {responsive: false}) : attr;
return $(elm).DataTable(attr);
}
};
BS.ajaxConfirm = function(_options_, $Callbacks = {}) {
_options = BS.EXTEND({
title : 'Are you sure?',
text : 'Please confirm your action',
confirmButtonText : 'Confirm',
cancelButtonText : 'Cancel',
icon : 'warning',
url : '#',
method : 'POST',
data : {},
}, _options_ || {});
_options.data = _options_.data || {};
Swal.fire({
title : _options.title,
html : _options.text,
icon : _options.icon,
showCancelButton : true,
confirmButtonText : _options.confirmButtonText,
cancelButtonText : _options.cancelButtonText,
})
.then(function (e) {
if (e.value) {
if ($Callbacks['confirmed']) {
$Callbacks['confirmed'].apply(null);
}
$.ajax({
url : _options.url,
method : _options.method,
data : _options.data,
statusCode: {
200: function(data) {
if ($Callbacks[ data.code ]) {
$Callbacks[ data.code ].apply(data);
return;
}
if (data['redirect_url'] || data['redirect']) {
window.location = data['redirect_url'] || data['redirect'];
return;
}
if (data['toastr']) {
toastr[ data['toastr']['type'] ](data['toastr']['description'], data['toastr']['title']);
}
},
500: function(XHR) {
var data = JSON.parse(XHR.responseText);
}
},
})
.done(function(data) {
if ($Callbacks['done']) {
$Callbacks['done'].apply(data);
return;
}
})
.fail(function(XHR) {
// BS.BTN_TOGGLE_LOADING(_SUBMIT);
var data = JSON.parse(XHR.responseText);
if ($Callbacks['fail']) {
$Callbacks['fail'].apply(data);
return;
}
})
.always(function() {
if ($Callbacks['always']) {
$Callbacks['always'].apply(null);
return;
}
});
}
else if ($Callbacks['rejected']) {
$Callbacks['rejected'].apply(null);
}
});
}
BS.ajaxDelete = function(_url, model, datatable = null) {
var $Callbacks = {
done : function(data) {
if (datatable) {
BS.reloadDatatable(datatable);
}
}
};
BS.ajaxConfirm({
title : 'Are you sure',
text : 'Are you sure you want to delete this entry',
confirmButtonText : 'Delete',
cancelButtonText : 'Cancel',
url : _url,
data : {
_token : 'OMjMWew3ZbJnibbDD2XrXpvUWpwZFyzK1DcqTQKx',
model : model,
}
}, $Callbacks);
}
BS.ajaxRestore = function(_url, model, datatable = null) {
var $Callbacks = {
done : function(data) {
if (datatable) {
BS.reloadDatatable(datatable);
}
}
};
BS.ajaxConfirm({
title : 'Are you sure',
text : 'Are you sure you want to restore this entry',
confirmButtonText : 'Restore',
cancelButtonText : 'Cancel',
url : _url,
data : {
_token : 'OMjMWew3ZbJnibbDD2XrXpvUWpwZFyzK1DcqTQKx',
model : model,
}
}, $Callbacks);
}
BS.ajaxPermaDelete = function(_url, model, datatable = null) {
var $Callbacks = {
done : function(data) {
if (datatable) {
BS.reloadDatatable(datatable);
}
}
};
BS.ajaxConfirm({
title : 'Are you sure',
text : 'Are you sure you want to permanently delete this entry (You cannot undo this action)', confirmButtonText : 'Delete', cancelButtonText : 'Cancel', url : _url, data : { _token : 'OMjMWew3ZbJnibbDD2XrXpvUWpwZFyzK1DcqTQKx', model : model, } }, $Callbacks); } BS.CALLABLES = {}; BS.REGISTER = function(name, CallableClass) { BS.CALLABLES[ name ] = CallableClass; }; BS.loadCallable = function(name) { return BS.CALLABLES[ name ] || null; }; $(document).on('click', '.image-input .select', function() { $(this).closest('.image-input').find('input[type=file]').first().click(); $(this).closest('.image-input').find('input.custom-file-input-remove').first().val('N'); }); $(document).on('click', '.image-input .remove', function() { $(this).closest('.image-input').find('img').first().attr('src', $(this).data('default') || ''); $(this).closest('.image-input').find('input[type=file]').first().val(''); $(this).closest('.image-input').find('input.custom-file-input-remove').first().val('Y'); }); $(document).on('change', '.image-input input[type=file]', function(event) { var imgTag = $(this).closest('.image-input').find('img').first(); var reader = new FileReader(); reader.onload = function() { imgTag.attr('src', reader.result); }; reader.readAsDataURL(event.target.files[0]); }); tinymce.init({ selector: 'textarea.bs-editor-full', language : 'tr', height: 500, menubar: false, plugins: [ 'advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table paste code help wordcount fullscreen' ], toolbar1: 'formatselect | ' + 'bold italic backcolor | alignleft aligncenter ' + 'alignright alignjustify | bullist numlist outdent indent', toolbar2: 'image media link table | removeformat | blockquote fullscreen', // content_style: "body { font-family: Cairo, sans-serif !important; }", image_title: true, /* enable automatic uploads of images represented by blob or data URIs*/ automatic_uploads: true, /* URL of our upload handler (for more details check: https://www.tiny.cloud/docs/configure/file-image-upload/#images_upload_url) images_upload_url: 'postAcceptor.php', here we add custom filepicker only to Image dialog */ file_picker_types: 'image', /* and here's our custom image picker*/ file_picker_callback: function (cb, value, meta) { var input = document.createElement('input'); input.setAttribute('type', 'file'); input.setAttribute('accept', 'image/*'); /* Note: In modern browsers input[type="file"] is functional without even adding it to the DOM, but that might not be the case in some older or quirky browsers like IE, so you might want to add it to the DOM just in case, and visually hide it. And do not forget do remove it once you do not need it anymore. */ input.onchange = function () { var file = this.files[0]; var reader = new FileReader(); reader.onload = function () { /* Note: Now we need to register the blob in TinyMCEs image blob registry. In the next release this part hopefully won't be necessary, as we are looking to handle it internally. */ var id = 'blobid' + (new Date()).getTime(); var blobCache = tinymce.activeEditor.editorUpload.blobCache; var base64 = reader.result.split(',')[1]; var blobInfo = blobCache.create(id, file, base64); blobCache.add(blobInfo); /* call the callback and populate the Title field with the file name */ cb(blobInfo.blobUri(), { title: file.name }); }; reader.readAsDataURL(file); }; input.click(); }, });