import React from 'react';

const RevisionUploadDialog = ({ 
  revisionDialog, 
  setRevisionDialog, 
  revisionFile, 
  setRevisionFile, 
  handleRevisionUpload, 
  uploading 
}) => {
  if (!revisionDialog.open) return null;

  return (
    <div style={{
      position: 'fixed',
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      background: 'rgba(0, 0, 0, 0.5)',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      zIndex: 1000
    }}>
      <div style={{
        background: 'white',
        borderRadius: '12px',
        padding: '24px',
        maxWidth: '500px',
        width: '90%'
      }}>
        <h3 style={{ margin: '0 0 16px 0' }}>
          리비전 업로드: {revisionDialog.bomName}
        </h3>
        
        <input
          type="file"
          accept=".csv,.xlsx,.xls"
          onChange={(e) => setRevisionFile(e.target.files[0])}
          style={{ 
            width: '100%', 
            marginBottom: '16px',
            padding: '8px'
          }}
        />
        
        <div style={{ display: 'flex', gap: '12px', justifyContent: 'flex-end' }}>
          <button
            onClick={() => setRevisionDialog({ open: false, bomName: '', parentId: null })}
            style={{
              padding: '8px 16px',
              background: '#e2e8f0',
              color: '#4a5568',
              border: 'none',
              borderRadius: '6px',
              cursor: 'pointer'
            }}
          >
            취소
          </button>
          <button
            onClick={handleRevisionUpload}
            disabled={!revisionFile || uploading}
            style={{
              padding: '8px 16px',
              background: (!revisionFile || uploading) ? '#e2e8f0' : '#4299e1',
              color: (!revisionFile || uploading) ? '#a0aec0' : 'white',
              border: 'none',
              borderRadius: '6px',
              cursor: (!revisionFile || uploading) ? 'not-allowed' : 'pointer'
            }}
          >
            {uploading ? '업로드 중...' : '업로드'}
          </button>
        </div>
      </div>
    </div>
  );
};

export default RevisionUploadDialog;






















