Skip to content

Commit

Permalink
Merge pull request #22 from devaslanphp/dev
Browse files Browse the repository at this point in the history
Ticket attachments
  • Loading branch information
heloufir authored Jan 5, 2023
2 parents 7d78c23 + c954e76 commit c43f5d1
Show file tree
Hide file tree
Showing 67 changed files with 478 additions and 63 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
- **Release 1.1.5**
- Add comment field to ticket hours logging
- **Release 1.1.6**
- Edit ticket epic details
- PR #13 made by @mihaisolomon
- Edit ticket epic details
- PR #13 made by @mihaisolomon
- **Release 1.1.7**
- Ticket attachments

## Support us

Expand Down
61 changes: 61 additions & 0 deletions app/Http/Livewire/Ticket/Attachments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace App\Http\Livewire\Ticket;

use App\Models\Ticket;
use Filament\Facades\Filament;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Illuminate\Database\Eloquent\Model;
use Livewire\Component;

class Attachments extends Component implements HasForms
{
use InteractsWithForms;

public Ticket $ticket;

public function mount(): void
{
$this->form->fill([
'attachments' => $this->ticket->attachments
]);
}

public function render()
{
return view('livewire.ticket.attachments');
}

protected function getFormModel(): Model|string|null
{
return $this->ticket;
}

protected function getFormSchema(): array
{
return [
FileUpload::make('attachments')
->label(__('Attachments'))
->hint(__('Important: If a file has the same name, it will be replaced'))
->helperText(__('Here you can attach all files needed for this ticket'))
->multiple()
->disablePreview()
->enableReordering()
->enableOpen()
->preserveFilenames()
->enableDownload()
->directory(fn() => 'tickets/' . $this->ticket->code)
];
}

public function perform(): void
{
$data = $this->form->getState();
$this->ticket->attachments = $data['attachments'];
$this->ticket->save();
$this->ticket->refresh();
Filament::notify('success', __('Ticket attachments saved'));
}
}
6 changes: 5 additions & 1 deletion app/Models/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ class Ticket extends Model
protected $fillable = [
'name', 'content', 'owner_id', 'responsible_id',
'status_id', 'project_id', 'code', 'order', 'type_id',
'priority_id', 'estimation', 'epic_id'
'priority_id', 'estimation', 'epic_id', 'attachments',
];

protected $casts = [
'attachments' => 'array',
];

