feat: Implement email task import functionality
- Added `import_tasks_from_email` method in `Cron` class to handle task imports from email. - Created `MailToTaskImporter` class for processing emails and creating tasks based on their content. - Updated configuration to include IMAP settings for email import. - Enhanced `Tasks` class with a method to change the client associated with a task. - Modified task details view to include a dropdown for selecting clients. - Improved task timer functionality with separate start and stop functions. - Added logic to handle task work duration validation. - Updated JavaScript to manage task timers and client changes more effectively.
This commit is contained in:
@@ -130,9 +130,16 @@
|
||||
</div>
|
||||
<div class="client box">
|
||||
<h3>Klient</h3>
|
||||
<? if ( $this -> task['client_id'] ):?>
|
||||
<?= \factory\Crm::get_client_name( $this -> task['client_id'] );?>
|
||||
<? endif;?>
|
||||
<div class="current_client">
|
||||
<select name="task_client" class="form-control task_client_select" task_id="<?= $this -> task['id'];?>">
|
||||
<option value="0">-- brak --</option>
|
||||
<? if ( is_array( $this -> clients ) ): foreach ( $this -> clients as $client ):?>
|
||||
<option value="<?= (int)$client['id'];?>" <? if ( (int)$this -> task['client_id'] === (int)$client['id'] ):?>selected="selected"<? endif;?>>
|
||||
<?= htmlspecialchars( $client['firm'] );?>
|
||||
</option>
|
||||
<? endforeach; endif;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="time box">
|
||||
<h3>Przepracowany czas</h3>
|
||||
@@ -168,6 +175,24 @@
|
||||
if ( !popup.length )
|
||||
return;
|
||||
|
||||
if ( $.fn.select2 )
|
||||
{
|
||||
var client_select = popup.find( '.task_client_select' );
|
||||
client_select.select2({
|
||||
width: '100%',
|
||||
placeholder: 'Wybierz klienta',
|
||||
dropdownParent: popup
|
||||
});
|
||||
|
||||
client_select.on( 'select2:open', function() {
|
||||
setTimeout( function() {
|
||||
var search_field = document.querySelector( '.select2-container--open .select2-search__field' );
|
||||
if ( search_field )
|
||||
search_field.focus();
|
||||
}, 0 );
|
||||
} );
|
||||
}
|
||||
|
||||
var time_worked = popup.find( '.time_worked' );
|
||||
var time_value = popup.find( '.js-time-worked-value' );
|
||||
var total_seconds = parseInt( time_worked.attr( 'data-total-seconds' ), 10 ) || 0;
|
||||
|
||||
Reference in New Issue
Block a user