|
|
@@ -140,14 +140,18 @@ $(document).ready(function () {
|
|
|
}).on(
|
|
|
'select_node.jstree',
|
|
|
function (event, data) {
|
|
|
+
|
|
|
if (data.node.text.includes("-")) {
|
|
|
- $("#folderPath").empty();
|
|
|
+ $("#reset").prop("disabled", false);
|
|
|
+ $("#header").empty();
|
|
|
displayDetail(false);
|
|
|
project_id = data.node.text.split("-")[0];
|
|
|
project_name = data.node.text.split("-")[1];
|
|
|
project = data.node.text;
|
|
|
$("#project-id").val(project_id)
|
|
|
- $("#header").text(project);
|
|
|
+ //$("#header").text(project + " > ");
|
|
|
+ $("#header").empty();
|
|
|
+ $("#header").append("<span>" + project + " > </span>");
|
|
|
category = $('#treeAjaxHTML').jstree(true).get_node(data.node.parents[0]).text;
|
|
|
let i = 1;
|
|
|
table.clear().draw();
|
|
|
@@ -175,8 +179,12 @@ $(document).ready(function () {
|
|
|
});
|
|
|
|
|
|
$('#btn-search').click(function () {
|
|
|
- $("#folderPath").empty();
|
|
|
- $("#header").text("搜尋結果");
|
|
|
+
|
|
|
+ $("#reset").prop("disabled", true);
|
|
|
+ $("#header").empty();
|
|
|
+ //$("#header").text("搜尋結果");
|
|
|
+ $("#header").empty();
|
|
|
+ $("#header").append("<span>搜尋結果</span>");
|
|
|
$.ajax({
|
|
|
url: "./script/php/search.php",
|
|
|
data: {
|
|
|
@@ -223,28 +231,32 @@ $(document).ready(function () {
|
|
|
|
|
|
$('#reset').click(function () {
|
|
|
|
|
|
- folderPath.pop();
|
|
|
- let index = folderPath.length;
|
|
|
-
|
|
|
- $("#folderPath").children().eq(index).remove();
|
|
|
-
|
|
|
- table.clear().draw();
|
|
|
- if(is_blueprint2){
|
|
|
- tempTable2.forEach(function(data) {
|
|
|
- table.row.add(data).draw();
|
|
|
- });
|
|
|
- is_blueprint2 = false;
|
|
|
- }else{
|
|
|
- tempTable.forEach(function(data) {
|
|
|
- table.row.add(data).draw();
|
|
|
- });
|
|
|
+ if (folderPath.length != 1) {
|
|
|
+ folderPath.pop();
|
|
|
+ let index = folderPath.length;
|
|
|
+ $("#header").children().eq(index).remove();
|
|
|
+ table.clear().draw();
|
|
|
+ if (is_blueprint2) {
|
|
|
+ tempTable2.forEach(function (data) {
|
|
|
+ table.row.add(data).draw();
|
|
|
+ });
|
|
|
+ is_blueprint2 = false;
|
|
|
+ } else {
|
|
|
+ tempTable.forEach(function (data) {
|
|
|
+ table.row.add(data).draw();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $("#tableDetail td").empty();
|
|
|
+ displayDetail(false);
|
|
|
}
|
|
|
- $("#tableDetail td").empty();
|
|
|
- displayDetail(false);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
|
|
|
var is_blueprint2 = false;
|
|
|
$('#datatable-ajax tbody').on('click', 'tr', function () {
|
|
|
+ $("#reset").prop("disabled", false);
|
|
|
$(this).parent().find("tr").css('background-color', '');
|
|
|
$(this).css("background-color", "#cccccc");
|
|
|
$("#tableDetail td").empty();
|
|
|
@@ -280,15 +292,15 @@ $(document).ready(function () {
|
|
|
span.on("click", function (e) {
|
|
|
let clicked = $(e.target).text().split(" > ")[0];
|
|
|
let index = folderPath.indexOf(clicked);
|
|
|
- for(k = index+1; k < folderPath.length; k++){
|
|
|
- $("#folderPath").children().eq(k).remove();
|
|
|
+ for (k = index + 1; k < folderPath.length; k++) {
|
|
|
+ $("#header").children().eq(k).remove();
|
|
|
folderPath.pop();
|
|
|
}
|
|
|
addTable(data, notes, response, SN, path);
|
|
|
is_blueprint2 = false;
|
|
|
});
|
|
|
- $("#folderPath").append(span);
|
|
|
- folderPath = $("#folderPath").text().split(" > ");
|
|
|
+ $("#header").append(span);
|
|
|
+ folderPath = $("#header").text().split(" > ");
|
|
|
folderPath.pop();
|
|
|
|
|
|
addTable(data, notes, response, SN, path);
|
|
|
@@ -338,7 +350,7 @@ $(document).ready(function () {
|
|
|
}
|
|
|
|
|
|
function addTable(data, notes, response, SN, path) {
|
|
|
-
|
|
|
+
|
|
|
table.clear().draw();
|
|
|
if (data[1] != "設計圖") {
|
|
|
displayDetail(true);
|