@extends('layouts.adminlte.adminlte')
@section('title')
{{auth()->user()->id == $user->id ? 'Configure profile' : ('Edit user (ID: ' . $user->id . ')')}}
@endsection
@section('content_header')
@parent
@if (auth()->user()->id == $user->id)
Configure profile
@if (auth()->user()->user_type == 'agent')
(ID {{auth()->user()->id}})
@endif
@else
{{'Edit user (ID: ' . $user->id . ')'}}
@endif
@endsection
@section('modals')
@if (in_array($user->user_type, ['manager', 'seller', 'agent']))
spreadsheet['id']}}" target="_blank">
@endif
{!! Form::open(['action' => ['App\Http\Controllers\CustomUsersController@update', $user->id], 'method' => 'POST']) !!}
{{Form::label('name', 'Name *')}}
{{Form::text('name', $user->name, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Name'])}}
@if (auth()->user()->user_type == 'admin')
@endif
{{Form::label('user_type', 'User type *')}}
@if ($user->user_type == 'seller' || $user->user_type == 'manager')
{{Form::label('wechat', 'Wechat')}}
{{Form::text('wechat', $user->wechat, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Wechat'])}}
@endif
{{Form::label('manager_notifs', 'Order bot notifications as manager')}}
{{Form::checkbox('manager_notifs', '1', (bool) $user->manager_notifs, ['class' => 'form-checkbox'])}}
{{Form::label('perc_refund_feedback', '% Refund Feedback')}}
{{Form::text('perc_refund_feedback', $user->perc_refund_feedback, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Feedback'])}}
{{Form::label('perc_refund_rating', '% Refund Rating')}}
{{Form::text('perc_refund_rating', $user->perc_refund_rating, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Rating'])}}
{{Form::label('perc_refund_purchase_only', '% Refund Purchase Only')}}
{{Form::text('perc_refund_purchase_only', $user->perc_refund_purchase_only, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Purchase Only'])}}
{{Form::label('feedback', 'Feedback')}}
@if(auth()->user()->user_type == "admin" && $user->user_type == "agent")
{{Form::label('payment_agent_comm', 'Payment Agent Commission')}}
{{Form::text('payment_agent_comm', $agent_comm, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Payment Agent Commission'])}}
@endif
{{Form::label('feedback_agent_comm', 'Feedback Agent Commission')}}
{{Form::text('feedback_agent_comm', $user->feedback_agent_comm, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Feedback Agent Commission'])}}
{{Form::label('feedback_total_comm', 'Feedback Total Commission')}}
{{Form::text('feedback_total_comm', $user->feedback_total_comm, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Feedback Total Commission'])}}
@if (auth()->user()->user_type == 'admin')
{{Form::label('agent_paypal', 'Agent Paypal e-mail')}}
{{Form::email('agent_paypal', '', ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Agent Paypal e-mail'])}}
@endif
{{Form::label('banned', 'Banned')}}
{{Form::checkbox('banned', '1', $user->banned ? true : false, ['class' => 'form-checkbox'])}}
@if (in_array($user->user_type, ['seller', 'agent']))
{{Form::label('chat_banned', 'Chat Banned')}}
{{Form::checkbox('chat_banned', '1', $user->chat_banned ? true : false, ['class' => 'form-checkbox'])}}
@if($user->chat_banned && $user->chat_banned_by_user_id)
(Banned by user ID: {{ $user->chat_banned_by_user_id }})
@endif
@endif
{{Form::label('email', 'E-mail * ')}}
{{Form::email('email', $user->email, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'E-mail'])}}
{{Form::label('paypal_email', 'Paypal e-mail')}}
{{Form::email('paypal_email', $user->paypal_email, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Paypal e-mail'])}}
@if ((auth()->user()->user_type == 'admin' || auth()->user()->user_type == 'manager') && $user->user_type == 'seller')
@endif
@if (auth()->user()->user_type == "admin")
@php $cannot = $user->cannot ? json_decode($user->cannot) : []; @endphp
@endif
{{Form::hidden('_method', 'PUT')}}
{{Form::submit('Edit user', ['class' => 'btn btn-primary'])}}
{!! Form::close() !!}
@else

@if (in_array(auth()->user()->user_type, ['manager', 'seller', 'agent']))
user()->spreadsheet['id']}}" target="_blank">
EDIT
@endif
@if(auth()->user()->user_type == 'agent')
@php
$catalog_link = "/catalog?x=" . auth()->user()->id . (isset($site) && $site ? "&site={$site->db_name}" : "");
@endphp
@endif
{!! Form::open(['action' => ['App\Http\Controllers\CustomUsersController@update', $user->id], 'method' => 'POST']) !!}
@if (auth()->user()->user_type == 'seller')
{{Form::label('perc_refund_feedback', '% Refund Feedback')}}
{{Form::text('perc_refund_feedback', $user->perc_refund_feedback, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Feedback'])}}
{{Form::label('perc_refund_rating', '% Refund Rating')}}
{{Form::text('perc_refund_rating', $user->perc_refund_rating, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Rating'])}}
{{Form::label('perc_refund_purchase_only', '% Refund Purchase Only')}}
{{Form::text('perc_refund_purchase_only', $user->perc_refund_purchase_only, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => '% Refund Purchase Only'])}}
@endif
@if (auth()->user()->user_type == 'manager')
{{Form::label('manager_notifs', 'Order bot notifications as manager')}}
{{Form::checkbox('manager_notifs', '1', (bool) $user->manager_notifs, ['class' => 'form-checkbox'])}}
@endif
{{Form::label('telegram_username', 'Telegram username')}}
{{Form::label('email', 'E-mail *')}}
{{Form::email('email', $user->email, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'E-mail', auth()->user()->user_type == 'admin' ? '' : 'readonly'])}}
{{Form::label('password', 'Password')}}
{{Form::password('password', ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'New Password'])}}
{{Form::label('confirm_password', 'Confirm password')}}
{{Form::password('confirm_password', ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Confirm Password'])}}
@if (in_array($user->user_type, ['manager', 'agent']))
{{Form::label('paypal_email', 'Paypal E-mail')}}
{{Form::email('paypal_email', $user->paypal_email, ['class' => 'col-md-4 form-control form-textbox', 'placeholder' => 'Paypal E-mail'])}}
@endif
{{Form::hidden('_method', 'PUT')}}
{{Form::submit(auth()->user()->id != $user->id ? 'Edit user' : 'Update profile', ['class' => 'btn btn-primary'])}}
{!! Form::close() !!}
@endif
@endsection
@section('js')
@parent
@if (auth()->user()->id != $user->id)