@extends('layouts.app')

@section('title', 'Add Shop')

@section('content')


  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
		<div class="d-flex justify-content-between align-items-center mb-3">
			<h6 class="card-title mb-0">Add Shop</h6>

             </div>
          @if($errors->any())
            <div class="alert alert-danger">
              <ul class="mb-0">
                @foreach($errors->all() as $error)
                  <li>{{ $error }}</li>
                @endforeach
              </ul>
            </div>
          @endif

          <form action="{{ route('shops.store') }}" method="post">
            @csrf
            <div class="mb-3">
              <label class="form-label">Shop Name</label>
              <input type="text" name="name" class="form-control" value="{{ old('name') }}" required>
              @error('name')<div class="text-danger small">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
              <label class="form-label">Phone</label>
              <input type="text" name="phone" class="form-control" value="{{ old('phone') }}">
              @error('phone')<div class="text-danger small">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
              <label class="form-label">Email</label>
              <input type="email" name="email" class="form-control" value="{{ old('email') }}">
              @error('email')<div class="text-danger small">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
              <label class="form-label">Address</label>
              <textarea name="address" class="form-control" rows="2">{{ old('address') }}</textarea>
              @error('address')<div class="text-danger small">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
              <label class="form-label">City</label>
              <input type="text" name="city" class="form-control" value="{{ old('city') }}">
              @error('city')<div class="text-danger small">{{ $message }}</div>@enderror
            </div>
            <div class="row">
              <div class="col-md-4 mb-3">
                <label class="form-label">Commission Rate (%)</label>
                <input type="number" step="0.01" name="commission_rate" class="form-control" value="{{ old('commission_rate', '0') }}" min="0" max="100">
                @error('commission_rate')<div class="text-danger small">{{ $message }}</div>@enderror
              </div>
              <div class="col-md-4 mb-3">
                <label class="form-label">Security Deposit</label>
                <input type="number" step="0.01" name="security_deposit" class="form-control" value="{{ old('security_deposit', '0') }}" min="0">
                @error('security_deposit')<div class="text-danger small">{{ $message }}</div>@enderror
              </div>
              <div class="col-md-4 mb-3 d-flex align-items-end">
                <div class="form-check pb-2">
                  <input type="hidden" name="is_security_account" value="0">
                  <input class="form-check-input" type="checkbox" name="is_security_account" value="1" id="isSecurityAccountShop" {{ old('is_security_account') ? 'checked' : '' }}>
                  <label class="form-check-label" for="isSecurityAccountShop">
                    Is Security Account
                  </label>
                </div>
              </div>
            </div>

            <div class="d-flex gap-2">
              <a href="{{ route('shops.index') }}" class="btn btn-light">Cancel</a>
              <button type="submit" class="btn btn-primary">Save</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>

@endsection


