@@ -6,6 +6,26 @@ import Modal from '../shared/Modal'
66const get_attendees = ( appointment_attendees , apt_id ) => ( appointment_attendees && appointment_attendees [ apt_id ] ) || [ ]
77const NEW_STUDENT_ID = 999999999
88
9+ const AptDetails = ( { apt, spaces_available, props} ) => (
10+ < div className = "tcs-modal-flex" >
11+ < div className = "tcs-extra" >
12+ < div className = "tcs-price" >
13+ { props . config . format_money ( apt . price ) }
14+ < div className = "tcs-label" > Price</ div >
15+ </ div >
16+ </ div >
17+ < div className = "tcs-content" >
18+ < DetailGrid >
19+ < Detail label = "Job" > { apt . service_name } </ Detail >
20+ { apt . attendees_max && < Detail label = "Spaces Available" > { spaces_available } </ Detail > }
21+ < Detail label = "Start" className = "tcs-new-line" > { props . config . format_datetime ( apt . start ) } </ Detail >
22+ < Detail label = "Finish" > { props . config . format_datetime ( apt . finish ) } </ Detail >
23+ { apt . location && < Detail label = "Location" > { apt . location } </ Detail > }
24+ </ DetailGrid >
25+ </ div >
26+ </ div >
27+ )
28+
929const AddExisting = ( { students, book, booking_allowed, get_text} ) => (
1030 students && students . length > 0 &&
1131 < div className = "tcs-book-existing" >
@@ -157,24 +177,7 @@ class AptModal extends Component {
157177 const booking_allowed = this . state . booking_allowed && spaces_available > 0
158178 return (
159179 < Modal history = { this . props . history } title = { title } last_url = { this . props . last_url } flex = { false } >
160- < div className = "tcs-modal-flex" >
161- < div className = "tcs-extra" >
162- < div className = "tcs-price" >
163- { this . props . config . format_money ( apt . price ) }
164- < div className = "tcs-label" > Price</ div >
165- </ div >
166- </ div >
167- < div className = "tcs-content" >
168- < DetailGrid >
169- < Detail label = "Job" > { apt . service_name } </ Detail >
170- { apt . attendees_max && < Detail label = "Spaces Available" > { spaces_available } </ Detail > }
171- < Detail label = "Start" className = "tcs-new-line" > { this . props . config . format_datetime ( apt . start ) } </ Detail >
172- < Detail label = "Finish" > { this . props . config . format_datetime ( apt . finish ) } </ Detail >
173- { apt . location && < Detail label = "Location" > { apt . location } </ Detail > }
174- </ DetailGrid >
175- </ div >
176- </ div >
177-
180+ < AptDetails apt = { apt } spaces_available = { spaces_available } props = { this . props } />
178181 < div >
179182 < DisplayExtraAttrs extra_attributes = { apt . service_extra_attributes } />
180183 < div className = "tcs-book" >
@@ -183,17 +186,17 @@ class AptModal extends Component {
183186 < AddExisting students = { students }
184187 book = { this . book }
185188 booking_allowed = { booking_allowed }
186- get_text = { this . props . root . get_text } />
189+ get_text = { this . props . config . get_text } />
187190 < AddNew new_student = { this . state . new_student }
188191 onChange = { e => this . setState ( { new_student : e . target . value } ) }
189192 book = { this . book }
190193 booking_allowed = { booking_allowed }
191- get_text = { this . props . root . get_text } />
194+ get_text = { this . props . config . get_text } />
192195 </ div >
193196 </ If >
194197 < If v = { ! this . state . display_data && booking_allowed } >
195198 < button className = "tcs-button tcs-signin" onClick = { this . props . signin } >
196- { this . props . root . get_text ( 'book_appointment_button' ) }
199+ { this . props . config . get_text ( 'book_appointment_button' ) }
197200 </ button >
198201 </ If >
199202 </ div >
0 commit comments