{% extends "../base.html" %}
{% block content %}
<div class="starter-template">
	<legend>
		{% if from=="usb" || not plate.PlateID %}
			<translate>Add Plate</translate>
		{% else %}
			<translate>Edit Plate</translate> "{{plate.Path}}"
		{% endif %}
	</legend>
	<form method="post" action="{% if file!="" %}/plate/add-usb{% endif %}" class="edit-page" enctype="multipart/form-data">
		<div class="row flex-row">
			{% if from=="usb" %}
			<div class="col-md-4">
				<label for="file" translate>File From USB</label>
				<select name="USBFile" id="file" class="form-control">
				{% for file in files %}
					<option value="{{file}}">{{file}}</option>
				{% endfor %}
				</select>
			</div>
			{% else %}
				{% if not plate.PlateID && file=="" %}
				<div class="col-md-4">
					<label for="ZipFile"><translate>Plate File</translate> <span class="label label-default" translate>STL, OBJ, SLC, SVG, NanoDLP or Zip (PNG Files)</span></label>
					<input name="ZipFile" class="form-control" id="ZipFile" type="file" accept=".zip,.obj,.slc,.svg,.stl,.cws,.nanodlp" {% if not plate.PlateID %}required{% endif %}>
				</div>
				{% else %}
				<input type="hidden" name="USBFile" class="form-control" value="{{file}}">
				{% endif %}
			{% endif %}
			<div class="col-md-4">
				<label for="Path" translate>Plate Name</label>
				<input value="{{plate.Path}}" name="Path" id="Path" class="form-control" required>
				<br>
			</div>
			<div class="col-md-4">
				<label for="ProfileID" translate>Profile</label>
				<select name="ProfileID" id="ProfileID" class="form-control">
					{% for profile in profiles %}
						<option value="{{profile.ProfileID}}" {% if (defaultProfile == profile.ProfileID) %}selected{% endif %}>{{profile.Title}}</option>
					{% endfor %}
				</select>
				<br>
			</div>
			<div class="col-md-12">
				<button class="btn btn-info" type="button" data-toggle="collapse" data-target=".advanced" aria-expanded="false" translate>Advanced Options</button>
				<br>
				<br>
			</div>
			<div class="col-md-3 collapse advanced">
				<label for="AutoCenter"><translate>Auto Center</translate>{{helpModal("auto-center")}}</label>
				<select name="AutoCenter" id="AutoCenter" class="form-control">
					<option value="0" translate>Center Pieces</option>
					<option value="1" translate>Center Origin</option>
					<option value="2" translate>Disable</option>
				</select>
			</div>
			<div class="col-md-3 collapse advanced">
					<label for="Offset"><translate>Offset Lowest Point for Slicing</translate> <span class="label label-default" translate>mm</span></label>
					<input name="Offset" class="form-control" id="Offset" type="number" step="0.01" value="{{ plate.Offset }}">
			</div>
			<div class="col-md-3 collapse advanced">
				<label for="StopLayers"><translate>Stop Layers</translate> <span class="label label-default" translate>Optional</span>{{helpModal("stop-layers")}}</label>
				<input value="{{plate.StopLayers}}" class="form-control" name="StopLayers" id="StopLayers" pattern="[\d,]*">
			</div>
			<div class="col-md-3 collapse advanced">
				<label for="LowQualityLayerNumber"><translate>Number of Low Quality Layers</translate> <span class="label label-default" translate>Optional</span>{{helpModal("low-quality-layers")}}</label>
				<input class="form-control" value="{{plate.LowQualityLayerNumber}}" name="LowQualityLayerNumber" id="LowQualityLayerNumber" type="number" required>
				<br>
			</div>
			{% if not plate.PlateID && file=="" %}
				<div class="col-md-3 collapse advanced">
					<label for="MaskFile"><translate>Mask File (PNG)</translate> <span class="label label-default" translate>Optional, override global mask</span></label>
					<input name="MaskFile" class="form-control" id="MaskFile" type="file" accept=".png">
				</div>
				<div class="col-md-3 collapse advanced">
					<label for="MaskEffect"><translate>Decrease Mask Intensity</translate> <span class="label label-default" translate>Percentage</span></label>
					<input name="MaskEffect" class="form-control" id="MaskEffect" type="number" step="0.1" min="0" max="100" value="{{ plate.MaskEffect }}">
				</div>
			{% endif %}
			<div class="col-md-3 collapse advanced">
				<label for="ImageRotate" translate>Rotate Layers</label>
				<select class="form-control" name="ImageRotate" id="ImageRotate">
					<option value="0" {% if plate.ImageRotate==0 %}selected{% endif %} translate>Same as Profile</option>
					<option value="1" {% if plate.ImageRotate==1 %}selected{% endif %} translate>Do not Rotate</option>
					<option value="2" {% if plate.ImageRotate==2 %}selected{% endif %} translate>Rotate 90°</option>
				</select>
				<br>
			</div>
		</div>
		<br>
		<button type="submit" class="btn btn-success" translate>Submit</button>
	</form>
	{% if isARM %}
	<div class="row">
		<div class="col-md-12">
			<br>
			<br>
			<div class="alert alert-info" translate>Available memory on Raspberry Pi is limited to slice STL files larger than 200MB. Please, use NanoDLP remote slicer feature or SLC format to upload large plates.</div>
		</div>
	</div>
	<br>
	<br>
	{% endif %}
</div>
{% endblock %}