Exemple #1
0
            };
            break;
        case 'orders_status_id':
            return function () {
                InlineEditItem::select('orders_status_id', NULL)->list(Models\OrdersStatus::class);
            };
            break;
        case 'total':
            return function () {
                InlineEditItem::text('total', NULL)->validationRule('required|regexp:\\d');
            };
            break;
        default:
            return function () {
            };
            break;
    }
})->form(function () {
    FormItem::select('customer_id', 'Customer')->list(Models\Customer::class)->validationRule('required|numeric|exists:customers,id')->group('general');
    FormItem::select('orders_status_id', 'Status')->list(Models\OrdersStatus::class)->validationRule('required|numeric|exists:orders_statuses,id')->group('general');
    FormItem::text('total', 'Total')->validationRule('required|numeric|min:1')->group('general');
    FormItem::items('items', 'Items')->group('items');
    FormGroup::create('general', 'General')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
    FormGroup::create('items', 'Items')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
})->viewFilters(function () {
    ViewFilter::text('customer.login', 'Customer');
    ViewFilter::dropdown('orders_status_id', 'Status')->options(function () {
        $options = [['id' => '', 'name' => '- Status -']];
        return array_merge($options, App\Models\Repositories\OrdersStatusRepository::getOptionsList());
    });
});
Exemple #2
0
            };
            break;
        case 'last_name':
            return function () {
                InlineEditItem::text('last_name', NULL)->validationRule('required|regex:/^[a-zA-Z0-9_@]{3,100}$/');
            };
            break;
        default:
            return function () {
            };
            break;
    }
})->form(function () {
    FormItem::text('name', 'Name')->validationRule('required')->group('general');
    FormItem::text('second_name', 'Second Name')->validationRule('required')->group('general');
    FormItem::text('last_name', 'Last Name')->validationRule('required')->group('general');
    FormItem::email('email', 'Email')->validationRule('required|email')->group('general');
    FormItem::text('phone', 'Phone')->validationRule('required')->group('general');
    if (!preg_match('/edit$/', Request::url()) && !preg_match('/update$/', Request::url())) {
        FormItem::text('login', 'Login')->validationRule('required')->group('general');
        FormItem::text('password', 'Password')->validationRule('required')->group('general');
    }
    FormItem::images()->type('model')->modelMethod('photos')->group('photos');
    FormGroup::create('general', 'General')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
    FormGroup::create('photos', 'Photos')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
})->viewFilters(function () {
    ViewFilter::text('name', 'Name');
    ViewFilter::text('second_name', 'Second Name');
    ViewFilter::text('last_name', 'Last Name');
    ViewFilter::text('email', 'Email');
});
Exemple #3
0
                InlineEditItem::text('code', NULL)->validationRule('required');
            };
            break;
        case 'name':
            return function () {
                InlineEditItem::callback('name', '')->callback(function ($instance) {
                    $content = '';
                    foreach (Models\Language::get() as $language) {
                        $value = '';
                        $descriptions = $instance->descriptions->where('language_id', $language->id)->first();
                        if (!is_null($descriptions)) {
                            $value = $descriptions->name;
                        }
                        $content .= HtmlBuilder::text('name_' . $language->id, 'Name [' . $language->code . ']', $value, ['data-parsley-required' => true]);
                    }
                    return $content;
                });
            };
            break;
        default:
            return function () {
            };
            break;
    }
})->form(function () {
    FormItem::text('code', 'Code')->validationRule('required')->group('status');
    FormItem::checkbox('default', 'Default')->group('status');
    FormItem::descriptions()->useTabs(true)->type('model')->modelMethod('descriptions')->fields(['name' => ['name' => 'Name', 'value' => 'name', 'type' => 'text', 'validation' => 'required']])->group('descriptions');
    FormGroup::create('status', 'Status')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
    FormGroup::create('descriptions', 'Status Descriptions')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
});
Exemple #4
0
 public function addGroup(FormGroup $group)
 {
     $this->groups[$group->getCode()] = $group;
 }