first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl =
|
||||
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
|
||||
var controller = baseUrl;
|
||||
$(document).ready(function () {
|
||||
//alert("Please index js");
|
||||
});
|
||||
$(".btn-switch-admin").click(function (e) {
|
||||
id = $(this).data('id');
|
||||
console.log(id);
|
||||
Swal.fire({
|
||||
title: "Apakah anda yakin?",
|
||||
text: "Anda Akan Pindah Acces User",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Ya,switch user",
|
||||
cancelButtonText: "Batal",
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: controller + "/user/switch_user_back",
|
||||
dataType: "JSON",
|
||||
type: "POST",
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.status) {
|
||||
console.log("success");
|
||||
window.location.href = baseUrl + "/site/dashboard";
|
||||
} else {
|
||||
console.log("filed");
|
||||
window.location.href = baseUrl + "/user";
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {},
|
||||
}); //end ajax
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||
var controller = baseUrl + '/groupMenu';
|
||||
|
||||
$(document).ready(function () {
|
||||
$("body").off("click", "input[class=checkbox-three]").on("click", "input[class=checkbox-three]", function (e) {
|
||||
var key = $(this).val();
|
||||
var ket = 0;
|
||||
if ($(this).is(":checked")) {
|
||||
var ket = 1;
|
||||
}
|
||||
$.ajax({
|
||||
url: baseUrl + '/groupMenu/getChecked',
|
||||
type: "POST",
|
||||
data: {"key": key, "ket": ket},
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
data.forEach(function (idm) {
|
||||
if (ket == 1) {
|
||||
$("[id='menu-" + idm + "']").prop("checked", true);
|
||||
} else {
|
||||
$("[id='menu-" + idm + "']").prop("checked", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||
var controller = baseUrl + '/menu';
|
||||
|
||||
$(document).ready(function () {
|
||||
var isNewRecord = $("#isNewRecord").val();
|
||||
if (isNewRecord == 'false') {
|
||||
var key = $("#position").val();
|
||||
var level = $("#level").val();
|
||||
|
||||
if (level == 2) {
|
||||
change_position(key, $("#parent_1").val());
|
||||
} else if (level == 3) {
|
||||
change_position(key, $("#parent_1").val());
|
||||
change_parent($("#parent_1").val(), $("#parent_2").val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".level_1").select2({
|
||||
placeholder: "Select Level 1",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$(".level_2").select2({
|
||||
placeholder: "Select Level 2",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$(".js-example-placeholder-single").select2({
|
||||
placeholder: "Select a state",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$("#position").change(function () {
|
||||
var key = $("#position").val();
|
||||
change_position(key, '', '');
|
||||
});
|
||||
|
||||
function change_position(key, parent) {
|
||||
$.ajax({
|
||||
url: baseUrl + '/menu/getParent',
|
||||
data: {'key': key},
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
var html = '';
|
||||
var i;
|
||||
if ($("#isNewRecord").val() == 'true') {
|
||||
html += '<option value="">-- Select Level 1 --</option>';
|
||||
}
|
||||
for (i = 0; i < data.length; i++) {
|
||||
html += '<option value=' + data[i].id + '>' + data[i].name + '</option>';
|
||||
}
|
||||
$('#level_1').html(html);
|
||||
$('#level_1').val(parent);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function change_parent(key, parent_2) {
|
||||
console.log("aa" + key);
|
||||
$.ajax({
|
||||
url: baseUrl + '/menu/getChild',
|
||||
data: {'key': key},
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
var html = '';
|
||||
var i;
|
||||
if ($("#isNewRecord").val() == 'true') {
|
||||
html += '<option value="">-- Select Level 2 --</option>';
|
||||
}
|
||||
for (i = 0; i < data.length; i++) {
|
||||
html += '<option value=' + data[i].id + '>' + data[i].name + '</option>';
|
||||
}
|
||||
$('#level_2').html(html);
|
||||
$('#level_2').val(parent_2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#level_1").change(function () {
|
||||
var key = $("#level_1").val();
|
||||
change_parent(key);
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||
var controller = baseUrl + '/company_profile';
|
||||
|
||||
$(document).ready(function () {
|
||||
load_setting();
|
||||
});
|
||||
|
||||
function load_setting(key) {
|
||||
$.ajax({
|
||||
url: baseUrl + '/companyProfile/load_setting',
|
||||
type: "POST",
|
||||
data: {},
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$("#div-setting").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||
var controller = baseUrl + '/profile';
|
||||
|
||||
$("body").off("click", "#btn-reset").on("click", "#btn-reset", function (e) {
|
||||
var key = $(this).attr("data-key");
|
||||
load_modal(key);
|
||||
});
|
||||
|
||||
function load_modal(key) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: baseUrl + '/profile/load_modal',
|
||||
data: {
|
||||
key: key
|
||||
},
|
||||
success: function (data) {
|
||||
$("#div-reset").html(data);
|
||||
$('#modal-reset').modal('show');
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
var getUrl = window.location;
|
||||
var baseUrl =
|
||||
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
|
||||
var controller = baseUrl + "/user";
|
||||
$(document).ready(function () {
|
||||
//alert("Please enter a valid");
|
||||
});
|
||||
|
||||
$(".btn-switch-user").click(function (e) {
|
||||
id = $(this).data("id");
|
||||
Swal.fire({
|
||||
title: "Apakah anda yakin?",
|
||||
text: "Anda Akan Pindah Acces User",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Ya,switch user",
|
||||
cancelButtonText: "Batal",
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: controller + "/switch_user",
|
||||
dataType: "JSON",
|
||||
type: "POST",
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
|
||||
success: function (data) {
|
||||
if (data.status) {
|
||||
console.log("success");
|
||||
window.location.href = baseUrl + "/site/dashboard";
|
||||
} else {
|
||||
console.log("filed");
|
||||
window.location.href = baseUrl + "/user";
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {},
|
||||
}); //end ajax
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user