optimisation
This commit is contained in:
@@ -87,22 +87,34 @@
|
||||
</div>
|
||||
|
||||
@if (category()!.subcategories?.length) {
|
||||
<mat-list>
|
||||
<mat-accordion multi>
|
||||
@for (sub of category()!.subcategories; track sub.id) {
|
||||
<mat-list-item (click)="openSubcategory(sub.id)">
|
||||
<span matListItemTitle>{{ sub.name }}</span>
|
||||
<span matListItemLine>{{ 'PRIORITY' | translate }}: {{ sub.priority }}</span>
|
||||
<button mat-icon-button matListItemMeta>
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
</mat-list-item>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<mat-icon class="sub-icon">folder</mat-icon>
|
||||
{{ sub.name }}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
{{ 'PRIORITY' | translate }}: {{ sub.priority }}
|
||||
<button mat-icon-button (click)="openSubcategory(sub.id); $event.stopPropagation()" [matTooltip]="'EDIT' | translate">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<app-inline-items-list
|
||||
[subcategoryId]="sub.id"
|
||||
[projectId]="projectId()">
|
||||
</app-inline-items-list>
|
||||
</mat-expansion-panel>
|
||||
}
|
||||
</mat-list>
|
||||
</mat-accordion>
|
||||
} @else {
|
||||
<p class="empty-state">{{ 'NO_SUBCATEGORIES' | translate }}</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Translations section hidden until client provides requirements
|
||||
<div class="translations-section">
|
||||
<h3>{{ 'TRANSLATIONS' | translate }}</h3>
|
||||
<p class="hint">{{ 'TRANSLATIONS_HINT' | translate }}</p>
|
||||
@@ -111,6 +123,7 @@
|
||||
<input matInput [(ngModel)]="ruName" (blur)="saveRuName(ruName)" [placeholder]="'NAME_TRANSLATED' | translate">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -124,12 +124,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
mat-list-item {
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
mat-accordion {
|
||||
display: block;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f5f5;
|
||||
mat-expansion-panel {
|
||||
margin-bottom: 0.25rem;
|
||||
|
||||
.sub-icon {
|
||||
margin-right: 0.5rem;
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
mat-panel-description {
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
|
||||
button {
|
||||
margin-right: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { ApiService } from '../../services';
|
||||
import { ToastService } from '../../services/toast.service';
|
||||
@@ -18,6 +19,7 @@ import { Category } from '../../models';
|
||||
import { LoadingSkeletonComponent } from '../../components/loading-skeleton/loading-skeleton.component';
|
||||
import { CreateDialogComponent } from '../../components/create-dialog/create-dialog.component';
|
||||
import { ConfirmDialogComponent } from '../../components/confirm-dialog/confirm-dialog.component';
|
||||
import { InlineItemsListComponent } from '../../components/inline-items-list/inline-items-list.component';
|
||||
import { LanguageService } from '../../services/language.service';
|
||||
import { TranslatePipe } from '../../pipes/translate.pipe';
|
||||
|
||||
@@ -36,7 +38,9 @@ import { TranslatePipe } from '../../pipes/translate.pipe';
|
||||
MatListModule,
|
||||
MatDialogModule,
|
||||
MatTooltipModule,
|
||||
MatExpansionModule,
|
||||
LoadingSkeletonComponent,
|
||||
InlineItemsListComponent,
|
||||
TranslatePipe
|
||||
],
|
||||
templateUrl: './category-editor.component.html',
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Translations Tab -->
|
||||
<!-- Translations Tab - hidden until client provides requirements
|
||||
<mat-tab [label]="'TRANSLATIONS' | translate">
|
||||
<div class="tab-content">
|
||||
<div class="translations-section">
|
||||
@@ -444,6 +444,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
-->
|
||||
</mat-tab-group>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -113,6 +113,11 @@ export class ItemEditorComponent implements OnInit {
|
||||
this.loading.set(true);
|
||||
this.apiService.getItem(this.itemId()).subscribe({
|
||||
next: (item) => {
|
||||
if (!item) {
|
||||
this.toast.error(this.lang.t('ITEM_NOT_FOUND'));
|
||||
this.loading.set(false);
|
||||
return;
|
||||
}
|
||||
this.item.set(item);
|
||||
// Initialise Russian translation buffers
|
||||
const ru = item.translations?.['ru'];
|
||||
|
||||
@@ -99,19 +99,21 @@
|
||||
</div>
|
||||
|
||||
<div class="items-section">
|
||||
<h3>{{ 'VIEW_ITEMS' | translate }}</h3>
|
||||
@if (subcategory()!.subcategories?.length) {
|
||||
<p class="no-items-note">
|
||||
<mat-icon>account_tree</mat-icon>
|
||||
{{ 'SUBCATEGORIES' | translate }}
|
||||
</p>
|
||||
} @else {
|
||||
<button mat-raised-button color="primary" (click)="viewItems()">
|
||||
<mat-icon>{{ subcategory()!.hasItems ? 'list' : 'add' }}</mat-icon>
|
||||
{{ subcategory()!.hasItems ? (('VIEW_ITEMS' | translate) + ' (' + (subcategory()!.itemCount || 0) + ')') : ('ADD_SUBCATEGORY' | translate) }}
|
||||
</button>
|
||||
<app-inline-items-list
|
||||
[subcategoryId]="subcategoryId()"
|
||||
[projectId]="projectId()">
|
||||
</app-inline-items-list>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Translations section hidden until client provides requirements
|
||||
<div class="translations-section">
|
||||
<h3>{{ 'TRANSLATIONS' | translate }}</h3>
|
||||
<p class="hint">{{ 'TRANSLATIONS_HINT' | translate }}</p>
|
||||
@@ -120,6 +122,7 @@
|
||||
<input matInput [(ngModel)]="ruName" (blur)="saveRuName(ruName)" [placeholder]="'NAME_TRANSLATED' | translate">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -110,10 +110,10 @@
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
|
||||
button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
h3 {
|
||||
margin: 0 0 0.75rem 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.no-items-note {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { ToastService } from '../../services/toast.service';
|
||||
import { Subcategory } from '../../models';
|
||||
import { LoadingSkeletonComponent } from '../../components/loading-skeleton/loading-skeleton.component';
|
||||
import { ConfirmDialogComponent } from '../../components/confirm-dialog/confirm-dialog.component';
|
||||
import { InlineItemsListComponent } from '../../components/inline-items-list/inline-items-list.component';
|
||||
import { LanguageService } from '../../services/language.service';
|
||||
import { TranslatePipe } from '../../pipes/translate.pipe';
|
||||
|
||||
@@ -34,6 +35,7 @@ import { TranslatePipe } from '../../pipes/translate.pipe';
|
||||
MatDialogModule,
|
||||
MatTooltipModule,
|
||||
LoadingSkeletonComponent,
|
||||
InlineItemsListComponent,
|
||||
TranslatePipe
|
||||
],
|
||||
templateUrl: './subcategory-editor.component.html',
|
||||
|
||||
Reference in New Issue
Block a user