Skip to content

Commit

Permalink
Merge pull request #95 from frontChapter/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
lokiwich authored Mar 4, 2024
2 parents e36a954 + 3f66806 commit 09c3293
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 29 deletions.
22 changes: 19 additions & 3 deletions app/Filament/Resources/GiftResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use App\Filament\Resources\GiftResource\Pages;
use App\Models\Gift;
use Ariaieboy\FilamentJalaliDatetime\JalaliDateTimeColumn;
use Ariaieboy\FilamentJalaliDatetimepicker\Forms\Components\JalaliDatePicker;
use Ariaieboy\FilamentJalaliDatetimepicker\Forms\Components\JalaliDateTimePicker;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
Expand Down Expand Up @@ -65,6 +67,10 @@ public static function form(Form $form): Form
->translateLabel()
->required()
->maxLength(255),
JalaliDateTimePicker::make('expired_at')
->required()
->translateLabel()
->required(),
Forms\Components\TextInput::make('link')
->nullable()
->translateLabel()
Expand All @@ -76,30 +82,40 @@ public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('user.id')
->sortable()
->label('Email')
Tables\Columns\TextColumn::make('user.name')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('title')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('description')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('type')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('value')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('code')
->translateLabel()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('link')
->translateLabel()
->sortable()
->searchable(),
JalaliDateTimeColumn::make('expired_at')
->sortable()
->translateLabel()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: false),
JalaliDateTimeColumn::make('created_at')
->sortable()
->translateLabel()
Expand Down
10 changes: 10 additions & 0 deletions app/Models/Gift.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ class Gift extends Model
'value',
'type',
'link',
'expired_at',
'user_id',
];

/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'expired_at' => 'datetime',
];

