Add: Replace All option to text import UI
- Add replaceAll checkbox to ImportText view with warning - Pass replaceAll parameter to import service - Allows complete product catalog replacement via text import - Enhanced documentation for unit types and variant collections
This commit is contained in:
parent
86e30d7203
commit
4f591418df
@ -252,7 +252,7 @@ public class ProductsController : Controller
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> ImportText(string textContent, IFormFile? file)
|
public async Task<IActionResult> ImportText(string textContent, IFormFile? file, bool replaceAll = false)
|
||||||
{
|
{
|
||||||
string importText = textContent;
|
string importText = textContent;
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ public class ProductsController : Controller
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _importService.ImportFromHumanTextAsync(importText);
|
var result = await _importService.ImportFromHumanTextAsync(importText, replaceAll);
|
||||||
ViewData["ImportResult"] = result;
|
ViewData["ImportResult"] = result;
|
||||||
return View("ImportResult", result);
|
return View("ImportResult", result);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" name="replaceAll" id="replaceAll" class="form-check-input" value="true" />
|
||||||
|
<label for="replaceAll" class="form-check-label">
|
||||||
|
<strong class="text-danger">Replace All</strong> - Delete all existing products, variants, and categories before import
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-text text-danger">
|
||||||
|
<i class="fas fa-exclamation-triangle"></i> <strong>Warning:</strong> This will permanently delete ALL existing product data! This action cannot be undone.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="fas fa-upload"></i> Import Products
|
<i class="fas fa-upload"></i> Import Products
|
||||||
@ -121,11 +133,16 @@ stock: 50
|
|||||||
|
|
||||||
<p class="small mt-3"><strong>Weight Units:</strong></p>
|
<p class="small mt-3"><strong>Weight Units:</strong></p>
|
||||||
<ul class="small mb-0">
|
<ul class="small mb-0">
|
||||||
|
<li><code>Unit</code> - For individual items (tablets, etc.)</li>
|
||||||
<li><code>Grams</code> (default)</li>
|
<li><code>Grams</code> (default)</li>
|
||||||
<li><code>Kilograms</code></li>
|
<li><code>Kilograms</code></li>
|
||||||
<li><code>Pounds</code></li>
|
<li><code>Pounds</code></li>
|
||||||
<li><code>Ounces</code></li>
|
<li><code>Ounces</code></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p class="small mt-3"><strong>Variant Collections:</strong></p>
|
||||||
|
<p class="small">Add after product name to link to variant collection:</p>
|
||||||
|
<code class="small"># Product Name; Weights - Standard</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user