Skip to content

Commit

Permalink
Merge pull request #41 from tomatophp/develop
Browse files Browse the repository at this point in the history
add marketplace and blog
  • Loading branch information
3x1io authored Mar 28, 2024
2 parents eacb692 + 23e3dd7 commit 92e1f22
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 6 deletions.
26 changes: 26 additions & 0 deletions Modules/CircleXO/App/Http/Controllers/CircleXOController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ public function index()
return view('circle-xo::index', compact('page'));
}

public function marketplace(Request $request)
{
$query = AccountListing::query();
$query->with('account')->where('type', 'product')->orWhere('type', 'service')->where('is_active', true);
if($request->has('search') && !empty($request->get('search'))){
$query->where('title', 'LIKE', '%'.$request->get('search').'%');
}

$products = $query->orderBy('id', 'desc')->paginate(10);

return view('circle-xo::marketplace', compact('products'));
}

public function blog(Request $request)
{
$query = AccountListing::query();
$query->with('account')->where('type', 'post')->where('is_active', true);
if($request->has('search') && !empty($request->get('search'))){
$query->where('title', 'LIKE', '%'.$request->get('search').'%');
}

$posts = $query->orderBy('id', 'desc')->paginate(10);

return view('circle-xo::blog', compact('posts'));
}

public function verify(Account $account)
{
if($account->type === 'verified'){
Expand Down
60 changes: 60 additions & 0 deletions Modules/CircleXO/resources/views/blog.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@php
SEO::openGraphType('WebPage');
SEO::openGraphSiteName('Blog | '. setting('site_name'));
SEO::openGraphTitle('Blog | '. setting('site_name'));
SEO::openGraphUrl(url()->current());
SEO::openGraphImage(setting('site_profile'));
SEO::metaByProperty('og:description',setting('site_description'));
SEO::twitterCard('summary_large_image');
SEO::twitterTitle('Blog | '. setting('site_name'));
SEO::twitterDescription(setting('site_description'));
SEO::twitterImage(setting('site_profile'));
SEO::canonical(url()->current());
@endphp
@seoTitle('Blog | '. setting('site_name'))
@seoDescription(setting('site_description'))
@seoKeywords(setting('site_keywords'))


<x-circle-xo-app-layout>
<div class="min-h-screen bg-zinc-900 text-white">
<div class="bg-zinc-800 border-b border-zinc-700">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 flex items-baseline justify-between p-4">
<x-splade-link :href="route('home.blog')" class="text-4xl font-bold tracking-tight text-zinc-200">
{{__('Blog')}}
</x-splade-link>

<div class="flex justify-center items-center flex-col">
<x-splade-form method="GET" action="{{url()->current()}}" :default="['search' => request()->get('search') ?? '']">
<x-splade-input type="search" name="search" placeholder="{{__('Search ...')}}" />
</x-splade-form>
</div>
</div>
</div>
<div class="flex items-center justify-center w-full">
<div class="w-full lg:w-1/2 xl:w-1/3">

@if(!$posts->count())
<div class="bg-zinc-800 border border-zinc-700 mx-8 md:mx-0 mt-6 mb-8 rounded-lg shadow-sm flex justify-center">
<div class="p-8 md:p-16 text-center">
<i class="bx bx-x-circle bx-lg text-danger-500"></i>
<h1>{{__('Sorry There is not posts, please change search')}}</h1>
</div>
</div>
@else
<div class="grid grid-cols-1 gap-4 mx-8 md:mx-0 my-4">
@foreach($posts as $item)
<x-circle-xo-listing-card :item="$item" :link="url($item->account->username .'/posts/'.$item->id)"/>
@endforeach
</div>

<div class="mx-8 lg:mx-0 my-4">
{!! $posts->links('tomato-admin::components.pagination') !!}
</div>
@endif
</div>
</div>
</div>
</x-circle-xo-app-layout>
10 changes: 10 additions & 0 deletions Modules/CircleXO/resources/views/components/menu-items.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
<span class="ms-3 text-zinc-300 group-hover:text-white">{{__('Home')}}</span>
</x-splade-link>

<x-splade-link :href="route('home.marketplace')" class="flex items-center p-2 text-xl rounded-lg hover:bg-zinc-700 group transition-all">
<i class="bx bx-store text-zinc-100 transition duration-75 group-hover:text-white"></i>
<span class="ms-3 text-zinc-300 group-hover:text-white">{{__('Marketplace')}}</span>
</x-splade-link>

<x-splade-link :href="route('home.blog')" class="flex items-center p-2 text-xl rounded-lg hover:bg-zinc-700 group transition-all">
<i class="bx bxs-news text-zinc-100 transition duration-75 group-hover:text-white"></i>
<span class="ms-3 text-zinc-300 group-hover:text-white">{{__('Blog')}}</span>
</x-splade-link>

@foreach(menu('main') as $item)
@if(str($item->url)->contains('profile') && auth('accounts')->user())
@if($item->target === '_blank')
Expand Down
5 changes: 3 additions & 2 deletions Modules/CircleXO/resources/views/listing/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</x-slot>
<x-splade-form :default="[
'type' => 'link',
'is_active' => true,
]" class="flex flex-col gap-4" method="POST" action="{{route('profile.listing.store')}}">
<div class="grid grid-cols-3 lg:grid-cols-5 gap-4">
<x-circle-xo-listing-filter-item
Expand Down Expand Up @@ -95,7 +96,7 @@
</div>
</div>

<x-splade-checkbox name="is_active" label="Active" />
<x-splade-submit spinner label="Save" class="bg-main-600 border-main-400 text-zinc-900" />
<x-splade-checkbox name="is_active" :label="__('Public')" />
<x-splade-submit spinner :label="__('Save')" class="bg-main-600 border-main-400 text-zinc-900" />
</x-splade-form>
</x-splade-modal>
5 changes: 2 additions & 3 deletions Modules/CircleXO/resources/views/listing/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@
</div>
</div>

<x-splade-checkbox name="is_active" label="Active" />

<x-splade-checkbox name="is_active" :label="__('Public')" />

<div class="flex justify-start gap-4">
<x-tomato-admin-submit spinner :label="__('Update')" class="bg-main-600 border-main-400 text-zinc-900" />
<x-tomato-admin-submit spinner :label="__('Update')" />
<x-tomato-admin-button danger confirm-danger method="DELETE" :href="route('profile.listing.destroy', $listing)" :label="__('Delete Listing')" />
</div>
</x-splade-form>
Expand Down
59 changes: 59 additions & 0 deletions Modules/CircleXO/resources/views/marketplace.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@php
SEO::openGraphType('WebPage');
SEO::openGraphSiteName('Marketplace | '. setting('site_name'));
SEO::openGraphTitle('Marketplace | '. setting('site_name'));
SEO::openGraphUrl(url()->current());
SEO::openGraphImage(setting('site_profile'));
SEO::metaByProperty('og:description',setting('site_description'));
SEO::twitterCard('summary_large_image');
SEO::twitterTitle('Marketplace | '. setting('site_name'));
SEO::twitterDescription(setting('site_description'));
SEO::twitterImage(setting('site_profile'));
SEO::canonical(url()->current());
@endphp
@seoTitle('Marketplace | '. setting('site_name'))
@seoDescription(setting('site_description'))
@seoKeywords(setting('site_keywords'))

<x-circle-xo-app-layout>
<div class="min-h-screen bg-zinc-900 text-white">
<div class="bg-zinc-800 border-b border-zinc-700">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 flex items-baseline justify-between p-4">
<x-splade-link :href="route('home.marketplace')" class="text-4xl font-bold tracking-tight text-zinc-200">
{{__('Marketplace')}}
</x-splade-link>

<div class="flex justify-center items-center flex-col">
<x-splade-form method="GET" action="{{url()->current()}}" :default="['search' => request()->get('search') ?? '']">
<x-splade-input type="search" name="search" placeholder="{{__('Search ...')}}" />
</x-splade-form>
</div>
</div>
</div>
<div class="flex items-center justify-center w-full">
<div class="w-full lg:w-1/2 xl:w-1/3">

@if(!$products->count())
<div class="bg-zinc-800 border border-zinc-700 mx-8 md:mx-0 mt-6 mb-8 rounded-lg shadow-sm flex justify-center">
<div class="p-8 md:p-16 text-center">
<i class="bx bx-x-circle bx-lg text-danger-500"></i>
<h1>{{__('Sorry There is not products or services, please change search')}}</h1>
</div>
</div>
@else
<div class="grid grid-cols-1 gap-4 mx-8 md:mx-0 my-4">
@foreach($products as $item)
<x-circle-xo-listing-card :item="$item" />
@endforeach
</div>

<div class="mx-8 lg:mx-0 my-4">
{!! $products->links('tomato-admin::components.pagination') !!}
</div>
@endif
</div>
</div>
</div>
</x-circle-xo-app-layout>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
</div>
<main class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<x-tomato-markdown-viewer :content="$page->body" />

</main>
</div>
2 changes: 2 additions & 0 deletions Modules/CircleXO/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
Route::get('/faq', [CircleXOController::class, 'faq'])->name('home.faq');
Route::get('/terms', [CircleXOController::class, 'terms'])->name('home.terms');
Route::get('/privacy', [CircleXOController::class, 'privacy'])->name('home.privacy');
Route::get('/marketplace', [CircleXOController::class, 'marketplace'])->name('home.marketplace');
Route::get('/blog', [CircleXOController::class, 'blog'])->name('home.blog');
});

Route::middleware('web')->group(function (){
Expand Down

0 comments on commit 92e1f22

Please sign in to comment.