Author: Martin Donovan | GitHub gist | profile.json

269c60934b98df42e195a66d45831354

<script src="https://cdn.jsdelivr.net/gh/xcash/bootstrap-autocomplete@v2.3.7/dist/latest/bootstrap-autocomplete.min.js"
  async></script>
  <!-- <script
  src="https://cdn.jsdelivr.net/npm/bootswatch@4.5.2/dist/slate/bootstrap.min.css"
  async 
></script> -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> 
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">

<!--<link rel="stylesheet" href="/resources/demos/style.css">-->
<!-- <script src="https://code.jquery.com/jquery-1.12.4.js"></script> -->
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/9.4.4/math.min.js" integrity="sha512-OZ6CXzl5JrSc9OM1lxp1OC+zt5gCTVAqy7nWwbdSUE98akAvGl/20WaIqsRUnSpBG+QBkcMkiJVfFvybZ6PtKQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/scripts/invoices-client.js"></script>

<%- include ('partials/topnav', {user: user, restaurant: restaurant}) %>
<div class="container">
    <div class="container pt-3 pb-5 shadow-lg bg-white rounded" style="margin: 10px;">
        <form id="setupinvoice">
            <div class="form-row">
                Edit an Invoice:<br>
            </div>
            <div class="form-row">
                <div class="col-2">
                    <label for="startdatepicker">Start Date</label>
                    <input type="text" id="startdatepicker" class="form-control form-control-sm">
                </div>
                <div class="col-2">
                    <label for="enddatepicker">End Date</label>
                    <input type="text" id="enddatepicker" class="form-control form-control-sm">
                </div>
                <div class="col-3">
                    <label for="editinvoicevendorselect">Vendor</label>
                    <select name="vendor" id="editinvoicevendorselect" class="form-control form-control-sm"></select>
                </div>
                <div class="col-5">
                    <label for="invoiceselect">Invoice</label>
                    <select name="invoice" id="invoiceselect" class="form-control form-control-sm"></select>
                </div>
            </div>
            <hr class="border border-primary">
            <div class="form-row">
                Enter a New Invoice:<br>
            </div>
            <div class="form-row">
                <div class="col=1">
                    <label for="startinvoicebutton">Start</label>
                    <button id="startinvoicebutton" type="button" class="form-control form-control-sm">Start</button>
                </div>
                <div class="col-3">
                    <label for="vendorselect">Vendor</label>
                    <select name="vendor" id="vendorselect" class="form-control form-control-sm"></select>
                </div>
                <div class="col-3">
                    <label for="vendorinvoiceid">Vendor Invoice ID</label>
                    <input type="text" name="vendorinvoiceid" id="vendorinvoiceid" class="form-control form-control-sm">
                </div>
                <div class="col-2">
                    <label for="invoicedatepicker">Invoice Date</label>
                    <input type="text" id="invoicedatepicker" class="form-control form-control-sm">
                </div>
                <div class="col-2">
                    <label for="paymentdatepicker">Payment Date</label>
                    <input type="text" id="paymentdatepicker" class="form-control form-control-sm">
                </div>
                <div class="col=1">
                    <label for="enterinvbutton">Enter Invoice</label>
                    <button id="enterinvbutton" type="button" class="form-control form-control-sm">Enter</button>
                </div>
            </div>
        </form>
    </div>
    <!-- <hr class="border border-primary"> -->
    <div class="container pb-4 shadow-lg bg-white rounded" style="margin: 10px;">
        <form id="enterinvoicedetails">
            <div class="row">
                <div class="col-1">
                    <label for="addnewproductbutton"></label>
                    <button type="button" class="btn form-control form-control-sm"  id="addnewproductbutton" data-toggle="modal" data-target="#newproductmodal" data-placement="top" title="Add New Product">
                      <i class="fas fa-plus"></i>
                    </button>
                </div>
                <div class="col-1">
                    <label for="searchcurrentdistonly">Distributor</label>
                    <input class="form-control form-control-sm checkbox-inline" type="checkbox"
                        id="searchcurrentdistonly" data-toggle="tooltip" data-placement="top" title="Current Distributor's Products Only" checked>
                </div>
                <div class="col-5">
                    <label for="select-product">Product Instance:</label>
                    <!-- class demo-default-->
                    <select id="select-product" class="form-control form-control-sm" placeholder="Select a product instance...">
                        <option value="">Select a product instance...</option>
                    </select>
                </div>
                <div class="col-2">
                    <label for="numberreceived">Number Received</label>
                    <input id="numberreceived" type="text" class="form-control form-control-sm"></input>
                </div>
                <div class="col-2">
                    <label for="extendednet">Extended Net</label>
                    <input id="extendednet" type="text" class="form-control form-control-sm"></input>
                </div>
                <div class="col=1">
                    <label for="enterlinebutton">Enter Line</label>
                    <button id="enterlinebutton" type="button" class="form-control form-control-sm">Enter</button>
                </div>
            </div>
        </form>
    </div>
    <div class="container shadow-lg bg-white rounded"  style="margin: 10px;">
        <table id="invoicedetails" class="table table-striped table-sm" width="100%" cellspacing="0">
            <thead>
                <tr>
                    <th>Del.</th>
                    <th>Name</th>
                    <th>Num. Rec.</th>
                    <th>Extended</th>
                    <th>Bottle Net</th>
                    <th>Previous Cost</th>
                    <th>Last Purch. Date</th>
                    <th>Inv. Num.</th>
                    <th>Diff.</th>
                    <th>% Diff.</th>
                </tr>
            </thead>

            <tfoot>
                <tr>
                    <th>Del.</th>
                    <th>Name</th>
                    <th>Num. Rec.</th>
                    <th>Extended</th>
                    <th>Bottle Net</th>
                    <th>Previous Cost</th>
                    <th>Last Purch. Date</th>
                    <th>Inv. Num.</th>
                    <th>Diff.</th>
                    <th>% Diff.</th>
                </tr>
            </tfoot>
        </table>
    </div>

    <div id="invoiceinsertedtoast" class="toast" role="alert" aria-live="assertive" aria-atomic="true" >
        <!-- style="position: absolute; top: 0; right: 0;" -->
        <div class="toast-header">
          <img src="..." class="rounded mr-2" alt="...">
          <strong class="mr-auto">Invoice Inserted</strong>
          <small class="text-muted"></small>
          <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="toast-body">
          The invoice has been inserted into the database.
        </div>
      </div>
    </div>
      <%- include ('partials/newproduct.ejs') %>
