mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
e-commerce needs
This commit is contained in:
parent
5e6d378b17
commit
3658be64c2
@ -42,4 +42,5 @@ return [
|
||||
'replicate' => 'Replicate',
|
||||
'fast_create' => 'Fast create',
|
||||
'publish' => 'Publish',
|
||||
'import' => 'Import',
|
||||
];
|
||||
|
||||
19
addons/default/visiosoft/advs-module/src/Adv/AdvsImport.php
Normal file
19
addons/default/visiosoft/advs-module/src/Adv/AdvsImport.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace Visiosoft\AdvsModule\Adv;
|
||||
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
|
||||
class AdvsImport implements ToModel
|
||||
{
|
||||
public function model(array $row)
|
||||
{
|
||||
return new AdvModel([
|
||||
'name' => $row[0],
|
||||
'slug' => Str::slug($row[0]),
|
||||
'price' => $row[1],
|
||||
'currency' => $row[2],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -25,13 +25,7 @@ class AdvTableButtons
|
||||
return ($entry->getStatus() == 'approved') ? "danger" : "success";
|
||||
},
|
||||
],
|
||||
|
||||
'edit' => [
|
||||
'href' => function (EntryModel $entry) {
|
||||
return route('visiosoft.module.advs::edit_adv', ['id' => $entry->getId()]);
|
||||
},
|
||||
'text' => "<font class='hidden-xs-down'>" . trans('streams::button.edit') . "</font>"
|
||||
],
|
||||
'edit',
|
||||
'settings' => [
|
||||
'text' => false,
|
||||
'href' => false,
|
||||
|
||||
@ -1,13 +1,56 @@
|
||||
<?php namespace Visiosoft\AdvsModule;
|
||||
|
||||
use Anomaly\FilesModule\Disk\Contract\DiskRepositoryInterface;
|
||||
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||
|
||||
class AdvsModuleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* The disk repository.
|
||||
*
|
||||
* @var DiskRepositoryInterface
|
||||
*/
|
||||
protected $disks;
|
||||
|
||||
/**
|
||||
* The folder repository.
|
||||
*
|
||||
* @var FolderRepositoryInterface
|
||||
*/
|
||||
protected $folders;
|
||||
|
||||
/**
|
||||
* Create a new FolderSeeder instance.
|
||||
*
|
||||
* @param DiskRepositoryInterface $disks
|
||||
* @param FolderRepositoryInterface $folders
|
||||
*/
|
||||
public function __construct(DiskRepositoryInterface $disks, FolderRepositoryInterface $folders)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->disks = $disks;
|
||||
$this->folders = $folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the seeder.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//Create Store Icon Folder
|
||||
if (!$this->folders->findBySlug('ads_excel')) {
|
||||
$disk = $this->disks->findBySlug('local');
|
||||
|
||||
$this->folders->create([
|
||||
'en' => [
|
||||
'name' => 'Ads Excel',
|
||||
'description' => 'A folder for Ads Excel.',
|
||||
],
|
||||
'slug' => 'ads_excel',
|
||||
'disk' => $disk
|
||||
]);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -47,10 +47,18 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
'admin/advs-users/choose/{advId}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@choose',
|
||||
'admin/class/actions/{id}/{type}' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@actions',
|
||||
'admin/advs/export' => [
|
||||
'as' => 'advs::exportAdvs',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@exportAdvs',
|
||||
],
|
||||
|
||||
|
||||
//Excel
|
||||
'admin/advs/export' => [
|
||||
'as' => 'advs::exportAdvs',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@exportAdvs',
|
||||
],
|
||||
'admin/advs/import' => [
|
||||
'as' => 'visiosoft.module.advs::import.advs',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ExcelController@import',
|
||||
],
|
||||
|
||||
|
||||
// advsController
|
||||
'advs/list' => [
|
||||
@ -187,25 +195,25 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
// Others
|
||||
'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser',
|
||||
|
||||
//Configurations Admin Controller
|
||||
'admin/advs/option_configuration/create' => [
|
||||
'as' => 'visiosoft.module.advs::configrations.create',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create',
|
||||
],
|
||||
'admin/advs/option_configuration' => [
|
||||
'as' => 'visiosoft.module.advs::configrations.index',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@index',
|
||||
],
|
||||
//Configurations Admin Controller
|
||||
'admin/advs/option_configuration/create' => [
|
||||
'as' => 'visiosoft.module.advs::configrations.create',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create',
|
||||
],
|
||||
'admin/advs/option_configuration' => [
|
||||
'as' => 'visiosoft.module.advs::configrations.index',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@index',
|
||||
],
|
||||
|
||||
//Configuration Controller
|
||||
'advs/option_configuration/create' => [
|
||||
'as' => 'visiosoft.module.advs::user.configrations.create',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create',
|
||||
],
|
||||
'conf/addCart' => [
|
||||
'as' => 'configuration::add_cart',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@confAddCart',
|
||||
],
|
||||
//Configuration Controller
|
||||
'advs/option_configuration/create' => [
|
||||
'as' => 'visiosoft.module.advs::user.configrations.create',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create',
|
||||
],
|
||||
'conf/addCart' => [
|
||||
'as' => 'configuration::add_cart',
|
||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@confAddCart',
|
||||
],
|
||||
|
||||
// Admin ProductoptionsController
|
||||
'admin/advs/product_options' => 'Visiosoft\AdvsModule\Http\Controller\Admin\ProductoptionsController@index',
|
||||
@ -236,9 +244,9 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
CategoryRepositoryInterface::class => CategoryRepository::class,
|
||||
CountryRepositoryInterface::class => CountryRepository::class,
|
||||
OptionRepositoryInterface::class => OptionRepository::class,
|
||||
ProductoptionRepositoryInterface::class => ProductoptionRepository::class,
|
||||
OptionConfigurationRepositoryInterface::class => OptionConfigurationRepository::class,
|
||||
ProductoptionsValueRepositoryInterface::class => ProductoptionsValueRepository::class,
|
||||
ProductoptionRepositoryInterface::class => ProductoptionRepository::class,
|
||||
OptionConfigurationRepositoryInterface::class => OptionConfigurationRepository::class,
|
||||
ProductoptionsValueRepositoryInterface::class => ProductoptionsValueRepository::class,
|
||||
];
|
||||
|
||||
public function boot(AddonCollection $addonCollection, FileModel $fileModel)
|
||||
@ -247,30 +255,35 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||
'general_settings' => [
|
||||
'title' => 'visiosoft.module.advs::button.general_settings',
|
||||
'href' => '/admin/settings/modules/visiosoft.module.advs',
|
||||
'page' => 'anomaly.module.settings'
|
||||
'page' => 'anomaly.module.settings'
|
||||
],
|
||||
'theme_settings' => [
|
||||
'title' => 'visiosoft.theme.defaultadmin::section.theme_settings.name',
|
||||
'href' => url('admin/settings/themes/' . setting_value('streams::standard_theme')),
|
||||
'page' => 'anomaly.module.settings'
|
||||
'page' => 'anomaly.module.settings'
|
||||
],
|
||||
'assets_clear' => [
|
||||
'title' => 'visiosoft.module.advs::section.assets_clear.name',
|
||||
'href' => route('assets_clear'),
|
||||
'page' => 'anomaly.module.settings'
|
||||
'page' => 'anomaly.module.settings'
|
||||
],
|
||||
'export' => [
|
||||
'title' => 'visiosoft.module.advs::button.export',
|
||||
'href' => route('advs::exportAdvs'),
|
||||
'page' => 'visiosoft.module.advs'
|
||||
]
|
||||
'export' => [
|
||||
'title' => 'visiosoft.module.advs::button.export',
|
||||
'href' => route('advs::exportAdvs'),
|
||||
'page' => 'visiosoft.module.advs'
|
||||
],
|
||||
'import' => [
|
||||
'title' => 'visiosoft.module.advs::button.import',
|
||||
'href' => route('visiosoft.module.advs::import.advs'),
|
||||
'page' => 'visiosoft.module.advs'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($settings_url as $key => $value) {
|
||||
$addonCollection->get($value['page'])->addSection($key, $value);
|
||||
}
|
||||
|
||||
// Disable file versioning
|
||||
// Disable file versioning
|
||||
$fileModel->disableVersioning();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||
|
||||
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Visiosoft\AdvsModule\Adv\AdvsImport;
|
||||
|
||||
class ExcelController extends AdminController
|
||||
{
|
||||
public function import(FormBuilder $builder, FileRepositoryInterface $fileRepository)
|
||||
{
|
||||
if (request()->action == "save" and $file = $fileRepository->find(request()->file)) {
|
||||
if ($file->extension === 'xls' || $file->extension === 'xlsx') {
|
||||
$pathToFolder = "/storage/streams/default/files-module/local/ads_excel/";
|
||||
Excel::import(new AdvsImport(), base_path() . $pathToFolder . $file->name);
|
||||
$this->messages->success(trans('streams::message.create_success', ['name' => trans('module::addon.title')]));
|
||||
}
|
||||
}
|
||||
|
||||
//Form Render
|
||||
$builder->setFields([
|
||||
'file' => [
|
||||
"type" => "anomaly.field_type.file",
|
||||
"config" => [
|
||||
'folders' => ["ads_excel"],
|
||||
'mode' => 'upload'
|
||||
]
|
||||
],
|
||||
]);
|
||||
$builder->setActions([
|
||||
'save'
|
||||
]);
|
||||
|
||||
$builder->setOptions([
|
||||
'redirect' => route('visiosoft.module.advs::admin_advs')
|
||||
]);
|
||||
|
||||
return $builder->render();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user