@extends('layouts.main') @section('title', $mode === 'edit' ? 'Update Employee' : 'Add Employee') @section('navbarTitle', $mode === 'edit' ? 'Update Employee' : 'Add Employee') @section('content') @php $isEdit = $mode === 'edit'; $formatDate = static function (mixed $value): string { if (blank($value)) { return ''; } return \Illuminate\Support\Carbon::parse($value)->format('d/m/Y'); }; @endphp @include('layouts.breadcrumb', [ 'title' => $isEdit ? 'Update Employee' : 'Add Employee', 'current' => 'Employee Data', 'homeRoute' => 'dashboard', ])
@csrf @if ($isEdit) @method('PUT') @endif

{{ $isEdit ? 'Update Employee' : 'Add Employee' }}

Complete the user, profile, identity, deployment, and PIC data.

user?->is_active ?? true))>
@if ($isEdit)
is_event_project_admin ?? false))>
@endif
is_core_staff ?? false))>
@if ($errors->any()) @include('partials.swal-alert', [ 'type' => 'error', 'title' => 'The data is not valid.', 'message' => 'Please check the required fields again.', ]) @endif @if (! $isEdit) @endif
@error('name')
{{ $message }}
@enderror
@error('email')
{{ $message }}
@enderror
@error('username')
{{ $message }}
@enderror
@error('current_office_location_id')
{{ $message }}
@enderror
@php $selectedPrimaryPositionId = (string) old('current_position_id', $employee?->deployment?->current_position_id ?? ''); $selectedPositionIds = collect(old('current_position_ids', $employee?->deployment?->positions?->pluck('id')->all() ?? [])) ->when($selectedPrimaryPositionId !== '', fn ($collection) => $collection->prepend($selectedPrimaryPositionId)) ->map(fn ($positionId) => (string) $positionId) ->unique() ->values(); @endphp @error('current_position_id')
{{ $message }}
@enderror @error('current_position_ids')
{{ $message }}
@enderror @error('current_position_ids.*')
{{ $message }}
@enderror @error('current_position_order')
{{ $message }}
@enderror @error('current_position_order.*')
{{ $message }}
@enderror
@endsection @section('script') @php $dashboardJsPath = public_path('assets/js/dashboard.js'); $dashboardJsVersion = file_exists($dashboardJsPath) ? filemtime($dashboardJsPath) : time(); @endphp @endsection