Merge branches 'fatihalp' and 'master' of https://github.com/openclassify/openclassify into fatihalp

This commit is contained in:
Fatih Alp 2021-02-07 23:42:14 +03:00
commit 6abb14dfb5
18 changed files with 99 additions and 59 deletions

View File

@ -23,6 +23,7 @@
.upper-list-banner {
min-height: 300px;
background-size: cover;
}
.upper-list-banner img {
@ -226,31 +227,14 @@ a.sort-by-open-dropdown:hover {
padding: 5px 0;
}
.p-3{
background-color: #f4f4f4;
}
.card {
border: none;
}
.py-1 {
padding-top: 3px!important;
padding-bottom: 3px!important;
}
.px-2 {
padding: 0!important;
}
.btn-link {
font-weight: bold;
}
.p-3 {
padding: 8px !important;
}
.searchbut {
padding: 0px !important;
}

View File

@ -60,13 +60,15 @@ $(document).ready(function () {
$('.cat-item-3').parent().css('display', 'flex');
stop();
} else {
response.forEach(function(options){
$(catId).append("<li class='text-truncate pl-1 my-1' data-value="+options.id+">"+options.name+"</li>");
});
$('.focus-select').removeClass('focus-select');
// $(catId).animate({height: '14rem'}, 200);
$(catId).css({height: '14rem'});
$(catId).closest('.cat-item-2').show().addClass('focus-select')
if (!$('li', catId).length) {
response.forEach(function(options){
$(catId).append("<li class='text-truncate pl-1 my-1' data-value="+options.id+">"+options.name+"</li>");
});
$('.focus-select').removeClass('focus-select');
// $(catId).animate({height: '14rem'}, 200);
$(catId).css({height: '14rem'});
$(catId).closest('.cat-item-2').show().addClass('focus-select')
}
}
// Auto scroll right
let categoryTab = $('.category-tab');

View File

@ -322,6 +322,8 @@ return [
'upload_files' => 'Upload Files',
'additional_fields' => 'Additional Fields',
'ad_location' => 'Ad Location',
'owner' => 'Owner',
'default_owner_instruction' => 'The owner will default to the current user if no user is selected',
'free' => 'Free',
'ad_date' => 'Ad Date',

View File

@ -4,9 +4,20 @@
{{ content|raw }}
{% if form.mode == 'edit' %}
{% set entry = form.entry.setAttribute('cf_json', null) %}
{% set entry = form.entry %}
<script>
const ad = JSON.parse(`{{ entry|json_encode|raw }}`)
const ad = {
cat1: `{{ entry.cat1 }}`,
cat2: `{{ entry.cat2 }}`,
cat3: `{{ entry.cat3 }}`,
cat4: `{{ entry.cat4 }}`,
cat5: `{{ entry.cat5 }}`,
cat6: `{{ entry.cat6 }}`,
cat7: `{{ entry.cat7 }}`,
cat8: `{{ entry.cat8 }}`,
cat9: `{{ entry.cat9 }}`,
cat10: `{{ entry.cat10 }}`,
}
</script>
{% endif %}
{% endblock %}

View File

@ -11,7 +11,9 @@
</p>
</div>
<div class="preview-actions text-center">
{% if isActiveDopings %}
{% if isActive('packages') and setting_value('visiosoft.module.packages::move_the_buy_package_to_the_end') %}
{% set continueLink = url_route('visiosoft.module.packages::add_package', [adv.id]) %}
{% elseif isActive('dopings') %}
{% set continueLink = url_route('add_doping', [adv.id]) %}
{% else %}
{% set continueLink = url_route('adv_detail_seo', [adv.slug, adv.id]) %}

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Adv;
use Anomaly\Streams\Platform\Entry\EntryCollection;
use Carbon\Carbon;
use Illuminate\Container\Container;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
@ -26,4 +27,13 @@ class AdvCollection extends EntryCollection
'items', 'total', 'perPage', 'currentPage', 'options'
));
}
public function nonExpired()
{
return $this->filter(
function ($ad) {
return $ad->finish_at->gt(Carbon::now());
}
);
}
}

View File

