Merge remote-tracking branch 'origin/v19' into v19

# Conflicts:
#	src/views/uikit/chartdoc.ts
This commit is contained in:
Çetin
2025-01-06 17:12:34 +03:00

View File

@@ -11,164 +11,144 @@ import { ButtonModule } from 'primeng/button';
import { Product, ProductService } from '@/src/service/product.service'; import { Product, ProductService } from '@/src/service/product.service';
@Component({ @Component({
standalone:true, standalone: true,
imports: [CommonModule, DataViewModule, FormsModule, SelectButtonModule, PickListModule, OrderListModule, TagModule, ButtonModule], imports: [CommonModule, DataViewModule, FormsModule, SelectButtonModule, PickListModule, OrderListModule, TagModule, ButtonModule],
template: ` template: ` <div class="flex flex-col">
<div class="flex flex-col"> <div class="card">
<div class="card"> <div class="font-semibold text-xl">DataView</div>
<div class="font-semibold text-xl">DataView</div> <p-dataview [value]="products" [layout]="layout">
<p-dataview [value]="products" [layout]="layout"> <ng-template #header>
<ng-template #header> <div class="flex justify-end">
<div class="flex justify-end"> <p-select-button [(ngModel)]="layout" [options]="options" [allowEmpty]="false">
<p-select-button [(ngModel)]="layout" [options]="options" [allowEmpty]="false"> <ng-template #item let-option>
<ng-template #item let-option> <i class="pi " [ngClass]="{ 'pi-bars': option === 'list', 'pi-table': option === 'grid' }"></i>
<i class="pi " [ngClass]="{'pi-bars': option === 'list', 'pi-table': option === 'grid'}"></i> </ng-template>
</ng-template> </p-select-button>
</p-select-button> </div>
</div> </ng-template>
</ng-template>
<ng-template #list let-items> <ng-template #list let-items>
<div class="flex flex-col"> <div class="flex flex-col">
<div *ngFor="let item of items; let i = index"> <div *ngFor="let item of items; let i = index">
<div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4" <div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4" [ngClass]="{ 'border-t border-surface': i !== 0 }">
[ngClass]="{ 'border-t border-surface': i !== 0 }"> <div class="md:w-40 relative">
<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" />
<img class="block xl:block mx-auto rounded w-full" <p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)" class="absolute dark:!bg-surface-900" [style]="{ left: '4px', top: '4px' }"></p-tag>
src="https://primefaces.org/cdn/primevue/images/product/{{item.image}}" </div>
[alt]="item.name" /> <div class="flex flex-col md:flex-row justify-between md:items-center flex-1 gap-6">
<p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)" <div class="flex flex-row md:flex-col justify-between items-start gap-2">
class="absolute dark:!bg-surface-900" [style]="{left: '4px', top: '4px'}"></p-tag> <div>
</div> <span class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.category }}</span>
<div class="flex flex-col md:flex-row justify-between md:items-center flex-1 gap-6"> <div class="text-lg font-medium mt-2">{{ item.name }}</div>
<div class="flex flex-row md:flex-col justify-between items-start gap-2"> </div>
<div> <div class="bg-surface-100 p-1" style="border-radius: 30px">
<span <div
class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.category }}</span> class="bg-surface-0 flex items-center gap-2 justify-center py-1 px-2"
<div class="text-lg font-medium mt-2">{{ item.name }}</div> style="
</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; border-radius: 30px;
box-shadow: box-shadow:
0px 1px 2px 0px rgba(0, 0, 0, 0.04), 0px 1px 2px 0px rgba(0, 0, 0, 0.04),
0px 1px 2px 0px rgba(0, 0, 0, 0.06); 0px 1px 2px 0px rgba(0, 0, 0, 0.06);
" "
> >
<span <span class="text-surface-900 font-medium text-sm">{{ item.rating }}</span>
class="text-surface-900 font-medium text-sm">{{ item.rating }}</span> <i class="pi pi-star-fill text-yellow-500"></i>
<i class="pi pi-star-fill text-yellow-500"></i>
</div>
</div> </div>
</div> </div>
<div class="flex flex-col md:items-end gap-20"> </div>
<span class="text-xl font-semibold">$ {{ item.price }}</span> <div class="flex flex-col md:items-end gap-20">
<div class="flex flex-row-reverse md:flex-row gap-2"> <span class="text-xl font-semibold">$ {{ item.price }}</span>
<p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button> <div class="flex flex-row-reverse md:flex-row gap-2">
<p-button icon="pi pi-shopping-cart" label="Buy Now" <p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button>
[disabled]="item.inventoryStatus === 'OUTOFSTOCK'" <p-button icon="pi pi-shopping-cart" label="Buy Now" [disabled]="item.inventoryStatus === 'OUTOFSTOCK'" styleClass="flex-auto md:flex-initial whitespace-nowrap"></p-button>
styleClass="flex-auto md:flex-initial whitespace-nowrap"></p-button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</ng-template> </div>
</ng-template>
<ng-template #grid let-items> <ng-template #grid let-items>
<div class="grid grid-cols-12 gap-4"> <div class="grid grid-cols-12 gap-4">
<div *ngFor="let item of items; let i = index"> <div *ngFor="let item of items; let i = index" class="col-span-12 sm:col-span-6 lg:col-span-4 p-2">
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 <div class="bg-surface-50 flex justify-center rounded p-6">
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 mx-auto">
<div class="bg-surface-50 flex justify-center rounded p-6"> <img class="rounded w-full" src="https://primefaces.org/cdn/primevue/images/product/{{ item.image }}" [alt]="item.name" style="max-width: 300px" />
<div class="relative mx-auto"> <p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)" class="absolute dark:!bg-surface-900" [style]="{ left: '4px', top: '4px' }"></p-tag>
<img class="rounded w-full"
src="https://primefaces.org/cdn/primevue/images/product/{{item.image}}"
[alt]="item.name" style="max-width: 300px" />
<p-tag [value]="item.inventoryStatus" [severity]="getSeverity(item)"
class="absolute dark:!bg-surface-900"
[style]="{left: '4px', top: '4px'}"></p-tag>
</div>
</div> </div>
<div class="pt-12"> </div>
<div class="flex flex-row justify-between items-start gap-2"> <div class="pt-12">
<div> <div class="flex flex-row justify-between items-start gap-2">
<span <div>
class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.category }}</span> <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 class="text-lg font-medium mt-1">{{ item.name }}</div>
</div> </div>
<div class="bg-surface-100 p-1" style="border-radius: 30px"> <div class="bg-surface-100 p-1" style="border-radius: 30px">
<div <div
class="bg-surface-0 flex items-center gap-2 justify-center py-1 px-2" class="bg-surface-0 flex items-center gap-2 justify-center py-1 px-2"
style=" style="
border-radius: 30px; border-radius: 30px;
box-shadow: box-shadow:
0px 1px 2px 0px rgba(0, 0, 0, 0.04), 0px 1px 2px 0px rgba(0, 0, 0, 0.04),
0px 1px 2px 0px rgba(0, 0, 0, 0.06); 0px 1px 2px 0px rgba(0, 0, 0, 0.06);
" "
> >
<span <span class="text-surface-900 font-medium text-sm">{{ item.rating }}</span>
class="text-surface-900 font-medium text-sm">{{ item.rating }}</span> <i class="pi pi-star-fill text-yellow-500"></i>
<i class="pi pi-star-fill text-yellow-500"></i>
</div>
</div> </div>
</div> </div>
<div class="flex flex-col gap-6 mt-6"> </div>
<span class="text-2xl font-semibold">$ {{ item.price }}</span> <div class="flex flex-col gap-6 mt-6">
<div class="flex gap-2"> <span class="text-2xl font-semibold">$ {{ item.price }}</span>
<p-button icon="pi pi-shopping-cart" label="Buy Now" <div class="flex gap-2">
[disabled]="item.inventoryStatus === 'OUTOFSTOCK'" <p-button icon="pi pi-shopping-cart" label="Buy Now" [disabled]="item.inventoryStatus === 'OUTOFSTOCK'" class="flex-auto whitespace-nowrap" styleClass="w-full"></p-button>
class="flex-auto whitespace-nowrap"></p-button> <p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button>
<p-button icon="pi pi-heart" styleClass="h-full" [outlined]="true"></p-button>
</div>
</div> </div>
</div> </div>
</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> </ng-template>
</p-dataview>
</div>
<div class="lg:w-1/3"> <div class="flex flex-col lg:flex-row gap-20">
<div class="card"> <div class="lg:w-2/3">
<div class="font-semibold text-xl mb-4">OrderList</div> <div class="card">
<p-orderlist [value]="orderCities" dataKey="id" breakpoint="575px"> <div class="font-semibold text-xl mb-4">PickList</div>
<ng-template #option let-option> <p-pick-list [source]="sourceCities" [target]="targetCities" breakpoint="1400px">
{{ option.name }} <ng-template #item let-item>
</ng-template> {{ item.name }}
</p-orderlist> </ng-template>
</div> </p-pick-list>
</div> </div>
</div> </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: ` styles: `
::ng-deep { ::ng-deep {
.p-orderlist-list-container{ .p-orderlist-list-container {
width: 100%; width: 100%;
} }
} }
`, `,
providers: [ProductService] providers: [ProductService]
}) })
export class ListDoc { export class ListDoc {
layout: 'list' | 'grid' = 'list'; layout: 'list' | 'grid' = 'list';
options = ['list', 'grid']; options = ['list', 'grid'];
@@ -181,10 +161,10 @@ export class ListDoc {
orderCities: any[] = []; orderCities: any[] = [];
constructor(private productService: ProductService) { } constructor(private productService: ProductService) {}
ngOnInit() { ngOnInit() {
this.productService.getProducts().then(data => this.products = data); this.productService.getProductsSmall().then((data) => (this.products = data.slice(0, 6)));
this.sourceCities = [ this.sourceCities = [
{ name: 'San Francisco', code: 'SF' }, { name: 'San Francisco', code: 'SF' },
@@ -193,7 +173,8 @@ export class ListDoc {
{ name: 'Istanbul', code: 'IST' }, { name: 'Istanbul', code: 'IST' },
{ name: 'Berlin', code: 'BRL' }, { name: 'Berlin', code: 'BRL' },
{ name: 'Barcelona', code: 'BRC' }, { name: 'Barcelona', code: 'BRC' },
{ name: 'Rome', code: 'RM' }]; { name: 'Rome', code: 'RM' }
];
this.targetCities = []; this.targetCities = [];
@@ -204,11 +185,10 @@ export class ListDoc {
{ name: 'Istanbul', code: 'IST' }, { name: 'Istanbul', code: 'IST' },
{ name: 'Berlin', code: 'BRL' }, { name: 'Berlin', code: 'BRL' },
{ name: 'Barcelona', code: 'BRC' }, { name: 'Barcelona', code: 'BRC' },
{ name: 'Rome', code: 'RM' }]; { name: 'Rome', code: 'RM' }
];
} }
getSeverity(product) { getSeverity(product) {
switch (product.inventoryStatus) { switch (product.inventoryStatus) {
case 'INSTOCK': case 'INSTOCK':