@extends('layouts.admin') @section('title', '公司與店鋪管理') @push('breadcrumb') @endpush @push('styles') @endpush @section('content')
新增公司
@csrf
@forelse ($companies as $company)
{{ $company->name }}
@if($company->contact_person) {{ $company->contact_person }} @endif @if($company->phone) {{ $company->phone }} @endif
文件 編輯 @if(auth()->user()->isAdmin()) @if($company->branches->isEmpty())
@csrf @method('DELETE')
@else @endif @endif
@if($company->branches->count() > 0)
@foreach($company->branches as $branch) @endforeach
店鋪資訊
{{ $branch->name }}
@if(auth()->user()->isAdmin())
@csrf @method('DELETE')
@endif
@if($branch->address)
{{ $branch->address }}
@endif @if($branch->workers->count() > 0) @php $allWorkers = $branch->workers->sortBy([['position', 'asc'], ['zh_name', 'asc']])->values(); $maleWorkers = $allWorkers->where('gender', '男'); $femaleWorkers = $allWorkers->where('gender', '!=', '男'); @endphp
員工 ({{ $branch->workers->count() }}人) 男 {{ $maleWorkers->count() }} 女 {{ $femaleWorkers->count() }}
@foreach($allWorkers as $worker)
{{ $worker->zh_name ?: '(未填姓名)' }}@if($worker->position) {{ $worker->position }}@endif
@endforeach
@else 尚無分配員工 @endif
@else

目前尚未建立任何店鋪

@endif
@csrf
@empty

目前尚未建立公司資料

請從左側表單新增公司

@endforelse
@endsection