feat: add carpet

This commit is contained in:
2026-07-03 21:58:28 +03:30
parent d290ba86bb
commit 413fca68cc
20 changed files with 421 additions and 16 deletions
+49
View File
@@ -0,0 +1,49 @@
<!doctype html>
<html dir="rtl" lang="fa">
{{template "head" .}}
<body>
{{template "nav" .}}
<div class="wrap">
<h1>فرش‌ها</h1>
{{if .Saved}}<div class="saved">انجام شد ✓</div>{{end}}
<p style="color:#9aa;font-size:13px">
هر فرش به‌جای میزِ بازی استفاده می‌شود. تصویرِ هر فرش را به‌صورتِ jpg آپلود کنید
(با نامِ شناسه ذخیره می‌شود). شناسهٔ <code>classic</code> یعنی میزِ پیش‌فرضِ بدونِ تصویر.
</p>
<table>
<tr><th>شناسه</th><th>عنوان</th><th>قیمت (سکه)</th><th>VIP رایگان</th><th>ترتیب</th><th>پیش‌نمایش</th><th>تصویر</th><th></th></tr>
{{range .Carpets}}
<tr><form method="post" action="/admin/carpets/add">
<td>{{.id}}<input type="hidden" name="id" value="{{.id}}"></td>
<td><input name="title" value="{{.title}}"></td>
<td><input name="price_coins" value="{{.price_coins}}" style="width:80px"></td>
<td><input type="checkbox" name="vip" {{if .vip}}checked{{end}}></td>
<td><input name="sort" value="{{.sort}}" style="width:50px"></td>
<td><img src="/carpets/{{.id}}.jpg" alt="—" style="height:48px;border-radius:4px" onerror="this.style.display='none'"></td>
<td>
<form method="post" action="/admin/carpets/{{.id}}/upload" enctype="multipart/form-data" style="display:flex;gap:4px">
<input type="file" name="image" accept="image/*" required>
<button>آپلود</button>
</form>
</td>
<td>
<button>ذخیره</button>
<button formaction="/admin/carpets/delete" formnovalidate class="del">حذف</button>
</td>
</form></tr>
{{end}}
<tr class="addrow"><form method="post" action="/admin/carpets/add">
<td><input name="id" placeholder="شناسه" required></td>
<td><input name="title" placeholder="عنوان"></td>
<td><input name="price_coins" value="0" style="width:80px"></td>
<td><input type="checkbox" name="vip"></td>
<td><input name="sort" value="0" style="width:50px"></td>
<td colspan="2"></td>
<td><button>افزودن فرش</button></td>
</form></tr>
</table>
</div>
</body>
</html>
+5 -5
View File
@@ -50,12 +50,12 @@
<table>
<tr><th>متن / شکلک</th><th>ترتیب</th><th></th></tr>
{{range .messages}}
<tr><form method="post" action="/admin/chat/message/delete">
<td>{{.body}}</td>
<td>{{.sort}}</td>
<tr><form method="post" action="/admin/chat/message">
<td><input type="hidden" name="id" value="{{.id}}"><input name="body" value="{{.body}}" style="width:100%"></td>
<td><input name="sort" value="{{.sort}}" style="width:50px"></td>
<td>
<input type="hidden" name="id" value="{{.id}}">
<button class="del">حذف</button>
<button>ذخیره</button>
<button formaction="/admin/chat/message/delete" formnovalidate class="del">حذف</button>
</td>
</form></tr>
{{end}}
+1
View File
@@ -33,6 +33,7 @@
<nav>
<a href="/admin" class="{{if eq .Nav "dashboard"}}active{{end}}">داشبورد</a>
<a href="/admin/shop" class="{{if eq .Nav "shop"}}active{{end}}">فروشگاه</a>
<a href="/admin/carpets" class="{{if eq .Nav "carpets"}}active{{end}}">فرش‌ها</a>
<a href="/admin/chat" class="{{if eq .Nav "chat"}}active{{end}}">چت</a>
<a href="/admin/users" class="{{if eq .Nav "users"}}active{{end}}">کاربران</a>
</nav>