Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dropdown-and-bool…
Browse files Browse the repository at this point in the history
…ean-support
  • Loading branch information
devansh-webkul committed Sep 29, 2023
2 parents aa2c7c5 + 54f3bf3 commit 1e0dfaf
Show file tree
Hide file tree
Showing 99 changed files with 3,072 additions and 2,734 deletions.
Empty file removed .rr.yaml
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,21 @@ public function create()
public function store()
{
$this->validate(request(), [
'code' => ['required', 'not_in:type,attribute_family_id', 'unique:attributes,code', new Code()],
'admin_name' => 'required',
'type' => 'required',
'code' => ['required', 'not_in:type,attribute_family_id', 'unique:attributes,code', new Code()],
'admin_name' => 'required',
'type' => 'required',
'default_value' => 'integer',
]);

$requestData = request()->input();

if (! $requestData['default_value']) {
$requestData['default_value'] = Null;
}

Event::dispatch('catalog.attribute.create.before');

$attribute = $this->attributeRepository->create(array_merge(request()->input()));
$attribute = $this->attributeRepository->create($requestData);

Event::dispatch('catalog.attribute.create.after', $attribute);

Expand Down Expand Up @@ -108,14 +115,22 @@ public function getAttributeOptions($id)
public function update($id)
{
$this->validate(request(), [
'code' => ['required', 'unique:attributes,code,' . $id, new Code],
'admin_name' => 'required',
'type' => 'required',
'code' => ['required', 'unique:attributes,code,' . $id, new Code],
'admin_name' => 'required',
'type' => 'required',
'default_value' => 'integer',
]);


$requestData = request()->input();

if (! $requestData['default_value']) {
$requestData['default_value'] = Null;
}

Event::dispatch('catalog.attribute.update.before', $id);

$attribute = $this->attributeRepository->update(request()->all(), $id);
$attribute = $this->attributeRepository->update($requestData, $id);

Event::dispatch('catalog.attribute.update.after', $attribute);

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/ar/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'الحالة',
'success' => 'ناجح',
'view' => 'عرض',
'product-count' => ':count + المزيد من المنتجات'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/bn/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'স্থিতি',
'success' => 'সাফল্য',
'view' => 'দেখুন',
'product-count' => ':count + আরও পণ্য'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/de/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Status',
'success' => 'Erfolgreich',
'view' => 'Ansehen',
'product-count' => ':count + Mehr Produkte'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Status',
'success' => 'Success',
'view' => 'View',
'product-count' => ':count + More Products'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Estado',
'success' => 'Éxito',
'view' => 'Ver',
'product-count' => ':count + Más productos'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'وضعیت',
'success' => 'موفقیت',
'view' => 'مشاهده',
'product-count' => ':count + محصولات بیشتر'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/fr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Statut',
'success' => 'Succès',
'view' => 'Voir',
'product-count' => ':count + Plus de produits'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/he/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'מצב',
'success' => 'הצלחה',
'view' => 'צפה',
'product-count' => ':count + מוצרים נוספים'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/hi_IN/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'स्थिति',
'success' => 'सफलता',
'view' => 'देखें',
'product-count' => ':count + और अधिक उत्पाद'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/it/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Stato',
'success' => 'Successo',
'view' => 'Vedi',
'product-count' => ':count + Altri prodotti'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/ja/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'ステータス',
'success' => '成功',
'view' => '表示',
'product-count' => ':count + 他の製品'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/nl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Status',
'success' => 'Succes',
'view' => 'Bekijken',
'product-count' => ':count + Meer producten'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/pl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Status',
'success' => 'Sukces',
'view' => 'Podgląd',
'product-count' => ':count + Więcej produktów'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Status',
'success' => 'Sucesso',
'view' => 'Visualizar',
'product-count' => ':count + Mais produtos'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/ru/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Статус',
'success' => 'Успешно',
'view' => 'Просмотр',
'product-count' => ':count + Еще продукты'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/sin/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'ස්ථානය',
'success' => 'සාර්ථකයි',
'view' => 'දර්ශකයට',
'product-count' => ':count + වැඩි නිෂ්පාදන'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/tr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Durum',
'success' => 'Başarılı',
'view' => 'Görüntüle',
'product-count' => ':count + Daha Fazla Ürün'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/uk/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => 'Статус',
'success' => 'Успішно',
'view' => 'Перегляд',
'product-count' => ':count + Ще більше продуктів'
],
],

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/zh_CN/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'status' => '状态',
'success' => '成功',
'view' => '查看',
'product-count' => ':count + 更多产品'
],
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class="primary-button"
<x-admin::form.control-group.control
type="text"
:name="$locale->code . '[name]'"
:value="old($locale->code)"
:value="old($locale->code . '[name]')"
:placeholder="$locale->name"
>
</x-admin::form.control-group.control>
Expand Down Expand Up @@ -141,11 +141,6 @@ class="secondary-button text-[14px]"
v-model="swatchType"
@change="showSwatch=true"
>
<!-- Default Option -->
<option value="">
@lang('admin::app.catalog.attributes.create.select')
</option>

