-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdd-LineOperator07.ps1
219 lines (182 loc) · 4.4 KB
/
Add-LineOperator07.ps1
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# https://ej2.syncfusion.com/documentation/listview/how-to/add-and-remove-list-items-from-listview/
# https://www.w3schools.com/css/css_table_size.asp
# https://www.w3schools.com/css/tryit.asp?filename=trycss_form_responsive
Function Add-LineOperator07 {
### HTML Form
$form = @"
<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
}
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
input[type=submit] {
background-color: #0066ff;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: right;
}
input[type=submit]:hover {
background-color: #45a049;
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
}
</style>
</head>
<body>
<h1>Get order</h1>
<div class="container">
<form action='/LineOperator07/GetOrder' method='post'>
<div class="row">
<div class="col-25">
<label for="ordernumber">Order Number</label>
</div>
<div class="col-75">
<input type="text" id="ordernumber" name="ordernumber" placeholder="Enter the ordernumber">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="printamount">Amount to print</label>
</div>
<div class="col-75">
<input type="text" id="printamount" name="printamount" placeholder="Enter the amount of orders to print">
</div>
</div>
<div class="row">
<div class="col-25">
</div>
</div>
<div class="row">
</div>
<br>
<div class="row">
<input type="submit" value="Get Order">
</div>
</form>
</div>
</body>
</html>
"@
### List servers in html
$content = @"
<!DOCTYPE html>
<html>
<head>
<style>
#customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #0066ff;
color: white;
}
</style>
</head>
<body>
<h1>Print List</h1>
<table id='customers'>
<tr>
<th>Print amount</th>
<th>country</th>
<th>car</th>
<th>currency</th>
</tr>
"@
$htmltable = @"
</table>
</div>
<form action='/LineOperator07/Print' method='post'>
<br>
<div class="row">
<input type="submit" value="Print now">
</form>
</div>
</body>
</table>
</div>
<form action='/LineOperator07/ClearPrintJobs' method='post'>
<br>
<div class="row">
<input type="submit" value="Clear print jobs">
</form>
</div>
</body>
</html>
"@
# Create HTML File
New-Item -Path ".\LineOperator07.html" -ItemType File -Value $form -Force
Add-Content -Path ".\LineOperator07.html" -Value $content -Force
# Get Content of order number
If (Test-Path -Path ".\DataToPrint\L07\temp\$ordernumber.csv") {
$ordernumbercontent = Get-content ".\DataToPrint\L07\temp\$ordernumber.csv" | ConvertFrom-Csv -Delimiter ','
}
Else
{
Write-Host 'order not found... -f Red'
}
foreach ($lines in $ordernumbercontent){
Add-Content -Value " <tr>" -LiteralPath .\LineOperator07.html -Force
Add-Content -Value "<td>$($printamount)</td>" -LiteralPath .\LineOperator07.html -Force
Add-Content -Value "<td>$($selectedOrder.country)</td>" -LiteralPath .\LineOperator07.html -Force
Add-Content -Value "<td>$($selectedOrder.car)</td>" -LiteralPath .\LineOperator07.html -Force
Add-Content -Value "<td>$($selectedOrder.currency)</td>" -LiteralPath .\LineOperator07.html -Force
Add-Content -Value " </tr>" -LiteralPath .\LineOperator07.html -Force
}
Add-Content -Value $htmltable -LiteralPath .\LineOperator07.html -Force
}
# <form action='/clear' id="ClearServers" method='post'>
# <input type='reset' and add onclick='document.forms["ClearServers"].submit();'>