ExcelAccountingSection.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. <template>
  2. <div class="excel-accounting-section">
  3. <div class="section-header">
  4. <h2>Excel-pohjan Kirjanpito</h2>
  5. <div class="header-actions">
  6. <button class="btn btn-primary" @click="showAddEntryModal">
  7. <i class="fas fa-plus"></i> Lisää Tapahtuma
  8. </button>
  9. <button class="btn btn-secondary" @click="exportToExcel">
  10. <i class="fas fa-download"></i> Vie Excel
  11. </button>
  12. </div>
  13. </div>
  14. <!-- Filters -->
  15. <div class="filters">
  16. <div class="filter-group">
  17. <label for="dateFilter">Päivämäärä:</label>
  18. <input
  19. type="date"
  20. id="dateFilter"
  21. v-model="filters.date"
  22. @change="applyFilters"
  23. >
  24. </div>
  25. <div class="filter-group">
  26. <label for="typeFilter">Tyyppi:</label>
  27. <select id="typeFilter" v-model="filters.type" @change="applyFilters">
  28. <option value="">Kaikki</option>
  29. <option value="Tulo">Tulo</option>
  30. <option value="Kulu">Kulu</option>
  31. </select>
  32. </div>
  33. <div class="filter-group">
  34. <label for="categoryFilter">Luokka:</label>
  35. <input
  36. type="text"
  37. id="categoryFilter"
  38. v-model="filters.category"
  39. placeholder="Hae luokasta..."
  40. @input="applyFilters"
  41. >
  42. </div>
  43. </div>
  44. <!-- Summary Cards -->
  45. <div class="summary-cards">
  46. <div class="summary-card income">
  47. <h3>Tulot</h3>
  48. <p class="amount">{{ formatCurrency(totalIncome) }}</p>
  49. </div>
  50. <div class="summary-card expenses">
  51. <h3>Kulut</h3>
  52. <p class="amount">{{ formatCurrency(totalExpenses) }}</p>
  53. </div>
  54. <div class="summary-card balance" :class="{ 'positive': netBalance >= 0, 'negative': netBalance < 0 }">
  55. <h3>Saldo</h3>
  56. <p class="amount">{{ formatCurrency(netBalance) }}</p>
  57. </div>
  58. </div>
  59. <!-- Entries Table -->
  60. <div class="entries-section">
  61. <div v-if="loading" class="loading">
  62. Ladataan tapahtumia...
  63. </div>
  64. <div v-else-if="filteredEntries.length === 0" class="no-data">
  65. Ei tapahtumia löytynyt.
  66. </div>
  67. <table v-else class="table">
  68. <thead>
  69. <tr>
  70. <th>Päivämäärä</th>
  71. <th>Kuvaus</th>
  72. <th>Tyyppi</th>
  73. <th>Luokka</th>
  74. <th>Veroton summa</th>
  75. <th>ALV %</th>
  76. <th>ALV 25,5%</th>
  77. <th>ALV 14%</th>
  78. <th>ALV 10%</th>
  79. <th>Yhteensä</th>
  80. <th>Netto</th>
  81. <th>ALV</th>
  82. <th>Viite</th>
  83. <th>Toiminnot</th>
  84. </tr>
  85. </thead>
  86. <tbody>
  87. <tr v-for="entry in paginatedEntries" :key="entry.id" :class="{ 'income': entry.entry_type === 'Tulo', 'expense': entry.entry_type === 'Kulu' }">
  88. <td>{{ formatDate(entry.entry_date) }}</td>
  89. <td>{{ entry.description }}</td>
  90. <td>
  91. <span :class="['entry-type-badge', entry.entry_type.toLowerCase()]">
  92. {{ entry.entry_type }}
  93. </span>
  94. </td>
  95. <td>{{ entry.category || '-' }}</td>
  96. <td class="currency">{{ formatCurrency(entry.tax_free_amount) }}</td>
  97. <td class="percentage">{{ entry.vat_percentage }}%</td>
  98. <td class="currency">{{ formatCurrency(entry.vat_25_5) }}</td>
  99. <td class="currency">{{ formatCurrency(entry.vat_14) }}</td>
  100. <td class="currency">{{ formatCurrency(entry.vat_10) }}</td>
  101. <td class="currency">{{ formatCurrency(entry.total_amount) }}</td>
  102. <td class="currency">{{ formatCurrency(entry.net_amount) }}</td>
  103. <td class="currency">{{ formatCurrency(entry.vat_amount) }}</td>
  104. <td>{{ entry.reference_number || '-' }}</td>
  105. <td>
  106. <div class="actions">
  107. <button class="btn btn-sm btn-primary" @click="editEntry(entry)">Muokkaa</button>
  108. <button class="btn btn-sm btn-danger" @click="deleteEntry(entry.id)">Poista</button>
  109. </div>
  110. </td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. <!-- Pagination -->
  115. <div class="pagination" v-if="totalPages > 1">
  116. <button
  117. class="btn btn-secondary"
  118. @click="currentPage--"
  119. :disabled="currentPage <= 1"
  120. >
  121. Edellinen
  122. </button>
  123. <span class="page-info">Sivu {{ currentPage }} / {{ totalPages }}</span>
  124. <button
  125. class="btn btn-secondary"
  126. @click="currentPage++"
  127. :disabled="currentPage >= totalPages"
  128. >
  129. Seuraava
  130. </button>
  131. </div>
  132. </div>
  133. <!-- Add/Edit Entry Modal -->
  134. <div v-if="showEntryModal" class="modal" @click.self="closeEntryModal">
  135. <div class="modal-content">
  136. <span class="close" @click="closeEntryModal">&times;</span>
  137. <h2>{{ isEditingEntry ? 'Muokkaa Tapahtumaa' : 'Lisää Tapahtuma' }}</h2>
  138. <form @submit.prevent="saveEntry">
  139. <div class="form-row">
  140. <div class="form-group">
  141. <label for="entry_date">Päivämäärä *</label>
  142. <input
  143. type="date"
  144. id="entry_date"
  145. v-model="entryForm.entry_date"
  146. required
  147. >
  148. </div>
  149. <div class="form-group">
  150. <label for="entry_type">Tyyppi *</label>
  151. <select id="entry_type" v-model="entryForm.entry_type" @change="onEntryTypeChange" required>
  152. <option value="">Valitse tyyppi</option>
  153. <option value="Tulo">Tulo</option>
  154. <option value="Kulu">Kulu</option>
  155. </select>
  156. </div>
  157. </div>
  158. <div class="form-group">
  159. <label for="description">Kuvaus *</label>
  160. <textarea
  161. id="description"
  162. v-model="entryForm.description"
  163. required
  164. placeholder="Syötä tapahtuman kuvaus..."
  165. ></textarea>
  166. </div>
  167. <div class="form-group">
  168. <label for="category">Luokka</label>
  169. <select
  170. id="category"
  171. v-model="entryForm.category"
  172. @change="onCategoryChange"
  173. >
  174. <option value="">Valitse luokka</option>
  175. <option v-for="cat in availableCategories" :key="cat.code" :value="cat.code">
  176. {{ cat.name }}
  177. </option>
  178. </select>
  179. </div>
  180. <div class="form-row">
  181. <div class="form-group">
  182. <label for="tax_free_amount">Veroton summa</label>
  183. <input
  184. type="number"
  185. id="tax_free_amount"
  186. v-model="entryForm.tax_free_amount"
  187. step="0.01"
  188. min="0"
  189. @input="calculateTotals"
  190. >
  191. </div>
  192. <div class="form-group">
  193. <label for="vat_percentage">ALV %</label>
  194. <select id="vat_percentage" v-model="entryForm.vat_percentage" @change="calculateTotals">
  195. <option value="0">0%</option>
  196. <option value="10">10%</option>
  197. <option value="14">14%</option>
  198. <option value="25.5">25.5%</option>
  199. </select>
  200. </div>
  201. </div>
  202. <div class="form-row">
  203. <div class="form-group">
  204. <label for="total_amount">Yhteensä *</label>
  205. <input
  206. type="number"
  207. id="total_amount"
  208. v-model="entryForm.total_amount"
  209. step="0.01"
  210. required
  211. @input="calculateVAT"
  212. >
  213. </div>
  214. <div class="form-group">
  215. <label for="reference_number">Viitenumero</label>
  216. <input
  217. type="text"
  218. id="reference_number"
  219. v-model="entryForm.reference_number"
  220. placeholder="Viitenumero..."
  221. >
  222. </div>
  223. </div>
  224. <div class="form-actions">
  225. <button type="button" class="btn" @click="closeEntryModal">Peruuta</button>
  226. <button type="submit" class="btn btn-success">
  227. {{ isEditingEntry ? 'Päivitä' : 'Tallenna' }}
  228. </button>
  229. </div>
  230. </form>
  231. </div>
  232. </div>
  233. </div>
  234. </template>
  235. <script>
  236. import api from '../../api/axios'
  237. import { formatCurrency, formatDate } from '../../utils/locale'
  238. export default {
  239. name: 'ExcelAccountingSection',
  240. emits: ['add-entry', 'edit-entry', 'delete-entry'],
  241. data() {
  242. return {
  243. entries: [],
  244. loading: false,
  245. showEntryModal: false,
  246. isEditingEntry: false,
  247. currentPage: 1,
  248. itemsPerPage: 50,
  249. categories: [],
  250. categoriesLoading: false,
  251. filters: {
  252. date: '',
  253. type: '',
  254. category: ''
  255. },
  256. entryForm: {
  257. id: null,
  258. entry_date: '',
  259. description: '',
  260. entry_type: '',
  261. category: '',
  262. tax_free_amount: 0,
  263. vat_percentage: 24,
  264. vat_25_5: 0,
  265. vat_14: 0,
  266. vat_10: 0,
  267. total_amount: 0,
  268. net_amount: 0,
  269. vat_amount: 0,
  270. reference_number: ''
  271. }
  272. }
  273. },
  274. computed: {
  275. availableCategories() {
  276. if (!this.entryForm.entry_type) {
  277. return []
  278. }
  279. return this.categories.filter(cat => cat.type === this.entryForm.entry_type)
  280. },
  281. filteredEntries() {
  282. let filtered = this.entries
  283. if (this.filters.date) {
  284. filtered = filtered.filter(entry => entry.entry_date >= this.filters.date)
  285. }
  286. if (this.filters.type) {
  287. filtered = filtered.filter(entry => entry.entry_type === this.filters.type)
  288. }
  289. if (this.filters.category) {
  290. filtered = filtered.filter(entry =>
  291. entry.category && entry.category.toLowerCase().includes(this.filters.category.toLowerCase())
  292. )
  293. }
  294. return filtered
  295. },
  296. paginatedEntries() {
  297. const start = (this.currentPage - 1) * this.itemsPerPage
  298. const end = start + this.itemsPerPage
  299. return this.filteredEntries.slice(start, end)
  300. },
  301. totalPages() {
  302. return Math.ceil(this.filteredEntries.length / this.itemsPerPage)
  303. },
  304. totalIncome() {
  305. return this.filteredEntries
  306. .filter(entry => entry.entry_type === 'Tulo')
  307. .reduce((sum, entry) => sum + parseFloat(entry.total_amount || 0), 0)
  308. },
  309. totalExpenses() {
  310. return this.filteredEntries
  311. .filter(entry => entry.entry_type === 'Kulu')
  312. .reduce((sum, entry) => sum + parseFloat(entry.total_amount || 0), 0)
  313. },
  314. netBalance() {
  315. return this.totalIncome - this.totalExpenses
  316. }
  317. },
  318. methods: {
  319. formatCurrency,
  320. formatDate,
  321. async fetchEntries() {
  322. this.loading = true
  323. try {
  324. const response = await api.get('/accounting_entries.php')
  325. this.entries = response.data.records || []
  326. } catch (error) {
  327. console.error('Error fetching entries:', error)
  328. } finally {
  329. this.loading = false
  330. }
  331. },
  332. async fetchCategories() {
  333. this.categoriesLoading = true
  334. try {
  335. const response = await api.get('/accounting_categories.php')
  336. this.categories = response.data || []
  337. } catch (error) {
  338. console.error('Error fetching categories:', error)
  339. } finally {
  340. this.categoriesLoading = false
  341. }
  342. },
  343. showAddEntryModal() {
  344. this.isEditingEntry = false
  345. this.entryForm = {
  346. id: null,
  347. entry_date: new Date().toISOString().split('T')[0],
  348. description: '',
  349. entry_type: '',
  350. category: '',
  351. tax_free_amount: 0,
  352. vat_percentage: 24,
  353. vat_25_5: 0,
  354. vat_14: 0,
  355. vat_10: 0,
  356. total_amount: 0,
  357. net_amount: 0,
  358. vat_amount: 0,
  359. reference_number: ''
  360. }
  361. this.showEntryModal = true
  362. },
  363. onCategoryChange() {
  364. // Automatically set VAT percentage based on selected category
  365. if (this.entryForm.category) {
  366. const selectedCategory = this.categories.find(cat => cat.code === this.entryForm.category)
  367. if (selectedCategory) {
  368. this.entryForm.vat_percentage = parseFloat(selectedCategory.vat_percentage) || 0
  369. // Always calculate VAT when category changes to show the calculation
  370. this.calculateVAT()
  371. }
  372. }
  373. },
  374. onEntryTypeChange() {
  375. // Clear category when entry type changes
  376. this.entryForm.category = ''
  377. },
  378. editEntry(entry) {
  379. this.isEditingEntry = true
  380. this.entryForm = { ...entry }
  381. this.showEntryModal = true
  382. },
  383. closeEntryModal() {
  384. this.showEntryModal = false
  385. this.entryForm = {
  386. id: null,
  387. entry_date: '',
  388. description: '',
  389. entry_type: '',
  390. category: '',
  391. tax_free_amount: 0,
  392. vat_percentage: 24,
  393. vat_25_5: 0,
  394. vat_14: 0,
  395. vat_10: 0,
  396. total_amount: 0,
  397. net_amount: 0,
  398. vat_amount: 0,
  399. reference_number: ''
  400. }
  401. },
  402. calculateVAT() {
  403. const vatRate = parseFloat(this.entryForm.vat_percentage) || 0
  404. const total = parseFloat(this.entryForm.total_amount) || 0
  405. if (vatRate === 25.5) {
  406. // Yhteensä = Verollinen vero (Brutto ÷ 1.255)
  407. this.entryForm.vat_25_5 = total * 0.255 / 1.255
  408. this.entryForm.vat_14 = 0
  409. this.entryForm.vat_10 = 0
  410. } else if (vatRate === 14) {
  411. // Yhteensä = Verollinen vero (Brutto ÷ 1.14)
  412. this.entryForm.vat_25_5 = 0
  413. this.entryForm.vat_14 = total * 0.14 / 1.14
  414. this.entryForm.vat_10 = 0
  415. } else if (vatRate === 10) {
  416. // Yhteensä = Verollinen vero (Brutto ÷ 1.10)
  417. this.entryForm.vat_25_5 = 0
  418. this.entryForm.vat_14 = 0
  419. this.entryForm.vat_10 = total * 0.10 / 1.10
  420. } else {
  421. // Yhteensä = Verollinen vero (Brutto ÷ 1.24)
  422. this.entryForm.vat_25_5 = 0
  423. this.entryForm.vat_14 = 0
  424. this.entryForm.vat_10 = 0
  425. }
  426. this.entryForm.vat_amount = this.entryForm.vat_25_5 + this.entryForm.vat_14 + this.entryForm.vat_10
  427. this.entryForm.net_amount = total - this.entryForm.vat_amount
  428. // Calculate Yhteensä (VAT amount) for display
  429. this.entryForm.yhteensa = this.entryForm.vat_amount
  430. },
  431. calculateTotals() {
  432. const taxFree = parseFloat(this.entryForm.tax_free_amount) || 0
  433. const vatRate = parseFloat(this.entryForm.vat_percentage) || 0
  434. // Calculate VAT amounts based on tax-free amount and VAT rate
  435. if (vatRate === 25.5) {
  436. this.entryForm.vat_25_5 = Math.round((taxFree * 0.255) * 100) / 100
  437. this.entryForm.vat_14 = 0
  438. this.entryForm.vat_10 = 0
  439. } else if (vatRate === 14) {
  440. this.entryForm.vat_25_5 = 0
  441. this.entryForm.vat_14 = Math.round((taxFree * 0.14) * 100) / 100
  442. this.entryForm.vat_10 = 0
  443. } else if (vatRate === 10) {
  444. this.entryForm.vat_25_5 = 0
  445. this.entryForm.vat_14 = 0
  446. this.entryForm.vat_10 = Math.round((taxFree * 0.10) * 100) / 100
  447. } else {
  448. // Default 24% VAT
  449. this.entryForm.vat_25_5 = 0
  450. this.entryForm.vat_14 = 0
  451. this.entryForm.vat_10 = 0
  452. }
  453. const vat25_5 = parseFloat(this.entryForm.vat_25_5) || 0
  454. const vat14 = parseFloat(this.entryForm.vat_14) || 0
  455. const vat10 = parseFloat(this.entryForm.vat_10) || 0
  456. this.entryForm.total_amount = Math.round((taxFree + vat25_5 + vat14 + vat10) * 100) / 100
  457. this.entryForm.vat_amount = Math.round((vat25_5 + vat14 + vat10) * 100) / 100
  458. this.entryForm.net_amount = Math.round(taxFree * 100) / 100
  459. },
  460. async saveEntry() {
  461. try {
  462. if (this.isEditingEntry) {
  463. await api.put(`/accounting_entries.php?id=${this.entryForm.id}`, this.entryForm)
  464. } else {
  465. await api.post('/accounting_entries.php', this.entryForm)
  466. }
  467. this.closeEntryModal()
  468. this.fetchEntries()
  469. } catch (error) {
  470. console.error('Error saving entry:', error)
  471. }
  472. },
  473. async deleteEntry(id) {
  474. if (!confirm('Haluatko varmasti poistaa tämän tapahtuman?')) {
  475. return
  476. }
  477. try {
  478. await api.delete(`/accounting_entries.php?id=${id}`)
  479. this.fetchEntries()
  480. } catch (error) {
  481. console.error('Error deleting entry:', error)
  482. }
  483. },
  484. applyFilters() {
  485. this.currentPage = 1
  486. },
  487. exportToExcel() {
  488. // Implementation for Excel export
  489. alert('Excel-vienti ominaisuus tulossa pian!')
  490. }
  491. },
  492. mounted() {
  493. this.fetchEntries()
  494. this.fetchCategories()
  495. }
  496. }
  497. </script>
  498. <style scoped>
  499. .excel-accounting-section {
  500. padding: 20px;
  501. }
  502. .section-header {
  503. display: flex;
  504. justify-content: space-between;
  505. align-items: center;
  506. margin-bottom: 20px;
  507. }
  508. .section-header h2 {
  509. margin: 0;
  510. color: white;
  511. }
  512. .header-actions {
  513. display: flex;
  514. gap: 10px;
  515. }
  516. .filters {
  517. display: flex;
  518. gap: 15px;
  519. margin-bottom: 20px;
  520. padding: 15px;
  521. background-color: #f8f9fa;
  522. border-radius: 8px;
  523. }
  524. .filter-group {
  525. display: flex;
  526. flex-direction: column;
  527. gap: 5px;
  528. }
  529. .filter-group label {
  530. font-weight: 600;
  531. color: #495057;
  532. }
  533. .filter-group input,
  534. .filter-group select {
  535. padding: 8px;
  536. border: 1px solid #ddd;
  537. border-radius: 4px;
  538. font-size: 14px;
  539. }
  540. .summary-cards {
  541. display: grid;
  542. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  543. gap: 20px;
  544. margin-bottom: 20px;
  545. }
  546. .summary-card {
  547. padding: 20px;
  548. border-radius: 8px;
  549. text-align: center;
  550. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  551. }
  552. .summary-card.income {
  553. background-color: #d4edda;
  554. border-left: 4px solid #28a745;
  555. }
  556. .summary-card.expenses {
  557. background-color: #f8d7da;
  558. border-left: 4px solid #dc3545;
  559. }
  560. .summary-card.balance {
  561. background-color: #e2e3e5;
  562. border-left: 4px solid #6c757d;
  563. }
  564. .summary-card.balance.positive {
  565. border-left-color: #28a745;
  566. }
  567. .summary-card.balance.negative {
  568. border-left-color: #dc3545;
  569. }
  570. .summary-card h3 {
  571. margin: 0 0 10px 0;
  572. color: #495057;
  573. }
  574. .summary-card .amount {
  575. font-size: 24px;
  576. font-weight: 700;
  577. margin: 0;
  578. color: #333;
  579. }
  580. .entries-section {
  581. background-color: white;
  582. border-radius: 8px;
  583. overflow: hidden;
  584. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  585. }
  586. .table {
  587. width: 100%;
  588. border-collapse: collapse;
  589. margin-bottom: 20px;
  590. }
  591. .table th,
  592. .table td {
  593. padding: 12px;
  594. text-align: left;
  595. border-bottom: 1px solid #dee2e6;
  596. }
  597. .table th {
  598. background-color: #f8f9fa;
  599. font-weight: 600;
  600. color: #495057;
  601. }
  602. .table tbody tr:hover {
  603. background-color: #f8f9fa;
  604. }
  605. .table tbody tr.income {
  606. background-color: rgba(40, 167, 69, 0.05);
  607. color: #333 !important;
  608. }
  609. .table tbody tr.expense {
  610. background-color: rgba(220, 53, 69, 0.05);
  611. color: #333 !important;
  612. }
  613. .currency {
  614. text-align: right;
  615. font-family: 'Courier New', monospace;
  616. font-weight: 600;
  617. }
  618. .percentage {
  619. text-align: center;
  620. font-weight: 600;
  621. }
  622. .entry-type-badge {
  623. padding: 2px 6px;
  624. border-radius: 4px;
  625. font-size: 12px;
  626. font-weight: 600;
  627. }
  628. .entry-type-badge.tulo {
  629. background-color: #28a745;
  630. color: white;
  631. }
  632. .entry-type-badge.kulu {
  633. background-color: #dc3545;
  634. color: white;
  635. }
  636. .actions {
  637. display: flex;
  638. gap: 5px;
  639. }
  640. .btn {
  641. padding: 6px 12px;
  642. border: none;
  643. border-radius: 4px;
  644. cursor: pointer;
  645. font-size: 12px;
  646. transition: background-color 0.2s ease;
  647. }
  648. .btn-sm {
  649. padding: 4px 8px;
  650. font-size: 11px;
  651. }
  652. .btn-primary {
  653. background-color: #007bff;
  654. color: white;
  655. }
  656. .btn-primary:hover {
  657. background-color: #0056b3;
  658. }
  659. .btn-secondary {
  660. background-color: #6c757d;
  661. color: white;
  662. }
  663. .btn-secondary:hover {
  664. background-color: #545b62;
  665. }
  666. .btn-success {
  667. background-color: #28a745;
  668. color: white;
  669. }
  670. .btn-success:hover {
  671. background-color: #1e7e34;
  672. }
  673. .btn-danger {
  674. background-color: #dc3545;
  675. color: white;
  676. }
  677. .btn-danger:hover {
  678. background-color: #c82333;
  679. }
  680. .modal {
  681. position: fixed;
  682. z-index: 1000;
  683. left: 0;
  684. top: 0;
  685. width: 100%;
  686. height: 100%;
  687. background-color: rgba(0,0,0,0.5);
  688. display: flex;
  689. align-items: center;
  690. justify-content: center;
  691. }
  692. .modal-content {
  693. background-color: white;
  694. padding: 30px;
  695. border-radius: 8px;
  696. width: 90%;
  697. max-width: 600px;
  698. max-height: 90vh;
  699. overflow-y: auto;
  700. position: relative;
  701. }
  702. .close {
  703. position: absolute;
  704. right: 15px;
  705. top: 15px;
  706. font-size: 24px;
  707. cursor: pointer;
  708. color: #aaa;
  709. }
  710. .form-row {
  711. display: grid;
  712. grid-template-columns: 1fr 1fr;
  713. gap: 15px;
  714. }
  715. .form-group {
  716. margin-bottom: 15px;
  717. }
  718. .form-group label {
  719. display: block;
  720. margin-bottom: 5px;
  721. font-weight: 600;
  722. color: #495057;
  723. }
  724. .form-group input,
  725. .form-group select,
  726. .form-group textarea {
  727. width: 100%;
  728. padding: 10px;
  729. border: 1px solid #ddd;
  730. border-radius: 4px;
  731. font-size: 14px;
  732. }
  733. .form-group textarea {
  734. min-height: 80px;
  735. resize: vertical;
  736. }
  737. .form-actions {
  738. display: flex;
  739. gap: 10px;
  740. justify-content: flex-end;
  741. margin-top: 20px;
  742. }
  743. .loading {
  744. text-align: center;
  745. padding: 40px;
  746. color: #333;
  747. }
  748. .no-data {
  749. text-align: center;
  750. padding: 40px;
  751. color: #6c757d;
  752. }
  753. .pagination {
  754. display: flex;
  755. justify-content: center;
  756. align-items: center;
  757. gap: 15px;
  758. margin-top: 20px;
  759. }
  760. .page-info {
  761. color: #6c757d;
  762. font-weight: 600;
  763. }
  764. </style>