Main.vue
7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<template>
<div class="grid dashboard">
<div class="col-12 md:col-6 lg:col-4">
<div class="card tasks">
<h5>Tasks</h5>
<ul>
<li>
<Checkbox name="task" value="reports" v-model="tasksCheckbox" />
<span>Sales Report</span>
<span class="task-badge-open">Open<i class="pi pi-circle-on"></i></span>
</li>
<li>
<Checkbox name="task" value="invoices" v-model="tasksCheckbox" />
<span>Pay Invoices</span>
<span class="task-badge-open">Open<i class="pi pi-circle-on"></i></span>
</li>
<li>
<Checkbox name="task" value="party" v-model="tasksCheckbox" />
<span>Birthday Party</span>
<span class="task-badge-open">Open<i class="pi pi-circle-on"></i></span>
</li>
<li>
<Checkbox name="task" value="meeting" v-model="tasksCheckbox" />
<span>Client Meeting</span>
<span class="task-badge-closed">Closed<i class="pi pi-circle-on"></i></span>
</li>
<li>
<Checkbox name="task" value="themes" v-model="tasksCheckbox" />
<span>New Themes</span>
<span class="task-badge-closed">Closed<i class="pi pi-circle-on"></i></span>
</li>
<li>
<Checkbox name="task" value="ticket" v-model="tasksCheckbox" />
<span>Flight Ticket</span>
<span class="task-badge-closed">Closed<i class="pi pi-circle-on"></i></span>
</li>
</ul>
</div>
</div>
<div class="col-12 lg:col-8">
<div class="card table">
<h5>Inventory</h5>
<DataTable :value="products" v-model:selection="selectedProduct" selectionMode="single" dataKey="id" :rows="5" style="margin-bottom: 20px" :paginator="true" responsiveLayout="scroll">
<Column>
<template #header> Logo </template>
<template #body="slotProps">
<img :src="'/demo/images/product/' + slotProps.data.image" :alt="slotProps.data.image" width="50" />
</template>
</Column>
<Column field="code" header="Code" :sortable="true">
<template #body="slotProps">
<span class="p-column-title">Code</span>
{{ slotProps.data.code }}
</template>
</Column>
<Column field="name" header="Name" :sortable="true">
<template #body="slotProps">
<span class="p-column-title">Name</span>
{{ slotProps.data.name }}
</template>
</Column>
<Column field="category" header="Category" :sortable="true">
<template #body="slotProps">
<span class="p-column-title">Category</span>
{{ slotProps.data.category }}
</template>
</Column>
<Column field="price" header="Price" :sortable="true">
<template #body="slotProps">
<span class="p-column-title">Price</span>
{{ formatCurrency(slotProps.data.price) }}
</template>
</Column>
<Column>
<template #header> View </template>
<template #body>
<Button icon="pi pi-search" type="button" class="mr-2"></Button>
<Button icon="pi pi-times" type="button" class="p-button-danger"></Button>
</template>
</Column>
</DataTable>
</div>
</div>
<div class="col-12 lg:col-12">
<div class="card chart">
<h5>Quarter Reports</h5>
<Chart type="line" :data="chartData" :options="chartOptions" />
</div>
</div>
</div>
</template>
<script>
import ProductService from '@/service/ProductService';
export default {
data() {
return {
tasksCheckbox: [],
chartData: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Sales',
data: [12, 19, 3, 5, 2, 3, 9],
borderColor: ['#4CAF50'],
borderWidth: 3,
borderDash: [5, 5],
fill: false,
pointRadius: 3,
tension: 0.4,
},
{
label: 'Income',
data: [1, 2, 5, 3, 12, 7, 15],
backgroundColor: ['rgba(187,222,251,0.2)'],
borderColor: ['#00BCD4'],
borderWidth: 3,
fill: true,
tension: 0.4,
},
{
label: 'Expenses',
data: [7, 12, 15, 5, 3, 13, 21],
borderColor: ['#e91e63'],
borderWidth: 3,
fill: false,
pointRadius: [4, 6, 4, 12, 8, 0, 4],
tension: 0.4,
},
{
label: 'New Users',
data: [3, 7, 2, 17, 15, 13, 19],
borderColor: ['#FF8F00'],
borderWidth: 3,
fill: false,
tension: 0.4,
},
],
},
chartOptions: {
responsive: true,
hover: {
mode: 'index',
},
scales: {
x: {
display: true,
scaleLabel: {
display: true,
labelString: 'Month',
},
},
y: {
display: true,
scaleLabel: {
display: true,
labelString: 'Value',
},
},
},
},
textAreaValue: '',
products: null,
selectedProduct: null,
items: [
{ label: 'Save', icon: 'pi pi-fw pi-check' },
{ label: 'Update', icon: 'pi pi-fw pi-refresh' },
{ label: 'Delete', icon: 'pi pi-fw pi-trash' },
],
};
},
productService: null,
created() {
this.productService = new ProductService();
},
mounted() {
this.productService.getProductsSmall().then((data) => (this.products = data));
},
methods: {
formatCurrency(value) {
return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
},
menuToggle(event) {
this.$refs.menu.toggle(event);
},
},
};
</script>
<style scoped></style>