Added lan_id to more places

This commit is contained in:
Anna-Sara Sélea 2026-02-25 21:45:02 +01:00
parent bec32c5fb4
commit b42be16c46
2 changed files with 16 additions and 11 deletions

View file

@ -12,6 +12,7 @@ interface CustomerProps {
name: string
customer_group_id: string,
is_in_group: boolean
lan_id: number
}],
};
@ -20,7 +21,7 @@ type Customer = {
name: string
customer_group_id: string,
is_in_group: boolean
lan_id: number
};
interface CustomerGroupProps {
@ -32,6 +33,7 @@ interface CustomerGroupProps {
name: string
customer_group_id: string,
is_in_group: boolean
lan_id: number
}],
}]
};
@ -44,6 +46,7 @@ type CustomerGroup = {
name: string
customer_group_id: string,
is_in_group: boolean
lan_id: number
}],
};
@ -86,7 +89,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
setSearchItemCustomers(searchTerm)
const filteredItems = customers.filter((customer) =>
customer.name.toLowerCase().includes(searchTerm.toLowerCase())
customer.name.toLowerCase().includes(searchTerm.toLowerCase()) || String(customer.lan_id).includes(searchTerm)
);
setFilteredCustomers(filteredItems);
@ -161,7 +164,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
setSearchItemCustomersAddToGroup(searchTerm)
const filteredItems = customers.filter((customer) =>
customer.name.toLowerCase().includes(searchTerm.toLowerCase())
customer.name.toLowerCase().includes(searchTerm.toLowerCase()) || String(customer.lan_id).includes(searchTerm)
);
setFilteredCustomersAddToGroup(filteredItems);
@ -211,7 +214,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
.map( customer => {
return <label className='checkbox'>
<input type="checkbox" className='mr-2' data-id={customer.id} onClick={handleCheckBoxChangeAddToGroup}/>
{customer.id}. {customer.name}
{customer.lan_id}. {customer.name}
</label>
})}
</div>
@ -228,7 +231,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
.filter((filteredCustomer) => checkboxesAddToGroup.includes("" + filteredCustomer.id))
.map( customer => {
return <p key={customer.id} className='mr-2 tag'>
{customer.id}. {customer.name}
{customer.lan_id}. {customer.name}
</p>
})}
@ -281,7 +284,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
.map( customer => {
return <label key={customer.id} className='checkbox'>
<input type="checkbox" className='mr-2' data-id={customer.id} onClick={handleCheckBoxChange}/>
{customer.id}. {customer.name}
{customer.lan_id}. {customer.name}
</label>
})}
</div>
@ -298,7 +301,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
.filter((filteredCustomer) => checkboxes.includes("" + filteredCustomer.id))
.map( customer => {
return <p key={customer.id} className='mr-2 tag'>
{customer.id}. {customer.name}
{customer.lan_id}. {customer.name}
</p>
})}
@ -354,7 +357,7 @@ export default function CustomerGroups({groups, customers} :( CustomerGroupProps
<ul>
{ group.customers.length > 0 && group.customers.filter((customer) => customer.is_in_group).map( customer => {
return <div className='is-flex gap-4 border-b p-2 is-justify-content-space-between'>
<p className="is-size-5">{customer.id}. {customer.name}</p>
<p className="is-size-5">{customer.lan_id}. {customer.name}</p>
<button onClick={() => deleteCustomerFromGroup(customer.id)} className="button is-danger is-outlined is-small">
<span>Ta bort från grupp</span>
</button>

View file

@ -11,6 +11,7 @@ interface CustomerProps {
name: string
group_id: string,
is_group: boolean
lan_id: number
}],
};
@ -19,6 +20,7 @@ type Customer = {
name: string
group_id: string,
is_group: boolean
lan_id: number
};
@ -34,7 +36,7 @@ export default function Dashboard({ customers }: CustomerProps) {
setSearchItem(searchTerm)
const filteredItems = customers.filter((customer) =>
customer.name.toLowerCase().includes(searchTerm.toLowerCase())
customer.name.toLowerCase().includes(searchTerm.toLowerCase()) || String(customer.lan_id).includes(searchTerm)
);
setFilteredCustomers(filteredItems);
@ -80,8 +82,8 @@ export default function Dashboard({ customers }: CustomerProps) {
<div className='container is-centered'>
{filteredCustomers && filteredCustomers.map(customer => {
return <a key={customer.id} className="box customer-box is-flex is-justify-content-space-between" href={`/customer/` + customer.id}>
{customer.is_group && <p>{customer.name}</p> }
{! customer.is_group && <p>{customer.id}. {customer.name}</p> }
{! customer.lan_id && <p>{customer.name}</p> }
{customer.lan_id && <p>{customer.lan_id}. {customer.name}</p> }
<span className="icon has-text-black">
<FontAwesomeIcon icon={faArrowRight} />
</span>