diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php index 7c83e2392..92d4a8d3c 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -23,6 +23,7 @@ return [ 'latest-limit', 'popular_ads_limit', 'default_view_type', + 'price_area_hidden', 'hide_listing_standard_price', 'hide_zero_price', 'auto_approve', @@ -67,7 +68,7 @@ return [ 'user' => [ 'title' => 'visiosoft.module.advs::section.user', 'fields' => [ - 'register_email_field', + 'register_email_field' ], ], 'filter' => [ @@ -76,6 +77,12 @@ return [ 'hide_price_filter', 'hide_date_filter', 'hide_photo_filter', 'hide_map_filter', 'user_filter_limit' ], ], + 'translations' => [ + 'title' => 'visiosoft.module.advs::section.translations', + 'fields' => [ + 'override_text', + ], + ], ], ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php index df69de9c2..d3c42dd98 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -153,6 +153,12 @@ return [ 'mode' => 'checkbox' ] ], + 'price_area_hidden' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + ] + ], 'enabled_currencies' => [ 'bind' => 'streams::currencies.enabled', 'env' => 'ADV_ENABLED_CURRENCIES', @@ -339,4 +345,9 @@ return [ 'mode' => 'checkbox' ], ], + 'override_text' => [ + 'type' => 'anomaly.field_type.tags', + 'bind' => 'override_text', + 'env' => 'OVERRIDE_TEXT', + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/button.php b/addons/default/visiosoft/advs-module/resources/lang/en/button.php index c09c7bc27..777bc94d0 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/button.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/button.php @@ -42,4 +42,5 @@ return [ 'replicate' => 'Replicate', 'fast_create' => 'Fast create', 'publish' => 'Publish', + 'import' => 'Import', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/section.php b/addons/default/visiosoft/advs-module/resources/lang/en/section.php index 1992005b1..6e1310527 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/section.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/section.php @@ -55,4 +55,5 @@ return [ 'option_configuration' => [ 'title' => 'Configuration', ], + 'translations' => 'Translations', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php index 660e90150..c773d2cce 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -126,7 +126,9 @@ return [ 'market_place' => [ 'name' => 'Market Place', ], - + 'price_area_hidden' => [ + 'name' => 'Price Area Hidden', + ], 'hide_price_filter' => [ 'name' => 'Hide Price Filter', ], @@ -205,4 +207,8 @@ return [ 'name' => 'Show Post Ad Agreement', 'instructions' => 'Turn this on if you want to display a privacy policy agreement on the ad creation page', ], + 'override_text' => [ + 'name' => 'Override Text', + 'instructions' => 'Old Value:New Value' + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/button.php b/addons/default/visiosoft/advs-module/resources/lang/tr/button.php index 9ba9fa095..2ebeaae73 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/button.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/button.php @@ -38,5 +38,7 @@ return [ 'new_options_configuration' => 'Yeni Seçenek yapılandırması', 'new_option_configuration' => 'Yeni Seçenek yapılandırması', 'create_configurations' => 'Konfigürasyonlar Oluşturun', - 'replicate' => 'Tekrarlamak', + 'replicate' => 'Tekrarla', + 'publish' => 'Yayınla', + ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php index 182ed9036..0c5de843a 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php @@ -307,6 +307,12 @@ return [ 'listing_details' => 'Liste Ayrıntıları', 'preview' => 'Ön İzleme', 'congratulations' => 'Tebrikler', + 'ad_desc' => 'İlan Açıklaması', + 'upload_photos' => 'Resim Yükle', + 'additional_fields' => 'Özel Alanlar', + 'ad_location' => 'Lokasyon Ekle', + + 'free' => 'Bedava', 'ad_date' => 'İlan Tarihi', diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php index c3f2b06b2..6cbc77cb4 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php @@ -27,4 +27,6 @@ return [ 'ad_doesnt_exist' => "Bu İlan mevcut değil!", 'select_location_error' => "Lütfen haritada bir yer seçin!", 'this_ad_is_not_valid_anymore' => "Bu ürün veya ilan artık geçerli değil!", + 'approve_status_change' => "İlanınızın Durumu Etkin Olarak Ayarlandı!", + 'passive_status_change' => "İlanınızın Durumu Pasif Olarak Ayarlandı!", ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index dfc591859..af3e2b57c 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -90,7 +90,9 @@ -
+
+
-
{{ trans('visiosoft.module.advs::field.upload_photos') }}
+
+ {{ trans('visiosoft.module.advs::field.upload_photos') }} +
@@ -178,12 +182,14 @@
-
- {{ trans('visiosoft.module.advs::field.additional_fields') }} -
-
- {{ addBlock('new-ad/other-fields',{'custom_fields':custom_fields})|raw }} -
+ {% if count(custom_fields) %} +
+ {{ trans('visiosoft.module.advs::field.additional_fields') }} +
+
+ {{ addBlock('new-ad/other-fields',{'custom_fields':custom_fields})|raw }} +
+ {% endif %}
{{ trans('visiosoft.module.advs::field.ad_location') }} diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvsImport.php b/addons/default/visiosoft/advs-module/src/Adv/AdvsImport.php new file mode 100644 index 000000000..ef6fa24ce --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvsImport.php @@ -0,0 +1,19 @@ + $row[0], + 'slug' => Str::slug($row[0]), + 'price' => $row[1], + 'currency' => $row[2], + ]); + } +} diff --git a/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableButtons.php b/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableButtons.php index 266de8c98..d8bd59c4c 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableButtons.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Table/AdvTableButtons.php @@ -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' => "" . trans('streams::button.edit') . "" - ], + 'edit', 'settings' => [ 'text' => false, 'href' => false, diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleSeeder.php b/addons/default/visiosoft/advs-module/src/AdvsModuleSeeder.php index a511c269b..3af51f7f2 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleSeeder.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleSeeder.php @@ -4,9 +4,6 @@ use Anomaly\Streams\Platform\Database\Seeder\Seeder; class AdvsModuleSeeder extends Seeder { - /** - * Run the seeder. - */ public function run() { } diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index c65d8b6f1..88f672aa8 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -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' => [ @@ -188,25 +196,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', @@ -237,9 +245,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) @@ -248,30 +256,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(); } } diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ExcelController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ExcelController.php new file mode 100644 index 000000000..361d4308a --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/ExcelController.php @@ -0,0 +1,41 @@ +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(); + } +} diff --git a/addons/default/visiosoft/location-module/resources/js/settings.js b/addons/default/visiosoft/location-module/resources/js/settings.js index 04f0c34a9..2144e5374 100644 --- a/addons/default/visiosoft/location-module/resources/js/settings.js +++ b/addons/default/visiosoft/location-module/resources/js/settings.js @@ -32,7 +32,7 @@ new Promise(function (resolve, reject) { function getCities(country) { crudAjax('id=' + country, '/ajax/getCities', 'POST', function (callback) { cities = callback; - $('select[name="default_city"]').html(""); + $('select[name="default_city"]').html(""); $.each(cities, function (index, value) { $('select[name="default_city"]').append(""); }); @@ -42,7 +42,7 @@ function getCities(country) { function getDistricts(city) { crudAjax('id=' + city, '/ajax/getDistricts', 'POST', function (callback) { cities = callback; - $('select[name="default_district"]').html(""); + $('select[name="default_district"]').html(""); $.each(cities, function (index, value) { $('select[name="default_district"]').append(""); }); @@ -52,7 +52,7 @@ function getDistricts(city) { function getNeighborhoods(district) { crudAjax('id=' + district, '/ajax/getNeighborhoods', 'POST', function (callback) { cities = callback; - $('select[name="default_neighborhood"]').html(""); + $('select[name="default_neighborhood"]').html(""); $.each(cities, function (index, value) { $('select[name="default_neighborhood"]').append(""); }); diff --git a/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig b/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig index afa8736a4..223babf0f 100644 --- a/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig +++ b/addons/default/visiosoft/media-field_type/resources/views/upload/partials/body.twig @@ -1,15 +1,20 @@ +{% set folders = entries('files','folders').whereIn('slug',field_type.configGet('folders')).get() %} +{% set allowed_types = {} %} +{% for mimes in folders.pluck('allowed_types.value').all() %} + {% set allowed_types = allowed_types|merge(mimes) %} +{% endfor %} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/resources/assets/js/country.js b/addons/default/visiosoft/profile-module/resources/assets/js/country.js index bde79bc7a..e42bf6dcc 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/js/country.js +++ b/addons/default/visiosoft/profile-module/resources/assets/js/country.js @@ -73,7 +73,7 @@ function Locations(cat, level, name){ url: "/class/ajax", success: function(msg){ $('select[name="'+name+'"]').find('option').remove(); - $('select[name="'+name+'"]').append(''); + $('select[name="'+name+'"]').append(''); $.each(msg, function(key, value){ $('select[name="'+name+'"]').append(''); }); diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/field.php b/addons/default/visiosoft/profile-module/resources/lang/en/field.php index 2f577d9ae..5ac8fe1d6 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/field.php @@ -58,6 +58,12 @@ return [ 'birthday' => [ 'name' => 'Birthday' ], + 'facebook_address' => [ + 'name' => 'Facebook Address' + ], + 'google_address' => [ + 'name' => 'Google Address' + ], 'education' => [ 'name' => 'Education' ], @@ -375,6 +381,9 @@ return [ 'password' => [ 'name' => 'Password', ], + 'old_password' => [ + 'name' => 'Old password', + ], 'new_password' => [ 'name' => 'New password', ], diff --git a/addons/default/visiosoft/profile-module/resources/lang/en/message.php b/addons/default/visiosoft/profile-module/resources/lang/en/message.php index fbd74ccb0..01da8faa1 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/en/message.php +++ b/addons/default/visiosoft/profile-module/resources/lang/en/message.php @@ -29,6 +29,7 @@ return [ 'empty_password_sms_message' => 'Due to security issues, we changed your password! Your new password is:', 'required_all' => "All Field is Required!", 'can_not_remove_filled_fields' => "You can not remove filled fields!", + 'wrong_password' => "The password you entered is not correct!", // Forgot Password 'email_phone_not_found' => 'The E-mail, Phone Number is not correct!', diff --git a/addons/default/visiosoft/profile-module/resources/lang/tr/field.php b/addons/default/visiosoft/profile-module/resources/lang/tr/field.php index 96a2bb319..945e70398 100644 --- a/addons/default/visiosoft/profile-module/resources/lang/tr/field.php +++ b/addons/default/visiosoft/profile-module/resources/lang/tr/field.php @@ -377,6 +377,9 @@ return [ 'new_password' => [ 'name' => 'Yeni Şifre', ], + 'old_password' => [ + 'name' => 'Eski Şifre', + ], 're_new_password' => [ 'name' => 'Şifre Onayı', ], diff --git a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig index c84551599..8b733d248 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/detail.twig @@ -149,7 +149,22 @@ {{ profileForm.fields.birthday.configSet('date_format','Y-m-d').setPlaceholder(now|date('Y-m-d')).input|raw }}
- +
+
+ + {{ profileForm.fields.facebook_address.input|raw }} +
+
+
+
+ + {{ profileForm.fields.google_address.input|raw }} +
+
{% if setting_value('visiosoft.module.profile::show_education_profession') %}
@@ -236,6 +251,12 @@ {{ passwordForm.open()|raw }}
+
+
+ + {{ passwordForm.fields.old_password.input|raw }} +
+
diff --git a/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormBuilder.php b/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormBuilder.php index 5f5578422..fe5ea5c1a 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormBuilder.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormBuilder.php @@ -6,6 +6,13 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder; class PasswordFormBuilder extends FormBuilder { protected $fields = [ + 'old_password' => [ + 'type' => 'anomaly.field_type.text', + 'required' => true, + 'config' => [ + 'type' => 'password' + ], + ], 'new_password' => [ 'type' => 'anomaly.field_type.text', 'required' => true, diff --git a/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormHandler.php b/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormHandler.php index ab88a1bd5..77b93ba91 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormHandler.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Password/PasswordFormHandler.php @@ -4,6 +4,7 @@ use Anomaly\Streams\Platform\Message\MessageBag; use Anomaly\UsersModule\User\User; use Anomaly\UsersModule\User\UserPassword; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Hash; class PasswordFormHandler { @@ -20,6 +21,11 @@ class PasswordFormHandler return; } + if (!Hash::check($builder->getPostValue('old_password'), \auth()->user()->password)) { + $messages->error(trans('visiosoft.module.profile::message.wrong_password')); + return redirect()->back(); + } + if ($builder->getPostValue('new_password') != $builder->getPostValue('re_new_password')) { $messages->error(trans('visiosoft.module.profile::message.password_do_not_match')); return redirect()->back(); diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php index b005cf522..d93408d68 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormBuilder.php @@ -17,7 +17,9 @@ class ProfileFormBuilder extends FormBuilder 'state_of_education', 'profession', 'birthday', - 'register_type' + 'register_type', + 'facebook_address', + 'google_address', ]; protected $actions = [ diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php index 1b98c239f..2a93e5a21 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php @@ -23,6 +23,8 @@ class ProfileFormHandler 'identification_number' => $builder->getPostValue('identification_number'), 'birthday' => $builder->getPostValue('birthday'), 'register_type' => $builder->getPostValue('register_type'), + 'facebook_address' => $builder->getPostValue('facebook_address'), + 'google_address' => $builder->getPostValue('google_address'), ]; if (setting_value('visiosoft.module.profile::show_education_profession')) { diff --git a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php index a377a6535..cf4271066 100644 --- a/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php +++ b/addons/default/visiosoft/profile-module/src/Seed/UsersFieldsSeeder.php @@ -139,6 +139,16 @@ class UsersFieldsSeeder extends Seeder 'slug' => 'profession', 'type' => 'anomaly.field_type.text', ], + [ + 'name' => trans('visiosoft.module.profile::field.facebook_address.name'), + 'slug' => 'facebook_address', + 'type' => 'anomaly.field_type.text', + ], + [ + 'name' => trans('visiosoft.module.profile::field.google_address.name'), + 'slug' => 'google_address', + 'type' => 'anomaly.field_type.text', + ] ]; foreach ($customFields as $customField) { diff --git a/app/Lang/Loader.php b/app/Lang/Loader.php new file mode 100644 index 000000000..72f7728a0 --- /dev/null +++ b/app/Lang/Loader.php @@ -0,0 +1,266 @@ + + * @author Ryan Thompson + */ +class Loader extends FileLoader +{ + + /** + * The runtime cache. + * + * @var array + */ + protected static $disabled = []; + + /** + * The streams path. + * + * @var string + */ + protected $streams; + + /** + * The addon collection instance. + * + * @var AddonCollection + */ + protected $addons; + + /** + * The application instance. + * + * @var Application + */ + protected $application; + + /** + * Create a new Loader instance. + * + * @param Filesystem $files + * @param string $path + */ + public function __construct(Filesystem $files, $path) + { + $this->streams = base_path('vendor/visiosoft/streams-platform/resources/lang'); + + $this->application = app(Application::class); + $this->addons = app(AddonCollection::class); + + parent::__construct($files, $path); + } + + /** + * Load a locale from a given path. + * + * Keep streams overrides in place + * that are NOT namespaced cause + * we're overriding Laravel's + * base language files too. + * + * @param string $path + * @param string $locale + * @param string $group + * @return array + */ + protected function loadPath($path, $locale, $group) + { + $lines = parent::loadPath($path, $locale, $group); + + if ($path == $this->streams && $lines) { + $lines = $this->loadAddonOverrides($lines, $locale, $group); + $lines = $this->loadSystemOverrides($lines, $locale, $group); + $lines = $this->loadApplicationOverrides($lines, $locale, $group); + } + + return $lines; + } + + /** + * Load namespaced overrides from + * system AND application paths. + * + * @param array $lines + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) + { + /** + * @deprecated since 1.6; Use manual loading or publishing. + */ + if (env('AUTOMATIC_ADDON_OVERRIDES', true)) { + $lines = $this->loadAddonOverrides($lines, $locale, $group, $namespace); + } + + $lines = $this->loadSystemOverrides($lines, $locale, $group, $namespace); + $lines = $this->loadApplicationOverrides($lines, $locale, $group, $namespace); + + return parent::loadNamespaceOverrides($lines, $locale, $group, $namespace); + } + + /** + * Load system overrides. + * + * @param array $lines + * @param $locale + * @param $group + * @param $namespace + * @return array + */ + protected function loadSystemOverrides(array $lines, $locale, $group, $namespace = null) + { + if (!$namespace || $namespace == 'streams') { + + $file = base_path("resources/streams/lang/{$locale}/{$group}.php"); + + if (is_dir(base_path("resources/streams/lang")) && $this->files->exists($file)) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + + if (str_is('*.*.*', $namespace)) { + + list($vendor, $type, $slug) = explode('.', $namespace); + + $file = base_path("resources/addons/{$vendor}/{$slug}-{$type}/lang/{$locale}/{$group}.php"); + + if (is_dir(base_path("resources/addons/{$vendor}/{$slug}-{$type}/lang")) && $this->files->exists($file)) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + + return $lines; + } + + /** + * Load system overrides. + * + * @param array $lines + * @param $locale + * @param $group + * @param $namespace + * @return array + */ + protected function loadApplicationOverrides(array $lines, $locale, $group, $namespace = null) + { + if (!$namespace || $namespace == 'streams') { + + $file = $this->application->getResourcesPath("streams/lang/{$locale}/{$group}.php"); + + if (is_dir($this->application->getResourcesPath("streams/lang")) && $this->files->exists($file)) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + + if (str_is('*.*.*', $namespace)) { + + list($vendor, $type, $slug) = explode('.', $namespace); + + $file = $this->application->getResourcesPath( + "addons/{$vendor}/{$slug}-{$type}/lang/{$locale}/{$group}.php" + ); + + if ( + is_dir($this->application->getResourcesPath("addons/{$vendor}/{$slug}-{$type}/lang")) + && $this->files->exists($file) + ) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + if (config()->has('override_text')) { + foreach (config()->get('override_text') as $override) { + $override = explode(':', $override); + + $lines = $this->findArrayValue($override[0], $override[1], $lines); + } + } + + return $lines; + } + + function replaceNewValue($find_value, $new_value, $arr) + { + if (is_array($arr)) { + foreach ($arr as $key => $item) { + $arr[$key] = $this->replaceNewValue($find_value, $new_value, $item); + } + return $arr; + } + if (strtolower($arr) == strtolower($find_value)) { + return $new_value; + } + return $arr; + } + + function findArrayValue($find_value, $new_value, $arr) + { + foreach ($arr as $key => $item) { + $arr[$key] = $this->replaceNewValue($find_value, $new_value, $item); + } + return $arr; + } + + + /** + * @param array $lines + * @param $locale + * @param $group + * @param null $namespace + * @return array + */ + protected function loadAddonOverrides(array $lines, $locale, $group, $namespace = null) + { + /** @var Addon $addon */ + foreach ($this->addons->enabled() as $addon) { + + $disabled = array_get(self::$disabled, $key = $addon->getNamespace('streams'), false); + + if (!$disabled && !$this->files->isDirectory($addon->getPath('resources/streams'))) { + self::$disabled[$key] = $disabled = true; + } + + if (!$disabled && (!$namespace || $namespace == 'streams')) { + + $file = $addon->getPath("resources/streams/lang/{$locale}/{$group}.php"); + + if ($this->files->exists($file)) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + + $disabled = array_get(self::$disabled, $key = $addon->getNamespace('addons'), false); + + if (!$disabled && !$this->files->isDirectory($addon->getPath('resources/addons'))) { + self::$disabled[$key] = $disabled = true; + } + + if (!$disabled && str_is('*.*.*', $namespace)) { + + list($vendor, $type, $slug) = explode('.', $namespace); + + $file = $addon->getPath( + "resources/addons/{$vendor}/{$slug}-{$type}/lang/{$locale}/{$group}.php" + ); + + if ($this->files->exists($file)) { + $lines = array_replace_recursive($lines, $this->files->getRequire($file)); + } + } + } + + return $lines; + } +} diff --git a/app/Listeners/Translations.php b/app/Listeners/Translations.php new file mode 100755 index 000000000..a891f3401 --- /dev/null +++ b/app/Listeners/Translations.php @@ -0,0 +1,45 @@ +singleton( + 'translation.loader', + function ($application) { + return new Loader($application['files'], $application['path.lang']); + } + ); + + app()->singleton( + 'translator', + function ($application) { + $loader = $application->make('translation.loader'); + + // When registering the translator component, we'll need to set the default + // locale as well as the fallback locale. So, we'll grab the application + // configuration so we can easily get both of these values from there. + $locale = $application['config']['app.locale']; + + $trans = new Translator($loader, $locale); + + $trans->setFallback($application['config']['app.fallback_locale']); + + return $trans; + } + ); + + if (defined('LOCALE')) { + app()->setLocale(LOCALE); + config()->set('app.locale', LOCALE); + } + // Set our locale namespace. + app()->make('translator')->addNamespace('streams', realpath(__DIR__ . '/../../vendor/visiosoft/streams-platform/resources/lang')); + + } +} diff --git a/config/streams.php b/config/streams.php index a05e9b5d3..bc4d41f38 100644 --- a/config/streams.php +++ b/config/streams.php @@ -13,7 +13,11 @@ return [ | */ - 'listeners' => [], + 'listeners' => [ + \Anomaly\Streams\Platform\Event\Booted::class => [ + \App\Listeners\Translations::class + ], + ], /* |-------------------------------------------------------------------------- diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 0fa39acbd..b90ff0f09 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -1,5 +1,7 @@ widgets = $widgets; - $this->menus = $menus; - $this->users = $users; - $this->roles = $roles; - $this->activator = $activator; - } + public function __construct( + WidgetRepositoryInterface $widgets, + MenuRepositoryInterface $menus, + UserRepositoryInterface $users, + DiskRepositoryInterface $disks, + FolderRepositoryInterface $folders, + RoleRepositoryInterface $roles, + UserActivator $activator + ) + { + $this->widgets = $widgets; + $this->menus = $menus; + $this->users = $users; + $this->roles = $roles; + $this->activator = $activator; + $this->disks = $disks; + $this->folders = $folders; + } - public function run() - { + public function run() + { - $admin = $this->roles->findBySlug('admin'); + $admin = $this->roles->findBySlug('admin'); - $this->users->unguard(); - $this->users->newQuery()->where('email', "info@openclassify.com")->forceDelete(); - $visiosoft_administrator = $this->users->create( - [ - 'display_name' => 'openclassify', - 'email' => "info@openclassify.com", - 'username' => "openclassify", - 'password' => "openclassify", - ] - ); + $this->users->unguard(); + $this->users->newQuery()->where('email', "info@openclassify.com")->forceDelete(); + $visiosoft_administrator = $this->users->create( + [ + 'display_name' => 'openclassify', + 'email' => "info@openclassify.com", + 'username' => "openclassify", + 'password' => "openclassify", + ] + ); - $visiosoft_administrator->roles()->sync([$admin->getId()]); + $visiosoft_administrator->roles()->sync([$admin->getId()]); - $this->activator->force($visiosoft_administrator); + $this->activator->force($visiosoft_administrator); - //Footer Link - LinkModel::query()->forceDelete(); - $repository = new EntryRepository(); - $repository->setModel(new UrlLinkTypeModel()); - $menu = $this->menus->findBySlug('footer'); + //Footer Link + LinkModel::query()->forceDelete(); + $repository = new EntryRepository(); + $repository->setModel(new UrlLinkTypeModel()); + $menu = $this->menus->findBySlug('footer'); - $openclassify = $repository->create( - [ - 'en' => [ - 'title' => 'OpenClassify.com', - ], - 'url' => 'https://openclassify.com/', - ] - ); - $visiosoft = $repository->create( - [ - 'en' => [ - 'title' => 'Visiosoft Inc.', - ], - 'url' => 'https://visiosoft.com.tr/', - ] - ); + $openclassify = $repository->create( + [ + 'en' => [ + 'title' => 'OpenClassify.com', + ], + 'url' => 'https://openclassify.com/', + ] + ); + $visiosoft = $repository->create( + [ + 'en' => [ + 'title' => 'Visiosoft Inc.', + ], + 'url' => 'https://visiosoft.com.tr/', + ] + ); - LinkModel::query()->create( - [ - 'menu' => $menu, - 'target' => '_blank', - 'entry' => $openclassify, - 'type' => 'anomaly.extension.url_link_type', - ] - ); - LinkModel::query()->create( - [ - 'menu' => $menu, - 'target' => '_blank', - 'entry' => $visiosoft, - 'type' => 'anomaly.extension.url_link_type', - ] - ); + LinkModel::query()->create( + [ + 'menu' => $menu, + 'target' => '_blank', + 'entry' => $openclassify, + 'type' => 'anomaly.extension.url_link_type', + ] + ); + LinkModel::query()->create( + [ + 'menu' => $menu, + 'target' => '_blank', + 'entry' => $visiosoft, + 'type' => 'anomaly.extension.url_link_type', + ] + ); - DB::table('files_files')->truncate(); + DB::table('files_files')->truncate(); - $repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/"; - file_put_contents(storage_path('advs.sql'), fopen($repository . "advs.sql", 'r')); - file_put_contents(storage_path('settings.sql'), fopen($repository . "settings.sql", 'r')); - file_put_contents(storage_path('categories.sql'), fopen($repository . "categories.sql", 'r')); - file_put_contents(storage_path('images.zip'), fopen($repository . "images.zip", "r")); - file_put_contents(storage_path('cats.zip'), fopen($repository . "cats.zip", "r")); + $repository = "https://raw.githubusercontent.com/openclassify/Openclassify-Demo-Data/master/"; + file_put_contents(storage_path('advs.sql'), fopen($repository . "advs.sql", 'r')); + file_put_contents(storage_path('settings.sql'), fopen($repository . "settings.sql", 'r')); + file_put_contents(storage_path('categories.sql'), fopen($repository . "categories.sql", 'r')); + file_put_contents(storage_path('images.zip'), fopen($repository . "images.zip", "r")); + file_put_contents(storage_path('cats.zip'), fopen($repository . "cats.zip", "r")); - Model::unguard(); - DB::unprepared(file_get_contents(storage_path('advs.sql'))); - DB::unprepared(file_get_contents(storage_path('categories.sql'))); - DB::unprepared(file_get_contents(storage_path('settings.sql'))); - Model::reguard(); + Model::unguard(); + DB::unprepared(file_get_contents(storage_path('advs.sql'))); + DB::unprepared(file_get_contents(storage_path('categories.sql'))); + DB::unprepared(file_get_contents(storage_path('settings.sql'))); + Model::reguard(); - $zip = new ZipArchive(); - $zip->open(storage_path('images.zip'), ZipArchive::CREATE); - $zip->extractTo(storage_path('streams/default/files-module/local/images/')); - $zip->open(storage_path('cats.zip'), ZipArchive::CREATE); - $zip->extractTo(storage_path('streams/default/files-module/local/images/')); - $zip->close(); + $zip = new ZipArchive(); + $zip->open(storage_path('images.zip'), ZipArchive::CREATE); + $zip->extractTo(storage_path('streams/default/files-module/local/images/')); + $zip->open(storage_path('cats.zip'), ZipArchive::CREATE); + $zip->extractTo(storage_path('streams/default/files-module/local/images/')); + $zip->close(); - $this->call(widgetSeeder::class); - } + $this->call(widgetSeeder::class); + + + //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 + ]); + }; + + if ($images_folder = $this->folders->findBySlug('images')) { + $images_folder->update([ + 'allowed_types' => [ + 'jpg', 'jpeg','png' + ], + ]); + } + } }