Prompt: when user logs in for the first time, they should see a modal asking to create an organization (only name input for organization). Keep the design similar to homepage/login/register in terms of color scheme. User should not be able to delete ALL organization they have, to have at least one is mendatory

Session:
Total cost:            $5.44 (costs may be inaccurate due to usage of unknown models)
Total duration (API):  50m 49s
Total duration (wall): 1h 10m 53s
Total code changes:    2972 lines added, 29 lines removed

Usage by model:
qwen/qwen3.6-35b-a3b:  287.3k input, 69.6k output, 11.5m cache read, 0 cache write ($5.37)
claude-haiku-4-5:  9.4k input, 13.3k output, 8.3k cache read, 0 cache write ($0.0767)

Runtime: llamacpp
Model: Qwen 3.6 35B A3B Q4 K M
Coding Agent: ClaudeCode
This commit is contained in:
Darius Rapalis
2026-04-29 11:15:16 +03:00
parent 8e65638401
commit b4b2fd8c1e
11 changed files with 2476 additions and 1 deletions

View File

@@ -357,5 +357,171 @@
</p>
</div>
</div>
{{-- Organization creation modal --}}
<div id="org-modal" class="org-modal" style="display: flex;">
<div class="org-modal-backdrop" data-close-modal></div>
<div class="org-modal-card">
<div class="org-modal__header">
<h2>Create your first organization</h2>
<p>Organizations help you group your projects and team members together.</p>
</div>
<div class="org-modal__body">
<div class="form-control">
<label for="org-name">Organization name</label>
<input type="text" id="org-name" name="name" placeholder="e.g. My Company" maxlength="255">
</div>
<p id="org-error" class="org-error" style="display:none;"></p>
</div>
<div class="org-modal__footer">
<button type="button" class="btn-cancel" data-close-modal>Cancel</button>
<button type="button" class="btn-primary" id="org-create-btn" onclick="createOrganization()">Create</button>
</div>
</div>
</div>
<script>
function createOrganization() {
const name = document.getElementById('org-name').value.trim();
const errorEl = document.getElementById('org-error');
const btn = document.getElementById('org-create-btn');
if (!name) {
errorEl.textContent = 'Please enter an organization name.';
errorEl.style.display = 'block';
return;
}
btn.textContent = 'Creating...';
btn.disabled = true;
errorEl.style.display = 'none';
fetch('{{ route("organizations.store") }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
},
body: JSON.stringify({ name: name })
})
.then(res => res.json())
.then(data => {
if (data.redirect) {
window.location.href = data.redirect;
} else if (data.errors) {
const messages = Object.values(data.errors).flat().join('\n');
errorEl.textContent = messages;
errorEl.style.display = 'block';
}
})
.catch(err => {
errorEl.textContent = 'Something went wrong. Please try again.';
errorEl.style.display = 'block';
})
.finally(() => {
btn.textContent = 'Create';
btn.disabled = false;
});
}
document.querySelectorAll('[data-close-modal]').forEach(el => {
el.addEventListener('click', () => {
document.getElementById('org-modal').style.display = 'none';
});
});
document.getElementById('org-name').addEventListener('input', function () {
document.getElementById('org-error').style.display = 'none';
});
document.getElementById('org-name').addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
e.preventDefault();
createOrganization();
}
});
</script>
<style>
.org-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 200;
align-items: center;
justify-content: center;
}
.org-modal-backdrop {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.org-modal-card {
position: relative;
background: var(--bg-white);
border-radius: 8px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 400px;
padding: 32px;
z-index: 1;
}
.org-modal__header {
margin-bottom: 24px;
}
.org-modal__header h2 {
font-size: 20px;
font-weight: 700;
color: var(--text-dark);
margin-bottom: 6px;
}
.org-modal__header p {
font-size: 14px;
color: var(--text-medium);
line-height: 1.5;
}
.org-modal__body {
margin-bottom: 24px;
}
.org-modal__footer {
display: flex;
justify-content: flex-end;
gap: 12px;
}
.btn-cancel {
padding: 10px 20px;
font-size: 14px;
font-weight: 600;
font-family: inherit;
color: var(--text-medium);
background: var(--bg-light);
border: 1px solid var(--border-color);
border-radius: 8px;
cursor: pointer;
transition: background-color 0.15s;
}
.btn-cancel:hover {
background: #e9e9ed;
}
.org-error {
color: var(--error-color);
font-size: 13px;
margin-top: 8px;
line-height: 1.4;
}
@media (max-width: 480px) {
.org-modal-card {
margin: 16px;
padding: 24px;
}
}
</style>
</body>
</html>