mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-208,213): update PurchaseOrderDetail and PurchaseOrderInvoice components for improved warehouse and supplier details
This commit is contained in:
@@ -499,7 +499,7 @@ const PurchaseOrderDetail = ({
|
||||
</span>
|
||||
<span className='text-gray-900 ml-3 break-all'>
|
||||
:{' '}
|
||||
{purchaseData.items?.[0]?.warehouse?.type !== 'AREA' &&
|
||||
{purchaseData.items?.[0]?.warehouse?.type === 'LOKASI' &&
|
||||
purchaseData.items?.[0]?.warehouse?.location?.name
|
||||
? purchaseData.items[0].warehouse.location.name
|
||||
: '-'}
|
||||
|
||||
@@ -267,7 +267,9 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
style={pdfStyles.logo}
|
||||
id={'mbu-logo'}
|
||||
/>
|
||||
<Text style={pdfStyles.companyInfo}>PT MITRA BERLIAN UNGGAS</Text>
|
||||
<Text style={pdfStyles.companyInfo}>
|
||||
PT LUMBUNG TELUR INDONESIA
|
||||
</Text>
|
||||
<Text style={pdfStyles.address}>
|
||||
SOHO Building Lt.3 (Paris Van Java), Jalan Karang Tinggal, Kel.
|
||||
Cipedes, Kec. Sukajadi, Kota Bandung 40162
|
||||
@@ -283,8 +285,8 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
<Text>
|
||||
Date:{' '}
|
||||
{purchaseData?.po_date
|
||||
? formatDate(purchaseData.po_date, 'DD-MMM-YYYY')
|
||||
: formatDate(new Date(), 'DD-MMM-YYYY')}
|
||||
? formatDate(purchaseData.po_date, 'DD MMM YYYY')
|
||||
: formatDate(new Date(), 'DD MMM YYYY')}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -302,20 +304,34 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
<View style={pdfStyles.tableRow}>
|
||||
<View style={pdfStyles.tableCell}>
|
||||
<Text style={{ fontWeight: 'bold' }}>
|
||||
{purchaseData?.supplier?.name || '-'}
|
||||
{purchaseData?.supplier?.name || '-'} (
|
||||
{purchaseData?.supplier?.alias || ''})
|
||||
</Text>
|
||||
<Text>{purchaseData?.supplier?.pic || '-'}</Text>
|
||||
<Text>{purchaseData?.supplier?.category || '-'}</Text>
|
||||
<Text>
|
||||
{purchaseData?.supplier?.phone || '-'} /{' '}
|
||||
{purchaseData?.supplier?.email || '-'}
|
||||
Credit Term: {purchaseData?.credit_term || 0} hari
|
||||
</Text>
|
||||
<Text>
|
||||
Due Date:{' '}
|
||||
{purchaseData?.due_date
|
||||
? formatDate(purchaseData.due_date, 'DD MMM YYYY')
|
||||
: '-'}
|
||||
</Text>
|
||||
<Text>{purchaseData?.supplier?.address || '-'}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellLast}>
|
||||
<Text style={{ fontWeight: 'bold' }}>
|
||||
PT MITRA BERLIAN UNGGAS
|
||||
PT LUMBUNG TELUR INDONESIA
|
||||
</Text>
|
||||
<Text>
|
||||
{purchaseData?.items?.[0]?.warehouse.type === 'LOKASI'
|
||||
? purchaseData.items[0].warehouse.location.name
|
||||
: '-'}
|
||||
</Text>
|
||||
<Text>
|
||||
{purchaseData?.items?.[0]?.warehouse.type === 'LOKASI'
|
||||
? purchaseData.items[0].warehouse.location.address
|
||||
: '-'}
|
||||
</Text>
|
||||
<Text>{purchaseData?.location?.name || '-'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
@@ -331,7 +347,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
<Text>Unit Price</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellHeader}>
|
||||
<Text>Total Quantity</Text>
|
||||
<Text>Quantity</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellHeaderLast}>
|
||||
<Text>Total Amount</Text>
|
||||
@@ -355,7 +371,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
<Text>Rp{formatNumber(item.price || 0)}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellRight}>
|
||||
<Text>{formatNumber(item.total_qty || 0)}</Text>
|
||||
<Text>{formatNumber(item.sub_qty || 0)}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellRightLast}>
|
||||
<Text>Rp{formatNumber(item.total_price || 0)}</Text>
|
||||
@@ -398,28 +414,30 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
<Text>Warehouse Name</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellHeader}>
|
||||
<Text>PIC</Text>
|
||||
<Text>Area</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellHeader}>
|
||||
<Text>Address Detail</Text>
|
||||
<Text>Location Address</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellHeaderLast}>
|
||||
<Text>Product Allocation</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View style={pdfStyles.tableRow}>
|
||||
{purchaseData?.items?.map((item, itemIndex) => (
|
||||
<View key={itemIndex} style={pdfStyles.tableRow}>
|
||||
<View style={pdfStyles.tableCell}>
|
||||
<Text>{purchaseData?.warehouse?.name || '-'}</Text>
|
||||
<Text>{item.warehouse?.name || '-'}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCell}>
|
||||
<Text>{purchaseData?.created_user?.name || '-'}</Text>
|
||||
<Text style={{ fontSize: 8 }}>
|
||||
{purchaseData?.created_user?.email || '-'}
|
||||
<Text>{item.warehouse?.area?.name || '-'}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCell}>
|
||||
<Text>
|
||||
{item.warehouse?.type === 'LOKASI'
|
||||
? item.warehouse.location.address
|
||||
: '-'}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCell}>
|
||||
<Text>{purchaseData?.location?.name || '-'}</Text>
|
||||
</View>
|
||||
<View style={pdfStyles.tableCellLast}>
|
||||
{/* Inner table for product allocation */}
|
||||
<View style={pdfStyles.innerTable}>
|
||||
@@ -435,22 +453,21 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
Quantity
|
||||
</Text>
|
||||
</View>
|
||||
{/* Data rows */}
|
||||
{purchaseData?.items?.map((item, index) => (
|
||||
<View key={index} style={pdfStyles.innerRow}>
|
||||
{/* Data row */}
|
||||
<View style={pdfStyles.innerRow}>
|
||||
<Text style={pdfStyles.innerCell}>
|
||||
{item.product?.name || '-'}
|
||||
</Text>
|
||||
<Text style={pdfStyles.innerCellRightLast}>
|
||||
{formatNumber(item.total_qty || 0)}
|
||||
{formatNumber(item.sub_qty || 0)}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)) || []}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Footer with Special Instructions */}
|
||||
<View style={pdfStyles.footer}>
|
||||
@@ -467,7 +484,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
|
||||
</View>
|
||||
</View>
|
||||
<View style={pdfStyles.footerCompany}>
|
||||
<Text>PT MITRA BERLIAN UNGGAS</Text>
|
||||
<Text>PT LUMBUNG TELUR INDONESIA</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user