#557 Installment calculation widget

This commit is contained in:
Diatrex 2019-12-24 18:17:02 +03:00
parent af20bc8cb3
commit e647124f0f
3 changed files with 18 additions and 1 deletions

View File

@ -47,6 +47,8 @@
{{ blocks('ad-item-content-block-area') }}
{% endif %}
{{ addBlock('ad-detail/widget', {'price': adv.price, 'id': adv.id})|raw }}
</div>
</section>

View File

@ -207,6 +207,11 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
'as' => 'ajax::getAds',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@getMyAds'
],
'ajax/loanApplication' => [
'as' => 'ajax::loanApplication',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@sendLoanApplication'
],
];
/**

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\AdvsModule\Http\Controller;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\UsersModule\User\UserModel;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Illuminate\Http\Request;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
@ -9,14 +10,17 @@ use Visiosoft\LocationModule\District\DistrictModel;
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
use Visiosoft\LocationModule\Village\VillageModel;
use Visiosoft\CatsModule\Category\CategoryModel;
use Visiosoft\NotificationsModule\Notify\Notification\SendLoanApplicationMail;
class AjaxController extends PublicController
{
private $adv_model;
private $userModel;
public function __construct(AdvModel $advModel)
public function __construct(AdvModel $advModel, UserModel $userModel)
{
$this->adv_model = $advModel;
$this->userModel = $userModel;
parent::__construct();
}
@ -88,4 +92,10 @@ class AjaxController extends PublicController
return response()->json(['success' => true, 'content' => $my_advs, 'title' => $page_title]);
}
public function sendLoanApplication(Request $request)
{
$this->userModel->find(1)->notify(new SendLoanApplicationMail($request));
return response()->json(['success' => true, 'content' => $request['firstName']]);
}
}