Files
Leantime/app/Domain/Api/Templates/newAPIKey.blade.php

148 lines
5.6 KiB
PHP

@extends($layout)
@section('content')
@php
$apiKeyValues = $apiKeyValues ?? false;
@endphp
<div style="min-width:700px;">
<h4 class="widgettitle title-light"><i class="fa fa-key"></i> {!! __('headlines.new_api_key') !!}</h4>
{!! $tpl->displayNotification() !!}
@if ($apiKeyValues !== false && isset($apiKeyValues['id']))
<p>Your API Key was successfully created. Please copy the key below. This is your only chance to copy it.</p>
<x-global::forms.text-input id="apiKey" value="lt_{{ $apiKeyValues['user'] }}_{{ $apiKeyValues['passwordClean'] }}" style="width:100%;" />
<x-global::forms.button contentRole="primary" onclick="leantime.snippets.copyUrl('apiKey');">{!! __('links.copy_key') !!}</x-global::forms.button>
@else
<form action="{{ BASE_URL }}/api/newApiKey" method="post" class="stdform formModal" >
<input type="hidden" name="save" value="1" />
<div class="row" >
<div class="col-md-6">
<h4 class="widgettitle title-light">{!! __('label.basic_information') !!}</h4>
<label for="firstname">{!! __('label.key_name') !!}</label><div class="clearfix"></div>
<x-global::forms.text-input
name="firstname" id="firstname"
value="" /><br />
<label for="role">{!! __('label.role') !!}</label><div class="clearfix"></div>
<select name="role" id="role">
@foreach ($roles as $key => $role)
<option value="{{ $key }}"
@if ($key == $values['role'])
selected="selected"
@endif
>
{!! __('label.roles.' . $role) !!}
</option>
@endforeach
</select> <br />
<label for="status">{!! __('label.status') !!}</label><div class="clearfix"></div>
<select name="status" id="status">
<option value="a"
@if (strtolower($values['status']) == 'a')
selected="selected"
@endif
>
{!! __('label.active') !!}
</option>
<option value=""
@if (strtolower($values['status']) == '')
selected="selected"
@endif
>
{!! __('label.deactivated') !!}
</option>
</select>
<div class="clearfix"></div>
<p class="stdformbutton">
<x-global::forms.button tag="input" inputType="submit" contentRole="primary" :labelText="__('buttons.save')" name="save" id="save" />
</p>
</div>
<div class="col-md-6">
<h4 class="widgettitle title-light">{!! __('label.project_access') !!}</h4>
<div class="scrollableItemList">
@php
$currentClient = '';
$i = 0;
$containerOpen = false;
@endphp
@foreach ($allProjects as $row)
@if ($currentClient != $row['clientName'])
@if ($i > 0 && $containerOpen)
</div>
@php $containerOpen = false; @endphp
@endif
<h3 id="accordion_link_{{ $i }}">
<a href="#" onclick="accordionToggle({{ $i }});" id="accordion_toggle_{{ $i }}"><i class="fa fa-angle-down"></i> {{ $tpl->escape($row['clientName']) }}</a>
</h3>
<div id="accordion_{{ $i }}" class="simpleAccordionContainer">
@php
$currentClient = $row['clientName'];
$containerOpen = true;
@endphp
@endif
<div class="item">
<input type="checkbox" name="projects[]" id="project_{{ $row['id'] }}" value="{{ $row['id'] }}"
@if (is_array($relations) === true && in_array($row['id'], $relations) === true)
checked="checked"
@endif
/><label for="project_{{ $row['id'] }}">{{ $tpl->escape($row['name']) }}</label>
<div class="clearall"></div>
</div>
@php $i++; @endphp
@endforeach
@if ($containerOpen)
</div>
@endif
</div>
</div>
</div>
@endif
</form>
</div>
@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