{{ Form::select('type', [''=>trans('general.select'),
\App\Constants\DiscountTypes::PRODUCT => trans('general.discount_type_product'),
\App\Constants\DiscountTypes::PRODUCTS_GROUP => trans('general.discount_type_products_group'),
\App\Constants\DiscountTypes::MAIN_CATEGORY => trans('general.discount_type_main_category'),
\App\Constants\DiscountTypes::SUB_CATEGORY => trans('general.discount_type_sub_category'),
\App\Constants\DiscountTypes::CATEGORIES_GROUP => trans('general.discount_type_categories_group'),
\App\Constants\DiscountTypes::STORE_PRODUCTS => trans('general.discount_type_store_products'),
\App\Constants\DiscountTypes::ORDER_TOTAL => trans('general.discount_type_order_total'),
], $item->type ?? null , [
'class' => 'form-select discount_type',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'data-placeholder' => 'اختر ..',
'required' => 'required',
]) }}
{{ Form::select('product_id', [''=>trans('general.select')]+$products, !empty($item->products) && count($item->products) > 0 ? $item->products->pluck('id')->toArray()[0] : null , [
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{ Form::select('products[]', [''=>trans('general.select')]+$products, !empty($item->products) ? $item->products->pluck('id')->toArray() : null , [
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'multiple' => 'multiple',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{ Form::select('category_id', [''=>trans('general.select')]+$categories,
$item->getCategoryId(),
[
'id' => 'category_id',
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{ Form::select('sub_category_id', [''=>trans('general.select')]+$subCategories,
$item->getSubCategoryId(),
[
'id' => 'sub_category_id',
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{ Form::select('categories[]', $categories, $item->getCategoryIds() , [
'id' => 'categories',
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'multiple' => 'multiple',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{ Form::select('sub_categories[]', $subCategories, $item->getSubCategoryIds(), [
'id' => 'sub_categories',
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'multiple' => 'multiple',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}
{{-- --}}
{{ Form::select('order_total_type', [
\App\Constants\DiscountTypes::GREATER_OR_EQUAL_TOTAL => trans('general.greater_than_or_equal'),
\App\Constants\DiscountTypes::LESS_OR_EQUAL_TOTAL => trans('general.less_than_or_equal'),
], $item->order_total_type ?? null , [
'class' => 'form-select',
'data-control' => 'select2',
'data-hide-search' => 'false',
'data-allow-clear' => 'false',
'multiple' => 'multiple',
'data-placeholder' => 'الرجاء الاختيار..',
'required' => 'required',
]) }}