-
Notifications
You must be signed in to change notification settings - Fork 0
/
bom.html
153 lines (142 loc) · 4.79 KB
/
bom.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>APS viewer app</title>
<link rel="icon" href="img/favicon.ico" />
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/site.css" />
<link rel="stylesheet" href="css/dx.common.css" />
<link rel="stylesheet" href="css/dx.light.css" />
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css" />
<script type="text/javascript"
src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
<script type="text/javascript" src="lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="lib/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="js/dx.all.js"></script>
<style>
</style>
</head>
<body class="d-flex flex-column vh-100">
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow">
<div class="container-fluid">
<a class="navbar-brand" style="display: flex;" href="/">
<object class="mt-1 mb-1" data="img/logo.svg" height="35"></object>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item" style="width: 300px;">
<div id="ProjectsLookup"></div>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="projects.html">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="index.html">Documents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="bom.html"><b>Bill of Materials</b></a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="instructions.html">Instructions</a>
</li>
</ul>
</nav>
<div class="body-area container-fluid flex-fill px-0">
<div class="row m-0" style="position: relative; width: 100%; height: 100%;">
<div class="col p-0">
<div id="BomGrid"></div>
</div>
</div>
</div>
</body>
<script src="js/site.js"></script>
<script>
/*
https://js.devexpress.com/Documentation/21_2/Guide/jQuery_Components/Add_DevExtreme_to_a_jQuery_Application/#Local_Files
https://community.devexpress.com/blogs/aspnet/archive/2017/05/03/new-treelist-widget-html-5-client-side-javascript-devextreme-v17-1.aspx
https://js.devexpress.com/Documentation/21_2/Guide/UI_Components/TreeList/Getting_Started_with_TreeList/
*/
var data = [
{
"ID": 1, "ParentID": 0, "Number": "00000001", "Description": "Assembly", "Picture": "assembly.png"
},
{
"ID": 2, "ParentID": 1, "Number": "00000002", "Description": "Subassembly", "Picture": "assembly.png"
},
{
"ID": 3, "ParentID": 2, "Number": "00000003", "Description": "Part 2", "Picture": "part.png"
},
{
"ID": 4, "ParentID": 2, "Number": "00000004", "Description": "Part 3", "Picture": "part.png"
},
{
"ID": 5, "ParentID": 1, "Number": "00000005", "Description": "Part 1", "Picture": "part.png"
}
];
$(function () {
$("#BomGrid").dxTreeList({
dataSource: data,
rootValue: 0,
keyExpr: "ID",
parentIdExpr: "ParentID",
columns: [{
dataField: "Number",
caption: "Part Number"
}, {
dataField: "Picture",
caption: "",
cellTemplate: function (element, info) {
element.append("<img src='img/" + info.text + "'></img>")
.css("color", "blue");
}
},
"Description"],
autoExpandAll: true,
allowColumnResizing: true,
columnAutoWidth: true,
rowAlternationEnabled: true,
hoverStateEnabled: true,
filterRow: { visible: true },
searchPanel: { visible: false },
});
});
var projects = [
{
"ID": 1, "Number": "00000001", "Description": "Assembly", "Picture": "assembly.png"
},
{
"ID": 2, "Number": "00000002", "Description": "Subassembly"
},
{
"ID": 3, "Number": "00000003", "Description": "Part 2"
},
{
"ID": 4, "Number": "00000004", "Description": "Part 3"
},
{
"ID": 5, "Number": "00000005", "Description": "Part 1"
}
];
$(function () {
$("#ProjectsLookup").dxLookup({
dataSource: projects,
valueExpr: "ID",
displayExpr: "Number",
searchMode: 'contains',
searchExpr: 'Description',
searchPlaceholder: 'Type Project name',
itemTemplate: function (itemData, itemIndex, itemElement) {
return itemData.Number + ' - ' + itemData.Description;
},
dropDownOptions: {
closeOnOutsideClick: true,
showTitle: false
}
});
});
</script>