remove unused codes and update
This commit is contained in:
@@ -1 +0,0 @@
|
||||
export * from './pos-display';
|
||||
@@ -1,133 +0,0 @@
|
||||
# POS Display Component
|
||||
|
||||
A reusable component for displaying Point-of-Sale (POS) terminal information with configurable variants.
|
||||
|
||||
## Overview
|
||||
|
||||
The `PosDisplayComponent` displays POS entity information in a card-based layout with support for different visibility variants ('consumer', 'partner', 'full').
|
||||
|
||||
## Features
|
||||
|
||||
- **Variant Support**: Choose from 'consumer', 'partner', or 'full' display modes
|
||||
- **Conditional Field Visibility**: Fields are dynamically shown/hidden based on variant
|
||||
- **Edit Mode**: Toggle between view and edit modes
|
||||
- **Responsive Grid**: Displays up to 3 columns with gap-4 spacing
|
||||
- **More Actions**: Optional button for additional actions
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```typescript
|
||||
import { PosDisplayComponent, IPosEntity } from '@/app/components';
|
||||
|
||||
@Component({
|
||||
selector: 'app-my-component',
|
||||
template: `
|
||||
<app-pos-display
|
||||
variant="consumer"
|
||||
[pos]="posData"
|
||||
[editMode]="isEditing"
|
||||
(onMoreAction)="handleMoreAction()"
|
||||
(editModeChange)="editModeChange($event)"
|
||||
/>
|
||||
`,
|
||||
standalone: true,
|
||||
imports: [PosDisplayComponent],
|
||||
})
|
||||
export class MyComponent {
|
||||
posData = signal<IPosEntity>({
|
||||
id: '123',
|
||||
name: 'Terminal 1',
|
||||
pos_type: 'PSP',
|
||||
serial_number: 'SN123',
|
||||
model: 'Model X',
|
||||
status: 'active',
|
||||
complex: { id: 'c1', name: 'Complex 1' },
|
||||
device: { id: 'd1', name: 'Device A' },
|
||||
provider: { id: 'p1', name: 'Provider A' },
|
||||
});
|
||||
|
||||
isEditing = signal(false);
|
||||
|
||||
handleMoreAction(): void {
|
||||
console.log('More action clicked');
|
||||
}
|
||||
|
||||
editModeChange(editing: boolean): void {
|
||||
this.isEditing.set(editing);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Variants
|
||||
|
||||
### Consumer Variant
|
||||
Displays: name, pos_type, serial_number, device, model, provider (6 fields)
|
||||
|
||||
### Partner Variant
|
||||
Displays: name, pos_type, serial_number (3 fields)
|
||||
|
||||
### Full Variant
|
||||
Displays: name, pos_type, serial_number, device, model, provider (6 fields - same as consumer)
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Type | Default | Description |
|
||||
|-------|------|---------|-------------|
|
||||
| `variant` | 'consumer' \| 'partner' \| 'full' | 'full' | Display variant mode |
|
||||
| `pos` | Signal<IPosEntity \| undefined> | undefined | POS entity data |
|
||||
| `editMode` | Signal<boolean> | false | Edit mode state |
|
||||
| `cardTitle` | string | 'اطلاعات پایانه فروش' | Card header title |
|
||||
| `showMoreActions` | boolean | true | Show more actions button |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Output | Payload | Description |
|
||||
|--------|---------|-------------|
|
||||
| `editModeChange` | boolean | Emitted when edit mode toggled |
|
||||
| `onMoreAction` | void | Emitted when more actions button clicked |
|
||||
| `onSubmit` | void | Emitted on form submission |
|
||||
|
||||
## Model (IPosEntity)
|
||||
|
||||
```typescript
|
||||
interface IPosEntity {
|
||||
id: string;
|
||||
name: string;
|
||||
serial_number: string;
|
||||
model?: string;
|
||||
status: string;
|
||||
pos_type: string;
|
||||
complex: ISummary;
|
||||
device?: ISummary;
|
||||
provider?: ISummary;
|
||||
}
|
||||
```
|
||||
|
||||
## Integration in Existing Component
|
||||
|
||||
To replace the inline display in your POS single view:
|
||||
|
||||
```typescript
|
||||
// Before: Manual field rendering
|
||||
<app-key-value label="عنوان" [value]="pos()?.name" />
|
||||
<app-key-value label="نوع پایانه" [value]="pos()?.pos_type" />
|
||||
// ... more fields
|
||||
|
||||
// After: Use the component
|
||||
<app-pos-display
|
||||
variant="full"
|
||||
[pos]="pos"
|
||||
[editMode]="editMode"
|
||||
(onMoreAction)="toPosLanding()"
|
||||
/>
|
||||
```
|
||||
|
||||
## Files
|
||||
|
||||
- `pos-display.component.ts` - Component logic
|
||||
- `pos-display.component.html` - Template
|
||||
- `pos-display.component.scss` - Styles
|
||||
- `models/posEntity.model.ts` - TypeScript interfaces and types
|
||||
- `index.ts` - Barrel export
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models/posEntity.model';
|
||||
export * from './pos-display.component';
|
||||
@@ -1,27 +0,0 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export type PosVariant = 'consumer' | 'partner' | 'full';
|
||||
|
||||
export interface IPosEntity {
|
||||
id: string;
|
||||
name: string;
|
||||
serial_number: string;
|
||||
model?: string;
|
||||
status: string;
|
||||
pos_type: string;
|
||||
complex: ISummary;
|
||||
device?: ISummary;
|
||||
provider?: ISummary;
|
||||
}
|
||||
|
||||
export interface IPosDisplayConfig {
|
||||
variant: PosVariant;
|
||||
editable?: boolean;
|
||||
showMoreActions?: boolean;
|
||||
}
|
||||
|
||||
export const POS_VARIANT_FIELDS: Record<PosVariant, Array<keyof IPosEntity>> = {
|
||||
consumer: ['name', 'pos_type', 'serial_number', 'device', 'model', 'provider'],
|
||||
partner: ['name', 'pos_type', 'serial_number'],
|
||||
full: ['name', 'pos_type', 'serial_number', 'device', 'model', 'provider'],
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
<app-card-data [cardTitle]="cardTitle" [editable]="true" [editMode]="isEditing()" (editModeChange)="toggleEditMode()">
|
||||
<ng-template #moreActions>
|
||||
@if (showMoreActions) {
|
||||
<p-button type="button" variant="outlined" (onClick)="handleMoreAction()"> ورود به پایانه </p-button>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="listKeyValue">
|
||||
@for (field of visibleFields(); track field) {
|
||||
@if (isFieldVisible(field)) {
|
||||
<app-key-value [label]="fieldLabels[field]" [value]="getFieldValue(field)" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</app-card-data>
|
||||
@@ -1,78 +0,0 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, effect, EventEmitter, Input, Output, signal } from '@angular/core';
|
||||
import { Button } from 'primeng/button';
|
||||
import { IPosEntity, POS_VARIANT_FIELDS, PosVariant } from './models/posEntity.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pos-entity-display',
|
||||
standalone: true,
|
||||
imports: [CommonModule, AppCardComponent, Button, KeyValueComponent],
|
||||
templateUrl: './pos-display.component.html',
|
||||
})
|
||||
export class PosDisplayComponent {
|
||||
@Input() variant: PosVariant = 'full';
|
||||
@Input() pos = signal<IPosEntity | undefined>(undefined);
|
||||
@Input() editMode = signal<boolean>(false);
|
||||
@Input() cardTitle = 'اطلاعات پایانه فروش';
|
||||
@Input() showMoreActions = true;
|
||||
|
||||
@Output() editModeChange = new EventEmitter<boolean>();
|
||||
@Output() onMoreAction = new EventEmitter<void>();
|
||||
@Output() onSubmit = new EventEmitter<void>();
|
||||
|
||||
visibleFields = signal<Array<keyof IPosEntity>>([]);
|
||||
isEditing = signal<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
this.visibleFields.set(POS_VARIANT_FIELDS[this.variant] || POS_VARIANT_FIELDS.full);
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
this.isEditing.set(this.editMode());
|
||||
});
|
||||
}
|
||||
|
||||
get fieldLabels(): Record<string, string> {
|
||||
return {
|
||||
name: 'عنوان',
|
||||
pos_type: 'نوع پایانه',
|
||||
serial_number: 'شماره سریال',
|
||||
device: 'نوع دستگاه',
|
||||
model: 'مدل دستگاه',
|
||||
provider: 'ارایهدهنده',
|
||||
};
|
||||
}
|
||||
|
||||
isFieldVisible(field: keyof IPosEntity): boolean {
|
||||
return this.visibleFields().includes(field);
|
||||
}
|
||||
|
||||
getFieldValue(field: keyof IPosEntity): any {
|
||||
const posData = this.pos();
|
||||
if (!posData) return null;
|
||||
|
||||
if (field === 'device' && posData.device) {
|
||||
return posData.device.name;
|
||||
}
|
||||
if (field === 'provider' && posData.provider) {
|
||||
return posData.provider.name;
|
||||
}
|
||||
return posData[field];
|
||||
}
|
||||
|
||||
toggleEditMode(): void {
|
||||
const newMode = !this.isEditing();
|
||||
this.isEditing.set(newMode);
|
||||
this.editModeChange.emit(newMode);
|
||||
}
|
||||
|
||||
handleMoreAction(): void {
|
||||
this.onMoreAction.emit();
|
||||
}
|
||||
|
||||
handleSubmit(): void {
|
||||
this.onSubmit.emit();
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,11 @@ export interface INativeBridgeResult<T = unknown> {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface INativeBridgeDeviceInfo {
|
||||
deviceName: string;
|
||||
androidId: string;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class NativeBridgeService {
|
||||
private readonly toastService = inject(ToastService);
|
||||
@@ -108,6 +113,19 @@ export class NativeBridgeService {
|
||||
return this.invokePrint(request);
|
||||
}
|
||||
|
||||
async getDeviceInfo(): Promise<INativeBridgeResult<INativeBridgeDeviceInfo>> {
|
||||
if (!this.isEnabled()) {
|
||||
return { success: false, error: 'متاسفانه ارتباط با دستگاه برقرار نیست.' };
|
||||
}
|
||||
try {
|
||||
// @ts-ignore
|
||||
const deviceInfo = await window.NativeBridge.deviceInfo();
|
||||
return { success: true, data: JSON.parse(deviceInfo) };
|
||||
} catch (error) {
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
}
|
||||
|
||||
private invokePrint(payload: INativePrintRequest): INativeBridgeResult {
|
||||
if (!this.isEnabled() || !this.canPrint()) {
|
||||
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
[showRefresh]="false"
|
||||
>
|
||||
<ng-template #totalAmount let-item>
|
||||
aaa
|
||||
@if (!item.discount_amount) {
|
||||
<span [appPriceMask]="item.total_amount"></span>
|
||||
} @else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { PosInfoStore } from '@/domains/pos/store';
|
||||
import { CatalogTaxProviderStatusTagComponent } from '@/shared/catalog';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
@@ -9,9 +10,10 @@ import {
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { UikitEmptyStateComponent } from '@/uikit';
|
||||
import { getGoodUnitTypeProperties } from '@/utils';
|
||||
import { formatJalali, getGoodUnitTypeProperties } from '@/utils';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
@@ -54,22 +56,30 @@ export class ConsumerSaleInvoiceSharedComponent {
|
||||
@Output() onRefresh = new EventEmitter<void>();
|
||||
|
||||
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
|
||||
readonly posName = computed(() => {
|
||||
if (this.posInfoStore.entity()) {
|
||||
const { name, businessActivity, complex } = this.posInfoStore.entity()!;
|
||||
return `${name} (${businessActivity.name} - ${complex.name})`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
printInvoice = () => {
|
||||
if (this.nativeBridge.isEnabled() && this.invoice) {
|
||||
const result = this.nativeBridge.print({
|
||||
title: 'salam',
|
||||
if (this.invoice) {
|
||||
const printResult = this.nativeBridge.print({
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{
|
||||
label: 'مجموع قیمت',
|
||||
value: this.invoice?.total_amount,
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice?.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
});
|
||||
if (result.success) return;
|
||||
}
|
||||
|
||||
window.print();
|
||||
};
|
||||
|
||||
columns: IColumn[] = [
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<ng-template #topbarCenter>
|
||||
@if (posInfo()) {
|
||||
<div class="flex flex-col items-center justify-center gap-2">
|
||||
<a [routerLink]="homeRouteLink" class="flex flex-col items-center justify-center gap-2">
|
||||
<div class="w-8 h-8">
|
||||
<img
|
||||
[src]="posInfo()?.partner?.logo_url ?? placeholderLogo"
|
||||
@@ -13,14 +13,14 @@
|
||||
/>
|
||||
</div>
|
||||
<span class="text-base font-semibold">{{ posInfo()?.partner?.name }}</span>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #topbarEnd>
|
||||
<div class="">
|
||||
<p-menu #menu [model]="profileMenuItems" [popup]="true" />
|
||||
<p-button (click)="menu.toggle($event)" icon="pi pi-user" text outlined size="large" />
|
||||
<p-button (click)="menu.toggle($event)" icon="pi pi-user" outlined size="large" />
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
>
|
||||
@if (pullDistance() >= 0) {
|
||||
<div
|
||||
class="w-full flex justify-center items-center py-2 min-h-10 text-xs text-surface-500 overflow-hidden fixed top-0 inset-x-0 z-1000 translate-y--20px"
|
||||
class="w-full flex justify-center items-center py-2 min-h-10 text-xs text-surface-500 overflow-hidden fixed top-0 inset-x-0 z-1000 translate-y-[-20px]"
|
||||
[ngStyle]="{ height: pullDistance() + 'px' }"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { AuthService } from '@/core';
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { LayoutService } from '@/layout/service/layout.service';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -13,13 +11,15 @@ import {
|
||||
inject,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { RouterLinkWithHref, RouterOutlet } from '@angular/router';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { Button, ButtonDirective } from 'primeng/button';
|
||||
import { Card } from 'primeng/card';
|
||||
import { Menu } from 'primeng/menu';
|
||||
import { finalize } from 'rxjs';
|
||||
import images from 'src/assets/images';
|
||||
import { PosInfoStore, PosProfileStore } from '../store';
|
||||
import { DeviceInfoStore } from '../store/device.store';
|
||||
import { PosChooseCardsComponent } from './choose-pos.component';
|
||||
import { PosMainMenuSidebarComponent } from './mainMenuSidebar/main-menu-sidebar.component';
|
||||
|
||||
@@ -36,13 +36,14 @@ import { PosMainMenuSidebarComponent } from './mainMenuSidebar/main-menu-sidebar
|
||||
PosMainMenuSidebarComponent,
|
||||
Menu,
|
||||
CommonModule,
|
||||
RouterLinkWithHref,
|
||||
],
|
||||
})
|
||||
export class PosLayoutComponent implements AfterViewInit {
|
||||
constructor() {}
|
||||
|
||||
private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
private readonly toastService = inject(ToastService);
|
||||
// private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
// private readonly toastService = inject(ToastService);
|
||||
|
||||
@ViewChild('topbarStart', { static: true }) topbarStart!: TemplateRef<any>;
|
||||
@ViewChild('topbarCenter', { static: true }) topbarCenter!: TemplateRef<any>;
|
||||
@@ -50,6 +51,7 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
|
||||
private readonly posProfileStore = inject(PosProfileStore);
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
private readonly deviceInfoStore = inject(DeviceInfoStore);
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly layoutService = inject(LayoutService);
|
||||
|
||||
@@ -66,6 +68,8 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
readonly loading = computed(() => this.posProfileLoading());
|
||||
readonly error = computed(() => this.posProfileError());
|
||||
|
||||
readonly deviceInfo = computed(() => this.deviceInfoStore.entity());
|
||||
|
||||
logout = () => {
|
||||
this.authService.logout();
|
||||
};
|
||||
@@ -91,10 +95,21 @@ export class PosLayoutComponent implements AfterViewInit {
|
||||
pullDistance = signal(0);
|
||||
readonly pullThreshold = 80;
|
||||
|
||||
getData() {
|
||||
this.posProfileStore.getData().subscribe({
|
||||
homeRouteLink = '/pos';
|
||||
|
||||
async getData() {
|
||||
await this.layoutService.changeFullPageLoading(true);
|
||||
await this.deviceInfoStore.getData();
|
||||
await this.posProfileStore.getData().subscribe({
|
||||
next: () => {
|
||||
this.posInfoStore.getData().subscribe();
|
||||
this.posInfoStore
|
||||
.getData()
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.layoutService.changeFullPageLoading(false);
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,8 +37,11 @@ export class PosMainMenuSidebarComponent extends AbstractDialog {
|
||||
.then((res) => res.json())
|
||||
.then((data: { appData?: { appVersion?: string } }) => {
|
||||
this.appVersion = data?.appData?.appVersion || this.appVersion;
|
||||
console.log('appVersion:', data?.appData);
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch((err) => {
|
||||
console.log('err', err);
|
||||
});
|
||||
|
||||
this.swUpdate.versionUpdates
|
||||
.pipe(filter((event): event is VersionReadyEvent => event.type === 'VERSION_READY'))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface IDeviceProfileRawResponse {
|
||||
androidId: string;
|
||||
deviceName: string;
|
||||
}
|
||||
|
||||
export interface IDeviceProfileResponse extends IDeviceProfileRawResponse {}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './device.io';
|
||||
export * from './good.io';
|
||||
export * from './pos.io';
|
||||
export * from './profile.io';
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export class PosOrderCustomerDialogComponent extends AbstractDialog {
|
||||
|
||||
customerTypes = [
|
||||
{
|
||||
label: 'بدون اطلاعات (نوع دوم)',
|
||||
label: 'نوع دوم',
|
||||
value: 'UNKNOWN',
|
||||
},
|
||||
{
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="flex gap-2 justify-center">
|
||||
<button pButton type="button" outlined (click)="printInvoice()">چاپ</button>
|
||||
<button pButton type="button" outlined (click)="sendToTsp()">ارسال به سامانه مودیان</button>
|
||||
<button pButton type="button" outlined (click)="sendInvoice()">ارسال به سامانه مودیان</button>
|
||||
<button pButton type="button" outlined (click)="openOrderDetails()">جزئیات</button>
|
||||
</div>
|
||||
</shared-dialog>
|
||||
|
||||
+25
-10
@@ -1,10 +1,14 @@
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { PosInfoStore } from '@/domains/pos/store';
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { SharedDialogComponent } from '@/shared/components';
|
||||
import { Component, inject, Input, signal } from '@angular/core';
|
||||
import { formatJalali } from '@/utils';
|
||||
import { Component, computed, inject, Input, signal } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { finalize } from 'rxjs';
|
||||
import { posSaleInvoicesNamedRoutes } from '../../../saleInvoices/constants';
|
||||
import { PosSaleInvoicesService } from '../../../saleInvoices/services/main.service';
|
||||
import { IPosOrderResponse } from '../../models';
|
||||
|
||||
@@ -18,12 +22,24 @@ export class PosOrderSubmittedDialogComponent extends AbstractDialog {
|
||||
private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
private readonly service = inject(PosSaleInvoicesService);
|
||||
private readonly toastService = inject(ToastService);
|
||||
private readonly posInfoStore = inject(PosInfoStore);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
readonly posName = computed(() => {
|
||||
if (this.posInfoStore.entity()) {
|
||||
const { name, businessActivity, complex } = this.posInfoStore.entity()!;
|
||||
return `${name} (${businessActivity.name} - ${complex.name})`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
sendingLoading = signal(false);
|
||||
sended = signal(false);
|
||||
|
||||
openOrderDetails() {
|
||||
this.close();
|
||||
this.router.navigateByUrl(
|
||||
posSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(this.invoice.id),
|
||||
);
|
||||
}
|
||||
|
||||
sendInvoice() {
|
||||
@@ -39,15 +55,14 @@ export class PosOrderSubmittedDialogComponent extends AbstractDialog {
|
||||
|
||||
printInvoice() {
|
||||
const printResult = this.nativeBridgeService.print({
|
||||
title: 'رسید پرداخت',
|
||||
title: `فروشگاه ${this.posName()}`,
|
||||
items: [
|
||||
{ label: 'مبلغ کل', value: String(this.invoice.code) },
|
||||
// { label: 'نقدی', value: String(this.invoice.payment.cash || 0) },
|
||||
// { label: 'تهاتر', value: String(this.invoice.payment.set_off || 0) },
|
||||
// {
|
||||
// label: 'پایانه',
|
||||
// value: String((this.invoice.payment.terminals || []).reduce((acc, item) => acc + item, 0)),
|
||||
// },
|
||||
{
|
||||
label: 'شماره فاکتور',
|
||||
value: this.invoice.code,
|
||||
},
|
||||
{ label: 'تاریخ', value: formatJalali(this.invoice.invoice_date, 'YYYY/MM/DD') },
|
||||
{ label: 'مبلغ کل', value: this.invoice.total_amount },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ export class PosPaymentFormDialogComponent extends AbstractFormDialog<IPayment,
|
||||
(terminal) => terminal.value!,
|
||||
);
|
||||
|
||||
this.selectedPayByTerminalStep.set(terminalPayments.length);
|
||||
this.selectedPayByTerminalStep.set(terminalPayments.length || 1);
|
||||
|
||||
if (terminalPayments.length) {
|
||||
if (this.nativeBridgeService.isEnabled()) {
|
||||
|
||||
+15
-1
@@ -1,5 +1,7 @@
|
||||
import { IPosInfoRawResponse } from '@/domains/pos/models';
|
||||
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
||||
import { ICustomer } from './customer';
|
||||
import { IEnumTranslate } from '@/shared/models/enum_translate.type';
|
||||
import { ICustomer, IUnknownCustomer } from './customer';
|
||||
import { IPayment } from './payment';
|
||||
import { IPosOrderItem } from './types';
|
||||
|
||||
@@ -17,5 +19,17 @@ export interface IPosOrderRequest {
|
||||
export interface IPosOrderRawResponse {
|
||||
id: string;
|
||||
code: string;
|
||||
invoice_number: number;
|
||||
invoice_date: string;
|
||||
created_at: string;
|
||||
total_amount: string;
|
||||
customer: ICustomer;
|
||||
unknown_customer: IUnknownCustomer;
|
||||
status: IEnumTranslate;
|
||||
}
|
||||
export interface IPosOrderResponse extends IPosOrderRawResponse {}
|
||||
|
||||
export interface IPosInfoResponse extends IPosInfoRawResponse {}
|
||||
|
||||
export interface IPosHeldOrderRawResponse extends IPosOrderResponse {}
|
||||
export interface IPosHeldOrderResponse extends IPosHeldOrderRawResponse {}
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
<div class="grow min-h-[calc(100dvh-5.5rem)]">
|
||||
<pos-goods class="block h-full" />
|
||||
</div>
|
||||
<div class="md:shrink-0 h-full md:block hidden p-4 overflow-auto">
|
||||
<pos-order-section />
|
||||
</div>
|
||||
@if (!isMobile()) {
|
||||
<div class="md:shrink-0 h-full md:block hidden p-4 overflow-auto">
|
||||
<pos-order-section />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +41,9 @@
|
||||
[closable]="true"
|
||||
header="فاکتور"
|
||||
>
|
||||
<pos-order-section (onAddMoreGoods)="closeInvoiceBottomSheet()" (onSuccess)="onSuccessSubmit($event)" />
|
||||
@if (showInvoiceBottomSheet()) {
|
||||
<pos-order-section (onAddMoreGoods)="closeInvoiceBottomSheet()" (onSuccess)="onSuccessSubmit($event)" />
|
||||
}
|
||||
</shared-dialog>
|
||||
|
||||
@if (responseInvoice()) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
||||
import { Maybe } from '@/core';
|
||||
import { PosInfoStore } from '@/domains/pos/store/pos.store';
|
||||
import { AbstractIsMobileComponent } from '@/shared/abstractClasses/abstract-is-mobile';
|
||||
import { SharedDialogComponent } from '@/shared/components';
|
||||
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
@@ -27,7 +28,7 @@ import { PosLandingStore } from '../store/main.store';
|
||||
PosOrderSubmittedDialogComponent,
|
||||
],
|
||||
})
|
||||
export class PosLandingComponent {
|
||||
export class PosLandingComponent extends AbstractIsMobileComponent {
|
||||
private readonly infoStore = inject(PosInfoStore);
|
||||
private readonly landingStore = inject(PosLandingStore);
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './filter-drawer.component';
|
||||
export * from './list.component';
|
||||
export * from './sale-invoice-card.component';
|
||||
@@ -68,7 +68,14 @@ export class SaleInvoiceCardComponent {
|
||||
this.service
|
||||
.sendToTsp(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.sendingLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
.subscribe((res) => {
|
||||
if (res.status === 'FAILURE') {
|
||||
this.toastService.error({
|
||||
text: res.message || 'خطا در ارسال فاکتور رخ داده است.',
|
||||
});
|
||||
} else {
|
||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
}
|
||||
this.toastService.success({ text: 'ارسال فاکتور با موفقیت انجام شد.' });
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
@@ -89,8 +96,12 @@ export class SaleInvoiceCardComponent {
|
||||
this.service
|
||||
.retrySendToTsp(this.saleInvoice.id)
|
||||
.pipe(finalize(() => this.resendingLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
this.toastService.success({ text: 'ارسال مجدد فاکتور با موفقیت انجام شد.' });
|
||||
.subscribe((res) => {
|
||||
if (res.status === 'FAILURE') {
|
||||
this.toastService.error({ text: res.message || 'خطا در ارسال مجدد فاکتور رخ داده است.' });
|
||||
} else {
|
||||
this.toastService.success({ text: 'ارسال مجدد فاکتور با موفقیت انجام شد.' });
|
||||
}
|
||||
this.refreshRequested.emit();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export const POS_SALE_INVOICES_API_ROUTES = {
|
||||
send: (invoiceId: string) => `${baseUrl()}/${invoiceId}/send`,
|
||||
getInquiry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/inquiry`,
|
||||
revoke: (invoiceId: string) => `${baseUrl()}/${invoiceId}/revoke`,
|
||||
retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/retry`,
|
||||
retry: (invoiceId: string) => `${baseUrl()}/${invoiceId}/retry`,
|
||||
status: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/status`,
|
||||
attempts: (invoiceId: string) => `${baseUrl()}/${invoiceId}/fiscal/attempts`,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { NativeBridgeService } from '@/core/services';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { IDeviceProfileResponse } from '../models';
|
||||
|
||||
interface DeviceInfoState extends EntityState<IDeviceProfileResponse> {}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DeviceInfoStore extends EntityStore<IDeviceProfileResponse, DeviceInfoState> {
|
||||
private readonly nativeBridgeService = inject(NativeBridgeService);
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
|
||||
async getData() {
|
||||
this.patchState({ loading: true });
|
||||
if (this.nativeBridgeService.isEnabled()) {
|
||||
const deviceInfoRes = await this.nativeBridgeService.getDeviceInfo();
|
||||
if (deviceInfoRes.success && deviceInfoRes.data) {
|
||||
const deviceInfo = deviceInfoRes.data;
|
||||
this.setEntity({
|
||||
deviceName: deviceInfo.deviceName,
|
||||
androidId: deviceInfo.androidId,
|
||||
});
|
||||
} else {
|
||||
this.setError(
|
||||
new HttpErrorResponse({ error: deviceInfoRes.error || 'Failed to get device info' }),
|
||||
);
|
||||
}
|
||||
}
|
||||
this.patchState({ loading: true });
|
||||
}
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,32 @@
|
||||
<div class="layout-wrapper" [ngClass]="containerClass">
|
||||
<app-topbar
|
||||
[showMenu]="showMenu()"
|
||||
[startTemplate]="topBarStartAction"
|
||||
[centerTemplate]="topBarCenterAction"
|
||||
[endTemplate]="topBarEndAction || topBarMoreAction"
|
||||
/>
|
||||
@if (fullLoading) {
|
||||
<div class="flex justify-center align-items-center grow items-center">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
} @else {
|
||||
@if (showMenu()) {
|
||||
<app-sidebar></app-sidebar>
|
||||
}
|
||||
<div [class]="`layout-main-container ${!showMenu() ? 'hideMenu' : ''} grow ${isFullPage ? 'isFullPage' : ''}`">
|
||||
<div class="layout-main flex flex-col gap-4">
|
||||
@if (showBreadcrumb) {
|
||||
<app-breadcrumb class="rounded-md overflow-hidden shrink-0" />
|
||||
}
|
||||
<div [class]="`rounded-md flex flex-col grow`">
|
||||
<!-- style="container-type: size" -->
|
||||
<div class="h-full">
|
||||
@if (content) {
|
||||
<ng-container [ngTemplateOutlet]="content"></ng-container>
|
||||
} @else {
|
||||
<router-outlet></router-outlet>
|
||||
}
|
||||
</div>
|
||||
@if (!fullPageLoading()) {
|
||||
<app-topbar
|
||||
[showMenu]="showMenu()"
|
||||
[startTemplate]="topBarStartAction"
|
||||
[centerTemplate]="topBarCenterAction"
|
||||
[endTemplate]="topBarEndAction || topBarMoreAction"
|
||||
/>
|
||||
}
|
||||
@if (showMenu()) {
|
||||
<app-sidebar></app-sidebar>
|
||||
}
|
||||
<div [class]="`layout-main-container ${!showMenu() ? 'hideMenu' : ''} grow ${isFullPage ? 'isFullPage' : ''}`">
|
||||
<div class="layout-main flex flex-col gap-4">
|
||||
@if (showBreadcrumb) {
|
||||
<app-breadcrumb class="rounded-md overflow-hidden shrink-0" />
|
||||
}
|
||||
<div [class]="`rounded-md flex flex-col grow`">
|
||||
<!-- style="container-type: size" -->
|
||||
<div class="h-full">
|
||||
@if (content) {
|
||||
<ng-container [ngTemplateOutlet]="content"></ng-container>
|
||||
} @else {
|
||||
<router-outlet></router-outlet>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
}
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
<div class="layout-mask animate-fadein"></div>
|
||||
</div>
|
||||
|
||||
@@ -2,15 +2,7 @@ import { Maybe } from '@/core';
|
||||
import { AuthService, BreadcrumbService } from '@/core/services';
|
||||
import { BreadcrumbComponent } from '@/shared/components';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
ContentChild,
|
||||
inject,
|
||||
Input,
|
||||
Renderer2,
|
||||
TemplateRef,
|
||||
} from '@angular/core';
|
||||
import { Component, computed, ContentChild, inject, Renderer2, TemplateRef } from '@angular/core';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { ProgressSpinner } from 'primeng/progressspinner';
|
||||
import { filter, Subscription } from 'rxjs';
|
||||
@@ -38,8 +30,6 @@ export class AppLayout {
|
||||
|
||||
menuOutsideClickListener: any;
|
||||
|
||||
@Input() fullLoading: boolean = false;
|
||||
|
||||
@ContentChild('content', { static: true }) content?: TemplateRef<any> | null;
|
||||
// @ContentChild('topBarMoreAction', { static: true }) topBarMoreAction?: TemplateRef<any> | null;
|
||||
|
||||
@@ -75,6 +65,8 @@ export class AppLayout {
|
||||
});
|
||||
}
|
||||
|
||||
readonly fullPageLoading = computed(() => this.layoutService.layoutState().fullPageLoading);
|
||||
|
||||
isOutsideClicked(event: MouseEvent) {
|
||||
const sidebarEl = document.querySelector('.layout-sidebar');
|
||||
const topbarEl = document.querySelector('.layout-menu-button');
|
||||
|
||||
@@ -15,6 +15,7 @@ interface IPanelInfo {
|
||||
}
|
||||
|
||||
interface LayoutState {
|
||||
fullPageLoading?: boolean;
|
||||
staticMenuDesktopInactive?: boolean;
|
||||
overlayMenuActive?: boolean;
|
||||
configSidebarVisible?: boolean;
|
||||
@@ -42,6 +43,7 @@ export class LayoutService {
|
||||
};
|
||||
|
||||
_state: LayoutState = {
|
||||
fullPageLoading: false,
|
||||
staticMenuDesktopInactive: false,
|
||||
overlayMenuActive: false,
|
||||
configSidebarVisible: false,
|
||||
@@ -154,6 +156,13 @@ export class LayoutService {
|
||||
}));
|
||||
}
|
||||
|
||||
changeFullPageLoading(status: boolean) {
|
||||
this.layoutState.update((prev) => ({
|
||||
...prev,
|
||||
fullPageLoading: status,
|
||||
}));
|
||||
}
|
||||
|
||||
toggleDarkMode(config?: layoutConfig): void {
|
||||
const _config = config || this.layoutConfig();
|
||||
localStorage.setItem('isDarkTheme', JSON.stringify(_config.darkTheme));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="bg-white h-svh relative">
|
||||
<div class="absolute inset-0 opacity-30 blur-xs flex items-center justify-center">
|
||||
<img [src]="authVector" alt="background image" class="object-cover max-w-full max-h-full" />
|
||||
<img [src]="authVector" alt="background image" class="w-full bg-cover bg-no-repeat" />
|
||||
</div>
|
||||
<div class="flex justify-center items-center relative z-10 h-svh mx-auto bg-gray-800/80">
|
||||
<div
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
const baseUrl = '/api/v1/pos';
|
||||
|
||||
export const POS_API_ROUTES = {
|
||||
info: (posId: number) => `${baseUrl}/${posId}`,
|
||||
stock: (posId: number) => `${baseUrl}/${posId}/stock`,
|
||||
productCategories: (posId: number) => `${baseUrl}/${posId}/product-categories`,
|
||||
submitOrder: (posId: number) => `${baseUrl}/${posId}/orders/create`,
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './apiRoutes';
|
||||
export * from './routes';
|
||||
@@ -1,18 +0,0 @@
|
||||
import { NamedRoutes } from '@/core';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
export const dashboardNamedRoutes: NamedRoutes<any> = {
|
||||
POS: {
|
||||
path: '',
|
||||
loadComponent: () =>
|
||||
import('../../views/dashboard.component').then((m) => m.DashboardComponent),
|
||||
meta: {
|
||||
title: 'داشبورد',
|
||||
pagePath: () => ``,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export type TDashboardRouteNames = keyof typeof dashboardNamedRoutes;
|
||||
|
||||
export const DASHBOARD_ROUTES: Routes = Object.values(dashboardNamedRoutes);
|
||||
@@ -1,7 +0,0 @@
|
||||
<div class="">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<!-- <app-statistics-shared-top-alert-stocks class="block h-[300px]" />
|
||||
<app-statistics-shared-top-sales class="block h-[300px]" />
|
||||
<app-statistics-shared-top-supplier-debts class="block h-[300px]" /> -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,33 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import images from 'src/assets/images';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
templateUrl: './dashboard.component.html',
|
||||
imports: [
|
||||
// StatisticsSharedTopAlertStocksComponent,
|
||||
// StatisticsSharedTopSalesComponent,
|
||||
// StatisticsSharedTopSupplierDebtsComponent,
|
||||
],
|
||||
})
|
||||
export class DashboardComponent {
|
||||
placeholderLogo = images.placeholders.logo;
|
||||
|
||||
now = new Date();
|
||||
|
||||
// info = this.store.info;
|
||||
// infoLoading = this.store.getInfoLoading;
|
||||
|
||||
// getInfo() {
|
||||
// this.infoLoading.set(true);
|
||||
// this.service.getInfo(Number(this.posId)).subscribe({
|
||||
// next: (res) => {
|
||||
// this.info.set(res);
|
||||
// this.infoLoading.set(false);
|
||||
// },
|
||||
// error: () => {
|
||||
// this.infoLoading.set(false);
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<div class="flex items-center gap-2 justify-between">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-bold text-lg">سفارش #{{ heldOrder.orderNumber }}</span>
|
||||
<span class="text-sm text-muted-color">
|
||||
{{ heldOrder.orderItems.length }} کالا -
|
||||
<span [appPriceMask]="heldOrder.totalAmount"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
pButton
|
||||
size="small"
|
||||
type="button"
|
||||
label="بارگذاری"
|
||||
icon="pi pi-download"
|
||||
(click)="loadHeldOrder(heldOrder.id)"
|
||||
></button>
|
||||
<button
|
||||
pButton
|
||||
size="small"
|
||||
type="button"
|
||||
label="حذف"
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
(click)="cancelHeldOrder(heldOrder.id)"
|
||||
></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,57 +0,0 @@
|
||||
import { ToastService } from '@/core/services/toast.service';
|
||||
import { ConfirmationDialogService } from '@/shared/components/confirmationDialog/confirmation-dialog.service';
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { Component, EventEmitter, Input, Output, signal } from '@angular/core';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { IPosHeldOrderResponse } from '../../models';
|
||||
import { PosService } from '../../services/main.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-held-order-item',
|
||||
templateUrl: './held-order-item.component.html',
|
||||
imports: [PriceMaskDirective, ButtonDirective],
|
||||
})
|
||||
export class HeldOrderItemComponent {
|
||||
@Input() heldOrder!: IPosHeldOrderResponse;
|
||||
@Input() posId!: number;
|
||||
|
||||
@Output() onCancel = new EventEmitter<number>();
|
||||
@Output() onLoad = new EventEmitter<number>();
|
||||
|
||||
constructor(
|
||||
private readonly posService: PosService,
|
||||
private readonly confirmationService: ConfirmationDialogService,
|
||||
private readonly toastService: ToastService,
|
||||
) {}
|
||||
|
||||
actionLoading = signal<boolean>(false);
|
||||
|
||||
cancelHeldOrder(heldOrderId: number) {
|
||||
this.confirmationService.confirm({
|
||||
message: `آیا از لغو سفارش شمارهی #${this.heldOrder.orderNumber} اطمینان دارید؟`,
|
||||
header: 'لغو سفارش موقت',
|
||||
acceptLabel: 'بله',
|
||||
rejectLabel: 'خیر',
|
||||
accept: () => {
|
||||
this.actionLoading.set(true);
|
||||
this.posService.cancelOrder(this.posId, heldOrderId).subscribe({
|
||||
next: () => {
|
||||
this.onCancel.emit(heldOrderId);
|
||||
this.actionLoading.set(false);
|
||||
this.toastService.success({
|
||||
text: `سفارش شمارهی #${this.heldOrder.orderNumber} با موفقیت لغو شد.`,
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.actionLoading.set(false);
|
||||
},
|
||||
});
|
||||
},
|
||||
reject: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
loadHeldOrder(heldOrderId: number) {
|
||||
this.onLoad.emit(heldOrderId);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<div class="d-flex flex-col gap-4">
|
||||
<div class="flex items-center justify-between shrink-0">
|
||||
<div class="flex items-center gap-2 text-muted-color">
|
||||
<i class="pi pi-shopping-cart"></i>
|
||||
<span class="text-base font-bold">سفارشهای نگهداشته شده</span>
|
||||
</div>
|
||||
</div>
|
||||
@if (!heldOrders()?.length) {
|
||||
<div class="grow flex flex-col gap-5 justify-center items-center text-center text-muted-color">
|
||||
<span class="text-base text-muted-color pt-4">هیچ سفارش نگهداشته شدهای وجود ندارد.</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="flex flex-col gap-2 mt-3">
|
||||
@for (heldOrder of heldOrders(); track heldOrder.id) {
|
||||
<app-held-order-item [heldOrder]="heldOrder" [posId]="posId" (onCancel)="removeHeldOrder($event)" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -1,41 +0,0 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { Component, Input, signal } from '@angular/core';
|
||||
import { IPosHeldOrderResponse } from '../../models';
|
||||
import { PosService } from '../../services/main.service';
|
||||
import { HeldOrderItemComponent } from './held-order-item.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-held-orders',
|
||||
templateUrl: './held-orders.component.html',
|
||||
imports: [HeldOrderItemComponent],
|
||||
})
|
||||
export class HeldOrdersComponent {
|
||||
@Input() posId!: number;
|
||||
|
||||
constructor(private readonly posService: PosService) {}
|
||||
|
||||
heldOrders = signal<Maybe<IPosHeldOrderResponse[]>>(null);
|
||||
loading = signal<boolean>(false);
|
||||
|
||||
ngOnInit() {
|
||||
this.getHeldOrders();
|
||||
}
|
||||
|
||||
getHeldOrders() {
|
||||
this.loading.set(true);
|
||||
this.posService.getHeldOrders(this.posId).subscribe({
|
||||
next: (res) => {
|
||||
this.heldOrders.set(res.data);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: () => {
|
||||
this.loading.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
removeHeldOrder(orderId: number) {
|
||||
const currentOrders = this.heldOrders() || [];
|
||||
this.heldOrders.set(currentOrders.filter((order) => order.id !== orderId));
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<div class="bg-surface-card w-md shrink-0 h-full overflow-hidden rounded-xl p-4 pb-0 flex flex-col">
|
||||
<div class="shrink-0">
|
||||
<app-held-orders [posId]="posId" />
|
||||
</div>
|
||||
<hr />
|
||||
<div class="shrink-0 sticky top-0">
|
||||
<!-- <customers-select-field
|
||||
[canInsert]="true"
|
||||
[value]="selectedCustomer()"
|
||||
(valueChange)="updateCustomer($event)"
|
||||
[isFullDataOptionValue]="true"
|
||||
/> -->
|
||||
</div>
|
||||
<hr />
|
||||
<div class="grow overflow-auto flex flex-col">
|
||||
<div class="flex items-center justify-between shrink-0">
|
||||
<div class="flex items-center gap-2 text-muted-color">
|
||||
<i class="pi pi-shopping-cart"></i>
|
||||
<span class="text-base font-bold">سفارشها</span>
|
||||
</div>
|
||||
<button pButton type="button" icon="pi pi-trash" outlined size="small" (click)="clearOrderList()">
|
||||
پاک کردن سفارشها
|
||||
</button>
|
||||
</div>
|
||||
@if (!inOrderProducts().length) {
|
||||
<div class="grow flex flex-col gap-5 justify-center items-center text-center text-muted-color">
|
||||
<i class="pi pi-inbox text-6xl!"></i>
|
||||
<span class="text-lg text-muted-color">هیچ سفارشی ثبت نشده است.</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="flex flex-col gap-2 mt-3">
|
||||
@for (inOrderProduct of inOrderProducts(); track inOrderProduct.productId) {
|
||||
<div class="border border-surface-border rounded-xl p-2 shadow-sm">
|
||||
<div class="flex gap-3 items-stretch">
|
||||
<img [src]="placeholderImage" class="w-24 h-24 rounded-md bg-surface-100 object-cover shrink-0" />
|
||||
<div class="flex flex-col grow justify-between">
|
||||
<div class="flex items-center">
|
||||
<div class="flex flex-col grow">
|
||||
<span class="font-bold text-lg">{{ inOrderProduct.product.name }}</span>
|
||||
<span class="text-sm text-muted-color">{{ inOrderProduct.product.sku }}</span>
|
||||
</div>
|
||||
<button
|
||||
pButton
|
||||
type="button"
|
||||
icon="pi pi-trash"
|
||||
size="small"
|
||||
severity="danger"
|
||||
class="ms-auto"
|
||||
(click)="removeProductFromOrder(inOrderProduct.productId)"
|
||||
></button>
|
||||
</div>
|
||||
<div class="flex items-center gap-4 mt-auto">
|
||||
<p-inplace>
|
||||
<ng-template #display>
|
||||
<span class="font-bold text-lg shrink-0" [appPriceMask]="inOrderProduct.unitPrice"></span>
|
||||
</ng-template>
|
||||
<ng-template #content let-closeCallback="closeCallback">
|
||||
<p-input-number
|
||||
type="text"
|
||||
inputStyleClass="w-24"
|
||||
[min]="0"
|
||||
[(ngModel)]="inOrderProduct.unitPrice"
|
||||
(onBlur)="
|
||||
updateInOrderProductFee(inOrderProduct.productId, $event, inOrderProduct.unitPrice);
|
||||
closeCallback()
|
||||
"
|
||||
/>
|
||||
</ng-template>
|
||||
</p-inplace>
|
||||
<div class="ms-auto shrink-0">
|
||||
<app-uikit-counter
|
||||
[min]="1"
|
||||
[max]="inOrderProduct.maxQuantity"
|
||||
[value]="inOrderProduct.count"
|
||||
(valueChange)="updateInOrderProductQuantity(inOrderProduct.productId, $event)"
|
||||
></app-uikit-counter>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-col sticky bottom-0 py-2">
|
||||
<pos-order-price-info-card />
|
||||
<div class="grid grid-cols-2 sticky bottom-0 gap-2 pt-4">
|
||||
<button
|
||||
pButton
|
||||
type="button"
|
||||
label="ثبت موقت"
|
||||
severity="primary"
|
||||
icon="pi pi-check"
|
||||
class="w-full"
|
||||
(click)="submit()"
|
||||
></button>
|
||||
<button
|
||||
pButton
|
||||
type="button"
|
||||
label="ثبت و پرداخت"
|
||||
severity="primary"
|
||||
icon="pi pi-check"
|
||||
class="w-full"
|
||||
[attr.disabled]="true"
|
||||
(click)="submitAndPay()"
|
||||
></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,76 +0,0 @@
|
||||
// import { CustomersSelectComponent } from '@/modules/customers/components/select/select.component';
|
||||
// import { ICustomerResponse } from '@/modules/customers/models';
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { UikitCounterComponent } from '@/uikit';
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { InplaceModule } from 'primeng/inplace';
|
||||
import { InputNumber } from 'primeng/inputnumber';
|
||||
import images from 'src/assets/images';
|
||||
import { POSStore } from '../../store';
|
||||
import { HeldOrdersComponent } from './held-orders.component';
|
||||
import { POSOrderPriceInfoCardComponent } from './price-info-card.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-order-card',
|
||||
templateUrl: './order-card.component.html',
|
||||
imports: [
|
||||
// CustomersSelectComponent,
|
||||
ButtonDirective,
|
||||
PriceMaskDirective,
|
||||
UikitCounterComponent,
|
||||
POSOrderPriceInfoCardComponent,
|
||||
FormsModule,
|
||||
InplaceModule,
|
||||
InputNumber,
|
||||
HeldOrdersComponent,
|
||||
],
|
||||
})
|
||||
export class PosOrderCardComponent {
|
||||
private store = inject(POSStore);
|
||||
|
||||
constructor() {
|
||||
// this.selectedCustomer.set(this.store.selectedCustomer());
|
||||
}
|
||||
|
||||
posId = this.store.posId;
|
||||
|
||||
placeholderImage = images.placeholders.default;
|
||||
|
||||
inOrderProducts = computed(() => this.store.inOrderProducts());
|
||||
|
||||
// selectedCustomer = signal<Maybe<ICustomerResponse>>(null);
|
||||
|
||||
removeProductFromOrder(productId: number) {
|
||||
this.store.removeFromInOrderProducts(productId);
|
||||
}
|
||||
|
||||
updateInOrderProductQuantity(productId: number, quantity: number) {
|
||||
this.store.updateInOrderProductQuantity(productId, quantity);
|
||||
}
|
||||
|
||||
updateInOrderProductFee(productId: number, $event: Event, prevFee: number) {
|
||||
const unitPrice = $event.target
|
||||
? parseFloat(($event.target as HTMLInputElement).ariaValueNow || prevFee.toString())
|
||||
: prevFee;
|
||||
|
||||
this.store.updateInOrderProductFee(productId, unitPrice);
|
||||
}
|
||||
|
||||
clearOrderList() {
|
||||
this.store.resetInOrderProducts();
|
||||
}
|
||||
|
||||
// updateCustomer(customer: Maybe<ICustomerResponse>) {
|
||||
// this.store.setSelectedCustomer(customer);
|
||||
// }
|
||||
|
||||
submit() {
|
||||
this.store.submitOrder();
|
||||
}
|
||||
|
||||
submitAndPay() {
|
||||
this.store.submitOrder();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<p-card class="border border-surface-border">
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="flex justify-between items-center">
|
||||
<span>جمع قیمت</span>
|
||||
@if (priceInfo().totalAmount == priceInfo().totalBaseAmount) {
|
||||
<span [appPriceMask]="priceInfo().totalAmount"></span>
|
||||
} @else {
|
||||
<div class="flex flex-col items-end">
|
||||
<span class="line-through text-muted-color text-xs" [appPriceMask]="priceInfo().totalBaseAmount"></span>
|
||||
<span [appPriceMask]="priceInfo().totalAmount"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="flex justify-between items-center">
|
||||
<span>ارزش افزوده</span>
|
||||
<span [appPriceMask]="priceInfo().taxAmount"></span>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="flex justify-between items-center font-bold text-lg">
|
||||
<span>مجموع کل</span>
|
||||
<span [appPriceMask]="priceInfo().payableAmount"></span>
|
||||
</div>
|
||||
</div>
|
||||
</p-card>
|
||||
@@ -1,15 +0,0 @@
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { Component, computed } from '@angular/core';
|
||||
import { Card } from 'primeng/card';
|
||||
import { POSStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-order-price-info-card',
|
||||
templateUrl: './price-info-card.component.html',
|
||||
imports: [Card, PriceMaskDirective],
|
||||
})
|
||||
export class POSOrderPriceInfoCardComponent {
|
||||
constructor(private store: POSStore) {}
|
||||
|
||||
priceInfo = computed(() => this.store.orderPricingInfo());
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<div class="flex gap-3 overflow-auto">
|
||||
@if (loading()) {
|
||||
@for (i of [1, 2, 3, 4, 5]; track i) {
|
||||
<p-skeleton width="6rem" height="2.5rem" />
|
||||
}
|
||||
} @else {
|
||||
@for (category of categories(); track category.id) {
|
||||
<div
|
||||
[class]="
|
||||
'h-10 rounded-lg px-3 flex items-center gap-3 border border-surface-border cursor-pointer bg-surface-100 hover:bg-surface-200 transition-all shrink-0' +
|
||||
(selectedCategory() === category.id ? ' bg-surface-card' : '')
|
||||
"
|
||||
(click)="changeSelectedCategory(category)"
|
||||
>
|
||||
<span class="text-sm text-muted-color font-bold"> {{ category.name }}</span>
|
||||
<div
|
||||
[class]="
|
||||
'flex items-center justify-center py-0.5 px-2 rounded-sm bg-surface-300 text-xs text-muted-color' +
|
||||
(selectedCategory() === category.id ? ' bg-amber-400! text-white' : '')
|
||||
"
|
||||
>
|
||||
<span>
|
||||
{{ category.productCount }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Component, EventEmitter, inject, Output } from '@angular/core';
|
||||
import { Skeleton } from 'primeng/skeleton';
|
||||
import { POSStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-product-categories',
|
||||
templateUrl: './categories.component.html',
|
||||
imports: [Skeleton],
|
||||
})
|
||||
export class PosProductCategoriesComponent {
|
||||
@Output() categoryChange = new EventEmitter<number>();
|
||||
|
||||
private readonly store = inject(POSStore);
|
||||
|
||||
categories = this.store.productCategories;
|
||||
loading = this.store.getProductCategoriesLoading;
|
||||
|
||||
selectedCategory = this.store.activeProductCategory;
|
||||
|
||||
changeSelectedCategory(category: { id: number; name: string }) {
|
||||
this.store.changeActiveCategory(category.id);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<div class="grid 2xl:grid-cols-8 xl:grid-cols-6 lg:grid-cols-4 grid-cols-2 gap-3 flex-wrap">
|
||||
@if (loading()) {
|
||||
@for (_ of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]; track $index) {
|
||||
<div class="flex-1 aspect-[0.9]">
|
||||
<p-skeleton width="100%" height="100%"></p-skeleton>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
@for (product of products(); track product.id) {
|
||||
<div class="flex-1 bg-surface-card rounded-lg p-1 shadow-xs">
|
||||
<img [src]="productPlaceholder" class="w-full aspect-[1.3] object-cover rounded-md" />
|
||||
<div class="mt-2">
|
||||
<span class="text-lg font-bold">
|
||||
{{ product.product.name }}
|
||||
<small class="text-xs text-muted-color">({{ product.quantity }})</small>
|
||||
</span>
|
||||
<div class="flex items-center justify-between mt-1">
|
||||
<span [appPriceMask]="product.product.salePrice" class="text-base font-bold"></span>
|
||||
<button pButton type="button" icon="pi pi-plus" size="small" (click)="addProduct(product.product)"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { Component, computed } from '@angular/core';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Skeleton } from 'primeng/skeleton';
|
||||
import images from 'src/assets/images';
|
||||
import { IPosProductSummary } from '../../models/types';
|
||||
import { POSStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-products-grid-view',
|
||||
templateUrl: './grid-view.component.html',
|
||||
imports: [PriceMaskDirective, ButtonDirective, Skeleton],
|
||||
})
|
||||
export class PosProductsGridViewComponent {
|
||||
constructor(private store: POSStore) {}
|
||||
|
||||
products = computed(() => this.store.activatedCategoryProducts());
|
||||
loading = computed(() => this.store.getStockLoading());
|
||||
|
||||
productPlaceholder = images.placeholders.default;
|
||||
|
||||
addProduct(product: IPosProductSummary) {
|
||||
this.store.addToInOrderProducts(product.id);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<div class="flex flex-col gap-3 flex-wrap">
|
||||
@if (loading()) {
|
||||
@for (_ of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]; track $index) {
|
||||
<div class="w-100 h-12">
|
||||
<p-skeleton width="100%" height="100%"></p-skeleton>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
@for (product of products(); track product.id) {
|
||||
<div class="flex items-center bg-surface-card rounded-lg p-1 shadow-xs gap-2">
|
||||
<div class="grow flex items-center gap-2">
|
||||
<img [src]="productPlaceholder" class="w-12 h-12 object-cover rounded-md" />
|
||||
<div class="flex flex-col gap-2">
|
||||
<span class="text-lg font-bold">
|
||||
{{ product.product.name }}
|
||||
<small class="text-xs text-muted-color">({{ product.quantity }})</small>
|
||||
</span>
|
||||
<span class="text-sm text-muted-color">
|
||||
{{ product.product.sku }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shrink-0 flex items-center justify-between gap-3">
|
||||
<span [appPriceMask]="product.product.salePrice" class="text-base font-bold"></span>
|
||||
<button pButton type="button" icon="pi pi-plus" size="small" (click)="addProduct(product.product)"></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -1,25 +0,0 @@
|
||||
import { PriceMaskDirective } from '@/shared/directives';
|
||||
import { Component, computed } from '@angular/core';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Skeleton } from 'primeng/skeleton';
|
||||
import images from 'src/assets/images';
|
||||
import { IPosProductSummary } from '../../models/types';
|
||||
import { POSStore } from '../../store';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-products-list-view',
|
||||
templateUrl: './list-view.component.html',
|
||||
imports: [PriceMaskDirective, ButtonDirective, Skeleton],
|
||||
})
|
||||
export class PosProductsListViewComponent {
|
||||
constructor(private store: POSStore) {}
|
||||
|
||||
products = computed(() => this.store.activatedCategoryProducts());
|
||||
loading = computed(() => this.store.getStockLoading());
|
||||
|
||||
productPlaceholder = images.placeholders.default;
|
||||
|
||||
addProduct(product: IPosProductSummary) {
|
||||
this.store.addToInOrderProducts(product.id);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-2 text-muted-color">
|
||||
<i class="pi pi-list"></i>
|
||||
<span class="text-base font-bold">لیست کالاها</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<app-search-input (search)="onSearch($event)"></app-search-input>
|
||||
|
||||
<div class="card p-2! flex justify-center">
|
||||
<p-selectbutton [options]="viewOptions" [(ngModel)]="viewType" optionValue="value">
|
||||
<ng-template #item let-item>
|
||||
<i [class]="item.icon"></i>
|
||||
</ng-template>
|
||||
</p-selectbutton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<pos-product-categories (categoryChange)="onCategoryChange($event)" />
|
||||
|
||||
@if (viewType === "grid") {
|
||||
<pos-products-grid-view />
|
||||
} @else {
|
||||
<pos-products-list-view />
|
||||
}
|
||||
</div>
|
||||
@@ -1,55 +0,0 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { SearchInputComponent } from '@/shared/components/search/search-input.component';
|
||||
import { Component, computed, inject, Input, signal } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SelectButton } from 'primeng/selectbutton';
|
||||
import { POSStore, TViewType } from '../../store';
|
||||
import { PosProductCategoriesComponent } from './categories.component';
|
||||
import { PosProductsGridViewComponent } from './grid-view.component';
|
||||
import { PosProductsListViewComponent } from './list-view.component';
|
||||
|
||||
@Component({
|
||||
selector: 'pos-products',
|
||||
templateUrl: './products.component.html',
|
||||
imports: [
|
||||
PosProductCategoriesComponent,
|
||||
PosProductsListViewComponent,
|
||||
SelectButton,
|
||||
FormsModule,
|
||||
PosProductsGridViewComponent,
|
||||
SearchInputComponent,
|
||||
],
|
||||
})
|
||||
export class PosProductsComponent {
|
||||
@Input() activeCategory = signal<Maybe<number>>(null);
|
||||
|
||||
private readonly store = inject(POSStore);
|
||||
|
||||
constructor() {
|
||||
this.store.initial();
|
||||
}
|
||||
|
||||
viewOptions = [
|
||||
{ value: 'list', icon: 'pi pi-list' },
|
||||
{ value: 'grid', icon: 'pi pi-th-large' },
|
||||
];
|
||||
|
||||
readonly activatedCategoryProducts = computed(() => this.store.activatedCategoryProducts());
|
||||
readonly stock = computed(() => this.store.stock());
|
||||
|
||||
get viewType() {
|
||||
return this.store.viewType();
|
||||
}
|
||||
set viewType(val: TViewType) {
|
||||
this.store.updateViewType(val);
|
||||
}
|
||||
|
||||
onSearch(searchTerm: string) {
|
||||
this.store.updateSearchQuery(searchTerm);
|
||||
this.store.getStock();
|
||||
}
|
||||
|
||||
onCategoryChange(categoryId: number) {
|
||||
this.store.changeActiveCategory(categoryId);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
const baseUrl = '/api/v1/pos';
|
||||
|
||||
export const POS_API_ROUTES = {
|
||||
info: (posId: number) => `${baseUrl}/${posId}`,
|
||||
stock: (posId: number) => `${baseUrl}/${posId}/stock`,
|
||||
productCategories: (posId: number) => `${baseUrl}/${posId}/product-categories`,
|
||||
submitOrder: (posId: number) => `${baseUrl}/${posId}/orders`,
|
||||
heldOrders: (posId: number) => `${baseUrl}/${posId}/orders/held`,
|
||||
order: (posId: number, orderId: number) => `${baseUrl}/${posId}/orders/${orderId}`,
|
||||
cancelOrder: (posId: number, orderId: number) => `${baseUrl}/${posId}/orders/${orderId}/cancel`,
|
||||
rejectOrder: (posId: number, orderId: number) => `${baseUrl}/${posId}/orders/${orderId}/reject`,
|
||||
confirmOrder: (posId: number, orderId: number) => `${baseUrl}/${posId}/orders/${orderId}/confirm`,
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './apiRoutes';
|
||||
export * from './routes';
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NamedRoutes } from '@/core';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
export type TPOSRouteNames = 'POS';
|
||||
|
||||
export const posNamedRoutes: NamedRoutes<TPOSRouteNames> = {
|
||||
POS: {
|
||||
path: 'pos/:posId',
|
||||
loadComponent: () => import('../../views/pos.component').then((m) => m.POSComponent),
|
||||
meta: {
|
||||
title: 'نقاط فروش',
|
||||
pagePath: (params) => `/pos/${params.posId}`,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const POS_ROUTES: Routes = Object.values(posNamedRoutes);
|
||||
@@ -1,5 +1,4 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
import { IBankAccountSummary, IPosOrderItem, IPosProductSummary } from './types';
|
||||
|
||||
export interface IPosInfoRawResponse {
|
||||
id: number;
|
||||
@@ -12,7 +11,6 @@ export interface IPosInfoRawResponse {
|
||||
updatedAt: string;
|
||||
deletedAt: null;
|
||||
inventory: ISummary;
|
||||
bankAccount: IBankAccountSummary;
|
||||
}
|
||||
|
||||
export interface IPosInfoResponse extends IPosInfoRawResponse {}
|
||||
@@ -20,7 +18,6 @@ export interface IPosInfoResponse extends IPosInfoRawResponse {}
|
||||
export interface IPosStockRawResponse {
|
||||
id: number;
|
||||
quantity: number;
|
||||
product: IPosProductSummary;
|
||||
}
|
||||
export interface IPosStockResponse extends IPosStockRawResponse {}
|
||||
|
||||
@@ -34,7 +31,6 @@ export interface IPosProductCategoriesResponse extends IPosProductCategoriesRawR
|
||||
|
||||
export interface IPosOrderRequest {
|
||||
customerId?: number;
|
||||
items: IPosOrderItem[];
|
||||
}
|
||||
|
||||
export interface IPosOrderRawResponse {
|
||||
@@ -53,7 +49,6 @@ export interface IPosOrderRawResponse {
|
||||
lastName: string;
|
||||
};
|
||||
orderItems: {
|
||||
product: IPosProductSummary;
|
||||
count: number;
|
||||
unitPrice: number;
|
||||
totalPrice: number;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
|
||||
export interface IPosProductSummary {
|
||||
id: number;
|
||||
name: string;
|
||||
sku: string;
|
||||
salePrice: string;
|
||||
categoryId: number;
|
||||
}
|
||||
|
||||
interface ICategorySummary {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IPosOrderItem {
|
||||
productId: number;
|
||||
count: number;
|
||||
unitPrice: number;
|
||||
}
|
||||
|
||||
export interface IPosInOrderProduct extends IPosOrderItem {
|
||||
product: IPosProductSummary;
|
||||
maxQuantity: number;
|
||||
}
|
||||
|
||||
export interface IBankAccountSummary {
|
||||
id: number;
|
||||
name: string;
|
||||
accountNumber: string;
|
||||
branch: IBankAccountBranchSummary;
|
||||
}
|
||||
|
||||
interface IBankAccountBranchSummary extends ISummary {
|
||||
bank: ISummary;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
import { IPaginatedResponse } from '@/core/models/service.model';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { POS_API_ROUTES } from '../constants';
|
||||
import {
|
||||
IPosInfoRawResponse,
|
||||
IPosInfoResponse,
|
||||
IPosOrderRequest,
|
||||
IPosProductCategoriesRawResponse,
|
||||
IPosProductCategoriesResponse,
|
||||
IPosStockRawResponse,
|
||||
IPosStockResponse,
|
||||
} from '../models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PosService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
private apiRoutes = POS_API_ROUTES;
|
||||
|
||||
getInfo(posId: number): Observable<IPosInfoResponse> {
|
||||
return this.http.get<IPosInfoRawResponse>(this.apiRoutes.info(posId));
|
||||
}
|
||||
|
||||
getStock(
|
||||
posId: number,
|
||||
searchQuery: string = '',
|
||||
): Observable<IPaginatedResponse<IPosStockResponse>> {
|
||||
return this.http.get<IPaginatedResponse<IPosStockRawResponse>>(this.apiRoutes.stock(posId), {
|
||||
params: {
|
||||
q: searchQuery,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getCategories(posId: number): Observable<IPaginatedResponse<IPosProductCategoriesResponse>> {
|
||||
return this.http.get<IPaginatedResponse<IPosProductCategoriesRawResponse>>(
|
||||
this.apiRoutes.productCategories(posId),
|
||||
);
|
||||
}
|
||||
|
||||
submitOrder(posId: number, payload: IPosOrderRequest): Observable<any> {
|
||||
return this.http.post<any>(this.apiRoutes.submitOrder(posId), payload);
|
||||
}
|
||||
|
||||
getHeldOrders(posId: number): Observable<IPaginatedResponse<any>> {
|
||||
return this.http.get<IPaginatedResponse<any>>(this.apiRoutes.heldOrders(posId));
|
||||
}
|
||||
|
||||
getOrder(posId: number, orderId: number): Observable<any> {
|
||||
return this.http.get<any>(this.apiRoutes.order(posId, orderId));
|
||||
}
|
||||
|
||||
cancelOrder(posId: number, orderId: number): Observable<any> {
|
||||
return this.http.post<any>(this.apiRoutes.cancelOrder(posId, orderId), {});
|
||||
}
|
||||
|
||||
rejectOrder(posId: number, orderId: number): Observable<any> {
|
||||
return this.http.post<any>(this.apiRoutes.rejectOrder(posId, orderId), {});
|
||||
}
|
||||
|
||||
confirmOrder(posId: number, orderId: number): Observable<any> {
|
||||
return this.http.post<any>(this.apiRoutes.confirmOrder(posId, orderId), {});
|
||||
}
|
||||
}
|
||||
@@ -1,272 +0,0 @@
|
||||
import { Maybe } from '@/core';
|
||||
// import { ICustomerResponse } from '@/modules/customers/models';
|
||||
import { computed, Inject, Injectable, InjectionToken, signal } from '@angular/core';
|
||||
import { map, of } from 'rxjs';
|
||||
import { IPosInfoResponse, IPosProductCategoriesResponse, IPosStockResponse } from '../models';
|
||||
import { IPosInOrderProduct } from '../models/types';
|
||||
import { PosService } from '../services/main.service';
|
||||
|
||||
export const POS_ID = new InjectionToken<number>('POS_ID');
|
||||
|
||||
export type TViewType = 'list' | 'grid';
|
||||
|
||||
interface IPosState {
|
||||
getStockLoading: boolean;
|
||||
stock: Maybe<IPosStockResponse[]>;
|
||||
getInfoLoading: boolean;
|
||||
info: Maybe<IPosInfoResponse>;
|
||||
getProductCategoriesLoading: boolean;
|
||||
productCategories: Maybe<IPosProductCategoriesResponse[]>;
|
||||
activeProductCategory: Maybe<number>;
|
||||
inOrderProducts: IPosInOrderProduct[];
|
||||
selectedCustomer: Maybe<any>;
|
||||
viewType: TViewType;
|
||||
searchQuery: string;
|
||||
}
|
||||
|
||||
export const INITIAL_POS_STATE: IPosState = {
|
||||
getStockLoading: true,
|
||||
stock: null,
|
||||
getInfoLoading: true,
|
||||
info: null,
|
||||
getProductCategoriesLoading: true,
|
||||
productCategories: null,
|
||||
activeProductCategory: null,
|
||||
inOrderProducts: [],
|
||||
selectedCustomer: null,
|
||||
viewType: 'grid',
|
||||
searchQuery: '',
|
||||
};
|
||||
|
||||
@Injectable({ providedIn: 'any' })
|
||||
export class POSStore {
|
||||
constructor(
|
||||
@Inject(POS_ID) posId: number,
|
||||
private service: PosService,
|
||||
) {
|
||||
this.posId = posId;
|
||||
this.initial();
|
||||
}
|
||||
|
||||
private state$ = signal<IPosState>({ ...INITIAL_POS_STATE });
|
||||
|
||||
readonly stock = computed(() => this.state$().stock);
|
||||
readonly getStockLoading = computed(() => this.state$().getStockLoading);
|
||||
readonly info = computed(() => this.state$().info);
|
||||
readonly getInfoLoading = computed(() => this.state$().getInfoLoading);
|
||||
readonly inOrderProducts = computed(() => this.state$().inOrderProducts);
|
||||
readonly productCategories = computed(() => this.state$().productCategories);
|
||||
readonly getProductCategoriesLoading = computed(() => this.state$().getProductCategoriesLoading);
|
||||
readonly activeProductCategory = computed(() => this.state$().activeProductCategory);
|
||||
readonly selectedCustomer = computed(() => this.state$().selectedCustomer);
|
||||
readonly viewType = computed(() => this.state$().viewType);
|
||||
readonly searchQuery = computed(() => this.state$().searchQuery);
|
||||
readonly activatedCategoryProducts = computed(() => {
|
||||
if (this.activeProductCategory() === 0) {
|
||||
return this.state$().stock;
|
||||
}
|
||||
return this.state$().stock?.filter(
|
||||
(s) => s.product.categoryId === this.state$().activeProductCategory,
|
||||
);
|
||||
});
|
||||
|
||||
readonly orderPricingInfo = computed(() => {
|
||||
const totalAmount = this.inOrderProducts().reduce(
|
||||
(acc, curr) => acc + curr.unitPrice * curr.count,
|
||||
0,
|
||||
);
|
||||
const taxAmount = totalAmount * 0.1;
|
||||
return {
|
||||
totalItems: this.inOrderProducts().reduce((acc, curr) => acc + curr.count, 0),
|
||||
totalBaseAmount: this.inOrderProducts().reduce(
|
||||
(acc, curr) => acc + parseFloat(curr.product.salePrice) * curr.count,
|
||||
0,
|
||||
),
|
||||
totalAmount,
|
||||
taxAmount,
|
||||
payableAmount: totalAmount + taxAmount,
|
||||
};
|
||||
});
|
||||
|
||||
posId!: number;
|
||||
|
||||
setState(partial: Partial<IPosState>) {
|
||||
this.state$.set({ ...this.state$(), ...partial });
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.state$.set({ ...INITIAL_POS_STATE });
|
||||
}
|
||||
|
||||
initial() {
|
||||
this.getInfo();
|
||||
this.getStock();
|
||||
this.getProductCategories();
|
||||
}
|
||||
|
||||
fillInitial(data: Partial<IPosState>) {
|
||||
this.state$.set({ ...INITIAL_POS_STATE, ...data });
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
this.setState({ getInfoLoading: true });
|
||||
this.service.getInfo(this.posId).subscribe({
|
||||
next: (res) => {
|
||||
this.setState({ info: res, getInfoLoading: false });
|
||||
},
|
||||
error: () => {
|
||||
this.setState({ getInfoLoading: false });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getStock() {
|
||||
this.setState({ getStockLoading: true });
|
||||
this.service.getStock(this.posId, this.state$().searchQuery).subscribe({
|
||||
next: (res) => {
|
||||
this.setState({ stock: res.data, getStockLoading: false });
|
||||
},
|
||||
error: () => {
|
||||
this.setState({ getStockLoading: false });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getProductCategories() {
|
||||
this.setState({ getProductCategoriesLoading: true });
|
||||
this.service
|
||||
.getCategories(this.posId)
|
||||
.pipe(
|
||||
map((res) => {
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
id: 0,
|
||||
name: 'همه',
|
||||
totalQuantity: res.data.reduce((acc, curr) => acc + curr.totalQuantity, 0),
|
||||
productCount: res.data.reduce((acc, curr) => acc + curr.productCount, 0),
|
||||
},
|
||||
...res.data,
|
||||
],
|
||||
meta: res.meta,
|
||||
};
|
||||
}),
|
||||
)
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
this.setState({
|
||||
productCategories: res.data,
|
||||
getProductCategoriesLoading: false,
|
||||
activeProductCategory: res.data[0]?.id,
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.setState({ getProductCategoriesLoading: false });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
changeActiveCategory(categoryId: number) {
|
||||
this.setState({ activeProductCategory: categoryId });
|
||||
}
|
||||
|
||||
addToInOrderProducts(productId: number) {
|
||||
const productStock = this.state$().stock?.find((s) => s.product.id === productId);
|
||||
if (!productStock) return;
|
||||
const { product } = productStock;
|
||||
|
||||
if (this.state$().inOrderProducts.some((p) => p.productId === productId)) {
|
||||
this.updateInOrderProductQuantity(
|
||||
productId,
|
||||
this.state$().inOrderProducts.find((p) => p.productId === productId)!.count + 1,
|
||||
);
|
||||
} else {
|
||||
this.setState({
|
||||
inOrderProducts: [
|
||||
...this.state$().inOrderProducts,
|
||||
{
|
||||
product,
|
||||
productId: product.id,
|
||||
count: 1,
|
||||
unitPrice: parseFloat(product.salePrice),
|
||||
maxQuantity: productStock.quantity,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
removeFromInOrderProducts(productId: number) {
|
||||
this.setState({
|
||||
inOrderProducts: this.state$().inOrderProducts.filter((p) => p.productId !== productId),
|
||||
});
|
||||
}
|
||||
|
||||
updateInOrderProductQuantity(productId: number, quantity: number) {
|
||||
const inOrderProducts = this.state$().inOrderProducts;
|
||||
|
||||
if (quantity < 1) {
|
||||
this.removeFromInOrderProducts(productId);
|
||||
} else if (inOrderProducts.findIndex((p) => p.productId === productId) === -1) {
|
||||
this.addToInOrderProducts(productId);
|
||||
} else {
|
||||
const updatedProducts = inOrderProducts.map((p) => {
|
||||
if (p.productId === productId) {
|
||||
return { ...p, count: Math.min(quantity, p.maxQuantity) };
|
||||
}
|
||||
return p;
|
||||
});
|
||||
this.setState({ inOrderProducts: updatedProducts });
|
||||
}
|
||||
}
|
||||
|
||||
updateInOrderProductFee(productId: number, unitPrice: number) {
|
||||
const inOrderProducts = this.state$().inOrderProducts;
|
||||
|
||||
if (inOrderProducts.some((p) => p.productId === productId)) {
|
||||
const updatedProducts = inOrderProducts.map((p) => {
|
||||
if (p.productId === productId) {
|
||||
return { ...p, unitPrice: unitPrice };
|
||||
}
|
||||
return p;
|
||||
});
|
||||
this.setState({ inOrderProducts: updatedProducts });
|
||||
}
|
||||
}
|
||||
|
||||
updateViewType(viewType: TViewType) {
|
||||
this.setState({ viewType });
|
||||
}
|
||||
updateSearchQuery(searchQuery: string) {
|
||||
this.setState({ searchQuery });
|
||||
}
|
||||
|
||||
resetInOrderProducts() {
|
||||
this.setState({ inOrderProducts: [] });
|
||||
}
|
||||
|
||||
setSelectedCustomer(customer: Maybe<any>) {
|
||||
this.setState({ selectedCustomer: customer });
|
||||
}
|
||||
|
||||
submitOrder() {
|
||||
const orderPayload = {
|
||||
customer_id: this.selectedCustomer()?.id,
|
||||
items: this.inOrderProducts()?.map((item) => ({
|
||||
productId: item.productId,
|
||||
count: item.count,
|
||||
unitPrice: item.unitPrice,
|
||||
})),
|
||||
};
|
||||
return this.service.submitOrder(this.posId, orderPayload).subscribe({
|
||||
next: (res) => {
|
||||
this.resetInOrderProducts();
|
||||
this.setSelectedCustomer(null);
|
||||
return of(res);
|
||||
},
|
||||
error: (err) => {
|
||||
return of(err);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<div class="w-svw h-svh bg-surface-ground flex flex-col gap-4 p-4">
|
||||
<div class="w-full flex items-center gap-4 shrink-0 justify-between">
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="w-10 h-10">
|
||||
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
|
||||
</div>
|
||||
<span class="text-lg font-bold">{{ info()?.name }} - شعبه {{ info()?.inventory?.name }}</span>
|
||||
</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="bg-surface-card py-1 px-3 rounded-md shadow-sm">
|
||||
<span [jalaliDate]="now" jalaliFormat="dddd YYYY/MM/DD" class="text-base"></span>
|
||||
</div>
|
||||
<div class="bg-surface-card py-1 px-3 rounded-md shadow-sm">
|
||||
<span class="text-base"> فروشنده شمارهی ۱ </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-4 grow overflow-hidden">
|
||||
<div class="grow h-full overflow-auto">
|
||||
<pos-products />
|
||||
</div>
|
||||
<div class="shrink-0 h-full">
|
||||
<pos-order-card />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,44 +0,0 @@
|
||||
import { JalaliDateDirective } from '@/shared/directives';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import images from 'src/assets/images';
|
||||
import { PosOrderCardComponent } from '../components/order/order-card.component';
|
||||
import { PosProductsComponent } from '../components/products/products.component';
|
||||
import { POSStore, POS_ID } from '../store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pos',
|
||||
templateUrl: './pos.component.html',
|
||||
imports: [JalaliDateDirective, PosProductsComponent, PosOrderCardComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: POS_ID,
|
||||
useFactory: (route: ActivatedRoute) => Number(route.snapshot.params['posId']),
|
||||
deps: [ActivatedRoute],
|
||||
},
|
||||
POSStore,
|
||||
],
|
||||
})
|
||||
export class POSComponent {
|
||||
private readonly store = inject(POSStore);
|
||||
|
||||
placeholderLogo = images.placeholders.logo;
|
||||
|
||||
now = new Date();
|
||||
|
||||
info = this.store.info;
|
||||
infoLoading = this.store.getInfoLoading;
|
||||
|
||||
// getInfo() {
|
||||
// this.infoLoading.set(true);
|
||||
// this.service.getInfo(Number(this.posId)).subscribe({
|
||||
// next: (res) => {
|
||||
// this.info.set(res);
|
||||
// this.infoLoading.set(false);
|
||||
// },
|
||||
// error: () => {
|
||||
// this.infoLoading.set(false);
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
|
||||
@Component({
|
||||
selector: 'app-access',
|
||||
standalone: true,
|
||||
imports: [ButtonModule, RouterModule, RippleModule, ButtonModule],
|
||||
template: ` <div
|
||||
class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-screen overflow-hidden"
|
||||
>
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div
|
||||
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, rgba(247, 149, 48, 0.4) 10%, rgba(247, 149, 48, 0) 30%)"
|
||||
>
|
||||
<div
|
||||
class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20 flex flex-col items-center"
|
||||
style="border-radius: 53px"
|
||||
>
|
||||
<div class="gap-4 flex flex-col items-center">
|
||||
<div
|
||||
class="flex justify-center items-center border-2 border-orange-500 rounded-full"
|
||||
style="width: 3.2rem; height: 3.2rem"
|
||||
>
|
||||
<i class="text-orange-500 pi pi-fw pi-lock text-2xl!"></i>
|
||||
</div>
|
||||
<h1 class="text-surface-900 dark:text-surface-0 font-bold text-4xl lg:text-5xl mb-2">
|
||||
Access Denied
|
||||
</h1>
|
||||
<span class="text-muted-color mb-8"
|
||||
>You do not have the necessary permisions. Please contact admins.</span
|
||||
>
|
||||
<img
|
||||
src="https://primefaces.org/cdn/templates/sakai/auth/asset-access.svg"
|
||||
alt="Access denied"
|
||||
class="mb-8"
|
||||
width="80%"
|
||||
/>
|
||||
<div class="col-span-12 mt-8 text-center">
|
||||
<p-button label="Go to Dashboard" routerLink="/" severity="warn" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
})
|
||||
export class Access {}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { Access } from './access';
|
||||
import { Login } from './login';
|
||||
import { Error } from './error';
|
||||
|
||||
export default [
|
||||
{ path: 'access', component: Access },
|
||||
{ path: 'error', component: Error },
|
||||
{ path: 'login', component: Login }
|
||||
] as Routes;
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
|
||||
@Component({
|
||||
selector: 'app-error',
|
||||
imports: [ButtonModule, RippleModule, RouterModule, ButtonModule],
|
||||
standalone: true,
|
||||
template: ` <div
|
||||
class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-screen overflow-hidden"
|
||||
>
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div
|
||||
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, rgba(233, 30, 99, 0.4) 10%, rgba(33, 150, 243, 0) 30%)"
|
||||
>
|
||||
<div
|
||||
class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20 flex flex-col items-center"
|
||||
style="border-radius: 53px"
|
||||
>
|
||||
<div class="gap-4 flex flex-col items-center">
|
||||
<div
|
||||
class="flex justify-center items-center border-2 border-pink-500 rounded-full"
|
||||
style="height: 3.2rem; width: 3.2rem"
|
||||
>
|
||||
<i class="pi pi-fw pi-exclamation-circle text-2xl! text-pink-500"></i>
|
||||
</div>
|
||||
<h1 class="text-surface-900 dark:text-surface-0 font-bold text-5xl mb-2">
|
||||
Error Occured
|
||||
</h1>
|
||||
<span class="text-muted-color mb-8">Requested resource is not available.</span>
|
||||
<img
|
||||
src="https://primefaces.org/cdn/templates/sakai/auth/asset-error.svg"
|
||||
alt="Error"
|
||||
class="mb-8"
|
||||
width="80%"
|
||||
/>
|
||||
<div class="col-span-12 mt-8 text-center">
|
||||
<p-button label="Go to Dashboard" routerLink="/" severity="danger" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
})
|
||||
export class Error {}
|
||||
@@ -1,132 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { CheckboxModule } from 'primeng/checkbox';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { PasswordModule } from 'primeng/password';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ButtonModule,
|
||||
CheckboxModule,
|
||||
InputTextModule,
|
||||
PasswordModule,
|
||||
FormsModule,
|
||||
RouterModule,
|
||||
RippleModule,
|
||||
],
|
||||
template: `
|
||||
<div
|
||||
class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-screen overflow-hidden"
|
||||
>
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div
|
||||
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)"
|
||||
>
|
||||
<div
|
||||
class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20"
|
||||
style="border-radius: 53px"
|
||||
>
|
||||
<div class="text-center mb-8">
|
||||
<svg
|
||||
viewBox="0 0 54 40"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="mb-8 w-16 shrink-0 mx-auto"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M17.1637 19.2467C17.1566 19.4033 17.1529 19.561 17.1529 19.7194C17.1529 25.3503 21.7203 29.915 27.3546 29.915C32.9887 29.915 37.5561 25.3503 37.5561 19.7194C37.5561 19.5572 37.5524 19.3959 37.5449 19.2355C38.5617 19.0801 39.5759 18.9013 40.5867 18.6994L40.6926 18.6782C40.7191 19.0218 40.7326 19.369 40.7326 19.7194C40.7326 27.1036 34.743 33.0896 27.3546 33.0896C19.966 33.0896 13.9765 27.1036 13.9765 19.7194C13.9765 19.374 13.9896 19.0316 14.0154 18.6927L14.0486 18.6994C15.0837 18.9062 16.1223 19.0886 17.1637 19.2467ZM33.3284 11.4538C31.6493 10.2396 29.5855 9.52381 27.3546 9.52381C25.1195 9.52381 23.0524 10.2421 21.3717 11.4603C20.0078 11.3232 18.6475 11.1387 17.2933 10.907C19.7453 8.11308 23.3438 6.34921 27.3546 6.34921C31.36 6.34921 34.9543 8.10844 37.4061 10.896C36.0521 11.1292 34.692 11.3152 33.3284 11.4538ZM43.826 18.0518C43.881 18.6003 43.9091 19.1566 43.9091 19.7194C43.9091 28.8568 36.4973 36.2642 27.3546 36.2642C18.2117 36.2642 10.8 28.8568 10.8 19.7194C10.8 19.1615 10.8276 18.61 10.8816 18.0663L7.75383 17.4411C7.66775 18.1886 7.62354 18.9488 7.62354 19.7194C7.62354 30.6102 16.4574 39.4388 27.3546 39.4388C38.2517 39.4388 47.0855 30.6102 47.0855 19.7194C47.0855 18.9439 47.0407 18.1789 46.9536 17.4267L43.826 18.0518ZM44.2613 9.54743L40.9084 10.2176C37.9134 5.95821 32.9593 3.1746 27.3546 3.1746C21.7442 3.1746 16.7856 5.96385 13.7915 10.2305L10.4399 9.56057C13.892 3.83178 20.1756 0 27.3546 0C34.5281 0 40.8075 3.82591 44.2613 9.54743Z"
|
||||
fill="var(--primary-color)"
|
||||
/>
|
||||
<mask
|
||||
id="mask0_1413_1551"
|
||||
style="mask-type: alpha"
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="0"
|
||||
y="8"
|
||||
width="54"
|
||||
height="11"
|
||||
>
|
||||
<path
|
||||
d="M27 18.3652C10.5114 19.1944 0 8.88892 0 8.88892C0 8.88892 16.5176 14.5866 27 14.5866C37.4824 14.5866 54 8.88892 54 8.88892C54 8.88892 43.4886 17.5361 27 18.3652Z"
|
||||
fill="var(--primary-color)"
|
||||
/>
|
||||
</mask>
|
||||
<g mask="url(#mask0_1413_1551)">
|
||||
<path
|
||||
d="M-4.673e-05 8.88887L3.73084 -1.91434L-8.00806 17.0473L-4.673e-05 8.88887ZM27 18.3652L26.4253 6.95109L27 18.3652ZM54 8.88887L61.2673 17.7127L50.2691 -1.91434L54 8.88887ZM-4.673e-05 8.88887C-8.00806 17.0473 -8.00469 17.0505 -8.00132 17.0538C-8.00018 17.055 -7.99675 17.0583 -7.9944 17.0607C-7.98963 17.0653 -7.98474 17.0701 -7.97966 17.075C-7.96949 17.0849 -7.95863 17.0955 -7.94707 17.1066C-7.92401 17.129 -7.89809 17.1539 -7.86944 17.1812C-7.8122 17.236 -7.74377 17.3005 -7.66436 17.3743C-7.50567 17.5218 -7.30269 17.7063 -7.05645 17.9221C-6.56467 18.3532 -5.89662 18.9125 -5.06089 19.5534C-3.39603 20.83 -1.02575 22.4605 1.98012 24.0457C7.97874 27.2091 16.7723 30.3226 27.5746 29.7793L26.4253 6.95109C20.7391 7.23699 16.0326 5.61231 12.6534 3.83024C10.9703 2.94267 9.68222 2.04866 8.86091 1.41888C8.45356 1.10653 8.17155 0.867278 8.0241 0.738027C7.95072 0.673671 7.91178 0.637576 7.90841 0.634492C7.90682 0.63298 7.91419 0.639805 7.93071 0.65557C7.93897 0.663455 7.94952 0.673589 7.96235 0.686039C7.96883 0.692262 7.97582 0.699075 7.98338 0.706471C7.98719 0.710167 7.99113 0.714014 7.99526 0.718014C7.99729 0.720008 8.00047 0.723119 8.00148 0.724116C8.00466 0.727265 8.00796 0.730446 -4.673e-05 8.88887ZM27.5746 29.7793C37.6904 29.2706 45.9416 26.3684 51.6602 23.6054C54.5296 22.2191 56.8064 20.8465 58.4186 19.7784C59.2265 19.2431 59.873 18.7805 60.3494 18.4257C60.5878 18.2482 60.7841 18.0971 60.9374 17.977C61.014 17.9169 61.0799 17.8645 61.1349 17.8203C61.1624 17.7981 61.1872 17.7781 61.2093 17.7602C61.2203 17.7512 61.2307 17.7427 61.2403 17.7348C61.2452 17.7308 61.2499 17.727 61.2544 17.7233C61.2566 17.7215 61.2598 17.7188 61.261 17.7179C61.2642 17.7153 61.2673 17.7127 54 8.88887C46.7326 0.0650536 46.7357 0.0625219 46.7387 0.0600241C46.7397 0.0592345 46.7427 0.0567658 46.7446 0.0551857C46.7485 0.0520238 46.7521 0.0489887 46.7557 0.0460799C46.7628 0.0402623 46.7694 0.0349487 46.7753 0.0301318C46.7871 0.0204986 46.7966 0.0128495 46.8037 0.00712562C46.818 -0.00431848 46.8228 -0.00808311 46.8184 -0.00463784C46.8096 0.00228345 46.764 0.0378652 46.6828 0.0983779C46.5199 0.219675 46.2165 0.439161 45.7812 0.727519C44.9072 1.30663 43.5257 2.14765 41.7061 3.02677C38.0469 4.79468 32.7981 6.63058 26.4253 6.95109L27.5746 29.7793ZM54 8.88887C50.2691 -1.91433 50.27 -1.91467 50.271 -1.91498C50.2712 -1.91506 50.272 -1.91535 50.2724 -1.9155C50.2733 -1.91581 50.274 -1.91602 50.2743 -1.91616C50.2752 -1.91643 50.275 -1.91636 50.2738 -1.91595C50.2714 -1.91515 50.2652 -1.91302 50.2552 -1.9096C50.2351 -1.90276 50.1999 -1.89078 50.1503 -1.874C50.0509 -1.84043 49.8938 -1.78773 49.6844 -1.71863C49.2652 -1.58031 48.6387 -1.377 47.8481 -1.13035C46.2609 -0.635237 44.0427 0.0249875 41.5325 0.6823C36.215 2.07471 30.6736 3.15796 27 3.15796V26.0151C33.8087 26.0151 41.7672 24.2495 47.3292 22.7931C50.2586 22.026 52.825 21.2618 54.6625 20.6886C55.5842 20.4011 56.33 20.1593 56.8551 19.986C57.1178 19.8993 57.3258 19.8296 57.4735 19.7797C57.5474 19.7548 57.6062 19.7348 57.6493 19.72C57.6709 19.7127 57.6885 19.7066 57.7021 19.7019C57.7089 19.6996 57.7147 19.6976 57.7195 19.696C57.7219 19.6952 57.7241 19.6944 57.726 19.6938C57.7269 19.6934 57.7281 19.693 57.7286 19.6929C57.7298 19.6924 57.7309 19.692 54 8.88887ZM27 3.15796C23.3263 3.15796 17.7849 2.07471 12.4674 0.6823C9.95717 0.0249875 7.73904 -0.635237 6.15184 -1.13035C5.36118 -1.377 4.73467 -1.58031 4.3155 -1.71863C4.10609 -1.78773 3.94899 -1.84043 3.84961 -1.874C3.79994 -1.89078 3.76474 -1.90276 3.74471 -1.9096C3.73469 -1.91302 3.72848 -1.91515 3.72613 -1.91595C3.72496 -1.91636 3.72476 -1.91643 3.72554 -1.91616C3.72593 -1.91602 3.72657 -1.91581 3.72745 -1.9155C3.72789 -1.91535 3.72874 -1.91506 3.72896 -1.91498C3.72987 -1.91467 3.73084 -1.91433 -4.673e-05 8.88887C-3.73093 19.692 -3.72983 19.6924 -3.72868 19.6929C-3.72821 19.693 -3.72698 19.6934 -3.72603 19.6938C-3.72415 19.6944 -3.72201 19.6952 -3.71961 19.696C-3.71482 19.6976 -3.70901 19.6996 -3.7022 19.7019C-3.68858 19.7066 -3.67095 19.7127 -3.6494 19.72C-3.60629 19.7348 -3.54745 19.7548 -3.47359 19.7797C-3.32589 19.8296 -3.11788 19.8993 -2.85516 19.986C-2.33008 20.1593 -1.58425 20.4011 -0.662589 20.6886C1.17485 21.2618 3.74125 22.026 6.67073 22.7931C12.2327 24.2495 20.1913 26.0151 27 26.0151V3.15796Z"
|
||||
fill="var(--primary-color)"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">
|
||||
Welcome to PrimeLand!
|
||||
</div>
|
||||
<span class="text-muted-color font-medium">Sign in to continue</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label
|
||||
for="email1"
|
||||
class="block text-surface-900 dark:text-surface-0 text-xl font-medium mb-2"
|
||||
>Email</label
|
||||
>
|
||||
<input
|
||||
pInputText
|
||||
id="email1"
|
||||
type="text"
|
||||
placeholder="Email address"
|
||||
class="w-full md:w-120 mb-8"
|
||||
[(ngModel)]="email"
|
||||
/>
|
||||
|
||||
<label
|
||||
for="password1"
|
||||
class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2"
|
||||
>Password</label
|
||||
>
|
||||
<p-password
|
||||
id="password1"
|
||||
[(ngModel)]="password"
|
||||
placeholder="Password"
|
||||
[toggleMask]="true"
|
||||
styleClass="mb-4"
|
||||
[fluid]="true"
|
||||
[feedback]="false"
|
||||
></p-password>
|
||||
|
||||
<div class="flex items-center justify-between mt-2 mb-8 gap-8">
|
||||
<div class="flex items-center">
|
||||
<p-checkbox
|
||||
[(ngModel)]="checked"
|
||||
id="rememberme1"
|
||||
binary
|
||||
class="mr-2"
|
||||
></p-checkbox>
|
||||
<label for="rememberme1">Remember me</label>
|
||||
</div>
|
||||
<span class="font-medium no-underline ml-2 text-right cursor-pointer text-primary"
|
||||
>Forgot password?</span
|
||||
>
|
||||
</div>
|
||||
<p-button label="Sign In" styleClass="w-full" routerLink="/"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
})
|
||||
export class Login {
|
||||
email: string = '';
|
||||
|
||||
password: string = '';
|
||||
|
||||
checked: boolean = false;
|
||||
}
|
||||
@@ -1,488 +0,0 @@
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit, signal, ViewChild } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||
import { DialogModule } from 'primeng/dialog';
|
||||
import { IconFieldModule } from 'primeng/iconfield';
|
||||
import { InputIconModule } from 'primeng/inputicon';
|
||||
import { InputNumberModule } from 'primeng/inputnumber';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { RadioButtonModule } from 'primeng/radiobutton';
|
||||
import { RatingModule } from 'primeng/rating';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { SelectModule } from 'primeng/select';
|
||||
import { Table, TableModule } from 'primeng/table';
|
||||
import { TagModule } from 'primeng/tag';
|
||||
import { TextareaModule } from 'primeng/textarea';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ToolbarModule } from 'primeng/toolbar';
|
||||
import { Product, ProductService } from '../service/product.service';
|
||||
|
||||
interface Column {
|
||||
field: string;
|
||||
header: string;
|
||||
customExportHeader?: string;
|
||||
}
|
||||
|
||||
interface ExportColumn {
|
||||
title: string;
|
||||
dataKey: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-crud',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
TableModule,
|
||||
FormsModule,
|
||||
ButtonModule,
|
||||
RippleModule,
|
||||
ToastModule,
|
||||
ToolbarModule,
|
||||
RatingModule,
|
||||
InputTextModule,
|
||||
TextareaModule,
|
||||
SelectModule,
|
||||
RadioButtonModule,
|
||||
InputNumberModule,
|
||||
DialogModule,
|
||||
TagModule,
|
||||
InputIconModule,
|
||||
IconFieldModule,
|
||||
ConfirmDialogModule,
|
||||
SharedDialogComponent,
|
||||
],
|
||||
template: `
|
||||
<p-toolbar styleClass="mb-6">
|
||||
<ng-template #start>
|
||||
<p-button
|
||||
label="New"
|
||||
icon="pi pi-plus"
|
||||
severity="secondary"
|
||||
class="mr-2"
|
||||
(onClick)="openNew()"
|
||||
/>
|
||||
<p-button
|
||||
severity="secondary"
|
||||
label="Delete"
|
||||
icon="pi pi-trash"
|
||||
outlined
|
||||
(onClick)="deleteSelectedProducts()"
|
||||
[disabled]="!selectedProducts || !selectedProducts.length"
|
||||
/>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #end>
|
||||
<p-button label="Export" icon="pi pi-upload" severity="secondary" (onClick)="exportCSV()" />
|
||||
</ng-template>
|
||||
</p-toolbar>
|
||||
|
||||
<p-table
|
||||
#dt
|
||||
[value]="products()"
|
||||
[rows]="10"
|
||||
[columns]="cols"
|
||||
[paginator]="true"
|
||||
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
||||
[tableStyle]="{ 'min-width': '75rem' }"
|
||||
[(selection)]="selectedProducts"
|
||||
[rowHover]="true"
|
||||
dataKey="id"
|
||||
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} products"
|
||||
[showCurrentPageReport]="true"
|
||||
[rowsPerPageOptions]="[10, 20, 30]"
|
||||
>
|
||||
<ng-template #caption>
|
||||
<div class="flex items-center justify-between">
|
||||
<h5 class="m-0">Manage Products</h5>
|
||||
<p-iconfield>
|
||||
<p-inputicon styleClass="pi pi-search" />
|
||||
<input
|
||||
pInputText
|
||||
type="text"
|
||||
(input)="onGlobalFilter(dt, $event)"
|
||||
placeholder="Search..."
|
||||
/>
|
||||
</p-iconfield>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th style="width: 3rem">
|
||||
<p-tableHeaderCheckbox />
|
||||
</th>
|
||||
<th style="min-width: 16rem">Code</th>
|
||||
<th pSortableColumn="name" style="min-width:16rem">
|
||||
Name
|
||||
<p-sortIcon field="name" />
|
||||
</th>
|
||||
<th>Image</th>
|
||||
<th pSortableColumn="price" style="min-width: 8rem">
|
||||
Price
|
||||
<p-sortIcon field="price" />
|
||||
</th>
|
||||
<th pSortableColumn="category" style="min-width:10rem">
|
||||
Category
|
||||
<p-sortIcon field="category" />
|
||||
</th>
|
||||
<th pSortableColumn="rating" style="min-width: 12rem">
|
||||
Reviews
|
||||
<p-sortIcon field="rating" />
|
||||
</th>
|
||||
<th pSortableColumn="inventoryStatus" style="min-width: 12rem">
|
||||
Status
|
||||
<p-sortIcon field="inventoryStatus" />
|
||||
</th>
|
||||
<th style="min-width: 12rem"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-product>
|
||||
<tr>
|
||||
<td style="width: 3rem">
|
||||
<p-tableCheckbox [value]="product" />
|
||||
</td>
|
||||
<td style="min-width: 12rem">{{ product.code }}</td>
|
||||
<td style="min-width: 16rem">{{ product.name }}</td>
|
||||
<td>
|
||||
<img
|
||||
[src]="'https://primefaces.org/cdn/primeng/images/demo/product/' + product.image"
|
||||
[alt]="product.name"
|
||||
style="width: 64px"
|
||||
class="rounded"
|
||||
/>
|
||||
</td>
|
||||
<td>{{ product.price | currency: 'USD' }}</td>
|
||||
<td>{{ product.category }}</td>
|
||||
<td>
|
||||
<p-rating [(ngModel)]="product.rating" [readonly]="true" />
|
||||
</td>
|
||||
<td>
|
||||
<p-tag
|
||||
[value]="product.inventoryStatus"
|
||||
[severity]="getSeverity(product.inventoryStatus)"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<p-button
|
||||
icon="pi pi-pencil"
|
||||
class="mr-2"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
(click)="editProduct(product)"
|
||||
/>
|
||||
<p-button
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
(click)="deleteProduct(product)"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<shared-dialog
|
||||
[(visible)]="productDialog"
|
||||
[style]="{ width: '450px' }"
|
||||
header="Product Details"
|
||||
[modal]="true"
|
||||
>
|
||||
<ng-template #content>
|
||||
<div class="flex flex-col gap-6">
|
||||
<img
|
||||
[src]="'https://primefaces.org/cdn/primeng/images/demo/product/' + product.image"
|
||||
[alt]="product.image"
|
||||
class="block m-auto pb-4"
|
||||
*ngIf="product.image"
|
||||
/>
|
||||
<div>
|
||||
<label for="name" class="block font-bold mb-3">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
pInputText
|
||||
id="name"
|
||||
[(ngModel)]="product.name"
|
||||
required
|
||||
autofocus
|
||||
fluid
|
||||
/>
|
||||
<small class="text-red-500" *ngIf="submitted && !product.name">Name is required.</small>
|
||||
</div>
|
||||
<div>
|
||||
<label for="description" class="block font-bold mb-3">Description</label>
|
||||
<textarea
|
||||
id="description"
|
||||
pTextarea
|
||||
[(ngModel)]="product.description"
|
||||
required
|
||||
rows="3"
|
||||
cols="20"
|
||||
fluid
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="inventoryStatus" class="block font-bold mb-3">Inventory Status</label>
|
||||
<p-select
|
||||
[(ngModel)]="product.inventoryStatus"
|
||||
inputId="inventoryStatus"
|
||||
[options]="statuses"
|
||||
optionLabel="label"
|
||||
optionValue="label"
|
||||
placeholder="Select a Status"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="block font-bold mb-4">Category</span>
|
||||
<div class="grid grid-cols-12 gap-4">
|
||||
<div class="flex items-center gap-2 col-span-6">
|
||||
<p-radiobutton
|
||||
id="category1"
|
||||
name="category"
|
||||
value="Accessories"
|
||||
[(ngModel)]="product.category"
|
||||
/>
|
||||
<label for="category1">Accessories</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 col-span-6">
|
||||
<p-radiobutton
|
||||
id="category2"
|
||||
name="category"
|
||||
value="Clothing"
|
||||
[(ngModel)]="product.category"
|
||||
/>
|
||||
<label for="category2">Clothing</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 col-span-6">
|
||||
<p-radiobutton
|
||||
id="category3"
|
||||
name="category"
|
||||
value="Electronics"
|
||||
[(ngModel)]="product.category"
|
||||
/>
|
||||
<label for="category3">Electronics</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 col-span-6">
|
||||
<p-radiobutton
|
||||
id="category4"
|
||||
name="category"
|
||||
value="Fitness"
|
||||
[(ngModel)]="product.category"
|
||||
/>
|
||||
<label for="category4">Fitness</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-12 gap-4">
|
||||
<div class="col-span-6">
|
||||
<label for="price" class="block font-bold mb-3">Price</label>
|
||||
<p-inputnumber
|
||||
id="price"
|
||||
[(ngModel)]="product.price"
|
||||
mode="currency"
|
||||
currency="USD"
|
||||
locale="en-US"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<label for="quantity" class="block font-bold mb-3">Quantity</label>
|
||||
<p-inputnumber id="quantity" [(ngModel)]="product.quantity" fluid />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #footer>
|
||||
<p-button label="Cancel" icon="pi pi-times" text (click)="hideDialog()" />
|
||||
<p-button label="Save" icon="pi pi-check" (click)="saveProduct()" />
|
||||
</ng-template>
|
||||
</shared-dialog>
|
||||
|
||||
<p-confirmdialog [style]="{ width: '450px' }" />
|
||||
`,
|
||||
providers: [MessageService, ProductService, ConfirmationService],
|
||||
})
|
||||
export class Crud implements OnInit {
|
||||
productDialog: boolean = false;
|
||||
|
||||
products = signal<Product[]>([]);
|
||||
|
||||
product!: Product;
|
||||
|
||||
selectedProducts!: Product[] | null;
|
||||
|
||||
submitted: boolean = false;
|
||||
|
||||
statuses!: any[];
|
||||
|
||||
@ViewChild('dt') dt!: Table;
|
||||
|
||||
exportColumns!: ExportColumn[];
|
||||
|
||||
cols!: Column[];
|
||||
|
||||
constructor(
|
||||
private productService: ProductService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
) {}
|
||||
|
||||
exportCSV() {
|
||||
this.dt.exportCSV();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadDemoData();
|
||||
}
|
||||
|
||||
loadDemoData() {
|
||||
this.productService.getProducts().then((data) => {
|
||||
this.products.set(data);
|
||||
});
|
||||
|
||||
this.statuses = [
|
||||
{ label: 'INSTOCK', value: 'instock' },
|
||||
{ label: 'LOWSTOCK', value: 'lowstock' },
|
||||
{ label: 'OUTOFSTOCK', value: 'outofstock' },
|
||||
];
|
||||
|
||||
this.cols = [
|
||||
{ field: 'code', header: 'Code', customExportHeader: 'Product Code' },
|
||||
{ field: 'name', header: 'Name' },
|
||||
{ field: 'image', header: 'Image' },
|
||||
{ field: 'price', header: 'Price' },
|
||||
{ field: 'category', header: 'Category' },
|
||||
];
|
||||
|
||||
this.exportColumns = this.cols.map((col) => ({ title: col.header, dataKey: col.field }));
|
||||
}
|
||||
|
||||
onGlobalFilter(table: Table, event: Event) {
|
||||
table.filterGlobal((event.target as HTMLInputElement).value, 'contains');
|
||||
}
|
||||
|
||||
openNew() {
|
||||
this.product = {};
|
||||
this.submitted = false;
|
||||
this.productDialog = true;
|
||||
}
|
||||
|
||||
editProduct(product: Product) {
|
||||
this.product = { ...product };
|
||||
this.productDialog = true;
|
||||
}
|
||||
|
||||
deleteSelectedProducts() {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Are you sure you want to delete the selected products?',
|
||||
header: 'Confirm',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
accept: () => {
|
||||
this.products.set(this.products().filter((val) => !this.selectedProducts?.includes(val)));
|
||||
this.selectedProducts = null;
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Successful',
|
||||
detail: 'Products Deleted',
|
||||
life: 3000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
hideDialog() {
|
||||
this.productDialog = false;
|
||||
this.submitted = false;
|
||||
}
|
||||
|
||||
deleteProduct(product: Product) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Are you sure you want to delete ' + product.name + '?',
|
||||
header: 'Confirm',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
accept: () => {
|
||||
this.products.set(this.products().filter((val) => val.id !== product.id));
|
||||
this.product = {};
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Successful',
|
||||
detail: 'Product Deleted',
|
||||
life: 3000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
findIndexById(id: string): number {
|
||||
let index = -1;
|
||||
for (let i = 0; i < this.products().length; i++) {
|
||||
if (this.products()[i].id === id) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
createId(): string {
|
||||
let id = '';
|
||||
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (var i = 0; i < 5; i++) {
|
||||
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
getSeverity(status: string) {
|
||||
switch (status) {
|
||||
case 'INSTOCK':
|
||||
return 'success';
|
||||
case 'LOWSTOCK':
|
||||
return 'warn';
|
||||
case 'OUTOFSTOCK':
|
||||
return 'danger';
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
|
||||
saveProduct() {
|
||||
this.submitted = true;
|
||||
let _products = this.products();
|
||||
if (this.product.name?.trim()) {
|
||||
if (this.product.id) {
|
||||
_products[this.findIndexById(this.product.id)] = this.product;
|
||||
this.products.set([..._products]);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Successful',
|
||||
detail: 'Product Updated',
|
||||
life: 3000,
|
||||
});
|
||||
} else {
|
||||
this.product.id = this.createId();
|
||||
this.product.image = 'product-placeholder.svg';
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Successful',
|
||||
detail: 'Product Created',
|
||||
life: 3000,
|
||||
});
|
||||
this.products.set([..._products, this.product]);
|
||||
}
|
||||
|
||||
this.productDialog = false;
|
||||
this.product = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { MenuModule } from 'primeng/menu';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-best-selling-widget',
|
||||
imports: [CommonModule, ButtonModule, MenuModule],
|
||||
template: ` <div class="card">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div class="font-semibold text-xl">Best Selling Products</div>
|
||||
<div>
|
||||
<button pButton type="button" icon="pi pi-ellipsis-v" class="p-button-rounded p-button-text p-button-plain" (click)="menu.toggle($event)"></button>
|
||||
<p-menu #menu [popup]="true" [model]="items"></p-menu>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-none p-0 m-0">
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Space T-Shirt</span>
|
||||
<div class="mt-1 text-muted-color">Clothing</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-orange-500 h-full" style="width: 50%"></div>
|
||||
</div>
|
||||
<span class="text-orange-500 ml-4 font-medium">%50</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Portal Sticker</span>
|
||||
<div class="mt-1 text-muted-color">Accessories</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 ml-0 md:ml-20 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-cyan-500 h-full" style="width: 16%"></div>
|
||||
</div>
|
||||
<span class="text-cyan-500 ml-4 font-medium">%16</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Supernova Sticker</span>
|
||||
<div class="mt-1 text-muted-color">Accessories</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 ml-0 md:ml-20 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-pink-500 h-full" style="width: 67%"></div>
|
||||
</div>
|
||||
<span class="text-pink-500 ml-4 font-medium">%67</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Wonders Notebook</span>
|
||||
<div class="mt-1 text-muted-color">Office</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 ml-0 md:ml-20 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-green-500 h-full" style="width: 35%"></div>
|
||||
</div>
|
||||
<span class="text-primary ml-4 font-medium">%35</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Mat Black Case</span>
|
||||
<div class="mt-1 text-muted-color">Accessories</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 ml-0 md:ml-20 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-purple-500 h-full" style="width: 75%"></div>
|
||||
</div>
|
||||
<span class="text-purple-500 ml-4 font-medium">%75</span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
|
||||
<div>
|
||||
<span class="text-surface-900 dark:text-surface-0 font-medium mr-2 mb-1 md:mb-0">Robots T-Shirt</span>
|
||||
<div class="mt-1 text-muted-color">Clothing</div>
|
||||
</div>
|
||||
<div class="mt-2 md:mt-0 ml-0 md:ml-20 flex items-center">
|
||||
<div class="bg-surface-300 dark:bg-surface-500 rounded-border overflow-hidden w-40 lg:w-24" style="height: 8px">
|
||||
<div class="bg-teal-500 h-full" style="width: 40%"></div>
|
||||
</div>
|
||||
<span class="text-teal-500 ml-4 font-medium">%40</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>`
|
||||
})
|
||||
export class BestSellingWidget {
|
||||
menu = null;
|
||||
|
||||
items = [
|
||||
{ label: 'Add New', icon: 'pi pi-fw pi-plus' },
|
||||
{ label: 'Remove', icon: 'pi pi-fw pi-trash' }
|
||||
];
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { MenuModule } from 'primeng/menu';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-notifications-widget',
|
||||
imports: [ButtonModule, MenuModule],
|
||||
template: `<div class="card">
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div class="font-semibold text-xl">Notifications</div>
|
||||
<div>
|
||||
<button pButton type="button" icon="pi pi-ellipsis-v" class="p-button-rounded p-button-text p-button-plain" (click)="menu.toggle($event)"></button>
|
||||
<p-menu #menu [popup]="true" [model]="items"></p-menu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="block text-muted-color font-medium mb-4">TODAY</span>
|
||||
<ul class="p-0 mx-0 mt-0 mb-6 list-none">
|
||||
<li class="flex items-center py-2 border-b border-surface">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-blue-100 dark:bg-blue-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-dollar text-xl! text-blue-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-900 dark:text-surface-0 leading-normal"
|
||||
>Richard Jones
|
||||
<span class="text-surface-700 dark:text-surface-100">has purchased a blue t-shirt for <span class="text-primary font-bold">$79.00</span></span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="flex items-center py-2">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-orange-100 dark:bg-orange-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-download text-xl! text-orange-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-700 dark:text-surface-100 leading-normal">Your request for withdrawal of <span class="text-primary font-bold">$2500.00</span> has been initiated.</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<span class="block text-muted-color font-medium mb-4">YESTERDAY</span>
|
||||
<ul class="p-0 m-0 list-none mb-6">
|
||||
<li class="flex items-center py-2 border-b border-surface">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-blue-100 dark:bg-blue-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-dollar text-xl! text-blue-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-900 dark:text-surface-0 leading-normal"
|
||||
>Keyser Wick
|
||||
<span class="text-surface-700 dark:text-surface-100">has purchased a black jacket for <span class="text-primary font-bold">$59.00</span></span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="flex items-center py-2 border-b border-surface">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-pink-100 dark:bg-pink-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-question text-xl! text-pink-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-900 dark:text-surface-0 leading-normal"
|
||||
>Jane Davis
|
||||
<span class="text-surface-700 dark:text-surface-100">has posted a new questions about your product.</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<span class="block text-muted-color font-medium mb-4">LAST WEEK</span>
|
||||
<ul class="p-0 m-0 list-none">
|
||||
<li class="flex items-center py-2 border-b border-surface">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-green-100 dark:bg-green-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-arrow-up text-xl! text-green-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-900 dark:text-surface-0 leading-normal">Your revenue has increased by <span class="text-primary font-bold">%25</span>.</span>
|
||||
</li>
|
||||
<li class="flex items-center py-2 border-b border-surface">
|
||||
<div class="w-12 h-12 flex items-center justify-center bg-purple-100 dark:bg-purple-400/10 rounded-full mr-4 shrink-0">
|
||||
<i class="pi pi-heart text-xl! text-purple-500"></i>
|
||||
</div>
|
||||
<span class="text-surface-900 dark:text-surface-0 leading-normal"><span class="text-primary font-bold">12</span> users have added your products to their wishlist.</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>`
|
||||
})
|
||||
export class NotificationsWidget {
|
||||
items = [
|
||||
{ label: 'Add New', icon: 'pi pi-fw pi-plus' },
|
||||
{ label: 'Remove', icon: 'pi pi-fw pi-trash' }
|
||||
];
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Product, ProductService } from '../../service/product.service';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-recent-sales-widget',
|
||||
imports: [CommonModule, TableModule, ButtonModule, RippleModule],
|
||||
template: `<div class="card mb-8!">
|
||||
<div class="font-semibold text-xl mb-4">Recent Sales</div>
|
||||
<p-table [value]="products" [paginator]="true" [rows]="5" responsiveLayout="scroll">
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th>Image</th>
|
||||
<th pSortableColumn="name">Name <p-sortIcon field="name"></p-sortIcon></th>
|
||||
<th pSortableColumn="price">Price <p-sortIcon field="price"></p-sortIcon></th>
|
||||
<th>View</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-product>
|
||||
<tr>
|
||||
<td style="width: 15%; min-width: 5rem;">
|
||||
<img src="https://primefaces.org/cdn/primevue/images/product/{{ product.image }}" class="shadow-lg" alt="{{ product.name }}" width="50" />
|
||||
</td>
|
||||
<td style="width: 35%; min-width: 7rem;">{{ product.name }}</td>
|
||||
<td style="width: 35%; min-width: 8rem;">{{ product.price | currency: 'USD' }}</td>
|
||||
<td style="width: 15%;">
|
||||
<button pButton pRipple type="button" icon="pi pi-search" class="p-button p-component p-button-text p-button-icon-only"></button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>`,
|
||||
providers: [ProductService]
|
||||
})
|
||||
export class RecentSalesWidget {
|
||||
products!: Product[];
|
||||
|
||||
constructor(private productService: ProductService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.productService.getProductsSmall().then((data) => (this.products = data));
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ChartModule } from 'primeng/chart';
|
||||
import { debounceTime, Subscription } from 'rxjs';
|
||||
import { LayoutService } from '../../../layout/service/layout.service';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-revenue-stream-widget',
|
||||
imports: [ChartModule],
|
||||
template: `<div class="card mb-8!">
|
||||
<div class="font-semibold text-xl mb-4">Revenue Stream</div>
|
||||
<p-chart type="bar" [data]="chartData" [options]="chartOptions" class="h-100" />
|
||||
</div>`
|
||||
})
|
||||
export class RevenueStreamWidget {
|
||||
chartData: any;
|
||||
|
||||
chartOptions: any;
|
||||
|
||||
subscription!: Subscription;
|
||||
|
||||
constructor(public layoutService: LayoutService) {
|
||||
this.subscription = this.layoutService.configUpdate$.pipe(debounceTime(25)).subscribe(() => {
|
||||
this.initChart();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.initChart();
|
||||
}
|
||||
|
||||
initChart() {
|
||||
const documentStyle = getComputedStyle(document.documentElement);
|
||||
const textColor = documentStyle.getPropertyValue('--text-color');
|
||||
const borderColor = documentStyle.getPropertyValue('--surface-border');
|
||||
const textMutedColor = documentStyle.getPropertyValue('--text-color-secondary');
|
||||
|
||||
this.chartData = {
|
||||
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
|
||||
datasets: [
|
||||
{
|
||||
type: 'bar',
|
||||
label: 'Subscriptions',
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-400'),
|
||||
data: [4000, 10000, 15000, 4000],
|
||||
barThickness: 32
|
||||
},
|
||||
{
|
||||
type: 'bar',
|
||||
label: 'Advertising',
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-300'),
|
||||
data: [2100, 8400, 2400, 7500],
|
||||
barThickness: 32
|
||||
},
|
||||
{
|
||||
type: 'bar',
|
||||
label: 'Affiliate',
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-200'),
|
||||
data: [4100, 5200, 3400, 7400],
|
||||
borderRadius: {
|
||||
topLeft: 8,
|
||||
topRight: 8,
|
||||
bottomLeft: 0,
|
||||
bottomRight: 0
|
||||
},
|
||||
borderSkipped: false,
|
||||
barThickness: 32
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.chartOptions = {
|
||||
maintainAspectRatio: false,
|
||||
aspectRatio: 0.8,
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
stacked: true,
|
||||
ticks: {
|
||||
color: textMutedColor
|
||||
},
|
||||
grid: {
|
||||
color: 'transparent',
|
||||
borderColor: 'transparent'
|
||||
}
|
||||
},
|
||||
y: {
|
||||
stacked: true,
|
||||
ticks: {
|
||||
color: textMutedColor
|
||||
},
|
||||
grid: {
|
||||
color: borderColor,
|
||||
borderColor: 'transparent',
|
||||
drawTicks: false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-stats-widget',
|
||||
imports: [CommonModule],
|
||||
template: `<div class="col-span-12 lg:col-span-6 xl:col-span-3">
|
||||
<div class="card mb-0">
|
||||
<div class="flex justify-between mb-4">
|
||||
<div>
|
||||
<span class="block text-muted-color font-medium mb-4">Orders</span>
|
||||
<div class="text-surface-900 dark:text-surface-0 font-medium text-xl">152</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center bg-blue-100 dark:bg-blue-400/10 rounded-border" style="width: 2.5rem; height: 2.5rem">
|
||||
<i class="pi pi-shopping-cart text-blue-500 text-xl!"></i>
|
||||
</div>
|
||||
</div>
|
||||
<span class="text-primary font-medium">24 new </span>
|
||||
<span class="text-muted-color">since last visit</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 lg:col-span-6 xl:col-span-3">
|
||||
<div class="card mb-0">
|
||||
<div class="flex justify-between mb-4">
|
||||
<div>
|
||||
<span class="block text-muted-color font-medium mb-4">Revenue</span>
|
||||
<div class="text-surface-900 dark:text-surface-0 font-medium text-xl">$2.100</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center bg-orange-100 dark:bg-orange-400/10 rounded-border" style="width: 2.5rem; height: 2.5rem">
|
||||
<i class="pi pi-dollar text-orange-500 text-xl!"></i>
|
||||
</div>
|
||||
</div>
|
||||
<span class="text-primary font-medium">%52+ </span>
|
||||
<span class="text-muted-color">since last week</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 lg:col-span-6 xl:col-span-3">
|
||||
<div class="card mb-0">
|
||||
<div class="flex justify-between mb-4">
|
||||
<div>
|
||||
<span class="block text-muted-color font-medium mb-4">Customers</span>
|
||||
<div class="text-surface-900 dark:text-surface-0 font-medium text-xl">28441</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center bg-cyan-100 dark:bg-cyan-400/10 rounded-border" style="width: 2.5rem; height: 2.5rem">
|
||||
<i class="pi pi-users text-cyan-500 text-xl!"></i>
|
||||
</div>
|
||||
</div>
|
||||
<span class="text-primary font-medium">520 </span>
|
||||
<span class="text-muted-color">newly registered</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 lg:col-span-6 xl:col-span-3">
|
||||
<div class="card mb-0">
|
||||
<div class="flex justify-between mb-4">
|
||||
<div>
|
||||
<span class="block text-muted-color font-medium mb-4">Comments</span>
|
||||
<div class="text-surface-900 dark:text-surface-0 font-medium text-xl">152 Unread</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center bg-purple-100 dark:bg-purple-400/10 rounded-border" style="width: 2.5rem; height: 2.5rem">
|
||||
<i class="pi pi-comment text-purple-500 text-xl!"></i>
|
||||
</div>
|
||||
</div>
|
||||
<span class="text-primary font-medium">85 </span>
|
||||
<span class="text-muted-color">responded</span>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
export class StatsWidget {}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NotificationsWidget } from './components/notificationswidget';
|
||||
import { StatsWidget } from './components/statswidget';
|
||||
import { RecentSalesWidget } from './components/recentsaleswidget';
|
||||
import { BestSellingWidget } from './components/bestsellingwidget';
|
||||
import { RevenueStreamWidget } from './components/revenuestreamwidget';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
imports: [StatsWidget, RecentSalesWidget, BestSellingWidget, RevenueStreamWidget, NotificationsWidget],
|
||||
template: `
|
||||
<div class="grid grid-cols-12 gap-8">
|
||||
<app-stats-widget class="contents" />
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<app-recent-sales-widget />
|
||||
<app-best-selling-widget />
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<app-revenue-stream-widget />
|
||||
<app-notifications-widget />
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class Dashboard {}
|
||||
@@ -1,73 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-documentation',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
template: `
|
||||
<div class="card">
|
||||
<div class="font-semibold text-2xl mb-4">Documentation</div>
|
||||
<div class="font-semibold text-xl mb-4">Get Started</div>
|
||||
<p class="text-lg mb-4">Sakai is an application template for Angular and is distributed as a CLI project. Current versions is Angular v20 with PrimeNG v20. In case CLI is not installed already, use the command below to set it up.</p>
|
||||
<pre class="app-code">
|
||||
<code>npm install -g @angular/cli</code></pre>
|
||||
<p class="text-lg mb-4">
|
||||
Once CLI is ready in your system, extract the contents of the zip file distribution, cd to the directory, install the libraries from npm and then execute "ng serve" to run the application in your local environment.
|
||||
</p>
|
||||
<pre class="app-code">
|
||||
<code>git clone https://github.com/primefaces/sakai-ng
|
||||
npm install
|
||||
ng serve</code></pre>
|
||||
|
||||
<p class="text-lg mb-4">The application should run at <i class="bg-highlight px-2 py-1 rounded-border not-italic text-base">http://localhost:4200/</i> to view the application in your local environment.</p>
|
||||
|
||||
<div class="font-semibold text-xl mb-4">Structure</div>
|
||||
<p class="text-lg mb-4">Templates consists of a couple folders, demos and layout have been separated so that you can easily identify what is necessary for your application.</p>
|
||||
<ul class="leading-normal list-disc pl-8 text-lg mb-4">
|
||||
<li><span class="text-primary font-medium">src/app/layout</span>: Main layout files, needs to be present.</li>
|
||||
<li><span class="text-primary font-medium">src/app/pages</span>: Demo content like Dashboard.</li>
|
||||
<li><span class="text-primary font-medium">src/assets/demo</span>: Assets used in demos</li>
|
||||
<li><span class="text-primary font-medium">src/assets/layout</span>: SCSS files of the main layout</li>
|
||||
</ul>
|
||||
|
||||
<div class="font-semibold text-xl mb-4">Menu</div>
|
||||
<p class="text-lg mb-4">
|
||||
Main menu is defined at <span class="bg-highlight px-2 py-1 rounded-border not-italic text-base">src/app/layout/component/app.menu.ts</span> file. Update the
|
||||
<i class="bg-highlight px-2 py-1 rounded-border not-italic text-base">model</i> property to define your own menu items.
|
||||
</p>
|
||||
|
||||
<div class="font-semibold text-xl mb-4">Layout Service</div>
|
||||
<p class="text-lg mb-4">
|
||||
<span class="bg-highlight px-2 py-1 rounded-border not-italic text-base">src/app/layout/service/layout.service.ts</span> is a service that manages layout state changes, including dark mode, PrimeNG theme, menu modes, and states.
|
||||
</p>
|
||||
|
||||
<div class="font-semibold text-xl mb-4">Tailwind CSS</div>
|
||||
<p class="text-lg mb-4">The demo pages are developed with Tailwind CSS however the core application shell uses custom CSS.</p>
|
||||
|
||||
<div class="font-semibold text-xl mb-4">Variables</div>
|
||||
<p class="text-lg mb-4">
|
||||
CSS variables used in the template are derived from the applied PrimeNG theme. Customize them through the CSS variables in <span class="bg-highlight px-2 py-1 rounded-border not-italic text-base">src/assets/layout/variables</span>.
|
||||
</p>
|
||||
</div>
|
||||
`,
|
||||
styles: `
|
||||
@media screen and (max-width: 991px) {
|
||||
.video-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 56.25%;
|
||||
|
||||
iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
})
|
||||
export class Documentation {}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-empty',
|
||||
standalone: true,
|
||||
template: ` <div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Empty Page</div>
|
||||
<p>Use this page to start from scratch and place your custom content.</p>
|
||||
</div>`
|
||||
})
|
||||
export class Empty {}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { Documentation } from './documentation/documentation';
|
||||
import { Crud } from './crud/crud';
|
||||
import { Empty } from './empty/empty';
|
||||
|
||||
export default [
|
||||
{ path: 'documentation', component: Documentation },
|
||||
{ path: 'crud', component: Crud },
|
||||
{ path: 'empty', component: Empty },
|
||||
{ path: '**', redirectTo: '/notfound' }
|
||||
] as Routes;
|
||||
@@ -1,255 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class CountryService {
|
||||
getData() {
|
||||
return [
|
||||
{ name: 'Afghanistan', code: 'AF' },
|
||||
{ name: 'Albania', code: 'AL' },
|
||||
{ name: 'Algeria', code: 'DZ' },
|
||||
{ name: 'American Samoa', code: 'AS' },
|
||||
{ name: 'Andorra', code: 'AD' },
|
||||
{ name: 'Angola', code: 'AO' },
|
||||
{ name: 'Anguilla', code: 'AI' },
|
||||
{ name: 'Antarctica', code: 'AQ' },
|
||||
{ name: 'Antigua and Barbuda', code: 'AG' },
|
||||
{ name: 'Argentina', code: 'AR' },
|
||||
{ name: 'Armenia', code: 'AM' },
|
||||
{ name: 'Aruba', code: 'AW' },
|
||||
{ name: 'Australia', code: 'AU' },
|
||||
{ name: 'Austria', code: 'AT' },
|
||||
{ name: 'Azerbaijan', code: 'AZ' },
|
||||
{ name: 'Bahamas', code: 'BS' },
|
||||
{ name: 'Bahrain', code: 'BH' },
|
||||
{ name: 'Bangladesh', code: 'BD' },
|
||||
{ name: 'Barbados', code: 'BB' },
|
||||
{ name: 'Belarus', code: 'BY' },
|
||||
{ name: 'Belgium', code: 'BE' },
|
||||
{ name: 'Belize', code: 'BZ' },
|
||||
{ name: 'Benin', code: 'BJ' },
|
||||
{ name: 'Bermuda', code: 'BM' },
|
||||
{ name: 'Bhutan', code: 'BT' },
|
||||
{ name: 'Bolivia', code: 'BO' },
|
||||
{ name: 'Bosnia and Herzegovina', code: 'BA' },
|
||||
{ name: 'Botswana', code: 'BW' },
|
||||
{ name: 'Bouvet Island', code: 'BV' },
|
||||
{ name: 'Brazil', code: 'BR' },
|
||||
{ name: 'British Indian Ocean Territory', code: 'IO' },
|
||||
{ name: 'Brunei Darussalam', code: 'BN' },
|
||||
{ name: 'Bulgaria', code: 'BG' },
|
||||
{ name: 'Burkina Faso', code: 'BF' },
|
||||
{ name: 'Burundi', code: 'BI' },
|
||||
{ name: 'Cambodia', code: 'KH' },
|
||||
{ name: 'Cameroon', code: 'CM' },
|
||||
{ name: 'Canada', code: 'CA' },
|
||||
{ name: 'Cape Verde', code: 'CV' },
|
||||
{ name: 'Cayman Islands', code: 'KY' },
|
||||
{ name: 'Central African Republic', code: 'CF' },
|
||||
{ name: 'Chad', code: 'TD' },
|
||||
{ name: 'Chile', code: 'CL' },
|
||||
{ name: 'China', code: 'CN' },
|
||||
{ name: 'Christmas Island', code: 'CX' },
|
||||
{ name: 'Cocos (Keeling) Islands', code: 'CC' },
|
||||
{ name: 'Colombia', code: 'CO' },
|
||||
{ name: 'Comoros', code: 'KM' },
|
||||
{ name: 'Congo', code: 'CG' },
|
||||
{ name: 'Congo, The Democratic Republic of the', code: 'CD' },
|
||||
{ name: 'Cook Islands', code: 'CK' },
|
||||
{ name: 'Costa Rica', code: 'CR' },
|
||||
{ name: 'Cote D"Ivoire', code: 'CI' },
|
||||
{ name: 'Croatia', code: 'HR' },
|
||||
{ name: 'Cuba', code: 'CU' },
|
||||
{ name: 'Cyprus', code: 'CY' },
|
||||
{ name: 'Czech Republic', code: 'CZ' },
|
||||
{ name: 'Denmark', code: 'DK' },
|
||||
{ name: 'Djibouti', code: 'DJ' },
|
||||
{ name: 'Dominica', code: 'DM' },
|
||||
{ name: 'Dominican Republic', code: 'DO' },
|
||||
{ name: 'Ecuador', code: 'EC' },
|
||||
{ name: 'Egypt', code: 'EG' },
|
||||
{ name: 'El Salvador', code: 'SV' },
|
||||
{ name: 'Equatorial Guinea', code: 'GQ' },
|
||||
{ name: 'Eritrea', code: 'ER' },
|
||||
{ name: 'Estonia', code: 'EE' },
|
||||
{ name: 'Ethiopia', code: 'ET' },
|
||||
{ name: 'Falkland Islands (Malvinas)', code: 'FK' },
|
||||
{ name: 'Faroe Islands', code: 'FO' },
|
||||
{ name: 'Fiji', code: 'FJ' },
|
||||
{ name: 'Finland', code: 'FI' },
|
||||
{ name: 'France', code: 'FR' },
|
||||
{ name: 'French Guiana', code: 'GF' },
|
||||
{ name: 'French Polynesia', code: 'PF' },
|
||||
{ name: 'French Southern Territories', code: 'TF' },
|
||||
{ name: 'Gabon', code: 'GA' },
|
||||
{ name: 'Gambia', code: 'GM' },
|
||||
{ name: 'Georgia', code: 'GE' },
|
||||
{ name: 'Germany', code: 'DE' },
|
||||
{ name: 'Ghana', code: 'GH' },
|
||||
{ name: 'Gibraltar', code: 'GI' },
|
||||
{ name: 'Greece', code: 'GR' },
|
||||
{ name: 'Greenland', code: 'GL' },
|
||||
{ name: 'Grenada', code: 'GD' },
|
||||
{ name: 'Guadeloupe', code: 'GP' },
|
||||
{ name: 'Guam', code: 'GU' },
|
||||
{ name: 'Guatemala', code: 'GT' },
|
||||
{ name: 'Guernsey', code: 'GG' },
|
||||
{ name: 'Guinea', code: 'GN' },
|
||||
{ name: 'Guinea-Bissau', code: 'GW' },
|
||||
{ name: 'Guyana', code: 'GY' },
|
||||
{ name: 'Haiti', code: 'HT' },
|
||||
{ name: 'Heard Island and Mcdonald Islands', code: 'HM' },
|
||||
{ name: 'Holy See (Vatican City State)', code: 'VA' },
|
||||
{ name: 'Honduras', code: 'HN' },
|
||||
{ name: 'Hong Kong', code: 'HK' },
|
||||
{ name: 'Hungary', code: 'HU' },
|
||||
{ name: 'Iceland', code: 'IS' },
|
||||
{ name: 'India', code: 'IN' },
|
||||
{ name: 'Indonesia', code: 'ID' },
|
||||
{ name: 'Iran, Islamic Republic Of', code: 'IR' },
|
||||
{ name: 'Iraq', code: 'IQ' },
|
||||
{ name: 'Ireland', code: 'IE' },
|
||||
{ name: 'Isle of Man', code: 'IM' },
|
||||
{ name: 'Israel', code: 'IL' },
|
||||
{ name: 'Italy', code: 'IT' },
|
||||
{ name: 'Jamaica', code: 'JM' },
|
||||
{ name: 'Japan', code: 'JP' },
|
||||
{ name: 'Jersey', code: 'JE' },
|
||||
{ name: 'Jordan', code: 'JO' },
|
||||
{ name: 'Kazakhstan', code: 'KZ' },
|
||||
{ name: 'Kenya', code: 'KE' },
|
||||
{ name: 'Kiribati', code: 'KI' },
|
||||
{ name: 'Korea, Democratic People"S Republic of', code: 'KP' },
|
||||
{ name: 'Korea, Republic of', code: 'KR' },
|
||||
{ name: 'Kuwait', code: 'KW' },
|
||||
{ name: 'Kyrgyzstan', code: 'KG' },
|
||||
{ name: 'Lao People"S Democratic Republic', code: 'LA' },
|
||||
{ name: 'Latvia', code: 'LV' },
|
||||
{ name: 'Lebanon', code: 'LB' },
|
||||
{ name: 'Lesotho', code: 'LS' },
|
||||
{ name: 'Liberia', code: 'LR' },
|
||||
{ name: 'Libyan Arab Jamahiriya', code: 'LY' },
|
||||
{ name: 'Liechtenstein', code: 'LI' },
|
||||
{ name: 'Lithuania', code: 'LT' },
|
||||
{ name: 'Luxembourg', code: 'LU' },
|
||||
{ name: 'Macao', code: 'MO' },
|
||||
{ name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK' },
|
||||
{ name: 'Madagascar', code: 'MG' },
|
||||
{ name: 'Malawi', code: 'MW' },
|
||||
{ name: 'Malaysia', code: 'MY' },
|
||||
{ name: 'Maldives', code: 'MV' },
|
||||
{ name: 'Mali', code: 'ML' },
|
||||
{ name: 'Malta', code: 'MT' },
|
||||
{ name: 'Marshall Islands', code: 'MH' },
|
||||
{ name: 'Martinique', code: 'MQ' },
|
||||
{ name: 'Mauritania', code: 'MR' },
|
||||
{ name: 'Mauritius', code: 'MU' },
|
||||
{ name: 'Mayotte', code: 'YT' },
|
||||
{ name: 'Mexico', code: 'MX' },
|
||||
{ name: 'Micronesia, Federated States of', code: 'FM' },
|
||||
{ name: 'Moldova, Republic of', code: 'MD' },
|
||||
{ name: 'Monaco', code: 'MC' },
|
||||
{ name: 'Mongolia', code: 'MN' },
|
||||
{ name: 'Montserrat', code: 'MS' },
|
||||
{ name: 'Morocco', code: 'MA' },
|
||||
{ name: 'Mozambique', code: 'MZ' },
|
||||
{ name: 'Myanmar', code: 'MM' },
|
||||
{ name: 'Namibia', code: 'NA' },
|
||||
{ name: 'Nauru', code: 'NR' },
|
||||
{ name: 'Nepal', code: 'NP' },
|
||||
{ name: 'Netherlands', code: 'NL' },
|
||||
{ name: 'Netherlands Antilles', code: 'AN' },
|
||||
{ name: 'New Caledonia', code: 'NC' },
|
||||
{ name: 'New Zealand', code: 'NZ' },
|
||||
{ name: 'Nicaragua', code: 'NI' },
|
||||
{ name: 'Niger', code: 'NE' },
|
||||
{ name: 'Nigeria', code: 'NG' },
|
||||
{ name: 'Niue', code: 'NU' },
|
||||
{ name: 'Norfolk Island', code: 'NF' },
|
||||
{ name: 'Northern Mariana Islands', code: 'MP' },
|
||||
{ name: 'Norway', code: 'NO' },
|
||||
{ name: 'Oman', code: 'OM' },
|
||||
{ name: 'Pakistan', code: 'PK' },
|
||||
{ name: 'Palau', code: 'PW' },
|
||||
{ name: 'Palestinian Territory, Occupied', code: 'PS' },
|
||||
{ name: 'Panama', code: 'PA' },
|
||||
{ name: 'Papua New Guinea', code: 'PG' },
|
||||
{ name: 'Paraguay', code: 'PY' },
|
||||
{ name: 'Peru', code: 'PE' },
|
||||
{ name: 'Philippines', code: 'PH' },
|
||||
{ name: 'Pitcairn', code: 'PN' },
|
||||
{ name: 'Poland', code: 'PL' },
|
||||
{ name: 'Portugal', code: 'PT' },
|
||||
{ name: 'Puerto Rico', code: 'PR' },
|
||||
{ name: 'Qatar', code: 'QA' },
|
||||
{ name: 'Reunion', code: 'RE' },
|
||||
{ name: 'Romania', code: 'RO' },
|
||||
{ name: 'Russian Federation', code: 'RU' },
|
||||
{ name: 'RWANDA', code: 'RW' },
|
||||
{ name: 'Saint Helena', code: 'SH' },
|
||||
{ name: 'Saint Kitts and Nevis', code: 'KN' },
|
||||
{ name: 'Saint Lucia', code: 'LC' },
|
||||
{ name: 'Saint Pierre and Miquelon', code: 'PM' },
|
||||
{ name: 'Saint Vincent and the Grenadines', code: 'VC' },
|
||||
{ name: 'Samoa', code: 'WS' },
|
||||
{ name: 'San Marino', code: 'SM' },
|
||||
{ name: 'Sao Tome and Principe', code: 'ST' },
|
||||
{ name: 'Saudi Arabia', code: 'SA' },
|
||||
{ name: 'Senegal', code: 'SN' },
|
||||
{ name: 'Serbia and Montenegro', code: 'CS' },
|
||||
{ name: 'Seychelles', code: 'SC' },
|
||||
{ name: 'Sierra Leone', code: 'SL' },
|
||||
{ name: 'Singapore', code: 'SG' },
|
||||
{ name: 'Slovakia', code: 'SK' },
|
||||
{ name: 'Slovenia', code: 'SI' },
|
||||
{ name: 'Solomon Islands', code: 'SB' },
|
||||
{ name: 'Somalia', code: 'SO' },
|
||||
{ name: 'South Africa', code: 'ZA' },
|
||||
{ name: 'South Georgia and the South Sandwich Islands', code: 'GS' },
|
||||
{ name: 'Spain', code: 'ES' },
|
||||
{ name: 'Sri Lanka', code: 'LK' },
|
||||
{ name: 'Sudan', code: 'SD' },
|
||||
{ name: 'Suriname', code: 'SR' },
|
||||
{ name: 'Svalbard and Jan Mayen', code: 'SJ' },
|
||||
{ name: 'Swaziland', code: 'SZ' },
|
||||
{ name: 'Sweden', code: 'SE' },
|
||||
{ name: 'Switzerland', code: 'CH' },
|
||||
{ name: 'Syrian Arab Republic', code: 'SY' },
|
||||
{ name: 'Taiwan, Province of China', code: 'TW' },
|
||||
{ name: 'Tajikistan', code: 'TJ' },
|
||||
{ name: 'Tanzania, United Republic of', code: 'TZ' },
|
||||
{ name: 'Thailand', code: 'TH' },
|
||||
{ name: 'Timor-Leste', code: 'TL' },
|
||||
{ name: 'Togo', code: 'TG' },
|
||||
{ name: 'Tokelau', code: 'TK' },
|
||||
{ name: 'Tonga', code: 'TO' },
|
||||
{ name: 'Trinidad and Tobago', code: 'TT' },
|
||||
{ name: 'Tunisia', code: 'TN' },
|
||||
{ name: 'Turkey', code: 'TR' },
|
||||
{ name: 'Turkmenistan', code: 'TM' },
|
||||
{ name: 'Turks and Caicos Islands', code: 'TC' },
|
||||
{ name: 'Tuvalu', code: 'TV' },
|
||||
{ name: 'Uganda', code: 'UG' },
|
||||
{ name: 'Ukraine', code: 'UA' },
|
||||
{ name: 'United Arab Emirates', code: 'AE' },
|
||||
{ name: 'United Kingdom', code: 'GB' },
|
||||
{ name: 'United States', code: 'US' },
|
||||
{ name: 'United States Minor Outlying Islands', code: 'UM' },
|
||||
{ name: 'Uruguay', code: 'UY' },
|
||||
{ name: 'Uzbekistan', code: 'UZ' },
|
||||
{ name: 'Vanuatu', code: 'VU' },
|
||||
{ name: 'Venezuela', code: 'VE' },
|
||||
{ name: 'Viet Nam', code: 'VN' },
|
||||
{ name: 'Virgin Islands, British', code: 'VG' },
|
||||
{ name: 'Virgin Islands, U.S.', code: 'VI' },
|
||||
{ name: 'Wallis and Futuna', code: 'WF' },
|
||||
{ name: 'Western Sahara', code: 'EH' },
|
||||
{ name: 'Yemen', code: 'YE' },
|
||||
{ name: 'Zambia', code: 'ZM' },
|
||||
{ name: 'Zimbabwe', code: 'ZW' }
|
||||
];
|
||||
}
|
||||
|
||||
getCountries() {
|
||||
return Promise.resolve(this.getData());
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class IconService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
icons!: any[];
|
||||
|
||||
selectedIcon: any;
|
||||
|
||||
apiUrl = 'assets/demo/data/icons.json';
|
||||
|
||||
getIcons() {
|
||||
return this.http.get(this.apiUrl).pipe(
|
||||
map((response: any) => {
|
||||
this.icons = response.icons;
|
||||
return this.icons;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,816 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { TreeNode } from 'primeng/api';
|
||||
|
||||
@Injectable()
|
||||
export class NodeService {
|
||||
getTreeNodesData() {
|
||||
return [
|
||||
{
|
||||
key: '0',
|
||||
label: 'Documents',
|
||||
data: 'Documents Folder',
|
||||
icon: 'pi pi-fw pi-inbox',
|
||||
children: [
|
||||
{
|
||||
key: '0-0',
|
||||
label: 'Work',
|
||||
data: 'Work Folder',
|
||||
icon: 'pi pi-fw pi-cog',
|
||||
children: [
|
||||
{ key: '0-0-0', label: 'Expenses.doc', icon: 'pi pi-fw pi-file', data: 'Expenses Document' },
|
||||
{ key: '0-0-1', label: 'Resume.doc', icon: 'pi pi-fw pi-file', data: 'Resume Document' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '0-1',
|
||||
label: 'Home',
|
||||
data: 'Home Folder',
|
||||
icon: 'pi pi-fw pi-home',
|
||||
children: [{ key: '0-1-0', label: 'Invoices.txt', icon: 'pi pi-fw pi-file', data: 'Invoices for this month' }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
label: 'Events',
|
||||
data: 'Events Folder',
|
||||
icon: 'pi pi-fw pi-calendar',
|
||||
children: [
|
||||
{ key: '1-0', label: 'Meeting', icon: 'pi pi-fw pi-calendar-plus', data: 'Meeting' },
|
||||
{ key: '1-1', label: 'Product Launch', icon: 'pi pi-fw pi-calendar-plus', data: 'Product Launch' },
|
||||
{ key: '1-2', label: 'Report Review', icon: 'pi pi-fw pi-calendar-plus', data: 'Report Review' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: 'Movies',
|
||||
data: 'Movies Folder',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
children: [
|
||||
{
|
||||
key: '2-0',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
label: 'Al Pacino',
|
||||
data: 'Pacino Movies',
|
||||
children: [
|
||||
{ key: '2-0-0', label: 'Scarface', icon: 'pi pi-fw pi-video', data: 'Scarface Movie' },
|
||||
{ key: '2-0-1', label: 'Serpico', icon: 'pi pi-fw pi-video', data: 'Serpico Movie' }
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2-1',
|
||||
label: 'Robert De Niro',
|
||||
icon: 'pi pi-fw pi-star-fill',
|
||||
data: 'De Niro Movies',
|
||||
children: [
|
||||
{ key: '2-1-0', label: 'Goodfellas', icon: 'pi pi-fw pi-video', data: 'Goodfellas Movie' },
|
||||
{ key: '2-1-1', label: 'Untouchables', icon: 'pi pi-fw pi-video', data: 'Untouchables Movie' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getTreeTableNodesData() {
|
||||
return [
|
||||
{
|
||||
key: '0',
|
||||
data: {
|
||||
name: 'Applications',
|
||||
size: '100kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '0-0',
|
||||
data: {
|
||||
name: 'Angular',
|
||||
size: '25kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '0-0-0',
|
||||
data: {
|
||||
name: 'angular.app',
|
||||
size: '10kb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-0-1',
|
||||
data: {
|
||||
name: 'native.app',
|
||||
size: '10kb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-0-2',
|
||||
data: {
|
||||
name: 'mobile.app',
|
||||
size: '5kb',
|
||||
type: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '0-1',
|
||||
data: {
|
||||
name: 'editor.app',
|
||||
size: '25kb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '0-2',
|
||||
data: {
|
||||
name: 'settings.app',
|
||||
size: '50kb',
|
||||
type: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
data: {
|
||||
name: 'Cloud',
|
||||
size: '20kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '1-0',
|
||||
data: {
|
||||
name: 'backup-1.zip',
|
||||
size: '10kb',
|
||||
type: 'Zip'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '1-1',
|
||||
data: {
|
||||
name: 'backup-2.zip',
|
||||
size: '10kb',
|
||||
type: 'Zip'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
data: {
|
||||
name: 'Desktop',
|
||||
size: '150kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '2-0',
|
||||
data: {
|
||||
name: 'note-meeting.txt',
|
||||
size: '50kb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '2-1',
|
||||
data: {
|
||||
name: 'note-todo.txt',
|
||||
size: '100kb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
data: {
|
||||
name: 'Documents',
|
||||
size: '75kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-0',
|
||||
data: {
|
||||
name: 'Work',
|
||||
size: '55kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-0-0',
|
||||
data: {
|
||||
name: 'Expenses.doc',
|
||||
size: '30kb',
|
||||
type: 'Document'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '3-0-1',
|
||||
data: {
|
||||
name: 'Resume.doc',
|
||||
size: '25kb',
|
||||
type: 'Resume'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '3-1',
|
||||
data: {
|
||||
name: 'Home',
|
||||
size: '20kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '3-1-0',
|
||||
data: {
|
||||
name: 'Invoices',
|
||||
size: '20kb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '4',
|
||||
data: {
|
||||
name: 'Downloads',
|
||||
size: '25kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-0',
|
||||
data: {
|
||||
name: 'Spanish',
|
||||
size: '10kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-0-0',
|
||||
data: {
|
||||
name: 'tutorial-a1.txt',
|
||||
size: '5kb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '4-0-1',
|
||||
data: {
|
||||
name: 'tutorial-a2.txt',
|
||||
size: '5kb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '4-1',
|
||||
data: {
|
||||
name: 'Travel',
|
||||
size: '15kb',
|
||||
type: 'Text'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '4-1-0',
|
||||
data: {
|
||||
name: 'Hotel.pdf',
|
||||
size: '10kb',
|
||||
type: 'PDF'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '4-1-1',
|
||||
data: {
|
||||
name: 'Flight.pdf',
|
||||
size: '5kb',
|
||||
type: 'PDF'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '5',
|
||||
data: {
|
||||
name: 'Main',
|
||||
size: '50kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '5-0',
|
||||
data: {
|
||||
name: 'bin',
|
||||
size: '50kb',
|
||||
type: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '5-1',
|
||||
data: {
|
||||
name: 'etc',
|
||||
size: '100kb',
|
||||
type: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '5-2',
|
||||
data: {
|
||||
name: 'var',
|
||||
size: '100kb',
|
||||
type: 'Link'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '6',
|
||||
data: {
|
||||
name: 'Other',
|
||||
size: '5kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '6-0',
|
||||
data: {
|
||||
name: 'todo.txt',
|
||||
size: '3kb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '6-1',
|
||||
data: {
|
||||
name: 'logo.png',
|
||||
size: '2kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '7',
|
||||
data: {
|
||||
name: 'Pictures',
|
||||
size: '150kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '7-0',
|
||||
data: {
|
||||
name: 'barcelona.jpg',
|
||||
size: '90kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '7-1',
|
||||
data: {
|
||||
name: 'primeng.png',
|
||||
size: '30kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '7-2',
|
||||
data: {
|
||||
name: 'prime.jpg',
|
||||
size: '30kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: '8',
|
||||
data: {
|
||||
name: 'Videos',
|
||||
size: '1500kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
key: '8-0',
|
||||
data: {
|
||||
name: 'primefaces.mkv',
|
||||
size: '1000kb',
|
||||
type: 'Video'
|
||||
}
|
||||
},
|
||||
{
|
||||
key: '8-1',
|
||||
data: {
|
||||
name: 'intro.avi',
|
||||
size: '500kb',
|
||||
type: 'Video'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getLazyNodesData() {
|
||||
return [
|
||||
{
|
||||
label: 'Lazy Node 0',
|
||||
data: 'Node 0',
|
||||
expandedIcon: 'pi pi-folder-open',
|
||||
collapsedIcon: 'pi pi-folder',
|
||||
leaf: false
|
||||
},
|
||||
{
|
||||
label: 'Lazy Node 1',
|
||||
data: 'Node 1',
|
||||
expandedIcon: 'pi pi-folder-open',
|
||||
collapsedIcon: 'pi pi-folder',
|
||||
leaf: false
|
||||
},
|
||||
{
|
||||
label: 'Lazy Node 1',
|
||||
data: 'Node 2',
|
||||
expandedIcon: 'pi pi-folder-open',
|
||||
collapsedIcon: 'pi pi-folder',
|
||||
leaf: false
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getFileSystemNodesData() {
|
||||
return [
|
||||
{
|
||||
data: {
|
||||
name: 'Applications',
|
||||
size: '200mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Angular',
|
||||
size: '25mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'angular.app',
|
||||
size: '10mb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'cli.app',
|
||||
size: '10mb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'mobile.app',
|
||||
size: '5mb',
|
||||
type: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'editor.app',
|
||||
size: '25mb',
|
||||
type: 'Application'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'settings.app',
|
||||
size: '50mb',
|
||||
type: 'Application'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Cloud',
|
||||
size: '20mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'backup-1.zip',
|
||||
size: '10mb',
|
||||
type: 'Zip'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'backup-2.zip',
|
||||
size: '10mb',
|
||||
type: 'Zip'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Desktop',
|
||||
size: '150kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'note-meeting.txt',
|
||||
size: '50kb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'note-todo.txt',
|
||||
size: '100kb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Documents',
|
||||
size: '75kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Work',
|
||||
size: '55kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Expenses.doc',
|
||||
size: '30kb',
|
||||
type: 'Document'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Resume.doc',
|
||||
size: '25kb',
|
||||
type: 'Resume'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Home',
|
||||
size: '20kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Invoices',
|
||||
size: '20kb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Downloads',
|
||||
size: '25mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Spanish',
|
||||
size: '10mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'tutorial-a1.txt',
|
||||
size: '5mb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'tutorial-a2.txt',
|
||||
size: '5mb',
|
||||
type: 'Text'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Travel',
|
||||
size: '15mb',
|
||||
type: 'Text'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'Hotel.pdf',
|
||||
size: '10mb',
|
||||
type: 'PDF'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Flight.pdf',
|
||||
size: '5mb',
|
||||
type: 'PDF'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Main',
|
||||
size: '50mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'bin',
|
||||
size: '50kb',
|
||||
type: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'etc',
|
||||
size: '100kb',
|
||||
type: 'Link'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'var',
|
||||
size: '100kb',
|
||||
type: 'Link'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Other',
|
||||
size: '5mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'todo.txt',
|
||||
size: '3mb',
|
||||
type: 'Text'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'logo.png',
|
||||
size: '2mb',
|
||||
type: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Pictures',
|
||||
size: '150kb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'barcelona.jpg',
|
||||
size: '90kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'primeng.png',
|
||||
size: '30kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'prime.jpg',
|
||||
size: '30kb',
|
||||
type: 'Picture'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'Videos',
|
||||
size: '1500mb',
|
||||
type: 'Folder'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
name: 'primefaces.mkv',
|
||||
size: '1000mb',
|
||||
type: 'Video'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: {
|
||||
name: 'intro.avi',
|
||||
size: '500mb',
|
||||
type: 'Video'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getDynamicTreeNodes(parentCount: number, childrenCount: number): TreeNode[] {
|
||||
const nodes: TreeNode[] = [];
|
||||
|
||||
for (let parentIndex = 0; parentIndex < parentCount; parentIndex++) {
|
||||
const children: TreeNode[] = [];
|
||||
|
||||
for (let childIndex = 0; childIndex < childrenCount; childIndex++) {
|
||||
children.push({
|
||||
key: `${parentIndex}-${childIndex}`,
|
||||
label: `Child ${parentIndex}-${childIndex}`,
|
||||
selectable: true
|
||||
});
|
||||
}
|
||||
|
||||
nodes.push({
|
||||
key: parentIndex.toString(),
|
||||
label: `Parent ${parentIndex}`,
|
||||
selectable: true,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
getLargeTreeNodes() {
|
||||
return Promise.resolve(this.getDynamicTreeNodes(10, 100));
|
||||
}
|
||||
|
||||
getTreeTableNodes() {
|
||||
return Promise.resolve(this.getTreeTableNodesData());
|
||||
}
|
||||
|
||||
getTreeNodes() {
|
||||
return Promise.resolve(this.getTreeNodesData());
|
||||
}
|
||||
|
||||
getFiles() {
|
||||
return Promise.resolve(this.getTreeNodesData());
|
||||
}
|
||||
|
||||
getLazyFiles() {
|
||||
return Promise.resolve(this.getLazyNodesData());
|
||||
}
|
||||
|
||||
getFilesystem() {
|
||||
return Promise.resolve(this.getFileSystemNodesData());
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class PhotoService {
|
||||
getData() {
|
||||
return [
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria1.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria1s.jpg',
|
||||
alt: 'Description for Image 1',
|
||||
title: 'Title 1'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria2.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria2s.jpg',
|
||||
alt: 'Description for Image 2',
|
||||
title: 'Title 2'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria3.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria3s.jpg',
|
||||
alt: 'Description for Image 3',
|
||||
title: 'Title 3'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria4.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria4s.jpg',
|
||||
alt: 'Description for Image 4',
|
||||
title: 'Title 4'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria5.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria5s.jpg',
|
||||
alt: 'Description for Image 5',
|
||||
title: 'Title 5'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria6.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria6s.jpg',
|
||||
alt: 'Description for Image 6',
|
||||
title: 'Title 6'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria7.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria7s.jpg',
|
||||
alt: 'Description for Image 7',
|
||||
title: 'Title 7'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria8.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria8s.jpg',
|
||||
alt: 'Description for Image 8',
|
||||
title: 'Title 8'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria9.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria9s.jpg',
|
||||
alt: 'Description for Image 9',
|
||||
title: 'Title 9'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria10.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria10s.jpg',
|
||||
alt: 'Description for Image 10',
|
||||
title: 'Title 10'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria11.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria11s.jpg',
|
||||
alt: 'Description for Image 11',
|
||||
title: 'Title 11'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria12.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria12s.jpg',
|
||||
alt: 'Description for Image 12',
|
||||
title: 'Title 12'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria13.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria13s.jpg',
|
||||
alt: 'Description for Image 13',
|
||||
title: 'Title 13'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria14.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria14s.jpg',
|
||||
alt: 'Description for Image 14',
|
||||
title: 'Title 14'
|
||||
},
|
||||
{
|
||||
itemImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria15.jpg',
|
||||
thumbnailImageSrc: 'https://primefaces.org/cdn/primeng/images/galleria/galleria15s.jpg',
|
||||
alt: 'Description for Image 15',
|
||||
title: 'Title 15'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
getImages() {
|
||||
return Promise.resolve(this.getData());
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,192 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { ButtonGroupModule } from 'primeng/buttongroup';
|
||||
import { SplitButtonModule } from 'primeng/splitbutton';
|
||||
|
||||
@Component({
|
||||
selector: 'app-button-demo',
|
||||
standalone: true,
|
||||
imports: [ButtonModule, ButtonGroupModule, SplitButtonModule],
|
||||
template: `<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Default</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Submit"></p-button>
|
||||
<p-button label="Disabled" [disabled]="true"></p-button>
|
||||
<p-button label="Link" class="p-button-link" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Severities</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Primary" />
|
||||
<p-button label="Secondary" severity="secondary" />
|
||||
<p-button label="Success" severity="success" />
|
||||
<p-button label="Info" severity="info" />
|
||||
<p-button label="Warn" severity="warn" />
|
||||
<p-button label="Help" severity="help" />
|
||||
<p-button label="Danger" severity="danger" />
|
||||
<p-button label="Contrast" severity="contrast" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Text</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Primary" text />
|
||||
<p-button label="Secondary" severity="secondary" text />
|
||||
<p-button label="Success" severity="success" text />
|
||||
<p-button label="Info" severity="info" text />
|
||||
<p-button label="Warn" severity="warn" text />
|
||||
<p-button label="Help" severity="help" text />
|
||||
<p-button label="Danger" severity="danger" text />
|
||||
<p-button label="Plain" text />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Outlined</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Primary" outlined />
|
||||
<p-button label="Secondary" severity="secondary" outlined />
|
||||
<p-button label="Success" severity="success" outlined />
|
||||
<p-button label="Info" severity="info" outlined />
|
||||
<p-button label="warn" severity="warn" outlined />
|
||||
<p-button label="Help" severity="help" outlined />
|
||||
<p-button label="Danger" severity="danger" outlined />
|
||||
<p-button label="Contrast" severity="contrast" outlined />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Group</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-buttongroup>
|
||||
<p-button label="Save" icon="pi pi-check" />
|
||||
<p-button label="Delete" icon="pi pi-trash" />
|
||||
<p-button label="Cancel" icon="pi pi-times" />
|
||||
</p-buttongroup>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">SplitButton</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-splitbutton label="Save" [model]="items"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="secondary"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="success"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="info"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="warn"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="help"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="danger"></p-splitbutton>
|
||||
<p-splitbutton label="Save" [model]="items" severity="contrast"></p-splitbutton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Templating</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button type="button">
|
||||
<img alt="logo" src="https://primefaces.org/cdn/primeng/images/logo.svg" style="width: 1.5rem" />
|
||||
</p-button>
|
||||
<p-button type="button" outlined severity="success">
|
||||
<img alt="logo" src="https://primefaces.org/cdn/primeng/images/logo.svg" style="width: 1.5rem" />
|
||||
<span class="text-bold">PrimeNG</span>
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Icons</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button icon="pi pi-bookmark"></p-button>
|
||||
<p-button label="Bookmark" icon="pi pi-bookmark"></p-button>
|
||||
<p-button label="Bookmark" icon="pi pi-bookmark" iconPos="right"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Raised</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Primary" raised />
|
||||
<p-button label="Secondary" severity="secondary" raised />
|
||||
<p-button label="Success" severity="success" raised />
|
||||
<p-button label="Info" severity="info" raised />
|
||||
<p-button label="Warn" severity="warn" raised />
|
||||
<p-button label="Help" severity="help" raised />
|
||||
<p-button label="Danger" severity="danger" raised />
|
||||
<p-button label="Contrast" severity="contrast" raised />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Rounded</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button label="Primary" rounded />
|
||||
<p-button label="Secondary" severity="secondary" rounded />
|
||||
<p-button label="Success" severity="success" rounded />
|
||||
<p-button label="Info" severity="info" rounded />
|
||||
<p-button label="Warn" severity="warn" rounded />
|
||||
<p-button label="Help" severity="help" rounded />
|
||||
<p-button label="Danger" severity="danger" rounded />
|
||||
<p-button label="Contrast" severity="contrast" rounded />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Rounded Icons</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button icon="pi pi-check" rounded />
|
||||
<p-button icon="pi pi-bookmark" severity="secondary" rounded />
|
||||
<p-button icon="pi pi-search" severity="success" rounded />
|
||||
<p-button icon="pi pi-user" severity="info" rounded />
|
||||
<p-button icon="pi pi-bell" severity="warn" rounded />
|
||||
<p-button icon="pi pi-heart" severity="help" rounded />
|
||||
<p-button icon="pi pi-times" severity="danger" rounded />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Rounded Text</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button icon="pi pi-check" text raised rounded />
|
||||
<p-button icon="pi pi-bookmark" severity="secondary" text raised rounded />
|
||||
<p-button icon="pi pi-search" severity="success" text raised rounded />
|
||||
<p-button icon="pi pi-user" severity="info" text raised rounded />
|
||||
<p-button icon="pi pi-bell" severity="warn" text raised rounded />
|
||||
<p-button icon="pi pi-heart" severity="help" text raised rounded />
|
||||
<p-button icon="pi pi-times" severity="danger" text raised rounded />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Rounded Outlined</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button icon="pi pi-check" rounded outlined />
|
||||
<p-button icon="pi pi-bookmark" severity="secondary" rounded outlined />
|
||||
<p-button icon="pi pi-search" severity="success" rounded outlined />
|
||||
<p-button icon="pi pi-user" severity="info" rounded outlined />
|
||||
<p-button icon="pi pi-bell" severity="warn" rounded outlined />
|
||||
<p-button icon="pi pi-heart" severity="help" rounded outlined />
|
||||
<p-button icon="pi pi-times" severity="danger" rounded outlined />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Loading</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button type="button" label="Search" icon="pi pi-search" [loading]="loading[0]" (click)="load(0)" />
|
||||
<p-button type="button" label="Search" icon="pi pi-search" iconPos="right" [loading]="loading[1]" (click)="load(1)" />
|
||||
<p-button type="button" styleClass="h-full" icon="pi pi-search" [loading]="loading[2]" (click)="load(2)" />
|
||||
<p-button type="button" label="Search" [loading]="loading[3]" (click)="load(3)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> `
|
||||
})
|
||||
export class ButtonDemo implements OnInit {
|
||||
items: MenuItem[] = [];
|
||||
|
||||
loading = [false, false, false, false];
|
||||
|
||||
ngOnInit() {
|
||||
this.items = [{ label: 'Update', icon: 'pi pi-refresh' }, { label: 'Delete', icon: 'pi pi-times' }, { label: 'Angular.io', icon: 'pi pi-info', url: 'http://angular.io' }, { separator: true }, { label: 'Setup', icon: 'pi pi-cog' }];
|
||||
}
|
||||
|
||||
load(index: number) {
|
||||
this.loading[index] = true;
|
||||
setTimeout(() => (this.loading[index] = false), 1000);
|
||||
}
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { ChartModule } from 'primeng/chart';
|
||||
import { FluidModule } from 'primeng/fluid';
|
||||
import { debounceTime, Subscription } from 'rxjs';
|
||||
import { LayoutService } from '../../layout/service/layout.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chart-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ChartModule, FluidModule],
|
||||
template: `
|
||||
<p-fluid class="grid grid-cols-12 gap-8">
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Linear</div>
|
||||
<p-chart type="line" [data]="lineData" [options]="lineOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Bar</div>
|
||||
<p-chart type="bar" [data]="barData" [options]="barOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card flex flex-col items-center">
|
||||
<div class="font-semibold text-xl mb-4">Pie</div>
|
||||
<p-chart type="pie" [data]="pieData" [options]="pieOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card flex flex-col items-center">
|
||||
<div class="font-semibold text-xl mb-4">Doughnut</div>
|
||||
<p-chart type="doughnut" [data]="pieData" [options]="pieOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card flex flex-col items-center">
|
||||
<div class="font-semibold text-xl mb-4">Polar Area</div>
|
||||
<p-chart type="polarArea" [data]="polarData" [options]="polarOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 xl:col-span-6">
|
||||
<div class="card flex flex-col items-center">
|
||||
<div class="font-semibold text-xl mb-4">Radar</div>
|
||||
<p-chart type="radar" [data]="radarData" [options]="radarOptions"></p-chart>
|
||||
</div>
|
||||
</div>
|
||||
</p-fluid>
|
||||
`
|
||||
})
|
||||
export class ChartDemo {
|
||||
lineData: any;
|
||||
|
||||
barData: any;
|
||||
|
||||
pieData: any;
|
||||
|
||||
polarData: any;
|
||||
|
||||
radarData: any;
|
||||
|
||||
lineOptions: any;
|
||||
|
||||
barOptions: any;
|
||||
|
||||
pieOptions: any;
|
||||
|
||||
polarOptions: any;
|
||||
|
||||
radarOptions: any;
|
||||
|
||||
subscription: Subscription;
|
||||
constructor(private layoutService: LayoutService) {
|
||||
this.subscription = this.layoutService.configUpdate$.pipe(debounceTime(25)).subscribe(() => {
|
||||
this.initCharts();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.initCharts();
|
||||
}
|
||||
|
||||
initCharts() {
|
||||
const documentStyle = getComputedStyle(document.documentElement);
|
||||
const textColor = documentStyle.getPropertyValue('--text-color');
|
||||
const textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary');
|
||||
const surfaceBorder = documentStyle.getPropertyValue('--surface-border');
|
||||
|
||||
this.barData = {
|
||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'My First dataset',
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-500'),
|
||||
borderColor: documentStyle.getPropertyValue('--p-primary-500'),
|
||||
data: [65, 59, 80, 81, 56, 55, 40]
|
||||
},
|
||||
{
|
||||
label: 'My Second dataset',
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-200'),
|
||||
borderColor: documentStyle.getPropertyValue('--p-primary-200'),
|
||||
data: [28, 48, 40, 19, 86, 27, 90]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.barOptions = {
|
||||
maintainAspectRatio: false,
|
||||
aspectRatio: 0.8,
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
ticks: {
|
||||
color: textColorSecondary,
|
||||
font: {
|
||||
weight: 500
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
display: false,
|
||||
drawBorder: false
|
||||
}
|
||||
},
|
||||
y: {
|
||||
ticks: {
|
||||
color: textColorSecondary
|
||||
},
|
||||
grid: {
|
||||
color: surfaceBorder,
|
||||
drawBorder: false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.pieData = {
|
||||
labels: ['A', 'B', 'C'],
|
||||
datasets: [
|
||||
{
|
||||
data: [540, 325, 702],
|
||||
backgroundColor: [documentStyle.getPropertyValue('--p-indigo-500'), documentStyle.getPropertyValue('--p-purple-500'), documentStyle.getPropertyValue('--p-teal-500')],
|
||||
hoverBackgroundColor: [documentStyle.getPropertyValue('--p-indigo-400'), documentStyle.getPropertyValue('--p-purple-400'), documentStyle.getPropertyValue('--p-teal-400')]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.pieOptions = {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
usePointStyle: true,
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.lineData = {
|
||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'First Dataset',
|
||||
data: [65, 59, 80, 81, 56, 55, 40],
|
||||
fill: false,
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-500'),
|
||||
borderColor: documentStyle.getPropertyValue('--p-primary-500'),
|
||||
tension: 0.4
|
||||
},
|
||||
{
|
||||
label: 'Second Dataset',
|
||||
data: [28, 48, 40, 19, 86, 27, 90],
|
||||
fill: false,
|
||||
backgroundColor: documentStyle.getPropertyValue('--p-primary-200'),
|
||||
borderColor: documentStyle.getPropertyValue('--p-primary-200'),
|
||||
tension: 0.4
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.lineOptions = {
|
||||
maintainAspectRatio: false,
|
||||
aspectRatio: 0.8,
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
ticks: {
|
||||
color: textColorSecondary
|
||||
},
|
||||
grid: {
|
||||
color: surfaceBorder,
|
||||
drawBorder: false
|
||||
}
|
||||
},
|
||||
y: {
|
||||
ticks: {
|
||||
color: textColorSecondary
|
||||
},
|
||||
grid: {
|
||||
color: surfaceBorder,
|
||||
drawBorder: false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.polarData = {
|
||||
datasets: [
|
||||
{
|
||||
data: [11, 16, 7, 3],
|
||||
backgroundColor: [documentStyle.getPropertyValue('--p-indigo-500'), documentStyle.getPropertyValue('--p-purple-500'), documentStyle.getPropertyValue('--p-teal-500'), documentStyle.getPropertyValue('--p-orange-500')],
|
||||
label: 'My dataset'
|
||||
}
|
||||
],
|
||||
labels: ['Indigo', 'Purple', 'Teal', 'Orange']
|
||||
};
|
||||
|
||||
this.polarOptions = {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
r: {
|
||||
grid: {
|
||||
color: surfaceBorder,
|
||||
},
|
||||
ticks: {
|
||||
display: false,
|
||||
color: textColorSecondary
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
this.radarData = {
|
||||
labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'My First dataset',
|
||||
borderColor: documentStyle.getPropertyValue('--p-indigo-400'),
|
||||
pointBackgroundColor: documentStyle.getPropertyValue('--p-indigo-400'),
|
||||
pointBorderColor: documentStyle.getPropertyValue('--p-indigo-400'),
|
||||
pointHoverBackgroundColor: textColor,
|
||||
pointHoverBorderColor: documentStyle.getPropertyValue('--p-indigo-400'),
|
||||
data: [65, 59, 90, 81, 56, 55, 40]
|
||||
},
|
||||
{
|
||||
label: 'My Second dataset',
|
||||
borderColor: documentStyle.getPropertyValue('--p-purple-400'),
|
||||
pointBackgroundColor: documentStyle.getPropertyValue('--p-purple-400'),
|
||||
pointBorderColor: documentStyle.getPropertyValue('--p-purple-400'),
|
||||
pointHoverBackgroundColor: textColor,
|
||||
pointHoverBorderColor: documentStyle.getPropertyValue('--p-purple-400'),
|
||||
data: [28, 48, 40, 19, 96, 27, 100]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.radarOptions = {
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
r: {
|
||||
pointLabels: {
|
||||
color: textColor
|
||||
},
|
||||
grid: {
|
||||
color: surfaceBorder
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { FileUploadModule } from 'primeng/fileupload';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
|
||||
@Component({
|
||||
selector: 'app-file-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FileUploadModule, ToastModule, ButtonModule],
|
||||
template: `<p-toast />
|
||||
<div class="grid grid-cols-12 gap-8">
|
||||
<div class="col-span-full lg:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Advanced</div>
|
||||
<p-fileupload name="demo[]" (onUpload)="onUpload($event)" [multiple]="true" accept="image/*" maxFileSize="1000000" mode="advanced" url="https://www.primefaces.org/cdn/api/upload.php">
|
||||
<ng-template #empty>
|
||||
<div>Drag and drop files to here to upload.</div>
|
||||
</ng-template>
|
||||
</p-fileupload>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-full lg:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Basic</div>
|
||||
<div class="flex flex-col gap-4 items-center justify-center">
|
||||
<p-fileupload #fu mode="basic" chooseLabel="Choose" chooseIcon="pi pi-upload" name="demo[]" url="https://www.primefaces.org/cdn/api/upload.php" accept="image/*" maxFileSize="1000000" (onUpload)="onUpload($event)" />
|
||||
<p-button label="Upload" (onClick)="fu.upload()" severity="secondary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
providers: [MessageService]
|
||||
})
|
||||
export class FileDemo {
|
||||
uploadedFiles: any[] = [];
|
||||
|
||||
constructor(private messageService: MessageService) {}
|
||||
|
||||
onUpload(event: any) {
|
||||
for (const file of event.files) {
|
||||
this.uploadedFiles.push(file);
|
||||
}
|
||||
|
||||
this.messageService.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded' });
|
||||
}
|
||||
|
||||
onBasicUpload() {
|
||||
this.messageService.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded with Basic Mode' });
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FluidModule } from 'primeng/fluid';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { SelectModule } from 'primeng/select';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { TextareaModule } from 'primeng/textarea';
|
||||
|
||||
@Component({
|
||||
selector: 'app-formlayout-demo',
|
||||
standalone: true,
|
||||
imports: [InputTextModule, FluidModule, ButtonModule, SelectModule, FormsModule, TextareaModule],
|
||||
template: `<p-fluid>
|
||||
<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Vertical</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="name1">Name</label>
|
||||
<input pInputText id="name1" type="text" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="email1">Email</label>
|
||||
<input pInputText id="email1" type="text" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="age1">Age</label>
|
||||
<input pInputText id="age1" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Vertical Grid</div>
|
||||
<div class="flex flex-wrap gap-6">
|
||||
<div class="flex flex-col grow basis-0 gap-2">
|
||||
<label for="name2">Name</label>
|
||||
<input pInputText id="name2" type="text" />
|
||||
</div>
|
||||
<div class="flex flex-col grow basis-0 gap-2">
|
||||
<label for="email2">Email</label>
|
||||
<input pInputText id="email2" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Horizontal</div>
|
||||
<div class="grid grid-cols-12 gap-4 grid-cols-12 gap-2">
|
||||
<label for="name3" class="flex items-center col-span-12 mb-2 md:col-span-2 md:mb-0">Name</label>
|
||||
<div class="col-span-12 md:col-span-10">
|
||||
<input pInputText id="name3" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-12 gap-4 grid-cols-12 gap-2">
|
||||
<label for="email3" class="flex items-center col-span-12 mb-2 md:col-span-2 md:mb-0">Email</label>
|
||||
<div class="col-span-12 md:col-span-10">
|
||||
<input pInputText id="email3" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Inline</div>
|
||||
<div class="flex flex-wrap items-start gap-6">
|
||||
<div class="field">
|
||||
<label for="firstname1" class="sr-only">Firstname</label>
|
||||
<input pInputText id="firstname1" type="text" placeholder="Firstname" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="lastname1" class="sr-only">Lastname</label>
|
||||
<input pInputText id="lastname1" type="text" placeholder="Lastname" />
|
||||
</div>
|
||||
<p-button label="Submit" [fluid]="false"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Help Text</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<label for="username">Username</label>
|
||||
<input pInputText id="username" type="text" />
|
||||
<small>Enter your username to reset your password.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex mt-8">
|
||||
<div class="card flex flex-col gap-6 w-full">
|
||||
<div class="font-semibold text-xl">Advanced</div>
|
||||
<div class="flex flex-col md:flex-row gap-6">
|
||||
<div class="flex flex-wrap gap-2 w-full">
|
||||
<label for="firstname2">Firstname</label>
|
||||
<input pInputText id="firstname2" type="text" />
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 w-full">
|
||||
<label for="lastname2">Lastname</label>
|
||||
<input pInputText id="lastname2" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap">
|
||||
<label for="address">Address</label>
|
||||
<textarea pTextarea id="address" rows="4"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-6">
|
||||
<div class="flex flex-wrap gap-2 w-full">
|
||||
<label for="state">State</label>
|
||||
<p-select id="state" [(ngModel)]="dropdownItem" [options]="dropdownItems" optionLabel="name" placeholder="Select One" class="w-full"></p-select>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 w-full">
|
||||
<label for="zip">Zip</label>
|
||||
<input pInputText id="zip" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p-fluid>`
|
||||
})
|
||||
export class FormLayoutDemo {
|
||||
dropdownItems = [
|
||||
{ name: 'Option 1', code: 'Option 1' },
|
||||
{ name: 'Option 2', code: 'Option 2' },
|
||||
{ name: 'Option 3', code: 'Option 3' }
|
||||
];
|
||||
|
||||
dropdownItem = null;
|
||||
}
|
||||
@@ -1,339 +0,0 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CheckboxModule } from 'primeng/checkbox';
|
||||
import { RadioButtonModule } from 'primeng/radiobutton';
|
||||
import { SelectButtonModule } from 'primeng/selectbutton';
|
||||
import { InputGroupModule } from 'primeng/inputgroup';
|
||||
import { FluidModule } from 'primeng/fluid';
|
||||
import { IconFieldModule } from 'primeng/iconfield';
|
||||
import { InputIconModule } from 'primeng/inputicon';
|
||||
import { FloatLabelModule } from 'primeng/floatlabel';
|
||||
import { AutoCompleteCompleteEvent, AutoCompleteModule } from 'primeng/autocomplete';
|
||||
import { InputNumberModule } from 'primeng/inputnumber';
|
||||
import { SliderModule } from 'primeng/slider';
|
||||
import { RatingModule } from 'primeng/rating';
|
||||
import { ColorPickerModule } from 'primeng/colorpicker';
|
||||
import { KnobModule } from 'primeng/knob';
|
||||
import { SelectModule } from 'primeng/select';
|
||||
import { DatePickerModule } from 'primeng/datepicker';
|
||||
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
||||
import { TreeSelectModule } from 'primeng/treeselect';
|
||||
import { MultiSelectModule } from 'primeng/multiselect';
|
||||
import { ListboxModule } from 'primeng/listbox';
|
||||
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
||||
import { TextareaModule } from 'primeng/textarea';
|
||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
||||
import { CountryService } from '../service/country.service';
|
||||
import { NodeService } from '../service/node.service';
|
||||
import { TreeNode } from 'primeng/api';
|
||||
import { Country } from '../service/customer.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-input-demo',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
InputTextModule,
|
||||
ButtonModule,
|
||||
CheckboxModule,
|
||||
RadioButtonModule,
|
||||
SelectButtonModule,
|
||||
InputGroupModule,
|
||||
FluidModule,
|
||||
IconFieldModule,
|
||||
InputIconModule,
|
||||
FloatLabelModule,
|
||||
AutoCompleteModule,
|
||||
InputNumberModule,
|
||||
SliderModule,
|
||||
RatingModule,
|
||||
ColorPickerModule,
|
||||
KnobModule,
|
||||
SelectModule,
|
||||
DatePickerModule,
|
||||
ToggleButtonModule,
|
||||
ToggleSwitchModule,
|
||||
TreeSelectModule,
|
||||
MultiSelectModule,
|
||||
ListboxModule,
|
||||
InputGroupAddonModule,
|
||||
TextareaModule
|
||||
],
|
||||
template: ` <p-fluid class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">InputText</div>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<input pInputText type="text" placeholder="Default" />
|
||||
<input pInputText type="text" placeholder="Disabled" [disabled]="true" />
|
||||
<input pInputText type="text" placeholder="Invalid" class="ng-dirty ng-invalid" />
|
||||
</div>
|
||||
|
||||
<div class="font-semibold text-xl">Icons</div>
|
||||
<p-iconfield>
|
||||
<p-inputicon class="pi pi-user" />
|
||||
<input pInputText type="text" placeholder="Username" />
|
||||
</p-iconfield>
|
||||
<p-iconfield iconPosition="left">
|
||||
<input pInputText type="text" placeholder="Search" />
|
||||
<p-inputicon class="pi pi-search" />
|
||||
</p-iconfield>
|
||||
|
||||
<div class="font-semibold text-xl">Float Label</div>
|
||||
<p-floatlabel>
|
||||
<input pInputText id="username" type="text" [(ngModel)]="floatValue" />
|
||||
<label for="username">Username</label>
|
||||
</p-floatlabel>
|
||||
|
||||
<div class="font-semibold text-xl">Textarea</div>
|
||||
<textarea pTextarea placeholder="Your Message" [autoResize]="true" rows="3" cols="30"></textarea>
|
||||
|
||||
<div class="font-semibold text-xl">AutoComplete</div>
|
||||
<p-autocomplete [(ngModel)]="selectedAutoValue" [suggestions]="autoFilteredValue" optionLabel="name" placeholder="Search" dropdown multiple display="chip" (completeMethod)="filterCountry($event)" />
|
||||
|
||||
<div class="font-semibold text-xl">DatePicker</div>
|
||||
<p-datepicker [showIcon]="true" [showButtonBar]="true" [(ngModel)]="calendarValue"></p-datepicker>
|
||||
|
||||
<div class="font-semibold text-xl">InputNumber</div>
|
||||
<p-inputnumber [(ngModel)]="inputNumberValue" showButtons mode="decimal"></p-inputnumber>
|
||||
</div>
|
||||
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Slider</div>
|
||||
<input pInputText [(ngModel)]="sliderValue" type="number" />
|
||||
<p-slider [(ngModel)]="sliderValue" />
|
||||
|
||||
<div class="flex flex-row mt-6">
|
||||
<div class="flex flex-col gap-4 w-1/2">
|
||||
<div class="font-semibold text-xl">Rating</div>
|
||||
<p-rating [(ngModel)]="ratingValue" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-4 w-1/2">
|
||||
<div class="font-semibold text-xl">ColorPicker</div>
|
||||
<p-colorpicker [style]="{ width: '2rem' }" [(ngModel)]="colorValue" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold text-xl">Knob</div>
|
||||
<p-knob [(ngModel)]="knobValue" [step]="10" [min]="-50" [max]="50" valueTemplate="{value}%" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">RadioButton</div>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex items-center">
|
||||
<p-radiobutton id="option1" name="option" value="Chicago" [(ngModel)]="radioValue" />
|
||||
<label for="option1" class="leading-none ml-2">Chicago</label>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<p-radiobutton id="option2" name="option" value="Los Angeles" [(ngModel)]="radioValue" />
|
||||
<label for="option2" class="leading-none ml-2">Los Angeles</label>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<p-radiobutton id="option3" name="option" value="New York" [(ngModel)]="radioValue" />
|
||||
<label for="option3" class="leading-none ml-2">New York</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold text-xl">Checkbox</div>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex items-center">
|
||||
<p-checkbox id="checkOption1" name="option" value="Chicago" [(ngModel)]="checkboxValue" />
|
||||
<label for="checkOption1" class="ml-2">Chicago</label>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<p-checkbox id="checkOption2" name="option" value="Los Angeles" [(ngModel)]="checkboxValue" />
|
||||
<label for="checkOption2" class="ml-2">Los Angeles</label>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<p-checkbox id="checkOption3" name="option" value="New York" [(ngModel)]="checkboxValue" />
|
||||
<label for="checkOption3" class="ml-2">New York</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold text-xl">ToggleSwitch</div>
|
||||
<p-toggleswitch [(ngModel)]="switchValue" />
|
||||
</div>
|
||||
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">Listbox</div>
|
||||
<p-listbox [(ngModel)]="listboxValue" [options]="listboxValues" optionLabel="name" [filter]="true" />
|
||||
|
||||
<div class="font-semibold text-xl">Select</div>
|
||||
<p-select [(ngModel)]="dropdownValue" [options]="dropdownValues" optionLabel="name" placeholder="Select" />
|
||||
|
||||
<div class="font-semibold text-xl">MultiSelect</div>
|
||||
<p-multiselect [options]="multiselectCountries" [(ngModel)]="multiselectSelectedCountries" placeholder="Select Countries" optionLabel="name" display="chip" [filter]="true">
|
||||
<ng-template #selecteditems let-countries>
|
||||
@for (country of countries; track country.code) {
|
||||
<div class="inline-flex items-center py-1 px-2 bg-primary text-primary-contrast rounded-border mr-2">
|
||||
<span [class]="'mr-2 flag flag-' + country.code.toLowerCase()" style="width: 18px; height: 12px"></span>
|
||||
<div>{{ country.name }}</div>
|
||||
</div>
|
||||
}
|
||||
</ng-template>
|
||||
<ng-template #item let-country>
|
||||
<div class="flex items-center">
|
||||
<span [class]="'mr-2 flag flag-' + country.code.toLowerCase()" style="width: 18px; height: 12px"></span>
|
||||
<div>{{ country.name }}</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-multiselect>
|
||||
|
||||
<div class="font-semibold text-xl">TreeSelect</div>
|
||||
<p-treeselect [(ngModel)]="selectedNode" [options]="treeSelectNodes" placeholder="Select Item"></p-treeselect>
|
||||
</div>
|
||||
|
||||
<div class="card flex flex-col gap-4">
|
||||
<div class="font-semibold text-xl">ToggleButton</div>
|
||||
<p-togglebutton [(ngModel)]="toggleValue" onLabel="Yes" offLabel="No" [style]="{ width: '10em' }" />
|
||||
|
||||
<div class="font-semibold text-xl">SelectButton</div>
|
||||
<p-selectbutton [(ngModel)]="selectButtonValue" [options]="selectButtonValues" optionLabel="name" />
|
||||
</div>
|
||||
</div>
|
||||
</p-fluid>
|
||||
|
||||
<p-fluid class="flex mt-8">
|
||||
<div class="card flex flex-col gap-6 w-full">
|
||||
<div class="font-semibold text-xl">InputGroup</div>
|
||||
<div class="flex flex-col md:flex-row gap-6">
|
||||
<p-inputgroup>
|
||||
<p-inputgroup-addon>
|
||||
<i class="pi pi-user"></i>
|
||||
</p-inputgroup-addon>
|
||||
<input pInputText placeholder="Username" />
|
||||
</p-inputgroup>
|
||||
<p-inputgroup>
|
||||
<p-inputgroup-addon>
|
||||
<i class="pi pi-clock"></i>
|
||||
</p-inputgroup-addon>
|
||||
<p-inputgroup-addon>
|
||||
<i class="pi pi-star-fill"></i>
|
||||
</p-inputgroup-addon>
|
||||
<p-inputnumber placeholder="Price" />
|
||||
<p-inputgroup-addon>$</p-inputgroup-addon>
|
||||
<p-inputgroup-addon>.00</p-inputgroup-addon>
|
||||
</p-inputgroup>
|
||||
</div>
|
||||
<div class="flex flex-col md:flex-row gap-6">
|
||||
<p-inputgroup>
|
||||
<p-button label="Search" />
|
||||
<input pInputText placeholder="Keyword" />
|
||||
</p-inputgroup>
|
||||
<p-inputgroup>
|
||||
<p-inputgroup-addon>
|
||||
<p-checkbox [(ngModel)]="inputGroupValue" [binary]="true" />
|
||||
</p-inputgroup-addon>
|
||||
<input pInputText placeholder="Confirm" />
|
||||
</p-inputgroup>
|
||||
</div>
|
||||
</div>
|
||||
</p-fluid>`,
|
||||
providers: [CountryService, NodeService]
|
||||
})
|
||||
export class InputDemo implements OnInit {
|
||||
floatValue: any = null;
|
||||
|
||||
autoValue: any[] | undefined;
|
||||
|
||||
autoFilteredValue: any[] = [];
|
||||
|
||||
selectedAutoValue: any = null;
|
||||
|
||||
calendarValue: any = null;
|
||||
|
||||
inputNumberValue: any = null;
|
||||
|
||||
sliderValue: number = 50;
|
||||
|
||||
ratingValue: any = null;
|
||||
|
||||
colorValue: string = '#1976D2';
|
||||
|
||||
radioValue: any = null;
|
||||
|
||||
checkboxValue: any[] = [];
|
||||
|
||||
switchValue: boolean = false;
|
||||
|
||||
listboxValues: any[] = [
|
||||
{ name: 'New York', code: 'NY' },
|
||||
{ name: 'Rome', code: 'RM' },
|
||||
{ name: 'London', code: 'LDN' },
|
||||
{ name: 'Istanbul', code: 'IST' },
|
||||
{ name: 'Paris', code: 'PRS' }
|
||||
];
|
||||
|
||||
listboxValue: any = null;
|
||||
|
||||
dropdownValues = [
|
||||
{ name: 'New York', code: 'NY' },
|
||||
{ name: 'Rome', code: 'RM' },
|
||||
{ name: 'London', code: 'LDN' },
|
||||
{ name: 'Istanbul', code: 'IST' },
|
||||
{ name: 'Paris', code: 'PRS' }
|
||||
];
|
||||
|
||||
dropdownValue: any = null;
|
||||
|
||||
multiselectCountries: Country[] = [
|
||||
{ name: 'Australia', code: 'AU' },
|
||||
{ name: 'Brazil', code: 'BR' },
|
||||
{ name: 'China', code: 'CN' },
|
||||
{ name: 'Egypt', code: 'EG' },
|
||||
{ name: 'France', code: 'FR' },
|
||||
{ name: 'Germany', code: 'DE' },
|
||||
{ name: 'India', code: 'IN' },
|
||||
{ name: 'Japan', code: 'JP' },
|
||||
{ name: 'Spain', code: 'ES' },
|
||||
{ name: 'United States', code: 'US' }
|
||||
];
|
||||
|
||||
multiselectSelectedCountries!: Country[];
|
||||
|
||||
toggleValue: boolean = false;
|
||||
|
||||
selectButtonValue: any = null;
|
||||
|
||||
selectButtonValues: any = [{ name: 'Option 1' }, { name: 'Option 2' }, { name: 'Option 3' }];
|
||||
|
||||
knobValue: number = 50;
|
||||
|
||||
inputGroupValue: boolean = false;
|
||||
|
||||
treeSelectNodes!: TreeNode[];
|
||||
|
||||
selectedNode: any = null;
|
||||
|
||||
countryService = inject(CountryService);
|
||||
|
||||
nodeService = inject(NodeService);
|
||||
|
||||
ngOnInit() {
|
||||
this.countryService.getCountries().then((countries) => {
|
||||
this.autoValue = countries;
|
||||
});
|
||||
|
||||
this.nodeService.getFiles().then((data) => (this.treeSelectNodes = data));
|
||||
}
|
||||
|
||||
filterCountry(event: AutoCompleteCompleteEvent) {
|
||||
const filtered: any[] = [];
|
||||
const query = event.query;
|
||||
|
||||
for (let i = 0; i < (this.autoValue as any[]).length; i++) {
|
||||
const country = (this.autoValue as any[])[i];
|
||||
if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
||||
filtered.push(country);
|
||||
}
|
||||
}
|
||||
|
||||
this.autoFilteredValue = filtered;
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { DataViewModule } from 'primeng/dataview';
|
||||
import { OrderListModule } from 'primeng/orderlist';
|
||||
import { PickListModule } from 'primeng/picklist';
|
||||
import { SelectButtonModule } from 'primeng/selectbutton';
|
||||
import { TagModule } from 'primeng/tag';
|
||||
import { Product, ProductService } from '../service/product.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, DataViewModule, FormsModule, SelectButtonModule, PickListModule, OrderListModule, TagModule, ButtonModule],
|
||||
template: ` <div class="flex flex-col">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl">DataView</div>
|
||||
<p-dataview [value]="products" [layout]="layout">
|
||||
<ng-template #header>
|
||||
<div class="flex justify-end">
|
||||
<p-select-button [(ngModel)]="layout" [options]="options" [allowEmpty]="false">
|
||||
<ng-template #item let-option>
|
||||
<i class="pi " [ngClass]="{ 'pi-bars': option === 'list', 'pi-table': option === 'grid' }"></i>
|
||||
</ng-template>
|
||||
</p-select-button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #list let-items>
|
||||
<div class="flex flex-col">
|
||||
<div *ngFor="let item of items; let i = index">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4" [ngClass]="{ 'border-t border-surface': i !== 0 }">
|
||||
<div class="md:w-40 relative">
|
||||
<img class="block xl:block mx-auto rounded w-full" src="https://primefaces.org/cdn/primevue/images/product/{{ item.image }}" [alt]="item.name" />
|
||||
<div class="absolute bg-black/70 rounded-border" [style]="{ left: '4px', top: '4px' }">
|
||||
<p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)"></p-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col md:flex-row justify-between md:items-center flex-1 gap-6">
|
||||
<div class="flex flex-row md:flex-col justify-between items-start gap-2">
|
||||
<div>
|
||||
<span class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.category }}</span>
|
||||
<div class="text-lg font-medium mt-2">{{ item.name }}</div>
|
||||
</div>
|
||||
<div class="bg-surface-100 p-1" style="border-radius: 30px">
|
||||
<div
|
||||
class="bg-surface-0 flex items-center gap-2 justify-center py-1 px-2"
|
||||
style="
|
||||
border-radius: 30px;
|
||||
box-shadow:
|
||||
0px 1px 2px 0px rgba(0, 0, 0, 0.04),
|
||||
0px 1px 2px 0px rgba(0, 0, 0, 0.06);
|
||||
"
|
||||
>
|
||||
<span class="text-surface-900 font-medium text-sm">{{ item.rating }}</span>
|
||||
<i class="pi pi-star-fill text-yellow-500"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col md:items-end gap-8">
|
||||
<span class="text-xl font-semibold">$ {{ item.price }}</span>
|
||||
<div class="flex flex-row-reverse md:flex-row gap-2">
|
||||
<p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button>
|
||||
<p-button icon="pi pi-shopping-cart" label="Buy Now" [disabled]="item.inventoryStatus === 'OUTOFSTOCK'" styleClass="flex-auto md:flex-initial whitespace-nowrap"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #grid let-items>
|
||||
<div class="grid grid-cols-12 gap-4">
|
||||
<div *ngFor="let item of items; let i = index" class="col-span-12 sm:col-span-6 lg:col-span-4 p-2">
|
||||
<div class="p-6 border border-surface-200 dark:border-surface-700 bg-surface-0 dark:bg-surface-900 rounded flex flex-col">
|
||||
<div class="relative w-full shadow-sm">
|
||||
<img class="rounded w-full" src="https://primefaces.org/cdn/primevue/images/product/{{ item.image }}" [alt]="item.name" />
|
||||
<div
|
||||
class="absolute bg-black/70 rounded-border"
|
||||
[style]="{
|
||||
left: '4px',
|
||||
top: '4px'
|
||||
}"
|
||||
>
|
||||
<p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)"></p-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt-12">
|
||||
<div class="flex flex-row justify-between items-start gap-2">
|
||||
<div>
|
||||
<span class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.category }}</span>
|
||||
<div class="text-lg font-medium mt-1">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-surface-100 p-1" style="border-radius: 30px">
|
||||
<div
|
||||
class="bg-surface-0 flex items-center gap-2 justify-center py-1 px-2"
|
||||
style="
|
||||
border-radius: 30px;
|
||||
box-shadow:
|
||||
0px 1px 2px 0px rgba(0, 0, 0, 0.04),
|
||||
0px 1px 2px 0px rgba(0, 0, 0, 0.06);
|
||||
"
|
||||
>
|
||||
<span class="text-surface-900 font-medium text-xs">{{ item.rating }}</span>
|
||||
<i class="pi pi-star-fill text-yellow-500"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 mt-6">
|
||||
<span class="text-2xl font-semibold">$ {{ item.price }}</span>
|
||||
<div class="flex gap-2">
|
||||
<p-button icon="pi pi-shopping-cart" label="Buy Now" [disabled]="item.inventoryStatus === 'OUTOFSTOCK'" class="flex-auto whitespace-nowrap" styleClass="w-full"></p-button>
|
||||
<p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-dataview>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col lg:flex-row gap-20">
|
||||
<div class="lg:w-2/3">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">PickList</div>
|
||||
<p-pick-list [source]="sourceCities" [target]="targetCities" breakpoint="1400px">
|
||||
<ng-template #item let-item>
|
||||
{{ item.name }}
|
||||
</ng-template>
|
||||
</p-pick-list>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lg:w-1/3">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">OrderList</div>
|
||||
<p-orderlist [value]="orderCities" dataKey="id" breakpoint="575px">
|
||||
<ng-template #option let-option>
|
||||
{{ option.name }}
|
||||
</ng-template>
|
||||
</p-orderlist>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
styles: `
|
||||
::ng-deep {
|
||||
.p-orderlist-list-container {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
`,
|
||||
providers: [ProductService]
|
||||
})
|
||||
export class ListDemo {
|
||||
layout: 'list' | 'grid' = 'list';
|
||||
|
||||
options = ['list', 'grid'];
|
||||
|
||||
products: Product[] = [];
|
||||
|
||||
sourceCities: any[] = [];
|
||||
|
||||
targetCities: any[] = [];
|
||||
|
||||
orderCities: any[] = [];
|
||||
|
||||
constructor(private productService: ProductService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.productService.getProductsSmall().then((data) => (this.products = data.slice(0, 6)));
|
||||
|
||||
this.sourceCities = [
|
||||
{ name: 'San Francisco', code: 'SF' },
|
||||
{ name: 'London', code: 'LDN' },
|
||||
{ name: 'Paris', code: 'PRS' },
|
||||
{ name: 'Istanbul', code: 'IST' },
|
||||
{ name: 'Berlin', code: 'BRL' },
|
||||
{ name: 'Barcelona', code: 'BRC' },
|
||||
{ name: 'Rome', code: 'RM' }
|
||||
];
|
||||
|
||||
this.targetCities = [];
|
||||
|
||||
this.orderCities = [
|
||||
{ name: 'San Francisco', code: 'SF' },
|
||||
{ name: 'London', code: 'LDN' },
|
||||
{ name: 'Paris', code: 'PRS' },
|
||||
{ name: 'Istanbul', code: 'IST' },
|
||||
{ name: 'Berlin', code: 'BRL' },
|
||||
{ name: 'Barcelona', code: 'BRC' },
|
||||
{ name: 'Rome', code: 'RM' }
|
||||
];
|
||||
}
|
||||
|
||||
getSeverity(product: Product) {
|
||||
switch (product.inventoryStatus) {
|
||||
case 'INSTOCK':
|
||||
return 'success';
|
||||
|
||||
case 'LOWSTOCK':
|
||||
return 'warn';
|
||||
|
||||
case 'OUTOFSTOCK':
|
||||
return 'danger';
|
||||
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { CarouselModule } from 'primeng/carousel';
|
||||
import { GalleriaModule } from 'primeng/galleria';
|
||||
import { ImageModule } from 'primeng/image';
|
||||
import { TagModule } from 'primeng/tag';
|
||||
import { PhotoService } from '../service/photo.service';
|
||||
import { Product, ProductService } from '../service/product.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-media-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, CarouselModule, ButtonModule, GalleriaModule, ImageModule, TagModule],
|
||||
template: `<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Carousel</div>
|
||||
<p-carousel [value]="products" [numVisible]="3" [numScroll]="3" [circular]="false" [responsiveOptions]="carouselResponsiveOptions">
|
||||
<ng-template let-product #item>
|
||||
<div class="border border-surface rounded-border m-2 p-4">
|
||||
<div class="mb-4">
|
||||
<div class="relative mx-auto">
|
||||
<img src="https://primefaces.org/cdn/primeng/images/demo/product/{{ product.image }}" [alt]="product.name" class="w-full rounded-border" />
|
||||
<div class="absolute bg-black/70 rounded-border" [ngStyle]="{ 'left.px': 5, 'top.px': 5 }">
|
||||
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4 font-medium">{{ product.name }}</div>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="mt-0 font-semibold text-xl">{{ '$' + product.price }}</div>
|
||||
<span>
|
||||
<p-button icon="pi pi-heart" severity="secondary" [outlined]="true" />
|
||||
<p-button icon="pi pi-shopping-cart" styleClass="ml-2" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-carousel>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Image</div>
|
||||
<p-image src="https://primefaces.org/cdn/primeng/images/galleria/galleria10.jpg" alt="Image" width="250" />
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Galleria</div>
|
||||
<p-galleria [value]="images" [responsiveOptions]="galleriaResponsiveOptions" [containerStyle]="{ 'max-width': '640px' }" [numVisible]="5">
|
||||
<ng-template #item let-item>
|
||||
<img [src]="item.itemImageSrc" style="width:100%" />
|
||||
</ng-template>
|
||||
<ng-template #thumbnail let-item>
|
||||
<img [src]="item.thumbnailImageSrc" />
|
||||
</ng-template>
|
||||
</p-galleria>
|
||||
</div>`,
|
||||
providers: [ProductService, PhotoService]
|
||||
})
|
||||
export class MediaDemo implements OnInit {
|
||||
products!: Product[];
|
||||
|
||||
images!: any[];
|
||||
|
||||
galleriaResponsiveOptions: any[] = [
|
||||
{
|
||||
breakpoint: '1024px',
|
||||
numVisible: 5
|
||||
},
|
||||
{
|
||||
breakpoint: '960px',
|
||||
numVisible: 4
|
||||
},
|
||||
{
|
||||
breakpoint: '768px',
|
||||
numVisible: 3
|
||||
},
|
||||
{
|
||||
breakpoint: '560px',
|
||||
numVisible: 1
|
||||
}
|
||||
];
|
||||
|
||||
carouselResponsiveOptions: any[] = [
|
||||
{
|
||||
breakpoint: '1024px',
|
||||
numVisible: 3,
|
||||
numScroll: 3
|
||||
},
|
||||
{
|
||||
breakpoint: '768px',
|
||||
numVisible: 2,
|
||||
numScroll: 2
|
||||
},
|
||||
{
|
||||
breakpoint: '560px',
|
||||
numVisible: 1,
|
||||
numScroll: 1
|
||||
}
|
||||
];
|
||||
|
||||
constructor(
|
||||
private productService: ProductService,
|
||||
private photoService: PhotoService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.productService.getProductsSmall().then((products) => {
|
||||
this.products = products;
|
||||
});
|
||||
|
||||
this.photoService.getImages().then((images) => {
|
||||
this.images = images;
|
||||
});
|
||||
}
|
||||
|
||||
getSeverity(status: string) {
|
||||
switch (status) {
|
||||
case 'INSTOCK':
|
||||
return 'success';
|
||||
case 'LOWSTOCK':
|
||||
return 'warn';
|
||||
case 'OUTOFSTOCK':
|
||||
return 'danger';
|
||||
default:
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,540 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { BreadcrumbModule } from 'primeng/breadcrumb';
|
||||
import { TieredMenuModule } from 'primeng/tieredmenu';
|
||||
import { ContextMenuModule } from 'primeng/contextmenu';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MenuModule } from 'primeng/menu';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { MegaMenuModule } from 'primeng/megamenu';
|
||||
import { PanelMenuModule } from 'primeng/panelmenu';
|
||||
import { TabsModule } from 'primeng/tabs';
|
||||
import { MenubarModule } from 'primeng/menubar';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { StepperModule } from 'primeng/stepper';
|
||||
import { IconField, IconFieldModule } from 'primeng/iconfield';
|
||||
import { InputIcon, InputIconModule } from 'primeng/inputicon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu-demo',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
BreadcrumbModule,
|
||||
TieredMenuModule,
|
||||
IconFieldModule,
|
||||
InputIconModule,
|
||||
MenuModule,
|
||||
ButtonModule,
|
||||
ContextMenuModule,
|
||||
MegaMenuModule,
|
||||
PanelMenuModule,
|
||||
TabsModule,
|
||||
MenubarModule,
|
||||
InputTextModule,
|
||||
TabsModule,
|
||||
StepperModule,
|
||||
TabsModule,
|
||||
IconField,
|
||||
InputIcon
|
||||
],
|
||||
template: `
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Menubar</div>
|
||||
<p-menubar [model]="nestedMenuItems">
|
||||
<ng-template #end>
|
||||
<p-iconfield>
|
||||
<p-inputicon class="pi pi-search" />
|
||||
<input type="text" pInputText placeholder="Search" />
|
||||
</p-iconfield>
|
||||
</ng-template>
|
||||
</p-menubar>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Breadcrumb</div>
|
||||
<p-breadcrumb [model]="breadcrumbItems" [home]="breadcrumbHome"></p-breadcrumb>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Steps</div>
|
||||
<p-stepper [value]="1">
|
||||
<p-step-list>
|
||||
<p-step [value]="1">Header I</p-step>
|
||||
<p-step [value]="2">Header II</p-step>
|
||||
<p-step [value]="3">Header III</p-step>
|
||||
</p-step-list>
|
||||
</p-stepper>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">TabMenu</div>
|
||||
<p-tabs [value]="0">
|
||||
<p-tablist>
|
||||
<p-tab [value]="0">Header I</p-tab>
|
||||
<p-tab [value]="1">Header II</p-tab>
|
||||
<p-tab [value]="2">Header III</p-tab>
|
||||
</p-tablist>
|
||||
</p-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-8 mt-6">
|
||||
<div class="md:w-1/3">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Tiered Menu</div>
|
||||
<p-tieredmenu [model]="tieredMenuItems"></p-tieredmenu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/3">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Plain Menu</div>
|
||||
<p-menu [model]="menuItems"></p-menu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/3">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Overlay Menu</div>
|
||||
<p-menu #menu [popup]="true" [model]="overlayMenuItems"></p-menu>
|
||||
<button type="button" pButton icon="pi pi-chevron-down" label="Options" (click)="menu.toggle($event)" style="width:auto"></button>
|
||||
</div>
|
||||
|
||||
<div class="card" #anchor>
|
||||
<div class="font-semibold text-xl mb-4">Context Menu</div>
|
||||
Right click to display.
|
||||
<p-contextmenu [target]="anchor" [model]="contextMenuItems"></p-contextmenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-8 mt-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">MegaMenu | Horizontal</div>
|
||||
<p-megamenu [model]="megaMenuItems" />
|
||||
|
||||
<div class="font-semibold text-xl mb-4 mt-8">MegaMenu | Vertical</div>
|
||||
<p-megamenu [model]="megaMenuItems" orientation="vertical" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">PanelMenu</div>
|
||||
<p-panelmenu [model]="panelMenuItems" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class MenuDemo {
|
||||
nestedMenuItems = [
|
||||
{
|
||||
label: 'Customers',
|
||||
icon: 'pi pi-fw pi-table',
|
||||
items: [
|
||||
{
|
||||
label: 'New',
|
||||
icon: 'pi pi-fw pi-user-plus',
|
||||
items: [
|
||||
{
|
||||
label: 'Customer',
|
||||
icon: 'pi pi-fw pi-plus'
|
||||
},
|
||||
{
|
||||
label: 'Duplicate',
|
||||
icon: 'pi pi-fw pi-copy'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-user-edit'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Orders',
|
||||
icon: 'pi pi-fw pi-shopping-cart',
|
||||
items: [
|
||||
{
|
||||
label: 'View',
|
||||
icon: 'pi pi-fw pi-list'
|
||||
},
|
||||
{
|
||||
label: 'Search',
|
||||
icon: 'pi pi-fw pi-search'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Shipments',
|
||||
icon: 'pi pi-fw pi-envelope',
|
||||
items: [
|
||||
{
|
||||
label: 'Tracker',
|
||||
icon: 'pi pi-fw pi-compass'
|
||||
},
|
||||
{
|
||||
label: 'Map',
|
||||
icon: 'pi pi-fw pi-map-marker'
|
||||
},
|
||||
{
|
||||
label: 'Manage',
|
||||
icon: 'pi pi-fw pi-pencil'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Profile',
|
||||
icon: 'pi pi-fw pi-user',
|
||||
items: [
|
||||
{
|
||||
label: 'Settings',
|
||||
icon: 'pi pi-fw pi-cog'
|
||||
},
|
||||
{
|
||||
label: 'Billing',
|
||||
icon: 'pi pi-fw pi-file'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
icon: 'pi pi-fw pi-sign-out'
|
||||
}
|
||||
];
|
||||
breadcrumbHome = { icon: 'pi pi-home', to: '/' };
|
||||
breadcrumbItems = [{ label: 'Computer' }, { label: 'Notebook' }, { label: 'Accessories' }, { label: 'Backpacks' }, { label: 'Item' }];
|
||||
tieredMenuItems = [
|
||||
{
|
||||
label: 'Customers',
|
||||
icon: 'pi pi-fw pi-table',
|
||||
items: [
|
||||
{
|
||||
label: 'New',
|
||||
icon: 'pi pi-fw pi-user-plus',
|
||||
items: [
|
||||
{
|
||||
label: 'Customer',
|
||||
icon: 'pi pi-fw pi-plus'
|
||||
},
|
||||
{
|
||||
label: 'Duplicate',
|
||||
icon: 'pi pi-fw pi-copy'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-user-edit'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Orders',
|
||||
icon: 'pi pi-fw pi-shopping-cart',
|
||||
items: [
|
||||
{
|
||||
label: 'View',
|
||||
icon: 'pi pi-fw pi-list'
|
||||
},
|
||||
{
|
||||
label: 'Search',
|
||||
icon: 'pi pi-fw pi-search'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Shipments',
|
||||
icon: 'pi pi-fw pi-envelope',
|
||||
items: [
|
||||
{
|
||||
label: 'Tracker',
|
||||
icon: 'pi pi-fw pi-compass'
|
||||
},
|
||||
{
|
||||
label: 'Map',
|
||||
icon: 'pi pi-fw pi-map-marker'
|
||||
},
|
||||
{
|
||||
label: 'Manage',
|
||||
icon: 'pi pi-fw pi-pencil'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Profile',
|
||||
icon: 'pi pi-fw pi-user',
|
||||
items: [
|
||||
{
|
||||
label: 'Settings',
|
||||
icon: 'pi pi-fw pi-cog'
|
||||
},
|
||||
{
|
||||
label: 'Billing',
|
||||
icon: 'pi pi-fw pi-file'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
icon: 'pi pi-fw pi-sign-out'
|
||||
}
|
||||
];
|
||||
overlayMenuItems = [
|
||||
{
|
||||
label: 'Save',
|
||||
icon: 'pi pi-save'
|
||||
},
|
||||
{
|
||||
label: 'Update',
|
||||
icon: 'pi pi-refresh'
|
||||
},
|
||||
{
|
||||
label: 'Delete',
|
||||
icon: 'pi pi-trash'
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: 'Home',
|
||||
icon: 'pi pi-home'
|
||||
}
|
||||
];
|
||||
menuItems = [
|
||||
{
|
||||
label: 'Customers',
|
||||
items: [
|
||||
{
|
||||
label: 'New',
|
||||
icon: 'pi pi-fw pi-plus'
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-user-edit'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Orders',
|
||||
items: [
|
||||
{
|
||||
label: 'View',
|
||||
icon: 'pi pi-fw pi-list'
|
||||
},
|
||||
{
|
||||
label: 'Search',
|
||||
icon: 'pi pi-fw pi-search'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
contextMenuItems = [
|
||||
{
|
||||
label: 'Save',
|
||||
icon: 'pi pi-save'
|
||||
},
|
||||
{
|
||||
label: 'Update',
|
||||
icon: 'pi pi-refresh'
|
||||
},
|
||||
{
|
||||
label: 'Delete',
|
||||
icon: 'pi pi-trash'
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: 'Options',
|
||||
icon: 'pi pi-cog'
|
||||
}
|
||||
];
|
||||
megaMenuItems = [
|
||||
{
|
||||
label: 'Fashion',
|
||||
icon: 'pi pi-fw pi-tag',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Woman',
|
||||
items: [{ label: 'Woman Item' }, { label: 'Woman Item' }, { label: 'Woman Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Men',
|
||||
items: [{ label: 'Men Item' }, { label: 'Men Item' }, { label: 'Men Item' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Kids',
|
||||
items: [{ label: 'Kids Item' }, { label: 'Kids Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Luggage',
|
||||
items: [{ label: 'Luggage Item' }, { label: 'Luggage Item' }, { label: 'Luggage Item' }]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Electronics',
|
||||
icon: 'pi pi-fw pi-desktop',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Computer',
|
||||
items: [{ label: 'Computer Item' }, { label: 'Computer Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Camcorder',
|
||||
items: [{ label: 'Camcorder Item' }, { label: 'Camcorder Item' }, { label: 'Camcorder Item' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'TV',
|
||||
items: [{ label: 'TV Item' }, { label: 'TV Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Audio',
|
||||
items: [{ label: 'Audio Item' }, { label: 'Audio Item' }, { label: 'Audio Item' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Sports.7',
|
||||
items: [{ label: 'Sports.7.1' }, { label: 'Sports.7.2' }]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Furniture',
|
||||
icon: 'pi pi-fw pi-image',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Living Room',
|
||||
items: [{ label: 'Living Room Item' }, { label: 'Living Room Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Kitchen',
|
||||
items: [{ label: 'Kitchen Item' }, { label: 'Kitchen Item' }, { label: 'Kitchen Item' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Bedroom',
|
||||
items: [{ label: 'Bedroom Item' }, { label: 'Bedroom Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Outdoor',
|
||||
items: [{ label: 'Outdoor Item' }, { label: 'Outdoor Item' }, { label: 'Outdoor Item' }]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Sports',
|
||||
icon: 'pi pi-fw pi-star',
|
||||
items: [
|
||||
[
|
||||
{
|
||||
label: 'Basketball',
|
||||
items: [{ label: 'Basketball Item' }, { label: 'Basketball Item' }]
|
||||
},
|
||||
{
|
||||
label: 'Football',
|
||||
items: [{ label: 'Football Item' }, { label: 'Football Item' }, { label: 'Football Item' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Tennis',
|
||||
items: [{ label: 'Tennis Item' }, { label: 'Tennis Item' }]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
];
|
||||
panelMenuItems = [
|
||||
{
|
||||
label: 'Customers',
|
||||
icon: 'pi pi-fw pi-table',
|
||||
items: [
|
||||
{
|
||||
label: 'New',
|
||||
icon: 'pi pi-fw pi-user-plus',
|
||||
items: [
|
||||
{
|
||||
label: 'Customer',
|
||||
icon: 'pi pi-fw pi-plus'
|
||||
},
|
||||
{
|
||||
label: 'Duplicate',
|
||||
icon: 'pi pi-fw pi-copy'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-user-edit'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Orders',
|
||||
icon: 'pi pi-fw pi-shopping-cart',
|
||||
items: [
|
||||
{
|
||||
label: 'View',
|
||||
icon: 'pi pi-fw pi-list'
|
||||
},
|
||||
{
|
||||
label: 'Search',
|
||||
icon: 'pi pi-fw pi-search'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Shipments',
|
||||
icon: 'pi pi-fw pi-envelope',
|
||||
items: [
|
||||
{
|
||||
label: 'Tracker',
|
||||
icon: 'pi pi-fw pi-compass'
|
||||
},
|
||||
{
|
||||
label: 'Map',
|
||||
icon: 'pi pi-fw pi-map-marker'
|
||||
},
|
||||
{
|
||||
label: 'Manage',
|
||||
icon: 'pi pi-fw pi-pencil'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Profile',
|
||||
icon: 'pi pi-fw pi-user',
|
||||
items: [
|
||||
{
|
||||
label: 'Settings',
|
||||
icon: 'pi pi-fw pi-cog'
|
||||
},
|
||||
{
|
||||
label: 'Billing',
|
||||
icon: 'pi pi-fw pi-file'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MessageService, ToastMessageOptions } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { MessageModule } from 'primeng/message';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ToastModule, ButtonModule, InputTextModule, MessageModule, FormsModule],
|
||||
template: `
|
||||
<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Toast</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button (click)="showSuccessViaToast()" label="Success" severity="success" />
|
||||
<p-button (click)="showInfoViaToast()" label="Info" severity="info" />
|
||||
<p-button (click)="showWarnViaToast()" label="Warn" severity="warn" />
|
||||
<p-button (click)="showErrorViaToast()" label="Error" severity="danger" />
|
||||
<p-toast />
|
||||
</div>
|
||||
|
||||
<div class="font-semibold text-xl mt-4 mb-4">Inline</div>
|
||||
<div class="flex flex-col mb-4 gap-1">
|
||||
<input pInputText [(ngModel)]="username" placeholder="Username" aria-label="username" class="ng-dirty ng-invalid" />
|
||||
<p-message severity="error" variant="simple" size="small">Username is required</p-message>
|
||||
</div>
|
||||
<div class="flex flex-col flex-wrap gap-1">
|
||||
<input pInputText [(ngModel)]="email" placeholder="Email" aria-label="email" class="ng-dirty ng-invalid" />
|
||||
<p-message severity="error" variant="simple" size="small">Email is required</p-message>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Message</div>
|
||||
<div class="flex flex-col gap-4 mb-4">
|
||||
<p-message severity="success">Success Message</p-message>
|
||||
<p-message severity="info">Info Message</p-message>
|
||||
<p-message severity="warn">Warn Message</p-message>
|
||||
<p-message severity="error">Error Message</p-message>
|
||||
<p-message severity="secondary">Secondary Message</p-message>
|
||||
<p-message severity="contrast">Contrast Message</p-message>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
providers: [MessageService]
|
||||
})
|
||||
export class MessagesDemo {
|
||||
msgs: ToastMessageOptions[] | null = [];
|
||||
|
||||
username: string | undefined;
|
||||
|
||||
email: string | undefined;
|
||||
|
||||
constructor(private service: MessageService) {}
|
||||
|
||||
showInfoViaToast() {
|
||||
this.service.add({ severity: 'info', summary: 'Info Message', detail: 'PrimeNG rocks' });
|
||||
}
|
||||
|
||||
showWarnViaToast() {
|
||||
this.service.add({ severity: 'warn', summary: 'Warn Message', detail: 'There are unsaved changes' });
|
||||
}
|
||||
|
||||
showErrorViaToast() {
|
||||
this.service.add({ severity: 'error', summary: 'Error Message', detail: 'Validation failed' });
|
||||
}
|
||||
|
||||
showSuccessViaToast() {
|
||||
this.service.add({ severity: 'success', summary: 'Success Message', detail: 'Message sent' });
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { AvatarModule } from 'primeng/avatar';
|
||||
import { AvatarGroupModule } from 'primeng/avatargroup';
|
||||
import { BadgeModule } from 'primeng/badge';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { ChipModule } from 'primeng/chip';
|
||||
import { OverlayBadgeModule } from 'primeng/overlaybadge';
|
||||
import { ProgressBarModule } from 'primeng/progressbar';
|
||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||
import { ScrollTopModule } from 'primeng/scrolltop';
|
||||
import { SkeletonModule } from 'primeng/skeleton';
|
||||
import { TagModule } from 'primeng/tag';
|
||||
|
||||
@Component({
|
||||
selector: 'app-misc-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ProgressBarModule, BadgeModule, AvatarModule, ScrollPanelModule, TagModule, ChipModule, ButtonModule, SkeletonModule, AvatarGroupModule, ScrollTopModule, OverlayBadgeModule],
|
||||
template: `
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">ProgressBar</div>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="md:w-1/2">
|
||||
<p-progressbar [value]="value" [showValue]="true"></p-progressbar>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<p-progressbar [value]="50" [showValue]="false"></p-progressbar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Badge</div>
|
||||
<div class="flex gap-2">
|
||||
<p-badge value="2"></p-badge>
|
||||
<p-badge value="8" severity="success"></p-badge>
|
||||
<p-badge value="4" severity="info"></p-badge>
|
||||
<p-badge value="12" severity="warn"></p-badge>
|
||||
<p-badge value="3" severity="danger"></p-badge>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Overlay</div>
|
||||
<div class="flex gap-6">
|
||||
<p-overlaybadge value="2">
|
||||
<i class="pi pi-bell" style="font-size: 2rem"></i>
|
||||
</p-overlaybadge>
|
||||
<p-overlaybadge value="4" severity="danger">
|
||||
<i class="pi pi-calendar" style="font-size: 2rem"></i>
|
||||
</p-overlaybadge>
|
||||
<p-overlaybadge severity="danger">
|
||||
<i class="pi pi-envelope" style="font-size: 2rem"></i>
|
||||
</p-overlaybadge>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Button</div>
|
||||
<div class="flex gap-2">
|
||||
<p-button label="Emails" badge="8"></p-button>
|
||||
<p-button label="Messages" icon="pi pi-users" severity="warn" badge="8" badgeSeverity="danger"></p-button>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Sizes</div>
|
||||
<div class="flex items-start gap-2">
|
||||
<p-badge [value]="2"></p-badge>
|
||||
<p-badge [value]="4" badgeSize="large" severity="warn"></p-badge>
|
||||
<p-badge [value]="6" badgeSize="xlarge" severity="success"></p-badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Avatar</div>
|
||||
<div class="font-semibold mb-4">Group</div>
|
||||
<p-avatargroup styleClass="mb-4">
|
||||
<p-avatar image="https://primefaces.org/cdn/primeng/images/demo/avatar/amyelsner.png" size="large" shape="circle"></p-avatar>
|
||||
<p-avatar image="https://primefaces.org/cdn/primeng/images/demo/avatar/asiyajavayant.png" size="large" shape="circle"></p-avatar>
|
||||
<p-avatar image="https://primefaces.org/cdn/primeng/images/demo/avatar/onyamalimba.png" size="large" shape="circle"></p-avatar>
|
||||
<p-avatar image="https://primefaces.org/cdn/primeng/images/demo/avatar/ionibowcher.png" size="large" shape="circle"></p-avatar>
|
||||
<p-avatar image="https://primefaces.org/cdn/primeng/images/demo/avatar/xuxuefeng.png" size="large" shape="circle"></p-avatar>
|
||||
<p-avatar label="+2" shape="circle" size="large" [style]="{ 'background-color': '#9c27b0', color: '#ffffff' }"></p-avatar>
|
||||
</p-avatargroup>
|
||||
|
||||
<div class="font-semibold my-4">Label - Circle</div>
|
||||
<p-avatar class="mr-2" label="P" size="xlarge" shape="circle"></p-avatar>
|
||||
<p-avatar class="mr-2" label="V" size="large" [style]="{ 'background-color': '#2196F3', color: '#ffffff' }" shape="circle"></p-avatar>
|
||||
<p-avatar class="mr-2" label="U" [style]="{ 'background-color': '#9c27b0', color: '#ffffff' }" shape="circle"></p-avatar>
|
||||
|
||||
<div class="font-semibold my-4">Icon - Badge</div>
|
||||
<p-overlaybadge value="4" severity="danger" class="inline-flex">
|
||||
<p-avatar label="U" size="xlarge" />
|
||||
</p-overlaybadge>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Skeleton</div>
|
||||
<div class="rounded-border border border-surface p-6">
|
||||
<div class="flex mb-4">
|
||||
<p-skeleton shape="circle" size="4rem" styleClass="mr-2"></p-skeleton>
|
||||
<div>
|
||||
<p-skeleton width="10rem" styleClass="mb-2"></p-skeleton>
|
||||
<p-skeleton width="5rem" styleClass="mb-2"></p-skeleton>
|
||||
<p-skeleton height=".5rem"></p-skeleton>
|
||||
</div>
|
||||
</div>
|
||||
<p-skeleton width="100%" height="150px"></p-skeleton>
|
||||
<div class="flex justify-between mt-4">
|
||||
<p-skeleton width="4rem" height="2rem"></p-skeleton>
|
||||
<p-skeleton width="4rem" height="2rem"></p-skeleton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Tag</div>
|
||||
<div class="font-semibold mb-4">Default</div>
|
||||
<div class="flex gap-2">
|
||||
<p-tag value="Primary"></p-tag>
|
||||
<p-tag severity="success" value="Success"></p-tag>
|
||||
<p-tag severity="info" value="Info"></p-tag>
|
||||
<p-tag severity="warn" value="Warning"></p-tag>
|
||||
<p-tag severity="danger" value="Danger"></p-tag>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Pills</div>
|
||||
<div class="flex gap-2">
|
||||
<p-tag value="Primary" [rounded]="true"></p-tag>
|
||||
<p-tag severity="success" value="Success" [rounded]="true"></p-tag>
|
||||
<p-tag severity="info" value="Info" [rounded]="true"></p-tag>
|
||||
<p-tag severity="warn" value="Warning" [rounded]="true"></p-tag>
|
||||
<p-tag severity="danger" value="Danger" [rounded]="true"></p-tag>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Icons</div>
|
||||
<div class="flex gap-2">
|
||||
<p-tag icon="pi pi-user" value="Primary"></p-tag>
|
||||
<p-tag icon="pi pi-check" severity="success" value="Success"></p-tag>
|
||||
<p-tag icon="pi pi-info-circle" severity="info" value="Info"></p-tag>
|
||||
<p-tag icon="pi pi-exclamation-triangle" severity="warn" value="Warning"></p-tag>
|
||||
<p-tag icon="pi pi-times" severity="danger" value="Danger"></p-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Chip</div>
|
||||
<div class="font-semibold mb-4">Basic</div>
|
||||
<div class="flex items-center flex-col sm:flex-row">
|
||||
<p-chip label="Action" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Comedy" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Mystery" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Thriller" styleClass="m-1" [removable]="true"></p-chip>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Icon</div>
|
||||
<div class="flex items-center flex-col sm:flex-row">
|
||||
<p-chip label="Apple" icon="pi pi-apple" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Facebook" icon="pi pi-facebook" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Google" icon="pi pi-google" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Microsoft" icon="pi pi-microsoft" styleClass="m-1" [removable]="true"></p-chip>
|
||||
</div>
|
||||
|
||||
<div class="font-semibold my-4">Image</div>
|
||||
<div class="flex items-center flex-col sm:flex-row">
|
||||
<p-chip label="Amy Elsner" image="https://primefaces.org/cdn/primeng/images/demo/avatar/amyelsner.png" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Asiya Javayant" image="https://primefaces.org/cdn/primeng/images/demo/avatar/asiyajavayant.png" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Onyama Limba" image="https://primefaces.org/cdn/primeng/images/demo/avatar/onyamalimba.png" styleClass="m-1"></p-chip>
|
||||
<p-chip label="Xuxue Feng" image="https://primefaces.org/cdn/primeng/images/demo/avatar/xuxuefeng.png" styleClass="m-1" [removable]="true"></p-chip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class MiscDemo {
|
||||
value = 0;
|
||||
|
||||
interval: any;
|
||||
|
||||
ngOnInit() {
|
||||
this.interval = setInterval(() => {
|
||||
this.value = this.value + Math.floor(Math.random() * 10) + 1;
|
||||
if (this.value >= 100) {
|
||||
this.value = 100;
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { ConfirmPopupModule } from 'primeng/confirmpopup';
|
||||
import { DialogModule } from 'primeng/dialog';
|
||||
import { DrawerModule } from 'primeng/drawer';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { Popover, PopoverModule } from 'primeng/popover';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { TooltipModule } from 'primeng/tooltip';
|
||||
import { Product, ProductService } from '../service/product.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-overlay-demo',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ToastModule,
|
||||
DialogModule,
|
||||
ButtonModule,
|
||||
DrawerModule,
|
||||
PopoverModule,
|
||||
ConfirmPopupModule,
|
||||
InputTextModule,
|
||||
FormsModule,
|
||||
TooltipModule,
|
||||
TableModule,
|
||||
ToastModule,
|
||||
SharedDialogComponent,
|
||||
],
|
||||
template: ` <div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">SharedDialogComponent</div>
|
||||
<shared-dialog
|
||||
header="SharedDialogComponent"
|
||||
[(visible)]="display"
|
||||
[breakpoints]="{ '960px': '75vw' }"
|
||||
[style]="{ width: '30vw' }"
|
||||
[modal]="true"
|
||||
>
|
||||
<p class="leading-normal m-0">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
|
||||
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
||||
mollit anim id est laborum.
|
||||
</p>
|
||||
<ng-template #footer>
|
||||
<p-button label="Save" (click)="close()" />
|
||||
</ng-template>
|
||||
</shared-dialog>
|
||||
<p-button label="Show" [style]="{ width: 'auto' }" (click)="open()" />
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Popover</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-button type="button" label="Show" (click)="toggleDataTable(op2, $event)" />
|
||||
<p-popover #op2 id="overlay_panel" [style]="{ width: '450px' }">
|
||||
<p-table
|
||||
[value]="products"
|
||||
selectionMode="single"
|
||||
[(selection)]="selectedProduct"
|
||||
dataKey="id"
|
||||
[rows]="5"
|
||||
[paginator]="true"
|
||||
(onRowSelect)="onProductSelect(op2, $event)"
|
||||
>
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Image</th>
|
||||
<th>Price</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-product>
|
||||
<tr [pSelectableRow]="product">
|
||||
<td>{{ product.name }}</td>
|
||||
<td>
|
||||
<img
|
||||
[src]="
|
||||
'https://primefaces.org/cdn/primeng/images/demo/product/' + product.image
|
||||
"
|
||||
[alt]="product.name"
|
||||
class="w-16 shadow-sm"
|
||||
/>
|
||||
</td>
|
||||
<td>{{ product.price }}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</p-popover>
|
||||
<p-toast />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Tooltip</div>
|
||||
<div class="inline-flex gap-4">
|
||||
<input pInputText type="text" placeholder="Username" pTooltip="Your username" />
|
||||
<p-button type="button" label="Save" pTooltip="Click to proceed" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Drawer</div>
|
||||
<p-drawer [(visible)]="visibleLeft" header="Drawer">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
</p-drawer>
|
||||
|
||||
<p-drawer [(visible)]="visibleRight" header="Drawer" position="right">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
</p-drawer>
|
||||
|
||||
<p-drawer [(visible)]="visibleTop" header="Drawer" position="top">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
</p-drawer>
|
||||
|
||||
<p-drawer [(visible)]="visibleBottom" header="Drawer" position="bottom">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
</p-drawer>
|
||||
|
||||
<p-drawer [(visible)]="visibleFull" header="Drawer" position="full">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
||||
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
||||
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
</p-drawer>
|
||||
|
||||
<p-button
|
||||
icon="pi pi-arrow-right"
|
||||
(click)="visibleLeft = true"
|
||||
[style]="{ marginRight: '0.25em' }"
|
||||
/>
|
||||
<p-button
|
||||
icon="pi pi-arrow-left"
|
||||
(click)="visibleRight = true"
|
||||
[style]="{ marginRight: '0.25em' }"
|
||||
/>
|
||||
<p-button
|
||||
icon="pi pi-arrow-down"
|
||||
(click)="visibleTop = true"
|
||||
[style]="{ marginRight: '0.25em' }"
|
||||
/>
|
||||
<p-button
|
||||
icon="pi pi-arrow-up"
|
||||
(click)="visibleBottom = true"
|
||||
[style]="{ marginRight: '0.25em' }"
|
||||
/>
|
||||
<p-button icon="pi pi-external-link" (click)="visibleFull = true" />
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">ConfirmPopup</div>
|
||||
<p-confirmpopup></p-confirmpopup>
|
||||
<p-button
|
||||
#popup
|
||||
(click)="confirm($event)"
|
||||
icon="pi pi-check"
|
||||
label="Confirm"
|
||||
class="mr-2"
|
||||
></p-button>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">ConfirmDialog</div>
|
||||
<p-button
|
||||
label="Delete"
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
[style]="{ width: 'auto' }"
|
||||
(click)="openConfirmation()"
|
||||
/>
|
||||
<shared-dialog
|
||||
header="Confirmation"
|
||||
[(visible)]="displayConfirmation"
|
||||
[style]="{ width: '350px' }"
|
||||
[modal]="true"
|
||||
>
|
||||
<div class="flex items-center justify-center">
|
||||
<i class="pi pi-exclamation-triangle mr-4" style="font-size: 2rem"> </i>
|
||||
<span>Are you sure you want to proceed?</span>
|
||||
</div>
|
||||
<ng-template #footer>
|
||||
<p-button
|
||||
label="No"
|
||||
icon="pi pi-times"
|
||||
(click)="closeConfirmation()"
|
||||
text
|
||||
severity="secondary"
|
||||
/>
|
||||
<p-button
|
||||
label="Yes"
|
||||
icon="pi pi-check"
|
||||
(click)="closeConfirmation()"
|
||||
severity="danger"
|
||||
outlined
|
||||
autofocus
|
||||
/>
|
||||
</ng-template>
|
||||
</shared-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
providers: [ConfirmationService, MessageService, ProductService],
|
||||
})
|
||||
export class OverlayDemo implements OnInit {
|
||||
images: any[] = [];
|
||||
|
||||
display: boolean = false;
|
||||
|
||||
products: Product[] = [];
|
||||
|
||||
visibleLeft: boolean = false;
|
||||
|
||||
visibleRight: boolean = false;
|
||||
|
||||
visibleTop: boolean = false;
|
||||
|
||||
visibleBottom: boolean = false;
|
||||
|
||||
visibleFull: boolean = false;
|
||||
|
||||
displayConfirmation: boolean = false;
|
||||
|
||||
selectedProduct!: Product;
|
||||
|
||||
constructor(
|
||||
private productService: ProductService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private messageService: MessageService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.productService.getProductsSmall().then((products) => (this.products = products));
|
||||
|
||||
this.images = [];
|
||||
this.images.push({
|
||||
source: 'assets/demo/images/sopranos/sopranos1.jpg',
|
||||
thumbnail: 'assets/demo/images/sopranos/sopranos1_small.jpg',
|
||||
title: 'Sopranos 1',
|
||||
});
|
||||
this.images.push({
|
||||
source: 'assets/demo/images/sopranos/sopranos2.jpg',
|
||||
thumbnail: 'assets/demo/images/sopranos/sopranos2_small.jpg',
|
||||
title: 'Sopranos 2',
|
||||
});
|
||||
this.images.push({
|
||||
source: 'assets/demo/images/sopranos/sopranos3.jpg',
|
||||
thumbnail: 'assets/demo/images/sopranos/sopranos3_small.jpg',
|
||||
title: 'Sopranos 3',
|
||||
});
|
||||
this.images.push({
|
||||
source: 'assets/demo/images/sopranos/sopranos4.jpg',
|
||||
thumbnail: 'assets/demo/images/sopranos/sopranos4_small.jpg',
|
||||
title: 'Sopranos 4',
|
||||
});
|
||||
}
|
||||
|
||||
confirm(event: Event) {
|
||||
this.confirmationService.confirm({
|
||||
key: 'confirm2',
|
||||
target: event.target || new EventTarget(),
|
||||
message: 'Are you sure that you want to proceed?',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
accept: () => {
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Confirmed',
|
||||
detail: 'You have accepted',
|
||||
});
|
||||
},
|
||||
reject: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Rejected',
|
||||
detail: 'You have rejected',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
open() {
|
||||
this.display = true;
|
||||
}
|
||||
|
||||
close() {
|
||||
this.display = false;
|
||||
}
|
||||
|
||||
toggleDataTable(op: Popover, event: any) {
|
||||
op.toggle(event);
|
||||
}
|
||||
|
||||
onProductSelect(op: Popover, event: any) {
|
||||
op.hide();
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Product Selected',
|
||||
detail: event?.data.name,
|
||||
life: 3000,
|
||||
});
|
||||
}
|
||||
|
||||
openConfirmation() {
|
||||
this.displayConfirmation = true;
|
||||
}
|
||||
|
||||
closeConfirmation() {
|
||||
this.displayConfirmation = false;
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { AccordionModule } from 'primeng/accordion';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { DividerModule } from 'primeng/divider';
|
||||
import { FieldsetModule } from 'primeng/fieldset';
|
||||
import { IconFieldModule } from 'primeng/iconfield';
|
||||
import { InputIconModule } from 'primeng/inputicon';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { MenuModule } from 'primeng/menu';
|
||||
import { PanelModule } from 'primeng/panel';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { SplitButtonModule } from 'primeng/splitbutton';
|
||||
import { SplitterModule } from 'primeng/splitter';
|
||||
import { TabsModule } from 'primeng/tabs';
|
||||
import { ToolbarModule } from 'primeng/toolbar';
|
||||
|
||||
@Component({
|
||||
selector: 'app-panels-demo',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ToolbarModule,
|
||||
ButtonModule,
|
||||
RippleModule,
|
||||
SplitButtonModule,
|
||||
AccordionModule,
|
||||
FieldsetModule,
|
||||
MenuModule,
|
||||
InputTextModule,
|
||||
DividerModule,
|
||||
SplitterModule,
|
||||
PanelModule,
|
||||
TabsModule,
|
||||
IconFieldModule,
|
||||
InputIconModule
|
||||
],
|
||||
template: `
|
||||
<div class="flex flex-col">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Toolbar</div>
|
||||
<p-toolbar>
|
||||
<ng-template #start>
|
||||
<p-button icon="pi pi-plus" class="mr-2" severity="secondary" text />
|
||||
<p-button icon="pi pi-print" class="mr-2" severity="secondary" text />
|
||||
<p-button icon="pi pi-upload" severity="secondary" text />
|
||||
</ng-template>
|
||||
|
||||
<ng-template #center>
|
||||
<p-iconfield>
|
||||
<p-inputicon>
|
||||
<i class="pi pi-search"></i>
|
||||
</p-inputicon>
|
||||
<input pInputText placeholder="Search" />
|
||||
</p-iconfield>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #end><p-splitbutton label="Save" [model]="items"></p-splitbutton></ng-template>
|
||||
</p-toolbar>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-8">
|
||||
<div class="md:w-1/2">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Accordion</div>
|
||||
<p-accordion value="0">
|
||||
<p-accordion-panel value="0">
|
||||
<p-accordion-header>Header I</p-accordion-header>
|
||||
<p-accordion-content>
|
||||
<p class="m-0">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
|
||||
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
||||
mollit anim id est laborum.
|
||||
</p>
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
|
||||
<p-accordion-panel value="1">
|
||||
<p-accordion-header>Header II</p-accordion-header>
|
||||
<p-accordion-content>
|
||||
<p class="m-0">
|
||||
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt
|
||||
explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non
|
||||
numquam eius modi.
|
||||
</p>
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
|
||||
<p-accordion-panel value="2">
|
||||
<p-accordion-header>Header III</p-accordion-header>
|
||||
<p-accordion-content>
|
||||
<p class="m-0">
|
||||
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt
|
||||
explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non
|
||||
numquam eius modi.
|
||||
</p>
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
</p-accordion>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Tabs</div>
|
||||
<p-tabs value="0">
|
||||
<p-tablist>
|
||||
<p-tab value="0">Header I</p-tab>
|
||||
<p-tab value="1">Header II</p-tab>
|
||||
<p-tab value="2">Header III</p-tab>
|
||||
</p-tablist>
|
||||
<p-tabpanels>
|
||||
<p-tabpanel value="0">
|
||||
<p class="m-0">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
|
||||
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
||||
mollit anim id est laborum.
|
||||
</p>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel value="1">
|
||||
<p class="m-0">
|
||||
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt
|
||||
explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non
|
||||
numquam eius modi.
|
||||
</p>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel value="2">
|
||||
<p class="m-0">
|
||||
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident,
|
||||
similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio
|
||||
cumque nihil impedit quo minus.
|
||||
</p>
|
||||
</p-tabpanel>
|
||||
</p-tabpanels>
|
||||
</p-tabs>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-1/2 mt-6 md:mt-0">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Panel</div>
|
||||
<p-panel header="Header" [toggleable]="true">
|
||||
<p class="m-0">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
||||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
|
||||
id est laborum.
|
||||
</p>
|
||||
</p-panel>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Fieldset</div>
|
||||
<p-fieldset legend="Legend" [toggleable]="true">
|
||||
<p class="m-0">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
||||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
|
||||
id est laborum.
|
||||
</p>
|
||||
</p-fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-8">
|
||||
<div class="font-semibold text-xl mb-4">Divider</div>
|
||||
<div class="flex flex-col md:flex-row">
|
||||
<div class="w-full md:w-5/12 flex flex-col items-center justify-center gap-3 py-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="username">Username</label>
|
||||
<input pInputText id="username" type="text" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="password">Password</label>
|
||||
<input pInputText id="password" type="password" />
|
||||
</div>
|
||||
<div class="flex">
|
||||
<p-button label="Login" icon="pi pi-user" class="w-full max-w-[17.35rem] mx-auto"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-2/12">
|
||||
<p-divider layout="vertical" class="hidden! md:flex!"><b>OR</b></p-divider>
|
||||
<p-divider layout="horizontal" class="flex! md:hidden!" align="center"><b>OR</b></p-divider>
|
||||
</div>
|
||||
<div class="w-full md:w-5/12 flex items-center justify-center py-5">
|
||||
<p-button label="Sign Up" icon="pi pi-user-plus" severity="success" class="w-full" styleClass="w-full max-w-[17.35rem] mx-auto"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Splitter</div>
|
||||
<p-splitter [style]="{ height: '300px' }" [panelSizes]="[20, 80]" [minSizes]="[10, 0]" styleClass="mb-8">
|
||||
<ng-template #panel>
|
||||
<div class="col flex items-center justify-center">Panel 1</div>
|
||||
</ng-template>
|
||||
<ng-template #panel>
|
||||
<p-splitter layout="vertical" [panelSizes]="[50, 50]">
|
||||
<ng-template #panel>
|
||||
<div style="grow: 1;" class="flex items-center justify-center">Panel 2</div>
|
||||
</ng-template>
|
||||
<ng-template #panel>
|
||||
<p-splitter [panelSizes]="[20, 80]">
|
||||
<ng-template #panel>
|
||||
<div class="col flex items-center justify-center">Panel 3</div>
|
||||
</ng-template>
|
||||
<ng-template #panel>
|
||||
<div class="col flex items-center justify-center">Panel 4</div>
|
||||
</ng-template>
|
||||
</p-splitter>
|
||||
</ng-template>
|
||||
</p-splitter>
|
||||
</ng-template>
|
||||
</p-splitter>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class PanelsDemo {
|
||||
items: MenuItem[] = [
|
||||
{
|
||||
label: 'Save',
|
||||
icon: 'pi pi-check'
|
||||
},
|
||||
{
|
||||
label: 'Update',
|
||||
icon: 'pi pi-upload'
|
||||
},
|
||||
{
|
||||
label: 'Delete',
|
||||
icon: 'pi pi-trash'
|
||||
},
|
||||
{
|
||||
label: 'Home Page',
|
||||
icon: 'pi pi-home'
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -1,568 +0,0 @@
|
||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { MultiSelectModule } from 'primeng/multiselect';
|
||||
import { SelectModule } from 'primeng/select';
|
||||
import { SliderModule } from 'primeng/slider';
|
||||
import { Table, TableModule } from 'primeng/table';
|
||||
import { ProgressBarModule } from 'primeng/progressbar';
|
||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { RatingModule } from 'primeng/rating';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { InputIconModule } from 'primeng/inputicon';
|
||||
import { IconFieldModule } from 'primeng/iconfield';
|
||||
import { TagModule } from 'primeng/tag';
|
||||
import { Customer, CustomerService, Representative } from '../service/customer.service';
|
||||
import { Product, ProductService } from '../service/product.service';
|
||||
import {ObjectUtils} from "primeng/utils";
|
||||
|
||||
interface expandedRows {
|
||||
[key: string]: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-table-demo',
|
||||
standalone: true,
|
||||
imports: [
|
||||
TableModule,
|
||||
MultiSelectModule,
|
||||
SelectModule,
|
||||
InputIconModule,
|
||||
TagModule,
|
||||
InputTextModule,
|
||||
SliderModule,
|
||||
ProgressBarModule,
|
||||
ToggleButtonModule,
|
||||
ToastModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ButtonModule,
|
||||
RatingModule,
|
||||
RippleModule,
|
||||
IconFieldModule
|
||||
],
|
||||
template: ` <div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Filtering</div>
|
||||
<p-table
|
||||
#dt1
|
||||
[value]="customers1"
|
||||
dataKey="id"
|
||||
[rows]="10"
|
||||
[loading]="loading"
|
||||
[rowHover]="true"
|
||||
[showGridlines]="true"
|
||||
[paginator]="true"
|
||||
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
||||
responsiveLayout="scroll"
|
||||
>
|
||||
<ng-template #caption>
|
||||
<div class="flex justify-between items-center flex-column sm:flex-row">
|
||||
<button pButton label="Clear" class="p-button-outlined mb-2" icon="pi pi-filter-slash" (click)="clear(dt1)"></button>
|
||||
<p-iconfield iconPosition="left" class="ml-auto">
|
||||
<p-inputicon>
|
||||
<i class="pi pi-search"></i>
|
||||
</p-inputicon>
|
||||
<input pInputText type="text" (input)="onGlobalFilter(dt1, $event)" placeholder="Search keyword" />
|
||||
</p-iconfield>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th style="min-width: 12rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Name
|
||||
<p-columnFilter type="text" field="name" display="menu" placeholder="Search by name"></p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 12rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Country
|
||||
<p-columnFilter type="text" field="country.name" display="menu" placeholder="Search by country"></p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 14rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Agent
|
||||
<p-columnFilter field="representative" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
||||
<ng-template #header>
|
||||
<div class="px-3 pt-3 pb-0">
|
||||
<span class="font-bold">Agent Picker</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #filter let-value let-filter="filterCallback">
|
||||
<p-multiselect [ngModel]="value" [options]="representatives" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" styleClass="w-full">
|
||||
<ng-template let-option #item>
|
||||
<div class="flex items-center gap-2 w-44">
|
||||
<img [alt]="option.label" src="https://primefaces.org/cdn/primeng/images/demo/avatar/{{ option.image }}" width="32" />
|
||||
<span>{{ option.name }}</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-multiselect>
|
||||
</ng-template>
|
||||
</p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 10rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Date
|
||||
<p-columnFilter type="date" field="date" display="menu" placeholder="mm/dd/yyyy"></p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 10rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Balance
|
||||
<p-columnFilter type="numeric" field="balance" display="menu" currency="USD"></p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 12rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Status
|
||||
<p-columnFilter field="status" matchMode="equals" display="menu">
|
||||
<ng-template #filter let-value let-filter="filterCallback">
|
||||
<p-select [ngModel]="value" [options]="statuses" (onChange)="filter($event.value)" placeholder="Any" [style]="{ 'min-width': '12rem' }">
|
||||
<ng-template let-option #item>
|
||||
<span [class]="'customer-badge status-' + option.value">{{ option.label }}</span>
|
||||
</ng-template>
|
||||
</p-select>
|
||||
</ng-template>
|
||||
</p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 12rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Activity
|
||||
<p-columnFilter field="activity" matchMode="between" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
||||
<ng-template #filter let-filter="filterCallback">
|
||||
<p-slider [ngModel]="activityValues" [range]="true" (onSlideEnd)="filter($event.values)" styleClass="m-3" [style]="{ 'min-width': '12rem' }"></p-slider>
|
||||
<div class="flex items-center justify-between px-2">
|
||||
<span>{{ activityValues[0] }}</span>
|
||||
<span>{{ activityValues[1] }}</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
<th style="min-width: 8rem">
|
||||
<div class="flex justify-between items-center">
|
||||
Verified
|
||||
<p-columnFilter type="boolean" field="verified" display="menu"></p-columnFilter>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-customer>
|
||||
<tr>
|
||||
<td>
|
||||
{{ customer.name }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center gap-2">
|
||||
<img src="https://primefaces.org/cdn/primeng/images/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" width="30" />
|
||||
<span>{{ customer.country.name }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center gap-2">
|
||||
<img [alt]="customer.representative.name" src="https://primefaces.org/cdn/primeng/images/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
||||
<span class="image-text">{{ customer.representative.name }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ customer.date | date: 'MM/dd/yyyy' }}
|
||||
</td>
|
||||
<td>
|
||||
{{ customer.balance | currency: 'USD' : 'symbol' }}
|
||||
</td>
|
||||
<td>
|
||||
<p-tag [value]="customer.status.toLowerCase()" [severity]="getSeverity(customer.status.toLowerCase())" styleClass="dark:bg-surface-900!" />
|
||||
</td>
|
||||
<td>
|
||||
<p-progressbar [value]="customer.activity" [showValue]="false" [style]="{ height: '0.5rem' }" />
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<p-tag [value]="customer.status.toLowerCase()" [severity]="getSeverity(customer.status.toLowerCase())" styleClass="dark:bg-surface-900!" />
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #emptymessage>
|
||||
<tr>
|
||||
<td colspan="8">No customers found.</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #loadingbody>
|
||||
<tr>
|
||||
<td colspan="8">Loading customers data. Please wait.</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Frozen Columns</div>
|
||||
<p-togglebutton [(ngModel)]="balanceFrozen" [onIcon]="'pi pi-lock'" offIcon="pi pi-lock-open" [onLabel]="'Balance'" offLabel="Balance" />
|
||||
|
||||
<p-table [value]="customers2" [scrollable]="true" scrollHeight="400px" styleClass="mt-4">
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th style="min-width:200px" pFrozenColumn class="font-bold">Name</th>
|
||||
<th style="min-width:100px">Id</th>
|
||||
<th style="min-width:200px">Country</th>
|
||||
<th style="min-width:200px">Date</th>
|
||||
<th style="min-width:200px">Company</th>
|
||||
<th style="min-width:200px">Status</th>
|
||||
<th style="min-width:200px">Activity</th>
|
||||
<th style="min-width:200px">Representative</th>
|
||||
<th style="min-width:200px" alignFrozen="right" pFrozenColumn [frozen]="balanceFrozen" [ngClass]="{ 'font-bold': balanceFrozen }">Balance</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-customer>
|
||||
<tr>
|
||||
<td pFrozenColumn class="font-bold">{{ customer.name }}</td>
|
||||
<td style="min-width:100px">{{ customer.id }}</td>
|
||||
<td>{{ customer.country.name }}</td>
|
||||
<td>{{ customer.date }}</td>
|
||||
<td>{{ customer.company }}</td>
|
||||
<td>{{ customer.status }}</td>
|
||||
<td>{{ customer.activity }}</td>
|
||||
<td>{{ customer.representative.name }}</td>
|
||||
<td alignFrozen="right" pFrozenColumn [frozen]="balanceFrozen" [ngClass]="{ 'font-bold': balanceFrozen }">
|
||||
{{ formatCurrency(customer.balance) }}
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Row Expansion</div>
|
||||
<p-table [value]="products" dataKey="id" [tableStyle]="{ 'min-width': '60rem' }" [expandedRowKeys]="expandedRows">
|
||||
<ng-template #caption>
|
||||
<button pButton icon="pi pi-fw {{ isExpanded ? 'pi-minus' : 'pi-plus' }}" label="{{ isExpanded ? 'Collapse All' : 'Expand All' }}" (click)="expandAll()"></button>
|
||||
<div class="flex table-header"></div>
|
||||
</ng-template>
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th style="width: 5rem"></th>
|
||||
<th pSortableColumn="name">Name <p-sortIcon field="name" /></th>
|
||||
<th>Image</th>
|
||||
<th pSortableColumn="price">Price <p-sortIcon field="price" /></th>
|
||||
<th pSortableColumn="category">Category <p-sortIcon field="category" /></th>
|
||||
<th pSortableColumn="rating">Reviews <p-sortIcon field="rating" /></th>
|
||||
<th pSortableColumn="inventoryStatus">Status <p-sortIcon field="inventoryStatus" /></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-product let-expanded="expanded">
|
||||
<tr>
|
||||
<td>
|
||||
<p-button type="button" pRipple [pRowToggler]="product" [text]="true" [rounded]="true" [plain]="true" [icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'" />
|
||||
</td>
|
||||
<td>{{ product.name }}</td>
|
||||
<td>
|
||||
<img [src]="'https://primefaces.org/cdn/primeng/images/demo/product/' + product.image" [alt]="product.name" width="50" class="shadow-lg" />
|
||||
</td>
|
||||
<td>{{ product.price | currency: 'USD' }}</td>
|
||||
<td>{{ product.category }}</td>
|
||||
<td>
|
||||
<p-rating [ngModel]="product.rating" [readonly]="true" />
|
||||
</td>
|
||||
<td>
|
||||
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #expandedrow let-product>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div class="p-4">
|
||||
<h5>Orders for {{ product.name }}</h5>
|
||||
<p-table [value]="product.orders" dataKey="id">
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th pSortableColumn="id">Id <p-sortIcon field="price" /></th>
|
||||
<th pSortableColumn="customer">
|
||||
Customer
|
||||
<p-sortIcon field="customer" />
|
||||
</th>
|
||||
<th pSortableColumn="date">Date <p-sortIcon field="date" /></th>
|
||||
<th pSortableColumn="amount">
|
||||
Amount
|
||||
<p-sortIcon field="amount" />
|
||||
</th>
|
||||
<th pSortableColumn="status">
|
||||
Status
|
||||
<p-sortIcon field="status" />
|
||||
</th>
|
||||
<th style="width: 4rem"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-order>
|
||||
<tr>
|
||||
<td>{{ order.id }}</td>
|
||||
<td>{{ order.customer }}</td>
|
||||
<td>{{ order.date }}</td>
|
||||
<td>
|
||||
{{ order.amount | currency: 'USD' }}
|
||||
</td>
|
||||
<td>
|
||||
<p-tag [value]="order.status" [severity]="getSeverity(order.status)" />
|
||||
</td>
|
||||
<td>
|
||||
<p-button type="button" icon="pi pi-search" />
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #emptymessage>
|
||||
<tr>
|
||||
<td colspan="6">There are no order for this product yet.</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Grouping</div>
|
||||
<p-table [value]="customers3" sortField="representative.name" sortMode="single" [scrollable]="true" scrollHeight="400px" rowGroupMode="subheader" groupRowsBy="representative.name" [tableStyle]="{ 'min-width': '60rem' }">
|
||||
<ng-template #header>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Country</th>
|
||||
<th>Company</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #groupheader let-customer>
|
||||
<tr pRowGroupHeader>
|
||||
<td colspan="5">
|
||||
<div class="flex items-center gap-2">
|
||||
<img [alt]="customer.representative.name" src="https://primefaces.org/cdn/primeng/images/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
||||
<span class="font-bold">{{ customer.representative.name }}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #groupfooter let-customer>
|
||||
<tr>
|
||||
<td colspan="5" class="text-right font-bold pr-12">Total Customers: {{ calculateCustomerTotal(customer.representative.name) }}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-customer let-rowIndex="rowIndex">
|
||||
<tr>
|
||||
<td>
|
||||
{{ customer.name }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center gap-2">
|
||||
<img src="https://primefaces.org/cdn/primeng/images/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
||||
<span>{{ customer.country.name }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ customer.company }}
|
||||
</td>
|
||||
<td>
|
||||
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
||||
</td>
|
||||
<td>
|
||||
{{ customer.date }}
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>`,
|
||||
styles: `
|
||||
.p-datatable-frozen-tbody {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.p-datatable-scrollable .p-frozen-column {
|
||||
font-weight: bold;
|
||||
}
|
||||
`,
|
||||
providers: [ConfirmationService, MessageService, CustomerService, ProductService]
|
||||
})
|
||||
export class TableDemo implements OnInit {
|
||||
customers1: Customer[] = [];
|
||||
|
||||
customers2: Customer[] = [];
|
||||
|
||||
customers3: Customer[] = [];
|
||||
|
||||
selectedCustomers1: Customer[] = [];
|
||||
|
||||
selectedCustomer: Customer = {};
|
||||
|
||||
representatives: Representative[] = [];
|
||||
|
||||
statuses: any[] = [];
|
||||
|
||||
products: Product[] = [];
|
||||
|
||||
rowGroupMetadata: any;
|
||||
|
||||
expandedRows: expandedRows = {};
|
||||
|
||||
activityValues: number[] = [0, 100];
|
||||
|
||||
isExpanded: boolean = false;
|
||||
|
||||
balanceFrozen: boolean = false;
|
||||
|
||||
loading: boolean = true;
|
||||
|
||||
@ViewChild('filter') filter!: ElementRef;
|
||||
|
||||
constructor(
|
||||
private customerService: CustomerService,
|
||||
private productService: ProductService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.customerService.getCustomersLarge().then((customers) => {
|
||||
this.customers1 = customers;
|
||||
this.loading = false;
|
||||
|
||||
// @ts-ignore
|
||||
this.customers1.forEach((customer) => (customer.date = new Date(customer.date)));
|
||||
});
|
||||
this.customerService.getCustomersMedium().then((customers) => (this.customers2 = customers));
|
||||
this.customerService.getCustomersLarge().then((customers) => (this.customers3 = customers));
|
||||
this.productService.getProductsWithOrdersSmall().then((data) => (this.products = data));
|
||||
|
||||
this.representatives = [
|
||||
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
||||
{ name: 'Anna Fali', image: 'annafali.png' },
|
||||
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' },
|
||||
{ name: 'Bernardo Dominic', image: 'bernardodominic.png' },
|
||||
{ name: 'Elwin Sharvill', image: 'elwinsharvill.png' },
|
||||
{ name: 'Ioni Bowcher', image: 'ionibowcher.png' },
|
||||
{ name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' },
|
||||
{ name: 'Onyama Limba', image: 'onyamalimba.png' },
|
||||
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
||||
{ name: 'XuXue Feng', image: 'xuxuefeng.png' }
|
||||
];
|
||||
|
||||
this.statuses = [
|
||||
{ label: 'Unqualified', value: 'unqualified' },
|
||||
{ label: 'Qualified', value: 'qualified' },
|
||||
{ label: 'New', value: 'new' },
|
||||
{ label: 'Negotiation', value: 'negotiation' },
|
||||
{ label: 'Renewal', value: 'renewal' },
|
||||
{ label: 'Proposal', value: 'proposal' }
|
||||
];
|
||||
}
|
||||
|
||||
onSort() {
|
||||
this.updateRowGroupMetaData();
|
||||
}
|
||||
|
||||
updateRowGroupMetaData() {
|
||||
this.rowGroupMetadata = {};
|
||||
|
||||
if (this.customers3) {
|
||||
for (let i = 0; i < this.customers3.length; i++) {
|
||||
const rowData = this.customers3[i];
|
||||
const representativeName = rowData?.representative?.name || '';
|
||||
|
||||
if (i === 0) {
|
||||
this.rowGroupMetadata[representativeName] = { index: 0, size: 1 };
|
||||
} else {
|
||||
const previousRowData = this.customers3[i - 1];
|
||||
const previousRowGroup = previousRowData?.representative?.name;
|
||||
if (representativeName === previousRowGroup) {
|
||||
this.rowGroupMetadata[representativeName].size++;
|
||||
} else {
|
||||
this.rowGroupMetadata[representativeName] = { index: i, size: 1 };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expandAll() {
|
||||
if(ObjectUtils.isEmpty(this.expandedRows)) {
|
||||
this.expandedRows = this.products.reduce(
|
||||
(acc, p) => {
|
||||
if (p.id) {
|
||||
acc[p.id] = true;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as { [key: string]: boolean }
|
||||
);
|
||||
this.isExpanded = true;
|
||||
} else {
|
||||
this.collapseAll()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
collapseAll() {
|
||||
this.expandedRows = {};
|
||||
this.isExpanded = false;
|
||||
}
|
||||
|
||||
formatCurrency(value: number) {
|
||||
return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
||||
}
|
||||
|
||||
onGlobalFilter(table: Table, event: Event) {
|
||||
table.filterGlobal((event.target as HTMLInputElement).value, 'contains');
|
||||
}
|
||||
|
||||
clear(table: Table) {
|
||||
table.clear();
|
||||
this.filter.nativeElement.value = '';
|
||||
}
|
||||
|
||||
getSeverity(status: string) {
|
||||
switch (status) {
|
||||
case 'qualified':
|
||||
case 'instock':
|
||||
case 'INSTOCK':
|
||||
case 'DELIVERED':
|
||||
case 'delivered':
|
||||
return 'success';
|
||||
|
||||
case 'negotiation':
|
||||
case 'lowstock':
|
||||
case 'LOWSTOCK':
|
||||
case 'PENDING':
|
||||
case 'pending':
|
||||
return 'warn';
|
||||
|
||||
case 'unqualified':
|
||||
case 'outofstock':
|
||||
case 'OUTOFSTOCK':
|
||||
case 'CANCELLED':
|
||||
case 'cancelled':
|
||||
return 'danger';
|
||||
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
|
||||
calculateCustomerTotal(name: string) {
|
||||
let total = 0;
|
||||
|
||||
if (this.customers2) {
|
||||
for (let customer of this.customers2) {
|
||||
if (customer.representative?.name === name) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {TimelineModule} from 'primeng/timeline';
|
||||
import {CardModule} from 'primeng/card';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {ButtonModule} from 'primeng/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-timeline-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, TimelineModule, ButtonModule, CardModule],
|
||||
template: `<div class="grid grid-cols-12 gap-8">
|
||||
<div class="col-span-12 sm:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Left Align</div>
|
||||
<p-timeline [value]="events1">
|
||||
<ng-template #content let-event>
|
||||
{{ event.status }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 sm:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Right Align</div>
|
||||
<p-timeline [value]="events1" align="right">
|
||||
<ng-template #content let-event>
|
||||
{{ event.status }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 sm:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Alternate Align</div>
|
||||
<p-timeline [value]="events1" align="alternate">
|
||||
<ng-template #content let-event>
|
||||
{{ event.status }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 sm:col-span-6">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Opposite Content</div>
|
||||
<p-timeline [value]="events1">
|
||||
<ng-template #content let-event>
|
||||
<small class="p-text-secondary">{{ event.date }}</small>
|
||||
</ng-template>
|
||||
<ng-template #opposite let-event>
|
||||
{{ event.status }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-full">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Templating</div>
|
||||
<p-timeline [value]="events1" align="alternate" styleClass="customized-timeline">
|
||||
<ng-template #marker let-event>
|
||||
<span class="flex w-8 h-8 items-center justify-center text-white rounded-full z-10 shadow-sm" [style]="{ 'background-color': event.color }">
|
||||
<i [class]="event.icon"></i>
|
||||
</span>
|
||||
</ng-template>
|
||||
<ng-template #content let-event>
|
||||
<p-card [header]="event.status" [subheader]="event.date">
|
||||
<img *ngIf="event.image" [src]="'/images/product/' + event.image" [alt]="event.name" width="200" class="shadow" />
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse,
|
||||
cupiditate neque quas!
|
||||
</p>
|
||||
<p-button label="Read more" [text]="true" />
|
||||
</p-card>
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-full">
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">Horizontal</div>
|
||||
<div class="font-semibold mb-2">Top Align</div>
|
||||
<p-timeline [value]="events2" layout="horizontal" align="top">
|
||||
<ng-template #content let-event>
|
||||
{{ event }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
|
||||
<div class="font-semibold mt-4 mb-2">Bottom Align</div>
|
||||
<p-timeline [value]="events2" layout="horizontal" align="bottom">
|
||||
<ng-template #content let-event>
|
||||
{{ event }}
|
||||
</ng-template>
|
||||
</p-timeline>
|
||||
|
||||
<div class="font-semibold mt-4 mb-2">Alternate Align</div>
|
||||
<p-timeline [value]="events2" layout="horizontal" align="alternate">
|
||||
<ng-template #content let-event>
|
||||
{{ event }}
|
||||
</ng-template>
|
||||
<ng-template #opposite let-event> </ng-template>
|
||||
</p-timeline>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
export class TimelineDemo {
|
||||
events1: any[] = [];
|
||||
|
||||
events2: any[] = [];
|
||||
|
||||
ngOnInit() {
|
||||
this.events1 = [
|
||||
{
|
||||
status: 'Ordered',
|
||||
date: '15/10/2020 10:30',
|
||||
icon: 'pi pi-shopping-cart',
|
||||
color: '#9C27B0',
|
||||
image: 'game-controller.jpg'
|
||||
},
|
||||
{
|
||||
status: 'Processing',
|
||||
date: '15/10/2020 14:00',
|
||||
icon: 'pi pi-cog',
|
||||
color: '#673AB7'
|
||||
},
|
||||
{
|
||||
status: 'Shipped',
|
||||
date: '15/10/2020 16:15',
|
||||
icon: 'pi pi-envelope',
|
||||
color: '#FF9800'
|
||||
},
|
||||
{
|
||||
status: 'Delivered',
|
||||
date: '16/10/2020 10:00',
|
||||
icon: 'pi pi-check',
|
||||
color: '#607D8B'
|
||||
}
|
||||
];
|
||||
|
||||
this.events2 = ['2020', '2021', '2022', '2023'];
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { TreeNode } from 'primeng/api';
|
||||
import { TreeModule } from 'primeng/tree';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { TreeTableModule } from 'primeng/treetable';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NodeService } from '../service/node.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tree-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, TreeModule, TreeTableModule],
|
||||
template: `
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl">Tree</div>
|
||||
<p-tree [value]="treeValue" selectionMode="checkbox" [(selection)]="selectedTreeValue"></p-tree>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="font-semibold text-xl mb-4">TreeTable</div>
|
||||
<p-treetable [value]="treeTableValue" [columns]="cols" selectionMode="checkbox" [(selectionKeys)]="selectedTreeTableValue" dataKey="key" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
||||
<ng-template #header let-columns>
|
||||
<tr>
|
||||
<th *ngFor="let col of columns">
|
||||
{{ col.header }}
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-rowNode let-rowData="rowData" let-columns="columns">
|
||||
<tr [ttRow]="rowNode" [ttSelectableRow]="rowNode">
|
||||
<td *ngFor="let col of columns; let i = index">
|
||||
<span class="flex items-center gap-2">
|
||||
<p-treeTableToggler [rowNode]="rowNode" *ngIf="i === 0" />
|
||||
<p-treeTableCheckbox [value]="rowNode" *ngIf="i === 0" />
|
||||
{{ rowData[col.field] }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-treetable>
|
||||
</div>
|
||||
`,
|
||||
providers: [NodeService]
|
||||
})
|
||||
export class TreeDemo implements OnInit {
|
||||
treeValue: TreeNode[] = [];
|
||||
|
||||
treeTableValue: TreeNode[] = [];
|
||||
|
||||
selectedTreeValue: TreeNode[] = [];
|
||||
|
||||
selectedTreeTableValue = {};
|
||||
|
||||
cols: any[] = [];
|
||||
|
||||
nodeService = inject(NodeService);
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeService.getFiles().then((files) => (this.treeValue = files));
|
||||
this.nodeService.getTreeTableNodes().then((files: any) => (this.treeTableValue = files));
|
||||
|
||||
this.cols = [
|
||||
{ field: 'name', header: 'Name' },
|
||||
{ field: 'size', header: 'Size' },
|
||||
{ field: 'type', header: 'Type' }
|
||||
];
|
||||
|
||||
this.selectedTreeTableValue = {
|
||||
'0-0': {
|
||||
partialChecked: false,
|
||||
checked: true
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { ButtonDemo } from './buttondemo';
|
||||
import { ChartDemo } from './chartdemo';
|
||||
import { FileDemo } from './filedemo';
|
||||
import { FormLayoutDemo } from './formlayoutdemo';
|
||||
import { InputDemo } from './inputdemo';
|
||||
import { ListDemo } from './listdemo';
|
||||
import { MediaDemo } from './mediademo';
|
||||
import { MessagesDemo } from './messagesdemo';
|
||||
import { MiscDemo } from './miscdemo';
|
||||
import { PanelsDemo } from './panelsdemo';
|
||||
import { TimelineDemo } from './timelinedemo';
|
||||
import { TableDemo } from './tabledemo';
|
||||
import { OverlayDemo } from './overlaydemo';
|
||||
import { TreeDemo } from './treedemo';
|
||||
import { MenuDemo } from './menudemo';
|
||||
|
||||
export default [
|
||||
{ path: 'button', data: { breadcrumb: 'Button' }, component: ButtonDemo },
|
||||
{ path: 'charts', data: { breadcrumb: 'Charts' }, component: ChartDemo },
|
||||
{ path: 'file', data: { breadcrumb: 'File' }, component: FileDemo },
|
||||
{ path: 'formlayout', data: { breadcrumb: 'Form Layout' }, component: FormLayoutDemo },
|
||||
{ path: 'input', data: { breadcrumb: 'Input' }, component: InputDemo },
|
||||
{ path: 'list', data: { breadcrumb: 'List' }, component: ListDemo },
|
||||
{ path: 'media', data: { breadcrumb: 'Media' }, component: MediaDemo },
|
||||
{ path: 'message', data: { breadcrumb: 'Message' }, component: MessagesDemo },
|
||||
{ path: 'misc', data: { breadcrumb: 'Misc' }, component: MiscDemo },
|
||||
{ path: 'panel', data: { breadcrumb: 'Panel' }, component: PanelsDemo },
|
||||
{ path: 'timeline', data: { breadcrumb: 'Timeline' }, component: TimelineDemo },
|
||||
{ path: 'table', data: { breadcrumb: 'Table' }, component: TableDemo },
|
||||
{ path: 'overlay', data: { breadcrumb: 'Overlay' }, component: OverlayDemo },
|
||||
{ path: 'tree', data: { breadcrumb: 'Tree' }, component: TreeDemo },
|
||||
{ path: 'menu', data: { breadcrumb: 'Menu' }, component: MenuDemo },
|
||||
{ path: '**', redirectTo: '/notfound' }
|
||||
] as Routes;
|
||||
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
HostListener,
|
||||
Input,
|
||||
OnInit,
|
||||
Output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'abstract-isMobile',
|
||||
template: '',
|
||||
})
|
||||
export class AbstractIsMobileComponent implements OnInit {
|
||||
@Input() mobileBreakpoint = 768;
|
||||
|
||||
@Output() onHide = new EventEmitter<any>();
|
||||
|
||||
isMobile = signal(false);
|
||||
|
||||
ngOnInit() {
|
||||
this.updateViewportMode();
|
||||
}
|
||||
|
||||
@HostListener('window:resize')
|
||||
onResize() {
|
||||
this.updateViewportMode();
|
||||
}
|
||||
|
||||
private updateViewportMode() {
|
||||
this.isMobile.set(typeof window !== 'undefined' && window.innerWidth <= this.mobileBreakpoint);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ export class InputComponent {
|
||||
@Input() min?: number;
|
||||
@Input() max?: number;
|
||||
@Input() fixed?: number;
|
||||
@Input() numericValue?: number;
|
||||
@Output() valueChange = new EventEmitter<string | number>();
|
||||
@Output() blur = new EventEmitter<void>();
|
||||
|
||||
@@ -263,15 +264,7 @@ export class InputComponent {
|
||||
numericValue = Number.isNaN(parseFloat(value)) ? 0 : parseFloat(value);
|
||||
}
|
||||
|
||||
const isIdentifierField = [
|
||||
'nationalId',
|
||||
'phone',
|
||||
'postalCode',
|
||||
'mobile',
|
||||
'email',
|
||||
'password',
|
||||
'simple',
|
||||
].includes(this.type);
|
||||
const isIdentifierField = !this.numericValue;
|
||||
this.control.setValue(isIdentifierField ? value : value === '' ? '' : numericValue);
|
||||
|
||||
const viewValue = isPriceFormat && value !== '' ? numericValue.toLocaleString('en-US') : value;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div class="flex items-center justify-center h-[100cqmin] w-full">
|
||||
<div class="flex items-center justify-center h-svh w-full">
|
||||
<p-progressSpinner />
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
// apiBaseUrl: 'http://194.59.214.243:5002',
|
||||
apiBaseUrl: 'http://192.168.128.73:5002',
|
||||
// apiBaseUrl: 'http://localhost:5002',
|
||||
// apiBaseUrl: 'http://192.168.128.73:5002',
|
||||
apiBaseUrl: 'http://localhost:5002',
|
||||
// host: 'http://194.59.214.243',
|
||||
host: 'localhost',
|
||||
port: 5000,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user