mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #826 from openclassify/dia
partially refactoring the location module's admin side
This commit is contained in:
commit
f4c7e09bd4
@ -4,68 +4,35 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|||||||
|
|
||||||
class CityFormBuilder extends FormBuilder
|
class CityFormBuilder extends FormBuilder
|
||||||
{
|
{
|
||||||
|
protected $country = null;
|
||||||
|
|
||||||
/**
|
protected $skips = [
|
||||||
* The form fields.
|
'parent_country_id'
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $fields = [
|
|
||||||
'name','slug','order','parent_country_id'=>[
|
|
||||||
'class' => 'hidden',
|
|
||||||
'label' => '',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional validation rules.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $rules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields to skip.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $skips = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
protected $buttons = [
|
||||||
'cancel',
|
'cancel',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public function onSaving()
|
||||||
* The form options.
|
{
|
||||||
*
|
$country = $this->getCountry();
|
||||||
* @var array
|
$entry = $this->getFormEntry();
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
if ($country) {
|
||||||
* The form sections.
|
$entry->parent_country_id = $country;
|
||||||
*
|
}
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
public function getCountry()
|
||||||
* The form assets.
|
{
|
||||||
*
|
return $this->country;
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
|
public function setCountry($country = null)
|
||||||
|
{
|
||||||
|
$this->country = $country;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,69 +4,35 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|||||||
|
|
||||||
class DistrictFormBuilder extends FormBuilder
|
class DistrictFormBuilder extends FormBuilder
|
||||||
{
|
{
|
||||||
|
protected $city = null;
|
||||||
|
|
||||||
/**
|
protected $skips = [
|
||||||
* The form fields.
|
'parent_city_id'
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $fields = [
|
|
||||||
'name','slug','order','parent_city_id'=>[
|
|
||||||
'type' => 'anomaly.field_type.text',
|
|
||||||
'class' => 'hidden',
|
|
||||||
'label' => '',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional validation rules.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $rules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields to skip.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $skips = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
protected $buttons = [
|
||||||
'cancel',
|
'cancel',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public function onSaving()
|
||||||
* The form options.
|
{
|
||||||
*
|
$city = $this->getCity();
|
||||||
* @var array
|
$entry = $this->getFormEntry();
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
if ($city) {
|
||||||
* The form sections.
|
$entry->parent_city_id = $city;
|
||||||
*
|
}
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
public function getCity()
|
||||||
* The form assets.
|
{
|
||||||
*
|
return $this->city;
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
|
public function setCity($city = null)
|
||||||
|
{
|
||||||
|
$this->city = $city;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,13 +9,6 @@ use Visiosoft\LocationModule\District\DistrictModel;
|
|||||||
|
|
||||||
class CitiesController extends AdminController
|
class CitiesController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Display an index of existing entries.
|
|
||||||
*
|
|
||||||
* @param CityTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(CityTableBuilder $table, Request $request)
|
public function index(CityTableBuilder $table, Request $request)
|
||||||
{
|
{
|
||||||
if($this->request->action == "delete") {
|
if($this->request->action == "delete") {
|
||||||
@ -39,32 +32,13 @@ class CitiesController extends AdminController
|
|||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function create(CityFormBuilder $form)
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param CityFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(CityFormBuilder $form,Request $request)
|
|
||||||
{
|
{
|
||||||
if($this->request->action == "save") {
|
$form->setCountry($this->request->get('cities'));
|
||||||
if ($form->hasFormErrors()) {
|
|
||||||
return back();
|
|
||||||
}
|
|
||||||
$form->make();
|
|
||||||
return $this->redirect->to('/admin/location/cities?country='.$request->parent_country_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.location::location/admin-sub-location');
|
return $form->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing entry.
|
|
||||||
*
|
|
||||||
* @param CityFormBuilder $form
|
|
||||||
* @param $id
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function edit(CityFormBuilder $form, $id)
|
public function edit(CityFormBuilder $form, $id)
|
||||||
{
|
{
|
||||||
return $form->render($id);
|
return $form->render($id);
|
||||||
|
|||||||
@ -9,13 +9,6 @@ use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
|
|||||||
|
|
||||||
class DistrictsController extends AdminController
|
class DistrictsController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Display an index of existing entries.
|
|
||||||
*
|
|
||||||
* @param DistrictTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(DistrictTableBuilder $table, Request $request)
|
public function index(DistrictTableBuilder $table, Request $request)
|
||||||
{
|
{
|
||||||
if($this->request->action == "delete") {
|
if($this->request->action == "delete") {
|
||||||
@ -39,32 +32,13 @@ class DistrictsController extends AdminController
|
|||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function create(DistrictFormBuilder $form)
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param DistrictFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(DistrictFormBuilder $form,Request $request)
|
|
||||||
{
|
{
|
||||||
if($this->request->action == "save") {
|
$form->setCity($this->request->get('districts'));
|
||||||
if ($form->hasFormErrors()) {
|
|
||||||
return back();
|
|
||||||
}
|
|
||||||
$form->make();
|
|
||||||
return $this->redirect->to('/admin/location/districts?city='.$request->parent_city_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.location::location/admin-sub-location');
|
return $form->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing entry.
|
|
||||||
*
|
|
||||||
* @param DistrictFormBuilder $form
|
|
||||||
* @param $id
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function edit(DistrictFormBuilder $form, $id)
|
public function edit(DistrictFormBuilder $form, $id)
|
||||||
{
|
{
|
||||||
return $form->render($id);
|
return $form->render($id);
|
||||||
|
|||||||
@ -9,13 +9,6 @@ use Visiosoft\LocationModule\Village\VillageModel;
|
|||||||
|
|
||||||
class NeighborhoodsController extends AdminController
|
class NeighborhoodsController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Display an index of existing entries.
|
|
||||||
*
|
|
||||||
* @param NeighborhoodTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(NeighborhoodTableBuilder $table, Request $request)
|
public function index(NeighborhoodTableBuilder $table, Request $request)
|
||||||
{
|
{
|
||||||
if($this->request->action == "delete") {
|
if($this->request->action == "delete") {
|
||||||
@ -39,35 +32,13 @@ class NeighborhoodsController extends AdminController
|
|||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function create(NeighborhoodFormBuilder $form)
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param NeighborhoodFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(NeighborhoodFormBuilder $form,Request $request)
|
|
||||||
{
|
{
|
||||||
// dd($request);
|
$form->setDistrict($this->request->get('neighborhoods'));
|
||||||
// return $form->render();
|
|
||||||
if($this->request->action == "save") {
|
|
||||||
if ($form->hasFormErrors()) {
|
|
||||||
return back();
|
|
||||||
}
|
|
||||||
$form->make();
|
|
||||||
|
|
||||||
return $this->redirect->to('/admin/location/neighborhoods?district='.$request->parent_district_id);
|
return $form->render();
|
||||||
}
|
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.location::location/admin-sub-location');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing entry.
|
|
||||||
*
|
|
||||||
* @param NeighborhoodFormBuilder $form
|
|
||||||
* @param $id
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function edit(NeighborhoodFormBuilder $form, $id)
|
public function edit(NeighborhoodFormBuilder $form, $id)
|
||||||
{
|
{
|
||||||
return $form->render($id);
|
return $form->render($id);
|
||||||
|
|||||||
@ -8,13 +8,6 @@ use Visiosoft\LocationModule\Village\VillageModel;
|
|||||||
|
|
||||||
class VillageController extends AdminController
|
class VillageController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Display an index of existing entries.
|
|
||||||
*
|
|
||||||
* @param VillageTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(VillageTableBuilder $table, Request $request)
|
public function index(VillageTableBuilder $table, Request $request)
|
||||||
{
|
{
|
||||||
$villages = new VillageModel();
|
$villages = new VillageModel();
|
||||||
@ -31,33 +24,13 @@ class VillageController extends AdminController
|
|||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function create(VillageFormBuilder $form)
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param VillageFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(VillageFormBuilder $form,Request $request)
|
|
||||||
{
|
{
|
||||||
// return $form->render();
|
$form->setNeighborhood($this->request->get('village'));
|
||||||
if($this->request->action == "save") {
|
|
||||||
if ($form->hasFormErrors()) {
|
|
||||||
return back();
|
|
||||||
}
|
|
||||||
$form->make();
|
|
||||||
return $this->redirect->to('/admin/location/village?neighborhood='.$request->parent_neighborhood_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.location::location/admin-sub-location');
|
return $form->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing entry.
|
|
||||||
*
|
|
||||||
* @param VillageFormBuilder $form
|
|
||||||
* @param $id
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function edit(VillageFormBuilder $form, $id)
|
public function edit(VillageFormBuilder $form, $id)
|
||||||
{
|
{
|
||||||
return $form->render($id);
|
return $form->render($id);
|
||||||
|
|||||||
@ -4,36 +4,19 @@ use Anomaly\Streams\Platform\Addon\Module\Module;
|
|||||||
|
|
||||||
class LocationModule extends Module
|
class LocationModule extends Module
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* The navigation display flag.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $navigation = true;
|
protected $navigation = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon icon.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $icon = 'fa fa-location-arrow';
|
protected $icon = 'fa fa-location-arrow';
|
||||||
|
|
||||||
/**
|
|
||||||
* The module sections.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $sections = [
|
protected $sections = [
|
||||||
'countries' => [
|
'countries' => [
|
||||||
'buttons' => [
|
'buttons' => [
|
||||||
'new_country'=> [],
|
'new_country',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'cities' => [],
|
'cities',
|
||||||
'districts' => [],
|
'districts',
|
||||||
'neighborhoods' => [],
|
'neighborhoods',
|
||||||
'village' => [],
|
'village',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,48 +17,15 @@ use Visiosoft\LocationModule\Neighborhood\NeighborhoodRepository;
|
|||||||
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Village\VillageRepository;
|
use Visiosoft\LocationModule\Village\VillageRepository;
|
||||||
use Visiosoft\LocationModule\Village\VillageModel;
|
use Visiosoft\LocationModule\Village\VillageModel;
|
||||||
use Illuminate\Routing\Router;
|
|
||||||
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
|
||||||
use Visiosoft\LocationModule\Country\CountryRepository;
|
use Visiosoft\LocationModule\Country\CountryRepository;
|
||||||
|
|
||||||
class LocationModuleServiceProvider extends AddonServiceProvider
|
class LocationModuleServiceProvider extends AddonServiceProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional addon plugins.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $plugins = [
|
protected $plugins = [
|
||||||
LocationModulePlugin::class
|
LocationModulePlugin::class
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon Artisan commands.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $commands = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon's scheduled commands.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $schedules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon API routes.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $api = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon routes.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $routes = [
|
protected $routes = [
|
||||||
'admin/location/village' => 'Visiosoft\LocationModule\Http\Controller\Admin\VillageController@index',
|
'admin/location/village' => 'Visiosoft\LocationModule\Http\Controller\Admin\VillageController@index',
|
||||||
'admin/location/village/create' => 'Visiosoft\LocationModule\Http\Controller\Admin\VillageController@create',
|
'admin/location/village/create' => 'Visiosoft\LocationModule\Http\Controller\Admin\VillageController@create',
|
||||||
@ -104,141 +71,18 @@ class LocationModuleServiceProvider extends AddonServiceProvider
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon middleware.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $middleware = [
|
|
||||||
//Visiosoft\AdvsModule\Http\Middleware\ExampleMiddleware::class
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Addon group middleware.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $groupMiddleware = [
|
|
||||||
//'web' => [
|
|
||||||
// Visiosoft\AdvsModule\Http\Middleware\ExampleMiddleware::class,
|
|
||||||
//],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Addon route middleware.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $routeMiddleware = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon event listeners.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $listeners = [
|
|
||||||
//Visiosoft\AdvsModule\Event\ExampleEvent::class => [
|
|
||||||
// Visiosoft\AdvsModule\Listener\ExampleListener::class,
|
|
||||||
//],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon alias bindings.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $aliases = [
|
|
||||||
//'Example' => Visiosoft\AdvsModule\Example::class
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon class bindings.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $bindings = [
|
protected $bindings = [
|
||||||
LocationCitiesEntryModel::class => CityModel::class,
|
LocationCitiesEntryModel::class => CityModel::class,
|
||||||
LocationDistrictsEntryModel::class => DistrictModel::class,
|
LocationDistrictsEntryModel::class => DistrictModel::class,
|
||||||
LocationNeighborhoodsEntryModel::class => NeighborhoodModel::class,
|
LocationNeighborhoodsEntryModel::class => NeighborhoodModel::class,
|
||||||
// AdvsCfValuesEntryModel::class => CfValueModel::class,
|
|
||||||
// AdvsCustomFieldAdvsEntryModel::class => CustomFieldAdvModel::class,
|
|
||||||
// AdvsCustomFieldsEntryModel::class => CustomFieldModel::class,
|
|
||||||
LocationVillageEntryModel::class => VillageModel::class,
|
LocationVillageEntryModel::class => VillageModel::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon singleton bindings.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $singletons = [
|
protected $singletons = [
|
||||||
CityRepositoryInterface::class => CityRepository::class,
|
CityRepositoryInterface::class => CityRepository::class,
|
||||||
DistrictRepositoryInterface::class => DistrictRepository::class,
|
DistrictRepositoryInterface::class => DistrictRepository::class,
|
||||||
NeighborhoodRepositoryInterface::class => NeighborhoodRepository::class,
|
NeighborhoodRepositoryInterface::class => NeighborhoodRepository::class,
|
||||||
// CfValueRepositoryInterface::class => CfValueRepository::class,
|
|
||||||
// CustomFieldAdvRepositoryInterface::class => CustomFieldAdvRepository::class,
|
|
||||||
// CustomFieldRepositoryInterface::class => CustomFieldRepository::class,
|
|
||||||
VillageRepositoryInterface::class => VillageRepository::class,
|
VillageRepositoryInterface::class => VillageRepository::class,
|
||||||
CountryRepositoryInterface::class => CountryRepository::class,
|
CountryRepositoryInterface::class => CountryRepository::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional service providers.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $providers = [
|
|
||||||
//\ExamplePackage\Provider\ExampleProvider::class
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon view overrides.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $overrides = [
|
|
||||||
'streams::form/form' => 'visiosoft.module.advs::form/form',
|
|
||||||
//'streams::errors/404' => 'module::errors/404',
|
|
||||||
//'streams::errors/500' => 'module::errors/500',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon mobile-only view overrides.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $mobile = [
|
|
||||||
//'streams::errors/404' => 'module::mobile/errors/404',
|
|
||||||
//'streams::errors/500' => 'module::mobile/errors/500',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the addon.
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
// Run extra pre-boot registration logic here.
|
|
||||||
// Use method injection or commands to bring in services.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boot the addon.
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map additional addon routes.
|
|
||||||
*
|
|
||||||
* @param Router $router
|
|
||||||
*/
|
|
||||||
// public function map(Router $router)
|
|
||||||
// {
|
|
||||||
// // Register dynamic routes here for example.
|
|
||||||
// // Use method injection or commands to bring in services.
|
|
||||||
// }
|
|
||||||
public function map(Router $router)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,69 +4,35 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|||||||
|
|
||||||
class NeighborhoodFormBuilder extends FormBuilder
|
class NeighborhoodFormBuilder extends FormBuilder
|
||||||
{
|
{
|
||||||
|
protected $district = null;
|
||||||
|
|
||||||
/**
|
protected $skips = [
|
||||||
* The form fields.
|
'parent_district_id'
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $fields = [
|
|
||||||
'name','slug','order','parent_district_id'=>[
|
|
||||||
'type' => 'anomaly.field_type.text',
|
|
||||||
'class' => 'hidden',
|
|
||||||
'label' => '',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional validation rules.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $rules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields to skip.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $skips = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
protected $buttons = [
|
||||||
'cancel',
|
'cancel',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public function onSaving()
|
||||||
* The form options.
|
{
|
||||||
*
|
$district = $this->getDistrict();
|
||||||
* @var array
|
$entry = $this->getFormEntry();
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
if ($district) {
|
||||||
* The form sections.
|
$entry->parent_district_id = $district;
|
||||||
*
|
}
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
public function getDistrict()
|
||||||
* The form assets.
|
{
|
||||||
*
|
return $this->district;
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
|
public function setDistrict($district = null)
|
||||||
|
{
|
||||||
|
$this->district = $district;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,69 +4,35 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|||||||
|
|
||||||
class VillageFormBuilder extends FormBuilder
|
class VillageFormBuilder extends FormBuilder
|
||||||
{
|
{
|
||||||
|
protected $neighborhood = null;
|
||||||
|
|
||||||
/**
|
protected $skips = [
|
||||||
* The form fields.
|
'parent_neighborhood_id'
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $fields = [
|
|
||||||
'name','slug','order','parent_neighborhood_id'=>[
|
|
||||||
'type' => 'anomaly.field_type.text',
|
|
||||||
'class' => 'hidden',
|
|
||||||
'label' => '',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional validation rules.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $rules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields to skip.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $skips = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
protected $buttons = [
|
||||||
'cancel',
|
'cancel',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public function onSaving()
|
||||||
* The form options.
|
{
|
||||||
*
|
$neighborhood = $this->getNeighborhood();
|
||||||
* @var array
|
$entry = $this->getFormEntry();
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
if ($neighborhood) {
|
||||||
* The form sections.
|
$entry->parent_neighborhood_id = $neighborhood;
|
||||||
*
|
}
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
public function getNeighborhood()
|
||||||
* The form assets.
|
{
|
||||||
*
|
return $this->neighborhood;
|
||||||
* @var array
|
}
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
|
public function setNeighborhood($neighborhood = null)
|
||||||
|
{
|
||||||
|
$this->neighborhood = $neighborhood;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,11 +52,11 @@
|
|||||||
<nav aria-label="Page navigation example">
|
<nav aria-label="Page navigation example">
|
||||||
<ul class="pagination justify-content-center">
|
<ul class="pagination justify-content-center">
|
||||||
<li class="page-item">
|
<li class="page-item">
|
||||||
<a id="btn_prev" class="page-link" href="javascript:prevPage()">Previous</a>
|
<a id="btn_prev" class="page-link" href="javascript:prevPage()"><</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item"><span id="page" class="page-link">1</span></li>
|
<li class="page-item"><span id="page" class="page-link">1</span></li>
|
||||||
<li class="page-item">
|
<li class="page-item">
|
||||||
<a id="btn_next" class="page-link" href="javascript:nextPage()">Next</a>
|
<a id="btn_next" class="page-link" href="javascript:nextPage()">></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user