address edit modal

This commit is contained in:
vedatakd 2020-02-24 13:56:26 +03:00
parent 998b682ee0
commit f143ea045b
5 changed files with 51 additions and 0 deletions

View File

@ -68,6 +68,7 @@ $(document).on('change', 'select[name="'+neighborhoodSelectName+'"]', function()
function Locations(cat, level, name){
$.ajax({
type: "GET",
async: false,
data: "cat=" + cat + "&level=" + level,
url: "/class/ajax",
success: function(msg){

View File

@ -25,4 +25,5 @@ return [
'error_valid_email_or_phone' => 'Phone number or E-mail address format is not correct.',
'error_valid_phone' => 'Phone number format is not correct.',
'registered_phone' => 'This phone number has already been registered.',
'ajax_address_error' => 'No address or not authorized to view.',
];

View File

@ -25,4 +25,5 @@ return [
'error_valid_email_or_phone' => 'E-Posta Adresi veya Telefon numarası formatı geçersiz.',
'error_valid_phone' => 'Telefon numarası biçimi doğru değil.',
'registered_phone' => 'Bu telefon numarası ile daha önceden sisteme kayıt olunmuştur.',
'ajax_address_error' => 'Adres yok veya görüntüleme yetkiniz bulunmamaktadır.',
];

View File

@ -252,6 +252,46 @@ class MyProfileController extends PublicController
return $message;
}
public function adressAjaxUpdate(AdressFormBuilder $form, $id)
{
$address = $this->adressRepository->find($id);
if (isset($id) and $address != null and $address->user_id == Auth::id()) {
$message = [];
$error = $form->build()->validate()->getFormErrors()->getMessages();
if (!empty($error)) {
$message['status'] = "error";
$message['msg'] = trans('visiosoft.module.profile::message.required_all');
return $message;
}
$new_adress = $this->request->all();
unset($new_adress['_token']);
$address->update($new_adress);
$message['status'] = "updated";
$message['data'] = $address;
return $message;
}
$message['status'] = "error";
$message['msg'] = trans('visiosoft.module.profile::message.ajax_address_error');
return $message;
}
public function adressAjaxDetail()
{
$address = $this->adressRepository->find($this->request->id);
if (isset($this->request->id) and $address != null and $address->user_id == Auth::id()) {
$message['status'] = "success";
$message['data'] = $address;
return $message;
}
$message['status'] = "error";
$message['msg'] = trans('visiosoft.module.profile::message.ajax_address_error');
return $message;
}
public function showMessage($id)
{
$message = new MessageModel();

View File

@ -82,6 +82,14 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
'as' => 'visiosoft.module.profile::adress_ajax_create',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxCreate'
],
'profile/adress/ajaxUpdate/{id}' => [
'as' => 'visiosoft.module.profile::adress_ajax_update',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxUpdate'
],
'profile/adress/ajaxDetail' => [
'as' => 'visiosoft.module.profile::adress_ajax_detail',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxDetail'
],
'profile/adress/edit/{id}' => [
'as' => 'visiosoft.module.profile::address_edit',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressEdit'