mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 23:06:08 -06:00
Merge branches 'fatihalp' and 'master' of https://github.com/openclassify/openclassify into fatihalp
This commit is contained in:
commit
438c695aea
@ -1,4 +1,3 @@
|
|||||||
<p>
|
|
||||||
{% if(adv.map_Val == "") %}
|
{% if(adv.map_Val == "") %}
|
||||||
{{ trans('visiosoft.module.advs::field.no_location') }}
|
{{ trans('visiosoft.module.advs::field.no_location') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -51,4 +50,3 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
|
||||||
@ -1,8 +1,15 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Adv;
|
<?php namespace Visiosoft\AdvsModule\Adv;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\Command\DeleteOptionConfiguration;
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||||
|
|
||||||
class AdvObserver extends EntryObserver
|
class AdvObserver extends EntryObserver
|
||||||
{
|
{
|
||||||
|
public function deleting(EntryInterface $entry)
|
||||||
|
{
|
||||||
|
$this->dispatch(new DeleteOptionConfiguration($entry));
|
||||||
|
|
||||||
|
parent::deleting($entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Adv\Command;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
|
||||||
|
class DeleteOptionConfiguration
|
||||||
|
{
|
||||||
|
protected $ad;
|
||||||
|
|
||||||
|
public function __construct(AdvInterface $ad)
|
||||||
|
{
|
||||||
|
$this->ad = $ad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(OptionConfigurationRepositoryInterface $optionConfigurationRepository)
|
||||||
|
{
|
||||||
|
$optionConfigurationRepository->deleteAdsConfigs($this->ad->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,29 +1,27 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Form\OptionConfigurationFormBuilder;
|
use Visiosoft\AdvsModule\OptionConfiguration\Form\OptionConfigurationFormBuilder;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Table\OptionConfigurationTableBuilder;
|
use Visiosoft\AdvsModule\OptionConfiguration\Table\OptionConfigurationTableBuilder;
|
||||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
|
||||||
class OptionConfigurationController extends AdminController
|
class OptionConfigurationController extends AdminController
|
||||||
{
|
{
|
||||||
|
public function index(
|
||||||
/**
|
OptionConfigurationTableBuilder $table,
|
||||||
* Display an index of existing entries.
|
OptionConfigurationRepositoryInterface $optionConfigurationRepository
|
||||||
*
|
)
|
||||||
* @param OptionConfigurationTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(OptionConfigurationTableBuilder $table)
|
|
||||||
{
|
{
|
||||||
|
// Remove deleted ad's configuration
|
||||||
|
$unusedConfigs = $optionConfigurationRepository->getUnusedConfigs();
|
||||||
|
|
||||||
|
if (count($unusedConfigs)) {
|
||||||
|
$optionConfigurationRepository->deleteUnusedConfigs($unusedConfigs);
|
||||||
|
}
|
||||||
|
|
||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param OptionConfigurationFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(OptionConfigurationFormBuilder $form)
|
public function create(OptionConfigurationFormBuilder $form)
|
||||||
{
|
{
|
||||||
$form->setOption('redirect', route('visiosoft.module.advs::configrations.index'));
|
$form->setOption('redirect', route('visiosoft.module.advs::configrations.index'));
|
||||||
|
|||||||
@ -7,4 +7,10 @@ interface OptionConfigurationRepositoryInterface extends EntryRepositoryInterfac
|
|||||||
public function createConfigration($ad_id,$price,$currency,$stock,$option_json);
|
public function createConfigration($ad_id,$price,$currency,$stock,$option_json);
|
||||||
|
|
||||||
public function getConf($ad_id);
|
public function getConf($ad_id);
|
||||||
|
|
||||||
|
public function getUnusedConfigs();
|
||||||
|
|
||||||
|
public function deleteUnusedConfigs($adsIDs);
|
||||||
|
|
||||||
|
public function deleteAdsConfigs($adID);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,4 +70,24 @@ class OptionConfigurationRepository extends EntryRepository implements OptionCon
|
|||||||
|
|
||||||
return $configurations;
|
return $configurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUnusedConfigs()
|
||||||
|
{
|
||||||
|
return $this->newQuery()
|
||||||
|
->leftJoin('advs_advs as ads', 'advs_option_configuration.parent_adv_id', 'ads.id')
|
||||||
|
->whereNull('ads.id')
|
||||||
|
->orWhereNotNull('deleted_at')
|
||||||
|
->pluck('parent_adv_id')
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteUnusedConfigs($adsIDs)
|
||||||
|
{
|
||||||
|
return $this->newQuery()->whereIn('parent_adv_id', $adsIDs)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAdsConfigs($adID)
|
||||||
|
{
|
||||||
|
return $this->newQuery()->where('parent_adv_id', $adID)->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,7 @@ $(function () {
|
|||||||
formData.append('folder', element.data('folder'));
|
formData.append('folder', element.data('folder'));
|
||||||
},
|
},
|
||||||
renameFile: function (file) {
|
renameFile: function (file) {
|
||||||
let newName = new Date().getTime() + '_' + file.name;
|
return new Date().getTime() + '_' + file.name.replace(/ /g, '_');
|
||||||
return newName;
|
|
||||||
},
|
},
|
||||||
accept: function (file, done) {
|
accept: function (file, done) {
|
||||||
$.get(REQUEST_ROOT_PATH + '/streams/media-field_type/exists/' + element.data('folder'), {'file': file.name}, function (data) {
|
$.get(REQUEST_ROOT_PATH + '/streams/media-field_type/exists/' + element.data('folder'), {'file': file.name}, function (data) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user