freescout2ant/Resources/views/settings.blade.php
Claude 6eb4e8dfc2
Add API selection between MitarbeiterWebservice and Customer Archives/Stocks
Introduces an "Archive API" setting that switches both reads and writes
between the legacy MitarbeiterWebservice API and the new Customer Archives
(write) + Stocks (read) APIs.

- New write strategy (ArchiveWriterInterface + factory): legacy header-based
  writer and a Customer Archives JSON writer (CreateArchiveRequestDto, files as
  base64 data URIs, one entry per attachment), backed by CustomerArchivesApiClient.
- New read strategy (CrmReadClientInterface + factory): legacy delegate and a
  StocksReadClient that normalizes Stocks responses (customers/names,
  communications, contracts, contract lines/states) to the legacy shape so the
  controller/frontend stay unchanged.
- Hybrid: customer lookup by e-mail stays on MitarbeiterWebservice because the
  Stocks API cannot search by e-mail.
- Settings: ameise_api + ameise_archive_is_public dropdowns, env-backed base
  URLs for both new APIs (test/live), German translations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KfJdbw4dRvJdcihTkKt69T
2026-06-25 13:23:16 +00:00

72 lines
3.5 KiB
PHP

@php
$ameiseApi = old('settings[ameise_api]', $settings['ameise_api'] ?? 'mitarbeiterwebservice');
$ameiseIsPublic = filter_var($settings['ameise_archive_is_public'] ?? false, FILTER_VALIDATE_BOOLEAN);
@endphp
<form class="form-horizontal margin-top margin-bottom" method="POST" action="" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('Archive API') }}</label>
<div class="col-sm-6">
<select class="form-control" name="settings[ameise_api]">
<option value="mitarbeiterwebservice" {{ $ameiseApi == 'mitarbeiterwebservice' ? 'selected' : '' }}>{{ __('MitarbeiterWebservice') }}</option>
<option value="customer_archives" {{ $ameiseApi == 'customer_archives' ? 'selected' : '' }}>{{ __('Customer Archives') }}</option>
</select>
<p class="help-block">{{ __('Choose which Ameise API is used for reading customers/contracts and writing archive entries.') }}</p>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('Public archive entries') }}</label>
<div class="col-sm-6">
<select class="form-control" name="settings[ameise_archive_is_public]">
<option value="false" {{ !$ameiseIsPublic ? 'selected' : '' }}>{{ __('No') }}</option>
<option value="true" {{ $ameiseIsPublic ? 'selected' : '' }}>{{ __('Yes') }}</option>
</select>
<p class="help-block">{{ __('Whether archive entries created via the Customer Archives API are visible to the customer (isPublic).') }}</p>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('API Mode') }}</label>
<div class="col-sm-6">
<select class="form-control" name="settings[ameise_mode]">
<option value="test" {{ old('settings[ameise_mode]', $settings['ameise_mode']) == 'test' ? 'selected' : '' }}>{{ __('Test') }}</option>
<option value="live" {{ old('settings[ameise_mode]', $settings['ameise_mode']) == 'live' ? 'selected' : '' }}>{{ __('Live') }}</option>
</select>
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('Client ID') }}</label>
<div class="col-sm-6">
<input class="form-control" name="settings[ameise_client_id]" type="text" value="{{ old('settings[ameise_client_id]', $settings['ameise_client_id'])}}">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('Client Secret') }}</label>
<div class="col-sm-6">
<input class="form-control" name="settings[ameise_client_secret]" type="text" value="{{ old('settings[ameise_client_secret]', $settings['ameise_client_secret'])}}">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">{{ __('Redirect URL') }}</label>
<div class="col-sm-6">
<input class="form-control" name="settings[ameise_redirect_uri]" type="text" value="{{ old('settings[ameise_redirect_uri]', $settings['ameise_redirect_uri'])}}" readonly>
</div>
</div>
<div class="form-group margin-top margin-bottom">
<div class="col-sm-6 col-sm-offset-2">
<button type="submit" class="btn btn-primary">
{{ __('Save') }}
</button>
</div>
</div>
</form>