520 lines
14 KiB
PHP
520 lines
14 KiB
PHP
<script>
|
|
function copyToClipboard(text) {
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
Swal.fire({
|
|
title: '{{e2("Copied!")}}',
|
|
text: text,
|
|
icon: 'success',
|
|
toast: true,
|
|
position: 'top-end',
|
|
showConfirmButton: false,
|
|
timer: 2000
|
|
});
|
|
}).catch(err => {
|
|
console.error('Failed to copy text: ', err);
|
|
});
|
|
}
|
|
</script>
|
|
<script>
|
|
$.fn.hasAttr = function(name) {
|
|
return this.attr(name) !== undefined;
|
|
};
|
|
</script>
|
|
@foreach (glob(base_path() . '/resources/views/scripts/*.blade.php') as $file)
|
|
@include('scripts.' . basename(str_replace('.blade.php', '', $file)))
|
|
@endforeach
|
|
<?php seri(); // serialize form
|
|
?>
|
|
<script>
|
|
function printFrame() {
|
|
var iframe = document.getElementById('show_pdf');
|
|
var iframeWindow = iframe.contentWindow;
|
|
|
|
if (iframeWindow) {
|
|
iframeWindow.focus();
|
|
iframeWindow.print();
|
|
} else {
|
|
console.error('Could not access iframe content window');
|
|
}
|
|
}
|
|
</script>
|
|
<script type="text/javascript">
|
|
|
|
<?php
|
|
if(oturumisset("full-screen-block")) {
|
|
?>
|
|
$("#{{oturum("full-screen-block")}}").addClass('block-mode-fullscreen');
|
|
<?php
|
|
}
|
|
?>
|
|
$('.auto-complete').autocomplete({
|
|
source: function( request, response ) {
|
|
$.ajax( {
|
|
url: "{{url("admin/autocomplete/welding_methods/ru_short_name")}}",
|
|
dataType: "jsonp",
|
|
data: {
|
|
term: request.term
|
|
},
|
|
success: function( data ) {
|
|
response( data );
|
|
}
|
|
} );
|
|
},
|
|
minLength: 2,
|
|
select: function( event, ui ) {
|
|
log( "Selected: " + ui.item.value + " aka " + ui.item.id );
|
|
}
|
|
} );
|
|
$(".editable").on("click",function(){
|
|
$(this).attr("contenteditable",true);
|
|
$(this).prop("contenteditable",true);
|
|
});
|
|
|
|
$(".cevapla-soru").on("click",function(){
|
|
var bu = $(this);
|
|
var id = bu.attr("data-soru");
|
|
|
|
bu.html("Kaydediliyor...");
|
|
$.post("{{url("admin-ajax/cevap-soru")}}",{
|
|
soru_id : id,
|
|
_token : "{{csrf_token()}}",
|
|
cevap : $("#soru"+id).val(),
|
|
tak_duzey : $("#tak"+id).val()
|
|
},function(d){
|
|
console.log(d);
|
|
bu.html("Kaydedildi");
|
|
});
|
|
});
|
|
$(".serialize").unbind();
|
|
$(".serialize").on("submit",function(){
|
|
for (var i in CKEDITOR.instances) {
|
|
CKEDITOR.instances[i].updateElement();
|
|
};
|
|
var bu = $(this);
|
|
var html = bu.find("[type='submit']").html();
|
|
bu.find(".right-fixed button").html("Processing...");
|
|
bu.find("[type='submit']").html("Processing...");
|
|
$.ajax({
|
|
type : $(this).attr("method"),
|
|
url : $(this).attr("action"),
|
|
data : $(this).serialize(),
|
|
success: function(d){
|
|
bu.find(".right-fixed button").html(html);
|
|
bu.find("[type='submit']").html(html);
|
|
$(".result-ajax").html(d);
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
<script>
|
|
$( function() {
|
|
$('[data-toggle="popover"]').popover();
|
|
|
|
$(".nav-ajax a").on("click",function(){
|
|
var id = $(this).attr("href");
|
|
var path = $(this).parent().parent().attr("path");
|
|
var url = id.replace("#","");
|
|
console.log(path);
|
|
$(id).html('<i class="fa fa-spin fa-spinner"></i>').load("?ajax2="+path+"."+url);
|
|
});
|
|
$(".nav-ajax li:eq(0) a").trigger("click");
|
|
/*
|
|
$("[type='number']").on("keypress",function(e){
|
|
console.log(e.keyCode);
|
|
|
|
if(e.keyCode==48) {
|
|
if($(this).val().length==0) {
|
|
return false;
|
|
}
|
|
}
|
|
if(e.keyCode==46) {
|
|
return false;
|
|
}
|
|
});
|
|
*/
|
|
$('.date').mask('9999-99-99', {reverse: true});
|
|
// $("[name='Tonnage']").attr("type","text").prop("type","text").mask('#,0000', {reverse: true});
|
|
$("[name='Tonnage']")
|
|
.attr("pattern","[0-9]+([\.,][0-9]+)?")
|
|
.prop("pattern","[0-9]+([\.,][0-9]+)?")
|
|
.attr("min","0")
|
|
.prop("min","0")
|
|
.attr("step","0.0001")
|
|
.prop("step","0.0001");
|
|
$("[name='Tonnage']").focusout(function(){
|
|
var inputVal = this.value;
|
|
if(inputVal.indexOf(',') != -1){
|
|
var num = inputVal.split(',');
|
|
this.value = parseInt(num)+","+num[1];
|
|
} else if(inputVal.indexOf('.') != -1){
|
|
var num = inputVal.split('.');
|
|
this.value = parseInt(num)+"."+num[1];
|
|
}
|
|
});
|
|
|
|
$("[name='week']").css("min-width","50px");
|
|
$(".nav-link.active").trigger("click");
|
|
$('form').attr('autocomplete','off');
|
|
$( ".sortable" ).sortable({
|
|
stop: function(evt, ui) {
|
|
var k = 0;
|
|
var data = [];
|
|
$(".sortable > *").each(function(){
|
|
//console.log($(this).attr("id2"));
|
|
data.push([k,$(this).attr("id2")]);
|
|
k++;
|
|
});
|
|
data = JSON.stringify(data);
|
|
console.log(data);
|
|
$.post("{{url('admin-ajax/content-sort')}}",{
|
|
data : data,
|
|
_token : "{{ csrf_token() }}"
|
|
});
|
|
|
|
}
|
|
});
|
|
$( ".draggable" ).draggable();
|
|
$( "ul, li" ).disableSelection();
|
|
} );
|
|
</script>
|
|
<script>jQuery(function(){ Codebase.helpers('magnific-popup','notify','datepicker', 'colorpicker', 'maxlength', 'select2', 'masked-inputs', 'rangeslider', 'tags-inputs'); });</script>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
//$('.table').DataTable();
|
|
@if (\Session::has('mesaj'))
|
|
Codebase.helpers('notify', {
|
|
align: 'center', // 'right', 'left', 'center'
|
|
from: 'bottom', // 'top', 'bottom'
|
|
type: 'info', // 'info', 'success', 'warning', 'danger'
|
|
icon: 'fa fa-info mr-5', // Icon class
|
|
message: '{!! __(\Session::get('mesaj')) !!}'
|
|
});
|
|
@endif
|
|
@if (\Session::has('hata'))
|
|
Codebase.helpers('notify', {
|
|
align: 'center', // 'right', 'left', 'center'
|
|
from: 'bottom', // 'top', 'bottom'
|
|
type: 'danger', // 'info', 'success', 'warning', 'danger'
|
|
icon: 'fa fa-info mr-5', // Icon class
|
|
message: "{!! __(\Session::get('hata')) !!}"
|
|
});
|
|
@endif
|
|
|
|
$('#summernote,.editor').summernote({
|
|
height: 200,
|
|
width:800
|
|
});
|
|
function trigger() {
|
|
$(".ajax_modal").unbind();
|
|
$(".ajax_modal").on("click",function(){
|
|
$("#modal-popin .modal-dialog").addClass("modal-lg");
|
|
$("#modal-popin .block-title").html($(this).attr("title"));
|
|
$("#modal-popin .block-content").html("{{e2("Yükleniyor...")}}").load($(this).attr("href"));
|
|
$(".modal-footer").hide();
|
|
$("#modal-popin").modal();
|
|
return false;
|
|
|
|
});
|
|
$("[teyit]").unbind();
|
|
$("[teyit]").on("click",function(){
|
|
$("#modal-popin .block-title").html($(this).attr("title"));
|
|
$("#modal-popin .block-content").html($(this).attr("teyit"));
|
|
$("#modal-popin .modal-dialog").removeClass("modal-lg");
|
|
$(".modal-footer").show();
|
|
var ajax = $(this).attr("ajax");
|
|
var url = $(this).attr("href");
|
|
if(ajax==undefined) {
|
|
$("#modal-popin .tamam").prop("href",url).removeAttr("data-dismiss");
|
|
} else {
|
|
console.log(ajax);
|
|
$("#modal-popin .tamam").unbind();
|
|
$("#modal-popin .tamam").on("click",function(){
|
|
$(ajax).fadeOut();
|
|
$.get(url,function(){
|
|
|
|
|
|
});
|
|
});
|
|
|
|
}
|
|
|
|
$("#modal-popin").modal();
|
|
return false;
|
|
|
|
});
|
|
}
|
|
trigger();
|
|
|
|
/*
|
|
$("[ajax]").on("click",function(){
|
|
var yer = $(this).attr("ajax");
|
|
$(yer).html("{{e2("Yükleniyor...")}}").load($(this).href("href"));
|
|
return false;
|
|
});
|
|
*/
|
|
/*
|
|
$("[data-ajax]").each(function(){
|
|
var ajax = $(this).attr("data-ajax");
|
|
// alert(ajax);
|
|
if(ajax!="") {
|
|
$(this).load("{{e2("Loading")}}").load("?ajax2="+ajax);
|
|
}
|
|
|
|
});
|
|
*/
|
|
$(".yayinla").on("click",function(){
|
|
var y;
|
|
if($(this).is(":checked")) {
|
|
y=1;
|
|
} else {
|
|
y=0;
|
|
}
|
|
var bu = $(this);
|
|
bu.prop("disabled",true);
|
|
$.post("{{ url('admin-ajax/input-edit') }}",{
|
|
table : "contents",
|
|
value : y,
|
|
_token : "{{ csrf_token() }}",
|
|
id : bu.attr("id"),
|
|
name : "y"
|
|
|
|
},function(){
|
|
bu.prop("disabled",false);
|
|
|
|
});
|
|
});
|
|
$(".edit").on("blur",function(){
|
|
var bu = $(this);
|
|
bu.prop("disabled",true);
|
|
$.post("{{ url('admin-ajax/input-edit') }}",{
|
|
table : bu.attr("table"),
|
|
key : bu.attr("key"),
|
|
value : bu.val(),
|
|
_token : "{{ csrf_token() }}",
|
|
id : bu.attr("data-id"),
|
|
name : bu.attr("name")
|
|
|
|
},function(){
|
|
bu.prop("disabled",false);
|
|
|
|
});
|
|
|
|
});
|
|
$(".tags").tagsInput();
|
|
$(".select2").select2({
|
|
tags: true
|
|
});
|
|
/*
|
|
$("form").on("submit",function(event){
|
|
// Codebase.layout('header_loader_on')
|
|
$(this).find(":submit").html("{{__('Processing...')}}").prop("disabled",true);
|
|
|
|
});
|
|
*/
|
|
$(".ajax-form").on("submit", "form", function(event)
|
|
{
|
|
alert("ok");
|
|
event.preventDefault();
|
|
|
|
var url=$(this).attr("action");
|
|
$.ajax({
|
|
url: url,
|
|
type: $(this).attr("method"),
|
|
dataType: "JSON",
|
|
data: new FormData(this),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function (data, status)
|
|
{
|
|
|
|
},
|
|
error: function (xhr, desc, err)
|
|
{
|
|
|
|
|
|
}
|
|
});
|
|
|
|
});
|
|
/*
|
|
$(".btn")
|
|
.addClass("btn-noborder")
|
|
.addClass("btn-rounded");
|
|
*/
|
|
$(".input-group-append .btn, .input-group-prepend .btn")
|
|
.removeClass("btn-noborder")
|
|
.removeClass("btn-rounded");
|
|
|
|
function loadDoc(url, cFunction) {
|
|
var xhttp;
|
|
xhttp=new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
$("body").html(xhttp.responseText);
|
|
window.history.pushState('url',Math.random() , url);
|
|
cFunction(this);
|
|
}
|
|
};
|
|
xhttp.open("GET", url, true);
|
|
xhttp.send();
|
|
}
|
|
$("a").on("click",function(){
|
|
/*
|
|
loadDoc($(this).attr("href"),sonuc);
|
|
return false;
|
|
*/
|
|
});
|
|
function sonuc() {
|
|
console.log("sonuc");
|
|
}
|
|
});
|
|
</script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.13/cropper.min.js"></script>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.13/cropper.min.css" rel="stylesheet" />
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const openFeedbackBtn = document.getElementById('openFeedback');
|
|
const screenshotInput = document.getElementById('screenshotInput');
|
|
const screenshotPreview = document.getElementById('screenshotPreview');
|
|
const overlay = document.getElementById('screenshotOverlay');
|
|
const overlayPreview = document.getElementById('overlayPreview');
|
|
const useCroppedBtn = document.getElementById('useCropped');
|
|
const cancelCropBtn = document.getElementById('cancelCrop');
|
|
const sendFeedbackBtn = document.getElementById('sendFeedback');
|
|
|
|
let cropper = null;
|
|
let lastScreenshot = null;
|
|
|
|
// Take Screenshot
|
|
if (openFeedbackBtn) {
|
|
openFeedbackBtn.addEventListener('click', async (e) => {
|
|
e.preventDefault();
|
|
|
|
try {
|
|
if (cropper) cropper.destroy();
|
|
|
|
const target = document.querySelector('#main-content') || document.body;
|
|
|
|
// Create screenshot
|
|
const canvas = await html2canvas(target, {
|
|
backgroundColor: "#fff",
|
|
scale: 0.8,
|
|
useCORS: true
|
|
});
|
|
|
|
// Convert to base64 JPEG
|
|
const dataUrl = canvas.toDataURL("image/jpeg", 0.8);
|
|
lastScreenshot = dataUrl;
|
|
|
|
// Show crop overlay
|
|
overlay.style.display = "block";
|
|
overlayPreview.innerHTML = `<img id="cropImage" src="${dataUrl}" style="max-width:100%;" />`;
|
|
|
|
const cropImage = document.getElementById("cropImage");
|
|
|
|
// Initialize CropperJS
|
|
cropper = new Cropper(cropImage, {
|
|
aspectRatio: NaN,
|
|
viewMode: 1,
|
|
background: false,
|
|
autoCrop: false,
|
|
autoCropArea: 0,
|
|
ready() {
|
|
cropper.clear();
|
|
}
|
|
});
|
|
|
|
} catch (err) {
|
|
Swal.fire("Error", "Screenshot error: " + err.message, "error");
|
|
}
|
|
});
|
|
}
|
|
|
|
// Use cropped image
|
|
useCroppedBtn.addEventListener('click', function () {
|
|
let finalImage = lastScreenshot;
|
|
|
|
if (cropper) {
|
|
finalImage = cropper.getCroppedCanvas().toDataURL("image/jpeg", 0.8);
|
|
}
|
|
|
|
screenshotInput.value = finalImage;
|
|
screenshotPreview.innerHTML = `<img src="${finalImage}" style="max-width:100%;border:1px solid #ccc" />`;
|
|
|
|
overlay.style.display = "none";
|
|
$('#feedbackModal').modal('show');
|
|
});
|
|
|
|
// Cancel crop
|
|
cancelCropBtn.addEventListener('click', function () {
|
|
overlay.style.display = "none";
|
|
if (cropper) cropper.destroy();
|
|
});
|
|
|
|
// Send Feedback
|
|
if (sendFeedbackBtn) {
|
|
sendFeedbackBtn.addEventListener('click', () => {
|
|
const form = document.getElementById('feedbackForm');
|
|
const formData = new FormData(form);
|
|
|
|
fetch('?ajax=save-feedback', {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRF-TOKEN': document
|
|
.querySelector('meta[name="csrf-token"]')
|
|
.getAttribute('content')
|
|
},
|
|
body: formData
|
|
})
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
if (data.status === "success") {
|
|
const badge = document.getElementById('feedback-badge');
|
|
if (badge) {
|
|
let currentText = badge.textContent || badge.innerText || '0';
|
|
let count = parseInt(currentText.trim());
|
|
if(isNaN(count)) count = 0;
|
|
|
|
badge.textContent = count + 1;
|
|
badge.style.display = 'inline-block';
|
|
} else if (typeof $ !== 'undefined') {
|
|
let $badge = $('#feedback-badge');
|
|
if($badge.length) {
|
|
let count = parseInt($badge.text().trim()) || 0;
|
|
$badge.text(count + 1).show().css('display', 'inline-block');
|
|
}
|
|
}
|
|
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Success!',
|
|
text: data.message
|
|
}).then(() => {
|
|
$('#feedbackModal').modal('hide');
|
|
form.reset();
|
|
screenshotPreview.innerHTML = "";
|
|
});
|
|
} else {
|
|
Swal.fire("Error", data.message, "error");
|
|
}
|
|
})
|
|
.catch(err => Swal.fire("Error", err.message, "error"));
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|