Преглед на файлове

Fix Attachmenst and not used apis

svalavuo преди 1 ден
родител
ревизия
02ccf43f11

+ 1 - 1
backend/models/Attachment.php

@@ -139,7 +139,7 @@ class Attachment {
             if ($this->create()) {
                 $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
                 $apiPath = dirname($_SERVER['PHP_SELF']);
-                $fullUrl = $baseUrl . $apiPath . '/' . $uploadPath;
+                $fullUrl = $baseUrl . '/uploads/' . $uploadPath;
                 
                 return ['success' => true, 'url' => $fullUrl, 'id' => $this->conn->lastInsertId()];
             } else {

+ 21 - 21
frontend/src/App.vue

@@ -388,7 +388,7 @@
             :class="['tab-btn', { active: activeTab === 'attachments' }]" 
             @click="activeTab = 'attachments'"
           >
-            Liitteet
+            Tiedostot
           </button>
           <button 
             :class="['tab-btn', { active: activeTab === 'contacts' }]" 
@@ -510,7 +510,7 @@
                 <span class="attachment-size">({{ formatFileSize(attachment.file_size) }})</span>
               </div>
               <div class="attachment-actions">
-                <a :href="attachment.file_path" target="_blank" class="btn btn-primary">View</a>
+                <a :href="`/uploads/${attachment.file_path}`" target="_blank" class="btn btn-primary">View</a>
                 <button class="btn btn-danger" @click="deleteAttachment(attachment.id)">Delete</button>
               </div>
             </div>
@@ -613,8 +613,8 @@
       </div>
     </div>
     
-    <!-- Accounting Section -->
-    <AccountingSection
+    <!-- Accounting Section (Hidden - ExcelAccounting is in use) -->
+    <!-- <AccountingSection
       :active-section="activeSection"
       :invoices="invoices"
       :invoices-loading="invoicesLoading"
@@ -633,7 +633,7 @@
       @edit-journal-entry="editJournalEntry"
       @delete-journal-entry="deleteJournalEntry"
       @search="searchAccounting"
-    />
+    /> -->
     
     <!-- Add/Edit Client Modal -->
     <div v-if="showClientModal" class="modal" @click.self="closeClientModal">
@@ -1869,7 +1869,7 @@ export default {
     
     async fetchRentalPrices(itemId) {
       try {
-        const response = await api.get(`/api/rental_prices.php?item_id=${itemId}`)
+        const response = await api.get(`/rental_prices.php?item_id=${itemId}`)
         this.rentalPrices = response.data.records || []
       } catch (error) {
         this.showMessage('Error fetching rental prices: ' + error.message, 'error')
@@ -1878,7 +1878,7 @@ export default {
     
     async fetchAttachments(itemId) {
       try {
-        const response = await api.get(`/api/attachments.php?item_id=${itemId}`)
+        const response = await api.get(`/attachments.php?item_id=${itemId}`)
         this.attachments = response.data.records || []
       } catch (error) {
         this.showMessage('Error fetching attachments: ' + error.message, 'error')
@@ -1909,7 +1909,7 @@ export default {
     
     async saveRentalPrice() {
       try {
-        await api.post('/api/rental_prices.php', this.rentalForm)
+        await api.post('/rental_prices.php', this.rentalForm)
         this.showMessage('Rental price added successfully!', 'success')
         this.closeRentalModal()
         await this.fetchRentalPrices(this.selectedItem.id)
@@ -1924,7 +1924,7 @@ export default {
       }
       
       try {
-        await api.delete(`/api/rental_prices.php?id=${id}`)
+        await api.delete(`/rental_prices.php?id=${id}`)
         this.showMessage('Rental price deleted successfully!', 'success')
         await this.fetchRentalPrices(this.selectedItem.id)
       } catch (error) {
@@ -1966,7 +1966,7 @@ export default {
         formData.append('item_id', this.attachmentForm.item_id)
         formData.append('file_type', this.attachmentForm.file_type)
         
-        await api.post('/api/attachments.php', formData, {
+        await api.post('/attachments.php', formData, {
           headers: {
             'Content-Type': 'multipart/form-data'
           }
@@ -1986,7 +1986,7 @@ export default {
       }
       
       try {
-        await api.delete(`/api/attachments.php?id=${id}`)
+        await api.delete(`/attachments.php?id=${id}`)
         this.showMessage('Attachment deleted successfully!', 'success')
         await this.fetchAttachments(this.selectedItem.id)
       } catch (error) {
@@ -2228,7 +2228,7 @@ export default {
     async fetchInvoices() {
       this.invoicesLoading = true
       try {
-        const response = await api.get('/api/invoices.php')
+        const response = await api.get('/invoices.php')
         this.invoices = response.data.records || []
       } catch (error) {
         this.showMessage('Error fetching invoices: ' + error.message, 'error')
@@ -2245,7 +2245,7 @@ export default {
       
       this.invoicesLoading = true
       try {
-        const response = await api.get(`/api/invoices.php?search=${this.invoiceSearch}`)
+        const response = await api.get(`/invoices.php?search=${this.invoiceSearch}`)
         this.invoices = response.data.records || []
       } catch (error) {
         this.showMessage('Error searching invoices: ' + error.message, 'error')
@@ -2307,10 +2307,10 @@ export default {
     async saveInvoice() {
       try {
         if (this.isEditingInvoice) {
-          await api.put('/api/invoices.php', this.invoiceForm)
+          await api.put('/invoices.php', this.invoiceForm)
           this.showMessage('Invoice updated successfully!', 'success')
         } else {
-          await api.post('/api/invoices.php', this.invoiceForm)
+          await api.post('/invoices.php', this.invoiceForm)
           this.showMessage('Invoice created successfully!', 'success')
         }
         
@@ -2327,7 +2327,7 @@ export default {
       }
       
       try {
-        await api.delete(`/api/invoices.php?id=${id}`)
+        await api.delete(`/invoices.php?id=${id}`)
         this.showMessage('Invoice deleted successfully!', 'success')
         await this.fetchInvoices()
       } catch (error) {
@@ -2845,7 +2845,7 @@ export default {
     async fetchAccounts() {
       this.accountsLoading = true
       try {
-        const response = await api.get('/api/chart_of_accounts.php')
+        const response = await api.get('/chart_of_accounts.php')
         this.accounts = response.data.records || []
       } catch (error) {
         this.showMessage('Error fetching accounts: ' + error.message, 'error')
@@ -2858,7 +2858,7 @@ export default {
       this.accountSearch = searchTerm
       this.accountsLoading = true
       try {
-        const response = await api.get(`/api/chart_of_accounts.php?search=${this.accountSearch}`)
+        const response = await api.get(`/chart_of_accounts.php?search=${this.accountSearch}`)
         this.accounts = response.data.records || []
       } catch (error) {
         this.showMessage('Error searching accounts: ' + error.message, 'error')
@@ -2899,7 +2899,7 @@ export default {
       }
       
       try {
-        await api.delete(`/api/chart_of_accounts.php?id=${id}`)
+        await api.delete(`/chart_of_accounts.php?id=${id}`)
         this.showMessage('Account deleted successfully!', 'success')
         this.fetchAccounts()
       } catch (error) {
@@ -2911,7 +2911,7 @@ export default {
     async fetchJournalEntries() {
       this.journalEntriesLoading = true
       try {
-        const response = await api.get('/api/journal_entries.php')
+        const response = await api.get('/journal_entries.php')
         this.journalEntries = response.data.records || []
       } catch (error) {
         this.showMessage('Error fetching journal entries: ' + error.message, 'error')
@@ -2957,7 +2957,7 @@ export default {
       }
       
       try {
-        await api.delete(`/api/journal_entries.php?id=${id}`)
+        await api.delete(`/journal_entries.php?id=${id}`)
         this.showMessage('Journal entry deleted successfully!', 'success')
         this.fetchJournalEntries()
       } catch (error) {

+ 1 - 1
frontend/src/components/ProfileManagement.vue

@@ -254,7 +254,7 @@ export default {
       
       this.passwordLoading = true
       try {
-        await api.put('/users', {
+        await api.put('/users.php', {
           ...this.formData,
           password: this.passwordForm.password,
           current_password: this.passwordForm.current_password

+ 1 - 1
frontend/src/components/accounting/ExcelAccountingSection.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="excel-accounting-section">
+  <div class="excel-accounting-section" v-if="entries.length > 0 || loading">
     <div class="section-header">
       <h2>Excel-pohjan Kirjanpito</h2>
       <div class="header-actions">