{{-- PERSONEL KÜNYESİ — özlük dosyasının tamamı tek defter kartında. Tasarım müşteri künyesiyle (agency/customers/partials/qv-profile) birebir aynıdır: her alan tek satır — solda küçük etiket, sağda değer, en sağda hover'da beliren kopyala/düzenle. Düzenleme yerinde açılır, satır yüksekliği değişmez. Boş alanlar VARSAYILAN OLARAK GÖRÜNÜR (soluk ipucu ile), böylece hangi özlük bilgisinin eksik olduğu ilk bakışta anlaşılır; başlıktaki "boş alan" düğmesi onları gizler. Beklenen: $staff, $managers Kaydetme: PATCH agency.staff-management.staff.update-field {field, value} --}} @php $uf = route('agency.staff-management.staff.update-field', $staff); /** Seçim listesi: model haritasını ledger'ın beklediği biçime çevirir. */ $opts = function (array $map, bool $blank = true) { $out = $blank ? [['value' => '', 'label' => '—']] : []; foreach ($map as $v => $l) { $out[] = ['value' => (string) $v, 'label' => $l]; } return $out; }; $genderOpts = $opts(\App\Models\Agency\AgencyStaff::genders()); $maritalOpts = $opts(\App\Models\Agency\AgencyStaff::maritalStatuses()); $bloodOpts = $opts(\App\Models\Agency\AgencyStaff::bloodTypes()); $employmentOpts = $opts(\App\Models\Agency\AgencyStaff::employmentTypes()); $workModeOpts = $opts(\App\Models\Agency\AgencyStaff::workModes()); $educationOpts = $opts(\App\Models\Agency\AgencyStaff::educationLevels()); $militaryOpts = $opts(\App\Models\Agency\AgencyStaff::militaryStatuses()); $activeOpts = [['value' => '1', 'label' => 'Aktif'], ['value' => '0', 'label' => 'Pasif']]; $currencyOpts = [ ['value' => 'TRY', 'label' => '₺ TRY'], ['value' => 'USD', 'label' => '$ USD'], ['value' => 'EUR', 'label' => '€ EUR'], ['value' => 'GBP', 'label' => '£ GBP'], ]; // Yönetici seçici: aynı acentedeki diğer personeller $managerOpts = [['value' => '', 'label' => '—']]; foreach (($managers ?? collect()) as $m) { $managerOpts[] = [ 'value' => (string) $m->id, 'label' => trim($m->first_name . ' ' . $m->last_name) . ($m->position ? ' · ' . $m->position : ''), ]; } /** * Tek satır tanımı — müşteri künyesiyle aynı sözleşme. * $field null ise satır salt okunur (yalnızca kopyalanır). * $value düzenlemede kullanılan ham değer, $text ekranda görünen metin. */ $row = function (string $label, ?string $field, $value, ?string $text = null, array $o = []) { return [ 'label' => $label, 'field' => $field, 'type' => $o['type'] ?? 'text', 'value' => $value === null ? '' : (string) $value, 'text' => $text === null ? ($value === null ? '' : (string) $value) : $text, 'options' => $o['options'] ?? null, // lookup satırlarında seçenekler gömülmez, liste anahtarı taşınır 'lookup' => $o['lookup'] ?? null, 'mono' => $o['mono'] ?? false, 'ph' => $o['ph'] ?? null, 'suffix' => $o['suffix'] ?? null, 'dec' => $o['dec'] ?? null, ]; }; $dmy = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('d.m.Y') : ''; $iso = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('Y-m-d') : ''; $sections = []; // ── Kimlik ── $sections[] = [ 'title' => 'Kimlik', 'icon' => 'fa-id-badge', 'rows' => [ $row('Ad', 'first_name', $staff->first_name), $row('Soyad', 'last_name', $staff->last_name), $row('Ad Soyad', null, $staff->full_name), $row('T.C. Kimlik No', 'national_id', $staff->national_id, null, ['mono' => true, 'ph' => '11 hane']), $row('Doğum Tarihi', 'birth_date', $iso($staff->birth_date), $dmy($staff->birth_date), ['type' => 'date', 'mono' => true]), $row('Doğum Yeri', 'birth_place', $staff->birth_place, null, ['ph' => 'Şehir / ilçe']), $row('Cinsiyet', 'gender', $staff->gender, $staff->gender_label, ['type' => 'select', 'options' => $genderOpts]), $row('Medeni Durum', 'marital_status', $staff->marital_status, $staff->marital_status_label, ['type' => 'select', 'options' => $maritalOpts]), $row('Çocuk Sayısı', 'children_count', $staff->children_count, $staff->children_count !== null ? (string) $staff->children_count : '', ['type' => 'number', 'mono' => true, 'dec' => 0]), $row('Kan Grubu', 'blood_type', $staff->blood_type, \App\Models\Agency\AgencyStaff::bloodTypes()[$staff->blood_type] ?? '', ['type' => 'select', 'options' => $bloodOpts]), $row('Uyruk', 'nationality', $staff->nationality, \App\Models\Definition\Country::nameByCode($staff->nationality), ['type' => 'lookup', 'lookup' => 'countries', 'ph' => 'Ülke arayın']), ], ]; // ── İstihdam ── $sections[] = [ 'title' => 'İstihdam', 'icon' => 'fa-briefcase', 'rows' => [ $row('Sicil No', 'employee_no', $staff->employee_no, null, ['mono' => true, 'ph' => 'Personel sicil numarası']), $row('Pozisyon / Unvan', 'position', $staff->position, null, ['ph' => 'Ör. Operasyon Uzmanı']), $row('Departman', 'department', $staff->department, null, ['ph' => 'Ör. Satış, Operasyon']), $row('Çalışma Şekli', 'employment_type', $staff->employment_type, $staff->employment_type_label, ['type' => 'select', 'options' => $employmentOpts]), $row('Çalışma Düzeni', 'work_mode', $staff->work_mode, $staff->work_mode_label, ['type' => 'select', 'options' => $workModeOpts]), $row('Bağlı Olduğu Yönetici', 'manager_id', $staff->manager_id, $staff->manager?->full_name ?? '', ['type' => 'select', 'options' => $managerOpts]), $row('İşe Giriş Tarihi', 'hired_at', $iso($staff->hired_at), $dmy($staff->hired_at), ['type' => 'date', 'mono' => true]), $row('Deneme Süresi Bitişi', 'probation_end_at', $iso($staff->probation_end_at), $dmy($staff->probation_end_at), ['type' => 'date', 'mono' => true]), $row('Sözleşme Bitişi', 'contract_end_at', $iso($staff->contract_end_at), $dmy($staff->contract_end_at), ['type' => 'date', 'mono' => true]), $row('İşten Çıkış Tarihi', 'left_at', $iso($staff->left_at), $dmy($staff->left_at), ['type' => 'date', 'mono' => true]), $row('Çıkış Nedeni', 'termination_reason', $staff->termination_reason, null, ['ph' => 'Ör. istifa, sözleşme bitimi']), $row('Yıllık İzin Hakkı', 'annual_leave_days', $staff->annual_leave_days, $staff->annual_leave_days !== null ? (string) $staff->annual_leave_days : '', ['type' => 'number', 'mono' => true, 'dec' => 0, 'suffix' => 'gün']), $row('Kıdem', null, $staff->tenure_label), $row('Durum', 'is_active', $staff->is_active ? '1' : '0', $staff->status_label, ['type' => 'select', 'options' => $activeOpts]), ], ]; // ── İletişim ── $sections[] = [ 'title' => 'İletişim', 'icon' => 'fa-address-book', 'rows' => [ $row('İş Telefonu', 'phone', $staff->phone, null, ['mono' => true]), $row('Kişisel Telefon', 'phone_alt', $staff->phone_alt, null, ['mono' => true]), $row('İş E-postası', 'email', $staff->email, null, ['type' => 'email']), $row('Kişisel E-posta', 'personal_email', $staff->personal_email, null, ['type' => 'email']), ], ]; // ── Adres ── $sections[] = [ 'title' => 'Adres', 'icon' => 'fa-location-dot', 'rows' => [ $row('Açık Adres', 'address', $staff->address, null, ['type' => 'textarea']), $row('İl', 'city', $staff->city), $row('İlçe', 'district', $staff->district), $row('Posta Kodu', 'postal_code', $staff->postal_code, null, ['mono' => true]), ], ]; // ── Acil durum ── $sections[] = [ 'title' => 'Acil Durum', 'icon' => 'fa-truck-medical', 'rows' => [ $row('Aranacak Kişi', 'emergency_contact_name', $staff->emergency_contact_name, null, ['ph' => 'Ad Soyad']), $row('Telefonu', 'emergency_contact_phone', $staff->emergency_contact_phone, null, ['mono' => true]), $row('Yakınlık Derecesi', 'emergency_contact_relation', $staff->emergency_contact_relation, null, ['ph' => 'Ör. eş, kardeş']), $row('Sağlık Notu', 'health_notes', $staff->health_notes, null, ['type' => 'textarea', 'ph' => 'Alerji, kronik rahatsızlık…']), ], ]; // ── Mali & resmî ── $sections[] = [ 'title' => 'Mali & Resmî', 'icon' => 'fa-file-invoice-dollar', 'rows' => [ $row('Maaş', 'salary', $staff->salary, $staff->salary !== null ? number_format((float) $staff->salary, 2, ',', '.') : '', ['type' => 'number', 'mono' => true, 'dec' => 2, 'suffix' => $staff->salary_currency ?: 'TRY']), $row('Para Birimi', 'salary_currency', $staff->salary_currency, $staff->salary_currency, ['type' => 'select', 'options' => $currencyOpts]), $row('IBAN', 'iban', $staff->iban, null, ['mono' => true, 'ph' => 'TR00 0000 0000 …']), $row('Banka', 'bank_name', $staff->bank_name), $row('SGK Sicil No', 'sgk_no', $staff->sgk_no, null, ['mono' => true]), $row('Vergi Dairesi', 'tax_office', $staff->tax_office), ], ]; // ── Eğitim & yükümlülük ── $sections[] = [ 'title' => 'Eğitim & Yükümlülük', 'icon' => 'fa-graduation-cap', 'rows' => [ $row('Eğitim Durumu', 'education_level', $staff->education_level, $staff->education_level_label, ['type' => 'select', 'options' => $educationOpts]), $row('Okul', 'education_school', $staff->education_school, null, ['ph' => 'Mezun olduğu okul']), $row('Bölüm', 'education_field', $staff->education_field, null, ['ph' => 'Ör. Turizm İşletmeciliği']), $row('Askerlik Durumu', 'military_status', $staff->military_status, $staff->military_status_label, ['type' => 'select', 'options' => $militaryOpts]), $row('Ehliyet Sınıfı', 'driving_license', $staff->driving_license, null, ['mono' => true, 'ph' => 'Ör. B, B-A2']), $row('Yabancı Diller', 'languages', $staff->languages, null, ['ph' => 'İngilizce, Almanca']), ], ]; // ── Sistem (salt okunur) ── $sections[] = [ 'title' => 'Sistem', 'icon' => 'fa-clock-rotate-left', 'muted' => true, 'rows' => [ $row('Kayıt No', null, '#' . $staff->id, '#' . $staff->id, ['mono' => true]), $row('Sistem Hesabı', null, $staff->user ? $staff->user->email : ''), $row('Son Giriş', null, $staff->user?->last_login_at?->format('d.m.Y H:i')), $row('Oluşturulma', null, $staff->created_at?->format('d.m.Y H:i')), $row('Son Güncelleme', null, $staff->updated_at?->format('d.m.Y H:i')), ], ]; // Kart tanımı: markup ledger-card'da, boş alan sayacı da orada. // pfx-lw: etiketler uzun ("Deneme Süresi Bitişi") → geniş etiket sütunu. $qvCard = [ 'title' => 'Özlük Künyesi', 'icon' => 'fa-address-card', 'url' => $uf, 'class' => 'pfx-lw', 'foldable' => true, 'sections' => $sections, ]; @endphp {{-- Markup ledger-card'da: kart yalnızca yukarıdaki dizi tanımını verir. --}} @include('components.quick-view.ledger-card', ['card' => $qvCard]) {{-- Ortak katmanlar: pfx satır davranışı ledger-ui'de, .pfx-agent / .pfx-notes blokları activity-ui'de. --}} @include('components.quick-view.ledger-ui') @include('components.quick-view.activity-ui')