@foreach (['dropdown', 'color', 'image', 'text'] as $type)
<option value="{{ $type }}">
@lang('admin::app.catalog.attributes.create.option.' . $type)
Expand Down Expand Up @@ -383,7 +378,7 @@ class="secondary-button text-[14px]"
id="code"
v-bind="field"
:class="[errors['{{ 'code' }}'] ? 'border border-red-600 hover:border-red-600' : '']"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 dark:text-gray-300 transition-all hover:border-gray-400 focus:border-gray-400 dark:bg-gray-900 dark:border-gray-800"
class="flex w-full min-h-[39px] py-2 px-3 border rounded-[6px] text-[14px] text-gray-600 dark:text-gray-300 transition-all hover:border-gray-400 dark:hover:border-gray-400 dark:focus:border-gray-400 focus:border-gray-400 dark:bg-gray-900 dark:border-gray-800"
placeholder="{{ trans('admin::app.catalog.attributes.create.code') }}"
v-code
>
Expand Down Expand Up @@ -412,14 +407,12 @@ class="cursor-pointer"
v-model="attributeType"
@change="swatchAttribute=true"
>
<!-- Default Option -->
<option value="">
@lang('admin::app.catalog.attributes.create.select')
</option>

<!-- Here! All Needed types are defined -->
@foreach(['text', 'textarea', 'price', 'boolean', 'select', 'multiselect', 'datetime', 'date', 'image', 'file', 'checkbox'] as $type)
<option value="{{ $type }}">
<option
value="{{ $type }}"
{{ $type === 'text' ? "selected" : '' }}
>
@lang('admin::app.catalog.attributes.create.'. $type)
</option>
@endforeach
Expand Down Expand Up @@ -491,11 +484,6 @@ class="cursor-pointer"
v-model="validationType"
@change="inputValidation=true"
>
<!-- Default Option -->
<option value="">
@lang('admin::app.catalog.attributes.create.select')
</option>

<!-- Here! All Needed types are defined -->
@foreach(['number', 'email', 'decimal', 'url', 'regex'] as $type)
<option value="{{ $type }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class="icon-delete p-[6px] rounded-[6px] text-[24px] cursor-pointer transition-a
<div class="grid gap-[14px] justify-items-center py-[40px] px-[10px]">
<!-- Attribute Option Image -->
<img
class="w-[120px] h-[120px] border border-dashed dark:border-gray-800 rounded-[4px]"
class="w-[120px] h-[120px] border border-dashed border-gray-300 dark:border-gray-800 rounded-[4px]"
src="{{ bagisto_asset('images/icon-add-product.svg') }}"
alt="{{ trans('admin::app.catalog.attributes.edit.add-attribute-options') }}"
>
Expand Down Expand Up @@ -437,13 +437,6 @@ class="cursor-not-allowed"
:disabled="(boolean) $selectedOption"
:label="trans('admin::app.catalog.attributes.edit.type')"
>
<!-- Default Option -->
<option value="">
<span class="text-gray-400">
@lang('admin::app.catalog.attributes.edit.select')
</span>
</option>

<!-- Here! All Needed types are defined -->
@foreach(['text', 'textarea', 'price', 'boolean', 'select', 'multiselect', 'datetime', 'date', 'image', 'file', 'checkbox'] as $type)
<option
Expand Down Expand Up @@ -502,11 +495,16 @@ class="cursor-not-allowed"

<x-admin::form.control-group.control
type="text"
name="default-value"
value="{{ old('default-value') ?: $attribute->default_value }}"
name="default_value"
value="{{ old('default_value') ?: $attribute->default_value }}"
:label="trans('admin::app.catalog.attributes.edit.default-value')"
>
</x-admin::form.control-group.control>

<x-admin::form.control-group.error
control-name="default_value"
>
</x-admin::form.control-group.error>
</x-admin::form.control-group>
</div>
</div>
Expand Down Expand Up @@ -536,11 +534,6 @@ class="cursor-not-allowed"
class="cursor-pointer"
v-model="validationType"
>
<!-- Default Option -->
<option value="">
@lang('admin::app.catalog.attributes.edit.select')
</option>

<!-- Here! All Needed types are defined -->
@foreach(['number', 'email', 'decimal', 'url', 'regex'] as $type)
<option value="{{ $type }}">
Expand Down Expand Up @@ -575,14 +568,24 @@ class="mb-[10px]"

<!-- Is Required -->
<x-admin::form.control-group class="flex gap-[10px] w-max !mb-0 p-[6px] select-none">
@php
$selectedOption = old('is_required') ?? $attribute->is_required
@endphp

<x-admin::form.control-group.control
type="hidden"
name="is_required"
:value="(boolean) $selectedOption"
>
</x-admin::form.control-group.control>

<x-admin::form.control-group.control
type="checkbox"
name="is_required"
id="is_required"
for="is_required"
value="1"
:checked="(boolean) $attribute->is_required"
:disabled="(boolean) !$attribute->is_required"
:checked="(boolean) $selectedOption"
>
</x-admin::form.control-group.control>

Expand All @@ -592,13 +595,6 @@ class="!text-[14px] !font-semibold !text-gray-600 dark:!text-gray-300 cursor-poi
>
@lang('admin::app.catalog.attributes.edit.is-required')
</x-admin::form.control-group.label>

<x-admin::form.control-group.control
type="hidden"
name="is_required"
:value="$attribute->is_required"
>
</x-admin::form.control-group.control>
</x-admin::form.control-group>

<!-- Is Unique -->
Expand Down
Loading

0 comments on commit 1e0dfaf

Please sign in to comment.