@ -466,15 +466,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
{
$ads = $this
->newQuery()
->whereIn('advs_advs.created_by_id', $usersIDs)
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
->whereIn('advs_advs.created_by_id', $usersIDs);
if ($status) {
$ads = $ads->where('advs_advs.status', 'approved');
}
if (!$withDraft) {
$ads = $ads->where('advs_advs.slug', '!=', "");
$ads = $ads
->where('advs_advs.slug', '!=', "")
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
}
return $ads;

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Adv\Form;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
use Anomaly\UsersModule\User\UserModel;
use Visiosoft\AdvsModule\Adv\AdvModel;
class SimpleAdvFormBuilder extends FormBuilder
@ -8,6 +9,15 @@ class SimpleAdvFormBuilder extends FormBuilder
protected $model = AdvModel::class;
protected $fields = [
"created_by_id" => [
'label' => 'visiosoft.module.advs::field.owner',
'instructions' => 'visiosoft.module.advs::field.default_owner_instruction',
"type" => "anomaly.field_type.relationship",
"config" => [
"related" => UserModel::class,
"mode" => "lookup",
]
],
'name',
'price',
'currency',

View File

@ -11,6 +11,10 @@ class SimpleAdvFormHandler
return;
}
if (!$builder->getFormValue('created_by_id')) {
$builder->setFormValue('created_by_id', auth()->id());
}
$builder->saveForm();
$ad = $advRepository->find($builder->getFormEntryId());

View File

@ -128,9 +128,12 @@ class AdvsModulePlugin extends Plugin
return [
new \Twig_SimpleFilter(
'ksort',
function (array $array) {
ksort($array);
return $array;
function ($array) {
if ($array) {
ksort($array);
return $array;
}
return null;
}
),
];

View File

@ -666,8 +666,7 @@ class AdvsController extends PublicController
public function getCatsForNewAd($id)
{
if ($this->adv_model->is_enabled('packages')) {
if ($this->adv_model->is_enabled('packages') and !setting_value('visiosoft.module.packages::move_the_buy_package_to_the_end')) {
$cats = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForCategorySelection($id);
} else {
$cats = $this->getCats($id);
@ -962,7 +961,7 @@ class AdvsController extends PublicController
} elseif ($type === 'sold') {
$message = trans('visiosoft.module.advs::message.sold_status_change');
} else {
trans('visiosoft.module.advs::message.passive_status_change');
$message = trans('visiosoft.module.advs::message.passive_status_change');
}
$this->messages->success($message);
return back();

View File

@ -4076,7 +4076,7 @@ readers do not read off random characters that represent icons */
content: "\f7bc";
}
.fa-redo:before {
.fa-redo:before, .fa-repeat:before {
content: "\f01e";
}

View File

@ -2761,3 +2761,8 @@ body {
font-size: 2rem;
}
}
/** bootstrap 4.1 Column Fix**/
.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}
.col-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}

View File

@ -2,8 +2,14 @@
Dropzone.autoDiscover = false;
$("div#myDrop").dropzone({url: "/file/post"});
var doc_input = $('input[name="doc_files"]');
var uploaded = $('input[name="files"]').val().split(',').map(Number);
var docsUploaded = $('input[name="doc_files"]').val().split(',').map(Number);
if (doc_input.length) {
var docsUploaded = doc_input.val().split(',').map(Number);
}
$(function () {
@ -69,7 +75,7 @@ $(function () {
var response = JSON.parse(file.xhr.response);
var mimeType = response.mime_type.split('/')
if (mimeType[0] === 'image'){
if (mimeType[0] === 'image') {
uploaded.push(response.id);
$('.media-selected-wrapper').load(
@ -87,21 +93,23 @@ $(function () {
file.previewElement.remove();
}, 500);
} else {
docsUploaded.push(response.id);
$('input[name="doc_files"]').val(docsUploaded.join(','))
if (doc_input.length) {
docsUploaded.push(response.id);
$('input[name="doc_files"]').val(docsUploaded.join(','))
$('.doc_list').append(`
<a id="${ response.id }" href="javascript:void(0)" onclick="deleteDocs(${ response.id })" class="text-dark">
${ response.name }
$('.doc_list').append(`
<a id="${response.id}" href="javascript:void(0)" onclick="deleteDocs(${response.id})" class="text-dark">
${response.name}
<i class="fa fa-trash text-danger"></i>
</a><br>
`)
setTimeout(function () {
setTimeout(function () {
addAppendByData(docsUploaded[0])
file.previewElement.remove();
}, 500);
addAppendByData(docsUploaded[0])
file.previewElement.remove();
}, 500);
}
}
});

View File

@ -101,7 +101,6 @@ class UploadController extends AdminController
$constraint->aspectRatio();
});
if ($settings_value['add_canvas']) {
$fullImg->resizeCanvas(
@ -132,13 +131,15 @@ class UploadController extends AdminController
$w = $image->width() / 2;
$h1 = $image->height() / 2;
$font_size = $w / 20;
$image->text($settings_value['watermark_text'], $w, $h1, function ($font) use ($v, $h, $font_size) {
$image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) {
$font->file(public_path('Antonio-Bold.ttf'));
$font->size($font_size);
$font->align($h);
$font->valign($v);
});
}
if ($key === "full") {
$fileName = $file->getAttributes()['name'];
} else {

View File

@ -65,7 +65,7 @@ class ValueTableBuilder extends TableBuilder
],
'rotate' => [
'target' => '_blank',
'icon' => 'fas fa-redo',
'icon' => 'fa fa-repeat',
'type' => 'info',
'text' => '',
'class' => 'col-4',
@ -76,7 +76,7 @@ class ValueTableBuilder extends TableBuilder
],
'deleteImage' => [
'target' => '_blank',
'icon' => 'fas fa-trash',
'icon' => 'fa fa-trash',
'type' => 'danger',
'text' => '',
'class' => 'col-4 deleteImage',

View File

@ -4,10 +4,12 @@ class UserUpdated
{
public $oldCustomerInfo;
public $changes;
public $builder;
public function __construct($oldCustomerInfo, $changes)
public function __construct($oldCustomerInfo, $changes, $builder = null)
{
$this->oldCustomerInfo = $oldCustomerInfo;
$this->changes = $changes;
$this->builder = $builder;
}
}

View File

@ -2,11 +2,7 @@
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
use Anomaly\Streams\Platform\Message\MessageBag;
use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterface;
use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\UserModel;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Redirect;
use Visiosoft\ProfileModule\Events\UserUpdated;
class ProfileFormHandler
@ -72,7 +68,7 @@ class ProfileFormHandler
$changes = $this->change($user, $parameters);
event(new UserUpdated($oldCustomerInfo, $changes));
event(new UserUpdated($oldCustomerInfo, $changes, $builder));
$messages->success(trans('visiosoft.module.profile::message.success_update'));
}
@ -97,7 +93,7 @@ class ProfileFormHandler
foreach ($validators as $validator) {
$valid = $validator->validate($fields);
if ($valid['error']) {
if (isset($valid['error']) && $valid['error']) {
return $valid;
}
}