Skip to content

Commit ac6c094

Browse files
Merge pull request #81 from khalidmaquilang/dev
v2.3.0 - SI-79 | Hotfix | todays widget + SI-78 | Hotfix | remove currency + SI-75 | Hotfix | sale view fix + SI-74 | Feature | fix plan fields + SI-84 | Feature | add prefix and fix company resource + SI-80 | Feature | Added Scheduler to check expired subscriptions + SI-82 | Feature | added sentry + SI-64 | Feature | goods issue + SI-85 | Feature | able to display limit + SI-86 | Hotfix | fix inventory creation
2 parents b4ac94b + 456094a commit ac6c094

File tree

73 files changed

+2867
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2867
-136
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ AWS_BUCKET=
6262
AWS_USE_PATH_STYLE_ENDPOINT=false
6363

6464
VITE_APP_NAME="${APP_NAME}"
65+
SENTRY_LARAVEL_DSN=

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## :rocket: Deployment
2+
- Run X, Y, Z on bas1
3+
- Add the missing env variables
4+
5+
## Migrations
6+
- 2021_07_23_214950_add_show_in_public_folder_column_to_contact_lists_table.php => `contact_lists` table
7+
- 2021_09_16_010719_alter_filters_table.php => `filters` table
8+
9+
## Packages
10+
- Updated package A
11+
- Added package B
12+
13+
## :memo: Changes
14+
**Change 1:**
15+
- What has changed?
16+
17+
Add links and screenshots here
18+
19+
<hr>
20+
21+
**Change 2:**
22+
- What has changed?
23+
24+
Add links and screenshots here

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DB_PASSWORD=password
2525
- Run ``composer install``
2626
- Run ``npm install``
2727
- Run ``php artisan key:generate``
28-
- Run ``php artisan migrate``
28+
- Run ``php artisan migrate --seed``
2929
- Run ``php artisan shield:generate --all --option=permissions``
3030
- Run ``php artisan serve``
3131
- Run ``npm run dev`` (another window)
@@ -69,3 +69,11 @@ docker run --rm \
6969
- Run ``./vendor/bin/sail artisan shield:generate --all --option=permissions``
7070
- Run ``./vendor/bin/sail npm run dev``
7171
- Open ``localhost`` on your browser
72+
73+
## Deploying Prod
74+
75+
- `composer install --prefer-dist --no-dev -o`
76+
- `php artisan migrate`
77+
- `php artisan optimize`
78+
- `php artisan icon:cache`
79+
- `php artisan filament:clear-cached-components`
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Enums\SubscriptionStatusEnum;
6+
use App\Events\PrepareFreemium;
7+
use App\Services\SubscriptionService;
8+
use Illuminate\Console\Command;
9+
10+
class CheckExpiredSubscriptions extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'app:check-expired-subscriptions';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = "This command checks for active subscriptions that have expired based on their `end_date`. Expired subscriptions are then marked as 'expired', and you can add additional logic here to handle notifications, access restrictions, or other relevant actions.";
25+
26+
/**
27+
* Execute the console command.
28+
*/
29+
public function handle(SubscriptionService $subscriptionService)
30+
{
31+
$subscriptions = $subscriptionService->getExpiredSubscriptions();
32+
foreach ($subscriptions as $subscription) {
33+
$subscription->status = SubscriptionStatusEnum::PAST_DUE;
34+
$subscription->save();
35+
36+
event(new PrepareFreemium($subscription->company));
37+
}
38+
}
39+
}

app/Enums/GoodsIssueTypeEnum.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
use Filament\Support\Contracts\HasColor;
6+
use Filament\Support\Contracts\HasLabel;
7+
8+
enum GoodsIssueTypeEnum: string implements HasColor, HasLabel
9+
{
10+
case SALE = 'sale';
11+
case TRANSFER = 'transfer';
12+
case WRITE_OFF = 'write_off';
13+
case RTO = 'return_to_supplier';
14+
15+
/**
16+
* @return string
17+
*/
18+
public function getLabel(): string
19+
{
20+
return match ($this) {
21+
self::SALE => 'Sale',
22+
self::TRANSFER => 'Transfer',
23+
self::WRITE_OFF => 'Write Off',
24+
self::RTO => 'Return To Supplier',
25+
};
26+
}
27+
28+
/**
29+
* @return string
30+
*/
31+
public function getColor(): string
32+
{
33+
return match ($this) {
34+
self::SALE => 'success',
35+
self::TRANSFER => 'info',
36+
self::WRITE_OFF => 'gray',
37+
self::RTO => 'danger',
38+
};
39+
}
40+
}

