80 lines
3.7 KiB
HTML
80 lines
3.7 KiB
HTML
{% extends "base.html" %}
|
||
|
||
{% block page_title %}
|
||
<h4 class="mb-0">新增商品</h4>
|
||
{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="row justify-content-center">
|
||
<div class="col-md-8">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h5 class="card-title mb-0">商品資料</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
<form method="POST">
|
||
{{ form.csrf_token }}
|
||
|
||
<div class="row mb-4">
|
||
<div class="col-md-12">
|
||
<label class="form-label">{{ form.name.label }} <span class="text-danger">*</span></label>
|
||
{{ form.name(class="form-control" + (" is-invalid" if form.name.errors else "")) }}
|
||
{% if form.name.errors %}
|
||
<div class="invalid-feedback">
|
||
{% for error in form.name.errors %}
|
||
<span>{{ error }}</span>
|
||
{% endfor %}
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row mb-4">
|
||
<div class="col-md-6">
|
||
<label class="form-label">{{ form.price.label }} <span class="text-danger">*</span></label>
|
||
<div class="input-group">
|
||
<span class="input-group-text">$</span>
|
||
{{ form.price(class="form-control" + (" is-invalid" if form.price.errors else ""), step="0.01") }}
|
||
{% if form.price.errors %}
|
||
<div class="invalid-feedback">
|
||
{% for error in form.price.errors %}
|
||
<span>{{ error }}</span>
|
||
{% endfor %}
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<label class="form-label">{{ form.min_quantity.label }}</label>
|
||
{{ form.min_quantity(class="form-control" + (" is-invalid" if form.min_quantity.errors else "")) }}
|
||
{% if form.min_quantity.errors %}
|
||
<div class="invalid-feedback">
|
||
{% for error in form.min_quantity.errors %}
|
||
<span>{{ error }}</span>
|
||
{% endfor %}
|
||
</div>
|
||
{% endif %}
|
||
<div class="form-text">設定低於此數量時會發出警告</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="alert alert-info">
|
||
<i class="bi bi-info-circle me-2"></i>
|
||
商品代碼將自動生成,格式為:P + 年月日 + 4位序號(例:P2311060001)
|
||
</div>
|
||
|
||
<div class="d-flex justify-content-end gap-2">
|
||
<a href="{{ url_for('product.list_products') }}" class="btn btn-light">
|
||
<i class="bi bi-x-lg me-1"></i>取消
|
||
</a>
|
||
<button type="submit" class="btn btn-primary">
|
||
<i class="bi bi-check-lg me-1"></i>建立商品
|
||
</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|