@@ -16,6 +16,10 @@ import ProductsIndex from './components/ProductsIndex.jsx';
1616import QuoteLinesIndex from './components/QuoteLinesIndex.jsx' ;
1717import OrderLinesIndex from './components/OrderLinesIndex.jsx' ;
1818import SetupWizard from './components/SetupWizard.jsx' ;
19+ import CompanyDashboard from './components/CompanyDashboard.jsx' ;
20+ import CompanyForm from './components/CompanyForm.jsx' ;
21+ import CompanyAddresses from './components/CompanyAddresses.jsx' ;
22+ import CompanyContacts from './components/CompanyContacts.jsx' ;
1923// livewire-sortable ne doit être chargé que sur les pages qui embarquent Livewire
2024document . addEventListener ( 'livewire:init' , ( ) => {
2125 import ( 'livewire-sortable' ) ;
@@ -208,11 +212,12 @@ function mountInvoicesIndex() {
208212
209213 createRoot ( element ) . render (
210214 React . createElement ( InvoicesIndex , {
211- kpi : parse ( 'kpi' ) ?? { } ,
212- chartData : parse ( 'chart' ) ?? { } ,
213- topClients : parse ( 'topClients' ) ?? [ ] ,
214- endpoints : parse ( 'endpoints' ) ?? { } ,
215- trans : parse ( 'trans' ) ?? { } ,
215+ kpi : parse ( 'kpi' ) ?? { } ,
216+ chartData : parse ( 'chart' ) ?? { } ,
217+ topClients : parse ( 'topClients' ) ?? [ ] ,
218+ endpoints : parse ( 'endpoints' ) ?? { } ,
219+ trans : parse ( 'trans' ) ?? { } ,
220+ companieId : element . dataset . companieId ? parseInt ( element . dataset . companieId , 10 ) : null ,
216221 } )
217222 ) ;
218223}
@@ -253,6 +258,79 @@ function mountCompaniesIndex() {
253258 ) ;
254259}
255260
261+ function mountCompanyForm ( ) {
262+ const element = document . getElementById ( 'company-form-app' ) ;
263+ if ( ! element ) return ;
264+
265+ const parse = ( attr ) => {
266+ try { return JSON . parse ( element . dataset [ attr ] ?? 'null' ) ; } catch { return null ; }
267+ } ;
268+
269+ createRoot ( element ) . render (
270+ React . createElement ( CompanyForm , {
271+ company : parse ( 'company' ) ?? { } ,
272+ users : parse ( 'users' ) ?? [ ] ,
273+ endpoint : element . dataset . endpoint ?? '' ,
274+ trans : parse ( 'trans' ) ?? { } ,
275+ } )
276+ ) ;
277+ }
278+
279+ function mountCompanyDashboard ( ) {
280+ const element = document . getElementById ( 'company-dashboard-app' ) ;
281+ if ( ! element ) return ;
282+
283+ const parse = ( attr ) => {
284+ try { return JSON . parse ( element . dataset [ attr ] ?? 'null' ) ; } catch { return null ; }
285+ } ;
286+
287+ createRoot ( element ) . render (
288+ React . createElement ( CompanyDashboard , {
289+ kpi : parse ( 'kpi' ) ?? { } ,
290+ charts : parse ( 'charts' ) ?? { } ,
291+ trans : parse ( 'trans' ) ?? { } ,
292+ } )
293+ ) ;
294+ }
295+
296+ function mountCompanyAddresses ( ) {
297+ const element = document . getElementById ( 'company-addresses-app' ) ;
298+ if ( ! element ) return ;
299+
300+ const parse = ( attr ) => {
301+ try { return JSON . parse ( element . dataset [ attr ] ?? 'null' ) ; } catch { return null ; }
302+ } ;
303+
304+ createRoot ( element ) . render (
305+ React . createElement ( CompanyAddresses , {
306+ initialAddresses : parse ( 'addresses' ) ?? [ ] ,
307+ storeUrl : element . dataset . storeUrl ?? '' ,
308+ updateBaseUrl : element . dataset . updateBaseUrl ?? '' ,
309+ companieId : element . dataset . companieId ? parseInt ( element . dataset . companieId , 10 ) : null ,
310+ trans : parse ( 'trans' ) ?? { } ,
311+ } )
312+ ) ;
313+ }
314+
315+ function mountCompanyContacts ( ) {
316+ const element = document . getElementById ( 'company-contacts-app' ) ;
317+ if ( ! element ) return ;
318+
319+ const parse = ( attr ) => {
320+ try { return JSON . parse ( element . dataset [ attr ] ?? 'null' ) ; } catch { return null ; }
321+ } ;
322+
323+ createRoot ( element ) . render (
324+ React . createElement ( CompanyContacts , {
325+ initialContacts : parse ( 'contacts' ) ?? [ ] ,
326+ storeUrl : element . dataset . storeUrl ?? '' ,
327+ updateBaseUrl : element . dataset . updateBaseUrl ?? '' ,
328+ companieId : element . dataset . companieId ? parseInt ( element . dataset . companieId , 10 ) : null ,
329+ trans : parse ( 'trans' ) ?? { } ,
330+ } )
331+ ) ;
332+ }
333+
256334function mountSetupWizard ( ) {
257335 const element = document . getElementById ( 'setup-wizard-app' ) ;
258336 if ( ! element ) return ;
@@ -270,6 +348,10 @@ function mountSetupWizard() {
270348}
271349
272350mountSetupWizard ( ) ;
351+ mountCompanyDashboard ( ) ;
352+ mountCompanyForm ( ) ;
353+ mountCompanyAddresses ( ) ;
354+ mountCompanyContacts ( ) ;
273355mountKanbanBoard ( ) ;
274356mountDocumentTable ( ) ;
275357mountCompaniesIndex ( ) ;
0 commit comments