Muhammad Iqbal Afandi преди 3 години
родител
ревизия
2b735b1ee3

+ 3
- 0
app/Services/DashboardService.php Целия файл

@@ -63,6 +63,9 @@ class DashboardService
63 63
     {
64 64
         return [
65 65
             "title" => __("words.sale_and_purchase"),
66
+            "description" => __("words.period", [
67
+                "number" => now()->translatedFormat("Y"),
68
+            ]),
66 69
             "data" => [
67 70
                 __("words.sale") => QueryService::amountStatistic("sales"),
68 71
                 __("words.purchase") => QueryService::amountStatistic(

+ 2
- 1
app/Services/QueryService.php Целия файл

@@ -20,7 +20,7 @@ class QueryService
20 20
                  FROM
21 21
                     products
22 22
                  WHERE
23
-                    DATE(updated_at) = CURDATE()) AS amountToday"
23
+                    DATE(created_at) = CURDATE()) AS amountToday"
24 24
             )
25 25
             ->get()
26 26
             ->transform(
@@ -41,6 +41,7 @@ class QueryService
41 41
                 "COUNT(*) AS amount,
42 42
                  DATE_FORMAT(created_at, '%b') AS month"
43 43
             )
44
+            ->whereRaw("YEAR(created_at) = YEAR(CURDATE())")
44 45
             ->groupByRaw("month")
45 46
             ->orderByRaw("created_at")
46 47
             ->get()

+ 1
- 0
lang/en/words.php Целия файл

@@ -43,4 +43,5 @@ return [
43 43
     "stock_product" => "Stock Product",
44 44
     "best_product" => "Best Product",
45 45
     "sale_and_purchase" => "Sale and Purchase",
46
+    "period" => "Period :number",
46 47
 ];

+ 1
- 0
lang/id/words.php Целия файл

@@ -43,4 +43,5 @@ return [
43 43
     "stock_product" => "Stok Produk",
44 44
     "best_product" => "Produk Terlaris",
45 45
     "sale_and_purchase" => "Penjualan dan Pembelian",
46
+    "period" => "Periode :number",
46 47
 ];

+ 5
- 2
resources/js/pages/Dashboards/Components/CardCart.vue Целия файл

@@ -1,7 +1,9 @@
1 1
 <script setup>
2 2
 defineProps({
3 3
   title: {
4
-    required: true,
4
+    type: String,
5
+  },
6
+  description: {
5 7
     type: String,
6 8
   },
7 9
 })
@@ -9,7 +11,8 @@ defineProps({
9 11
 
10 12
 <template>
11 13
   <div class="card">
12
-    <h5>{{ title }}</h5>
14
+    <h5 class="mb-1">{{ title }}</h5>
15
+    <span>{{ description }}</span>
13 16
 
14 17
     <Chart v-bind="$attrs" />
15 18
   </div>

+ 2
- 1
resources/js/pages/Dashboards/Components/CardProductFavorite.vue Целия файл

@@ -10,7 +10,8 @@ defineProps({
10 10
 <template>
11 11
   <div class="card">
12 12
     <div class="flex justify-content-between align-items-center">
13
-      <h5>{{ data.title }}</h5>
13
+      <h5 class="mb-1">{{ data.title }}</h5>
14
+      <span>{{ data.description }}</span>
14 15
     </div>
15 16
 
16 17
     <ul class="list-none p-0 m-0">

+ 5
- 1
resources/js/pages/Dashboards/Composables/useStatistic.js Целия файл

@@ -30,5 +30,9 @@ export function useStatistic(chartData) {
30 30
     index++
31 31
   }
32 32
 
33
-  return { title: chartData.title, data: chartSettings }
33
+  return {
34
+    title: chartData.title,
35
+    description: chartData.description,
36
+    data: chartSettings,
37
+  }
34 38
 }

+ 5
- 1
resources/js/pages/Dashboards/Composables/useStatisticDualYear.js Целия файл

@@ -30,5 +30,9 @@ export function useStatisticDualYear(chartData) {
30 30
     index++
31 31
   }
32 32
 
33
-  return { title: chartData.title, data: chartSettings }
33
+  return {
34
+    title: chartData.title,
35
+    description: chartData.description,
36
+    data: chartSettings,
37
+  }
34 38
 }

+ 3
- 0
resources/js/pages/Dashboards/Index.vue Целия файл

@@ -44,6 +44,7 @@ const purchasePriceStatistic = useStatisticDualYear(
44 44
             <CardCart
45 45
               type="line"
46 46
               :title="salePurchaseAmountStatistic.title"
47
+              :description="salePurchaseAmountStatistic.description"
47 48
               :data="salePurchaseAmountStatistic.data"
48 49
             />
49 50
           </div>
@@ -56,6 +57,7 @@ const purchasePriceStatistic = useStatisticDualYear(
56 57
             <CardCart
57 58
               type="bar"
58 59
               :title="salePriceStatistic.title"
60
+              :description="salePriceStatistic.description"
59 61
               :data="salePriceStatistic.data"
60 62
             />
61 63
           </div>
@@ -64,6 +66,7 @@ const purchasePriceStatistic = useStatisticDualYear(
64 66
             <CardCart
65 67
               type="bar"
66 68
               :title="purchasePriceStatistic.title"
69
+              :description="purchasePriceStatistic.description"
67 70
               :data="purchasePriceStatistic.data"
68 71
             />
69 72
           </div>