{{-- the category form (flow م۹, slice 5الف; پ۵-۱). posts the name and, for every product it RENDERED, its id (`products[]`), «مجاز» (with a hidden «0» twin) and the special spreads — a product not on this page is never touched (+PARTIAL-SAVE). the price columns are the SERVER's: computed at render and, while typing, read again from the preview route; the script never computes a price (+STATE-TRUTH). without the script the form still saves and the page shows the prices after saving. --}} @extends('layouts.mz') @php $old = fn (string $field, int $id, string $default) => old($field . '.' . $id, $default); @endphp @section('title', $group ? 'دستهٔ ' . $group->name : 'دستهٔ تازه') @section('credit', '1') @section('nav') @include('panel._nav') @endsection @section('content')

{{ $group ? 'دستهٔ «' . $group->name . '»' : 'دستهٔ تازه' }}

برگشت به دسته‌ها
@if (session('mz.saved'))

{{ session('mz.saved') }}

@endif @if ($errors->any()) @endif
@csrf
فقط شما این نام را می‌بینید؛ در اپ مشتری نمی‌آید. @error('name')

{{ $message }}

@enderror
{{-- slice 5ب (پ۵-۲, debt 16): the category's own limits for each member and its auto-approval range, melted gold. the strictest of product, category and family binds; auto-approval needs the product's range AND this one. slice 5د۲ (decision 91, debt 33): the same for silver, its own fields (prefix «silver_»), shown where silver exists or a silver value is stored. slice 5ه۲ (decision 110, debt 33): coins by the same rule, prefix «coin_», a COUNT — every coin of the member counts one toward the daily cap --}} @foreach (array_filter(['' => 'طلای آبشده', 'silver_' => $silver ? 'نقره' : null, 'coin_' => $coin ? 'سکه' : null]) as $prefix => $familyWord) @php $isCoin = $prefix === 'coin_'; $setUnit = $isCoin ? 'عدد' : $weightUnitWord; $what = $isCoin ? 'تعداد' : 'وزن'; @endphp
حدهای {{ $familyWord }} برای هر عضو ({{ $setUnit }})

خالی یعنی بی‌حد. این حدها کنار حد هر کالا و حدهای سراسری {{ $familyWord }} در تنظیمات برقرارند و سخت‌ترینِ آن‌ها حکم می‌کند. سقف روزانه برای هر عضو جداست: جمع {{ $what }} سفارش‌های امروز همان عضو در هر طرف، در همهٔ کالاهای {{ $familyWord }}.@if ($isCoin) هر عدد سکه، هر نوعی که باشد، یکی شمرده می‌شود و اعشار پذیرفته نیست.@endif

@foreach (['trade_min' => 'کمترین مقدار هر معامله', 'trade_max' => 'بیشترین مقدار هر معامله', 'daily_cap' => 'سقف روزانهٔ هر عضو'] as $plain => $limitLabel) @php $limit = $prefix . $plain; @endphp

@error($limit){{ $message }}@enderror

@endforeach
تأیید خودکار {{ $familyWord }} برای اعضا ({{ $setUnit }})

سفارش {{ $familyWord }} عضو فقط وقتی خودکار تأیید می‌شود که هم در بازهٔ تأیید خودکار خود کالا باشد و هم در این بازه. «تا {{ $what }}» خالی یعنی این دسته بازهٔ جدایی ندارد و همان بازهٔ کالا حکم می‌کند؛ کالایی که تأیید خودکار ندارد، برای اعضا هم ندارد.

@foreach (['auto_min' => 'از ' . $what, 'auto_max' => 'تا ' . $what] as $plain => $autoLabel) @php $auto = $prefix . $plain; @endphp

@error($auto){{ $message }}@enderror

@endforeach
@endforeach {{-- slice 5ج۱ (پ۵-۳, flow م۹ «پیام اختصاصی»): the same reader and cap as the general message; no maxlength, a text over the cap is refused with its length, never cut (+SILENT-DISCARD) --}}
پیام اختصاصی برای اعضا
اگر بنویسید، اعضای این دسته به‌جای «پیغام عمومی» تنظیمات همین را می‌بینند: یک بار به‌صورت پنجره و از آن پس به‌صورت کادر جمع‌شدنی بالای قیمت‌ها. پایان ندارد؛ هر وقت خالی‌اش کنید، اعضا دوباره پیغام عمومی را می‌بینند. حداکثر ۱٬۰۰۰ نویسه. نام دسته همراه آن نمی‌رود.

@error('message'){{ $message }}@enderror

@if ($reach)

{{ \App\Support\Display::number($reach[0]) }} از {{ \App\Support\Display::number($reach[1]) }} عضو این پیام را دیده و «متوجه شدم» زده‌اند.

@endif

کالاها و اختلاف ویژه

عضو این دسته فقط کالاهای «مجاز» را می‌بیند. اختلاف ویژه جای اختلاف خود کالا را می‌گیرد و روی آن جمع نمی‌شود؛ خالی یعنی همان اختلاف کالا، و صفر یعنی خود قیمت مرجع. مبلغ‌ها به {{ $unitWord }}؛ برای کالایی که اختلافش درصدی است، اختلاف ویژه هم درصد قیمت مرجع است (حداکثر دو رقم اعشار). @if ($left > 0)
{{ \App\Support\Display::number($left) }} کالا در این دسته مجاز نیست و اعضا آن را نمی‌بینند. کالای تازه‌ای که می‌سازید هم تا اینجا تیک نخورد، در این دسته نیست. @endif

@error('products') @enderror @if ($rows === [])

هنوز کالایی ندارید؛ اول کالا بسازید، بعد آن را در دسته مجاز کنید.

@else
@foreach ($rows as $row) @php $id = $row['id']; @endphp @foreach (['buy' => 'خرید', 'sell' => 'فروش'] as $side => $word) @php $field = $side . '_spread'; @endphp @endforeach @endforeach
«خرید» و «فروش» از دید مشتری است. ستون «قیمت عضو» همان قیمتی است که عضو این دسته در اپ می‌بیند.
کالا مجاز اختلاف خرید ویژه قیمت عضو: خرید اختلاف فروش ویژه قیمت عضو: فروش
{{-- slice 5د۲: the mode this row was drawn in; a product switched since is refused, never read in the other unit --}} {{ $row['title'] }} @error('allowed.' . $id)

{{ $message }}

@enderror
@if ($row['percent']) ٪ از قیمت مرجع @endif

@error($field . '.' . $id){{ $message }}@enderror

{{ $row[$side] }}
@endif
@if ($group) حذف این دسته… @endif
@if ($group)

اعضا ({{ \App\Support\Display::number($members->count()) }})

@if ($members->isEmpty())

این دسته هنوز عضوی ندارد. دستهٔ هر مشتری در «حساب مشتری» صفحهٔ همان مشتری تعیین می‌شود.

مشتریان
@else @endif
@endif @endsection