diff --git a/app/Http/Controllers/CareerController.php b/app/Http/Controllers/CareerController.php
index 4599720..8c8b83a 100644
--- a/app/Http/Controllers/CareerController.php
+++ b/app/Http/Controllers/CareerController.php
@@ -208,22 +208,35 @@ class CareerController extends Controller
$request->validate([
'github_repo' => 'required|string|url|max:255',
+ 'github_username' => 'nullable|string|max:100',
], [
'github_repo.required' => 'Lütfen Github depo URL\'sini girin.',
'github_repo.url' => 'Geçerli bir URL girilmelidir.',
'github_repo.max' => 'Github depo URL\'si en fazla 255 karakter olabilir.',
+ 'github_username.max' => 'Github kullanıcı adı en fazla 100 karakter olabilir.',
]);
$intern = CareerApplication::findOrFail(session('intern_id'));
// Sanitize & format github URL
$repoUrl = trim($request->github_repo);
+ $username = trim($request->github_username);
$intern->update([
- 'github_repo' => $repoUrl
+ 'github_repo' => $repoUrl,
+ 'github_username' => $username ?: null,
]);
- return redirect()->back()->with('success', 'Github deposu başarıyla güncellendi.');
+ if ($request->expectsJson() || $request->ajax()) {
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Github bilgileri başarıyla güncellendi.',
+ 'github_repo' => $repoUrl,
+ 'github_username' => $username ?: null,
+ ]);
+ }
+
+ return redirect()->back()->with('success', 'Github bilgileri başarıyla güncellendi.');
}
public function downloadMarkdown()
diff --git a/app/Models/CareerApplication.php b/app/Models/CareerApplication.php
index 5444579..f975a49 100644
--- a/app/Models/CareerApplication.php
+++ b/app/Models/CareerApplication.php
@@ -30,6 +30,7 @@ class CareerApplication extends Model
'internship_end_date',
'internship_total_days',
'github_repo',
+ 'github_username',
'certificate_code',
'transcript_markdown',
'notebook_supervisor_signed',
diff --git a/database/migrations/2026_07_01_203644_add_github_username_to_career_applications_table.php b/database/migrations/2026_07_01_203644_add_github_username_to_career_applications_table.php
new file mode 100644
index 0000000..52a938d
--- /dev/null
+++ b/database/migrations/2026_07_01_203644_add_github_username_to_career_applications_table.php
@@ -0,0 +1,28 @@
+string('github_username')->nullable()->after('github_repo');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('career_applications', function (Blueprint $table) {
+ $table->dropColumn('github_username');
+ });
+ }
+};
diff --git a/resources/views/front/career/intern_dashboard.blade.php b/resources/views/front/career/intern_dashboard.blade.php
index c462f0e..19deb18 100644
--- a/resources/views/front/career/intern_dashboard.blade.php
+++ b/resources/views/front/career/intern_dashboard.blade.php
@@ -655,15 +655,23 @@
+
+
+
@push('styles')
@@ -888,8 +929,148 @@
});
const githubRepoUrl = @json($intern->github_repo);
+ let githubUsername = @json($intern->github_username);
let activeDayIdx = 0;
+ let activeCommitsToProcess = [];
+ let activeCommitsDateVal = '';
+
+ function openAuthorModal(uniqueAuthors) {
+ const modal = document.getElementById('author-modal');
+ const card = document.getElementById('author-modal-card');
+ const container = document.getElementById('author-list-container');
+ if (!modal || !card || !container) return;
+
+ container.innerHTML = '';
+
+ // 1. Add "Hepsi" (All commits) option
+ const allBtn = document.createElement('button');
+ allBtn.type = 'button';
+ allBtn.className = "w-full p-3 rounded-xl border border-slate-200 hover:border-blue-400 hover:bg-blue-50/20 text-left transition-all font-extrabold text-xs text-slate-700 flex items-center justify-between";
+ allBtn.innerHTML = `
+ Tüm Commitler (Filtreleme Yapma)
+
+ `;
+ allBtn.addEventListener('click', () => {
+ insertCommitsForAuthor(null);
+ });
+ container.appendChild(allBtn);
+
+ // 2. Add each unique author option
+ uniqueAuthors.forEach(author => {
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.className = "w-full p-3 rounded-xl border border-slate-200 hover:border-blue-400 hover:bg-blue-50/20 text-left transition-all font-extrabold text-xs text-slate-700 flex items-center justify-between mt-2";
+ btn.innerHTML = `
+ ${author}
+
+ `;
+ btn.addEventListener('click', () => {
+ insertCommitsForAuthor(author);
+ });
+ container.appendChild(btn);
+ });
+
+ modal.classList.remove('hidden');
+ setTimeout(() => {
+ card.classList.remove('scale-95', 'opacity-0');
+ card.classList.add('scale-100', 'opacity-100');
+ }, 10);
+ }
+
+ function closeAuthorModal() {
+ const modal = document.getElementById('author-modal');
+ const card = document.getElementById('author-modal-card');
+ if (!modal || !card) return;
+
+ card.classList.remove('scale-100', 'opacity-100');
+ card.classList.add('scale-95', 'opacity-0');
+ setTimeout(() => {
+ modal.classList.add('hidden');
+ }, 300);
+ }
+
+ function insertCommitsForAuthor(author) {
+ closeAuthorModal();
+
+ const savePref = document.getElementById('save-selected-author-pref');
+ if (author && savePref && savePref.checked) {
+ saveGithubUsernamePreference(author);
+ }
+
+ let dayCommits = activeCommitsToProcess;
+ if (author) {
+ dayCommits = activeCommitsToProcess.filter(item => {
+ const commitAuthorName = item.commit.author.name;
+ const commitAuthorLogin = item.author ? item.author.login : null;
+ return (commitAuthorLogin && commitAuthorLogin.toLowerCase() === author.toLowerCase()) ||
+ (commitAuthorName && commitAuthorName.toLowerCase() === author.toLowerCase());
+ });
+ }
+
+ renderCommitsToEditor(dayCommits);
+ }
+
+ function saveGithubUsernamePreference(username) {
+ if (!githubRepoUrl) return;
+
+ fetch("{{ route('intern.save-github') }}", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "X-CSRF-TOKEN": "{{ csrf_token() }}"
+ },
+ body: JSON.stringify({
+ github_repo: githubRepoUrl,
+ github_username: username
+ })
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ githubUsername = username;
+ const usernameInput = document.getElementById('github_username');
+ if (usernameInput) {
+ usernameInput.value = username;
+ }
+ }
+ })
+ .catch(err => {
+ console.warn("Kullanıcı adı tercihi kaydedilemedi.", err);
+ });
+ }
+
+ function renderCommitsToEditor(commitsList) {
+ if (commitsList.length === 0) {
+ alert("Bu yazar için seçilen güne ait commit bulunamadı.");
+ return;
+ }
+
+ let commitHtml = "";
+ const sorted = [...commitsList].reverse();
+ sorted.forEach(c => {
+ const msg = c.commit.message;
+ const sha = c.sha.substring(0, 7);
+ const authorDate = new Date(c.commit.author.date);
+ const time = authorDate.toLocaleTimeString('tr-TR', { timeZone: 'Europe/Istanbul', hour: '2-digit', minute: '2-digit' });
+ commitHtml += `- [${time}] (${sha}) ${msg}
`;
+ });
+ commitHtml += "
";
+
+ const currentHtml = quill.root.innerHTML.trim();
+ const headerHtml = "Git Commit Mesajları:
";
+
+ let newHtml = "";
+ if (currentHtml !== "" && currentHtml !== "
") {
+ newHtml = currentHtml + "
" + headerHtml + commitHtml;
+ } else {
+ newHtml = headerHtml + commitHtml;
+ }
+
+ quill.setContents([]);
+ quill.clipboard.dangerouslyPasteHTML(newHtml);
+ }
+
function hideFallbackCommits() {
const container = document.getElementById('git-commits-fallback-container');
if (container) {
@@ -1160,29 +1341,35 @@
return;
}
- let commitHtml = "";
- const sorted = [...dayCommits].reverse();
- sorted.forEach(c => {
- const msg = c.commit.message;
- const sha = c.sha.substring(0, 7);
- const authorDate = new Date(c.commit.author.date);
- const time = authorDate.toLocaleTimeString('tr-TR', { timeZone: 'Europe/Istanbul', hour: '2-digit', minute: '2-digit' });
- commitHtml += `- [${time}] (${sha}) ${msg}
`;
+ // Store these commits in memory for processing
+ activeCommitsToProcess = dayCommits;
+ activeCommitsDateVal = dateVal;
+
+ // Get unique authors
+ const authorsSet = new Set();
+ dayCommits.forEach(item => {
+ const login = item.author ? item.author.login : null;
+ const name = item.commit.author.name;
+ if (login) authorsSet.add(login);
+ if (name) authorsSet.add(name);
});
- commitHtml += "
";
+ const uniqueAuthors = Array.from(authorsSet);
- const currentHtml = quill.root.innerHTML.trim();
- const headerHtml = "Git Commit Mesajları:
";
-
- let newHtml = "";
- if (currentHtml !== "" && currentHtml !== "
") {
- newHtml = currentHtml + "
" + headerHtml + commitHtml;
+ // If there are multiple authors
+ if (uniqueAuthors.length > 1) {
+ // If we have a saved githubUsername that matches one of the unique authors
+ const matchedAuthor = uniqueAuthors.find(a => githubUsername && a.toLowerCase() === githubUsername.toLowerCase());
+ if (matchedAuthor) {
+ // Automatically filter and insert without modal
+ insertCommitsForAuthor(matchedAuthor);
+ } else {
+ // Show modal to choose
+ openAuthorModal(uniqueAuthors);
+ }
} else {
- newHtml = headerHtml + commitHtml;
+ // Only 1 author, insert directly
+ renderCommitsToEditor(dayCommits);
}
-
- quill.setContents([]);
- quill.clipboard.dangerouslyPasteHTML(newHtml);
})
.catch(err => {
alert("Commitler çekilirken hata oluştu: " + err.message);