public static function boot()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tickets', function (Blueprint $table) {
$table->longText('attachments')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tickets', function (Blueprint $table) {
$table->dropColumn('attachments');
});
}
};
7 changes: 6 additions & 1 deletion lang/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "تم حفظ التذكرة بنجاح",
"Parent epic": "ملحمة الوالدين",
"Road Map chart is only available on large screen": "مخطط خريطة الطريق متاح فقط على الشاشة الكبيرة",
"Comment": "تعليق"
"Comment": "تعليق",
"Attachments": "المرفقات",
"Here you can attach all files needed for this ticket": "هنا يمكنك إرفاق جميع الملفات المطلوبة لهذه التذكرة",
"Submit": "يُقدِّم",
"Ticket attachments saved": "تم حفظ مرفقات التذاكر",
"Important: If a file has the same name, it will be replaced": "هام: إذا كان الملف يحمل نفس الاسم ، فسيتم استبداله"
}
7 changes: 6 additions & 1 deletion lang/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Bilet uğurla yadda saxlanıldı",
"Parent epic": "Valideyn epik",
"Road Map chart is only available on large screen": "Yol Xəritəsi diaqramı yalnız böyük ekranda mövcuddur",
"Comment": "Şərh"
"Comment": "Şərh",
"Attachments": "Qoşmalar",
"Here you can attach all files needed for this ticket": "Burada bu bilet üçün lazım olan bütün faylları əlavə edə bilərsiniz",
"Submit": "təqdim",
"Ticket attachments saved": "Bilet qoşmaları yadda saxlanıldı",
"Important: If a file has the same name, it will be replaced": "Vacib: Əgər fayl eyni ada malikdirsə, o, dəyişdiriləcək"
}
7 changes: 6 additions & 1 deletion lang/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Білет паспяхова захаваны",
"Parent epic": "Бацькоўскі эпас",
"Road Map chart is only available on large screen": "Дарожная карта даступная толькі на вялікім экране",
"Comment": "Каментуйце"
"Comment": "Каментуйце",
"Attachments": "Дадаткі",
"Here you can attach all files needed for this ticket": "Тут вы можаце далучыць усе файлы, неабходныя для гэтага білета",
"Submit": "Падаць",
"Ticket attachments saved": "Дадаткі да квіткоў захаваны",
"Important: If a file has the same name, it will be replaced": "Важна: калі файл мае такую ​​ж назву, ён будзе заменены"
}
7 changes: 6 additions & 1 deletion lang/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Билетът е запазен успешно",
"Parent epic": "Родителски епос",
"Road Map chart is only available on large screen": "Диаграмата на пътната карта е достъпна само на голям екран",
"Comment": "Коментирайте"
"Comment": "Коментирайте",
"Attachments": "Прикачени файлове",
"Here you can attach all files needed for this ticket": "Тук можете да прикачите всички файлове, необходими за този билет",
"Submit": "Изпращане",
"Ticket attachments saved": "Прикачените файлове към билетите са запазени",
"Important: If a file has the same name, it will be replaced": "Важно: Ако файл има същото име, той ще бъде заменен"
}
7 changes: 6 additions & 1 deletion lang/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "টিকিট সফলভাবে সংরক্ষিত হয়েছে৷",
"Parent epic": "অভিভাবক মহাকাব্য",
"Road Map chart is only available on large screen": "রোড ম্যাপ চার্ট শুধুমাত্র বড় স্ক্রিনে উপলব্ধ",
"Comment": "মন্তব্য করুন"
"Comment": "মন্তব্য করুন",
"Attachments": "সংযুক্তি",
"Here you can attach all files needed for this ticket": "এখানে আপনি এই টিকিটের জন্য প্রয়োজনীয় সমস্ত ফাইল সংযুক্ত করতে পারেন",
"Submit": "জমা দিন",
"Ticket attachments saved": "টিকিট সংযুক্তি সংরক্ষিত",
"Important: If a file has the same name, it will be replaced": "গুরুত্বপূর্ণ: যদি একটি ফাইলের নাম একই থাকে তবে এটি প্রতিস্থাপন করা হবে"
}
7 changes: 6 additions & 1 deletion lang/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Karta je uspješno sačuvana",
"Parent epic": "Parent epic",
"Road Map chart is only available on large screen": "Mapa puta je dostupna samo na velikom ekranu",
"Comment": "Komentar"
"Comment": "Komentar",
"Attachments": "Prilozi",
"Here you can attach all files needed for this ticket": "Ovdje možete priložiti sve datoteke potrebne za ovu kartu",
"Submit": "Submit",
"Ticket attachments saved": "Prilozi ulaznica su sačuvani",
"Important: If a file has the same name, it will be replaced": "Važno: Ako datoteka ima isto ime, bit će zamijenjena"
}
7 changes: 6 additions & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "El bitllet s'ha desat correctament",
"Parent epic": "Èpica dels pares",
"Road Map chart is only available on large screen": "El gràfic del full de ruta només està disponible a la pantalla gran",
"Comment": "Comenta"
"Comment": "Comenta",
"Attachments": "Adjunts",
"Here you can attach all files needed for this ticket": "Aquí podeu adjuntar tots els fitxers necessaris per a aquest bitllet",
"Submit": "Presentar",
"Ticket attachments saved": "S'han desat els fitxers adjunts de les entrades",
"Important: If a file has the same name, it will be replaced": "Important: si un fitxer té el mateix nom, se substituirà"
}
7 changes: 6 additions & 1 deletion lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Lístek byl úspěšně uložen",
"Parent epic": "Rodičovský epos",
"Road Map chart is only available on large screen": "Cestovní mapa je k dispozici pouze na velké obrazovce",
"Comment": "Komentář"
"Comment": "Komentář",
"Attachments": "Přílohy",
"Here you can attach all files needed for this ticket": "Zde můžete připojit všechny soubory potřebné pro tento tiket",
"Submit": "Předložit",
"Ticket attachments saved": "Přílohy lístků uloženy",
"Important: If a file has the same name, it will be replaced": "Důležité: Pokud má soubor stejný název, bude nahrazen"
}
7 changes: 6 additions & 1 deletion lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Llwyddwyd i gadw'r tocyn",
"Parent epic": "Rhiant epig",
"Road Map chart is only available on large screen": "Mae siart Map Ffordd ar gael ar sgrin fawr yn unig",
"Comment": "Sylw"
"Comment": "Sylw",
"Attachments": "Ymlyniadau",
"Here you can attach all files needed for this ticket": "Yma gallwch atodi'r holl ffeiliau sydd eu hangen ar gyfer y tocyn hwn",
"Submit": "Cyflwyno",
"Ticket attachments saved": "Atodion tocynnau wedi'u cadw",
"Important: If a file has the same name, it will be replaced": "Pwysig: Os oes gan ffeil yr un enw, caiff ei disodli"
}
7 changes: 6 additions & 1 deletion lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Billetten blev gemt",
"Parent epic": "Forældre-epos",
"Road Map chart is only available on large screen": "Vejkort er kun tilgængeligt på storskærm",
"Comment": "Kommentar"
"Comment": "Kommentar",
"Attachments": "Vedhæftede filer",
"Here you can attach all files needed for this ticket": "Her kan du vedhæfte alle nødvendige filer til denne billet",
"Submit": "Indsend",
"Ticket attachments saved": "Billetvedhæftede filer er gemt",
"Important: If a file has the same name, it will be replaced": "Vigtigt: Hvis en fil har samme navn, vil den blive erstattet"
}
7 changes: 6 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Ticket erfolgreich gespeichert",
"Parent epic": "Elterliches Epos",
"Road Map chart is only available on large screen": "Das Straßenkartendiagramm ist nur auf einem großen Bildschirm verfügbar",
"Comment": "Kommentar"
"Comment": "Kommentar",
"Attachments": "Anhänge",
"Here you can attach all files needed for this ticket": "Hier können Sie alle Dateien anhängen, die für dieses Ticket benötigt werden",
"Submit": "einreichen",
"Ticket attachments saved": "Ticketanhänge gespeichert",
"Important: If a file has the same name, it will be replaced": "Wichtig: Wenn eine Datei denselben Namen hat, wird sie ersetzt"
}
7 changes: 6 additions & 1 deletion lang/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Το εισιτήριο αποθηκεύτηκε με επιτυχία",
"Parent epic": "Γονικό έπος",
"Road Map chart is only available on large screen": "Το γράφημα του οδικού χάρτη είναι διαθέσιμο μόνο σε μεγάλη οθόνη",
"Comment": "Σχόλιο"
"Comment": "Σχόλιο",
"Attachments": "Συνημμένα",
"Here you can attach all files needed for this ticket": "Εδώ μπορείτε να επισυνάψετε όλα τα αρχεία που χρειάζονται για αυτό το εισιτήριο",
"Submit": "υποβάλλουν",
"Ticket attachments saved": "Τα συνημμένα εισιτηρίων αποθηκεύτηκαν",
"Important: If a file has the same name, it will be replaced": "Σημαντικό: Εάν ένα αρχείο έχει το ίδιο όνομα, θα αντικατασταθεί"
}
7 changes: 6 additions & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Ticket guardado con éxito",
"Parent epic": "Epopeya de los padres",
"Road Map chart is only available on large screen": "El gráfico de hoja de ruta solo está disponible en pantalla grande",
"Comment": "Comentario"
"Comment": "Comentario",
"Attachments": "Archivos adjuntos",
"Here you can attach all files needed for this ticket": "Aquí puede adjuntar todos los archivos necesarios para este ticket",
"Submit": "Enviar",
"Ticket attachments saved": "Archivos adjuntos de entradas guardados",
"Important: If a file has the same name, it will be replaced": "Importante: si un archivo tiene el mismo nombre, será reemplazado"
}
7 changes: 6 additions & 1 deletion lang/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Pilet edukalt salvestatud",
"Parent epic": "Vanemaeepos",
"Road Map chart is only available on large screen": "Teekaardi diagramm on saadaval ainult suurel ekraanil",
"Comment": "Kommenteeri"
"Comment": "Kommenteeri",
"Attachments": "Manused",
"Here you can attach all files needed for this ticket": "Siin saate manustada kõik selle pileti jaoks vajalikud failid",
"Submit": "Esita",
"Ticket attachments saved": "Pileti manused salvestatud",
"Important: If a file has the same name, it will be replaced": "Tähtis. Kui failil on sama nimi, asendatakse see"
}
7 changes: 6 additions & 1 deletion lang/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Sarrera behar bezala gorde da",
"Parent epic": "Gurasoen epopeia",
"Road Map chart is only available on large screen": "Errepide-mapa grafikoa pantaila handian bakarrik dago eskuragarri",
"Comment": "Iruzkina"
"Comment": "Iruzkina",
"Attachments": "Eranskinak",
"Here you can attach all files needed for this ticket": "Hemen txartel honetarako behar diren fitxategi guztiak erantsi ditzakezu",
"Submit": "Bidali",
"Ticket attachments saved": "Gorde dira txartelaren eranskinak",
"Important: If a file has the same name, it will be replaced": "Garrantzitsua: fitxategi batek izen bera badu, ordezkatu egingo da"
}
7 changes: 6 additions & 1 deletion lang/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "بلیط با موفقیت ذخیره شد",
"Parent epic": "حماسه پدر و مادر",
"Road Map chart is only available on large screen": "نمودار نقشه راه فقط روی صفحه بزرگ در دسترس است",
"Comment": "اظهار نظر"
"Comment": "اظهار نظر",
"Attachments": "پیوست ها",
"Here you can attach all files needed for this ticket": "در اینجا می توانید تمام فایل های مورد نیاز برای این بلیط را پیوست کنید",
"Submit": "ارسال",
"Ticket attachments saved": "پیوست‌های بلیت ذخیره شدند",
"Important: If a file has the same name, it will be replaced": "مهم: اگر فایلی به همین نام باشد، جایگزین خواهد شد"
}
7 changes: 6 additions & 1 deletion lang/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Lippu tallennettu onnistuneesti",
"Parent epic": "Vanhempien eepos",
"Road Map chart is only available on large screen": "Tiekarttakaavio on käytettävissä vain suurella näytöllä",
"Comment": "Kommentti"
"Comment": "Kommentti",
"Attachments": "Liitteet",
"Here you can attach all files needed for this ticket": "Tänne voit liittää kaikki tähän lippuun tarvittavat tiedostot",
"Submit": "Lähetä",
"Ticket attachments saved": "Lippuliitteet tallennettu",
"Important: If a file has the same name, it will be replaced": "Tärkeää: Jos tiedostolla on sama nimi, se korvataan"
}
7 changes: 6 additions & 1 deletion lang/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Matagumpay na na-save ang tiket",
"Parent epic": "Epiko ng magulang",
"Road Map chart is only available on large screen": "Available lang ang tsart ng Road Map sa malaking screen",
"Comment": "Magkomento"
"Comment": "Magkomento",
"Attachments": "Mga kalakip",
"Here you can attach all files needed for this ticket": "Dito maaari mong ilakip ang lahat ng mga file na kailangan para sa tiket na ito",
"Submit": "Ipasa",
"Ticket attachments saved": "Na-save ang mga attachment ng ticket",
"Important: If a file has the same name, it will be replaced": "Mahalaga: Kung ang isang file ay may parehong pangalan, ito ay papalitan"
}
7 changes: 6 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "Ticket enregistré avec succès",
"Parent epic": "Epic parent",
"Road Map chart is only available on large screen": "Le graphique de la feuille de route n'est disponible que sur grand écran",
"Comment": "Commentaire"
"Comment": "Commentaire",
"Attachments": "Pièces jointes",
"Here you can attach all files needed for this ticket": "Ici vous pouvez joindre tous les fichiers nécessaires pour ce ticket",
"Submit": "Soumettre",
"Ticket attachments saved": "Pièces jointes au ticket enregistrées",
"Important: If a file has the same name, it will be replaced": "Important : Si un fichier porte le même nom, il sera remplacé"
}
7 changes: 6 additions & 1 deletion lang/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "O billete gardouse correctamente",
"Parent epic": "Épica dos pais",
"Road Map chart is only available on large screen": "O gráfico do mapa de estradas só está dispoñible na pantalla grande",
"Comment": "Comenta"
"Comment": "Comenta",
"Attachments": "Anexos",
"Here you can attach all files needed for this ticket": "Aquí podes anexar todos os ficheiros necesarios para este ticket",
"Submit": "Enviar",
"Ticket attachments saved": "Gardáronse os anexos dos tickets",
"Important: If a file has the same name, it will be replaced": "Importante: se un ficheiro ten o mesmo nome, substituirase"
}
7 changes: 6 additions & 1 deletion lang/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,10 @@
"Ticket successfully saved": "הכרטיס נשמר בהצלחה",
"Parent epic": "אפוס הורים",
"Road Map chart is only available on large screen": "תרשים מפת הדרכים זמין רק במסך גדול",
"Comment": "תגובה"
"Comment": "תגובה",
"Attachments": "קבצים מצורפים",
"Here you can attach all files needed for this ticket": "כאן תוכל לצרף את כל הקבצים הדרושים לכרטיס זה",
"Submit": "שלח",
"Ticket attachments saved": "קבצים מצורפים לכרטיסים נשמרו",
"Important: If a file has the same name, it will be replaced": "חשוב: אם לקובץ יש אותו שם, הוא יוחלף"
}
Loading

0 comments on commit c43f5d1

Please sign in to comment.