<div class="modal fade" id="newproductmodal">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">New Product: Click "New Product" or Select a Product and Instance to Copy</h4>
                
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- Modal body -->
            <div class="modal-body">
                <form>
                    <div class="row">
                        <div class="col">
                            <label for="createnewproductbutton">New Product</label>
                            <button id="createnewproductbutton" class="form-control form-control-sm" type="button">New Product</button>
                        </div>
                        <div class="col">
                            <label for="producttocopy" class="control-label">Product to copy:</label>
                            <!-- class demo-default-->
                            <select id="producttocopy" class="form-control form-control-sm"
                                placeholder="Select a product...">
                                <option value="">Product to copy</option>
                            </select>
                        </div>
                        <div class="col">
                            <label for="productinstancetopcopy" class="control-label">Product instance to copy:</label>
                            <!-- class demo-default-->
                            <select id="productinstancetocopy" class="form-control form-control-sm"
                                placeholder="Select a product">
                                <option value="">Product instance to copy</option>
                            </select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col">
                            <label for="npProductName">Product Name</label>
                            <input class="form-control form-control-sm" type="text" id="npProductName">
                        </div>
 
                    </div>
                    <div class="row">
                        <div class="col">
                            <label for="npInventoryName">Product Instance Name</label>
                            <input class="form-control form-control-sm" type="text" id="npInventoryName">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col">
                            <label for="npWineType"></label>
                            <select class="form-control form-control-sm" name="npWineType" id="npWineType" placeholder="Wine Type" ></select>
                        </div>
                        <div class="col">
                            <label for="npCountry"></label>
                            <select placeholder="Country" class="form-control form-control-sm" name="npCountry" id="npCountry"></select>
                        </div>
                        <div class="col">
                            <label for="npRegion"></label>
                            <select placeholder="Region" class="form-control form-control-sm" name="npRegion" id="npRegion"></select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col">
                            <label for="npVintage"></label>
                            <select placeholder="Vintage" class="form-control form-control-sm" name="npBottleSize" id="npVintage"></select>
                        </div>
                        <div class="col">
                            <label for="npBottleSize"></label>
                            <select placeholder="Bottle Size" class="form-control form-control-sm" name="npBottleSize" id="npBottleSize"></select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col">
                            <label for="npRoom">Room</label>
                            <select id="npRoom" name="npRoom" class="form-control form-control-sm"></select>
                        </div>
                        <div class="col">
                            <label for="npCol">Column</label>
                            <input value="0" type="number" id="npCol" name="npCol" class="form-control form-control-sm">
                        </div>
                        <div class="col">
                            <label for="npRow">Row</label>
                            <input value="0" type="number" id="npRow" name="npRow" class="form-control form-control-sm">
                        </div>
                    </div>

                </form>
            </div>

            <!-- Modal footer -->
            <div class="modal-footer">
                <button type="button" id="savenewproductbutton" class="btn btn-danger" data-dismiss="modal">Save</button>
                <button type="button" id="closebutton" class="btn btn-danger" data-dismiss="modal">Close</button>
            </div>

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