@php
$required = 'required';
@endphp
@if(isset($user) && !empty($user))
{!! Form::open(['url' => action([\App\Http\Controllers\ManageUserController::class, 'update'], [$user->id]), 'method' => 'PUT', 'id' => 'user_edit_form']) !!}
@php
$required = '';
@endphp
@else
{!! Form::open(['url' => action([\App\Http\Controllers\ManageUserController::class, 'store']), 'method' => 'post', 'id' => 'user_add_form' ,'class'=>'needs-validation' ,'novalidate']) !!}
@endif
@php
if(empty($user)){
$user_status = 'active';
}
else if($user->status==='active'){
$user_status = 'active';
}else{
$user_status = 'inactive';
}
@endphp
@include('layouts.partials.messages')
@include('user.edit_profile_form_personal_info_part')
@component('components.widget', ['title' => __('app.roles_and_permissions')])
@if(!isset($user->id))
@endif
{!! Form::label('password', __( 'business.password' ) . ':*') !!}
{!! Form::password('password', ['class' => 'form-control', $required, 'placeholder' => __( 'business.password' ) ]); !!}
{!! Form::label('confirm_password', __( 'business.confirm_password' ) . ':*') !!}
{!! Form::password('confirm_password', ['class' => 'form-control', $required, 'placeholder' => __( 'business.confirm_password' ) ]); !!}
{!! Form::label('role', __( 'user.role' ) . ':*') !!}
@show_tooltip(__('app.admin_role_location_permission_help'))
{!! Form::select('role', $roles, (isset($user->roles)&&!empty($user->roles->first()->id)) ? $user->roles->first()->id : null, ['class' => 'form-control select2', 'style' => 'width: 100%;']); !!}
@lang( 'role.access_locations' )
@show_tooltip(__('tooltip.access_locations_permission'))
{!! Form::checkbox('access_all_locations', 'access_all_locations', true,
['class' => 'filled-in chk-col-primary','id'=>'access_all_locations']); !!}
@show_tooltip(__('tooltip.all_location_permission'))
@foreach($locations as $location)
{!! Form::checkbox('location_permissions[]', 'location.' . $location->id, isset($permitted_locations) && is_array($permitted_locations) && in_array($location->id, $permitted_locations),
[ 'class' => 'filled-in chk-col-primary', 'id'=>'location_id_'.$location->location_id]); !!}
@endforeach
{{ __( 'user.is_user_active' ) }}
{!! Form::checkbox('is_active', $user_status, isset($is_checked_checkbox) ? $is_checked_checkbox : true,
['class' => 'filled-in chk-col-primary status','id'=>'user_status']); !!}
@show_tooltip(__('app.tooltip_enable_user_active'))
@endcomponent
@component('components.widget', ['title' => __('sale.sells')])
{!! Form::label('max_sales_discount_percent', __( 'app.max_sales_discount_percent' ) . ':') !!}
@show_tooltip(__('app.max_sales_discount_percent_help'))
{!! Form::text('max_sales_discount_percent', !is_null($user->max_sales_discount_percent) ? @num_format($user->max_sales_discount_percent) : null, ['class' => 'form-control input_number', 'placeholder' => __( 'app.max_sales_discount_percent' ),
'min' => 0,
'max' => 100,
'step' => 'any', // Optional: Allow decimals
'required' => false ]); !!}
@endcomponent
@include('user.edit_profile_form_more_info_part')
@if(!empty($form_partials))
@foreach($form_partials as $partial)
{!! $partial !!}
@endforeach
@endif
{!! Form::close() !!}
@section('javascript')
@endsection