fix: Admin ekranında birlik ekleme/düzenleme modalları eklendi

- UnitsContent.svelte componentine birlik ekleme modal formu eklendi
- Birlik düzenleme modal formu eklendi
- Modal stilleri ve responsive tasarım desteği eklendi
- Form validasyonları ve işlevselliği tamamen çalışır durumda
This commit is contained in:
2025-11-05 23:12:17 +03:00
parent 1b1e2a6fe0
commit 2a224f2f02

View File

@@ -299,8 +299,269 @@
{/if} {/if}
</div> </div>
<!-- Modal forms would go here - simplified for brevity --> <!-- Birlik Ekle Modal -->
<!-- You can copy the modal sections from the original file --> {#if showAddModal}
<div class="modal-overlay" on:click={closeModal}>
<div class="modal modal-large" on:click|stopPropagation>
<div class="modal-header">
<h2>Yeni Birlik Ekle</h2>
<button class="modal-close" on:click={closeModal}>×</button>
</div>
<form on:submit|preventDefault={handleAddUnit} class="modal-form">
<div class="form-section">
<h3>Birlik Bilgileri</h3>
<div class="form-group">
<label for="name">Birlik Adı</label>
<input
id="name"
type="text"
class="form-input"
bind:value={formData.name}
placeholder="1. Motorlu Piyade Tugayı"
required
/>
</div>
<div class="form-group">
<label for="address">Adres</label>
<input
id="address"
type="text"
class="form-input"
bind:value={formData.address}
placeholder="Mecidiyeköy, Şişli/İstanbul"
required
/>
</div>
<div class="form-row">
<div class="form-group">
<label for="stk">STK</label>
<input
id="stk"
type="text"
class="form-input"
bind:value={formData.stk}
placeholder="STK-12345"
required
/>
</div>
<div class="form-group">
<label for="btk">BTK</label>
<input
id="btk"
type="text"
class="form-input"
bind:value={formData.btk}
placeholder="BTK-67890"
required
/>
</div>
</div>
</div>
<div class="form-section">
<h3>Birlik Sorumlusu</h3>
<div class="form-row">
<div class="form-group">
<label for="commander-name">Adı Soyadı</label>
<input
id="commander-name"
type="text"
class="form-input"
bind:value={formData.commander.full_name}
placeholder="Mehmet Yılmaz"
required
/>
</div>
<div class="form-group">
<label for="commander-rank">Rütbesi</label>
<input
id="commander-rank"
type="text"
class="form-input"
bind:value={formData.commander.rank}
placeholder="Yüzbaşı"
required
/>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="commander-registration">Sicil No</label>
<input
id="commander-registration"
type="text"
class="form-input"
bind:value={formData.commander.registration_number}
placeholder="123456"
required
/>
</div>
<div class="form-group">
<label for="commander-phone">İrtibat No</label>
<input
id="commander-phone"
type="tel"
class="form-input"
bind:value={formData.commander.phone}
placeholder="05321234567"
required
/>
</div>
</div>
<div class="form-group">
<label for="commander-tc">TC Kimlik Numarası</label>
<input
id="commander-tc"
type="text"
class="form-input"
bind:value={formData.commander.tc_kimlik}
placeholder="12345678901"
maxlength="11"
required
/>
</div>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-secondary" on:click={closeModal}>İptal</button>
<button type="submit" class="btn btn-primary">Kaydet</button>
</div>
</form>
</div>
</div>
{/if}
<!-- Birlik Düzenle Modal -->
{#if showEditModal}
<div class="modal-overlay" on:click={closeModal}>
<div class="modal modal-large" on:click|stopPropagation>
<div class="modal-header">
<h2>Birlik Düzenle</h2>
<button class="modal-close" on:click={closeModal}>×</button>
</div>
<form on:submit|preventDefault={handleUpdateUnit} class="modal-form">
<div class="form-section">
<h3>Birlik Bilgileri</h3>
<div class="form-group">
<label for="edit-name">Birlik Adı</label>
<input
id="edit-name"
type="text"
class="form-input"
bind:value={formData.name}
placeholder="1. Motorlu Piyade Tugayı"
required
/>
</div>
<div class="form-group">
<label for="edit-address">Adres</label>
<input
id="edit-address"
type="text"
class="form-input"
bind:value={formData.address}
placeholder="Mecidiyeköy, Şişli/İstanbul"
required
/>
</div>
<div class="form-row">
<div class="form-group">
<label for="edit-stk">STK</label>
<input
id="edit-stk"
type="text"
class="form-input"
bind:value={formData.stk}
placeholder="STK-12345"
required
/>
</div>
<div class="form-group">
<label for="edit-btk">BTK</label>
<input
id="edit-btk"
type="text"
class="form-input"
bind:value={formData.btk}
placeholder="BTK-67890"
required
/>
</div>
</div>
</div>
<div class="form-section">
<h3>Birlik Sorumlusu</h3>
<div class="form-row">
<div class="form-group">
<label for="edit-commander-name">Adı Soyadı</label>
<input
id="edit-commander-name"
type="text"
class="form-input"
bind:value={formData.commander.full_name}
placeholder="Mehmet Yılmaz"
required
/>
</div>
<div class="form-group">
<label for="edit-commander-rank">Rütbesi</label>
<input
id="edit-commander-rank"
type="text"
class="form-input"
bind:value={formData.commander.rank}
placeholder="Yüzbaşı"
required
/>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="edit-commander-registration">Sicil No</label>
<input
id="edit-commander-registration"
type="text"
class="form-input"
bind:value={formData.commander.registration_number}
placeholder="123456"
required
/>
</div>
<div class="form-group">
<label for="edit-commander-phone">İrtibat No</label>
<input
id="edit-commander-phone"
type="tel"
class="form-input"
bind:value={formData.commander.phone}
placeholder="05321234567"
required
/>
</div>
</div>
<div class="form-group">
<label for="edit-commander-tc">TC Kimlik Numarası</label>
<input
id="edit-commander-tc"
type="text"
class="form-input"
bind:value={formData.commander.tc_kimlik}
placeholder="12345678901"
maxlength="11"
required
/>
</div>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-secondary" on:click={closeModal}>İptal</button>
<button type="submit" class="btn btn-primary">Güncelle</button>
</div>
</form>
</div>
</div>
{/if}
<style> <style>
.units-content { .units-content {
@@ -502,6 +763,119 @@
.btn-danger:hover { .btn-danger:hover {
background: #B91C1C; background: #B91C1C;
} }
/* Modal Stilleri */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
padding: 1rem;
}
.modal {
background: white;
border-radius: 12px;
max-width: 500px;
width: 100%;
max-height: 90vh;
overflow-y: auto;
}
.modal-large {
max-width: 700px;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
border-bottom: 1px solid var(--card-border-color);
}
.modal-header h2 {
margin: 0;
font-size: 1.3rem;
font-weight: 600;
color: var(--text-color);
}
.modal-close {
background: none;
border: none;
font-size: 1.5rem;
color: var(--text-secondary);
cursor: pointer;
padding: 0.25rem;
}
.modal-form {
padding: 1.5rem;
}
.form-section {
margin-bottom: 2rem;
}
.form-section h3 {
font-size: 1.1rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 1rem 0;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--card-border-color);
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--text-color);
}
.form-input {
width: 100%;
padding: 0.75rem;
border: 1px solid #D1D5DB;
border-radius: 8px;
font-size: 0.9rem;
transition: border-color 0.2s ease;
}
.form-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-row {
display: flex;
gap: 1rem;
}
.form-row .form-group {
flex: 1;
}
.modal-actions {
display: flex;
gap: 1rem;
justify-content: flex-end;
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid var(--card-border-color);
}
/* Responsive Tasarım */ /* Responsive Tasarım */
@media (max-width: 768px) { @media (max-width: 768px) {
@@ -527,5 +901,23 @@
flex-direction: column; flex-direction: column;
gap: 0.25rem; gap: 0.25rem;
} }
.modal {
margin: 0;
max-height: 100vh;
}
.modal-large {
max-width: 100%;
}
.form-row {
flex-direction: column;
gap: 0;
}
.modal-actions {
flex-direction: column;
}
} }
</style> </style>