Skip to content

Commit

Permalink
Add carrier Seeder and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts committed Jun 10, 2024
1 parent df1c10e commit fb5edf3
Show file tree
Hide file tree
Showing 21 changed files with 149 additions and 140 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<img src="https://github.com/shopperlabs/framework/workflows/tests/badge.svg" alt="Build Status">
</a>
<a href="https://laravel.com">
<img alt="Laravel v9.x" src="https://img.shields.io/badge/Laravel-v9.x-FF2D20">
<img alt="Laravel v10.x" src="https://img.shields.io/badge/Laravel-v10.x-FF2D20">
</a>
<a href="https://packagist.org/packages/shopper/framework">
<img src="https://img.shields.io/packagist/dt/shopper/framework" alt="Total Downloads">
Expand Down
178 changes: 81 additions & 97 deletions composer.lock

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions packages/admin/public/shopper.css
Original file line number Diff line number Diff line change
Expand Up @@ -3681,6 +3681,10 @@ html {
z-index: 1;
}

.order-first {
order: -9999;
}

.col-\[--col-span-default\] {
grid-column: var(--col-span-default);
}
Expand Down Expand Up @@ -4677,6 +4681,12 @@ html {
user-select: none;
}

.select-all {
-webkit-user-select: all;
-moz-user-select: all;
user-select: all;
}

.resize-none {
resize: none;
}
Expand Down Expand Up @@ -5577,6 +5587,10 @@ html {
--tw-bg-opacity: 0.75;
}

.\!bg-none {
background-image: none !important;
}

