/* ============ Main App ============ */ function ConsumptionListsPage({ lang, consumptionLists, setPage, onAddCustom }){ const isDari = lang === "dari"; const [showAdd, setShowAdd] = useState(false); const [newName, setNewName] = useState(""); const t = STR[lang]; const fixedLists = [ { id:"cl-arbaab", label:t.nav.clArbaab, count:(consumptionLists?.arbaab||[]).length }, { id:"cl-mataraffe", label:t.nav.clMataraffe, count:(consumptionLists?.mataraffe||[]).length }, { id:"cl-khorak", label:t.nav.clKhorak, count:(consumptionLists?.khorak||[]).length }, { id:"cl-barq", label:t.nav.clBarq, count:(consumptionLists?.barq||[]).length }, { id:"cl-teel", label:t.nav.clTeel, count:(consumptionLists?.teel||[]).length }, ]; const customLists = consumptionLists?.custom || []; const handleAddCustom = () => { if(newName.trim()){ onAddCustom(newName.trim()); setNewName(""); setShowAdd(false); } }; return (
{isDari?"انتخاب کنید کدام لیست را میخواهید باز کنید":"Select which list to open"}
| {isDari?"تاریخ":"Date"} | {isDari?"یادداشت":"Note"} | {isDari?"مبلغ":"Amount"} | |
|---|---|---|---|
| {x.date||"—"} | {x.note||x.title||x.name||x.fullName||"—"} | {f(Number(x.amount)||0)} |
| {isDari?"تاریخ":"Date"} | {isDari?"یادداشت":"Note"} | {isDari?"مبلغ":"Amount"} |
|---|---|---|
| {x.date||"—"} | {x.note||x.title||x.name||x.fullName||"—"} | {f(fmtMoney(Number(x.amount)||0))} |
{isDari ? `مجموع ${f(allData.length)} ثبت` : `${f(allData.length)} records`} · {isDari?"مجموع مبلغ:":"Total:"} {f(fmtMoney(totalAmount))} {isDari?"افغانی":"AFN"}
| {isDari?"کد":"Code"} | {isDari?"تاریخ":"Date"} | {isDari?"اسم":"Name"} | {isDari?"ولد":"Father"} | {isDari?"ولایت":"Province"} | {isDari?"ولسوالی":"District"} | {cfg.hasReceived ? ( <>{isDari?"دریافتی":"Received"} | {isDari?"باقیمانده":"Remaining"} | > ) : ({isDari?"رسید":"Amount"} | )}{isDari?"آدرس":"Address"} | |
|---|---|---|---|---|---|---|---|---|---|---|
| updateField(r,"code",e.target.value)}/> | updateField(r,"date",e.target.value)}/> |
updateField(r,"name",e.target.value)}/>
{r._custom && {isDari?"جدید":"New"}}
|
updateField(r,"father",e.target.value)}/> | updateField(r,"province",e.target.value)}/> | updateField(r,"district",e.target.value)}/> | {cfg.hasReceived ? ( <>updateField(r,"received",e.target.value)}/> | updateField(r,"remaining",e.target.value)}/> | > ) : (updateField(r,"amount",e.target.value)}/> | )}updateField(r,"address",e.target.value)}/> |
{r._custom && (
)}
|