Skip to content

Commit

Permalink
Merge pull request bagisto#7956 from amit-webkul/2.x
Browse files Browse the repository at this point in the history
Update regex in attribute section
  • Loading branch information
devansh-webkul authored Aug 16, 2023
2 parents 0bbfd2e + 9dc24d0 commit 816c1a4
Show file tree
Hide file tree
Showing 14 changed files with 555 additions and 296 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

class OrderShipmentsDataGrid extends DataGrid
{
/**
* Shipment Id.
*
* @var string
*/
protected $primaryColumn = 'shipment_id';

/**
* Prepare query builder.
*
Expand Down Expand Up @@ -126,7 +133,7 @@ public function prepareActions()
'title' => trans('admin::app.datagrid.view'),
'method' => 'GET',
'url' => function ($row) {
return route('admin.sales.shipments.view', $row->id);
return route('admin.sales.shipments.view', $row->shipment_id);
},
]);
}
Expand Down
68 changes: 35 additions & 33 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,34 +131,35 @@
],

'view' => [
'account-information' => 'Account Information',
'adjustment-refund' => 'Adjustment Refund',
'adjustment-fee' => 'Adjustment Fee',
'billing-address' => 'Billing Address',
'currency' => 'Currency',
'discounted-amount' => 'Discounted Amount',
'grand-total' => 'Grand Total',
'order-information' => 'Order Information',
'order-id' => 'Order Id',
'order-status' => 'Order status',
'order-date' => 'Order Date',
'order-channel' => 'Order Channel',
'product-ordered' => 'Products Ordered',
'product-image' => 'Product Image',
'payment-information' => 'Payment Information',
'payment-method' => 'Payment Method',
'price' => 'Price',
'qty' => 'QTY',
'refund' => 'Refund',
'shipping-address' => 'Shipping Address',
'sub-total' => 'Sub Total',
'shipping-handling' => 'Shipping & Handling',
'sku' => 'SKU',
'shipping-method' => 'Shipping Method',
'shipping-price' => 'Shipping Price',
'tax-amount' => 'Tax Amount',
'title' => 'Refund #:refund_id',
'tax' => 'Tax',
'account-information' => 'Account Information',
'adjustment-refund' => 'Adjustment Refund',
'adjustment-fee' => 'Adjustment Fee',
'base-discounted-amount' => 'Discounted Amount - :base-discounted-amount',
'billing-address' => 'Billing Address',
'currency' => 'Currency',
'discounted-amount' => 'Sub Total - :discounted-amount',
'grand-total' => 'Grand Total',
'order-information' => 'Order Information',
'order-id' => 'Order Id',
'order-status' => 'Order status',
'order-date' => 'Order Date',
'order-channel' => 'Order Channel',
'product-ordered' => 'Products Ordered',
'product-image' => 'Product Image',
'payment-information' => 'Payment Information',
'payment-method' => 'Payment Method',
'price' => 'Price - :price',
'qty' => 'QTY - :qty',
'refund' => 'Refund',
'shipping-address' => 'Shipping Address',
'sub-total' => 'Sub Total',
'shipping-handling' => 'Shipping & Handling',
'sku' => 'SKU - :sku',
'shipping-method' => 'Shipping Method',
'shipping-price' => 'Shipping Price',
'tax-amount' => 'Tax Amount - :tax-amount',
'title' => 'Refund #:refund_id',
'tax' => 'Tax',
],
],

Expand Down Expand Up @@ -316,8 +317,6 @@
'index' => [
'title' => 'Reviews',
],

'edit' => [],
],

'addresses' => [
Expand Down Expand Up @@ -1069,6 +1068,7 @@
'is_required' => 'Is Required',
'input_validation' => 'Input Validation',
'image' => 'Image',
'input-validation' => 'Input Validation',
'is_unique' => 'Is Unique',
'is_filterable' => 'Use in Layered Navigation',
'is_configurable' => 'Use To Create Configurable Product',
Expand All @@ -1081,6 +1081,7 @@
'number' => 'Number',
'price' => 'Price',
'position' => 'Position',
'regex' => 'Regex',
'select' => 'Select',
'select-type' => 'Select Attribute Type',
'save-btn' => 'Save Attribute',
Expand All @@ -1100,8 +1101,8 @@
'color' => 'Color Swatch',
'dropdown' => 'Dropdown',
'image' => 'Image Swatch',
'text' => 'Text Swatch',
'save-btn' => 'Save Option',
'text' => 'Text Swatch',
],
],

Expand Down Expand Up @@ -1129,7 +1130,7 @@
'file' => 'File',
'general' => 'General',
'is_required' => 'Is Required',
'input_validation' => 'Input Validation',
'input-validation' => 'Input Validation',
'image' => 'Image',
'is_unique' => 'Is Unique',
'is_filterable' => 'Use in Layered Navigation',
Expand All @@ -1143,6 +1144,7 @@
'number' => 'Number',
'price' => 'Price',
'position' => 'Position',
'regex' => 'Regex',
'select' => 'Select',
'select-type' => 'Select Attribute Type',
'save-btn' => 'Save Attribute',
Expand All @@ -1163,8 +1165,8 @@
'color' => 'Color Swatch',
'dropdown' => 'Dropdown',
'image' => 'Image Swatch',
'text' => 'Text Swatch',
'save-btn' => 'Save Option',
'text' => 'Text Swatch',
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ class="px-[12px] py-[6px] bg-blue-600 border border-blue-700 rounded-[6px] text-
<!-- Options -->
<div
class="p-[16px] bg-white box-shadow rounded-[4px]"
v-if="swatch_attribute && (attribute_type == 'select' || attribute_type == 'multiselect' || attribute_type == 'price' || attribute_type == 'checkbox')"
v-if="swatchAttribute && (
attributeType == 'select'
|| attributeType == 'multiselect'
|| attributeType == 'price'
|| attributeType == 'checkbox'
)"
>
<div class="flex justify-between items-center mb-3">
<p class="mb-[16px] text-[16px] text-gray-800 font-semibold">
Expand All @@ -129,11 +134,11 @@ class="max-w-max px-[12px] py-[5px] bg-white border-[2px] border-blue-600 rounde
<x-admin::form.control-group.control
type="select"
name="swatch_type"
id="swatch_type"
:value="old('swatch_type')"
v-model="swatch_type"
@change="show_swatch=true"
name="swatchType"
id="swatchType"
:value="old('swatchType')"
v-model="swatchType"
@change="showSwatch=true"
>
@foreach (['dropdown', 'color', 'image', 'text'] as $type)
<option value="{{ $type }}">
Expand Down Expand Up @@ -190,7 +195,7 @@ class="text-[14px] text-gray-600 font-semibold cursor-pointer"
<x-admin::table.th class="!p-0"></x-admin::table.th>
<!-- Swatch Select -->
<x-admin::table.th v-if="show_swatch && (swatch_type == 'color' || swatch_type == 'image')">
<x-admin::table.th v-if="showSwatch && (swatchType == 'color' || swatchType == 'image')">
@lang('admin::app.catalog.attributes.create.swatch')
</x-admin::table.th>
Expand Down Expand Up @@ -238,9 +243,9 @@ class="text-[14px] text-gray-600 font-semibold cursor-pointer"
</x-admin::table.td>
<!-- Swatch Type Image / Color -->
<x-admin::table.td v-if="show_swatch && (swatch_type == 'color' || swatch_type == 'image')">
<x-admin::table.td v-if="showSwatch && (swatchType == 'color' || swatchType == 'image')">
<!-- Swatch Image -->
<div v-if="swatch_type == 'image'">
<div v-if="swatchType == 'image'">
<img
src="{{ bagisto_asset('images/product-placeholders/front.svg') }}"
:ref="'image_' + element.params.id"
Expand All @@ -256,7 +261,7 @@ class="hidden"
</div>
<!-- Swatch Color -->
<div v-if="swatch_type == 'color'">
<div v-if="swatchType == 'color'">
<div
class="w-[25px] h-[25px] mx-auto rounded-[5px]"
:style="{ background: element.params.swatch_value }"
Expand Down Expand Up @@ -404,8 +409,8 @@ class="max-w-max px-[12px] py-[5px] bg-white border-[2px] border-blue-600 rounde
id="type"
class="cursor-pointer"
:label="trans('admin::app.catalog.attributes.create.type')"
v-model="attribute_type"
@change="swatch_attribute=true"
v-model="attributeType"
@change="swatchAttribute=true"
>
<!-- Here! All Needed types are defined -->
@foreach(['text', 'textarea', 'price', 'boolean', 'select', 'multiselect', 'datetime', 'date', 'image', 'file', 'checkbox'] as $type)
Expand All @@ -422,7 +427,7 @@ class="cursor-pointer"
</x-admin::form.control-group>
<!-- Textarea Switcher -->
<x-admin::form.control-group v-show="swatch_attribute && (attribute_type == 'textarea')">
<x-admin::form.control-group v-show="swatchAttribute && (attributeType == 'textarea')">
<x-admin::form.control-group.label>
@lang('admin::app.catalog.attributes.create.enable-wysiwyg')
</x-admin::form.control-group.label>
Expand All @@ -448,6 +453,62 @@ class="cursor-pointer"
</x-slot:header>
<x-slot:content>
<!-- Input Validation -->
<x-admin::form.control-group class="mb-[10px]">
<x-admin::form.control-group.label>
@lang('admin::app.catalog.attributes.create.input-validation')
</x-admin::form.control-group.label>
<x-admin::form.control-group.control
type="select"
name="validation"
:value="old('validation')"
id="validation"
class="cursor-pointer"
refs="validation"
:label="trans('admin::app.catalog.attributes.create.input-validation')"
v-model="validationType"
@change="inputValidation=true"
>
<!-- Here! All Needed types are defined -->
@foreach(['number', 'email', 'decimal', 'url', 'regex'] as $type)
<option value="{{ $type }}">
@lang('admin::app.catalog.attributes.create.' . $type)
</option>
@endforeach
</x-admin::form.control-group.control>
<x-admin::form.control-group.error
control-name="validation"
>
</x-admin::form.control-group.error>
</x-admin::form.control-group>
<!-- REGEX -->
<x-admin::form.control-group
class="mb-[10px]"
v-show="inputValidation && (validationType == 'regex')"
>
<x-admin::form.control-group.label>
@lang('admin::app.catalog.attributes.create.regex')
</x-admin::form.control-group.label>
<x-admin::form.control-group.control
type="text"
name="regex"
{{-- rules="required|regex:/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/" --}}
:value="old('regex')"
:placeholder="trans('admin::app.catalog.attributes.create.regex')"
>
</x-admin::form.control-group.control>
<x-admin::form.control-group.error
control-name="regex"
>
</x-admin::form.control-group.error>
</x-admin::form.control-group>
<!-- All Types Define In The Loop -->
@foreach (['is_required', 'is_unique'] as $item)
<x-admin::form.control-group class="flex gap-[10px] w-max !mb-0 p-[6px] cursor-pointer select-none">
Expand Down Expand Up @@ -512,8 +573,8 @@ class="hidden peer"
id="is_filterable"
name="is_filterable"
value="1"
:disabled="attribute_type == 'price' || attribute_type == 'checkbox'
|| attribute_type == 'select' || attribute_type == 'multiselect'
:disabled="attributeType == 'price' || attributeType == 'checkbox'
|| attributeType == 'select' || attributeType == 'multiselect'
? false : true
"
>
Expand Down Expand Up @@ -555,7 +616,7 @@ class="hidden peer"
<!-- Image Input -->
<x-admin::form.control-group
class="w-full"
v-if="swatch_type == 'image'"
v-if="swatchType == 'image'"
>
<x-admin::form.control-group.label>
@lang('admin::app.catalog.attributes.create.image')
Expand All @@ -577,7 +638,7 @@ class="w-full"
<!-- Color Input -->
<x-admin::form.control-group
class="w-full"
v-if="swatch_type == 'color'"
v-if="swatchType == 'color'"
>
<x-admin::form.control-group.label>
@lang('admin::app.catalog.attributes.create.color')
Expand Down Expand Up @@ -696,13 +757,17 @@ class="px-[12px] py-[6px] bg-blue-600 border border-blue-700 rounded-[6px] text-
return {
optionRowCount: 1,
attribute_type: '',
attributeType: '',
validationType: '',
inputValidation: false,
swatch_type: '',
swatchType: '',
swatch_attribute: false,
swatchAttribute: false,
show_swatch: false,
showSwatch: false,
isNullOptionChecked: false,
Expand Down
Loading

0 comments on commit 816c1a4

Please sign in to comment.