DeepSeek ArtifactsDeepSeek Artifacts

إنشاء برنامج لإدارة المنتجات

4.0
ar
تكنولوجيا
برمجة
إدارة المنتجات
تطوير البرمجيات

النص التوجيهي

قم بإنشاء برنامج يقوم بأدخال اصناف من المنتجات
حيث ان بيانات كل صنف هي:
نوع الصنف 
الطراز
الكمية
سعر التكلفة
سعر البيع

النتيجة المولدة

import React, { useState } from 'react';
import './App.css';

function App() {
  const [items, setItems] = useState([]);
  const [type, setType] = useState('');
  const [model, setModel] = useState('');
  const [quantity, setQuantity] = useState('');
  const [costPrice, setCostPrice] = useState('');
  const [sellingPrice, setSellingPrice] = useState('');

  const handleSubmit = (e) => {
    e.preventDefault();
    const newItem = {
      type,
      model,
      quantity,
      costPrice,
      sellingPrice,
    };
    setItems([...items, newItem]);
    setType('');
    setModel('');
    setQuantity('');
    setCostPrice('');
    setSellingPrice('');
  };

  return (
    <div className="App bg-gray-100 min-h-screen p-8">
      <div className="max-w-4xl mx-auto bg-white rounded-lg shadow-lg p-6">
        <h1 className="text-3xl font-bold text-center mb-6 text-blue-700">Product Management System</h1>
        <form onSubmit={handleSubmit} className="space-y-4">
          <div>
            <label className="block text-sm font-medium text-gray-700">Type</label>
            <input
              type="text"
              value={type}
              onChange={(e) => setType(e.target.value)}
              className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
              required
            />
          </div>
          <div>
            <label className="block text-sm font-medium text-gray-700">Model</label>
            <input
              type="text"
              value={model}
              onChange={(e) => setModel(e.target.value)}
              className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
              required
            />
          </div>
          <div>
            <label className="block text-sm font-medium text-gray-700">Quantity</label>
            <input
              type="number"
              value={quantity}
              onChange={(e) => setQuantity(e.target.value)}
              className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
              required
            />
          </div>
          <div>
            <label className="block text-sm font-medium text-gray-700">Cost Price</label>
            <input
              type="number"
              value={costPrice}
              onChange={(e) => setCostPrice(e.target.value)}
              className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
              required
            />
          </div>
          <div>
            <label className="block text-sm font-medium text-gray-700">Selling Price</label>
            <input
              type="number"
              value={sellingPrice}
              onChange={(e) => setSellingPrice(e.target.value)}
              className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
              required
            />
          </div>
          <button
            type="submit"
            className="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
          >
            Add Product
          </button>
        </form>
        <div className="mt-8">
          <h2 className="text-2xl font-bold mb-4 text-gray-800">Product List</h2>
          <div className="space-y-4">
            {items.map((item, index) => (
              <div key={index} className="bg-gray-50 p-4 rounded-md shadow-sm">
                <p><strong>Type:</strong> {item.type}</p>
                <p><strong>Model:</strong> {item.model}</p>
                <p><strong>Quantity:</strong> {item.quantity}</p>
                <p><strong>Cost Price:</strong> ${item.costPrice}</p>
                <p><strong>Selling Price:</strong> ${item.sellingPrice}</p>
              </div>
            ))}
          </div>
        </div>
      </div>
    </div>
  );
}

export default App;

المزيد من التوصيات

عرض الكل

بريد إلكتروني مؤقت

4.0
التكنولوجيا
ar
بريد مؤقت
بريد إلكتروني
خدمات بريد
بريد إلكتروني مؤقتاعمل ...

OTC Pulse تحليل EUR/USD

4.0
تكنولوجيا التداول
ar
OTC
AI Trading
EUR/USD
Technical Analysis
Automated Trading
اسم المشروع المقترح: 🔹 OTC Pulse أو FlashTrade AI 🎯 فكرة المشروع: منصة إلكترونية أنيقة وذكية مخصصة لتحليل زوج EUR/USD OTC فقط على منصة Pocket Option، باستخدام الذكاء الاصطناعي ومدارس التحليل الفني ا...

جعل خلفية بيضاء بسهولة

4.0
تصميم جرافيك
ar
تصميم
خلفية بيضاء
تحرير الصور
جعل لخلفية بيضاء بعذ تحميل صورة...

إنشاء تطبيق إزالة خلفية الصور

4.0
تطوير تطبيقات
ar
تطبيق
إزالة خلفية
تحميل صور
انشاء تطبيق ازالة خلفية صور بشكل احترافي مع ايضافت زر تحميل صورة...

تطبيق متجر ملابس عربي

4.0
تكنولوجيا
ar
متجر ملابس
تطبيق عربي
تصميم موبايل
طبيق متجر بيع الملابس مع إتاحة إظهار المقاسات المتاحة مع السعر مع الألوان المتاحة التطبيق يخدم الموبايل بحيث يكون التصميم يتناسب مع العرض على الموبايل باللغة العربية كل شيء باللغة العربية مع إتاحة الت...