app/Enums/StockMovementEnum.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ enum StockMovementEnum: string implements HasColor, HasLabel
1111
case SALE = 'sale';
1212
case ADJUSTMENT = 'adjustment';
1313
case RETURN = 'return';
14+
case TRANSFER = 'transfer';
15+
case WRITE_OFF = 'write_off';
16+
case RTO = 'return_to_supplier';
1417

1518
/**
1619
* @return string
@@ -22,6 +25,9 @@ public function getLabel(): string
2225
self::SALE => 'Sale',
2326
self::ADJUSTMENT => 'Adjustment',
2427
self::RETURN => 'Return',
28+
self::TRANSFER => 'Transfer',
29+
self::WRITE_OFF => 'Write Off',
30+
self::RTO => 'Return To Supplier',
2531
};
2632
}
2733

@@ -35,6 +41,9 @@ public function getColor(): string
3541
self::SALE => 'success',
3642
self::ADJUSTMENT => 'warning',
3743
self::RETURN => 'danger',
44+
self::TRANSFER => 'info',
45+
self::WRITE_OFF => 'gray',
46+
self::RTO => 'danger',
3847
};
3948
}
4049
}

app/Events/GoodsIssueCreated.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use App\Enums\GoodsIssueTypeEnum;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Broadcasting\PrivateChannel;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class GoodsIssueCreated
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
/**
16+
* Create a new event instance.
17+
*/
18+
public function __construct(
19+
public int $productId,
20+
public int $quantity,
21+
public int $userId,
22+
public GoodsIssueTypeEnum $type,
23+
public ?string $customerId = null,
24+
public ?string $supplierId = null,
25+
public string $referenceNumber = '',
26+
) {
27+
//
28+
}
29+
30+
/**
31+
* Get the channels the event should broadcast on.
32+
*
33+
* @return array<int, \Illuminate\Broadcasting\Channel>
34+
*/
35+
public function broadcastOn(): array
36+
{
37+
return [
38+
new PrivateChannel('channel-name'),
39+
];
40+
}
41+
}

app/Events/GoodsReceiptCreated.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Events;
44

5+
use App\Enums\StockMovementEnum;
56
use Illuminate\Broadcasting\InteractsWithSockets;
67
use Illuminate\Broadcasting\PrivateChannel;
78
use Illuminate\Foundation\Events\Dispatchable;
@@ -21,6 +22,7 @@ public function __construct(
2122
public int $userId,
2223
public ?string $supplierId = null,
2324
public string $referenceNumber = '',
25+
public StockMovementEnum $type = StockMovementEnum::PURCHASE,
2426
) {
2527
//
2628
}

app/Events/PrepareFreemium.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use App\Models\Company;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Broadcasting\PrivateChannel;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class PrepareFreemium
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
/**
16+
* Create a new event instance.
17+
*/
18+
public function __construct(public Company $company)
19+
{
20+
//
21+
}
22+
23+
/**
24+
* Get the channels the event should broadcast on.
25+
*
26+
* @return array<int, \Illuminate\Broadcasting\Channel>
27+
*/
28+
public function broadcastOn(): array
29+
{
30+
return [
31+
new PrivateChannel('channel-name'),
32+
];
33+
}
34+
}

app/Events/SaleCreated.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Events;
44

5+
use App\Enums\StockMovementEnum;
56
use Illuminate\Broadcasting\InteractsWithSockets;
67
use Illuminate\Broadcasting\PrivateChannel;
78
use Illuminate\Foundation\Events\Dispatchable;
@@ -15,12 +16,18 @@ class SaleCreated
1516
* Create a new event instance.
1617
*/
1718
public function __construct(
19+
public int $companyId,
20+
public int $saleId,
21+
public $saleDate,
1822
public int $productId,
23+
public string $sku,
24+
public string $name,
1925
public int $quantity,
2026
public float $unitCost,
2127
public int $userId,
2228
public ?string $customerId = null,
2329
public string $referenceNumber = '',
30+
public StockMovementEnum $type = StockMovementEnum::SALE,
2431
) {
2532
//
2633
}

0 commit comments

Comments
 (0)