Merge pull request #469 from openclassify/vedat

#1195 add sort order for list and admin page
This commit is contained in:
profstyle1 2020-03-31 10:17:04 +03:00 committed by GitHub
commit 2ef5d9bf2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 46 additions and 200 deletions

View File

@ -27,187 +27,32 @@ class VisiosoftModuleLocationCreateLocationFields extends Migration
'type' => '_'
],
],
'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' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'district' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'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' => ':',
'parent_city_id' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'custom_field_select_options' => 'anomaly.field_type.text',
'popular_adv' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => 0,
'parent_district_id' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'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,
'parent_neighborhood_id' => [
"type" => "anomaly.field_type.select",
"config" => [
"options" => [],
]
],
'order' => 'anomaly.field_type.integer',
];
}

View File

@ -14,7 +14,7 @@ class VisiosoftModuleLocationCreateCountriesStream extends Migration
'slug' => 'countries',
'title_column' => 'name',
'translatable' => true,
'trashable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];

View File

@ -14,7 +14,7 @@ class VisiosoftModuleLocationCreateCitiesStream extends Migration
'slug' => 'cities',
'title_column' => 'name',
'translatable' => true,
'trashable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];

View File

@ -14,7 +14,7 @@ class VisiosoftModuleLocationCreateDistrictsStream extends Migration
'slug' => 'districts',
'title_column' => 'name',
'translatable' => true,
'trashable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];

View File

@ -14,7 +14,7 @@ class VisiosoftModuleLocationCreateNeighborhoodsStream extends Migration
'slug' => 'neighborhoods',
'title_column' => 'name',
'translatable' => true,
'trashable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];

View File

@ -14,7 +14,7 @@ class VisiosoftModuleLocationCreateVillageStream extends Migration
'slug' => 'village',
'title_column' => 'name',
'translatable' => true,
'trashable' => false,
'trashable' => true,
'searchable' => false,
'sortable' => false,
];

View File

@ -15,13 +15,13 @@ class CityModel extends LocationCitiesEntryModel implements CityInterface
}
public function getSubCities($country) {
return $this->query()->where('parent_country_id', $country)->get();
return $this->query()->where('parent_country_id', $country)->orderBy('order','ASC')->get();
}
public function deleteCitiesByCountry($id) {
$districts = new DistrictModel();
$city = $this->where('parent_country_id',$id);
$city_id = $city->get();
$city_id = $city->orderBy('id','DESC')->get();
foreach ($city_id as $item)
{
$districts->deleteDistrictByCity($item->id);

View File

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

View File

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

View File

@ -11,13 +11,13 @@ class DistrictModel extends LocationDistrictsEntryModel implements DistrictInter
}
public function getSubDistricts($city) {
return $this->query()->where('parent_city_id', $city)->get();
return $this->query()->where('parent_city_id', $city)->orderBy('order','ASC')->get();
}
public function deleteDistrictByCity($id) {
$neighborhood = new NeighborhoodModel();
$districts = $this->where('parent_city_id',$id);
$districts_id = $districts->get();
$districts_id = $districts->orderBy('id','DESC')->get();
foreach ($districts_id as $item)
{
$neighborhood->deleteNeighborhoodByDistrict($item->id);

View File

@ -61,7 +61,7 @@ class DistrictTableBuilder extends TableBuilder
*/
protected $options = [
'order_by' => [
'id' => 'DESC',
'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

@ -1,4 +1,5 @@
<?php namespace Visiosoft\LocationModule;
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
use Illuminate\Database\Eloquent\Model;
@ -19,17 +20,17 @@ class LocationModuleSeeder extends Seeder
{
//Download demo SQL
$repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/";
file_put_contents(__DIR__."/countries.sql", fopen($repository."countries.sql", 'r'));
file_put_contents(__DIR__."/cities.sql", fopen($repository."cities.sql", 'r'));
file_put_contents(__DIR__."/districts.sql", fopen($repository."districts.sql", 'r'));
file_put_contents(__DIR__."/neighborhoods.sql", fopen($repository."neighborhoods.sql", 'r'));
file_put_contents(__DIR__ . "/countries.sql", fopen($repository . "countries.sql", 'r'));
file_put_contents(__DIR__ . "/cities.sql", fopen($repository . "cities.sql", 'r'));
file_put_contents(__DIR__ . "/districts.sql", fopen($repository . "districts.sql", 'r'));
file_put_contents(__DIR__ . "/neighborhoods.sql", fopen($repository . "neighborhoods.sql", 'r'));
/* Demo Start */
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__ . '/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'));
Model::reguard();
/* Demo Stop*/
}

View File

@ -11,13 +11,13 @@ class NeighborhoodModel extends LocationNeighborhoodsEntryModel implements Neigh
}
public function getSubNeighborhoods($district) {
return $this->query()->where('parent_district_id', $district)->get();
return $this->query()->where('parent_district_id', $district)->orderBy('order','ASC')->get();
}
public function deleteNeighborhoodByDistrict($id) {
$village = new VillageModel();
$neighborhood = $this->where('parent_district_id',$id);
$neighborhoods_id = $neighborhood->get();
$neighborhoods_id = $neighborhood->orderBy('id','DESC')->get();
foreach ($neighborhoods_id as $item)
{
$village->deleteVillageByNeighborhood($item->id);

View File

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

View File

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

View File

@ -10,10 +10,10 @@ class VillageModel extends LocationVillageEntryModel implements VillageInterface
}
public function getSubVillages($neighborhood) {
return $this->query()->where('parent_neighborhood_id', $neighborhood)->get();
return $this->query()->where('parent_neighborhood_id', $neighborhood)->orderBy('order','ASC')->get();
}
public function deleteVillageByNeighborhood($id) {
$this->where('parent_neighborhood_id',$id)->delete();
$this->where('parent_neighborhood_id',$id)->orderBy('id','DESC')->delete();
}
}