Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY=base64:GaqTGHuKxQlEwjWIepV5jJPlc0EwlGhpgA17lDwAUN4=
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_TIMEZONE=Asia/Kolkata

FRONTEND_URL=http://localhost:3000

Expand Down
10 changes: 4 additions & 6 deletions backend/app/Filament/Resources/LunchDays/LunchDayResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
use App\Filament\Resources\LunchDays\Pages\EditLunchDay;
use App\Filament\Resources\LunchDays\Pages\ListLunchDays;
use App\Filament\Resources\LunchDays\Schemas\LunchDayForm;
use App\Filament\Resources\LunchDays\Tables\LunchDaysTable;
use App\Models\LunchDay;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class LunchDayResource extends Resource
{
Expand All @@ -28,22 +27,21 @@ public static function form(Schema $schema): Schema
return LunchDayForm::configure($schema);
}


public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('lunch_date')
->date()
->sortable(),

TextColumn::make('menu.title')
->label('Meal'),

TextColumn::make('orders_count')
->counts('orders')
->label('Total Votes'),

TextColumn::make('opted_in_orders_count')
->counts('optedInOrders')
->label('Eating Count')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public function table(Table $table): Table

TextColumn::make('status')
->badge()
->color(fn ($state) =>
$state === 'opted_in' ? 'success' : 'danger'
->color(fn ($state) => $state === 'opted_in' ? 'success' : 'danger'
),

TextColumn::make('created_at')
Expand All @@ -30,4 +29,4 @@ public function table(Table $table): Table
])
->defaultSort('created_at', 'desc');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace App\Filament\Resources\LunchDays\Schemas;

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class LunchDayForm
Expand Down
7 changes: 4 additions & 3 deletions backend/app/Filament/Resources/Users/Schemas/UserForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace App\Filament\Resources\Users\Schemas;

use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Hash;

class UserForm
{
Expand All @@ -23,7 +24,7 @@ public static function configure(Schema $schema): Schema
DateTimePicker::make('email_verified_at'),
TextInput::make('password')
->password()
->dehydrateStateUsing(fn ($state) => \Illuminate\Support\Facades\Hash::make($state))
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->dehydrated(fn ($state) => filled($state))
->required(fn (string $context): bool => $context === 'create'),
Select::make('role')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Filament\Resources\WeeklyMenus\Schemas;

use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\FileUpload;
use Filament\Schemas\Schema;

class WeeklyMenuForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class WeeklyMenusTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class WeeklyMenuResource extends Resource

protected static ?string $modelLabel = 'Weekly Menu';


public static function form(Schema $schema): Schema
{
return WeeklyMenuForm::configure($schema);
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Controllers/Api/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function register(Request $request)
$passwordRules = $this->passwordRules();
// Remove 'confirmed' if it's not provided in the request
if (! $request->has('password_confirmation')) {
$passwordRules = array_filter($passwordRules, fn($rule) => $rule !== 'confirmed');
$passwordRules = array_filter($passwordRules, fn ($rule) => $rule !== 'confirmed');
}

$request->validate([
Expand Down
6 changes: 4 additions & 2 deletions backend/app/Http/Controllers/Api/BroadcastController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use App\Http\Controllers\Controller;
use App\Models\Broadcast;
use Illuminate\Http\Request;
use Carbon\Carbon;
use DB;
use Illuminate\Http\Request;

class BroadcastController extends Controller
{
Expand All @@ -30,6 +30,7 @@ public function index(Request $request)
// Attach is_read flag
$broadcasts->transform(function ($b) use ($readIds) {
$b->is_read = in_array($b->id, $readIds);

return $b;
});

Expand All @@ -40,7 +41,7 @@ public function store(Request $request)
{
$request->validate([
'message' => 'required|string|max:1000',
'type' => 'nullable|string|max:50'
'type' => 'nullable|string|max:50',
]);

$broadcast = Broadcast::create([
Expand All @@ -58,6 +59,7 @@ public function markAsRead(Request $request, $id)
['user_id' => $request->user()->id, 'broadcast_id' => $id],
['created_at' => Carbon::now(), 'updated_at' => Carbon::now()]
);

return response()->json(['success' => true]);
}
}
2 changes: 1 addition & 1 deletion backend/app/Http/Controllers/Api/ExpenseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\MonthlyExpense;
use Illuminate\Http\Request;

class ExpenseController extends Controller
{
Expand Down
Loading
Loading