This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
new.html
140 lines (95 loc) · 4.02 KB
/
new.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
<script>
$(document).ready(function () {
// app.home();//Get device list json
$( ".tbl-devices tbody" ).html(_.template($("#tpl-datatable").html(),{rows:device}));
$( "body" ).undelegate( ".btn-choose-device","click").delegate( ".btn-choose-device", "click", function() {
query = `select * from ? where id = ${$(this).attr("data-device-id")} ` ;
currentDevice = alasql(query,[device])[0];
(async function () {
$.blockUI();
var response = await axios.get("./device.html");
$( "#div_main" ).html(response.data);
if (userAgent.indexOf(' electron/') > -1) { //Electron code only
app.saveProjectEditorJson(currentDevice.id,currentDevice.code);
setTimeout(function(){
app.loadAllFile(fileLocation);
$.unblockUI();
}, 3000);
}else{
$.unblockUI();
}
})()
// $.get("url", function (data) {
// app.saveProjectEditorJson(device_id,device_code)
// // console.log(data["device"]);
// $( "#div_main" ).html(data);
// setTimeout(function(){
// app.loadAllFile(fileLocation);
// $.unblockUI();
// }, 3000);
// });
})//end choose device btn
$(".btn-dont-know").click(function (e) {
e.preventDefault();
swal({
type:"success",
title:"Device explain",
html:`<div style="text-align: left;font-size: 14px">
<b class="red">NodeMCU ESP8286</b> is the most recommend device if you don't know what to start. Reason:
<ul>
<li> <b class="red">NodeMCU ESP8286</b> is cheapest and support WIFI, a true IOT device.</li>
<li> <b class="red">NodeMCU ESP32</b> has higher price, has bluetooth (usually not used), not compatiple with all modules.</li>
<li> <b class="red">Arduino</b> is not recommend. You must buy an external device (like a LAN card) and using caple to connect device to internet.</li>
</ul>
<b class="red">Price and where to buy</b> is in description. China store is cheapest but it takes long to ship. You could try to find in any online market in your country.
</div>`
})
});
$('.hasTooltip').tooltip({"html": true,"container": "body"});
}); //End document ready
</script>
</head>
<body>
<h3 class="header smaller red">CHOOSE YOUR DEVICE TO CONTINUE...</h3>
<div class="alert alert-block alert-warning">I don't know any device below. Don't worry,
<span class="btn btn-mini btn-primary btn-dont-know">Click here</span> to know more.
</div>
<table style="width: 100%" class="table table-bordered table-striped tbl-devices">
<thead>
<tr>
<th style="width:5px">#</th>
<th style="width:10%">Device name</th>
<th ">Image</th>
<th>Description</th>
<th>Price ($)</th>
<th>Buy</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>
<!-------- TEMPLATE DE RENDER DU LIEU TU JSON CUA DATATABLE ----------------->
<script type="text/template" class="template" id="tpl-datatable">
<%
var tr_count = 0;
_.each(rows, function(row){
tr_count++;
%>
<%= row.id %>
<tr>
<td><%= tr_count %></td>
<td>
<b><a href="#id" data-device-id="<%= row.id %>" data-device-code="<%= row.code %>" class="btn-choose-device" data-api-url = "/iots/index.php?option=com_omg&view=omg&task=device&format=raw&id=<%= row.id %>" data-url=;"./device.html"><%= row.name %></a></b>
</td>
<td><img style="width:85%;margin-bottom:10px;border-radius:8px;max-width:100px;border: 1px solid #ddd;" src="./img/<%=row.image %>" ></td>
<td><%= row.description %></td>
<td><%= row.price %></td>
<td><a href="<%= row.buy_url %>" target="_blank">
<img style="width:60%" src="./img/aliexpress.png" >
</a></td>
</tr>
<% })
%>
</script>