/**
* Get the user that owns the site
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('gifts', function (Blueprint $table) {
$table->timestamp('expired_at')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('gifts', function (Blueprint $table) {
$table->dropColumn('expired_at');
});
}
};
4 changes: 3 additions & 1 deletion lang/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@
"Admin Panel": "پنل مدیریت",
"filament-spatie-roles-permissions::filament-spatie.section.users": "کاربران",
"Participants in conference": "شرکت کنندگان در همایش",
":number people have registered so far": "تا این لحظه :number نفر ثبت نام کرده‌اند",
":number people have registered": ":number نفر ثبت نام کرده‌اند",
"Changing language": "در حال تغییر زبان",
"Front Chapter Festival": "جشنواره فرانت چپتر",
"Register In Festival": "ثبت‌نام در جشنواره",
Expand Down Expand Up @@ -1012,6 +1012,8 @@
"Your access has been blocked for 5 minutes.": "دسترسی شما به مدت ۵ دقیقه بسته شده است.",
"The voting deadline is over 😿": "مهلت رای گیری تمام شد 😿",
"Discount amount": "میزان تخفیف",
"Participants in Front Chapter conference 2024": "شرکت کنندگان در همایش فرانت‌چپتر ۱۴۰۲",
"Expired at": "تاریخ انقضا",
"": "",
"test": "test"
}
56 changes: 41 additions & 15 deletions resources/views/components/gift-card.blade.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@
<div class="flex flex-col gap-3 lg:flex-row items-center p-4 text-secondary-200 rounded {{ $bgColor }}">
<div class="w-full">
<h3 class="mb-1 text-xl font-semibold leading-tight">
{{ $title }}
</h3>
<p>{{ $description }}</p>
</div>
<div class="flex gap-3 shadow items-stretch text-secondary-200 rounded {{ $bgColor }}">
<div class="flex gap-2 w-full p-4 flex-col lg:flex-row">
<div class="w-full">
<h3 class="mb-1 text-xl font-semibold leading-tight">
{{ $title }}
</h3>
<p>{{ $description }}</p>
@isset($href)
<div class="hidden lg:block">
<x-button sm :rightIcon="app()->getLocale() === 'fa' ? 'chevron-left' : 'chevron-right'" class="mt-2 min-w-max" dark
target="_blank" :label="__('Apply Coupon')" :$href />
</div>
@endisset
</div>

<div class="flex items-center justify-start w-full gap-4 lg:justify-end ms-auto">
<div class="flex flex-col w-full gap-1 lg:w-max">
<div class="flex items-center justify-start w-full gap-2 lg:justify-end">
<p>
{{ __('Discount code') }}:
<div class="flex lg:flex-col items-center lg:justify-center text-sm min-w-max gap-4 lg:gap-2">
@isset($value)
<div class="lg:w-full">
<p class="opacity-85">
{{ __('Discount amount') }}
</p>
<x-badge class="font-mono ms-auto lg:ms-0" white lg :label="$code" />
<p class="font-semibold">{{ $value }}</p>
</div>
@isset($expire)
<p class="text-end">{{ __('Expires at: :expiration', ['Expiration' => $expire]) }}</p>
<div class="border-r-2 lg:border-r-0 lg:border-b-2 border-white/30 h-4 lg:h-0 lg:w-full"></div>
@endisset
@endisset
@isset($expire)
<div class="lg:w-full">
<p class="opacity-85">
{{ __('Expired at') }}
</p>
<p class="font-semibold">{{ $expire }}</p>
</div>
@endisset
</div>
</div>

<div class="flex flex-col min-w-36 justify-center items-center bg-white/15 p-4 gap-1">
<p>
{{ __('Discount code') }}
</p>
<x-badge class="font-mono shadow-lg" white lg :label="$code" />
@isset($href)
<x-button class="ms-auto lg:ms-0 min-w-max" dark target="_blank" :label="__('Apply Coupon')" :$href />
<div>
<x-button sm :rightIcon="app()->getLocale() === 'fa' ? 'chevron-left' : 'chevron-right'"
class="mt-3 min-w-max lg:hidden" dark target="_blank" :label="__('Apply Coupon')" :$href />
</div>
@endisset
</div>
</div>
2 changes: 0 additions & 2 deletions resources/views/layouts/template/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
'label' => __('Front Chapter 2024'),
'url' => route('conf1402'),
'isActive' => request()->routeIs('conf1402'),
'blinkBdge' => true,
];
$links[] = [
'label' => __('I am a HERO Festival'),
'url' => route('festival-site'),
'isActive' => request()->routeIs('festival-site'),
'blinkBdge' => true,
];
@endphp
<x-check-email-verified />
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/home/show-home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="container mx-auto my-8">
<div class="flex flex-col gap-y-4">
@if(!empty(env('EVAND_SLUG')))
{{-- @if(!empty(env('EVAND_SLUG')))
<div class="flex flex-col gap-4 py-4 text-center xl:py-8">
<h2 class="text-4xl font-black leading-normal animate-text-recolor md:text-5xl xl:text-6xl xl:leading-relaxed">{{ __('Registration in the second Front Chapter conference') }}</h2>
<p class="text-xl">{{ __('29 February 2024') }} - {{ __('Mazandaran, Amol') }}</p>
Expand All @@ -29,7 +29,7 @@
</div>
@endauth
</div>
@endif
@endif --}}

<livewire:home.ticket-buyers lazy/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/home/ticket-buyers.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="mx-auto text-center">
@if(!empty($buyers))
<h3 class="mt-12 text-4xl font-extrabold leading-loose text-green-500">{{ __('Participants in conference') }}</h3>
<p class="mb-8 text-xl">{{ __(':number people have registered so far', ['number' => count($buyers)]) }}</p>
<h3 class="mt-12 text-4xl font-extrabold leading-loose text-green-500">{{ __('Participants in Front Chapter conference 2024') }}</h3>
<p class="mb-8 text-xl">{{ __(':number people have registered', ['number' => count($buyers)]) }}</p>
<x-card cardClasses="border-green-500 border">
<div class="flex flex-wrap justify-center grid-cols-12 gap-2 my-4 justify-items-center">
@foreach ($buyers as $buyer)
Expand Down
8 changes: 4 additions & 4 deletions resources/views/livewire/user/gift/list-gifts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

<div class="flex flex-col gap-4">
@foreach ($gifts as $gift)
<x-gift-card :href="$gift->link" :title="$gift->title" :description="$gift->description" :code="$gift->code" bgColor="bg-teal-600" />
<x-gift-card :value="$gift->value" :expire="$gift->expired_at->toJalali()" :href="$gift->link" :title="$gift->title" :description="$gift->description" :code="$gift->code" bgColor="bg-teal-600" />
@endforeach
@foreach ($tickets as $ticket)
<x-gift-card :title="__('Pachim')" :description="__('New experience in server and site management')" :code="$ticket->is_vip ? 'fchapter' : 'pchapter'" bgColor="bg-sky-600" />
<x-gift-card :title="__('Roocket')" :description="__('Roocket, the story of the beginning of a programmer')" :code="$ticket->is_vip ? 'fchapter' : 'rchapter'" bgColor="bg-rose-600" />
<x-gift-card expire="۱۴۰۲/۱۲/۱۹" href="https://console.liara.ir/rewards" :title="__('Liara')" :description="__('In less than 5 minutes, run your program on the server')" code="{{ $ticket->code }}" bgColor="bg-teal-600" />
<x-gift-card expire="۱۴۰۲/۱۲/۲۹ ۲۳:۵۹" href="https://app.pachim.sh/profile/billing" :title="__('Pachim')" :description="__('New experience in server and site management')" :value="$ticket->is_vip ? '۹۰٪' : '۸۰٪'" :code="$ticket->is_vip ? 'fchapter' : 'pchapter'" bgColor="bg-sky-600" />
<x-gift-card expire="۱۴۰۲/۱۲/۲۹ ۲۳:۵۹" href="https://roocket.ir/series" :title="__('Roocket')" :description="__('Roocket, the story of the beginning of a programmer')" :value="$ticket->is_vip ? '۶۰٪' : '۴۰٪'" :code="$ticket->is_vip ? 'fchapter' : 'rchapter'" bgColor="bg-rose-600" />
<x-gift-card expire="۱۴۰۲/۱۲/۱۹ ۲۳:۵۹" href="https://console.liara.ir/rewards" :title="__('Liara')" :description="__('In less than 5 minutes, run your program on the server')" :value="$ticket->is_vip ? '۵ میلیون ریال' : '۳ میلیون ریال'" code="{{ $ticket->code }}" bgColor="bg-teal-600" />
@endforeach

@if (count($gifts) === 0 && count($tickets) === 0)
Expand Down

0 comments on commit 09c3293

Please sign in to comment.