-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Hasban-Fardani/feat/public-mitra
feat: add new mitra page
- Loading branch information
Showing
14 changed files
with
227 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Partner; | ||
use App\Models\Report; | ||
use Illuminate\Http\Request; | ||
|
||
class MitraController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$mitras = Partner::where('is_active', true)->orderBy('created_at', 'DESC')->get(); | ||
|
||
return view('livewire.mitra', [ | ||
'mitras' => $mitras | ||
]); | ||
} | ||
|
||
public function show($id) | ||
{ | ||
$mitra = Partner::where('is_active', true)->where('id', $id)->first(); | ||
$reports = Report::where('partner_id', $id)->get(); | ||
|
||
// cencored the phone number | ||
$phone = preg_replace('/(\d{4})(\d{4})(\d{4})/', '$1 #### ####', $mitra->phone); | ||
|
||
return view('livewire.detail-mitra', [ | ||
'mitra' => $mitra, | ||
'phone' => $phone, | ||
'reports' => $reports | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Components; | ||
|
||
use Livewire\Component; | ||
|
||
class CardOnlyImage extends Component | ||
{ | ||
public $images; | ||
public $title; | ||
|
||
public $link; | ||
|
||
public function mount($images, $title): void | ||
{ | ||
$this->images = $images; | ||
$this->title = $title; | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.components.card-only-image'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use Livewire\Component; | ||
|
||
class DetailMitra extends Component | ||
{ | ||
public function render() | ||
{ | ||
return view('livewire.detail-mitra'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use Livewire\Component; | ||
|
||
class Mitra extends Component | ||
{ | ||
public function render() | ||
{ | ||
return view('livewire.mitra'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
resources/views/livewire/components/card-only-image.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<a href="{{ $link }}" class="relative grid-cols-1 transition duration-300 ease-in-out hover:scale-95"> | ||
<div class="flex flex-col border"> | ||
<img src="{{ asset($images) }}" alt="{{ $title }}" height="200" width="200" class="w-full bg-gray-50 min-h-32"> | ||
|
||
<div class="flex flex-col gap-4 px-4 py-5"> | ||
<h1 class="text-xl font-semibold">{{ $title }}</h1> | ||
</div> | ||
</div> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<x-layouts.app> | ||
<div id="banner"> | ||
<livewire:components.banner :title="$mitra->company_name" breadcrumbs="Mitra / Detail" position="center" | ||
subHeading="{{ $mitra->company_name }} - {{ $mitra->email }} - {{ $phone }}" :subtitle="$mitra->address" /> | ||
</div> | ||
|
||
<div id="detailMitra" class="px-40 pt-20 pb-10"> | ||
<livewire:components.container> | ||
<div class="px-4 md:px-20"> | ||
<div class="flex flex-col my-5"> | ||
<div class="flex items-center justify-center w-full bg-gray-50"> | ||
<img src="{{ asset($mitra->logo) }}" alt="{{ $mitra->company_name }}" | ||
class="object-contain w-48 h-48"> | ||
</div> | ||
<p class="mt-4 text-lg text-gray-600"> | ||
{{ $mitra->description }} | ||
</p> | ||
</div> | ||
</div> | ||
|
||
</livewire:components.container> | ||
</div> | ||
|
||
<div class="px-28 divider"></div> | ||
|
||
<div id="laporan" class="px-10 pt-10"> | ||
<livewire:components.container title="Laporan Dari Mitra"> | ||
<div class="grid grid-cols-1 px-20 py-10 lg:grid-cols-4 md:grid-cols-3 gap-7"> | ||
@forelse ($reports as $report) | ||
@php | ||
$images = $report->files | ||
@endphp | ||
|
||
<livewire:components.card-with-button :title="$report->title" :images="$images[0]" :description="$report->description" | ||
link="/report/{{ $report->id }}" :date="$report->realization_date" /> | ||
@empty | ||
<h1>tidak ada data</h1> | ||
@endforelse | ||
|
||
<div class="flex items-center justify-center pt-6 pb-10 col-span-full"> | ||
<x-mary-button label="Lihat semua laporan" class="btn-md btn-outline" link="/report" /> | ||
</div> | ||
</div> | ||
</livewire:components.container> | ||
</div> | ||
|
||
<div class="flex flex-wrap w-full"> | ||
<div id="contact" class="w-full p-4 md:w-1/2"> | ||
<livewire:components.container title="Hubungi Kami" | ||
subtitle="hubungi kami melalui formulir di samping, atau melalui kontak di bawah" | ||
fontClass="pt-4 text-stone-500"> | ||
<div class="px-20 py-8"> | ||
<livewire:components.contact-form icon="o-map-pin" title="Alamat" | ||
content="Jl. Sunan Kalijaga No.7,Sumber, Kec. Sumber, Kabupaten Cirebon, | ||
Jawa Barat 45611" /> | ||
<livewire:components.contact-form icon="o-phone" title="Phone" | ||
content="(0231) 321197 atau (0231) 3211792" /> | ||
<livewire:components.contact-form icon="o-envelope" title="Email" | ||
content="[email protected]" /> | ||
</div> | ||
</livewire:components.container> | ||
</div> | ||
<div class="w-full md:w-1/2"> | ||
<div class="flex items-start justify-center h-full p-16"> | ||
<img src="{{ asset('storage/images/bg-basemap.png') }}" width="400" height="400" | ||
alt="Map Cirebon"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<livewire:components.footer /> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<x-layouts.app> | ||
<div id="banner"> | ||
<livewire:components.banner title="Mitra" subtitle="Mitra CSR Kabupaten Cirebon" breadcrumbs="Mitra" | ||
position="center" /> | ||
</div> | ||
|
||
<div id="mitra" class="px-20 py-14"> | ||
<livewire:components.container class="items-center"> | ||
<div class="flex w-full gap-5"> | ||
<x-mary-button label="Laporan Terbanyak" icon-right="m-chevron-down" class="w-1/5 btn btn-outline" /> | ||
<x-mary-button label="Cari kegiatan..." icon="o-magnifying-glass" class="w-4/5 btn btn-outline" /> | ||
</div> | ||
<div class="grid grid-cols-1 py-10 lg:grid-cols-4 md:grid-cols-3 gap-7"> | ||
@foreach ($mitras as $mitra) | ||
{{-- {{ dd($mitra) }} --}} | ||
<livewire:components.card-only-image :title="$mitra->company_name" :images="$mitra->logo" | ||
link="/mitra/{{ $mitra->id }}" /> | ||
@endforeach | ||
</div> | ||
</livewire:components.container> | ||
</div> | ||
|
||
<div class="flex flex-wrap w-full"> | ||
<div id="contact" class="w-full p-4 md:w-1/2"> | ||
<livewire:components.container title="Hubungi Kami" | ||
subtitle="hubungi kami melalui formulir di samping, atau melalui kontak di bawah" | ||
fontClass="pt-4 text-stone-500"> | ||
<div class="px-20 py-8"> | ||
<livewire:components.contact-form icon="o-map-pin" title="Alamat" | ||
content="Jl. Sunan Kalijaga No.7,Sumber, Kec. Sumber, Kabupaten Cirebon, | ||
Jawa Barat 45611" /> | ||
<livewire:components.contact-form icon="o-phone" title="Phone" | ||
content="(0231) 321197 atau (0231) 3211792" /> | ||
<livewire:components.contact-form icon="o-envelope" title="Email" | ||
content="[email protected]" /> | ||
</div> | ||
</livewire:components.container> | ||
</div> | ||
<div class="w-full md:w-1/2"> | ||
<div class="flex items-start justify-center h-full p-16"> | ||
<img src="{{ asset('storage/images/bg-basemap.png') }}" width="400" height="400" | ||
alt="Map Cirebon"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<livewire:components.footer /> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters