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

View file

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