adding filters to my-listing (listingnumber), updated/new label

This commit is contained in:
2025-09-12 14:25:47 -05:00
parent d48cd7aa1d
commit 571cfb0e61
7 changed files with 187 additions and 17 deletions

View File

@@ -4,29 +4,85 @@
<!-- Desktop view -->
<div class="hidden md:block">
<table class="w-full bg-white drop-shadow-inner-faint rounded-lg overflow-hidden">
<table class="w-full table-fixed bg-white drop-shadow-inner-faint rounded-lg overflow-hidden">
<colgroup>
<col class="w-auto" />
<!-- Title: restliche Breite -->
<col class="w-40" />
<!-- Category -->
<col class="w-60" />
<!-- Located in -->
<col class="w-32" />
<!-- Price -->
<col class="w-28" />
<!-- Internal # -->
<col class="w-40" />
<!-- Publication Status -->
<col class="w-36" />
<!-- Actions -->
</colgroup>
<thead class="bg-gray-100">
<!-- Header -->
<tr>
<th class="py-2 px-4 text-left">Title</th>
<th class="py-2 px-4 text-left">Category</th>
<th class="py-2 px-4 text-left">Located in</th>
<th class="py-2 px-4 text-left">Price</th>
<th class="py-2 px-4 text-left">Internal #</th>
<th class="py-2 px-4 text-left">Publication Status</th>
<th class="py-2 px-4 text-left">Actions</th>
<th class="py-2 px-4 text-left whitespace-nowrap">Actions</th>
</tr>
<!-- Filter row (zwischen Header und Inhalt) -->
<tr class="bg-white border-b">
<th class="py-2 px-4">
<input type="text" class="w-full border rounded px-2 py-1" placeholder="Filter title…" [(ngModel)]="filters.title" (input)="applyFilters()" />
</th>
<!-- Category Filter -->
<th class="py-2 px-4">
<select class="w-full border rounded px-2 py-1" [(ngModel)]="filters.category" (change)="applyFilters()">
<option value="">All</option>
<option value="business">Business</option>
<option value="commercialProperty">Commercial Property</option>
</select>
</th>
<th class="py-2 px-4">
<input type="text" class="w-full border rounded px-2 py-1" placeholder="City/County/State…" [(ngModel)]="filters.location" (input)="applyFilters()" />
</th>
<th class="py-2 px-4">
<!-- Preis nicht gefiltert, daher leer -->
</th>
<th class="py-2 px-4">
<input type="text" class="w-full border rounded px-2 py-1" placeholder="Internal #" [(ngModel)]="filters.internalListingNumber" (input)="applyFilters()" />
</th>
<th class="py-2 px-4">
<select class="w-full border rounded px-2 py-1" [(ngModel)]="filters.status" (change)="applyFilters()">
<option value="">All</option>
<option value="published">Published</option>
<option value="draft">Draft</option>
</select>
</th>
<th class="py-2 px-4">
<button class="text-sm underline" (click)="clearFilters()">Clear</button>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let listing of myListings" class="border-b">
<td class="py-2 px-4">{{ listing.title }}</td>
<td class="py-2 px-4">{{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</td>
<td class="py-2 px-4">{{ listing.location.name ? listing.location.name : listing.location.county }}, {{ listing.location.state }}</td>
<td class="py-2 px-4">{{ listing.location?.name ? listing.location.name : listing.location?.county }}, {{ listing.location?.state }}</td>
<td class="py-2 px-4">${{ listing.price.toLocaleString() }}</td>
<td class="py-2 px-4 flex justify-center">
{{ listing.internalListingNumber ?? '—' }}
</td>
<td class="py-2 px-4">
<span class="{{ listing.draft ? 'bg-yellow-100 text-yellow-800' : 'bg-green-100 text-green-800' }} py-1 px-2 rounded-full text-xs font-medium">
{{ listing.draft ? 'Draft' : 'Published' }}
</span>
</td>
<td class="py-2 px-4">
<td class="py-2 px-4 whitespace-nowrap">
@if(listing.listingsCategory==='business'){
<button class="bg-green-500 text-white p-2 rounded-full mr-2" [routerLink]="['/editBusinessListing', listing.id]">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
@@ -57,11 +113,27 @@
<!-- Mobile view -->
<div class="md:hidden">
<!-- Mobile Filter -->
<div class="bg-white drop-shadow-inner-faint rounded-lg p-4 mb-4 border">
<div class="grid grid-cols-1 gap-3">
<input type="text" class="w-full border rounded px-3 py-2" placeholder="Filter title…" [(ngModel)]="filters.title" (input)="applyFilters()" />
<input type="text" class="w-full border rounded px-3 py-2" placeholder="City/County/State…" [(ngModel)]="filters.location" (input)="applyFilters()" />
<input type="text" class="w-full border rounded px-3 py-2" placeholder="Internal #" [(ngModel)]="filters.internalListingNumber" (input)="applyFilters()" />
<select class="w-full border rounded px-3 py-2" [(ngModel)]="filters.status" (change)="applyFilters()">
<option value="">All</option>
<option value="published">Published</option>
<option value="draft">Draft</option>
</select>
<button class="text-sm underline justify-self-start" (click)="clearFilters()">Clear</button>
</div>
</div>
<div *ngFor="let listing of myListings" class="bg-white drop-shadow-inner-faint rounded-lg p-4 mb-4">
<h2 class="text-xl font-semibold mb-2">{{ listing.title }}</h2>
<p class="text-gray-600 mb-2">Category: {{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</p>
<p class="text-gray-600 mb-2">Located in: {{ listing.location.name ? listing.location.name : listing.location.county }} - {{ listing.location.state }}</p>
<p class="text-gray-600 mb-2">Located in: {{ listing.location?.name ? listing.location.name : listing.location?.county }} - {{ listing.location?.state }}</p>
<p class="text-gray-600 mb-2">Price: ${{ listing.price.toLocaleString() }}</p>
<p class="text-gray-600 mb-2">Internal #: {{ listing.internalListingNumber ?? '—' }}</p>
<div class="flex items-center gap-2 mb-2">
<span class="text-gray-600">Publication Status:</span>
<span class="{{ listing.draft ? 'bg-yellow-100 text-yellow-800' : 'bg-green-100 text-green-800' }} py-1 px-2 rounded-full text-xs font-medium">
@@ -96,4 +168,5 @@
</div>
</div>
</div>
<app-confirmation></app-confirmation>