ikinci temizlik tamamlandı
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<script src="{{url("assets/admin/js/plugins/jquery-auto-complete/jquery.auto-complete.js")}}"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
var selectorClass = ".js-autocomplete";
|
||||
|
||||
|
||||
$(selectorClass).autoComplete({
|
||||
minChars: 1,
|
||||
source: function (a, e, that) {
|
||||
|
||||
|
||||
$.getJSON(that.attr("data-url"), {
|
||||
pattern : that.attr("data-pattern")
|
||||
} , function(json) {
|
||||
a = a.toLowerCase();
|
||||
var n = json,
|
||||
r = [];
|
||||
for (i = 0; i < n.length; i++) ~n[i].toLowerCase().indexOf(a) && r.push(n[i]);
|
||||
e(r)
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$(selectorClass).on("keypress", function(e) {
|
||||
|
||||
if(e.keyCode == 13) {
|
||||
//alert("ok");
|
||||
$(this).trigger("blur");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$(selectorClass).on("blur", function() {
|
||||
var bu = $(this);
|
||||
var url = "{{url("admin/detail/")}}" + "/" + bu.attr("data-table") + "/" + bu.attr("data-column");
|
||||
var dataGroup = bu.attr("data-group");
|
||||
var dataGroupParent = $("." + dataGroup);
|
||||
|
||||
var lineNumberAffected = JSON.parse(bu.attr("affected"));
|
||||
|
||||
$.getJSON(url,{
|
||||
value : bu.val()
|
||||
}, function(json) {
|
||||
if(!$.isEmptyObject(json)) {
|
||||
$.each(json, function(jsonIndex, jsonItem) {
|
||||
dataGroupParent.find("." + jsonIndex).val(jsonItem).attr("readonly", "readonly");
|
||||
|
||||
});
|
||||
|
||||
$.each(lineNumberAffected, function(lineNumberAffectedIndex, lineNumberAffectedItem) {
|
||||
var patternString = lineNumberAffectedItem;
|
||||
$.each(json, function(jsonIndex, jsonItem) {
|
||||
patternString = patternString.replace("{" + jsonIndex + "}", jsonItem);
|
||||
});
|
||||
|
||||
dataGroupParent.find("." + lineNumberAffectedIndex).val(patternString).attr("readonly", "readonly");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.4/dist/bootstrap-table.min.css">
|
||||
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://unpkg.com/bootstrap-table@1.21.4/dist/bootstrap-table.min.js" type="module"></script>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script>
|
||||
$(".dropdown-list .dropdown-item").on("click", function(){
|
||||
var parent = $(this).parent().parent().parent().parent().parent().parent(); //tr
|
||||
var value = $(this).text().trim();
|
||||
var filterColumns = $(this).attr("filter-columns");
|
||||
if(filterColumns!== undefined) {
|
||||
filterColumns = filterColumns.split(",");
|
||||
$.each(filterColumns, function(index, column){
|
||||
console.log(column);
|
||||
parent.find("[name='"+column+"']").val("");
|
||||
parent.find("." + column + " [data-filter-value]").addClass("d-none");
|
||||
parent.find("." + column + " [data-filter-value*='"+value+"']").removeClass("d-none");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,47 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$("[data-disabled-condition-column]").each(function(){
|
||||
var parent = $(this).parent().parent().parent(); // tr
|
||||
var column = $(this).attr("data-disabled-condition-column");
|
||||
var type = $(this).attr("data-disabled-condition-type");
|
||||
var value = $(this).attr("data-disabled-condition-value");
|
||||
var bu = $(this);
|
||||
/*
|
||||
console.log(column);
|
||||
console.log(type);
|
||||
console.log(value);
|
||||
*/
|
||||
var conditionColumn = parent.find("[name='"+column+"']");
|
||||
conditionColumn.on("blur", function(){
|
||||
switch (type) {
|
||||
case "!=":
|
||||
if($(this).val()!=value) {
|
||||
bu.prop("disabled","disabled");
|
||||
bu.parent().find(".dropdown").addClass("d-none");
|
||||
console.log("disabled");
|
||||
} else {
|
||||
bu.removeAttr("disabled");
|
||||
bu.parent().find(".dropdown").removeClass("d-none");
|
||||
}
|
||||
|
||||
break;
|
||||
case "==":
|
||||
if($(this).val()==value) {
|
||||
bu.prop("disabled","disabled");
|
||||
bu.parent().find(".dropdown").addClass("d-none");
|
||||
console.log("disabled");
|
||||
} else {
|
||||
bu.removeAttr("disabled");
|
||||
bu.parent().find(".dropdown").removeClass("d-none");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$(".dropdown-filter").on("click", function() {
|
||||
var parent = $(this).parent().parent().parent().parent();
|
||||
var column = $(this).attr("data-target-column");
|
||||
var filterColumn = $(this).attr("data-filter-column");
|
||||
var table = $(this).attr("data-table");
|
||||
var pattern = $(this).attr("data-pattern");
|
||||
var targetInput = parent.find("[name='"+column+"']");
|
||||
var targetInputSeperator = targetInput.attr("seperator");
|
||||
var targetValue = targetInput.val();
|
||||
var dropdownList = $(this).parent().find(".dropdown-list");
|
||||
if(targetInputSeperator === undefined) {
|
||||
targetInputSeperator = "";
|
||||
} else {
|
||||
targetValue = targetValue.split(targetInputSeperator);
|
||||
}
|
||||
|
||||
|
||||
$.getJSON("{{url("admin/detail/")}}" + "/" + table + "/" + filterColumn, {
|
||||
value : targetValue
|
||||
|
||||
}, function(d) {
|
||||
dropdownList.html("");
|
||||
var addedItems = [];
|
||||
$.each(d, function(index,item) {
|
||||
console.log(item);
|
||||
var thisPattern = pattern;
|
||||
|
||||
$.each(item, function(itemColumn, itemValue) {
|
||||
console.log(itemColumn);
|
||||
console.log(itemValue);
|
||||
thisPattern = thisPattern.replace("{"+itemColumn+"}", itemValue);
|
||||
|
||||
var requiredFilterSelector = "[data-required-column='"+itemColumn+"'][data-required-value='"+itemValue+"']";
|
||||
parent.find(requiredFilterSelector).prop("required", true);
|
||||
|
||||
});
|
||||
|
||||
if(!addedItems.includes(thisPattern)) {
|
||||
var thisItem = '<label class="dropdown-item">'+thisPattern+'</label>';
|
||||
dropdownList.append(thisItem);
|
||||
addedItems.push(thisPattern);
|
||||
dropdownList.find(".dropdown-item").on("click", function(){
|
||||
var parent = $(this).parent().parent().parent().parent();
|
||||
parent.find("input[type='text']").val($(this).text().trim()).trigger("blur");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
//console.log(parent);
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$(".generate-all2:not('.disabled')").on("click", function(){
|
||||
Swal.fire('{{e2("Generate Start")}}', '{{e2("Please wait...")}}', 'success');
|
||||
$(this).attr("disabled", "disabled").addClass("disabled").html("Please wait...");
|
||||
|
||||
$.get("{{url("cron-documents?type=")}}" + $(this).attr("type"), function(d) {
|
||||
Swal.fire('', 'Generated PDF Document Count:' + d, 'success');
|
||||
$(".generate-all2").html('<i class="fa fa-file-pdf"></i> {{e2("Generate All")}}');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$(".input-json").on("blur", function() {
|
||||
var bu = $(this);
|
||||
var url = "{{url("admin/detail/")}}" + "/" + bu.attr("data-table") + "/" + bu.attr("data-column");
|
||||
var dataGroup = bu.attr("data-group");
|
||||
var dataGroupParent = $("." + dataGroup);
|
||||
|
||||
var lineNumberAffected = JSON.parse(bu.attr("affected"));
|
||||
|
||||
$.getJSON(url,{
|
||||
value : bu.val()
|
||||
}, function(json) {
|
||||
if(!$.isEmptyObject(json)) {
|
||||
$.each(json, function(jsonIndex, jsonItem) {
|
||||
dataGroupParent.find("." + jsonIndex).val(jsonItem).attr("readonly", "readonly");
|
||||
|
||||
});
|
||||
|
||||
$.each(lineNumberAffected, function(lineNumberAffectedIndex, lineNumberAffectedItem) {
|
||||
var patternString = lineNumberAffectedItem;
|
||||
$.each(json, function(jsonIndex, jsonItem) {
|
||||
patternString = patternString.replace("{" + jsonIndex + "}", jsonItem);
|
||||
});
|
||||
|
||||
dataGroupParent.find("." + lineNumberAffectedIndex).val(patternString).attr("readonly", "readonly");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,93 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$(".multiple-choice .search").on("keyup", function(){
|
||||
var bu = $(this);
|
||||
var parent = bu.parent(); //tr
|
||||
var value = $(this).val().toLowerCase();
|
||||
parent.find('.dropdown-list .dropdown-item').filter(function() {
|
||||
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||
});
|
||||
|
||||
});
|
||||
$(".multiple-choice > input").on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
$(this).parent().find('[data-toggle=dropdown]').dropdown('toggle');
|
||||
});
|
||||
$(".multiple-choice > input").on("keypress", function(e) {
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".multiple-choice input[type='checkbox']").on("click", function(){
|
||||
|
||||
var selected = [];
|
||||
var selector = $(this).parent().parent().find("input[type='checkbox']");
|
||||
var checkedSelector = $(this).parent().parent().find("input[type='checkbox']:checked");
|
||||
var parent = $(this).parent().parent().parent().parent().parent();
|
||||
var dataGroup = $(this).parent().attr("data-group");
|
||||
var dataGroupParent = $("." + dataGroup);
|
||||
var input = parent.find(".multiple-choice-input");
|
||||
var exceptReadOnly = ['outside_diameter', 'thickness'];
|
||||
|
||||
var json = JSON.parse($(this).parent().attr("data-filter-value"));
|
||||
var affected = $(this).parent().parent().attr("affected");
|
||||
|
||||
if(affected !== undefined) {
|
||||
affected = JSON.parse(affected);
|
||||
|
||||
$.each(affected,function(key,value){
|
||||
var replaceString = value;
|
||||
|
||||
$.each(json, function(resultKey, resultValue){
|
||||
replaceString = replaceString.replace("{"+resultKey+"}",resultValue);
|
||||
});
|
||||
dataGroupParent.find("[name='"+key+"']").val(replaceString).trigger("blur");
|
||||
|
||||
if(!exceptReadOnly.includes(key)) {
|
||||
dataGroupParent.find("[name='"+key+"']").attr("readonly","readonly");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(input.hasAttr("max")) {
|
||||
var max = input.attr("max");
|
||||
if(checkedSelector.length>max) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
selector.each(function() {
|
||||
if($(this).is(":checked")) {
|
||||
selected.push($(this).val());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
input.val(selected.join(input.attr("seperator"))).trigger("blur");
|
||||
input.attr("readonly","readonly");
|
||||
|
||||
|
||||
});
|
||||
$(".multiple-choice .dropdown-toggle").on("click", function(){
|
||||
var parent = $(this).parent().parent();
|
||||
var input = parent.find("input[type='text']");
|
||||
var selected = input.val().split(input.attr("seperator"));
|
||||
parent.find("input[type='checkbox']").prop("checked", false);
|
||||
$.each(selected, function(e,i) {
|
||||
parent.find("input[type='checkbox'][value='"+i+"']").prop("checked", true);
|
||||
});
|
||||
});
|
||||
/*
|
||||
$(".multiple-choice input[type='text']").on("click", function(){
|
||||
|
||||
var parent = $(this).parent();
|
||||
parent.find('[data-toggle=dropdown]').dropdown('toggle');
|
||||
//console.log(selected);
|
||||
});
|
||||
*/
|
||||
$(document).on('click', 'someyourContainer .dropdown-menu', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<script>
|
||||
|
||||
$(function(){
|
||||
$(".select-dropdown .search").on("keyup", function(){
|
||||
var bu = $(this);
|
||||
var parent = bu.parent(); //tr
|
||||
var value = $(this).val().toLowerCase();
|
||||
parent.find('.dropdown-list .dropdown-item').filter(function() {
|
||||
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||
});
|
||||
|
||||
});
|
||||
$(".select-dropdown > input").on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
$(this).parent().find('[data-toggle=dropdown]').dropdown('toggle');
|
||||
});
|
||||
$(".select-dropdown > input").on("keypress", function(e) {
|
||||
return false;
|
||||
});
|
||||
$(".select-dropdown .dropdown-item").on("click", function(){
|
||||
var parent = $(this).parent().parent().parent().parent();
|
||||
var parentGroupName = parent.attr("data-group");
|
||||
var dataGroupParent = $("." + parentGroupName);
|
||||
try {
|
||||
var json = JSON.parse($(this).attr("data-filter-value"));
|
||||
} catch (error) {
|
||||
var json = [];
|
||||
}
|
||||
|
||||
var affected = $(this).parent().attr("affected");
|
||||
var exceptReadOnly = ['outside_diameter', 'thickness'];
|
||||
if(affected !== undefined) {
|
||||
affected = JSON.parse(affected);
|
||||
|
||||
if(affected[0]=="all") {
|
||||
$.each(json, function(resultKey, resultValue){
|
||||
// replaceString = replaceString.replace("{"+resultKey+"}",resultValue);
|
||||
dataGroupParent.find("[name='"+resultKey+"']").val(resultValue).trigger("blur");
|
||||
|
||||
if(!exceptReadOnly.includes(resultKey)) {
|
||||
dataGroupParent.find("[name='"+resultKey+"']").attr("readonly","readonly");
|
||||
}
|
||||
});
|
||||
}
|
||||
$.each(affected,function(key,value){
|
||||
var replaceString = value;
|
||||
|
||||
$.each(json, function(resultKey, resultValue){
|
||||
replaceString = replaceString.replace("{"+resultKey+"}",resultValue);
|
||||
});
|
||||
dataGroupParent.find("[name='"+key+"']").val(replaceString).trigger("blur");
|
||||
|
||||
if(!exceptReadOnly.includes(key)) {
|
||||
dataGroupParent.find("[name='"+key+"']").attr("readonly","readonly");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
parent.find(".select-dropdown-input").val($(this).text().trim()).trigger("blur");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,29 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$(".serialize").unbind();
|
||||
$(".serialize").on("submit",function(){
|
||||
|
||||
for (var i in CKEDITOR.instances) {
|
||||
CKEDITOR.instances[i].updateElement();
|
||||
};
|
||||
var bu = $(this);
|
||||
bu.find(".right-fixed button").attr("disabled","disabled").html("Processing...");
|
||||
bu.find("[type='submit']").attr("disabled","disabled").html("Processing...");
|
||||
$.ajax({
|
||||
type : $(this).attr("method"),
|
||||
url : $(this).attr("action"),
|
||||
data : $(this).serialize(),
|
||||
success: function(d){
|
||||
bu.find(".right-fixed button").removeAttr("disabled").html("{{e2("Success")}}");
|
||||
bu.find("[type='submit']").removeAttr("disabled").html("{{e2("Success")}}");
|
||||
$(".result-ajax").html(d);
|
||||
//bu.find("input").val()
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script>
|
||||
|
||||
$(function(){
|
||||
$(".table-select").on("change", function(){
|
||||
var bu = $(this);
|
||||
var parent = bu.parent().parent(); //tr
|
||||
try {
|
||||
var affected = JSON.parse(bu.attr("affected"));
|
||||
var url = bu.attr("data-url");
|
||||
$.getJSON(url, {
|
||||
value: bu.val()
|
||||
}, function(result){
|
||||
$.each(affected,function(key,value){
|
||||
//var value = d.
|
||||
var replaceString = value;
|
||||
//console.log(replaceString
|
||||
$.each(result, function(resultKey, resultValue){
|
||||
replaceString = replaceString.replace("{"+resultKey+"}",resultValue);
|
||||
});
|
||||
parent.find("[name='"+key+"']").val(replaceString).trigger("blur");
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user