@extends('layouts.app') @section('title', ($req ? '安裝申請草稿 #' . $req->id : '新增安裝申請') . ' - ' . $project->name) @php $me = auth()->user(); $oldPm = (int) old('pm_id', $pms->first()->id ?? 0); // 編輯草稿時以草稿內容預填;驗證失敗返回時以 old() 為準 $pk = collect($req?->packages ?? []); $std = $pk->where('key', '!=', 'other'); $savedExt = $req?->php_extensions ?? []; $oldPkg = old('pkg', $std->pluck('key')->all()); $oldVer = old('ver', $std->pluck('version', 'key')->all()); $oldExt = old('php_ext', array_values(array_intersect($savedExt, $phpExtensions))); $oldExtOther = old('php_ext_other', implode(', ', array_diff($savedExt, $phpExtensions))); $oldOther = array_values(array_filter(old('other', $pk->where('key', 'other')->values()->all()), fn ($o) => trim($o['name'] ?? '') !== '')) ?: [['name' => '', 'version' => '']]; $oldCollab = array_map('intval', old('collaborators', $req ? $req->collaborators->pluck('id')->all() : [])); $isCollab = $req && !$isOwner; $unconfirmed = $req ? $req->collaborators->whereNull('pivot.confirmed_at')->pluck('name')->all() : []; $verHints = [ 'apache' => ['2.4'], 'php' => ['8.4', '8.3', '8.2', '8.1', '7.4'], 'mysql' => ['8.4', '8.0', '5.7'], 'node' => ['22 LTS', '20 LTS', '18 LTS'], 'java' => ['21', '17', '11', '8'], 'python' => ['3.12', '3.11', '3.10'], ]; @endphp @push('styles') @endpush @section('content') @include('projects._nav')
@if($req) 安裝申請草稿 #{{ $req->id }} 共同填寫中 @else 新增安裝申請 @endif
返回列表
@if($errors->any())
@endif
@csrf @if($req) @method('PUT') @if(old('force'))@endif @endif {{-- 共同填寫:發起人可邀請本專案其他成員一起填,最後由發起人送出 --}}
共同填寫 發起人:{{ $applicant->name }} @if($req?->lastEditor) 最後編輯:{{ $req->lastEditor->name }}・{{ $req->updated_at->format('m/d H:i') }} @endif
@if($req && $req->collaborators->isNotEmpty())
@foreach($req->collaborators as $c) {{ $c->name }} {{ $c->pivot->confirmed_at ? '已完成' : ($c->pivot->last_edited_at ? '填寫中' : '尚未填寫') }} @endforeach
@endif @if($isOwner)
勾選要一起填寫的專案成員,按「儲存草稿」後會寄信邀請;大家填好後由您送出。不需要協作可直接送出。
@if($candidates->isEmpty())
本專案沒有其他成員可邀請。
@else
@foreach($candidates as $c) @endforeach
@endif @else
{{ $applicant->name }} 邀請您一起填寫此申請。填好後請按「儲存並標記我已完成」,最後由發起人送出。
@endif
{{-- 審核流程:主管申請 → 系統組主管;PM 申請 → 單位主管;工程師申請 → 單位主管 → PM → PM 主管(重複的人只審一次) --}}
審核流程: @if($pms->count() > 1) @elseif($pms->count() === 1) @endif
@foreach($chains as $pmId => $chain)
1 && $pmId !== $oldPm) hidden @endif> {{ $isOwner ? '您(申請人)' : $applicant->name . '(申請人)' }} @foreach($chain as $st) {{ $st['label'] }}:{{ $st['name'] }} @endforeach 系統組安裝 寄信通知申請人
@endforeach @if(\App\Models\InstallRequest::isSupervisorUser($applicant))
申請人是主管,由系統組主管核准後即送系統組安裝。
@elseif($isPm)
申請人是本專案 PM,由單位主管核准後即送系統組。
@elseif($pms->isEmpty())
本專案尚未設定「PM人員」角色成員,僅需單位主管核准。
@endif
{{-- 主機資訊 --}}
主機資訊
{{-- 基本安裝 --}}
基本安裝 勾選需要的項目並填寫版本
@foreach($basePackages as $key => $name) @php $checked = in_array($key, $oldPkg, true); @endphp
@isset($verHints[$key]) @foreach($verHints[$key] as $v) @endisset
@if($key === 'php')
PHP 擴充功能
@foreach($phpExtensions as $ext)
@endforeach
@endif @endforeach
{{-- 額外安裝 --}}
額外安裝 版本可留空(由系統組安裝穩定版)
@foreach($extraPackages as $key => $name) @php $checked = in_array($key, $oldPkg, true); @endphp
@isset($verHints[$key]) @foreach($verHints[$key] as $v) @endisset
@endforeach
其他軟體
@foreach($oldOther as $i => $o)
@endforeach
{{-- 安裝方法 / 原因 --}}
安裝方法與說明
@if($req && $isOwner) @endif {{ $req ? '返回' : '取消' }} @if($isCollab) @else @endif
@if($req && $isOwner)
@csrf @method('DELETE')
@endif
@endsection @push('scripts') @endpush