Work
This commit is contained in:
parent
f051f20ad9
commit
eceaf3e676
@ -1,8 +1,5 @@
|
|||||||
[Dolphin]
|
[Dolphin]
|
||||||
Timestamp=2024,10,17,12,9,4.965
|
Timestamp=2024,11,17,16,40,18.95
|
||||||
Version=4
|
Version=4
|
||||||
ViewMode=1
|
ViewMode=1
|
||||||
VisibleRoles=Icons_text,Icons_size
|
VisibleRoles=Icons_text,Icons_size
|
||||||
|
|
||||||
[Settings]
|
|
||||||
HiddenFilesShown=true
|
|
||||||
|
69
.env.testing
Normal file
69
.env.testing
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=base64:vRgghlbIdXQxXIEvgUArbI9FURhgdyqx3LDXDwHYSmA=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_TIMEZONE=UTC
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
# APP_MAINTENANCE_STORE=database
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=mysql
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=testing
|
||||||
|
DB_USERNAME=sail
|
||||||
|
DB_PASSWORD=password
|
||||||
|
|
||||||
|
SESSION_DRIVER=database
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=database
|
||||||
|
|
||||||
|
CACHE_STORE=database
|
||||||
|
CACHE_PREFIX=
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mailpit
|
||||||
|
MAIL_PORT=1025
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
SCOUT_DRIVER=meilisearch
|
||||||
|
MEILISEARCH_HOST=http://meilisearch:7700
|
||||||
|
|
||||||
|
MEILISEARCH_NO_ANALYTICS=false
|
118
app/Filament/Resources/CustomerReportResource.php
Normal file
118
app/Filament/Resources/CustomerReportResource.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\CustomerReportResource\Pages;
|
||||||
|
use App\Models\Customer;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CustomerReportResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Customer::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Reports';
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Customer Sales';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
//
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('company_name')
|
||||||
|
->label('Customer')
|
||||||
|
->sortable()
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('subtotal')
|
||||||
|
->money('usd')
|
||||||
|
->alignRight()
|
||||||
|
->getStateUsing(function (Table $table, Model $record) {
|
||||||
|
return $record->getSubtotalAttribute(
|
||||||
|
$table->getFilter('created_at')->getState()['created_at'],
|
||||||
|
$table->getFilter('created_until')->getState()['created_until']
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('gst')
|
||||||
|
->label('GST')
|
||||||
|
->money('usd')
|
||||||
|
->alignRight()
|
||||||
|
->getStateUsing(function (Table $table, Model $record) {
|
||||||
|
return $record->getGstAttribute(
|
||||||
|
$table->getFilter('created_at')->getState()['created_at'],
|
||||||
|
$table->getFilter('created_until')->getState()['created_until']
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('pst')
|
||||||
|
->label('PST')
|
||||||
|
->money('usd')
|
||||||
|
->alignRight()
|
||||||
|
->getStateUsing(function (Table $table, Model $record) {
|
||||||
|
return $record->getPstAttribute(
|
||||||
|
$table->getFilter('created_at')->getState()['created_at'],
|
||||||
|
$table->getFilter('created_until')->getState()['created_until']
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('total')
|
||||||
|
->money('usd')
|
||||||
|
->weight('bold')
|
||||||
|
->alignRight()
|
||||||
|
->getStateUsing(function (Table $table, Model $record) {
|
||||||
|
return $record->getTotalAttribute(
|
||||||
|
$table->getFilter('created_at')->getState()['created_at'],
|
||||||
|
$table->getFilter('created_until')->getState()['created_until']
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\Filter::make('created_at')
|
||||||
|
->form([
|
||||||
|
DatePicker::make('created_at')
|
||||||
|
->label('From date'),
|
||||||
|
]),
|
||||||
|
|
||||||
|
Tables\Filters\Filter::make('created_until')
|
||||||
|
->form([
|
||||||
|
DatePicker::make('created_until')
|
||||||
|
->label('Until date'),
|
||||||
|
]),
|
||||||
|
], layout: Tables\Enums\FiltersLayout::AboveContentCollapsible)
|
||||||
|
->actions([
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListCustomerReports::route('/'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\CustomerReportResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\CustomerReportResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateCustomerReport extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = CustomerReportResource::class;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\CustomerReportResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\CustomerReportResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditCustomerReport extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = CustomerReportResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\CustomerReportResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\CustomerReportResource;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListCustomerReports extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = CustomerReportResource::class;
|
||||||
|
|
||||||
|
protected static ?string $title = 'Customer Reports';
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,8 @@ class EditCustomer extends EditRecord
|
|||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
|
//todo: make report
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Actions\DeleteAction::make(),
|
Actions\DeleteAction::make(),
|
||||||
];
|
];
|
||||||
|
@ -19,7 +19,8 @@ public function form(Form $form): Form
|
|||||||
->schema([
|
->schema([
|
||||||
TextInput::make('first_name'),
|
TextInput::make('first_name'),
|
||||||
TextInput::make('last_name'),
|
TextInput::make('last_name'),
|
||||||
TextInput::make('email'),
|
TextInput::make('email')
|
||||||
|
->email(),
|
||||||
TextInput::make('phone'),
|
TextInput::make('phone'),
|
||||||
TextInput::make('notes'),
|
TextInput::make('notes'),
|
||||||
]);
|
]);
|
||||||
@ -33,7 +34,8 @@ public function table(Table $table): Table
|
|||||||
TextColumn::make('full_name'),
|
TextColumn::make('full_name'),
|
||||||
TextColumn::make('email'),
|
TextColumn::make('email'),
|
||||||
TextColumn::make('phone'),
|
TextColumn::make('phone'),
|
||||||
TextColumn::make('notes'),
|
TextColumn::make('notes')
|
||||||
|
->extraHeaderAttributes(['class' => 'w-full']),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
|
@ -32,7 +32,8 @@ public function table(Table $table): Table
|
|||||||
->label('Username'),
|
->label('Username'),
|
||||||
Tables\Columns\TextColumn::make('account_password')
|
Tables\Columns\TextColumn::make('account_password')
|
||||||
->label('Password'),
|
->label('Password'),
|
||||||
Tables\Columns\TextColumn::make('info_needed'),
|
Tables\Columns\TextColumn::make('info_needed')
|
||||||
|
->extraHeaderAttributes(['class' => 'w-full']),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
|
@ -114,12 +114,13 @@ public static function table(Table $table): Table
|
|||||||
->alignRight(),
|
->alignRight(),
|
||||||
Tables\Columns\TextColumn::make('gst_amount')
|
Tables\Columns\TextColumn::make('gst_amount')
|
||||||
->label('GST')
|
->label('GST')
|
||||||
// ->prefix('$')
|
|
||||||
->money('USD')
|
->money('USD')
|
||||||
->alignRight(),
|
->alignRight(),
|
||||||
Tables\Columns\TextColumn::make('pst_amount')
|
Tables\Columns\TextColumn::make('pst_amount')
|
||||||
->label('PST')
|
->label('PST')
|
||||||
->money('USD')
|
->formatStateUsing(function ($state) {
|
||||||
|
return $state == 0.00 ? '-' : '$'.$state;
|
||||||
|
})
|
||||||
->alignRight(),
|
->alignRight(),
|
||||||
Tables\Columns\TextColumn::make('total')
|
Tables\Columns\TextColumn::make('total')
|
||||||
->money('USD')
|
->money('USD')
|
||||||
|
@ -64,8 +64,9 @@ protected function handleRecordCreation(array $data): Order
|
|||||||
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
|
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//todo: change servce_type
|
||||||
ProductService::create([
|
ProductService::create([
|
||||||
'service_type' => strtoupper($service['service_type']) ?? null,
|
// 'service_type' => strtoupper($service['service_type']) ?? null,
|
||||||
'placement' => strtoupper($service['placement']) ?? null,
|
'placement' => strtoupper($service['placement']) ?? null,
|
||||||
'notes' => strtoupper($service['notes']) ?? null,
|
'notes' => strtoupper($service['notes']) ?? null,
|
||||||
'amount' => $service['amount'] ?? null,
|
'amount' => $service['amount'] ?? null,
|
||||||
@ -76,6 +77,8 @@ protected function handleRecordCreation(array $data): Order
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dd($data);
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
class ServiceTypeResource extends Resource
|
class ServiceTypeResource extends Resource
|
||||||
{
|
{
|
||||||
private ?string $quantity = 'priv';
|
|
||||||
|
|
||||||
protected static ?string $model = ServiceType::class;
|
protected static ?string $model = ServiceType::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
@ -66,7 +64,7 @@ public static function table(Table $table): Table
|
|||||||
$table->getFilter('created_until')->getState()['created_until']
|
$table->getFilter('created_until')->getState()['created_until']
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
->prefix('$'),
|
->money('usd'),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('salesPercentage')
|
Tables\Columns\TextColumn::make('salesPercentage')
|
||||||
->alignRight()
|
->alignRight()
|
||||||
|
@ -21,6 +21,46 @@ class Customer extends Model
|
|||||||
'phone',
|
'phone',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $appends = [
|
||||||
|
'subtotal',
|
||||||
|
'gst',
|
||||||
|
'pst',
|
||||||
|
'total',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function getSubtotalAttribute($created_at = null, $created_until = null): float
|
||||||
|
{
|
||||||
|
return $this->invoices()
|
||||||
|
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
||||||
|
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
||||||
|
->sum('subtotal');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGstAttribute($created_at = null, $created_until = null): float
|
||||||
|
{
|
||||||
|
return $this->invoices()
|
||||||
|
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
||||||
|
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
||||||
|
->sum('total') * 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPstAttribute($created_at = null, $created_until = null): float
|
||||||
|
{
|
||||||
|
return $this->invoices()
|
||||||
|
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
||||||
|
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
||||||
|
->where('pst', true)
|
||||||
|
->sum('total') * 0.07;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTotalAttribute($created_at = null, $created_until = null): float
|
||||||
|
{
|
||||||
|
return $this->invoices()
|
||||||
|
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
||||||
|
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
||||||
|
->sum('total');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany<Contact>
|
* @return HasMany<Contact>
|
||||||
*/
|
*/
|
||||||
@ -55,6 +95,6 @@ public function orders(): HasMany
|
|||||||
|
|
||||||
public function invoices(): HasMany
|
public function invoices(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(invoice::class);
|
return $this->hasMany(Invoice::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,19 +112,6 @@ public function active(): bool
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function generatePdf(): \Illuminate\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
|
||||||
// {
|
|
||||||
// Pdf::view('pdf.order', ['order' => $this])
|
|
||||||
// ->withBrowsershot(function (Browsershot $browsershot) {
|
|
||||||
// $browsershot->noSandbox();
|
|
||||||
// })
|
|
||||||
// ->margins(8, 8, 15, 8)
|
|
||||||
// ->footerView('pdf.order-footer', ['order' => $this])
|
|
||||||
// ->save('order.pdf');
|
|
||||||
//
|
|
||||||
// return redirect('order.pdf');
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Builder<Order> $query
|
* @param Builder<Order> $query
|
||||||
* @return Builder<Order>
|
* @return Builder<Order>
|
||||||
|
@ -30,15 +30,12 @@ public function getQuantityAttribute($created_at = null, $created_until = null):
|
|||||||
->sum('amount');
|
->sum('amount');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAmountAttribute($created_at = null, $created_until = null): string
|
public function getAmountAttribute($created_at = null, $created_until = null): float
|
||||||
{
|
{
|
||||||
return number_format(
|
return $this->productServices()
|
||||||
$this->productServices()
|
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
||||||
->when($created_at, fn ($query) => $query->whereDate('created_at', '>=', $created_at))
|
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
||||||
->when($created_until, fn ($query) => $query->whereDate('created_at', '<=', $created_until))
|
->sum('amount_price');
|
||||||
->sum('amount_price'),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSalesPercentageAttribute($created_at = null, $created_until = null): float
|
public function getSalesPercentageAttribute($created_at = null, $created_until = null): float
|
||||||
@ -67,7 +64,11 @@ public function getAveragePriceAttribute($created_at = null, $created_until = nu
|
|||||||
return '0.0';
|
return '0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return number_format($quantity / $amount, 2);
|
try {
|
||||||
|
return number_format($quantity / $amount, 2);
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
dd($quantity, $amount, $exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function productServices(): HasMany
|
public function productServices(): HasMany
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
"laravel/ui": "^4.5",
|
"laravel/ui": "^4.5",
|
||||||
"mockery/mockery": "^1.6",
|
"mockery/mockery": "^1.6",
|
||||||
"nunomaduro/collision": "^8.0",
|
"nunomaduro/collision": "^8.0",
|
||||||
"pestphp/pest": "^3.5"
|
"pestphp/pest": "^3.5",
|
||||||
|
"pestphp/pest-plugin-laravel": "^3.0",
|
||||||
|
"pestphp/pest-plugin-livewire": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
142
composer.lock
generated
142
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c716025d917e03b26838379028780814",
|
"content-hash": "0c966bb4f2402b99c0398908b98716ba",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anourvalar/eloquent-serialize",
|
"name": "anourvalar/eloquent-serialize",
|
||||||
@ -9129,6 +9129,146 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-09-08T23:23:55+00:00"
|
"time": "2024-09-08T23:23:55+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "pestphp/pest-plugin-laravel",
|
||||||
|
"version": "v3.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/pestphp/pest-plugin-laravel.git",
|
||||||
|
"reference": "7dd98c0c3b3542970ec21fce80ec5c88916ac469"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/pestphp/pest-plugin-laravel/zipball/7dd98c0c3b3542970ec21fce80ec5c88916ac469",
|
||||||
|
"reference": "7dd98c0c3b3542970ec21fce80ec5c88916ac469",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"laravel/framework": "^11.22.0",
|
||||||
|
"pestphp/pest": "^3.0.0",
|
||||||
|
"php": "^8.2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"laravel/dusk": "^8.2.5",
|
||||||
|
"orchestra/testbench": "^9.4.0",
|
||||||
|
"pestphp/pest-dev-tools": "^3.0.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Pest\\Laravel\\PestServiceProvider"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pest": {
|
||||||
|
"plugins": [
|
||||||
|
"Pest\\Laravel\\Plugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/Autoload.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Pest\\Laravel\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "The Pest Laravel Plugin",
|
||||||
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"laravel",
|
||||||
|
"pest",
|
||||||
|
"php",
|
||||||
|
"test",
|
||||||
|
"testing",
|
||||||
|
"unit"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/pestphp/pest-plugin-laravel/tree/v3.0.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.paypal.com/paypalme/enunomaduro",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nunomaduro",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-08T23:32:52+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pestphp/pest-plugin-livewire",
|
||||||
|
"version": "v3.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/pestphp/pest-plugin-livewire.git",
|
||||||
|
"reference": "e2f2edb0a7d414d6837d87908a0e148256d3bf89"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/pestphp/pest-plugin-livewire/zipball/e2f2edb0a7d414d6837d87908a0e148256d3bf89",
|
||||||
|
"reference": "e2f2edb0a7d414d6837d87908a0e148256d3bf89",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"livewire/livewire": "^3.5.6",
|
||||||
|
"pestphp/pest": "^3.0.0",
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^9.4.0",
|
||||||
|
"pestphp/pest-dev-tools": "^3.0.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/Autoload.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Pest\\Livewire\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "The Pest Livewire Plugin",
|
||||||
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"livewire",
|
||||||
|
"pest",
|
||||||
|
"php",
|
||||||
|
"plugin",
|
||||||
|
"test",
|
||||||
|
"testing",
|
||||||
|
"unit"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/pestphp/pest-plugin-livewire/tree/v3.0.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nunomaduro",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/nunomaduro",
|
||||||
|
"type": "patreon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-09T00:05:59+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pestphp/pest-plugin-mutate",
|
"name": "pestphp/pest-plugin-mutate",
|
||||||
"version": "v3.0.5",
|
"version": "v3.0.5",
|
||||||
|
@ -62,6 +62,23 @@
|
|||||||
]) : [],
|
]) : [],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'testing' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_TEST_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_TEST_PORT', '3306'),
|
||||||
|
'database' => env('DB_TEST_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_TEST_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_TEST_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
],
|
||||||
|
|
||||||
'mariadb' => [
|
'mariadb' => [
|
||||||
'driver' => 'mariadb',
|
'driver' => 'mariadb',
|
||||||
'url' => env('DB_URL'),
|
'url' => env('DB_URL'),
|
||||||
|
@ -19,7 +19,7 @@ public function definition(): array
|
|||||||
return [
|
return [
|
||||||
'created_at' => Carbon::now()->subDays(rand(1, 30)),
|
'created_at' => Carbon::now()->subDays(rand(1, 30)),
|
||||||
'gst' => true,
|
'gst' => true,
|
||||||
'pst' => $this->faker->boolean(25),
|
'pst' => $this->faker->boolean(40),
|
||||||
'status' => $this->faker->randomElement(InvoiceStatus::cases())->value,
|
'status' => $this->faker->randomElement(InvoiceStatus::cases())->value,
|
||||||
'customer_id' => $customer->id,
|
'customer_id' => $customer->id,
|
||||||
'updated_at' => Carbon::now(),
|
'updated_at' => Carbon::now(),
|
||||||
|
@ -44,6 +44,9 @@ public function definition(): array
|
|||||||
'garments' => $this->faker->boolean(),
|
'garments' => $this->faker->boolean(),
|
||||||
'supplied_file' => $this->faker->boolean(),
|
'supplied_file' => $this->faker->boolean(),
|
||||||
|
|
||||||
|
'printed' => $this->faker->boolean(),
|
||||||
|
'pre_production' => $this->faker->boolean(),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,5 @@ public function run(): void
|
|||||||
{
|
{
|
||||||
Customer::factory(5)->create();
|
Customer::factory(5)->create();
|
||||||
Customer::factory(['company_name' => 'Genumark'])->create();
|
Customer::factory(['company_name' => 'Genumark'])->create();
|
||||||
|
|
||||||
// ->has(ShippingEntry::factory([
|
|
||||||
// ]))
|
|
||||||
// ->has(ShippingEntry::factory([
|
|
||||||
// 'account_title' => 'Genumark Save-On-Foods',
|
|
||||||
// 'courier' => 'UPS CampusShip',
|
|
||||||
// 'contact' => 'https://www.ups.com/lasso/login',
|
|
||||||
// 'account_username' => 'GenumarkTopNotch',
|
|
||||||
// 'account_password' => 'TopNotch@13579',
|
|
||||||
// 'info_needed' => 'Put PO on box',
|
|
||||||
// 'notify' => 'Jane Wellman',
|
|
||||||
// 'notes' => 'Don\'t CC Kathlyn for SOF orders',
|
|
||||||
// ]))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
public/invoice-tn-in-24-0003.pdf
Normal file
BIN
public/invoice-tn-in-24-0003.pdf
Normal file
Binary file not shown.
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*/
|
|
||||||
// public function test_the_application_returns_a_successful_response(): void
|
|
||||||
// {
|
|
||||||
// $response = $this->get('/');
|
|
||||||
//
|
|
||||||
// $response->assertStatus(200);
|
|
||||||
// }
|
|
||||||
}
|
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pest()->extend(Tests\TestCase::class)
|
pest()->extend(Tests\TestCase::class)
|
||||||
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
|
->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
|
||||||
->in('Feature');
|
->in('Feature');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,7 +4,4 @@
|
|||||||
|
|
||||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase {}
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Unit;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*/
|
|
||||||
public function test_that_true_is_true(): void
|
|
||||||
{
|
|
||||||
$this->assertTrue(true);
|
|
||||||
}
|
|
||||||
}
|
|
38
tests/Unit/OrderTests.php
Normal file
38
tests/Unit/OrderTests.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Filament\Resources\OrderResource\Pages\ListOrders;
|
||||||
|
use App\Models\Customer;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\OrderProduct;
|
||||||
|
use App\Models\ProductService;
|
||||||
|
use App\Models\ServiceFile;
|
||||||
|
|
||||||
|
use function Pest\Livewire\livewire;
|
||||||
|
|
||||||
|
it('can list posts', function () {
|
||||||
|
$customer = Customer::factory()->create();
|
||||||
|
$orders = Order::factory()->for($customer)->count(2)->create();
|
||||||
|
|
||||||
|
livewire(ListOrders::class)
|
||||||
|
->assertCanSeeTableRecords($orders);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can create a post', function () {
|
||||||
|
$customer = Customer::factory()->create();
|
||||||
|
$formData = Order::factory()->for($customer)->create();
|
||||||
|
|
||||||
|
$formData['order_products'] = OrderProduct::factory()->count(2)->create();
|
||||||
|
|
||||||
|
$formData['order_products'][0]['xs'] = 4;
|
||||||
|
$formData['order_products'][1]['s'] = 3;
|
||||||
|
|
||||||
|
$serviceFile1 = ServiceFile::factory()->create();
|
||||||
|
$serviceFile2 = ServiceFile::factory()->create();
|
||||||
|
|
||||||
|
$formData['services'][0] = ProductService::factory()->for($serviceFile1)->create();
|
||||||
|
$formData['services'][1] = ProductService::factory()->for($serviceFile2)->create();
|
||||||
|
|
||||||
|
dd($formData);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user