removed old components

This commit is contained in:
2026-01-13 22:48:09 -07:00
parent 7481cec0d5
commit 717956790f
14 changed files with 19 additions and 307 deletions
+8 -6
View File
@@ -70,14 +70,13 @@ func (s *accountSubrouter) createSyncGroupListingDraft(c *gin.Context) (response
ctx := r.Context()
acctID := middleware.GetIdentity(ctx).Account.AccountID
orderIndex, err := s.accts.CreateSyncGroupListingDraft(ctx, acctID)
if err != nil {
if _, err := s.accts.CreateSyncGroupListingDraft(ctx, acctID); err != nil {
return nil, response.Errorf("failed to create new listing draft: %w", err)
}
return response.Redirect(
http.StatusSeeOther,
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/listings/%d", acctID, orderIndex),
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/table", acctID),
), nil
}
@@ -113,7 +112,7 @@ func (s *accountSubrouter) setShopInSyncGroupListingDraft(c *gin.Context) (respo
return response.Redirect(
http.StatusSeeOther,
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/listings/%d", acctID, orderIndex),
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/table", acctID),
), nil
}
@@ -140,7 +139,7 @@ func (s *accountSubrouter) setListingInSyncGroupListingDraft(c *gin.Context) (re
return response.Redirect(
http.StatusSeeOther,
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/listings/%d", acctID, orderIndex),
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/table", acctID),
), nil
}
@@ -159,7 +158,10 @@ func (s *accountSubrouter) deleteSyncGroupListingDraft(c *gin.Context) (response
return nil, response.Errorf("failed to delete listing: %w", response.ErrorFromConstant(err))
}
return response.Status(200), nil
return response.Redirect(
http.StatusSeeOther,
fmt.Sprintf("/ui/accounts/%d/inventory/sync-groups/draft/table", acctID),
), nil
}
// POST /api/accounts/{acctID}/inventory/sync-groups
@@ -38,7 +38,7 @@
platform: event.target.value.replace(/-[^ ]*/, ""),
"shop-id": event.target.value.replace(/[^ ]*-/, "")
}'
hx-target="closest tr"
hx-target="#accounts-acct-id-inventory-sync-groups-draft-table"
hx-swap="outerHTML"
_="
on change
@@ -73,7 +73,7 @@
hx-vals='js:{
"listing-id": event.target.value,
}'
hx-target="closest tr"
hx-target="#accounts-acct-id-inventory-sync-groups-draft-table"
hx-swap="outerHTML"
_="
@@ -116,9 +116,9 @@
</td>
<td data-id="remove">
{{ componentBody "button-dev"
{{ componentBody "button"
"HXDelete" (printf "/api/accounts/%d/inventory/sync-groups/draft/listings/%d" $acctID $orderIndex)
"HXTarget" "closest tr"
"HXTarget" "#accounts-acct-id-inventory-sync-groups-draft-table"
"HXSwap" "outerHTML"
"Text" "Remove"
}}
@@ -14,7 +14,7 @@
{{- $stores := $dot.Accounts.GetShops $acctID -}}
<table id="inventory-table-2" class="max-w-full overflow-x-auto">
<table id="accounts-acct-id-inventory-sync-groups-draft-table" class="max-w-full overflow-x-auto">
<thead>
<tr>
<th>
@@ -1,46 +0,0 @@
{{- $dot := or .dot . }}
{{- $dot.Auth.ByMatchingAccountID 2 }}
{{- $acctID := $dot.Identity.Account.AccountID }}
{{- $stores := $dot.Accounts.GetShops $acctID -}}
<table id="inventory-table" class="max-w-full overflow-x-scroll">
<thead>
<tr>
{{- range $store := $stores }}
<th class="text-nowrap">
{{ $store.Platform }}: {{ $store.Name }}
</th>
<th class="text-nowrap">
Count
</th>
{{- end }}
<th>
</th>
</tr>
</thead>
<tbody>
{{- componentBody "accounts/{acctID}/inventory/sync-table/new-row" "dot" $dot }}
</tbody>
<tfoot>
<tr>
{{- range $store := $stores }}
<th class="text-nowrap">
{{ $store.Platform }}: {{ $store.Name }}
</th>
<th class="text-nowrap">
Count
</th>
{{- end }}
<th>
</th>
</tr>
</tfoot>
</table>
@@ -1,55 +0,0 @@
{{/* TODO: delete when done with the newer draft */}}
{{- $dot := or .dot .}}
{{- $dot.Auth.ByMatchingAccountID 2 }}
{{- $acctID := $dot.Identity.Account.AccountID }}
{{- $shops := $dot.Accounts.GetShops $acctID -}}
<tr>
{{- range $shop := $shops }}
<td>
<select
class="min-w-fit cursor-pointer"
_="
on change
set dataset to the dataset of the first of my selectedOptions
set listingShowcase to the <#listing-showcase/>
if <#listing-showcase/> then
send displayListing(
id: dataset.id,
name: dataset.name,
description: dataset.description,
count: dataset.count
) to listingShowcase
end
set the innerHTML of the next <td/> to the dataset.count
"
>
<option disabled selected>- Listings -</option>
{{/*- $listings := $dot.Accounts.GetListingsForShop $acctID $shop.ShopID }}
{{- range $listing := $listings }}
<option
value="{{$listing.ListingID}}"
data-id="{{$listing.ListingID}}"
data-name="{{$listing.Name}}"
data-description="{{$listing.Description}}"
data-count="{{$listing.Count}}"
>
{{ $listing.Name }}
</option>
{{- end */}}
</select>
</td>
<td>
</td>
{{- end }}
<td>
<button class="cursor-pointer underline w-full">
Save
</button>
</td>
</tr>
@@ -1,40 +0,0 @@
<table class="max-w-full"
id="listing-showcase"
_="
on displayListing(id, name, description, count)
set innerHTML of <#listing-showcase-id/> to id
set innerHTML of <#listing-showcase-name/> to name
set innerHTML of <#listing-showcase-description/> to description
set innerHTML of <#listing-showcase-count/> to count
"
>
<thead>
<th>
ID
</th>
<th>
Name
</th>
<th>
Description
</th>
<th>
Count
</th>
</thead>
<tbody>
<th id="listing-showcase-id">
-
</th>
<th id="listing-showcase-name">
-
</th>
<th id="listing-showcase-description">
-
</th>
<th id="listing-showcase-count">
-
</th>
</tbody>
</table>
@@ -1,70 +0,0 @@
{{/* TODO: delete, once not needed */}}
{{/* "dot" . */}}
<nav
style="
margin: 0;
padding: 1em;
background-color: #bdf;
font-size: 1.25em;
display: flex;
flex-direction: column;
align-items: center;
"
>
<ul>
<li>
<a href="/ui">
Home
</a>
</li>
{{/* */}}
{{- $userID := .dot.Identity.User.UserID }}
{{- $acct := .dot.Identity.Account }}
{{- $acctID := 0 }}
{{- if $acct }}
{{- $acctID = $acct.AccountID }}
{{- end }}
{{- if not $userID }}
<li>
<a href="/api/auth/login">
Log In / Sign Up
</a>
</li>
{{- else if $acctID }}
<li>
<a href="/ui/accounts/{{$acctID}}">
Account
</a>
</li>
<li>
<a href="/ui/accounts/{{$acctID}}/reports">
Reports
</a>
</li>
<li>
<a href="/ui/accounts/{{$acctID}}/inventory">
Inventory
</a>
</li>
<li>
<a href="/api/auth/logout">
Log Out
</a>
</li>
{{- end }}
</ul>
</nav>
@@ -1,14 +0,0 @@
{{- define "title" }} Inventory++ Create an Account {{ end }}
{{/* TODO: will need to verify the email address */}}
<section style="margin-top: 2em;">
<form method="post" action="/accounts">
<label>
Email:
<input type="email" required name="email" />
</label>
<input type="submit" value="Create Account" />
</form>
</section>
@@ -17,24 +17,24 @@
<h4>
(Draft 2)
</h4>
{{ componentBody "accounts/{acctID}/inventory/sync-table-v2" "dot" . }}
{{ componentBody "accounts/{acctID}/inventory/sync-groups/draft/table" "dot" . }}
<div>
{{ componentBody "button-dev"
{{ componentBody "button"
"HXPost" (printf "/api/accounts/%d/inventory/sync-groups/draft/listings" $acctID)
"HXTarget" "previous table > tbody"
"HXSwap" "beforeend"
"HXTarget" "#accounts-acct-id-inventory-sync-groups-draft-table"
"HXSwap" "outerHTML"
"Class" "mt-[1em] mb-[1em]"
"Text" "Add Listing"
"_" `
on click
send rowUpdated to the first <tbody/> in #inventory-table-2
send rowUpdated to the first <tbody/> in #accounts-acct-id-inventory-sync-groups-draft-table
`
}}
{{/* TODO: enable the button when all listings are filled and there are at least two listings */}}
{{/* TODO: save the listings as a sync group on click */}}
{{ componentBody "button-dev"
{{ componentBody "button"
"ID" "create-sync-group-button"
"HXPost" (printf "/api/accounts/%d/sync-groups" $acctID)
"Class" "mt-[1em] mb-[1em]"
@@ -51,24 +51,3 @@
}}
</div>
</section>
<section class="w-full flex flex-col items-center">
<h3>
Draft 1
</h3>
{{ componentBody "accounts/{acctID}/inventory/sync-table" "dot" . }}
</section>
<section class="flex justify-center mt-[1em]">
{{ componentBody "accounts/{acctID}/inventory/sync-table/showcase-table" "dot" . }}
</section>
<section class="w-full flex justify-center mt-[1em]">
{{ componentBody "button-dev"
"HXGet" (printf "/api/accounts/%d/inventory/sync-table/new-row" $acctID)
"HXTarget" "#inventory-table > tbody"
"HXSwap" "beforeend"
"Class" "mt-[1em] mb-[1em]"
"Text" "Add Row"
}}
</section>
-11
View File
@@ -1,11 +0,0 @@
{{- define "title" }} Inventory++ Invalid Link {{ end }}
<section>
Invalid Link: {{ .Request.URL.Path }}
</section>
<section>
<a href="/ui">Return Home</a>
</section>
-11
View File
@@ -1,11 +0,0 @@
{{/* TODO: delete this page, when certain it's not wanted anymore */}}
<h1>Log In</h1>
<form action="login" method="post">
<label>
Email:
<input type="text" required name="email" />
</label>
<input type="submit" value="login" />
</form>
-11
View File
@@ -1,11 +0,0 @@
{{- define "title" }} Inventory++ Page Not Found {{ end }}
<section>
Page Not Found: {{ .Request.URL.Path }}
</section>
<section>
<a href="/ui">Return Home</a>
</section>
-11
View File
@@ -1,11 +0,0 @@
{{/* TODO: not used - read for deletion */}}
<h1>Sign Up</h1>
<form action="accounts" method="post">
<label>
Email:
<input type="text" required name="email" />
</label>
<input type="submit" value="Submit" />
</form>