Lieferland UST CH, Reverse Charge
This commit is contained in:
parent
351a8f763c
commit
d46824a4ac
19 changed files with 455 additions and 41 deletions
|
|
@ -63,7 +63,12 @@ class AdminUserController extends Controller
|
|||
{
|
||||
$data = Request::all();
|
||||
$user = User::findOrFail($data['id']);
|
||||
|
||||
|
||||
if(isset($data['user-delete'])){
|
||||
if(isset($data['realy_delete_user'])){
|
||||
return redirect(route('admin_user_delete', [$user->id]));
|
||||
}
|
||||
}
|
||||
if(isset($data['save-admin'])){
|
||||
$user->admin = $data['admin'];
|
||||
SysLog::action('save-admin', 'admin_user', 3)
|
||||
|
|
|
|||
|
|
@ -52,10 +52,12 @@ class CountryController extends Controller
|
|||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['switch'] = isset($data['switch']) ? true : false;
|
||||
$data['eu_country'] = isset($data['eu_country']) ? true : false;
|
||||
$data['own_eur'] = isset($data['own_eur']) ? true : false;
|
||||
$data['currency'] = isset($data['currency']) ? true : false;
|
||||
$data['currency_faktor'] = $data['currency_faktor'] == "" ? null : reFormatNumber($data['currency_faktor']);
|
||||
|
||||
|
||||
if(!isset($data['attr'])){
|
||||
$data['attr'] = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,12 @@ class DataTableController extends Controller
|
|||
return $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$user->getPaymentMethodsShort().'</span></a>';
|
||||
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<span class="no-line-break"><a href="' . route('admin_user_delete', [$user->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>
|
||||
<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a></span>';
|
||||
->addColumn('action_login', function (User $user) {
|
||||
return '<a href="' . route('admin_user_login_as', [$user->id]) . '" class="btn icon-btn btn-sm btn-warning" onclick="return confirm(\''.__('Login as User?').'\');"><span class="fa fa-sign-in-alt"></span></a>';
|
||||
})
|
||||
->addColumn('action_delete', function (User $user) {
|
||||
return '<a class="btn icon-btn btn-sm btn-danger" href="#" data-toggle="modal" data-target="#modals-user-delete" data-id="'.$user->id.'" data-email="'.$user->email.'"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->addColumn('test_mode', function (User $user) {
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-test_mode" data-id="'.$user->id.'" data-email="'.$user->email.'" data-test_mode="'.$user->test_mode.'">';
|
||||
return $user->test_mode ? $link.'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span></a>' : $link.'<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span></a>';
|
||||
|
|
@ -94,7 +96,7 @@ class DataTableController extends Controller
|
|||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('shop', 'shop $1')
|
||||
->orderColumn('admin', 'active $1')
|
||||
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_delete'])
|
||||
->rawColumns(['id', 'admin', 'confirmed', 'active', 'account', 'shop', 'my_payment_methods', 'test_mode', 'action_login', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Models\UserAccount;
|
||||
use App\Repositories\UserRepository;
|
||||
|
||||
|
||||
class UserDataController extends Controller
|
||||
|
|
@ -45,6 +46,44 @@ class UserDataController extends Controller
|
|||
$user->account = new UserAccount();
|
||||
}*/
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['reverse_charge_validate'])){
|
||||
|
||||
$rules = array(
|
||||
'tax_identification_number' => 'required',
|
||||
'reverse_charge' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
}
|
||||
$ret = $this->userRepo->reverse_charge_activate(Request::all(), $user);
|
||||
if($ret === 'error'){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('tax_identification_number', __('Die UST-ID konnte nicht validiert werden, Eingabe bitte prüfen.'));
|
||||
$data['reverse_charge'] = 0;
|
||||
return redirect(route('user_edit'))->withErrors($validator)->withInput($data);
|
||||
}
|
||||
if($ret === 'valid'){
|
||||
\Session()->flash('alert-success', 'UST-ID erfolgreich eingetragen.');
|
||||
return redirect('/user/edit');
|
||||
|
||||
}
|
||||
}
|
||||
if(isset($data['reverse_charge_delete'])){
|
||||
$user->account->tax_identification_number = '';
|
||||
$user->account->reverse_charge = 0;
|
||||
$user->account->reverse_charge_valid = null;
|
||||
$user->account->save();
|
||||
\Session()->flash('alert-success', 'Reverse Charge Verfahren und UST-ID gelöscht.');
|
||||
return redirect('/user/edit');
|
||||
|
||||
}
|
||||
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
|
|
@ -72,7 +111,6 @@ class UserDataController extends Controller
|
|||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue