File size: 10,048 Bytes
7b3aac2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html lang="uz" data-theme="dark">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Panel β€” M-TEXTILE</title>
    <link rel="stylesheet" href="css/global.css">
    <link rel="stylesheet" href="css/components.css">
    <link rel="stylesheet" href="css/admin.css">

    <!-- AOS CSS -->
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
</head>

<body>
    <!-- Global Preloader -->
    <div id="global-preloader" class="preloader">
        <div class="preloader-spinner"></div>
    </div>
    <!-- Login Modal -->
    <div class="admin-login-overlay" id="adminLogin">
        <div class="admin-login-box">
            <h2>Admin Kirish</h2>
            <input type="password" id="adminPass" class="form-input" placeholder="Parolni kiriting..."

                style="margin-bottom:1rem;">
            <button class="btn btn-primary" style="width:100%" onclick="checkAdmin()">Kirish</button>
        </div>
    </div>

    <!-- Dashboard -->
    <div class="admin-layout" id="adminDashboard" style="display:none;">
        <aside class="admin-sidebar">
            <div class="admin-logo">M-TEXTILE ADMIN</div>
            <nav class="admin-nav">
                <a href="#stats" class="active" onclick="showSection('stats', this)">πŸ“Š Statistika</a>
                <a href="#products" onclick="showSection('products', this)">πŸ“¦ Mahsulotlar</a>
                <a href="#orders" onclick="showSection('orders', this)">πŸ›’ Buyurtmalar</a>
                <a href="#settings" onclick="showSection('settings', this)">βš™οΈ Sozlamalar</a>
                <a href="index.html" style="margin-top:auto">πŸ”™ Saytga qaytish</a>
            </nav>
        </aside>

        <main class="admin-content">
            <header class="admin-header">
                <h2>Boshqaruv Paneli</h2>
                <div style="display:flex;gap:1rem;align-items:center;">
                    <input type="text" id="adminProductSearch" placeholder="Mahsulot qidirish..."

                        oninput="filterAdminProducts(this.value)" class="form-input" style="width:250px;">
                    <button class="btn btn-primary" onclick="openProductModal()">+ Yangi Mahsulot</button>
                </div>
            </header>

            <div class="admin-stats">
                <div class="stat-card">
                    <div class="stat-title">Jami Mahsulotlar</div>
                    <div class="stat-value" id="statProducts">0</div>
                </div>
                <div class="stat-card">
                    <div class="stat-title">Buyurtmalar</div>
                    <div class="stat-value" id="statOrders">0</div>
                </div>
                <div class="stat-card">
                    <div class="stat-title">Umumiy Daromad</div>
                    <div class="stat-value" id="statRevenue">0 so'm</div>
                </div>
            </div>

            <!-- Products Section -->
            <section id="section-products" class="admin-section active">
                <div class="card">
                    <table class="admin-table">
                        <thead>
                            <tr>
                                <th>Rasm</th>
                                <th>Nomi</th>
                                <th>Kategoriya</th>
                                <th>Narxi</th>
                                <th>Holat</th>
                                <th>Amallar</th>
                            </tr>
                        </thead>
                        <tbody id="adminProductsTable">
                            <!-- JS load -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- Orders Section -->
            <section id="section-orders" class="admin-section" style="display:none;">
                <div class="card">
                    <table class="admin-table" id="adminOrdersTable">
                        <thead>
                            <tr>
                                <th>β„–</th>
                                <th>Mijoz</th>
                                <th>Telefon</th>
                                <th>Summa</th>
                                <th>Sana</th>
                                <th>Holat</th>
                            </tr>
                        </thead>
                        <tbody id="ordersTableBody">
                            <!-- JS load -->
                        </tbody>
                    </table>
                </div>
            </section>

            <!-- Settings Section -->
            <section id="section-settings" class="admin-section" style="display:none;">
                <div class="card" style="max-width: 600px;">
                    <h3>Do'kon Sozlamalari</h3>
                    <p style="color:var(--clr-text-secondary);margin-bottom:1.5rem;">Saytning global ma'lumotlari,
                        do'kon manzili va xaritasini sozlang.</p>

                    <div class="form-group">
                        <label class="form-label">Do'kon Manzili (Matn ko'rinishida)</label>
                        <input type="text" id="settingAddress" class="form-input"

                            placeholder="Masalan: Toshkent shahar, Chilonzor tumani, 9-kvartal...">
                    </div>

                    <div class="form-group" style="margin-top:1rem;">
                        <label class="form-label">Google Xarita (Iframe URL yoki Embed Code)</label>
                        <textarea id="settingMap" class="form-input" rows="4"

                            placeholder="<iframe src='https://www.google.com/maps/embed?...' ...></iframe>"></textarea>
                        <p style="font-size:0.8rem;color:var(--clr-text-muted);margin-top:0.5rem;">Eslatma: Google
                            qidiruvdan 'Ulashish' -> 'Xaritani joylashtirish' orqali iframe kodini oling.</p>
                    </div>

                    <button class="btn btn-primary mt-2xl" onclick="saveAdminSettings()" style="width:100%">Sozlamalarni
                        Saqlash</button>

                    <div id="settingsMapPreview"

                        style="margin-top:2rem;border-radius:var(--radius-md);overflow:hidden;height:250px;background:var(--clr-surface);display:none;">
                    </div>
                </div>
            </section>
        </main>
    </div>

    <!-- Product Modal -->
    <div class="modal-overlay" id="productModal" style="display:none;z-index:99999;">
        <div class="modal" style="max-width:600px;width:90%">
            <div class="modal-header">
                <h3 id="modalTitle">Mahsulot qo'shish</h3>
                <button class="modal-close" onclick="closeProductModal()">βœ•</button>
            </div>
            <div class="modal-body">
                <form id="productForm">
                    <input type="hidden" id="pId">
                    <div class="form-group">
                        <label>Nomi</label>
                        <input type="text" id="pName" class="form-input" required>
                    </div>
                    <div class="grid grid-2">
                        <div class="form-group">
                            <label>Kategoriya</label>
                            <select id="pCat" class="form-input" required>
                                <option value="kiyimlar">Kiyimlar</option>
                                <option value="formalar">Formalar</option>
                                <option value="shimlar">Shimlar</option>
                                <option value="galistuklar">Galistuklar</option>
                                <option value="aksessuarlar">Aksessuarlar</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Ost-kategoriya (Subcategory)</label>
                            <input type="text" id="pSubCat" class="form-input" placeholder="Masalan: Ko'ylaklar"

                                required>
                        </div>
                    </div>
                    <div class="grid grid-2">
                        <div class="form-group">
                            <label>Narxi (so'm)</label>
                            <input type="number" id="pPrice" class="form-input" required>
                        </div>
                        <div class="form-group">
                            <label>Eski Narxi (Yoki bo'sh qoldiring)</label>
                            <input type="number" id="pOldPrice" class="form-input">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Rasm URL</label>
                        <input type="url" id="pImg" class="form-input" required>
                    </div>
                    <div class="form-group">
                        <label>Tavsif</label>
                        <textarea id="pDesc" class="form-input" rows="3" required></textarea>
                    </div>
                    <div class="grid grid-2">
                        <label class="filter-option"><input type="checkbox" id="pNew"> Yangi kelgan</label>
                        <label class="filter-option"><input type="checkbox" id="pFeat"> Tavsiya etilgan</label>
                    </div>
                    <button type="submit" class="btn btn-primary mt-md" style="width:100%">Saqlash</button>
                </form>
            </div>
        </div>
    </div>

    <script src="js/products.js"></script>
    <script src="js/admin.js"></script>

    <!-- AOS JS -->
    <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
</body>

</html>