#3699 province district add button

This commit is contained in:
Diatrex 2021-04-14 09:53:15 +03:00
parent 33c306a8b4
commit eab3885dc4
4 changed files with 22 additions and 7 deletions

View File

@ -3,4 +3,5 @@
return [
'placeholder' => 'Type here to search',
'null_msg' => 'Not Found',
'choose_country' => 'Choose a Country',
];

View File

@ -2,7 +2,7 @@
<button class="close" data-dismiss="modal">
<span>&times;</span>
</button>
<h4 class="modal-title">{{ trans('visiosoft.module.advs::message.choose_field_type') }}</h4>
<h4 class="modal-title">{{ trans('visiosoft.module.location::message.choose_country') }}</h4>
</div>
<div class="modal-body">
@ -10,12 +10,10 @@
{% include "streams::modals/filter" %}
<ul class="nav nav-pills nav-stacked">
{% for field_type in field_types %}
{% for country in countries %}
<li class="nav-item">
<a href="{{ url_to('admin/advs/fields/create?field_type=' ~ field_type.namespace) }}" class="nav-link">
<strong>{{ trans(field_type.getTitle()) }}</strong>
<br>
<small>{{ trans(field_type.getDescription()) }}</small>
<a href="{{ url_to('admin/location/cities/create?cities=' ~ country.id) }}" class="nav-link">
<strong>{{ country.name }}</strong>
</a>
</li>
{% endfor %}

View File

@ -5,6 +5,7 @@ use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\City\Form\CityFormBuilder;
use Visiosoft\LocationModule\City\Table\CityTableBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface;
use Visiosoft\LocationModule\District\DistrictModel;
class CitiesController extends AdminController
@ -32,6 +33,13 @@ class CitiesController extends AdminController
return $table->render();
}
public function choose(CountryRepositoryInterface $countryRepository)
{
$countries = $countryRepository->all();
return $this->view->make('visiosoft.module.location::admin/fields/choose', ['countries' => $countries]);
}
public function create(CityFormBuilder $form)
{
$form->setCountry($this->request->get('cities'));

View File

@ -14,7 +14,15 @@ class LocationModule extends Module
'new_country',
],
],
'cities',
'cities' => [
'buttons' => [
'new_city' => [
'data-toggle' => 'modal',
'data-target' => '#modal',
'href' => 'admin/location/cities/choose',
],
],
],
'districts',
'neighborhoods',
'village',