-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders.html
76 lines (74 loc) · 3.06 KB
/
orders.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>order Details</title>
<link rel="stylesheet" href="styles.css"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI=" crossorigin="anonymous"></script>
</head>
<body>
<script>
const mysql = require('mysql');
var connection = mysql.createConnection({
host:'localhost',
user:'root',
password:'12345678',
database:'amigos'
});
</script>
<div class="container">
<div class="row table-row">
<div class="col-sm-1"></div>
<div class="col-sm-10 table">
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-6">
<table id="table">
</table>
<button type="button" id="delete">delete</button>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<div class="col-sm-1"></div>
</div>
</div>
<script type='text/javascript' src="index.js"> </script>
<script type='text/javascript'>
require('electron').ipcRenderer.on('value',(event,result1)=>{
let k=result1;
let sql = "select * from menu where name=?";
connection.query(sql,[k],function(err,result){
if(err) throw err;
let table = document.getElementById("table");
for(let i=0;i<result.length;i++)
{
let row = table.insertRow(i);
let count=0;
for( var j in result[i])
{
row.insertCell(count).innerHTML = result[i][j];
count++;
}
}
let header = table.createTHead();
var row1 = header.insertRow(0);
for(let i=0;i<Object.keys(result[0]).length;i++)
{
row1.insertCell(i).innerHTML = Object.keys(result[0])[i];
}
})
document.getElementById("delete").addEventListener('click',function(){
let sql = "delete from menu where name='" + result1+"'";
connection.query(sql,[result1],function(err,result){
if(err) throw err;
})
})
})
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>