Files
Leantime/app/Domain/Users/Templates/editUser.blade.php

244 lines
12 KiB
PHP

@extends($layout)
@section('content')
@php
$projects = $relations;
@endphp
{!! $tpl->displayNotification() !!}
<div class="pageheader">
<div class="pageicon"><span class="fa {{ $tpl->getModulePicture() }}"></span></div>
<div class="pagetitle">
<h5>{!! __('label.administration') !!}</h5>
<h1>{!! __('headlines.edit_user') !!}</h1>
</div>
</div><!--pageheader-->
<form action="" method="post" class="stdform userEditModal">
<input type="hidden" name="{{ session('formTokenName') }}" value="{{ session('formTokenValue') }}" />
<div class="maincontent">
<div class="row">
<div class="col-md-7">
<div class="maincontentinner">
<h4 class="widgettitle title-light">{!! __('label.profile_information') !!}</h4>
<label for="firstname">{!! __('label.firstname') !!}</label> <x-global::forms.text-input
name="firstname" id="firstname"
value="{{ $values['firstname'] }}" /><br />
<label for="lastname">{!! __('label.lastname') !!}</label> <x-global::forms.text-input
name="lastname" id="lastname"
value="{{ $values['lastname'] }}" /><br />
<label for="role">{!! __('label.role') !!}</label>
<select name="role" id="role">
@foreach ($roles as $key => $role)
{{-- Privilege ceiling (parity with newUser): a manager may never
assign the admin(40)/owner(50) roles. Editing users is admin+
today, so this is defense-in-depth against any future widening
of who can reach this screen a lower role must never be able
to escalate an account above its own authority. --}}
@if ($login::userHasRole(\Leantime\Domain\Auth\Models\Roles::$manager) && $key > 30)
@continue
@endif
<option value="{{ $key }}"
@if ($key == $values['role']) selected="selected" @endif>
{!! __('label.roles.' . $role) !!}
</option>
@endforeach
</select> <br />
<label for="status">{!! __('label.status') !!}</label>
<select name="status" id="status" class="pull-left">
<option value="a"
@if (strtolower($values['status']) == 'a') selected="selected" @endif>
{!! __('label.active') !!}
</option>
<option value="i"
@if (strtolower($values['status']) == 'i') selected="selected" @endif>
{!! __('label.invited') !!}
</option>
<option value="0"
@if (strtolower($values['status']) === '' || $values['status'] === 0 || $values['status'] === '0') selected="selected" @endif>
{!! __('label.deactivated') !!}
</option>
</select>
@if ($values['status'] == 'i')
<div class="pull-left dropdownWrapper" style="padding-left:5px; line-height: 29px;">
<a class="dropdown-toggle btn btn-default" data-toggle="dropdown" href="{{ BASE_URL }}/auth/userInvite/{{ $values['pwReset'] }}"><i class="fa fa-link"></i> {!! __('label.copyinviteLink') !!}</a>
<div class="dropdown-menu padding-md noClickProp">
<x-global::forms.text-input id="inviteURL" value="{{ BASE_URL }}/auth/userInvite/{{ $values['pwReset'] }}" />
<x-global::forms.button contentRole="primary" onclick="leantime.snippets.copyUrl('inviteURL');">{!! __('links.copy_url') !!}</x-global::forms.button>
</div>
<x-global::forms.button tag="a" link="{{ BASE_URL }}/users/editUser/{{ $values['id'] }}?resendInvite=1" contentRole="default" style="margin-left:5px;"><i class="fa fa-envelope"></i> {!! __('buttons.resend_invite') !!}</x-global::forms.button>
</div>
@endif
<div class="clearfix"></div>
<label for="client">{!! __('label.client') !!}</label>
<select name='client' id="client">
@if ($login::userIsAtLeast('manager'))
<option value="0" selected="selected">{!! __('label.no_clients') !!}</option>
@endif
@foreach ($clients as $clientItem)
<option value="{{ $clientItem['id'] }}" @if ($clientItem['id'] == $values['clientId']) selected="selected" @endif>{{ $clientItem['name'] }}</option>
@endforeach
</select><br/>
<br/>
<h4 class="widgettitle title-light">{!! __('label.contact_information') !!}</h4>
<label for="user">{!! __('label.email') !!}</label> <x-global::forms.text-input
name="user" id="user" value="{{ $values['user'] }}" /><br />
<label for="phone">{!! __('label.phone') !!}</label> <x-global::forms.text-input
name="phone" id="phone"
value="{{ $values['phone'] }}" /><br /><br />
<h4 class="widgettitle title-light">{!! __('label.employee_information') !!}</h4>
<label for="jobTitle">{!! __('label.jobTitle') !!}</label> <x-global::forms.text-input
name="jobTitle" id="jobTitle" value="{{ $values['jobTitle'] }}" /><br />
<label for="jobLevel">{!! __('label.jobLevel') !!}</label> <x-global::forms.text-input
name="jobLevel" id="jobLevel" value="{{ $values['jobLevel'] }}" /><br />
<label for="department">{!! __('label.department') !!}</label> <x-global::forms.text-input
name="department" id="department" value="{{ $values['department'] }}" /><br />
@if ($login::userIsAtLeast(\Leantime\Domain\Auth\Models\Roles::$admin))
{{-- Capacity attributes admin-only. Weekly hours is what
downstream resource-planning surfaces (Resource
Allocation, cross-program warnings, portfolio
rollups) use to answer "how much of this person
is available to plan against?". Employment type
sets the semantic (target vs ceiling vs cap vs
best-effort). Both nullable until an admin
sets them, capacity math treats this user as
unconfigured and skips warnings. --}}
<h4 class="widgettitle title-light">{!! __('label.capacity') !!}</h4>
<label for="weekly_hours">{!! __('label.weekly_hours') !!}</label>
<x-global::forms.text-input
name="weekly_hours"
id="weekly_hours"
type="number"
min="0"
max="168"
:value="$values['weekly_hours'] ?? ''"
placeholder="{{ __('label.weekly_hours_placeholder') }}" /><br />
<span class="hint">{!! __('label.weekly_hours_hint') !!}</span><br /><br />
<label for="employment_type">{!! __('label.employment_type') !!}</label>
<select name="employment_type" id="employment_type">
<option value="">{!! __('label.employment_type.unset') !!}</option>
@foreach (\Leantime\Domain\Users\Enums\EmploymentType::cases() as $type)
<option value="{{ $type->value }}"
@if (($values['employment_type'] ?? '') === $type->value) selected="selected" @endif>
{!! __($type->langKey()) !!}
</option>
@endforeach
</select><br />
<span class="hint">{!! __('label.employment_type_hint') !!}</span><br /><br />
@endif
<p class="stdformbutton">
<x-global::forms.button tag="input" inputType="submit" contentRole="primary" :labelText="__('buttons.save')" name="save" id="save" />
</p>
</div>
</div>
<div class="col-md-5">
<div class="maincontentinner">
<h4 class="widgettitle title-light">{!! __('label.project_assignment') !!}</h4>
<div class="scrollableItemList">
@php
$currentClient = '';
$i = 0;
@endphp
@foreach ($allProjects as $row)
@php
if ($row['clientName'] == null) {
$row['clientName'] = 'Not assigned to client';
}
@endphp
@if ($currentClient != $row['clientName'])
@if ($i > 0)
</div>
@endif
<h3 id='accordion_link_{{ $i }}'>
<a href='#' onclick='accordionToggle({{ $i }});' id='accordion_toggle_{{ $i }}'><i class='fa fa-angle-down'></i> {{ $row['clientName'] }}</a>
</h3>
<div id='accordion_{{ $i }}' class='simpleAccordionContainer'>
@php $currentClient = $row['clientName']; @endphp
@endif
<div class="item" style="padding:10px 0px;">
<input type="checkbox" name="projects[]" id='project_{{ $row['id'] }}' value="{{ $row['id'] }}"
@if (is_array($projects) === true && in_array($row['id'], $projects) === true)
checked='checked'
@endif
/>
<span class="projectAvatar" style="width:30px; float:left; margin-right:10px;">
<img src='{{ BASE_URL }}/api/projects?projectAvatar={{ $row['id'] }}&v={{ format($row['modified'])->timestamp() }}' />
</span>
<label for="project_{{ $row['id'] }}" style="margin-top:-11px">
<small>{{ $row['type'] }}</small><br />
{{ $row['name'] }}</label>
<div class="clearall"></div>
</div>
@php $i++; @endphp
@endforeach
</div>
</div>
</div>
</div>
</div>
</form>
@once
@push('scripts')
<script>
jQuery(".noClickProp.dropdown-menu").on("click", function(e) {
e.stopPropagation();
});
function accordionToggle(id) {
let currentLink = jQuery("#accordion_toggle_"+id).find("i.fa");
if(currentLink.hasClass("fa-angle-right")){
currentLink.removeClass("fa-angle-right");
currentLink.addClass("fa-angle-down");
jQuery('#accordion_'+id).slideDown("fast");
}else{
currentLink.removeClass("fa-angle-down");
currentLink.addClass("fa-angle-right");
jQuery('#accordion_'+id).slideUp("fast");
}
}
</script>
@endpush
@endonce
@endsection