Skip to content

Commit

Permalink
Add Families (#64)
Browse files Browse the repository at this point in the history
* Add Families

* wip

* Add /admin prefix to routes

* rename memberships to members

* de-dupe tables across surfaces

* wip

* wip

* detail card redesign (im getting off topic)

* wip

* wip

* wip

* wip

* start tests

* wip

* Apply fixes from StyleCI (#65)

Co-authored-by: StyleCI Bot <[email protected]>

* fix ?

* fix

* fix tests

* update deps

* add tests

* add tests

* add testz

* wip - stripe payouts, user password changes

* change enums to string backed for DB

* wip - filament enum badges

* fix long descriptions

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
tadhgboyle and StyleCIBot authored Sep 24, 2024
1 parent 8441703 commit 1f67358
Show file tree
Hide file tree
Showing 255 changed files with 4,197 additions and 2,172 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

STRIPE_KEY=your-stripe-key
STRIPE_SECRET=your-stripe-secret
10 changes: 3 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -21,6 +21,8 @@ jobs:
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress
- name: Run Vite
run: npm install && npm run build
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
Expand All @@ -30,10 +32,4 @@ jobs:
mkdir -p database
touch database/database.sqlite
- name: Execute tests via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
CACHE_DRIVER: array
SESSION_DRIVER: array
QUEUE_DRIVER: sync
run: vendor/bin/phpunit
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ A lightweight, selfhosted web app that camps, resorts and schools can use as a P
#### Activity Information Page
![Activity Information Page](https://i.imgur.com/QopdJEz.png)

#### Statistics Page
![Statistics Page](https://i.imgur.com/o4FJcdI.png)

#### Stock Adjustment Page
![Stock Adjustment Page](https://i.imgur.com/VDWtJ6O.png)

Expand All @@ -107,7 +104,6 @@ A lightweight, selfhosted web app that camps, resorts and schools can use as a P
- If repeating activity, add a column (nullable), for root activity, the ID of the original activity it is duplicating
- Disable submit button when anything goes wrong *(Remaining: Stock, Categories)*
- Then on the backend, if they somehow bypass the disabled submit button: on errors during order, return back with their input + quantities
- Maybe add an ajax call before actually submitting the form to make it less jarring
- Complete inventory features
- "Set stock" in adjust page as well as add/subtract.
- Change user list to display deleted users (with toggle) & implement un-deleting (for products as well).
Expand All @@ -120,22 +116,8 @@ A lightweight, selfhosted web app that camps, resorts and schools can use as a P
- (Todo) Staff sales tracking (Charts).
- (Todo) User's favorite items (Charts).
- Add sales/discounts to item for period of time (automatic or button)
- Add auditing/tracking of everything
- Role changes
- New users
- Price changes
- Stock changes
- Gift card balance changes
- These + stock could be done by using a ledger data structure; append new row when data changes
- Etc
- Bulk change prices of items (Everything 10% *off* or everything 20% *more* etc)
- Add PDF printing of all users orders
- In settings page, allow to upload a custom logo to be on invoice
- Allow user to change light/dark mode
- Staff Discount: check if purchaser is staff role and give % off (per item basis)
- Lazy loading of users/products (especially in cashier view).
- Use this https://github.com/yajra/laravel-datatables
- They should type a query first, or use some ajax to fetch data. or else it could take forever to load
- Tax-free products / users
- User tags (tax free tagged, limit of xyz tag, etc)
- Allow categories to be PST and/or GST exempt
Expand All @@ -145,11 +127,8 @@ A lightweight, selfhosted web app that camps, resorts and schools can use as a P
- Gift card given (would need to let gift cards optionally have an assigned user, but should prolly still be able to be used by anyone)
- Admin emails: New user made, settings changed, etc
- Store credit
- Add check balance modal for gift card (under a "tools" dropdown?)
- Add way to "hide used gift cards" in gift card list
- Convert jquery ajax requests to use axios
- Let orders use multiple gift cards
- When editing entities, correctly return back to the list/show page the user was previously on upon success
- Add "cost" to products and display margins
- Create `Cart` model to represent an in-flight order, then use to implement cashier functionality with livewire and get rid of the fuckin item-sidebar.js
- Ability to mark products as final sale/cannot be returned
Expand All @@ -158,5 +137,4 @@ A lightweight, selfhosted web app that camps, resorts and schools can use as a P

## Issues/Bugs
- When cashier page refreshed with gift card, ensure it still has balance + update balance in table row
- Make settings boxes/columns more fluid, so it doesn't look odd when people have subset of permissions
- Make seeders only create past entities nothing in the future
29 changes: 29 additions & 0 deletions app/Enums/ActivityStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum ActivityStatus implements HasLabel, HasColor
{
case InProgress;
case Ended;
case Upcoming;

public function getLabel(): string
{
return match ($this) {
self::InProgress => 'In Progress',
self::Ended => 'Ended',
self::Upcoming => 'Upcoming',
};
}

public function getColor(): string
{
return match ($this) {
self::InProgress => 'success',
default => 'gray',
};
}
}
8 changes: 4 additions & 4 deletions app/Enums/CategoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Enums;

enum CategoryType: int
enum CategoryType: string
{
case ProductsActivities = 1;
case Products = 2;
case Activities = 3;
case ProductsActivities = 'products_activities';
case Products = 'products';
case Activities = 'activities';

public function getName(): string
{
Expand Down
9 changes: 9 additions & 0 deletions app/Enums/FamilyMemberRole.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Enums;

enum FamilyMemberRole: string
{
case Admin = 'admin';
case Member = 'member';
}
27 changes: 27 additions & 0 deletions app/Enums/GiftCardStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum GiftCardStatus implements HasLabel, HasColor
{
case Active;
case Expired;

public function getLabel(): string
{
return match ($this) {
self::Active => 'Active',
self::Expired => 'Expired',
};
}

public function getColor(): string
{
return match ($this) {
self::Active => 'success',
self::Expired => 'danger',
};
}
}
21 changes: 16 additions & 5 deletions app/Enums/OrderStatus.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum OrderStatus: int
enum OrderStatus: string implements HasLabel, HasColor
{
case NotReturned = 0;
case PartiallyReturned = 1;
case FullyReturned = 2;
case NotReturned = 'not_returned';
case PartiallyReturned = 'partially_returned';
case FullyReturned = 'fully_returned';

public function getWord(): string
public function getLabel(): string
{
return match ($this) {
self::NotReturned => 'Not Returned',
self::PartiallyReturned => 'Partially Returned',
self::FullyReturned => 'Fully Returned',
};
}

public function getColor(): string
{
return match ($this) {
self::NotReturned => 'gray',
self::PartiallyReturned => 'warning',
self::FullyReturned => 'danger',
};
}
}
30 changes: 30 additions & 0 deletions app/Enums/PayoutStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum PayoutStatus: string implements HasLabel, HasColor
{
case Pending = 'pending';
case Paid = 'paid';
case Cancelled = 'cancelled';

public function getLabel(): string
{
return match ($this) {
self::Pending => 'Pending',
self::Paid => 'Paid',
self::Cancelled => 'Cancelled',
};
}

public function getColor(): string
{
return match ($this) {
self::Pending => 'warning',
self::Paid => 'success',
self::Cancelled => 'danger',
};
}
}
18 changes: 14 additions & 4 deletions app/Enums/ProductStatus.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum ProductStatus: int
enum ProductStatus: string implements HasLabel, HasColor
{
case Active = 1;
case Active = 'active';

case Draft = 0;
case Draft = 'draft';

public function getWord(): string
public function getLabel(): string
{
return match ($this) {
self::Active => 'Active',
self::Draft => 'Draft',
};
}

public function getColor(): string
{
return match ($this) {
self::Active => 'success',
self::Draft => 'gray',
};
}
}
21 changes: 20 additions & 1 deletion app/Enums/RotationStatus.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum RotationStatus
enum RotationStatus implements HasLabel, HasColor
{
case Past;
case Present;
case Future;

public function getLabel(): string
{
return match ($this) {
self::Past => 'Past',
self::Present => 'Present',
self::Future => 'Future',
};
}

public function getColor(): string
{
return match ($this) {
self::Present => 'success',
default => 'gray',
};
}
}
6 changes: 3 additions & 3 deletions app/Enums/UserLimitDuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Enums;

enum UserLimitDuration: int
enum UserLimitDuration: string
{
case Daily = 0;
case Weekly = 1;
case Daily = 'daily';
case Weekly = 'weekly';

public function label(): string
{
Expand Down
6 changes: 5 additions & 1 deletion app/Helpers/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ class Permission
public const USERS_VIEW = 'users_view';
public const USERS_VIEW_DELETED = 'users_view_deleted'; // TODO
public const USERS_MANAGE = 'users_manage';
public const USERS_PAYOUTS_CREATE = 'users_payouts_create';
public const USERS_LIST_SELECT_ROTATION = 'users_list_select_rotation';

public const FAMILIES = 'families';
public const FAMILIES_LIST = 'families_list';
public const FAMILIES_VIEW = 'families_view';
public const FAMILIES_MANAGE = 'families_manage';

public const PRODUCTS = 'products';
public const PRODUCTS_LIST = 'products_list';
public const PRODUCTS_VIEW = 'products_view';
Expand Down
1 change: 0 additions & 1 deletion app/Helpers/PermissionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function __construct()
Permission::USERS_LIST => 'List all users',
Permission::USERS_VIEW => 'View specific user information',
Permission::USERS_MANAGE => 'Edit/Create/Delete users',
Permission::USERS_PAYOUTS_CREATE => 'Create payouts',
Permission::USERS_LIST_SELECT_ROTATION => 'View users from other rotations',
]);

Expand Down
40 changes: 0 additions & 40 deletions app/Helpers/RoleHelper.php

This file was deleted.

Loading

0 comments on commit 1f67358

Please sign in to comment.