Skip to content

Commit 89c19d7

Browse files
authored
Merge pull request #10 from devaslanphp/dev
Dev
2 parents 2ef8a87 + fda6957 commit 89c19d7

72 files changed

Lines changed: 4426 additions & 684 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Console/Commands/TranslateMissing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function handle()
5050
$newLocaleTranslations[$kbt] = $localeTranslations[$kbt];
5151
}
5252
}
53-
File::put($filePath, json_encode($newLocaleTranslations, JSON_UNESCAPED_UNICODE));
53+
File::put($filePath, json_encode($newLocaleTranslations, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT));
5454
}
5555
}
5656
$bar->advance();

app/Exports/TicketHoursExport.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function headings(): array
2525
'Time',
2626
'Hours',
2727
'Date',
28+
'Comment',
2829
];
2930
}
3031

@@ -41,6 +42,7 @@ public function collection()
4142
'time' => $item->forHumans,
4243
'hours' => number_format($item->value, 2, ',', ' '),
4344
'date' => $item->created_at->format(__('Y-m-d g:i A')),
45+
'comment' => $item->comment
4446
]);
4547
}
4648
}

app/Filament/Resources/TicketResource/Pages/ViewTicket.php

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Models\TicketHour;
99
use App\Models\TicketSubscriber;
1010
use Filament\Forms\Components\RichEditor;
11+
use Filament\Forms\Components\Textarea;
1112
use Filament\Forms\Components\TextInput;
1213
use Filament\Forms\Components\TimePicker;
1314
use Filament\Forms\Concerns\InteractsWithForms;
@@ -81,35 +82,41 @@ protected function getActions(): array
8182
'url' => route('filament.resources.tickets.share', $this->record->code)
8283
])),
8384
Actions\EditAction::make(),
85+
Actions\Action::make('logHours')
86+
->label(__('Log time'))
87+
->icon('heroicon-o-clock')
88+
->color('warning')
89+
->modalWidth('sm')
90+
->modalHeading(__('Log worked time'))
91+
->modalSubheading(__('Use the following form to add your worked time in this ticket.'))
92+
->modalButton(__('Log'))
93+
->visible(fn() => in_array(
94+
auth()->user()->id,
95+
[$this->record->owner_id, $this->record->responsible_id]
96+
))
97+
->form([
98+
TextInput::make('time')
99+
->label(__('Time to log'))
100+
->numeric()
101+
->required(),
102+
103+
Textarea::make('comment')
104+
->label(__('Comment'))
105+
->rows(3),
106+
])
107+
->action(function (Collection $records, array $data): void {
108+
$value = $data['time'];
109+
$comment = $data['comment'];
110+
TicketHour::create([
111+
'ticket_id' => $this->record->id,
112+
'user_id' => auth()->user()->id,
113+
'value' => $value,
114+
'comment' => $comment
115+
]);
116+
$this->record->refresh();
117+
$this->notify('success', __('Time logged into ticket'));
118+
}),
84119
Actions\ActionGroup::make([
85-
Actions\Action::make('logHours')
86-
->label(__('Log time'))
87-
->icon('heroicon-o-clock')
88-
->color('warning')
89-
->modalWidth('sm')
90-
->modalHeading(__('Log worked time'))
91-
->modalSubheading(__('Use the following form to add your worked time in this ticket.'))
92-
->modalButton(__('Log'))
93-
->visible(fn() => in_array(
94-
auth()->user()->id,
95-
[$this->record->owner_id, $this->record->responsible_id]
96-
))
97-
->form([
98-
TextInput::make('time')
99-
->label(__('Time to log'))
100-
->numeric()
101-
->required()
102-
])
103-
->action(function (Collection $records, array $data): void {
104-
$value = $data['time'];
105-
TicketHour::create([
106-
'ticket_id' => $this->record->id,
107-
'user_id' => auth()->user()->id,
108-
'value' => $value
109-
]);
110-
$this->record->refresh();
111-
$this->notify('success', __('Time logged into ticket'));
112-
}),
113120
Actions\Action::make('exportLogHours')
114121
->label(__('Export time logged'))
115122
->icon('heroicon-o-document-download')

app/Models/TicketHour.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TicketHour extends Model
1313
use HasFactory;
1414

1515
protected $fillable = [
16-
'user_id', 'ticket_id', 'value'
16+
'user_id', 'ticket_id', 'value', 'comment'
1717
];
1818

1919
public function user(): BelongsTo

0 commit comments

Comments
 (0)