This commit is contained in:
seb
2026-10-04 21:04:40 +02:00
parent 669954b496
commit f765b87336
59 changed files with 1491 additions and 2045 deletions

View File

@@ -0,0 +1,28 @@
import { quote as quoteApi } from '../api';
import { createListAutomat } from './createListAutomat';
/**
* @typedef {Object} QuoteSummary
* @property {string|number} id Quote id.
* @property {string} number Quote number.
* @property {string} type Always `'quote'`.
* @property {string|number|null} entityId Customer id.
* @property {string} date Expiry date (ISO).
*/
/**
* Company sales quotes (`GET /api/quote`).
*
* @type {import('react-automat').Automat<import('./createListAutomat').ListAutomatState>}
*/
export const quoteAutomat = createListAutomat({
name: 'quote',
fetch: async () => {
const data = await quoteApi.list();
return data.quotes ?? [];
},
sort: (items) =>
[...items].sort((a, b) => String(b.date).localeCompare(String(a.date))),
});
export default quoteAutomat;