2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2023-03-26 05:22:57 +00:00
|
|
|
<p>While data is being loaded. <PrimeVueNuxtLink to="/skeleton">Skeleton</PrimeVueNuxtLink> component may be used to indicate the busy state.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
|
|
|
<div class="card">
|
|
|
|
<DataView :value="products" :layout="layout">
|
|
|
|
<template #header>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex justify-end">
|
2024-03-26 10:45:13 +00:00
|
|
|
<SelectButton v-model="layout" :options="options" :allowEmpty="false">
|
|
|
|
<template #option="{ option }">
|
|
|
|
<i :class="[option === 'list' ? 'pi pi-bars' : 'pi pi-th-large']" />
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #list>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="flex flex-col">
|
|
|
|
<div v-for="i in 6" :key="i">
|
2024-05-21 11:49:36 +00:00
|
|
|
<div class="flex flex-col xl:flex-row xl:items-start p-6 gap-6" :class="{ 'border-t border-surface-200 dark:border-surface-700': i !== 0 }">
|
2024-05-20 12:14:38 +00:00
|
|
|
<Skeleton class="w-9/12 sm:w-64 xl:w-40 h-24 block xl:block mx-auto rounded" />
|
|
|
|
<div class="flex flex-col sm:flex-row justify-between items-center xl:items-start flex-1 gap-6">
|
|
|
|
<div class="flex flex-col items-center sm:items-start gap-4">
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex sm:flex-col items-center sm:items-end gap-4 sm:gap-2">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #grid>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="grid grid-cols-12 gap-4">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div v-for="i in 6" :key="i" class="col-span-12 sm:col-span-6 lg:col-span-12 xl: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">
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
<Skeleton class="w-24 rounded h-8" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex flex-col items-center gap-4 py-8">
|
|
|
|
<Skeleton class="w-9/12 rounded h-40" />
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</DataView>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" :service="['ProductService']" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
products: null,
|
2024-05-20 12:14:38 +00:00
|
|
|
layout: 'grid grid-cols-12 gap-4',
|
|
|
|
options: ['list', 'grid grid-cols-12 gap-4'],
|
2023-02-28 08:29:30 +00:00
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<DataView :value="products" :layout="layout">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #header>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex justify-end">
|
2024-03-26 10:45:13 +00:00
|
|
|
<SelectButton v-model="layout" :options="options" :allowEmpty="false">
|
|
|
|
<template #option="{ option }">
|
|
|
|
<i :class="[option === 'list' ? 'pi pi-bars' : 'pi pi-th-large']" />
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #list>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="flex flex-col">
|
|
|
|
<div v-for="i in 6" :key="i">
|
2024-05-21 11:49:36 +00:00
|
|
|
<div class="flex flex-col xl:flex-row xl:items-start p-6 gap-6" :class="{ 'border-t border-surface-200 dark:border-surface-700': i !== 0 }">
|
2024-05-20 12:14:38 +00:00
|
|
|
<Skeleton class="w-9/12 sm:w-64 xl:w-40 h-24 block xl:block mx-auto rounded" />
|
|
|
|
<div class="flex flex-col sm:flex-row justify-between items-center xl:items-start flex-1 gap-6">
|
|
|
|
<div class="flex flex-col items-center sm:items-start gap-4">
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex sm:flex-col items-center sm:items-end gap-4 sm:gap-2">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #grid>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="grid grid-cols-12 gap-4">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div v-for="i in 6" :key="i" class="col-span-12 sm:col-span-6 lg:col-span-12 xl: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">
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
<Skeleton class="w-24 rounded h-8" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex flex-col items-center gap-4 py-8">
|
|
|
|
<Skeleton class="w-9/12 rounded h-40" />
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</DataView>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card">
|
|
|
|
<DataView :value="products" :layout="layout">
|
|
|
|
<template #header>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex justify-end">
|
2024-03-26 10:45:13 +00:00
|
|
|
<SelectButton v-model="layout" :options="options" :allowEmpty="false">
|
|
|
|
<template #option="{ option }">
|
|
|
|
<i :class="[option === 'list' ? 'pi pi-bars' : 'pi pi-th-large']" />
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #list>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="flex flex-col">
|
|
|
|
<div v-for="i in 6" :key="i">
|
2024-05-21 11:49:36 +00:00
|
|
|
<div class="flex flex-col xl:flex-row xl:items-start p-6 gap-6" :class="{ 'border-t border-surface-200 dark:border-surface-700': i !== 0 }">
|
2024-05-20 12:14:38 +00:00
|
|
|
<Skeleton class="w-9/12 sm:w-64 xl:w-40 h-24 block xl:block mx-auto rounded" />
|
|
|
|
<div class="flex flex-col sm:flex-row justify-between items-center xl:items-start flex-1 gap-6">
|
|
|
|
<div class="flex flex-col items-center sm:items-start gap-4">
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex sm:flex-col items-center sm:items-end gap-4 sm:gap-2">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #grid>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="grid grid-cols-12 gap-4">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div v-for="i in 6" :key="i" class="col-span-12 sm:col-span-6 lg:col-span-12 xl: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">
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
<Skeleton class="w-24 rounded h-8" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex flex-col items-center gap-4 py-8">
|
|
|
|
<Skeleton class="w-9/12 rounded h-40" />
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</DataView>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
products: null,
|
2024-05-20 12:14:38 +00:00
|
|
|
layout: 'grid grid-cols-12 gap-4',
|
|
|
|
options: ['list', 'grid grid-cols-12 gap-4'],
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
ProductService.getProductsSmall().then((data) => (this.products = data.slice(0, 6)));
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getSeverity(product) {
|
|
|
|
switch (product.inventoryStatus) {
|
|
|
|
case 'INSTOCK':
|
|
|
|
return 'success';
|
|
|
|
|
|
|
|
case 'LOWSTOCK':
|
2024-04-16 07:35:56 +00:00
|
|
|
return 'warn';
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
case 'OUTOFSTOCK':
|
|
|
|
return 'danger';
|
|
|
|
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card">
|
|
|
|
<DataView :value="products" :layout="layout">
|
|
|
|
<template #header>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex justify-end">
|
2024-03-26 10:45:13 +00:00
|
|
|
<SelectButton v-model="layout" :options="options" :allowEmpty="false">
|
|
|
|
<template #option="{ option }">
|
|
|
|
<i :class="[option === 'list' ? 'pi pi-bars' : 'pi pi-th-large']" />
|
|
|
|
</template>
|
|
|
|
</SelectButton>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #list>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="flex flex-col">
|
|
|
|
<div v-for="i in 6" :key="i">
|
2024-05-21 11:49:36 +00:00
|
|
|
<div class="flex flex-col xl:flex-row xl:items-start p-6 gap-6" :class="{ 'border-t border-surface-200 dark:border-surface-700': i !== 0 }">
|
2024-05-20 12:14:38 +00:00
|
|
|
<Skeleton class="w-9/12 sm:w-64 xl:w-40 h-24 block xl:block mx-auto rounded" />
|
|
|
|
<div class="flex flex-col sm:flex-row justify-between items-center xl:items-start flex-1 gap-6">
|
|
|
|
<div class="flex flex-col items-center sm:items-start gap-4">
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex sm:flex-col items-center sm:items-end gap-4 sm:gap-2">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #grid>
|
2024-05-21 11:38:41 +00:00
|
|
|
<div class="grid grid-cols-12 gap-4">
|
2024-05-20 12:14:38 +00:00
|
|
|
<div v-for="i in 6" :key="i" class="col-span-12 sm:col-span-6 lg:col-span-12 xl: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">
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
<Skeleton class="w-24 rounded h-8" />
|
|
|
|
<Skeleton class="w-12 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex flex-col items-center gap-4 py-8">
|
|
|
|
<Skeleton class="w-9/12 rounded h-40" />
|
|
|
|
<Skeleton class="w-32 rounded h-8" />
|
|
|
|
<Skeleton class="w-24 rounded h-4" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<Skeleton class="w-16 rounded h-8" />
|
|
|
|
<Skeleton shape="circle" class="w-12 h-12" />
|
2023-11-15 09:51:35 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</DataView>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
ProductService.getProductsSmall().then((data) => (products.value = data.slice(0, 6)));
|
|
|
|
});
|
|
|
|
|
|
|
|
const products = ref();
|
2024-05-20 12:14:38 +00:00
|
|
|
const layout = ref('grid grid-cols-12 gap-4');
|
|
|
|
const options = ref(['list', 'grid grid-cols-12 gap-4']);
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
const getSeverity = (product) => {
|
|
|
|
switch (product.inventoryStatus) {
|
|
|
|
case 'INSTOCK':
|
|
|
|
return 'success';
|
|
|
|
|
|
|
|
case 'LOWSTOCK':
|
2024-04-16 07:35:56 +00:00
|
|
|
return 'warn';
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
case 'OUTOFSTOCK':
|
|
|
|
return 'danger';
|
|
|
|
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-02-28 08:29:30 +00:00
|
|
|
data: `
|
2023-11-15 09:51:35 +00:00
|
|
|
/* ProductService */
|
2023-02-28 08:29:30 +00:00
|
|
|
{
|
|
|
|
id: '1000',
|
|
|
|
code: 'f230fh0g3',
|
|
|
|
name: 'Bamboo Watch',
|
|
|
|
description: 'Product Description',
|
|
|
|
image: 'bamboo-watch.jpg',
|
|
|
|
price: 65,
|
|
|
|
category: 'Accessories',
|
|
|
|
quantity: 24,
|
|
|
|
inventoryStatus: 'INSTOCK',
|
|
|
|
rating: 5
|
|
|
|
},
|
|
|
|
...
|
|
|
|
`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
ProductService.getProductsSmall().then((data) => (this.products = data.slice(0, 6)));
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getSeverity(product) {
|
|
|
|
switch (product.inventoryStatus) {
|
|
|
|
case 'INSTOCK':
|
|
|
|
return 'success';
|
|
|
|
|
|
|
|
case 'LOWSTOCK':
|
2024-04-16 07:35:56 +00:00
|
|
|
return 'warn';
|
2023-02-28 08:29:30 +00:00
|
|
|
|
|
|
|
case 'OUTOFSTOCK':
|
|
|
|
return 'danger';
|
|
|
|
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|