diff --git a/app/Http/Controllers/Dashboard/OverviewController.php b/app/Http/Controllers/Dashboard/OverviewController.php index fcc50c6..7d2bdc0 100644 --- a/app/Http/Controllers/Dashboard/OverviewController.php +++ b/app/Http/Controllers/Dashboard/OverviewController.php @@ -3,13 +3,61 @@ namespace App\Http\Controllers\Dashboard; use App\Http\Controllers\Controller; +use App\Models\Cooperation; +use App\Models\Media; +use App\Models\Order; +use App\Models\User; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; class OverviewController extends Controller { public function index(){ - return view('dashboard.overview.index', [ - 'title' => 'Ikhtisar', - ]); + + $data = [ + 'title' => 'Ikhtisar' + ]; + + if(is_role(['3'])){ + $mediaId = Auth::user()->company->media->id; + $media = Media::with('cooperations')->findOrFail($mediaId); + $user = User::with(['announcements'])->find(Auth::id()); + + // Data pengumuman + $data['announcements'] = $user->announcements() + ->where(function ($query) { + $query->where('announcements_users.category', '=', 'general'); + }) + ->get(); + + // Data pengajuan kerjasama + $data['cooperationRequests'] = $media->cooperations() + ->where(function ($query) { + $query->where('media_cooperations.status', '=', '0'); + }) + ->get(); + + // Data Kerjasama + $data['cooperationMedia'] = $media->cooperations->filter(function ($cooperation) use ($mediaId){ + return $cooperation->proposals->where('status', 1)->where('media_id', $mediaId)->isNotEmpty(); + }); + + // Data media order + $data['mediaOrders'] = $media->orders() + ->where(function ($query) { + $query->where('media_orders.status', '=', '1'); + }) + ->get(); + + }else if(is_role(['1'])){ + // Data pengajuan kerjasama + $data['cooperationRequests'] = Cooperation::all(); + + // Data media order + $data['mediaOrders'] = Order::with(['cooperation'])->get(); + + } + + return view('dashboard.overview.index', $data); } } diff --git a/resources/views/dashboard/overview/index.blade.php b/resources/views/dashboard/overview/index.blade.php index a76b53a..2c2bcfe 100644 --- a/resources/views/dashboard/overview/index.blade.php +++ b/resources/views/dashboard/overview/index.blade.php @@ -11,6 +11,7 @@

Ikhtisar

+ {{-- {{dd($cooperationRequests)}} --}}
@@ -18,17 +19,9 @@
@@ -37,136 +30,44 @@
-
-
-
-
-
+
+
+
+
+
-
Today Orders
+
Statistik Isu
-
-
-
1,945
-
- -
-
-
4.63% vs. last week
+
+
-
-
-
-
-
-
-
-
-
-
-
Today Revenue
-
-
-
-
-
$2,338
-
- -
-
-
2.34% vs. last week
-
-
-
-
-
-
-
-
-
-
-
-
Today Customers
-
-
-
-
-
847
-
- -
-
-
4.63% vs. last week
-
-
-
-
-
-
-
-
-
-
-
-
Today Visitors
-
-
-
-
-
23,485
-
- -
-
-
2.34% vs. last week
-
-
-
-
-
-
-
-
-
-
-
-
Sales Statistics
-
-
- -
-
-
    +
    • - - Total Order + + Krisis
    • - - Cancelled Order + + Negatif +
      +
    • +
    • +
      + + Netral +
      +
    • +
    • +
      + + Positif
    -
    - -
    -
    -
    01 Jul, 2020
    -
    30 Jul, 2020
    -
@@ -177,29 +78,53 @@
-
Order Statistics
+
Statistik Kanal Monitoring Media
- +
  • - - Completed + + Facebook
  • - - Processing + + Twitter
  • - - Cancelled + + Website +
    +
  • +
  • +
    + + YouTube +
    +
  • +
  • +
    + + Instagram +
    +
  • +
  • +
    + + TikTok +
    +
  • +
  • +
    + + Cetak
@@ -208,281 +133,95 @@
-
-
-
-
-
Store Statistics
+
+
+
+
+
+
Statistik Media Order
+
-
-
    -
  • -
    -
    Orders
    -
    1,795
    -
    - -
  • -
  • -
    -
    Customers
    -
    2,327
    -
    - -
  • -
  • -
    -
    Products
    -
    674
    -
    - -
  • -
  • -
    -
    Categories
    -
    68
    -
    - -
  • -
-
+
+ +
+
    +
  • +
    + + Menunggu +
    +
  • +
  • +
    + + Diterima +
    +
  • +
  • +
    + + Ditolak +
    +
  • +
+
+
-
-
-
-
-
-
Recent Orders
+
+
+
+
+
+
+
Statistik Kanal Rekap Konten
+
-
+
+ +
+
    +
  • +
    + + Facebook +
    +
  • +
  • +
    + + Instagram +
    +
  • +
  • +
    + + TikTok +
    +
  • +
  • +
    + + Twitter +
    +
  • +
+
-
-
-
Order No.
-
Customer
-
Date
-
Amount
-
Status
-
-
-
- #95954 -
-
-
-
- AB -
-
- Abu Bin Ishtiyak -
-
-
-
- 02/11/2020 -
-
- 4,596.75 USD -
-
- Paid -
-
-
-
- #95850 -
-
-
-
- DE -
-
- Desiree Edwards -
-
-
-
- 02/02/2020 -
-
- 596.75 USD -
-
- Cancelled -
-
-
-
- #95812 -
-
-
-
- -
-
- Blanca Schultz -
-
-
-
- 02/01/2020 -
-
- 199.99 USD -
-
- Paid -
-
-
-
- #95256 -
-
-
-
- NL -
-
- Naomi Lawrence -
-
-
-
- 01/29/2020 -
-
- 1099.99 USD -
-
- Paid -
-
-
-
- #95135 -
-
-
-
- CH -
-
- Cassandra Hogan -
-
-
-
- 01/29/2020 -
-
- 1099.99 USD -
-
- Due -
-
-
-
-
-
-
-
-
-
-
Top products
-
-
- -
-
-
    -
  • -
    - -
    -
    -
    Pink Fitness Tracker
    -
    $99.00
    -
    -
    -
    $990.00
    -
    10 Sold
    -
    -
  • -
  • -
    - -
    -
    -
    Purple Smartwatch
    -
    $99.00
    -
    -
    -
    $990.00
    -
    10 Sold
    -
    -
  • -
  • -
    - -
    -
    -
    Black Smartwatch
    -
    $99.00
    -
    -
    -
    $990.00
    -
    10 Sold
    -
    -
  • -
  • -
    - -
    -
    -
    Black Headphones
    -
    $99.00
    -
    -
    -
    $990.00
    -
    10 Sold
    -
    -
  • -
  • -
    - -
    -
    -
    iPhone 7 Headphones
    -
    $99.00
    -
    -
    -
    $990.00
    -
    10 Sold
    -
    -
  • -
-
+
+
+
+
+
+
+
-@include('partials.dashboard.footer') +@include('partials.dashboard.footer', ['overview_page' => true]) diff --git a/resources/views/partials/app/calendars/admin.blade.php b/resources/views/partials/app/calendars/admin.blade.php new file mode 100644 index 0000000..7bda3b6 --- /dev/null +++ b/resources/views/partials/app/calendars/admin.blade.php @@ -0,0 +1,238 @@ + diff --git a/resources/views/partials/app/calendars/media.blade.php b/resources/views/partials/app/calendars/media.blade.php new file mode 100644 index 0000000..a387fb5 --- /dev/null +++ b/resources/views/partials/app/calendars/media.blade.php @@ -0,0 +1,248 @@ + diff --git a/resources/views/partials/app/overview-statistics.blade.php b/resources/views/partials/app/overview-statistics.blade.php new file mode 100644 index 0000000..51a6888 --- /dev/null +++ b/resources/views/partials/app/overview-statistics.blade.php @@ -0,0 +1,818 @@ + diff --git a/resources/views/partials/dashboard/footer.blade.php b/resources/views/partials/dashboard/footer.blade.php index 5475bc0..17e76fc 100644 --- a/resources/views/partials/dashboard/footer.blade.php +++ b/resources/views/partials/dashboard/footer.blade.php @@ -113,6 +113,17 @@ @include('partials.app.datatable', ['datatable' => $datatable]) @endif +@if (isset($overview_page)) + +@include('partials.app.overview-statistics') + + @if(is_role(['1'])) + @include('partials.app.calendars.admin') + @elseif (is_role(['3'])) + @include('partials.app.calendars.media') + @endif +@endif + @if (isset($rich_editor))