从表格

时间:2019-07-03 14:33:59

标签: javascript node.js express ejs

由于我是框架和nodejs的新手,所以我想知道是否可以做到这一点。我有一个来自数据库的表,其中除表(几列)外还包含动态值。我有几列包含与价格和价格列的注释部分。

  1. 我有一个按价格下载的按钮(只有对应的所有列都应以pdf格式下载)-“类似发票的东西”

  2. 我有第二个按钮,没有价格下载(只有复选框才能下载,其中除以一列或两列为pdf以外的所有列)-“类似发票的东西”

注意:即使启用了此复选框或并非所有记录都存储在数据库中,表的当前问题仍然存在。我还想知道是否可以使用javascript或nodejs仅提交选定的人。

到目前为止,连接和路由已完成,仅保存和下载即可。

<!DOCTYPE html>
<html lang="en">

<head>

    <%- include ../partials/head %>
   <link href="https://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
</head>

<body>
    <% include ../partials/menu %>
    <form action="/dist/Add/<%= idpacking %>/<%= AWBNo %>" method="post" name="form1">

    <div class="container-fluid bg-3 text-center">

        <div class="container">
            <h3>Distributor information</h3><br>&nbsp;
            <ul class="list-inline">
                <li class="list-inline-item">AWB No:<%= AWBNo %></li> &nbsp;
                <li class="list-inline-item">Date:<%= AWBNo %></li> &nbsp;
                <li class="list-inline-item">Land:<%= AWBNo %></li> &nbsp;
                <li class="list-inline-item">Lieferant:<%= AWBNo %></li> &nbsp;
            </ul>
            <!--   <% if (messages.error) { %>
              <p style="color:red"><%- messages.error %></p>
            <% } %> -->

            <% if (messages.success) { %>
                <p class="alert alert-success mt-4"><%- messages.success %></p>
            <% } %>  
            <br>
<div class="btn-group btn-group-justified">
  <a href="#" class="btn btn-primary">Save</a>
  <a href="#" class="btn btn-primary">Download With Price</a>
  <a href="#" class="btn btn-primary">Download Without Price</a>
</div>
<br>
            <div class="container1">
                <div class="row">
                    <div class="col-12">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th scope="col" style="text-align:center;">Box No.</th>
                                    <th scope="col" style="text-align:center;">Produkt Name</th>
                                    <th scope="col" style="text-align:center;">Gew.</th>
                                    <th scope="col" style="text-align:center;">Stk.</th>
                                    <th scope="col" style="text-align:center;">Kunde</th>
                                    <th scope="col" style="text-align:center;">Preis</th>
                                    <th scope="col" style="text-align:center;">Spedition</th>
                                    <th scope="col" style="text-align:center;">Verteillungs-Tag</th>
                                    <th scope="col" style="text-align:center;">Res</th>
                                    <th scope="col" style="text-align:center;">Bestell-Nr.</th>
                                    <th scope="col" style="text-align:center;">Notiz</th>
                                    <th scope="col" style="text-align:center;">Teilen</th>
                                    <th scope="col" style="text-align:center;">Liefersch</th>
                                </tr>
                            </thead>
                            <tbody>
                             <% if(data.length){

                                for(var i = 0; i< data.length; i++) {%>  
                                <input type="hidden"  value= "<%= data[i].ProductId%>"  name="ProductId">
                                <tr>

                                    <td>

                                            <input type="checkbox" class="custom-control-input" id="Check_Row"  name="Check_Row" checked>

                                            <label class="custom-control-label" for="customCheck1"><%= i+1 %></label>

                                    </td>
                                    <td><%= data[i].P_Name%></td>
                                    <td>

                                            <input type="number" class="custom-number"  min="0" max="<%= data[i].Weight%>"  id="Weight" name="Weight" style="width: 7em"  value="<%= data[i].Weight%>">
                                    </td>
                                    <td>

                                            <input type="number" class="custom-stk1" id="Pcs"  name="Pcs" style="width: 7em"  value="<%= data[i].Pcs%>" >
                                    </td>
                                    <td class="select">
                                        <select id="Distributor"  name="Distributor" >
                                            <option value=""></option>
                                            <option value="1">YinSeaFood</option>
                                            <option value="2">YinSeaFood1</option>
                                            <option value="3">YinSeaFood2</option>
                                            <option value="4">YinSeaFood3</option>
                                        </select>

                                    </td>
                                    <td>
                                       <div class="input-group">
                                                <span class="input-group-addon">€</span>
                                                <input type="number" value="<%= data[i].P_Price %>" min="0" step="0.01" data-number-to-fixed="2" data-number-stepfactor="100"
                                                    class="form-control currency" id="Price" name="Price"  style="width: 7em"/>

                                    </td>
                                    <td class="select">
                                            <select id="carrier" name="carrier">
                                                <option value=""></option>
                                                <option value="1">DHL</option>
                                                <option value="2">HERMES</option>
                                                <option value="3">UPS</option>
                                                <option value="4">Fedex</option>
                                            </select>

                                        </td>
                                    <td>
                                            <input type="text" name="DOD" style="width: 9.5em" class="date-picker">
                                    </td>
                                     <td>
                                            <input type="date" name="ResDate" style="width: 9.5em">
                                    </td>
                                     <td>
                                             <input type="textbox" name="OrderNo" style="width: 9.5em">
                                    </td>
                                     <td>
                                                <input type="textbox" name="Note" style="width: 9.5em" >
                                        </td>

                                    <td>

                                                    <input type="radio" name="Partition" id="Gew" class="responsive">
                                                    <label for="yes">Gew.</label>

                                                    <input type="radio" name="Partition" id="Stk" class="responsive">
                                                    <label for="no">Stk.</label>

                                    </td>
                                    <td>

                                                    <textarea name="Comment" id="Comment">

                                                    </textarea>

                                    </td>
                                </tr>
                              <% }

                               }else{ %>
                                   <tr>
                                      <td colspan="3">No Product</td>
                                   </tr>
                                <% } %>  
                            </tbody>
                        </table>

                    </div>
                </div>
            </div>

            </form>
        </div>
<script>

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
date = date.split("/").reverse().join("-");

$(".date-picker").val(date);
</script>
</body>


</html>

0 个答案:

没有答案