Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Discounts #324

Merged
merged 177 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
953e2a9
Init
alecritson Jun 7, 2022
bc75700
Add discount to composer
alecritson Jun 7, 2022
90c4055
Initial test set up
alecritson Jun 7, 2022
b84555f
Initial discounts
alecritson Jun 9, 2022
77f87b5
Tweaking discounts
alecritson Jun 9, 2022
f8c3f60
Tweaking bits
alecritson Jun 10, 2022
67c7300
Revert bits
alecritson Jun 10, 2022
5f7087e
Try and show some freebies
alecritson Jun 10, 2022
98fbdeb
Discount work
alecritson Jun 13, 2022
7bc0f2c
Discount tweaks
alecritson Jun 13, 2022
31a63da
Cast and add active scope
alecritson Jun 13, 2022
eadd698
Starting UI set up
alecritson Jun 15, 2022
6199849
Introduce rulesets
alecritson Jun 15, 2022
122d73c
Refactor to rules
alecritson Jun 15, 2022
536ea5d
Apply fixes from StyleCI
StyleCIBot Jun 15, 2022
30c611b
Add helper to get data
alecritson Jun 15, 2022
df1e21d
Add line count
alecritson Jun 15, 2022
620285e
Add cart total rule
alecritson Jun 15, 2022
efa08d9
Merge branch 'pro/discounts' of https://github.com/getcandy/getcandy …
alecritson Jun 15, 2022
e87f11b
Apply fixes from StyleCI
StyleCIBot Jun 15, 2022
cfaa50a
Start of discounts in core
alecritson Jun 16, 2022
860f214
Discount tweaks
alecritson Jun 16, 2022
21e4782
Merge branch 'pro/discounts' of https://github.com/getcandy/getcandy …
alecritson Jun 16, 2022
725ec8d
Apply fixes from StyleCI
StyleCIBot Jun 16, 2022
81af739
Start of discounts ui
alecritson Jun 17, 2022
bd155e1
Add method to return types
alecritson Jun 17, 2022
f5dd4d0
Import CartLine
alecritson Jun 17, 2022
32d26bb
Fix migration name
alecritson Jun 17, 2022
e90d76b
Fix name
alecritson Jun 17, 2022
1d1633a
Logic updates
alecritson Jun 20, 2022
ee475db
Merge branch 'pro/discounts' of https://github.com/getcandy/getcandy …
alecritson Jun 20, 2022
0a073da
Apply fixes from StyleCI
StyleCIBot Jun 20, 2022
2c43d29
Fix import
alecritson Jun 20, 2022
2bcd5b9
Refactor discounts a touch
alecritson Jun 20, 2022
188b468
UI tweaks
alecritson Jun 20, 2022
d4e11e7
Remove PRO package code
alecritson Jun 20, 2022
9c947c6
Discount updates
alecritson Jun 21, 2022
194da33
Merge branch 'pro/discounts' of https://github.com/getcandy/getcandy …
alecritson Jun 21, 2022
2951146
Apply fixes from StyleCI
StyleCIBot Jun 21, 2022
806a22d
Docs and tweaks
alecritson Jun 21, 2022
ca41dd2
Apply fixes from StyleCI
StyleCIBot Jun 21, 2022
33b4f1a
Add missing method
alecritson Jun 21, 2022
e799573
Merge branch 'main' of https://github.com/getcandy/getcandy into feat…
alecritson Jun 21, 2022
bf3f1e2
Merge branch 'feat/discounts' of https://github.com/getcandy/getcandy…
alecritson Jun 21, 2022
099c649
Merge branch 'develop' into feat/discounts
alecritson Aug 17, 2022
6050451
Update composer.json
alecritson Aug 17, 2022
dd9b9a2
Discount editing updates
alecritson Aug 19, 2022
59d12bf
Apply fixes from StyleCI
StyleCIBot Aug 19, 2022
3346054
Fix up tests
alecritson Aug 19, 2022
27f2abc
Add some tests
alecritson Aug 19, 2022
4c291c7
Update tests
alecritson Aug 19, 2022
d9f2b7a
Discount tweaks
alecritson Aug 19, 2022
cf92ebb
Apply fixes from StyleCI
StyleCIBot Aug 19, 2022
d0eed6e
Editing updates
alecritson Aug 19, 2022
1cdca5d
Merge branch 'feat/discounts' of github.com:getcandy/getcandy into fe…
alecritson Aug 19, 2022
3c2ad11
Fixes
alecritson Aug 19, 2022
43370db
Apply fixes from StyleCI
StyleCIBot Aug 19, 2022
f5b8005
Update CouponTest.php
alecritson Aug 22, 2022
a30dd77
Merge branch 'feat/discounts' of github.com:getcandy/getcandy into fe…
alecritson Aug 22, 2022
fc0b6f2
Apply fixes from StyleCI
StyleCIBot Aug 22, 2022
3334570
Add ability to delete discounts
alecritson Aug 22, 2022
aaab440
Merge branch 'develop' into feat/discounts
alecritson Aug 22, 2022
cd6cf10
Merge branch 'develop' into feat/discounts
alecritson Sep 16, 2022
36da498
Pint updates
alecritson Sep 16, 2022
0f9309d
Namespace update
alecritson Sep 16, 2022
d769b11
Update coupon.blade.php
alecritson Sep 16, 2022
ed63b99
Merge branch 'develop' into feat/discounts
alecritson Oct 6, 2022
16fc617
Merge branch 'develop' into feat/discounts
alecritson Oct 7, 2022
f3bd5aa
:beer:
alecritson Oct 7, 2022
634d3b3
Update discounts.md
alecritson Oct 7, 2022
1396982
Update CartManager.php
alecritson Oct 7, 2022
5c1ff4b
Merge branch 'develop' into feat/discounts
alecritson Oct 11, 2022
4958e0b
Discount updates
alecritson Oct 12, 2022
737be9c
Pint updates
alecritson Oct 12, 2022
18a1eb0
Add min spend
alecritson Oct 12, 2022
98b9057
Update AbstractDiscount.php
alecritson Oct 12, 2022
ef5ab43
Update CouponTest.php
alecritson Oct 12, 2022
5ecdab2
Update DiscountCreate.php
alecritson Oct 12, 2022
60a08d5
Allow brands to attach to discounts
alecritson Oct 12, 2022
8e5dd96
Support brand ids
alecritson Oct 13, 2022
01e505a
Update DiscountManager.php
alecritson Oct 13, 2022
5d7e94c
:beer:
alecritson Oct 13, 2022
5bca881
Add discount validation and tests
alecritson Oct 13, 2022
31235ad
Pint updates
alecritson Oct 13, 2022
9da5630
Update product discount saving
alecritson Oct 13, 2022
e1be237
:beer:
alecritson Oct 13, 2022
42e75ab
Product discount updates
alecritson Oct 14, 2022
b024821
Create ProductDiscountTest.php
alecritson Oct 14, 2022
99fd023
Add more editable fields
alecritson Oct 14, 2022
82ed322
Formatting
alecritson Oct 14, 2022
14d34a7
Pint updates
alecritson Oct 14, 2022
1707634
Add caching to cart's properties and reuse cartmanager instance, rath…
glennjacobs Oct 14, 2022
263c597
🍺
glennjacobs Oct 14, 2022
3230576
Move tax breakdown objects
glennjacobs Oct 20, 2022
9bda15a
:beer:
glennjacobs Oct 20, 2022
323f990
Add Discount value object
glennjacobs Oct 20, 2022
fbae2fc
wip
glennjacobs Oct 20, 2022
906d612
Update Cart.php
glennjacobs Oct 20, 2022
e1fc504
Update Cart.php
glennjacobs Oct 20, 2022
26ee7d1
wip
glennjacobs Oct 20, 2022
79ca9cc
Fixing tests
glennjacobs Oct 20, 2022
3c54bf5
:beer:
glennjacobs Oct 20, 2022
857fba7
Update CreateOrderTest.php
glennjacobs Oct 20, 2022
1e1f89f
Update CartManager.php
glennjacobs Oct 20, 2022
0026b38
Fix stuff
glennjacobs Oct 20, 2022
0aad57d
Add cart-level discounts
glennjacobs Oct 20, 2022
9579c35
Add cart free items collection and move stuff around
glennjacobs Oct 20, 2022
3b613fb
Initial tests
alecritson Oct 24, 2022
3f95d44
Tweaks
alecritson Oct 24, 2022
4f427aa
Update CartManager.php
alecritson Oct 24, 2022
24e41e4
Update CartLineManager.php
alecritson Oct 24, 2022
5f9f887
Update CachesPropertiesTest.php
alecritson Oct 25, 2022
619f38a
Update CachesPropertiesTest.php
alecritson Oct 25, 2022
ad19987
Merge branch 'feature/cart_cache' into feat/discounts
alecritson Oct 25, 2022
4b600ce
Discount updates
alecritson Oct 25, 2022
a5e9f17
:beer:
alecritson Oct 25, 2022
0edcecd
Fix tests
alecritson Oct 25, 2022
b90c774
Update CouponTest.php
alecritson Oct 25, 2022
566a5c8
Update DiscountManagerTest.php
alecritson Oct 25, 2022
276d4c1
Update CouponTest.php
alecritson Oct 25, 2022
96d65b7
Update composer.json
alecritson Oct 25, 2022
2cc31ad
Update composer.json
alecritson Oct 25, 2022
82414c4
Update discounts.php
alecritson Oct 25, 2022
9828812
Update AdminHubServiceProvider.php
alecritson Oct 25, 2022
aec2da4
Add max uses
alecritson Oct 25, 2022
8f2edab
Add missing permissions
alecritson Oct 25, 2022
5dd4474
Update app.css
alecritson Oct 25, 2022
f7d0f26
Update DiscountCreate.php
alecritson Oct 25, 2022
8972ccd
Update product-discount.blade.php
alecritson Oct 25, 2022
527f280
Update product-discount.blade.php
alecritson Oct 25, 2022
b957486
Update ProductDiscount.php
alecritson Oct 25, 2022
cedb379
Merge branch 'main' into feat/discounts
alecritson Nov 14, 2022
988a679
:bee:
alecritson Nov 14, 2022
813f100
Discount updates
alecritson Nov 14, 2022
b50957b
Discount updates
alecritson Nov 14, 2022
5307ab2
Merge branch 'main' into feat/discounts
alecritson Nov 14, 2022
9e82651
Update datepicker.blade.php
alecritson Nov 15, 2022
ac124e8
Discount editing
alecritson Nov 15, 2022
93d3260
Brand UI updates
alecritson Nov 15, 2022
039c755
Tweak collection saving
alecritson Nov 15, 2022
b26a722
Discount UI updates
alecritson Nov 15, 2022
daf11fd
Compile assets
alecritson Nov 16, 2022
0a88c43
Start discount refactor
alecritson Nov 18, 2022
ed9d361
Discount ui
alecritson Nov 18, 2022
be26adb
Rework discount UI
alecritson Nov 18, 2022
ea1da70
Discount updates
alecritson Nov 21, 2022
8c1491e
Discount UI tweaks
alecritson Nov 21, 2022
94c9172
:beer:
alecritson Nov 21, 2022
26c1085
Tweak discount manager test
alecritson Nov 21, 2022
57a651f
Add channel setting
alecritson Nov 21, 2022
7ad3516
Test updates
alecritson Nov 21, 2022
987324c
Update DiscountManagerTest.php
alecritson Nov 22, 2022
f9d016e
Tests and PINT
alecritson Nov 22, 2022
a5f0202
UI Updates
alecritson Nov 22, 2022
55ed23f
Update buy-x-get-y.blade.php
alecritson Nov 22, 2022
1fac87b
Update discount.blade.php
alecritson Nov 22, 2022
4df9f58
Update AbstractDiscount.php
alecritson Nov 22, 2022
3c0a807
UI Tweaks
alecritson Nov 22, 2022
44fe44e
Update for collection select
alecritson Nov 24, 2022
3900744
Compile
alecritson Nov 24, 2022
bca0d98
Update validation messages
alecritson Nov 24, 2022
e02c9ee
Update discount.blade.php
alecritson Nov 24, 2022
51ce513
Rename migrations
alecritson Nov 24, 2022
a319f16
Validation tweaks
alecritson Nov 24, 2022
b0af8d0
:bee:
alecritson Nov 24, 2022
36313d6
Fix up validation
alecritson Nov 24, 2022
a4188d7
Validation tweaks
alecritson Nov 24, 2022
4cb063c
:bee:
alecritson Nov 24, 2022
28552ab
Update AbstractDiscount.php
alecritson Nov 24, 2022
c412903
Update buy-x-get-y.blade.php
alecritson Nov 24, 2022
0a723b6
Fixes
alecritson Nov 25, 2022
343c087
Update Discount.php
alecritson Nov 25, 2022
63b80ea
Fixes
alecritson Nov 25, 2022
7834a7c
Update buy-x-get-y.blade.php
alecritson Nov 25, 2022
f69f393
Update table
alecritson Nov 25, 2022
3c207dc
Merge branch 'main' into feat/discounts
alecritson Dec 9, 2022
835022a
Merge branch 'main' into feat/discounts
alecritson Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module.exports = {
'/lunar/carts',
'/lunar/channels',
'/lunar/collections',
'/lunar/discounts',
'/lunar/currencies',
'/lunar/customers',
'/lunar/images',
Expand Down
185 changes: 185 additions & 0 deletions docs/src/lunar/discounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Discounts

[[toc]]

## Overview

// ...

## Discounts

```php
Lunar\Models\Discount
```

|Field|Description|Example|
|:-|:-|:-|
|`id`|||
|`name`|The given name for the discount||
|`handle`|The unique handle for the discount||
|`type`|The type of discount|`Lunar\DiscountTypes\Coupon`|
|`data`|JSON|Any data to be used by the type class
|`starts_at`|The datetime the discount starts (required)|
|`ends_at`|The datetime the discount expires, if `NULL` it won't expire|
|`uses`|How many uses the discount has had|
|`max_uses`|The maximum times this discount can be applied storewide|
|`priority`|The order of priority|
|`stop`|Whether this discount will stop others after propagating|
|`created_at`|||
|`updated_at`|||

### Creating a discount

```php
Lunar\Models\Discount::create([
'name' => '20% Coupon',
'handle' => '20_coupon',
'type' => 'Lunar\DiscountTypes\Coupon',
'data' => [
'coupon' => '20OFF',
'min_prices' => [
'USD' => 2000 // $20
],
],
'starts_at' => '2022-06-17 13:30:55',
'ends_at' => null,
'max_uses' => null,
])
```

## Discount Purchasable

You can relate a purchasable to a discount via this model. Each has a type for whether it's a `condition` or `reward`.

- `condition` - If your discount requires these purchasable models to be in the cart to activate
- `reward` - Once the conditions are met, discount one of more of these purchasable models.

```php
Lunar\Models\DiscountPurchasable
```

|Field|Description|Example|
|:-|:-|:-|
|`id`|||
|`discount_id`|||
|`purchasable_type`||`Lunar\Models\ProductVariant`
|`type`|`condition` or `reward`|
|`created_at`|||
|`updated_at`|||

### Relationships

- Purchasables `discount_purchasables`
- Users - `customer_user`


## Usage

Fetching applied discounts

```php
use Lunar\Facades\Discounts;

$appliedDiscounts = Discounts::getApplied();
```

This will return a collection of discounts which are applied to the current cart.

```php
foreach ($appliedDiscounts as $item) {
// Lunar\Base\DataTransferObjects\CartDiscount
$item->cartLine; // Lunar\Models\CartLine
$item->discount; // Lunar\Models\Discount
}
```

Each cart line will also have a `discount` property populated with the model of the applied discount.

```php
foreach ($cart->lines as $line) {
$line->discount; // Lunar\Models\Discount;
}
```

:::tip
These aren't database relationships and will only persist for the lifecycle of the each request.
:::


### Adding your own Discount type


```php
namespace App\Discounts;

use Lunar\Base\DataTransferObjects\CartDiscount;
use Lunar\DataTypes\Price;
use Lunar\Facades\Discounts;
use Lunar\Models\CartLine;
use Lunar\Models\Discount;

class CustomDiscount
{
protected Discount $discount;

/**
* Set the data for the discount to user.
*
* @param array $data
* @return self
*/
public function with(Discount $discount): self
{
$this->discount = $discount;

return $this;
}

/**
* Return the name of the discount.
*
* @return string
*/
public function getName(): string
{
return 'Custom Discount';
}

/**
* Called just before cart totals are calculated.
*
* @return CartLine
*/
public function execute(CartLine $cartLine): CartLine
{
$data = $this->discount->data;

// Return the unaltered cart line back
if (! $conditionIsMet) {
return $cartLine;
}

$cartLine->discount = $this->discount;

$cartLine->discountTotal = new Price(
$cartLine->unitPrice->value * $discountQuantity,
$cartLine->cart->currency,
1
);

Discounts::addApplied(
new CartDiscount($cartLine, $this->discount)
);

return $cartLine;
}
}

```

```php
Discounts::addType(
CustomDiscount::class
);
```

2 changes: 1 addition & 1 deletion packages/admin/public/app.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/admin/resources/icons/outline/arrows-right-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/admin/resources/icons/solid/arrows-right-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/admin/resources/lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
'permissions.catalogue.orders.description' => 'Allow the staff member to manage orders.',
'permissions.catalogue.customers.name' => 'Manage Customers',
'permissions.catalogue.customers.description' => 'Allow the staff member to manage customers.',
'permissions.discounts.name' => 'Manage Discounts',
'permissions.discounts.description' => 'Allow the staff member to manage discounts',
/**
* Reset password.
*/
Expand Down
15 changes: 15 additions & 0 deletions packages/admin/resources/lang/en/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,19 @@
'activity-log.orders.capture' => 'Payment of :amount on card ending :last_four',
'activity-log.orders.authorized' => 'Authorized of :amount on card ending :last_four',
'activity-log.orders.refund' => 'refund of :amount on card ending :last_four',
/**
* Discounts.
*/
'discounts.index.title' => 'Discounts',
'discounts.index.status.pending' => 'Pending',
'discounts.index.status.active' => 'Active',
'discounts.index.status.scheduled' => 'Scheduled',
'discounts.index.status.expired' => 'Expired',
'discounts.index.create_discount' => 'Create Discount',
'discounts.create.title' => 'Create Discount',
'discounts.create_btn' => 'Create Discount',
'discounts.save_btn' => 'Save Discount',
'discounts.show.stop.label' => 'Stop other discounts applying after this one',
'discounts.show.danger_zone.label' => 'Delete discount',
'discounts.show.danger_zone.instructions' => 'Enter the name of the discount to confirm removal.',
];
4 changes: 4 additions & 0 deletions packages/admin/resources/lang/en/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
'brand' => 'Brand',
'stock' => 'Stock',
'show_deleted' => 'Show Deleted',
'starts_at' => 'Starts At',
'ends_at' => 'Ends At',
'priority' => 'Priority',
'stop' => 'Stop',
'preview' => 'Preview',
'delivery_instructions' => 'Delivery Instructions',
'not_provided' => 'Not Provided',
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/inputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@
'text' => 'Text',
'richtext' => 'Richtext',
'transaction.label' => 'Transaction',
'starts_at.label' => 'Starts at',
'ends_at.label' => 'Ends at',
'tag.label' => 'Tag',
'active.label' => 'Active',
'priority.label' => 'Priority',
'postcodes.label' => 'Postcodes',
'postcodes.instructions' => 'List each postcode on a new line. Supports wildcards such as NW*',
'max_uses.label' => 'Max uses',
];
1 change: 1 addition & 0 deletions packages/admin/resources/lang/en/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'sidebar.order-processing' => 'Order Processing',
'sidebar.orders' => 'Orders',
'sidebar.customers' => 'Customers',
'sidebar.discounts' => 'Discounts',
/**
* Product side menu.
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/admin/resources/lang/en/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
'tax_class.deleted' => 'Tax class deleted',
'clipboard.copied' => 'Copied to clipboard',
'clipboard.failed_copy' => 'Unable to copy to clipboard',
'discount.saved' => 'Discount saved',
'discount.deleted' => 'Discount deleted',
'tags.updated' => 'Tags updated',
'staff.restored' => 'Staff member restored',
'default_url_protected' => 'Unable to delete the default URL',
Expand Down
1 change: 1 addition & 0 deletions packages/admin/resources/lang/en/partials.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
'orders.totals.shipping_total' => 'Shipping Total',
'orders.totals.total' => 'Total',
'orders.totals.notes_empty' => 'No notes on this order',
'orders.totals.discount_total' => 'Discount Total',
'orders.lines.unit_price' => 'Unit Price',
'orders.lines.quantity' => 'Quantity',
'orders.lines.sub_total' => 'Sub Total',
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
'headings.author' => 'Author',
'headings.products_count' => 'No. Products',
'headings.empty' => 'No Entries Found',
'headings.starts_at' => 'Starts At',
'headings.ends_at' => 'Ends At',
'headings.type' => 'Type',
'headings.tags' => 'Tags',
'headings.new_customer' => 'New Customer',
'headings.new_returning' => 'New/Returning Customers',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
value: @entangle($attributes->wire('model')),
init() {
this.$nextTick(() => {
flatpickr($refs.input, {{ json_encode($options) }})

passedOptions = {{ json_encode($options) }}

options = {
altFormat: passedOptions.enableTime ? 'Y-m-d H:i' : 'Y-m-d',
altInput: true,
}

flatpickr($refs.input, {...options, ...passedOptions})
})
}
}"
@change="value = $event.target.value"
class="flex relative"
wire:ignore
>
<x-hub::input.text
x-ref="input"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input {{ $attributes }} type="radio" class="w-4 h-4 text-indigo-600 border-gray-300 rounded cursor-pointer hover:bg-gray-50 focus:ring-indigo-500">
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div>
<div class="grid grid-cols-6 gap-4 p-2 border border-b-0 rounded-t">
<div class="col-span-4">
<x-hub::input.text
wire:model.debounce="searchTerm"
placeholder="Search by collection name"

/>
</div>
<div class="col-span-2">
<x-hub::input.select for="group" wire:model="collectionGroupId" :disabled="!!$this->searchTerm || $showOnlySelected">
@foreach($this->collectionGroups as $group)
<option value="{{ $group->id }}">{{ $group->name }}</option>
@endforeach
</x-hub::input.select>
</div>
</div>
<div class="rounded-b border h-full overflow-y-scroll max-h-96 bg-gray-50">
@if(count($selectedCollections))
<div class="bg-gray-100 py-1 px-2 text-sm border-b text-gray-700">
{{ count($selectedCollections) }} selected,
<a href="#" class="text-blue-600 hover:underline" wire:click.prevent="toggleSelected">
@if($showOnlySelected) show all @endif
@if(!$showOnlySelected) show selected @endif
</a>
</div>
@endif
<div class="px-2">
@foreach($this->collections as $collectionNode)
@include('adminhub::partials.collections.collection-tree-node', [
'node' => $collectionNode,
])
@endforeach
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="space-y-4">
<header>
<h1 class="text-xl font-bold text-gray-900 md:text-2xl dark:text-white">
@if($discount->id)
{{ $discount->name }}
@else
Create Discount
@endif
</h1>
</header>

<form action="#"
method="POST"
wire:submit.prevent="save">
@include('adminhub::partials.forms.discount')
</form>
</div>



{{-- <div class="py-12 pb-24 mt-6">
<div class="sm:px-6 lg:px-0 lg:col-span-9">
<div class="space-y-6">
<div
class="flex-col space-y-4 bg-white rounded px-4 py-5 sm:p-6"
>

<x-hub::input.group for="type" label="Limit discount">
<x-hub::input.select wire:model="discount.restriction">
<option value>All products</option>
<option value="products">Specific products</option>
<option value="collection">Products in collections</option>
</x-hub::input.select>
</x-hub::input.group>
</div>

</div>
</div>
</div> --}}
Loading