

<?php $__env->startSection('content'); ?>    

<?php if(session('success')): ?>
    <div class="alert alert-success mt-3">
        <?php echo e(session('success')); ?>

    </div>
<?php endif; ?>

<?php if(session('error')): ?>
    <div class="alert alert-danger mt-3">
        <?php echo e(session('error')); ?>

    </div>
<?php endif; ?>


<style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --accent-color: #e74c3c;
            --light-color: #f8f9fa;
            --dark-color: #343a40;
            --success-color: #28a745;
            --border-color: #dee2e6;
            --shadow-color: rgba(0, 0, 0, 0.1);
        }
        
        body {
            font-family: 'Tajawal', sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }
        
        .form-container {
            max-width: 1000px;
            margin: 30px auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }
        
        .form-header {
            background: linear-gradient(135deg, var(--primary-color) 0%, #4a6580 100%);
            color: white;
            padding: 25px;
            text-align: center;
            position: relative;
        }
        
        .form-title {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 12px;
            color: #ffd700;
        }
        
        .form-subtitle {
            font-size: 18px;
            margin-bottom: 8px;
            font-weight: 600;
        }
        
        .form-body {
            padding: 30px;
        }
        
        .form-section {
            margin-bottom: 30px;
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 20px;
            background: #fff;
        }
        
        .section-title {
            font-size: 20px;
            font-weight: 700;
            color: var(--primary-color);
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid var(--primary-color);
        }
        
        .form-row {
            display: flex;
            margin-bottom: 20px;
            gap: 20px;
        }
        
        .form-group {
            flex: 1;
        }
        
        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--dark-color);
        }
        
        .form-input, .form-select, .form-textarea {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-family: 'Tajawal', sans-serif;
            font-size: 16px;
            transition: all 0.3s;
        }
        
        .form-input:focus, .form-select:focus, .form-textarea:focus {
            outline: none;
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
        }
        
        .form-textarea {
            min-height: 100px;
            resize: vertical;
        }
        
        .calculation-row {
            background-color: #f1f6fd;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .calc-label {
            font-weight: 600;
            color: var(--primary-color);
        }
        
        .calc-value {
            font-weight: 700;
            color: var(--dark-color);
            background: white;
            padding: 8px 15px;
            border-radius: 5px;
            min-width: 150px;
            text-align: center;
        }
        
        .form-actions {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 30px;
        }
        
        .btn {
            padding: 12px 25px;
            border: none;
            border-radius: 8px;
            font-family: 'Tajawal', sans-serif;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 16px;
        }
        
        .btn-primary {
            background: var(--primary-color);
            color: white;
        }
        
        .btn-secondary {
            background: var(--secondary-color);
            color: white;
        }
        
        .btn-success {
            background: var(--success-color);
            color: white;
        }
        
        .btn-danger {
            background: var(--accent-color);
            color: white;
        }
        
        .btn-primary:hover {
            background: #1e2a36;
        }
        
        .btn-secondary:hover {
            background: #1d6fa5;
        }
        
        .btn-success:hover {
            background: #218838;
        }
        
        .btn-danger:hover {
            background: #c82333;
        }
        
        .signature-section {
            display: flex;
            justify-content: space-between;
            padding: 20px 50px;
            background: #f8f9fa;
            border-radius: 10px;
            border: 1px dashed #ced4da;
            margin-top: 30px;
        }
        
        .signature-item {
            text-align: center;
            font-weight: 700;
            color: var(--primary-color);
            padding: 15px 25px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
            min-width: 120px;
        }
        
        .stamp-placeholder {
            height: 60px;
            width: 100%;
            border-bottom: 2px dashed #ced4da;
            margin-top: 10px;
        }
        
        @media (max-width: 768px) {
            .form-row {
                flex-direction: column;
                gap: 15px;
            }
            
            .signature-section {
                flex-direction: column;
                gap: 15px;
                padding: 20px;
            }
            
            .calculation-row {
                flex-direction: column;
                gap: 10px;
                text-align: center;
            }
        }
    </style>


    
    <div class="form-container">
        <!-- Form Header -->
        <div class="form-header">
            <h1 class="form-title"> نموزج تسجيل عمليات الفرز </h1>
        </div>
        
        <!-- Form Body -->
        <form  role="form" method="POST" action="<?php echo e(url('/sorting/create')); ?>">
                        <?php echo e(csrf_field()); ?>

            <div class="form-body">
                <!-- Basic Information Section -->
                
                
                <!-- Product Information Section -->
                <div class="form-section">
                    <h2 class="section-title"> معلومات الصنف و المورد </h2>
                    
                    <div class="form-row">

                        <div class="form-group">
                            <label class="form-label">اختر اسم المورد </label>
                                <select class="form-control select2 select2-hidden-accessible"   style="width: 100%;text-align:right" name="supplier_id" id="supplier_id" required>
                                <option value="">اختر اسم المورد</option>    
                                <?php foreach( $suppliers as $supplier ): ?> 
                                    <option value="<?php echo e($supplier->id); ?>"  ><?php echo e($supplier->name); ?> </option>
                                    <?php endforeach; ?>
                                </select>                           
                        </div>


                        <div class="form-group">
                            <label class="form-label">اسم الصنف</label>
                                
                                <select class="form-control select2 select2-hidden-accessible"   style="width: 100%;text-align:right" name="sell_store_id" id="sell_store_id" required>
                                <option value="">اختر اسم الصنف</option>    
                                <?php foreach( $sell_stores as $store ): ?> 
                                    <option value="<?php echo e($store->id); ?>"  ><?php echo e($store->store->sell_name); ?> </option>
                                    <?php endforeach; ?>
                                </select>                           
                        </div>

                         
                    </div>
                    
                     
                    
                     
                    
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">الكمية</label>
                            <input type="number" class="form-input" name="quantity" id="quantity" placeholder="الكمية" min="1" required onchange="calculateTotal()">
                        </div>
                        
                        <div class="form-group">
                            <label class="form-label">تاريخ الفرز</label>
                            <input type="date" class="form-input" name="sort_date" placeholder="تاريخ الفرز" required>
                        </div>
                    </div>
                    
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">فترة التجميع - من </label>
                            <input type="date" class="form-input" name="date_from" placeholder="فترة التجميع من" required>
                        </div>

                         <div class="form-group">
                            <label class="form-label">فترة التجميع - الي </label>
                            <input type="date" class="form-input" name="date_to"  placeholder="فترة التجميع الي" required>
                        </div>

                    </div>
                    
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">ملاحظات</label>
                            <textarea class="form-textarea" name="note" placeholder="أي ملاحظات إضافية"></textarea>
                        </div>
                    </div>
                </div>
                
                <!-- Form Actions -->
                <div class="form-actions">
                    <button type="submit" class="btn btn-success">
                        <i class="fas fa-save"></i> حفظ التقرير
                    </button>
                    
                </div>
            </div>
        </form>
    </div>

    <script>
        function calculateTotal() {
            const quantity = parseFloat(document.getElementById('quantity').value) || 0;
            const unitPrice = parseFloat(document.getElementById('unit_purchase_price').value) || 0;
            const total = quantity * unitPrice;
            document.getElementById('total').textContent = total.toFixed(2);
        }
    </script>
    <?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.masterHome2', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>