#1195 add sort order for list and admin page

This commit is contained in:
vedatakd 2020-03-30 21:36:35 +03:00
parent fd6650723c
commit 01044aae52
12 changed files with 21 additions and 176 deletions

View File

@ -28,186 +28,31 @@ class VisiosoftModuleLocationCreateLocationFields extends Migration
],
],
'description' => 'anomaly.field_type.textarea',
'advs_desc' => [
'type' => 'anomaly.field_type.wysiwyg',
'config' => [
'height' => 500,
],
],
'cat1' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => 0,
]
],
'cat2' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'cat3' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'cat4' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'cat5' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'cat6' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'cat7' => [
'type' => 'anomaly.field_type.select',
'config' => [
"default_value" => NULL,
]
],
'parent_category' => [
'type' => 'anomaly.field_type.relationship',
'config' => [
'related' => CategoryModel::class,
"default_value" => 0,
]
],
'status' => [
'type' => 'anomaly.field_type.text',
'config' => [
'type' => 'text',
'default_value' => 'pending_user'
]
],
'order' => 'anomaly.field_type.integer',
'price' => 'anomaly.field_type.decimal',
'currency' => [
'type' => 'anomaly.field_type.select',
'config' => [
'handler' => 'currencies',
],
],
'stock' => 'anomaly.field_type.integer',
'online_payment' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => 0,
]
],
'is_get_adv' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => 0,
]
],
'files' => [
'type' => 'visiosoft.field_type.media',
'config' => [
'folders' => ["images"],
'mode' => 'upload',
]
],
'country' => [
'parent_country' => [
'type' => 'anomaly.field_type.relationship',
'config' => [
'related' => CountryModel::class,
"default_value" => 0,
]
],
'city' => [
'parent_city' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'district' => [
'parent_district' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'neighborhood' => [
'parent_neighborhood' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'village' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'map_Val' => "anomaly.field_type.text",
'parent_country_id' => 'anomaly.field_type.integer',
'parent_city_id' => 'anomaly.field_type.integer',
'parent_district_id' => 'anomaly.field_type.integer',
'parent_neighborhood_id' => 'anomaly.field_type.integer',
'publish_at' => 'anomaly.field_type.datetime',
'finish_at' => 'anomaly.field_type.datetime',
'custom_field_category' => [
'type' => 'anomaly.field_type.relationship',
'config' => [
'related' => CustomFieldModel::class,
],
],
'parent_adv' => [
'type' => 'anomaly.field_type.relationship',
'config' => [
'related' => AdvModel::class,
],
],
'custom_field_value' => 'anomaly.field_type.text',
'type' => [
'type' => 'anomaly.field_type.select',
'config' => [
'options' => ['text' => 'Text Box', 'select' => 'Secim Alani(Select Box)', 'checkboxes' => 'Coklu Secim(Check Box)', 'multiple' => 'Cok Satirli Alan(Multi Line Box)', 'integer' => 'Tam Sayi', 'colorpicker' => 'Color Picker'],
'separator' => ':',
]
],
'custom_field_select_options' => 'anomaly.field_type.text',
'popular_adv' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => 0,
]
],
'adv_day' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => 0,
]
],
'custom_field_type' => "anomaly.field_type.text",
'cf_json' => "visiosoft.field_type.json",
'foreign_currencies' => 'visiosoft.field_type.json',
'deleted_at' => "anomaly.field_type.datetime",
'value' => 'anomaly.field_type.text',
'cover_photo' => 'anomaly.field_type.text',
'category_id' => 'anomaly.field_type.integer',
'field_id' => 'anomaly.field_type.integer',
'custom_field' => [
'type' => 'anomaly.field_type.relationship',
'config' => [
'related' => CustomFieldModel::class,
],
],
'count_show_phone' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 0,
]
],
'order' => 'anomaly.field_type.integer',
];
}

View File

@ -33,7 +33,7 @@ class VisiosoftModuleLocationCreateCitiesStream extends Migration
'unique' => true,
'required' => true,
],
'parent_country_id' => [
'parent_country' => [
'required' => true,
],
'order'

View File

@ -33,7 +33,7 @@ class VisiosoftModuleLocationCreateDistrictsStream extends Migration
'unique' => true,
'required' => true,
],
'parent_city_id' => [
'parent_city' => [
'required' => true,
],
'order'

View File

@ -33,7 +33,7 @@ class VisiosoftModuleLocationCreateNeighborhoodsStream extends Migration
'unique' => true,
'required' => true,
],
'parent_district_id' => [
'parent_district' => [
'required' => true,
],
'order'

View File

@ -33,7 +33,7 @@ class VisiosoftModuleLocationCreateVillageStream extends Migration
'unique' => true,
'required' => true,
],
'parent_neighborhood_id' => [
'parent_neighborhood' => [
'required' => true,
],
'order'

View File

@ -61,7 +61,7 @@ class CityTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'sort_order' => 'ASC',
],
];

View File

@ -61,7 +61,7 @@ class CountryTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'sort_order' => 'ASC',
],
];

View File

@ -61,7 +61,7 @@ class DistrictTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'sort_order' => 'ASC',
],
];

View File

@ -57,7 +57,7 @@ class AjaxController extends PublicController
if ($this->request->id)
return $this->country_model->find($this->request->id);
else
return $this->country_model->get();
return $this->country_model->orderBy('order', 'ASC')->get();
}
/**
@ -67,7 +67,7 @@ class AjaxController extends PublicController
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
return $this->city_model->whereIn('parent_country_id', $id)->get();
return $this->city_model->whereIn('parent_country_id', $id)->orderBy('order', 'ASC')->get();
}
}
@ -78,7 +78,7 @@ class AjaxController extends PublicController
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
return $this->district_model->whereIn('parent_city_id', $id)->get();
return $this->district_model->whereIn('parent_city_id', $id)->orderBy('order', 'ASC')->get();
}
}
@ -89,7 +89,7 @@ class AjaxController extends PublicController
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
return $this->neighborhood_model->whereIn('parent_district_id', $id)->get();
return $this->neighborhood_model->whereIn('parent_district_id', $id)->orderBy('order', 'ASC')->get();
}
}
@ -100,7 +100,7 @@ class AjaxController extends PublicController
{
if ($this->request->id) {
$id = explode(',', $this->request->id);
return $this->village_model->whereIn('parent_neighborhood_id', $id)->get();
return $this->village_model->whereIn('parent_neighborhood_id', $id)->orderBy('order', 'ASC')->get();
}
}
}

View File

@ -28,8 +28,8 @@ class LocationModuleSeeder extends Seeder
Model::unguard();
DB::unprepared(file_get_contents(__DIR__.'/countries.sql'));
DB::unprepared(file_get_contents(__DIR__.'/cities.sql'));
DB::unprepared(file_get_contents(__DIR__.'/districts.sql'));
DB::unprepared(file_get_contents(__DIR__.'/neighborhoods.sql'));
// DB::unprepared(file_get_contents(__DIR__.'/districts.sql'));
// DB::unprepared(file_get_contents(__DIR__.'/neighborhoods.sql'));
Model::reguard();
/* Demo Stop*/
}

View File

@ -61,7 +61,7 @@ class NeighborhoodTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'sort_order' => 'ASC',
],
];

View File

@ -52,7 +52,7 @@ class VillageTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'sort_order' => 'ASC',
],
];
/**