.bg-gradient-to-b {
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
}
Expand Down
6 changes: 3 additions & 3 deletions packages/admin/resources/lang/fr/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
'disable' => 'Désactiver',
'edit' => 'Éditer',
'view' => 'Voir',
'enable' => 'Activer',
'enable' => 'Activé',
'export' => 'Exportez',
'nevermind' => 'Peu importe',
'update' => 'Modifier',
Expand All @@ -167,8 +167,8 @@
'cancel_order' => 'Annuler',
'send' => 'Envoyer',
'logout_session' => 'Déconnecter les autres sessions',
'approve' => 'Approuver',
'disapprove' => 'Désapprouver',
'approve' => 'Approuvé',
'disapprove' => 'Désapprouvé',
'create' => 'Créer',
'upload' => 'Télécharger',
'verified' => 'Vérifié',
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/resources/lang/fr/modals.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'new' => 'Nouvelle permission',
'new_description' => 'Ajouter une nouvelle autorisation et l\'attribuer directement à ce rôle',
'labels' => [
'name' => 'Nom de la permission (en minuscules)',
'name' => 'Permission (en minuscules)',
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/admin/resources/lang/fr/pages/attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'description' => 'Les attributes associés à votre produit. Ces attributs une fois sélectionnés, pourront être associés pour générer une combinaison de variantes',

'values' => [
'slug' => 'Valeurs',
'title' => 'Valeurs d\'attributs',
'description' => 'Ajouter des valeurs par défaut pour cet attribut. Ces valeurs pourront être disponibles dans l\' onglet attributs des produits.',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class="h-5 w-5 text-gray-400 dark:text-gray-500"
</h5>
@if ($activated)
<x-filament::badge size="sm" color="success" icon="untitledui-check-verified">
{{ __('shopper::forms.actions.enabled') }}
{{ __('shopper::forms.actions.enable') }}
</x-filament::badge>
@endif
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class="flex items-center space-x-4 text-sm leading-5 text-gray-900 dark:text-whi
<dd class="flex text-sm leading-5 text-gray-900 sm:col-span-2 sm:mt-0">
<x-shopper::badge
:style="$customer->opt_in ? 'success' : 'gray'"
:value="$customer->opt_in ? __('shopper::forms.actions.enabled') : __('shopper::forms.actions.disabled')"
:value="$customer->opt_in ? __('shopper::forms.actions.enable') : __('shopper::forms.actions.disable')"
/>
</dd>
</div>
Expand All @@ -111,7 +111,7 @@ class="flex items-center space-x-4 text-sm leading-5 text-gray-900 dark:text-whi
<dd class="flex text-sm leading-5 text-gray-900 dark:text-white sm:col-span-2 sm:mt-0">
<x-shopper::badge
:style="$customer->two_factor_secret ? 'success' : 'gray'"
:value="$customer->two_factor_secret ? __('shopper::forms.actions.enabled') : __('shopper::forms.actions.disabled')"
:value="$customer->two_factor_secret ? __('shopper::forms.actions.enable') : __('shopper::forms.actions.disable')"
/>
</dd>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Components/Form/AddressField.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function make(?string $prefix = null): array
Components\TextInput::make(self::getPrefix($prefix) . 'city')
->label(__('shopper::forms.label.city'))
->required(),
Components\TextInput::make(self::getPrefix($prefix) . 'zipcode')
Components\TextInput::make(self::getPrefix($prefix) . 'postal_code')
->label(__('shopper::forms.label.postal_code'))
->required(),
Components\Select::make(self::getPrefix($prefix) . 'country_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\Validate;
use Shopper\Core\Models\Setting;
use Shopper\Traits\SaveSettings;
use Spatie\LivewireWizard\Components\StepComponent;
Expand All @@ -20,17 +19,6 @@ final class StoreAddress extends StepComponent implements HasForms
use InteractsWithForms;
use SaveSettings;

#[Validate('required|string')]
public ?string $street_address = null;

#[Validate('required')]
public ?string $postcode = null;

#[Validate('required')]
public ?string $city = null;

public ?string $phone_number = null;

public ?array $data = [];

public function mount(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ final class StoreSocialLink extends StepComponent implements HasForms
use InteractsWithForms;
use SaveSettings;

public ?string $facebook_link = null;

public ?string $instagram_link = null;

public ?string $twitter_link = null;

public ?array $data = [];

public function mount(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public function table(Table $table): Table
Tables\Actions\Action::make('stock')
->label('Add stock')
->icon('untitledui-package')
->modal()
->color('gray')
->modalWidth(MaxWidth::ExtraLarge)
->form([
Expand Down
8 changes: 3 additions & 5 deletions packages/admin/src/Livewire/Pages/Attribute/Browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function table(Table $table): Table
arguments: ['attributeId' => $record->id]
)
)
->visible(fn (Attribute $record) => in_array($record->type->value, Attribute::fieldsWithValues())),
->visible(fn (Attribute $record) => in_array($record->type, Attribute::fieldsWithValues())),

Tables\Actions\Action::make('edit')
->label(__('shopper::forms.actions.edit'))
Expand All @@ -97,8 +97,7 @@ public function table(Table $table): Table
$records->each->delete();

Notification::make()
->title(__('shopper::components.tables.status.delete'))
->body(
->title(
__('shopper::notifications.delete', [
'item' => __('shopper::pages/attributes.single'),
])
Expand All @@ -114,8 +113,7 @@ public function table(Table $table): Table
$records->each->updateStatus();

Notification::make()
->title(__('shopper::components.tables.status.updated'))
->body(
->title(
__('shopper::notifications.enabled', [
'item' => __('shopper::pages/attributes.single'),
])
Expand Down
6 changes: 4 additions & 2 deletions packages/admin/src/Livewire/Pages/Product/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\On;
use Shopper\Core\Models\Product;
use Shopper\Core\Repositories\Store\ProductRepository;
use Shopper\Livewire\Pages\AbstractPageComponent;

class Edit extends AbstractPageComponent implements HasActions, HasForms
{
use InteractsWithActions;
use InteractsWithForms;

public Product $product;
public $product;

public function mount(): void
{
$this->authorize('edit_products');

$this->product = (new ProductRepository())->getById((int) $this->product);
}

public function deleteAction(): Action
Expand Down
6 changes: 4 additions & 2 deletions packages/admin/src/Livewire/Pages/Product/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Illuminate\Contracts\View\View;
use Shopper\Core\Models\Product;
use Shopper\Core\Repositories\Store\ProductRepository;
use Shopper\Feature;
use Shopper\Livewire\Pages\AbstractPageComponent;

class Index extends AbstractPageComponent implements HasForms, HasTable
Expand Down Expand Up @@ -68,8 +69,9 @@ public function table(Table $table): Table
Tables\Columns\TextColumn::make('brand.name')
->label(__('shopper::forms.label.brand'))
->searchable()
->toggleable()
->sortable(),
->sortable()
->toggleable(Feature::enabled('brand'))
->hidden(! Feature::enabled('brand')),

Tables\Columns\ViewColumn::make('stock')
->label(__('shopper::layout.tables.stock'))
Expand Down
2 changes: 0 additions & 2 deletions packages/admin/src/Livewire/SlideOvers/AttributeValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function table(Table $table): Table
->icon('untitledui-edit-04')
->color('gray')
->iconButton()
->modal()
->modalHeading(__('shopper::forms.actions.edit'))
->modalWidth(MaxWidth::ExtraLarge)
->fillForm(fn (AttributeValue $record): array => [
Expand Down Expand Up @@ -123,7 +122,6 @@ public function table(Table $table): Table
Tables\Actions\Action::make('add')
->label(__('shopper::forms.actions.add_label', ['label' => __('shopper::forms.label.value')]))
->badge()
->modal()
->modalHeading(__('shopper::modals.attributes.new_value', ['attribute' => $this->attribute->name]))
->modalWidth(MaxWidth::ExtraLarge)
->form($this->formSchema())
Expand Down
20 changes: 20 additions & 0 deletions packages/core/database/seeders/CarrierSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Shopper\Core\Database\Seeders;

use Illuminate\Database\Seeder;
use Shopper\Core\Models\Carrier;

final class CarrierSeeder extends Seeder
{
public function run(): void
{
Carrier::query()->create([
'name' => 'Manual',
'slug' => 'manual',
'is_enabled' => true,
]);
}
}
1 change: 1 addition & 0 deletions packages/core/database/seeders/ShopperSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function run(): void
$this->call(CurrenciesTableSeeder::class);
$this->call(LegalsPageTableSeeder::class);
$this->call(ChannelSeeder::class);
$this->call(CarrierSeeder::class);

Model::reguard();
}
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@
/**
* @property-read int $id
* @property int|null $parent_id
* @property string $name
* @property string|null $slug
* @property string|null $sku
* @property string|null $barcode
* @property bool $featured
* @property int|null $price_amount
* @property int|null $old_price_amount
* @property int|null $cost_amount
* @property int|null $security_stock
* @property string|null $seo_title
* @property string|null $seo_description
* @property \Carbon\Carbon|null $published_at
* @property-read int $stock
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/Traits/HasMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shopper\Core\Traits;

use Spatie\Image\Manipulations;
use Spatie\Image\Enums\Fit;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

Expand Down Expand Up @@ -33,14 +33,14 @@ public function registerMediaConversions(?Media $media = null): void
foreach ($conversions as $key => $conversion) {
$this->addMediaConversion($key)
->fit(
Manipulations::FIT_FILL,
Fit::Fill,
$conversion['width'],
$conversion['height']
)->keepOriginalImageFormat();
}

$this->addMediaConversion('thumb_200')
->fit(Manipulations::FIT_CROP, 200, 200)
->fit(Fit::Crop, 200, 200)
->keepOriginalImageFormat();
}
}
2 changes: 1 addition & 1 deletion tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;
use Shopper\Core\CoreServiceProvider;
use Shopper\Providers\ShopperServiceProvider;
use Shopper\ShopperServiceProvider;
use Shopper\Sidebar\SidebarServiceProvider;
use Shopper\Tests\Models\User;
use Spatie\MediaLibrary\MediaLibraryServiceProvider;
Expand Down

0 comments on commit fb5edf3

Please sign in to comment.