<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>ELAB Part Search Engine - Location editor</title>
    <script
  src="https://code.jquery.com/jquery-3.2.1.min.js"
  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  crossorigin="anonymous"></script>
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="{{ baseURL }}/static/style.css">
    <script src="https://use.fontawesome.com/2fef7be393.js"></script>
    <script type="text/javascript" src="{{ baseURL }}/static/common.js"></script>
    <script type="text/javascript" src="{{ baseURL }}/static/locationEditorScript.js"></script>
  </head>
  <body>
    <h1>LOCATION EDITOR</h1>
    <p>Looking for a place to store your obsolete ICs discontinued years ago? Just toss them anywhere and mark that location here! <a href=".">back to parts</a></p>
    <table id="results" class="results-locations">
      <tr>
        <th>ID</th>
        <th>c.ID</th>
        <th>Container name</th>
        <th>Location name</th>
      </tr>
      {% for location in locations %}
        <tr onclick="init_Location_edit({{location['id']}}, '{{location['name']}}', {{location['container_id']}});">
          <td>{{location['id']}}</td>
          <td>{{location['container_id']}}</td>
          <td>{{location['container']}}</td>
          <td>{{location['name']}}</td>
        </tr>
      {% endfor %}
    </table>
    <div class="bottom-spacer"></div>

    <div class="shadow" onclick="overlay_out()"></div>
  	<div class="overlay">
      <h2>Part Details</h2>
      <table id="details">
      <tr><td>Adding a new LOCATION inside a given CONTAINER</td></tr>  
        <tr><td>
          <select class="pinfo-input nothidden" onchange="update_map()" name="mapfile-input" id="container-input">
            {% for container in containers %}
            <option value="{{container['id']}}">{{container['name']}}</option>
            {% endfor %}
          </select>
        </td></tr>

        <tr><td>Location name (obs! If a drawer has an identification sticker, start the name with it.<br />Example: ".2 - Power resistors"</td></tr>
        <tr><td><p></p><input type="text" name="location-name-input" id="location-name-input" placeholder="Location name" class="pinfo-input nothidden"/></td></tr>
       
       

        <tr><td>Note: adding custom "containers" is currently insupported and unpossible.</td></tr>
        
      </table>
      <img src="map/{{containers[0]['id']}}" id="map" class="map"/>
      <div class="round-button-left"><a href="#" id="save-button"><i class="fa fa-check" aria-hidden="true"></i></a></div>
      <div class="round-button"><a href="#" id="delete-button"><i class="fa fa-trash" aria-hidden="true"></i></a></div>
      <div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div>
  	</div>
    <div class="round-floating-button"><a href="#" onclick="init_Location_edit(-1, '', 0)"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
  </body>
</html>
