Files
ihaleist/src/components/HealthPortfolioEditor.jsx
T

18 lines
2.2 KiB
React
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React from 'react';
import {portfolioFields} from '../services/healthPortfolio';
export function HealthPortfolioEditor({items,onChange,disabled}){
const patch=(id,change)=>onChange(items.map(item=>item.id===id?{...item,...change}:item));
return <fieldset disabled={disabled} className="border rounded-xl p-3 space-y-3">
<legend className="font-bold">Sağlık ürün ve hizmet portföyü</legend>
<p className="text-xs text-slate-600">Firma beyanıdır; resmi kayıt veya teknik uygunluk doğrulaması değildir. İhale hazırlığında seçilen ürünün bu sürümü taslakta tutulur.</p>
{items.map((item,index)=><section key={item.id} className="border rounded p-3 grid sm:grid-cols-2 gap-2">
<h3 className="font-bold text-sm sm:col-span-2">Portföy kaydı {index+1}</h3>
{portfolioFields.map(([key,label])=><label key={key} className="text-xs">{label}<input aria-label={`Portföy ${index+1} ${label}`} className="block w-full border rounded p-2" maxLength={1000} value={item[key] || ''} onChange={e=>patch(item.id,{[key]:e.target.value})}/></label>)}
<label className="text-xs">Kapsam<select aria-label={`Portföy ${index+1} Kapsam`} className="block w-full border rounded p-2" value={item.kind || 'consumable'} onChange={e=>patch(item.id,{kind:e.target.value})}><option value="consumable">Sarf / test ürünü</option><option value="device">Cihaz ve servis</option><option value="staffedService">Personelli hizmet</option></select></label>
<label className="text-xs">ÜTS beyanı<select aria-label={`Portföy ${index+1} ÜTS beyanı`} className="block w-full border rounded p-2" value={item.utsStatus || 'unknown'} onChange={e=>patch(item.id,{utsStatus:e.target.value})}><option value="unknown">Kontrol gerekli</option><option value="declared">Kayıt mevcut — firma beyanı</option><option value="notApplicable">Uygulanmıyor — açıklama gerekli</option></select></label>
<button type="button" className="text-red-700 text-xs" onClick={()=>onChange(items.filter(row=>row.id!==item.id))}>Portföy kaydı {index+1} kaldır</button>
</section>)}
<button type="button" className="border rounded p-2 text-sm" onClick={()=>onChange([...items,{id:crypto.randomUUID(),kind:'consumable',utsStatus:'unknown'}])}>Portföy kaydı ekle</button>
</fieldset>;
}