mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #1085 from openclassify/muammertop
#3284 Add description area in all modules on admin panel
This commit is contained in:
commit
70e334155a
@ -4,4 +4,5 @@ return [
|
|||||||
'title' => 'Ads',
|
'title' => 'Ads',
|
||||||
'name' => 'Ads Module',
|
'name' => 'Ads Module',
|
||||||
'description' => 'Ads Module',
|
'description' => 'Ads Module',
|
||||||
|
'info' => 'This is the screen where you can add, delete and edit ads from the Ads page. On this page, you can simply do the operations such as post management and ad configuration.'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -3,5 +3,6 @@
|
|||||||
return [
|
return [
|
||||||
'title' => 'Category',
|
'title' => 'Category',
|
||||||
'name' => 'Category Module',
|
'name' => 'Category Module',
|
||||||
'description' => ''
|
'description' => '',
|
||||||
|
'info' => 'This is the screen where you can add, delete and edit categories from the category page. You can easily manage main categories and sub-categories from this page.',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -30,6 +30,10 @@ return [
|
|||||||
'instructions' => 'It is used to add icons indicating the category type.',
|
'instructions' => 'It is used to add icons indicating the category type.',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'parent' => 'Parent',
|
||||||
|
'level' => 'Level',
|
||||||
|
'count' => 'Ad Counts',
|
||||||
|
|
||||||
'please_wait' => 'Please wait.Deleting Sub Categories',
|
'please_wait' => 'Please wait.Deleting Sub Categories',
|
||||||
'category_selection' => 'Category Selection',
|
'category_selection' => 'Category Selection',
|
||||||
'go_to_parent' => 'Go To Parent',
|
'go_to_parent' => 'Go To Parent',
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace Visiosoft\CatsModule\Category;
|
||||||
|
|
||||||
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
|
|
||||||
|
class CategoryExport implements WithMapping, FromCollection, WithHeadings
|
||||||
|
{
|
||||||
|
public function collection()
|
||||||
|
{
|
||||||
|
return CategoryModel::all();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function map($cats): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$cats->id,
|
||||||
|
$cats->name,
|
||||||
|
$cats->parent_category_id,
|
||||||
|
$cats->level,
|
||||||
|
$cats->count,
|
||||||
|
$cats->seo_keyword,
|
||||||
|
$cats->seo_description,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headings(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'ID',
|
||||||
|
trans('module::field.name.name'),
|
||||||
|
trans('module::field.parent'),
|
||||||
|
trans('module::field.level'),
|
||||||
|
trans('module::field.count'),
|
||||||
|
trans('module::field.seo_keyword.name'),
|
||||||
|
trans('module::field.seo_description.name'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php namespace Visiosoft\CatsModule\Category;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Maatwebsite\Excel\Concerns\ToModel;
|
||||||
|
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||||
|
|
||||||
|
class CategoryImport implements ToModel, WithHeadingRow
|
||||||
|
{
|
||||||
|
public function model(array $row)
|
||||||
|
{
|
||||||
|
if ($row['name'] !== null) {
|
||||||
|
return new CategoryModel([
|
||||||
|
'name' => $row['name'],
|
||||||
|
'slug' => Str::slug($row['name']),
|
||||||
|
'parent_category_id' => $row['parent_id'] ?? null,
|
||||||
|
'level' => $row['level'] ?? 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php namespace Visiosoft\CatsModule;
|
<?php namespace Visiosoft\CatsModule;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Addon\AddonCollection;
|
||||||
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
|
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
|
||||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||||
use Visiosoft\AdvsModule\Adv\Event\CreatedAd;
|
use Visiosoft\AdvsModule\Adv\Event\CreatedAd;
|
||||||
@ -59,13 +60,24 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
'admin/cats/adcountcalc' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@adCountCalc',
|
'admin/cats/adcountcalc' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@adCountCalc',
|
||||||
'admin/cats/catlevelcalc' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@catLevelCalc',
|
'admin/cats/catlevelcalc' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@catLevelCalc',
|
||||||
|
|
||||||
'admin/cats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index',
|
'admin/cats' => [
|
||||||
|
'as' => 'visiosoft.module.cats::admin_cats',
|
||||||
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index'
|
||||||
|
],
|
||||||
'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
|
'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
|
||||||
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
|
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
|
||||||
'admin/cats/category/delete/{id}' => [
|
'admin/cats/category/delete/{id}' => [
|
||||||
'as' => 'visiosoft.module.cats::admin.delete_category',
|
'as' => 'visiosoft.module.cats::admin.delete_category',
|
||||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@delete',
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@delete',
|
||||||
],
|
],
|
||||||
|
'admin/cats/import' => [
|
||||||
|
'as' => 'visiosoft.module.cats::import',
|
||||||
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@import',
|
||||||
|
],
|
||||||
|
'admin/cats/export' => [
|
||||||
|
'as' => 'visiosoft.module.cats::export',
|
||||||
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@export',
|
||||||
|
],
|
||||||
|
|
||||||
// Sitemap
|
// Sitemap
|
||||||
'sitemap.xml' => 'Visiosoft\CatsModule\Http\Controller\SitemapController@index',
|
'sitemap.xml' => 'Visiosoft\CatsModule\Http\Controller\SitemapController@index',
|
||||||
@ -187,10 +199,24 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
/**
|
/**
|
||||||
* Boot the addon.
|
* Boot the addon.
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(AddonCollection $addonCollection)
|
||||||
{
|
{
|
||||||
// Run extra post-boot registration logic here.
|
$settings_url = [
|
||||||
// Use method injection or commands to bring in services.
|
'import' => [
|
||||||
|
'title' => 'visiosoft.module.advs::button.import',
|
||||||
|
'href' => route('visiosoft.module.cats::import'),
|
||||||
|
'page' => 'visiosoft.module.cats'
|
||||||
|
],
|
||||||
|
'export' => [
|
||||||
|
'title' => 'visiosoft.module.advs::button.export',
|
||||||
|
'href' => route('visiosoft.module.cats::export'),
|
||||||
|
'page' => 'visiosoft.module.cats'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($settings_url as $key => $value) {
|
||||||
|
$addonCollection->get($value['page'])->addSection($key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
|
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
|
||||||
use Anomaly\FilesModule\File\FileSanitizer;
|
use Anomaly\FilesModule\File\FileSanitizer;
|
||||||
use Anomaly\FilesModule\File\FileUploader;
|
use Anomaly\FilesModule\File\FileUploader;
|
||||||
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryTranslationsModel;
|
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryTranslationsModel;
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use League\Flysystem\MountManager;
|
use League\Flysystem\MountManager;
|
||||||
|
use Visiosoft\CatsModule\Category\CategoryExport;
|
||||||
|
use Visiosoft\CatsModule\Category\CategoryImport;
|
||||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
use Visiosoft\CatsModule\Category\Command\CalculateAdsCount;
|
use Visiosoft\CatsModule\Category\Command\CalculateAdsCount;
|
||||||
use Visiosoft\CatsModule\Category\Command\CalculateCategoryLevel;
|
use Visiosoft\CatsModule\Category\Command\CalculateCategoryLevel;
|
||||||
@ -17,6 +21,7 @@ use Visiosoft\CatsModule\Category\Table\CategoryTableBuilder;
|
|||||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\CatsModule\Category\Traits\DeleteCategory;
|
use Visiosoft\CatsModule\Category\Traits\DeleteCategory;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class CategoryController extends AdminController
|
class CategoryController extends AdminController
|
||||||
{
|
{
|
||||||
@ -273,4 +278,38 @@ class CategoryController 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 CategoryImport(), 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.cats::admin_cats')
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $builder->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export(){
|
||||||
|
return Excel::download(new CategoryExport(), 'cats-' . time() . '.xlsx');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2762,6 +2762,10 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-info {
|
||||||
|
background-color: rgba(17, 190, 246, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** bootstrap 4.1 Column Fix**/
|
/** bootstrap 4.1 Column Fix**/
|
||||||
.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}
|
.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}
|
||||||
|
|||||||
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
{{ breadcrumb() }}
|
{{ breadcrumb() }}
|
||||||
|
|
||||||
|
{% if trans('module::addon.info') != 'module::addon.info' %}
|
||||||
|
<div class="page-info m-2 small text-white alert rounded">{{ trans('module::addon.info') }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
{% include "theme::partials/messages" %}
|
{% include "theme::partials/messages" %}
|
||||||
{% include "theme::partials/buttons" %}
|
{% include "theme::partials/buttons" %}
|
||||||
|
|||||||
@ -4,4 +4,5 @@ return [
|
|||||||
'title' => 'Location',
|
'title' => 'Location',
|
||||||
'name' => 'Location Module',
|
'name' => 'Location Module',
|
||||||
'description' => 'Description',
|
'description' => 'Description',
|
||||||
|
'info' => 'On this page, you can manage country, city, district, neighborhood and village information.',
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user