Compare commits
23 Commits
0c9228bfec
...
actions/ge
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bc8584e7a | |||
| d126e931c8 | |||
|
|
e525e3c526 | ||
| 62bf68ad2e | |||
|
|
caf2f3c1e7 | ||
| c6c63dcb35 | |||
|
|
2ceb76f008 | ||
| d1663ae58a | |||
|
|
988d109acc | ||
| deb46cdda2 | |||
|
|
bc8163a535 | ||
| 002bdc597d | |||
|
|
6834e37429 | ||
| a406d1b58a | |||
|
|
a9012ffc05 | ||
| 58d0b9f0ae | |||
|
|
c67bbc02b6 | ||
| c0d8ca7b1e | |||
|
|
d71837f314 | ||
| f31ab62ec0 | |||
|
|
36a50815f9 | ||
| 4285a31f94 | |||
|
|
11678dd846 |
4
.github/workflows/gemini-pr-review.yaml
vendored
4
.github/workflows/gemini-pr-review.yaml
vendored
@@ -36,8 +36,8 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-npm-global-
|
${{ runner.os }}-npm-global-
|
||||||
|
|
||||||
- name: Install Gemini CLI globally
|
# - name: Install Gemini CLI globally
|
||||||
run: npm install -g --loglevel=http @google/gemini-cli
|
# run: npm install -g --loglevel=http @google/gemini-cli
|
||||||
|
|
||||||
- name: Generate git diff and review with Gemini
|
- name: Generate git diff and review with Gemini
|
||||||
id: review
|
id: review
|
||||||
|
|||||||
@@ -267,9 +267,7 @@ class ItemResource extends Resource
|
|||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
return $plantId
|
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||||
? Item::where('plant_id', $plantId)->pluck('code', 'id')
|
|
||||||
: [];
|
|
||||||
})
|
})
|
||||||
->searchable()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
|||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use App\Models\StickerPrinting;
|
use App\Models\StickerPrinting;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
|
use Str;
|
||||||
|
|
||||||
|
|
||||||
class CreateStickerPrinting extends CreateRecord
|
class CreateStickerPrinting extends CreateRecord
|
||||||
@@ -77,7 +78,65 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
|
|
||||||
$sNumber = $this->form->getState()['serial_number'] ?? null;
|
$sNumber = $this->form->getState()['serial_number'] ?? null;
|
||||||
|
|
||||||
if(empty($this->plantId) || empty($ref) || empty($this->serial_number)) {
|
$pattern1 = '/^(?<item_code>[^|]+)\|(?<serial_number>[^|]+)\|?$/i';
|
||||||
|
|
||||||
|
$pattern2 = '/^(?<item_code>[^|]+)\|(?<serial_number>[^|]+)\|(?<batch_number>.+)$/i';
|
||||||
|
|
||||||
|
$pattern3 = '/^(?<serial_number>[^|]+)$/i';
|
||||||
|
|
||||||
|
|
||||||
|
if (preg_match($pattern1, $sNumber, $matches) || preg_match($pattern2, $sNumber, $matches) || preg_match($pattern3, $sNumber, $matches)) {
|
||||||
|
|
||||||
|
$serial = $matches['serial_number'];
|
||||||
|
|
||||||
|
if (Str::length($serial) < 9) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid Serial Number')
|
||||||
|
->body("Serial number should conatin minimum 9 digits '$serial'.")
|
||||||
|
->warning()
|
||||||
|
->send();
|
||||||
|
$this->form->fill([
|
||||||
|
'plant_id' => $plant,
|
||||||
|
'reference_number' => $ref,
|
||||||
|
'serial_number' => '',
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(!ctype_alnum($serial)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid Serial Number')
|
||||||
|
->body("Serial number should be alphanumeric '$serial'.")
|
||||||
|
->warning()
|
||||||
|
->send();
|
||||||
|
$this->form->fill([
|
||||||
|
'plant_id' => $plant,
|
||||||
|
'reference_number' => $ref,
|
||||||
|
'serial_number' => '',
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$extractedSerialNumber = $matches['serial_number'];
|
||||||
|
$sNumber = $extractedSerialNumber;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid Format')
|
||||||
|
->body("Serial number must be in the format 'itemcode|serialnumber' or 'itemcode|serialnumber|batchnumber'. or just 'serialnumber'.")
|
||||||
|
->warning()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
// Reset only serial number field
|
||||||
|
$this->form->fill([
|
||||||
|
'plant_id' => $plant,
|
||||||
|
'reference_number' => $ref,
|
||||||
|
'serial_number' => '',
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($plant == null || trim($plant) == '' || $ref == null || trim($ref) == '' || $sNumber == null || trim($sNumber) == '')
|
||||||
|
{
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Incomplete Data!')
|
->title('Unknown: Incomplete Data!')
|
||||||
->body("Please ensure Plant, Reference Number, and Serial Number are provided.")
|
->body("Please ensure Plant, Reference Number, and Serial Number are provided.")
|
||||||
@@ -110,16 +169,16 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
StickerPrinting::create([
|
StickerPrinting::create([
|
||||||
'plant_id' => $this->plantId,
|
'plant_id' => $plant,
|
||||||
'reference_number' => $ref,
|
'reference_number' => $ref,
|
||||||
'serial_number' => $this->serial_number,
|
'serial_number' => $sNumber,
|
||||||
'created_by' => Filament::auth()->user()->name,
|
'created_by' => Filament::auth()->user()->name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->dispatch('addStickerToList', $this->plantId, $ref, $this->serial_number);
|
$this->dispatch('addStickerToList', $plant, $ref, $sNumber);
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $this->plantId,
|
'plant_id' => $plant,
|
||||||
'reference_number' => $ref,
|
'reference_number' => $ref,
|
||||||
'serial_number' => '',
|
'serial_number' => '',
|
||||||
]);
|
]);
|
||||||
@@ -175,6 +234,7 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
// Send data to Pdf view
|
// Send data to Pdf view
|
||||||
$pdf = PDF::loadView('pdf.qrcode', [
|
$pdf = PDF::loadView('pdf.qrcode', [
|
||||||
'qrCode' => $qrCode,
|
'qrCode' => $qrCode,
|
||||||
|
'referenceNumber' => $refNumber,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($pdf) {
|
return response()->streamDownload(function () use ($pdf) {
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ use Illuminate\Auth\Access\Response;
|
|||||||
use App\Models\StickerPrinting;
|
use App\Models\StickerPrinting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
|
|
||||||
class StickerPrintingPolicy
|
class StickerPrintingPolicy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can view any models.
|
* Determine whether the user can view any models.
|
||||||
*/
|
*/
|
||||||
public function viewAny(App\Models\User $user): bool
|
public function viewAny(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('view-any StickerPrinting');
|
return $user->checkPermissionTo('view-any StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -19,7 +20,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can view the model.
|
* Determine whether the user can view the model.
|
||||||
*/
|
*/
|
||||||
public function view(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function view(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('view StickerPrinting');
|
return $user->checkPermissionTo('view StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -27,7 +28,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can create models.
|
* Determine whether the user can create models.
|
||||||
*/
|
*/
|
||||||
public function create(App\Models\User $user): bool
|
public function create(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('create StickerPrinting');
|
return $user->checkPermissionTo('create StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can update the model.
|
* Determine whether the user can update the model.
|
||||||
*/
|
*/
|
||||||
public function update(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function update(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('update StickerPrinting');
|
return $user->checkPermissionTo('update StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -43,7 +44,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can delete the model.
|
* Determine whether the user can delete the model.
|
||||||
*/
|
*/
|
||||||
public function delete(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function delete(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('delete StickerPrinting');
|
return $user->checkPermissionTo('delete StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can delete any models.
|
* Determine whether the user can delete any models.
|
||||||
*/
|
*/
|
||||||
public function deleteAny(App\Models\User $user): bool
|
public function deleteAny(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('delete-any StickerPrinting');
|
return $user->checkPermissionTo('delete-any StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -59,7 +60,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can restore the model.
|
* Determine whether the user can restore the model.
|
||||||
*/
|
*/
|
||||||
public function restore(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function restore(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('restore StickerPrinting');
|
return $user->checkPermissionTo('restore StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -67,7 +68,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can restore any models.
|
* Determine whether the user can restore any models.
|
||||||
*/
|
*/
|
||||||
public function restoreAny(App\Models\User $user): bool
|
public function restoreAny(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('restore-any StickerPrinting');
|
return $user->checkPermissionTo('restore-any StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can replicate the model.
|
* Determine whether the user can replicate the model.
|
||||||
*/
|
*/
|
||||||
public function replicate(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function replicate(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('replicate StickerPrinting');
|
return $user->checkPermissionTo('replicate StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can reorder the models.
|
* Determine whether the user can reorder the models.
|
||||||
*/
|
*/
|
||||||
public function reorder(App\Models\User $user): bool
|
public function reorder(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('reorder StickerPrinting');
|
return $user->checkPermissionTo('reorder StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can permanently delete the model.
|
* Determine whether the user can permanently delete the model.
|
||||||
*/
|
*/
|
||||||
public function forceDelete(App\Models\User $user, StickerPrinting $stickerprinting): bool
|
public function forceDelete(User $user, StickerPrinting $stickerprinting): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('force-delete StickerPrinting');
|
return $user->checkPermissionTo('force-delete StickerPrinting');
|
||||||
}
|
}
|
||||||
@@ -99,7 +100,7 @@ class StickerPrintingPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can permanently delete any models.
|
* Determine whether the user can permanently delete any models.
|
||||||
*/
|
*/
|
||||||
public function forceDeleteAny(App\Models\User $user): bool
|
public function forceDeleteAny(User $user): bool
|
||||||
{
|
{
|
||||||
return $user->checkPermissionTo('force-delete-any StickerPrinting');
|
return $user->checkPermissionTo('force-delete-any StickerPrinting');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ return [
|
|||||||
|
|
||||||
'user_model' => \App\Models\User::class,
|
'user_model' => \App\Models\User::class,
|
||||||
|
|
||||||
'user_model_class' => \App\Models\User::class,
|
// 'user_model_class' => \App\Models\User::class,
|
||||||
|
|
||||||
'policies_namespace' => 'App\Policies',
|
'policies_namespace' => 'App\Policies',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import process order']);
|
Permission::updateOrCreate(['name' => 'view import process order']);
|
||||||
Permission::updateOrCreate(['name' => 'view export process order']);
|
Permission::updateOrCreate(['name' => 'view export process order']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import sticker printing']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export sticker printing']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
style="height: 385px;"
|
style="height: 385px;"
|
||||||
>
|
>
|
||||||
<table class="table-auto w-full border-collapse border">
|
<table class="table-auto w-full border-collapse border">
|
||||||
<thead class="bg-gray-100">
|
{{-- <thead class="bg-gray-100"> --}}
|
||||||
|
<thead class="bg-gray-100 text-xs">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="border p-2">No</th>
|
<th class="border p-2">No</th>
|
||||||
<th class="border p-2">Reference No</th>
|
<th class="border p-2">Reference No</th>
|
||||||
@@ -44,7 +45,8 @@
|
|||||||
<th class="border p-2">Created By</th>
|
<th class="border p-2">Created By</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
{{-- <tbody> --}}
|
||||||
|
<tbody class="text-xs">
|
||||||
@forelse($records as $index => $record)
|
@forelse($records as $index => $record)
|
||||||
<tr>
|
<tr>
|
||||||
<td class="border p-2 text-center">{{ $index + 1 }}</td>
|
<td class="border p-2 text-center">{{ $index + 1 }}</td>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</html> --}}
|
</html> --}}
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
{{-- <!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@@ -40,9 +40,53 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<img src="data:image/png;base64,{{ $qrCode }}" />
|
<img src="data:image/png;base64,{{ $qrCode }}" />
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html> --}}
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
@page {
|
||||||
|
margin: 0;
|
||||||
|
size: 100mm 100mm;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100mm;
|
||||||
|
height: 100mm;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
width: 90mm; /* QR CODE REDUCED TO FIT TEXT */
|
||||||
|
height: 90mm;
|
||||||
|
}
|
||||||
|
.ref-text {
|
||||||
|
margin-top: 3mm;
|
||||||
|
font-size: 16px; /* Increased Font Size */
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="ref-text">
|
||||||
|
{{ $referenceNumber }}
|
||||||
|
</div>
|
||||||
|
<img src="data:image/png;base64,{{ $qrCode }}" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user