--
-- Host: localhost    Database: domopieki_dev
-- ------------------------------------------------------


--
-- Table structure for table `companies`
--

CREATE TABLE `companies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `nip` varchar(10) NOT NULL,
  `legal_form` varchar(100) DEFAULT NULL,
  `regon` varchar(20) DEFAULT NULL,
  `krs` varchar(20) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `postal_code` varchar(10) DEFAULT NULL,
  `country` varchar(100) DEFAULT 'Polska',
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `bank_name` varchar(255) DEFAULT NULL,
  `bank_account` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `is_active` tinyint(1) DEFAULT 1,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `companies`
--

INSERT INTO `companies` VALUES (5,'Klaubas Sp.z o.o.','8952170216','Sp. z o.o.','','','','','','Polska','','','','','','2024-10-26 14:07:37','2024-10-26 14:07:37',1),(12,'Ostrowski','4419691416','S.A.','911120717','8876581','Mieszka I 35','Żywiec','74-189','Polska','0048 65 047 97 ','filip.glowacki@lewandowski.pl','ziolkowski.org.pl','PKO BP','PL76734208134639887961979402','2025-03-03 20:56:53','2025-03-03 20:56:53',1),(13,'Jankowska','6877961757','Sp. z o.o.','697962806','4566690','Pszenna 88A','Bogaczów','85-217','Polska','0048 78 300 46 ','olszewska.tymoteusz@sawicka.net','ostrowska.pl','ING Bank Śląski','PL15015559394156103144975412','2025-03-03 20:56:53','2025-03-03 20:56:53',1),(14,'Ziółkowska','3040872644','S.A.','923626181','4935503','Nadrzeczna 74A/71','Knurów','03-449','Polska','+48 017 743 963','hkozlowska@nowakowska.co.pl','kaczmarek.pl','Alior Bank','PL65484617648976351797806410','2025-03-03 20:56:53','2025-03-03 20:56:53',1);

--
-- Table structure for table `cost_categories`
--

CREATE TABLE `cost_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `cost_categories_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cost_categories`
--

INSERT INTO `cost_categories` VALUES (1,'testowa kategoria','księgowa',1,9,'2025-03-06 14:09:09','2025-03-06 14:09:09'),(2,'Materiały','Koszty związane z zakupem materiałów',1,NULL,'2025-03-06 14:12:58','2025-03-06 14:12:58'),(3,'Transport','Koszty transportu i logistyki',1,NULL,'2025-03-06 14:12:58','2025-03-06 14:12:58'),(4,'Wynagrodzenia','Koszty wynagrodzeń pracowników',1,NULL,'2025-03-06 14:12:58','2025-03-06 14:12:58'),(5,'Narzędzia','Koszty zakupu i utrzymania narzędzi',1,NULL,'2025-03-06 14:12:58','2025-03-06 14:12:58'),(6,'Usługi obce','Koszty usług świadczonych przez podmioty zewnętrzne',1,NULL,'2025-03-06 14:12:58','2025-03-06 14:12:58');

--
-- Table structure for table `cost_files`
--

CREATE TABLE `cost_files` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cost_id` int(11) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_type` varchar(50) DEFAULT NULL,
  `file_size` int(11) DEFAULT NULL,
  `uploaded_by` bigint(20) unsigned DEFAULT NULL,
  `uploaded_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `cost_id` (`cost_id`),
  KEY `uploaded_by` (`uploaded_by`),
  CONSTRAINT `cost_files_ibfk_1` FOREIGN KEY (`cost_id`) REFERENCES `costs` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cost_files_ibfk_2` FOREIGN KEY (`uploaded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `cost_files`
--

INSERT INTO `cost_files` VALUES (1,52,'/uploads/costs/specyfikacja_2096.csv','specyfikacja_2096.csv','text/csv',806277,23,'2025-03-04 17:57:37'),(2,53,'/uploads/costs/zamówienie_8424.xls','zamówienie_8424.xls','application/vnd.ms-excel',4902502,9,'2025-03-04 17:57:37'),(3,56,'/uploads/costs/notatka_9864.doc','notatka_9864.doc','application/msword',4620819,25,'2025-03-04 17:57:37'),(4,56,'/uploads/costs/notatka_8165.png','notatka_8165.png','image/png',2088494,24,'2025-03-04 17:57:37'),(5,58,'/uploads/costs/zamówienie_2065.xls','zamówienie_2065.xls','application/vnd.ms-excel',116057,23,'2025-03-04 17:57:37'),(6,58,'/uploads/costs/umowa_8490.png','umowa_8490.png','image/png',3874537,23,'2025-03-04 17:57:37'),(7,58,'/uploads/costs/faktura_6499.txt','faktura_6499.txt','text/plain',1866407,24,'2025-03-04 17:57:37'),(8,61,'/uploads/costs/umowa_4337.jpg','umowa_4337.jpg','image/jpeg',2822634,5,'2025-03-04 17:57:37'),(9,61,'/uploads/costs/protokół_5127.csv','protokół_5127.csv','text/csv',111466,21,'2025-03-04 17:57:37'),(10,61,'/uploads/costs/specyfikacja_6430.pdf','specyfikacja_6430.pdf','application/pdf',3628289,24,'2025-03-04 17:57:37'),(11,64,'/uploads/costs/rachunek_4209.png','rachunek_4209.png','image/png',4383885,8,'2025-03-04 17:57:37'),(12,66,'/uploads/costs/wycena_1679.pdf','wycena_1679.pdf','application/pdf',1283466,21,'2025-03-04 17:57:37'),(13,66,'/uploads/costs/potwierdzenie_4629.jpg','potwierdzenie_4629.jpg','image/jpeg',2226153,22,'2025-03-04 17:57:37'),(14,68,'/uploads/costs/oferta_7077.txt','oferta_7077.txt','text/plain',4885583,22,'2025-03-04 17:57:37'),(15,68,'/uploads/costs/rachunek_8239.doc','rachunek_8239.doc','application/msword',339339,25,'2025-03-04 17:57:37'),(16,68,'/uploads/costs/wycena_7913.txt','wycena_7913.txt','text/plain',427554,24,'2025-03-04 17:57:37'),(17,70,'/uploads/costs/rachunek_6695.png','rachunek_6695.png','image/png',1539056,22,'2025-03-04 17:57:37'),(18,71,'/uploads/costs/specyfikacja_1484.jpg','specyfikacja_1484.jpg','image/jpeg',4702747,25,'2025-03-04 17:57:37'),(19,71,'/uploads/costs/wycena_7167.csv','wycena_7167.csv','text/csv',2322289,24,'2025-03-04 17:57:37'),(20,71,'/uploads/costs/wycena_8426.csv','wycena_8426.csv','text/csv',1514965,25,'2025-03-04 17:57:37'),(21,72,'/uploads/costs/wycena_2662.pdf','wycena_2662.pdf','application/pdf',1021661,21,'2025-03-04 17:57:37'),(22,72,'/uploads/costs/umowa_4580.xls','umowa_4580.xls','application/vnd.ms-excel',2445174,8,'2025-03-04 17:57:37'),(24,75,'/uploads/costs/zamówienie_6481.png','zamówienie_6481.png','image/png',4611836,21,'2025-03-04 17:57:37'),(25,76,'/uploads/costs/potwierdzenie_3004.png','potwierdzenie_3004.png','image/png',2850942,24,'2025-03-04 17:57:37'),(26,78,'/uploads/costs/faktura_6276.jpg','faktura_6276.jpg','image/jpeg',2844400,24,'2025-03-04 17:57:37'),(27,78,'/uploads/costs/wycena_6069.jpg','wycena_6069.jpg','image/jpeg',2642209,9,'2025-03-04 17:57:37'),(28,79,'/uploads/costs/specyfikacja_3894.txt','specyfikacja_3894.txt','text/plain',3062174,25,'2025-03-04 17:57:37'),(29,79,'/uploads/costs/zamówienie_9266.txt','zamówienie_9266.txt','text/plain',285622,8,'2025-03-04 17:57:37'),(30,80,'/uploads/costs/faktura_1707.doc','faktura_1707.doc','application/msword',2400863,9,'2025-03-04 17:57:37'),(31,80,'/uploads/costs/potwierdzenie_5015.pdf','potwierdzenie_5015.pdf','application/pdf',2208453,22,'2025-03-04 17:57:37'),(32,83,'/uploads/costs/umowa_8183.jpg','umowa_8183.jpg','image/jpeg',1563077,8,'2025-03-04 17:57:37'),(33,83,'/uploads/costs/rachunek_2428.png','rachunek_2428.png','image/png',436383,22,'2025-03-04 17:57:37'),(34,83,'/uploads/costs/protokół_8808.jpg','protokół_8808.jpg','image/jpeg',59304,22,'2025-03-04 17:57:37'),(35,84,'/uploads/costs/zamówienie_2859.png','zamówienie_2859.png','image/png',1171158,23,'2025-03-04 17:57:37'),(36,84,'/uploads/costs/protokół_7737.csv','protokół_7737.csv','text/csv',4552935,21,'2025-03-04 17:57:37'),(37,85,'/uploads/costs/specyfikacja_6571.txt','specyfikacja_6571.txt','text/plain',352618,9,'2025-03-04 17:57:37'),(38,86,'/uploads/costs/potwierdzenie_7005.txt','potwierdzenie_7005.txt','text/plain',2843400,22,'2025-03-04 17:57:37'),(39,86,'/uploads/costs/protokół_9837.pdf','protokół_9837.pdf','application/pdf',1244353,5,'2025-03-04 17:57:37'),(40,86,'/uploads/costs/rachunek_1379.png','rachunek_1379.png','image/png',3007011,23,'2025-03-04 17:57:37'),(41,87,'/uploads/costs/zamówienie_9048.png','zamówienie_9048.png','image/png',1715633,21,'2025-03-04 17:57:37'),(42,88,'/uploads/costs/notatka_1595.pdf','notatka_1595.pdf','application/pdf',2360792,25,'2025-03-04 17:57:37'),(43,89,'/uploads/costs/zamówienie_1447.png','zamówienie_1447.png','image/png',3520967,25,'2025-03-04 17:57:37'),(44,89,'/uploads/costs/protokół_5905.csv','protokół_5905.csv','text/csv',1615429,8,'2025-03-04 17:57:37'),(45,90,'/uploads/costs/notatka_3789.csv','notatka_3789.csv','text/csv',1826873,24,'2025-03-04 17:57:37'),(46,90,'/uploads/costs/rachunek_6276.doc','rachunek_6276.doc','application/msword',1355465,21,'2025-03-04 17:57:37'),(47,90,'/uploads/costs/notatka_5519.txt','notatka_5519.txt','text/plain',1047490,5,'2025-03-04 17:57:37'),(48,91,'/uploads/costs/notatka_1233.doc','notatka_1233.doc','application/msword',1178907,25,'2025-03-04 17:57:37'),(49,92,'/uploads/costs/notatka_9889.png','notatka_9889.png','image/png',126618,9,'2025-03-04 17:57:37'),(50,92,'/uploads/costs/umowa_2326.txt','umowa_2326.txt','text/plain',966156,25,'2025-03-04 17:57:37'),(51,93,'/uploads/costs/rachunek_4223.pdf','rachunek_4223.pdf','application/pdf',3309646,9,'2025-03-04 17:57:37'),(52,93,'/uploads/costs/faktura_6308.txt','faktura_6308.txt','text/plain',4926128,25,'2025-03-04 17:57:37'),(53,94,'/uploads/costs/rachunek_1060.txt','rachunek_1060.txt','text/plain',4211345,22,'2025-03-04 17:57:37'),(57,96,'/uploads/costs/potwierdzenie_2669.doc','potwierdzenie_2669.doc','application/msword',4114434,21,'2025-03-04 17:57:37'),(58,97,'/uploads/costs/umowa_2296.csv','umowa_2296.csv','text/csv',621221,8,'2025-03-04 17:57:37'),(59,98,'/uploads/costs/zamówienie_8685.doc','zamówienie_8685.doc','application/msword',1805244,25,'2025-03-04 17:57:37'),(60,98,'/uploads/costs/potwierdzenie_5100.csv','potwierdzenie_5100.csv','text/csv',168519,21,'2025-03-04 17:57:37'),(61,99,'/uploads/costs/rachunek_7057.doc','rachunek_7057.doc','application/msword',1491399,25,'2025-03-04 17:57:37'),(62,100,'/uploads/costs/oferta_3364.doc','oferta_3364.doc','application/msword',3692485,24,'2025-03-04 17:57:37'),(63,100,'/uploads/costs/protokół_6278.doc','protokół_6278.doc','application/msword',2164902,22,'2025-03-04 17:57:37'),(64,105,'/uploads/costs/zamówienie_4249.jpg','zamówienie_4249.jpg','image/jpeg',4821283,5,'2025-03-06 23:00:00'),(65,107,'/uploads/costs/notatka_3712.pdf','notatka_3712.pdf','application/pdf',3010051,5,'2025-03-06 23:00:00'),(66,107,'/uploads/costs/zamówienie_5534.jpg','zamówienie_5534.jpg','image/jpeg',4218498,5,'2025-03-06 23:00:00'),(67,109,'/uploads/costs/potwierdzenie_4897.jpg','potwierdzenie_4897.jpg','image/jpeg',4025533,5,'2025-03-06 23:00:00'),(68,110,'/uploads/costs/oferta_3790.txt','oferta_3790.txt','text/plain',1653522,25,'2025-03-06 23:00:00'),(69,113,'/uploads/costs/specyfikacja_8162.csv','specyfikacja_8162.csv','text/csv',681211,24,'2025-03-06 23:00:00'),(70,113,'/uploads/costs/rachunek_2353.csv','rachunek_2353.csv','text/csv',2170509,24,'2025-03-06 23:00:00'),(71,113,'/uploads/costs/specyfikacja_8813.txt','specyfikacja_8813.txt','text/plain',2481747,24,'2025-03-06 23:00:00'),(72,116,'/uploads/costs/protokół_6073.png','protokół_6073.png','image/png',2955487,25,'2025-03-06 23:00:00'),(73,116,'/uploads/costs/rachunek_7903.jpg','rachunek_7903.jpg','image/jpeg',1127016,25,'2025-03-06 23:00:00'),(74,116,'/uploads/costs/rachunek_8390.jpg','rachunek_8390.jpg','image/jpeg',220281,25,'2025-03-06 23:00:00'),(75,117,'/uploads/costs/umowa_1243.pdf','umowa_1243.pdf','application/pdf',1115701,21,'2025-03-06 23:00:00'),(76,122,'/uploads/costs/potwierdzenie_1798.csv','potwierdzenie_1798.csv','text/csv',1383899,5,'2025-03-06 23:00:00'),(77,122,'/uploads/costs/wycena_2352.csv','wycena_2352.csv','text/csv',2190806,5,'2025-03-06 23:00:00'),(78,124,'/uploads/costs/notatka_6996.png','notatka_6996.png','image/png',4516951,21,'2025-03-06 23:00:00'),(79,124,'/uploads/costs/potwierdzenie_6560.jpg','potwierdzenie_6560.jpg','image/jpeg',4549048,21,'2025-03-06 23:00:00'),(80,124,'/uploads/costs/umowa_6966.csv','umowa_6966.csv','text/csv',4354248,21,'2025-03-06 23:00:00'),(81,125,'/uploads/costs/protokół_9797.png','protokół_9797.png','image/png',1804943,24,'2025-03-06 23:00:00'),(82,125,'/uploads/costs/rachunek_5766.csv','rachunek_5766.csv','text/csv',873894,24,'2025-03-06 23:00:00'),(83,126,'/uploads/costs/zamówienie_2284.jpg','zamówienie_2284.jpg','image/jpeg',844859,21,'2025-03-06 23:00:00'),(84,131,'/uploads/costs/zamówienie_1905.png','zamówienie_1905.png','image/png',3141504,22,'2025-03-06 23:00:00'),(85,132,'/uploads/costs/wycena_7594.jpg','wycena_7594.jpg','image/jpeg',148351,22,'2025-03-06 23:00:00'),(86,132,'/uploads/costs/protokół_3907.doc','protokół_3907.doc','application/msword',4360598,22,'2025-03-06 23:00:00'),(87,133,'/uploads/costs/notatka_8590.jpg','notatka_8590.jpg','image/jpeg',4973263,25,'2025-03-06 23:00:00'),(88,133,'/uploads/costs/notatka_2361.txt','notatka_2361.txt','text/plain',4866694,25,'2025-03-06 23:00:00'),(89,138,'/uploads/costs/umowa_2489.jpg','umowa_2489.jpg','image/jpeg',1800514,25,'2025-03-06 23:00:00');

--
-- Table structure for table `cost_payments`
--

CREATE TABLE `cost_payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cost_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_date` date NOT NULL,
  `payment_method` enum('gotówka','przelew','karta','inne') NOT NULL,
  `description` text DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `cost_id` (`cost_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `cost_payments_ibfk_1` FOREIGN KEY (`cost_id`) REFERENCES `costs` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cost_payments_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=165 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `cost_payments`
--

INSERT INTO `cost_payments` VALUES (63,55,4.72,'2024-07-02','przelew',NULL,21,'2025-03-04 17:57:37'),(64,55,13.14,'2024-06-12','karta',NULL,21,'2025-03-04 17:57:37'),(65,55,21.45,'2024-06-26','przelew',NULL,21,'2025-03-04 17:57:37'),(66,56,28.28,'2024-07-18','karta',NULL,5,'2025-03-04 17:57:37'),(67,56,29.69,'2024-07-20','przelew',NULL,5,'2025-03-04 17:57:37'),(68,56,12.73,'2024-08-08','przelew',NULL,5,'2025-03-04 17:57:37'),(69,57,2.00,'2024-06-26','przelew',NULL,9,'2025-03-04 17:57:37'),(70,57,2.19,'2024-06-22','przelew',NULL,9,'2025-03-04 17:57:37'),(71,57,29.10,'2024-07-08','gotówka',NULL,9,'2025-03-04 17:57:37'),(72,58,44.98,'2024-08-02','karta',NULL,8,'2025-03-04 17:57:37'),(73,58,2.42,'2024-08-06','gotówka',NULL,8,'2025-03-04 17:57:37'),(74,58,11.01,'2024-08-02','przelew',NULL,8,'2025-03-04 17:57:37'),(76,61,0.50,'2024-05-09','gotówka',NULL,5,'2025-03-04 17:57:37'),(77,63,26.07,'2024-07-24','przelew',NULL,23,'2025-03-04 17:57:37'),(78,67,38.45,'2024-08-20','gotówka',NULL,8,'2025-03-04 17:57:37'),(79,67,2.71,'2024-08-16','karta',NULL,8,'2025-03-04 17:57:37'),(80,67,8.14,'2024-08-26','gotówka',NULL,8,'2025-03-04 17:57:37'),(81,68,3.04,'2024-07-29','przelew',NULL,21,'2025-03-04 17:57:37'),(82,68,1.63,'2024-07-31','przelew',NULL,21,'2025-03-04 17:57:37'),(83,69,13.11,'2025-01-27','karta',NULL,8,'2025-03-04 17:57:37'),(84,70,34.16,'2024-10-13','gotówka',NULL,9,'2025-03-04 17:57:37'),(85,71,45.34,'2024-08-13','karta',NULL,8,'2025-03-04 17:57:37'),(86,71,28.99,'2024-08-07','przelew',NULL,8,'2025-03-04 17:57:37'),(87,72,15.23,'2025-01-21','przelew',NULL,22,'2025-03-04 17:57:37'),(88,73,3.64,'2024-03-26','przelew',NULL,23,'2025-03-04 17:57:37'),(89,73,87.35,'2024-04-12','karta',NULL,23,'2025-03-04 17:57:37'),(92,75,11.57,'2024-10-31','przelew',NULL,23,'2025-03-04 17:57:37'),(93,75,7.39,'2024-11-10','gotówka',NULL,23,'2025-03-04 17:57:37'),(94,76,39.94,'2024-11-14','gotówka',NULL,23,'2025-03-04 17:57:37'),(95,76,35.42,'2024-11-15','gotówka',NULL,23,'2025-03-04 17:57:37'),(96,77,16.65,'2024-05-04','przelew',NULL,24,'2025-03-04 17:57:37'),(97,77,18.03,'2024-05-24','gotówka',NULL,24,'2025-03-04 17:57:37'),(98,78,9.35,'2024-06-16','gotówka',NULL,9,'2025-03-04 17:57:37'),(99,78,15.93,'2024-06-19','przelew',NULL,9,'2025-03-04 17:57:37'),(100,79,42.91,'2024-12-23','karta',NULL,21,'2025-03-04 17:57:37'),(101,80,6.30,'2024-06-24','przelew',NULL,9,'2025-03-04 17:57:37'),(102,81,27.35,'2024-04-23','gotówka',NULL,21,'2025-03-04 17:57:37'),(103,81,11.17,'2024-04-14','karta',NULL,21,'2025-03-04 17:57:37'),(104,82,61.62,'2024-06-24','przelew',NULL,24,'2025-03-04 17:57:37'),(105,83,18.57,'2024-08-09','przelew',NULL,25,'2025-03-04 17:57:37'),(106,85,18.72,'2024-04-12','przelew',NULL,23,'2025-03-04 17:57:37'),(107,86,51.81,'2024-05-24','przelew',NULL,9,'2025-03-04 17:57:37'),(108,87,3.72,'2024-11-15','karta',NULL,25,'2025-03-04 17:57:37'),(109,88,73.32,'2025-02-20','gotówka',NULL,23,'2025-03-04 17:57:37'),(110,89,23.80,'2024-11-27','karta',NULL,21,'2025-03-04 17:57:37'),(111,89,14.40,'2024-12-12','gotówka',NULL,21,'2025-03-04 17:57:37'),(112,89,5.88,'2024-12-09','karta',NULL,21,'2025-03-04 17:57:37'),(113,90,35.57,'2024-08-01','przelew',NULL,23,'2025-03-04 17:57:37'),(114,91,4.73,'2025-03-06','przelew',NULL,25,'2025-03-04 17:57:37'),(115,91,11.58,'2025-02-24','gotówka',NULL,25,'2025-03-04 17:57:37'),(116,92,0.25,'2024-03-16','gotówka',NULL,25,'2025-03-04 17:57:37'),(117,92,0.10,'2024-03-31','przelew',NULL,25,'2025-03-04 17:57:37'),(118,94,6.33,'2024-05-04','gotówka',NULL,8,'2025-03-04 17:57:37'),(120,96,0.50,'2024-11-20','karta',NULL,21,'2025-03-04 17:57:37'),(121,96,0.56,'2024-12-04','karta',NULL,21,'2025-03-04 17:57:37'),(122,98,73.44,'2024-05-08','gotówka',NULL,8,'2025-03-04 17:57:37'),(123,99,18.97,'2024-07-19','gotówka',NULL,25,'2025-03-04 17:57:37'),(124,100,43.94,'2025-02-02','gotówka',NULL,23,'2025-03-04 17:57:37'),(125,103,500.93,'2025-02-05','przelew','Płatność za Wynajem sali konferencyjnej',24,'2025-03-06 23:00:00'),(126,103,612.73,'2025-03-05','gotówka','Płatność za Wynajem sali konferencyjnej',24,'2025-03-06 23:00:00'),(127,103,1163.29,'2025-03-01','karta','Płatność za Wynajem sali konferencyjnej',24,'2025-03-06 23:00:00'),(128,104,1879.36,'2025-01-29','gotówka','Płatność za Delegacja służbowa',22,'2025-03-06 23:00:00'),(129,106,1725.14,'2025-01-29','gotówka','Płatność za Licencje na oprogramowanie',25,'2025-03-06 23:00:00'),(130,106,3502.56,'2025-03-02','przelew','Płatność za Licencje na oprogramowanie',25,'2025-03-06 23:00:00'),(131,107,1122.76,'2025-02-24','inne','Płatność za Czynsz za biuro',5,'2025-03-06 23:00:00'),(132,109,709.45,'2025-02-15','gotówka','Płatność za Licencje na oprogramowanie',5,'2025-03-06 23:00:00'),(133,109,695.40,'2025-02-18','gotówka','Płatność za Licencje na oprogramowanie',5,'2025-03-06 23:00:00'),(134,112,6296.33,'2025-02-22','gotówka','Płatność za Naprawa samochodu',22,'2025-03-06 23:00:00'),(135,112,2212.23,'2025-02-18','inne','Płatność za Naprawa samochodu',22,'2025-03-06 23:00:00'),(136,113,9021.30,'2025-02-06','przelew','Płatność za Faktura za gaz',24,'2025-03-06 23:00:00'),(137,116,1562.74,'2025-02-09','karta','Płatność za Zakup mebli biurowych',25,'2025-03-06 23:00:00'),(138,117,9311.63,'2025-03-03','gotówka','Płatność za Faktura za prąd',21,'2025-03-06 23:00:00'),(139,120,82.24,'2025-03-05','inne','Płatność za Czynsz za biuro',24,'2025-03-06 23:00:00'),(140,120,62.39,'2025-03-05','przelew','Płatność za Czynsz za biuro',24,'2025-03-06 23:00:00'),(141,120,99.65,'2025-03-03','gotówka','Płatność za Czynsz za biuro',24,'2025-03-06 23:00:00'),(142,121,1342.44,'2025-01-01','inne','Płatność za Naprawa sprzętu',24,'2025-03-06 23:00:00'),(143,121,910.07,'2025-02-21','karta','Płatność za Naprawa sprzętu',24,'2025-03-06 23:00:00'),(144,121,2658.84,'2025-02-21','przelew','Płatność za Naprawa sprzętu',24,'2025-03-06 23:00:00'),(145,123,6476.63,'2025-02-27','inne','Płatność za Zakup oprogramowania',21,'2025-03-06 23:00:00'),(146,126,4993.70,'2025-02-27','karta','Płatność za Zakup mebli biurowych',21,'2025-03-06 23:00:00'),(147,126,2349.97,'2025-02-27','karta','Płatność za Zakup mebli biurowych',21,'2025-03-06 23:00:00'),(148,127,732.38,'2025-02-27','przelew','Płatność za Kampania reklamowa',24,'2025-03-06 23:00:00'),(149,127,1567.30,'2025-03-07','karta','Płatność za Kampania reklamowa',24,'2025-03-06 23:00:00'),(150,127,1362.23,'2025-02-27','karta','Płatność za Kampania reklamowa',24,'2025-03-06 23:00:00'),(151,129,6807.85,'2025-02-27','gotówka','Płatność za Czynsz za biuro',5,'2025-03-06 23:00:00'),(152,130,957.70,'2025-02-25','karta','Płatność za Szkolenie pracowników',25,'2025-03-06 23:00:00'),(153,130,2462.64,'2025-01-12','karta','Płatność za Szkolenie pracowników',25,'2025-03-06 23:00:00'),(154,131,2344.06,'2025-02-15','inne','Płatność za Kampania reklamowa',22,'2025-03-06 23:00:00'),(155,132,1931.93,'2025-01-13','gotówka','Płatność za Usługi prawne',22,'2025-03-06 23:00:00'),(156,133,408.73,'2025-03-07','inne','Płatność za Zakup materiałów biurowych',25,'2025-03-06 23:00:00'),(158,137,997.95,'2025-03-07','gotówka','Płatność za Licencje na oprogramowanie',5,'2025-03-06 23:00:00'),(159,139,1538.25,'2025-03-07','karta','Płatność za Faktura za gaz',25,'2025-03-06 23:00:00'),(160,139,1047.05,'2025-03-07','karta','Płatność za Faktura za gaz',25,'2025-03-06 23:00:00'),(161,140,8287.73,'2025-02-28','gotówka','Płatność za Licencje na oprogramowanie',24,'2025-03-06 23:00:00'),(162,141,8985.89,'2025-03-04','karta','Płatność za Usługi prawne',22,'2025-03-06 23:00:00'),(163,142,5825.52,'2025-03-04','przelew','Płatność za Licencje na oprogramowanie',24,'2025-03-06 23:00:00'),(164,142,3348.52,'2025-03-07','karta','Płatność za Licencje na oprogramowanie',24,'2025-03-06 23:00:00');

--
-- Table structure for table `cost_tag_relations`
--

CREATE TABLE `cost_tag_relations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cost_id` int(11) NOT NULL,
  `tag_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cost_tag_unique` (`cost_id`,`tag_id`),
  KEY `tag_id` (`tag_id`),
  CONSTRAINT `cost_tag_relations_ibfk_1` FOREIGN KEY (`cost_id`) REFERENCES `costs` (`id`) ON DELETE CASCADE,
  CONSTRAINT `cost_tag_relations_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `cost_tags` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=366 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `cost_tag_relations`
--

INSERT INTO `cost_tag_relations` VALUES (103,51,17),(104,51,18),(105,52,12),(106,52,13),(107,52,19),(108,53,12),(109,53,15),(110,53,17),(111,54,12),(112,54,15),(113,54,16),(114,55,12),(115,55,14),(116,55,17),(117,56,17),(118,56,19),(119,57,15),(120,57,19),(121,58,18),(123,60,12),(124,60,14),(125,60,15),(126,61,13),(127,61,19),(128,62,12),(129,62,16),(130,62,19),(131,63,14),(132,64,14),(133,65,17),(134,66,20),(135,67,14),(136,67,18),(137,67,19),(138,68,20),(139,69,15),(140,69,19),(141,69,20),(142,70,12),(143,70,17),(144,70,18),(145,71,12),(146,71,16),(147,72,13),(148,72,14),(149,72,16),(150,73,14),(151,73,20),(153,75,21),(154,76,12),(155,76,14),(156,76,18),(157,77,20),(158,77,21),(159,78,15),(160,79,17),(161,79,18),(162,80,15),(163,81,17),(164,81,18),(165,82,19),(166,83,14),(167,83,21),(168,84,20),(169,85,13),(170,85,21),(171,86,18),(172,87,16),(173,88,13),(174,88,19),(175,89,13),(176,89,18),(177,89,20),(178,90,16),(179,91,14),(180,92,12),(181,92,14),(182,92,18),(183,93,12),(184,93,13),(185,93,17),(186,94,14),(187,94,16),(190,96,16),(191,96,21),(192,97,17),(193,97,20),(194,98,16),(195,98,17),(196,98,20),(197,99,12),(198,99,14),(199,99,17),(200,100,12),(201,103,15),(202,103,21),(203,104,13),(204,104,14),(205,104,17),(206,105,12),(207,106,12),(208,106,16),(209,106,21),(210,107,13),(211,108,17),(212,108,19),(213,109,20),(214,110,12),(215,110,16),(216,110,18),(217,111,16),(218,112,13),(219,112,19),(220,112,21),(221,113,17),(222,113,21),(223,114,19),(224,115,17),(225,115,20),(226,116,15),(227,117,14),(228,117,19),(229,117,21),(230,118,12),(231,118,21),(232,119,13),(233,119,15),(234,119,20),(235,120,15),(236,120,17),(237,120,20),(238,121,17),(239,122,12),(240,122,16),(241,123,13),(242,123,16),(243,124,13),(244,125,21),(245,126,14),(246,127,12),(247,127,18),(248,128,18),(249,128,20),(250,129,13),(251,129,16),(252,130,15),(253,130,17),(254,130,21),(255,131,12),(256,131,14),(257,132,13),(258,132,18),(259,132,20),(260,133,15),(262,135,19),(263,135,20),(264,135,21),(265,136,12),(266,136,14),(267,136,17),(269,137,21),(270,138,14),(271,138,17),(272,139,16),(273,139,19),(274,140,13),(275,141,16),(276,141,17),(277,141,20),(278,142,12),(279,142,21),(283,144,12),(284,144,16),(364,152,21),(280,155,17),(281,155,21),(363,157,16),(362,157,21),(361,159,17),(365,160,17);

--
-- Table structure for table `cost_tags`
--

CREATE TABLE `cost_tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `color` varchar(7) DEFAULT '#3498db',
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `cost_tags_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cost_tags`
--

INSERT INTO `cost_tags` VALUES (12,'Paliwo','#FF5733',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(13,'Serwis','#33FF57',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(14,'Ubezpieczenie','#3357FF',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(15,'Wynagrodzenia','#F3FF33',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(16,'Materiały biurowe','#FF33F3',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(17,'Czynsz','#33FFF3',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(18,'Marketing','#FF8033',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(19,'Szkolenia','#8033FF',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(20,'Podróże służbowe','#33FF80',5,'2025-03-04 17:57:37','2025-03-04 17:57:37'),(21,'Inne','#808080',5,'2025-03-04 17:57:37','2025-03-04 17:57:37');

--
-- Table structure for table `costs`
--

CREATE TABLE `costs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'PLN',
  `payment_method` varchar(50) DEFAULT NULL,
  `date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('unpaid','partially_paid','paid') NOT NULL DEFAULT 'unpaid',
  `paid_amount` decimal(10,2) DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `category_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `company_id` (`company_id`),
  KEY `created_by` (`created_by`),
  KEY `idx_date` (`date`),
  KEY `idx_status` (`status`),
  KEY `idx_company_id` (`company_id`),
  KEY `idx_category_id` (`category_id`),
  CONSTRAINT `costs_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  CONSTRAINT `costs_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `cost_categories` (`id`) ON DELETE SET NULL,
  CONSTRAINT `costs_ibfk_3` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `costs`
--

INSERT INTO `costs` VALUES (51,14,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2024-07-04',14.35,'PLN',NULL,'2024-07-04',NULL,'unpaid',0.00,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(52,5,'Czynsz za biuro','Opis kosztu: Czynsz za biuro z dnia 2024-03-14',94.79,'PLN',NULL,'2024-03-14',NULL,'unpaid',0.00,8,'2025-03-04 17:57:37','2025-03-06 14:13:25',2),(53,12,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2024-09-11',29.24,'PLN',NULL,'2024-09-11',NULL,'unpaid',0.00,22,'2025-03-04 17:57:37','2025-03-06 14:13:25',6),(54,13,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2024-09-20',99.37,'PLN',NULL,'2024-09-20',NULL,'unpaid',0.00,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(55,5,'Szkolenie pracowników','Opis kosztu: Szkolenie pracowników z dnia 2024-06-08',39.31,'PLN',NULL,'2024-06-08',NULL,'paid',39.31,21,'2025-03-04 17:57:37','2025-03-06 14:13:26',4),(56,5,'Konferencja branżowa','Opis kosztu: Konferencja branżowa z dnia 2024-07-09',70.70,'PLN',NULL,'2024-07-09',NULL,'paid',70.70,5,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(57,5,'Catering','Opis kosztu: Catering z dnia 2024-06-20',33.29,'PLN',NULL,'2024-06-20',NULL,'paid',33.29,9,'2025-03-04 17:57:37','2025-03-06 14:13:26',3),(58,13,'Podatki','Opis kosztu: Podatki z dnia 2024-07-11',58.41,'PLN',NULL,'2024-07-11',NULL,'paid',58.41,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(60,14,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2024-12-05',76.90,'PLN',NULL,'2024-12-05',NULL,'unpaid',0.00,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(61,12,'Szkolenie pracowników','Opis kosztu: Szkolenie pracowników z dnia 2024-04-30',16.76,'PLN',NULL,'2024-04-30',NULL,'partially_paid',0.50,5,'2025-03-04 17:57:37','2025-03-06 14:13:26',4),(62,5,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2024-03-31',52.03,'PLN',NULL,'2024-03-31',NULL,'unpaid',0.00,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(63,12,'Szkolenie pracowników','Opis kosztu: Szkolenie pracowników z dnia 2024-07-08',50.14,'PLN',NULL,'2024-07-08',NULL,'partially_paid',26.07,23,'2025-03-04 17:57:37','2025-03-06 14:13:26',4),(64,5,'Naprawa samochodu','Opis kosztu: Naprawa samochodu z dnia 2024-07-07',73.30,'PLN',NULL,'2024-07-07',NULL,'unpaid',0.00,9,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(65,13,'Catering','Opis kosztu: Catering z dnia 2024-10-21',41.84,'PLN',NULL,'2024-10-21',NULL,'unpaid',0.00,25,'2025-03-04 17:57:37','2025-03-06 14:13:26',3),(66,12,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2024-12-10',79.14,'PLN',NULL,'2024-12-10',NULL,'unpaid',0.00,5,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(67,14,'Delegacja','Opis kosztu: Delegacja z dnia 2024-08-12',49.30,'PLN',NULL,'2024-08-12',NULL,'paid',49.30,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(68,13,'Podatki','Opis kosztu: Podatki z dnia 2024-07-01',12.61,'PLN',NULL,'2024-07-01',NULL,'partially_paid',4.67,21,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(69,14,'Utrzymanie strony www','Opis kosztu: Utrzymanie strony www z dnia 2025-01-21',40.96,'PLN',NULL,'2025-01-21',NULL,'partially_paid',13.11,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(70,13,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2024-09-18',81.33,'PLN',NULL,'2024-09-18',NULL,'partially_paid',34.16,9,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(71,12,'Materiały biurowe','Opis kosztu: Materiały biurowe z dnia 2024-08-03',99.11,'PLN',NULL,'2024-08-03',NULL,'partially_paid',74.33,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(72,5,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2025-01-06',20.86,'PLN',NULL,'2025-01-06',NULL,'partially_paid',15.23,22,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(73,13,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2024-03-23',90.99,'PLN',NULL,'2024-03-23',NULL,'paid',90.99,23,'2025-03-04 17:57:37','2025-03-06 14:13:25',6),(75,13,'Zakup paliwa','Opis kosztu: Zakup paliwa z dnia 2024-10-11',26.34,'PLN',NULL,'2024-10-11',NULL,'partially_paid',18.96,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(76,5,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2024-11-01',75.36,'PLN',NULL,'2024-11-01',NULL,'paid',75.36,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(77,5,'Kampania reklamowa','Opis kosztu: Kampania reklamowa z dnia 2024-04-27',93.73,'PLN',NULL,'2024-04-27',NULL,'partially_paid',34.68,24,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(78,13,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2024-05-30',57.45,'PLN',NULL,'2024-05-30',NULL,'partially_paid',25.28,9,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(79,14,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2024-12-10',42.91,'PLN',NULL,'2024-12-10',NULL,'paid',42.91,21,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(80,13,'Utrzymanie strony www','Opis kosztu: Utrzymanie strony www z dnia 2024-06-22',6.30,'PLN',NULL,'2024-06-22',NULL,'paid',6.30,9,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(81,12,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2024-03-25',61.14,'PLN',NULL,'2024-03-25',NULL,'partially_paid',38.52,21,'2025-03-04 17:57:37','2025-03-06 14:13:25',6),(82,14,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2024-06-22',69.24,'PLN',NULL,'2024-06-22',NULL,'partially_paid',61.62,24,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(83,13,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2024-07-19',25.44,'PLN',NULL,'2024-07-19',NULL,'partially_paid',18.57,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(84,13,'Catering','Opis kosztu: Catering z dnia 2024-08-09',55.62,'PLN',NULL,'2024-08-09',NULL,'unpaid',0.00,23,'2025-03-04 17:57:37','2025-03-06 14:13:26',3),(85,13,'Konferencja branżowa','Opis kosztu: Konferencja branżowa z dnia 2024-04-08',98.55,'PLN',NULL,'2024-04-08',NULL,'partially_paid',18.72,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(86,5,'Energia elektryczna','Opis kosztu: Energia elektryczna z dnia 2024-05-01',86.35,'PLN',NULL,'2024-05-01',NULL,'partially_paid',51.81,9,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(87,14,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2024-11-14',3.72,'PLN',NULL,'2024-11-14',NULL,'paid',3.72,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(88,12,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2025-02-09',73.32,'PLN',NULL,'2025-02-09',NULL,'paid',73.32,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(89,13,'Usługi księgowe','Opis kosztu: Usługi księgowe z dnia 2024-11-16',44.08,'PLN',NULL,'2024-11-16',NULL,'paid',44.08,21,'2025-03-04 17:57:37','2025-03-06 14:13:25',6),(90,5,'Internet i telefon','Opis kosztu: Internet i telefon z dnia 2024-07-28',62.41,'PLN',NULL,'2024-07-28',NULL,'partially_paid',35.57,23,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(91,5,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2025-02-22',58.26,'PLN',NULL,'2025-02-22',NULL,'partially_paid',16.31,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(92,14,'Kampania reklamowa','Opis kosztu: Kampania reklamowa z dnia 2024-03-10',6.96,'PLN',NULL,'2024-03-10',NULL,'partially_paid',0.35,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(93,12,'Konferencja branżowa','Opis kosztu: Konferencja branżowa z dnia 2024-05-01',69.45,'PLN',NULL,'2024-05-01',NULL,'unpaid',0.00,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(94,5,'Delegacja','Opis kosztu: Delegacja z dnia 2024-04-26',6.53,'PLN',NULL,'2024-04-26',NULL,'partially_paid',6.33,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(96,5,'Czynsz za biuro','Opis kosztu: Czynsz za biuro z dnia 2024-11-14',53.14,'PLN',NULL,'2024-11-14',NULL,'partially_paid',1.06,21,'2025-03-04 17:57:37','2025-03-06 14:13:25',2),(97,13,'Zakup paliwa','Opis kosztu: Zakup paliwa z dnia 2024-05-01',27.89,'PLN',NULL,'2024-05-01',NULL,'unpaid',0.00,5,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(98,13,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2024-05-06',83.46,'PLN',NULL,'2024-05-06',NULL,'partially_paid',73.44,8,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(99,14,'Delegacja','Opis kosztu: Delegacja z dnia 2024-06-22',29.18,'PLN',NULL,'2024-06-22',NULL,'partially_paid',18.97,25,'2025-03-04 17:57:37','2025-03-04 17:57:37',NULL),(100,13,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2025-01-13',66.57,'PLN',NULL,'2025-01-13',NULL,'partially_paid',43.94,23,'2025-03-04 17:57:37','2025-03-06 14:13:25',6),(103,13,'Wynajem sali konferencyjnej','Opis kosztu: Wynajem sali konferencyjnej z dnia 2025-02-04',2276.95,'PLN','gotówka','2025-02-04','2025-02-14','paid',2276.95,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(104,5,'Delegacja służbowa','Opis kosztu: Delegacja służbowa z dnia 2024-12-22',1879.36,'EUR','gotówka','2024-12-22','2024-12-25','paid',1879.36,22,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(105,5,'Szkolenie pracowników','Opis kosztu: Szkolenie pracowników z dnia 2025-01-03',5453.79,'PLN','karta','2025-01-03','2025-01-03','unpaid',0.00,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(106,5,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2025-01-29',6223.45,'PLN','przelew','2025-01-29','2025-02-16','partially_paid',5227.70,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(107,14,'Czynsz za biuro','Opis kosztu: Czynsz za biuro z dnia 2025-02-12',2954.64,'EUR','BLIK','2025-02-12','2025-02-28','partially_paid',1122.76,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(108,12,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2025-02-28',8296.75,'USD','BLIK','2025-02-28','2025-03-22','unpaid',0.00,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(109,5,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2025-01-21',2926.78,'USD','karta','2025-01-21','2025-01-31','partially_paid',1404.85,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(110,5,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2024-12-29',7549.74,'USD','karta','2024-12-29','2025-01-10','unpaid',0.00,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(111,13,'Ubezpieczenie majątkowe','Opis kosztu: Ubezpieczenie majątkowe z dnia 2025-02-15',4467.31,'EUR','BLIK','2025-02-15','2025-03-04','unpaid',0.00,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(112,13,'Naprawa samochodu','Opis kosztu: Naprawa samochodu z dnia 2025-02-16',8508.56,'USD',NULL,'2025-02-16','2025-03-07','paid',8508.56,22,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(113,12,'Faktura za gaz','Opis kosztu: Faktura za gaz z dnia 2025-01-18',9021.30,'EUR',NULL,'2025-01-18','2025-01-30','paid',9021.30,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(114,5,'Podatki','Opis kosztu: Podatki z dnia 2025-01-21',8166.82,'EUR','przelew','2025-01-21','2025-01-31','unpaid',0.00,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(115,5,'Ubezpieczenie majątkowe','Opis kosztu: Ubezpieczenie majątkowe z dnia 2025-01-08',1441.28,'EUR','karta','2025-01-08','2025-01-19','unpaid',0.00,22,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(116,5,'Zakup mebli biurowych','Opis kosztu: Zakup mebli biurowych z dnia 2025-01-22',9767.13,'PLN',NULL,'2025-01-22','2025-02-13','partially_paid',1562.74,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(117,12,'Faktura za prąd','Opis kosztu: Faktura za prąd z dnia 2025-02-27',9311.63,'EUR','gotówka','2025-02-27','2025-03-12','paid',9311.63,21,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(118,13,'Usługi kurierskie','Opis kosztu: Usługi kurierskie z dnia 2025-01-12',8207.91,'PLN','gotówka','2025-01-12','2025-02-09','unpaid',0.00,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(119,14,'Faktura za wodę','Opis kosztu: Faktura za wodę z dnia 2025-01-25',6282.75,'PLN','BLIK','2025-01-25','2025-02-11','unpaid',0.00,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(120,13,'Czynsz za biuro','Opis kosztu: Czynsz za biuro z dnia 2025-03-02',244.28,'PLN','gotówka','2025-03-02','2025-03-14','paid',244.28,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(121,13,'Naprawa sprzętu','Opis kosztu: Naprawa sprzętu z dnia 2024-12-12',4911.35,'EUR',NULL,'2024-12-12','2024-12-27','paid',4911.35,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(122,5,'Faktura za prąd','Opis kosztu: Faktura za prąd z dnia 2024-12-23',5188.07,'USD',NULL,'2024-12-23','2025-01-11','unpaid',0.00,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(123,5,'Zakup oprogramowania','Opis kosztu: Zakup oprogramowania z dnia 2025-02-27',8872.09,'USD',NULL,'2025-02-27','2025-03-15','partially_paid',6476.63,21,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(124,12,'Naprawa samochodu','Opis kosztu: Naprawa samochodu z dnia 2025-01-07',6435.18,'USD','BLIK','2025-01-07','2025-01-23','unpaid',0.00,21,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(125,13,'Ubezpieczenie OC','Opis kosztu: Ubezpieczenie OC z dnia 2025-01-13',3643.36,'PLN','karta','2025-01-13','2025-01-23','unpaid',0.00,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(126,12,'Zakup mebli biurowych','Opis kosztu: Zakup mebli biurowych z dnia 2025-02-15',7343.67,'USD','BLIK','2025-02-15','2025-02-17','paid',7343.67,21,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(127,5,'Kampania reklamowa','Opis kosztu: Kampania reklamowa z dnia 2025-02-25',3661.91,'PLN','karta','2025-02-25','2025-03-18','paid',3661.91,24,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(128,12,'Opłaty bankowe','Opis kosztu: Opłaty bankowe z dnia 2025-01-14',6471.71,'USD','gotówka','2025-01-14','2025-01-14','unpaid',0.00,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(129,5,'Czynsz za biuro','Opis kosztu: Czynsz za biuro z dnia 2024-12-09',7916.10,'USD','BLIK','2024-12-09','2024-12-22','partially_paid',6807.85,5,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(130,13,'Szkolenie pracowników','Opis kosztu: Szkolenie pracowników z dnia 2024-12-23',4329.55,'EUR','BLIK','2024-12-23','2025-01-10','partially_paid',3420.34,25,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(131,13,'Kampania reklamowa','Opis kosztu: Kampania reklamowa z dnia 2025-02-10',4340.86,'PLN','przelew','2025-02-10','2025-03-01','partially_paid',2344.06,22,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(132,5,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2024-12-11',2759.90,'EUR','karta','2024-12-11','2024-12-14','partially_paid',1931.93,22,'2025-03-06 23:00:00','2025-03-06 23:00:00',NULL),(133,12,'Zakup materiałów biurowych','Opis kosztu: Zakup materiałów biurowych z dnia 2025-03-04',2043.63,'EUR','gotówka','2025-03-04','2025-03-19','partially_paid',408.73,25,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(135,12,'Kampania reklamowa','Opis kosztu: Kampania reklamowa z dnia 2025-03-09',1820.63,'USD','gotówka','2025-03-07','2025-03-18','unpaid',0.00,22,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(136,12,'Faktura za wodę','Opis kosztu: Faktura za wodę z dnia 2025-03-04',3502.86,'USD',NULL,'2025-03-04','2025-03-28','unpaid',0.00,24,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(137,5,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2025-03-06',4158.11,'EUR',NULL,'2025-03-06','2025-03-15','partially_paid',997.95,5,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(138,13,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2025-03-08',1753.08,'USD','karta','2025-03-02','2025-03-17','unpaid',0.00,25,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(139,5,'Faktura za gaz','Opis kosztu: Faktura za gaz z dnia 2025-03-05',2585.30,'PLN','przelew','2025-03-05','2025-03-23','paid',2585.30,25,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(140,12,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2025-03-08',8287.73,'USD','gotówka','2025-02-28','2025-03-14','paid',8287.73,24,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(141,5,'Usługi prawne','Opis kosztu: Usługi prawne z dnia 2025-03-08',8985.89,'USD','karta','2025-02-28','2025-03-31','paid',8985.89,22,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(142,14,'Licencje na oprogramowanie','Opis kosztu: Licencje na oprogramowanie z dnia 2025-03-09',9174.04,'PLN','gotówka','2025-03-04','2025-04-06','paid',9174.04,24,'2025-03-06 23:00:00','2025-03-07 11:49:34',NULL),(144,5,'sadas','',44554554.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:07:56','2025-03-11 12:56:22',NULL),(145,5,'dfgfd','',343434.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:08:35','2025-03-07 19:08:35',NULL),(146,5,'sadas','',32323.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:25:33','2025-03-07 19:25:33',NULL),(147,5,'1222','dfdfdf',2332323.00,'PLN',NULL,'2025-03-07',NULL,'paid',2332323.00,9,'2025-03-07 19:27:35','2025-03-07 19:27:35',2),(148,5,'ytreeer',NULL,2221111.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:29:04','2025-03-07 19:29:04',1),(149,5,'dfgfd','ggfrf',100.00,'PLN',NULL,'2025-03-07',NULL,'partially_paid',12.00,9,'2025-03-07 19:30:20','2025-03-07 19:30:20',5),(150,5,'rura333',NULL,123.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:34:10','2025-03-07 19:34:10',2),(151,5,'ytreeer',NULL,344.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:34:52','2025-03-07 19:34:52',NULL),(152,5,'tagowy 2 tagi','paliwo podróże',1222.00,'PLN','','2025-03-07',NULL,'partially_paid',0.00,9,'2025-03-07 19:39:08','2025-03-12 16:05:40',2),(153,5,'terst tagu 2',NULL,12222.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 19:42:22','2025-03-07 19:42:22',NULL),(154,5,'test3',NULL,122.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 20:19:16','2025-03-07 20:19:16',NULL),(155,5,'test3',NULL,122.00,'PLN',NULL,'2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 20:21:06','2025-03-07 20:21:06',NULL),(156,5,'file','',123.00,'PLN','','2025-03-07',NULL,'unpaid',0.00,9,'2025-03-07 20:56:25','2025-03-11 19:25:01',NULL),(157,5,'dzis','',987.00,'PLN','','2025-03-11',NULL,'paid',500.00,9,'2025-03-11 12:56:51','2025-03-11 18:18:57',2),(159,5,'za 5 zł','',5.00,'PLN','','2025-03-11',NULL,'paid',5.00,9,'2025-03-11 17:03:00','2025-03-11 18:10:25',NULL),(160,5,'testowy',NULL,1000.00,'PLN',NULL,'2025-03-12',NULL,'unpaid',0.00,9,'2025-03-12 16:19:08','2025-03-12 16:19:08',2);

--
-- Table structure for table `costs_backup`
--

CREATE TABLE `costs_backup` (
  `id` int(11) NOT NULL DEFAULT 0,
  `company_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'PLN',
  `payment_method` varchar(50) DEFAULT NULL,
  `date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('unpaid','partially_paid','paid') NOT NULL DEFAULT 'unpaid',
  `paid_amount` decimal(10,2) DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `costs_backup`
--


--
-- Table structure for table `document_categories`
--

CREATE TABLE `document_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `document_categories`
--

INSERT INTO `document_categories` VALUES (1,'Dokumenty pracownicze','Umowy o pracę, szkolenia BHP, badania lekarskie, certyfikaty i uprawnienia zawodowe, oceny pracownicze','2024-07-11 14:31:17','2024-07-11 14:31:17'),(2,'Dokumenty pojazdów','Dowody rejestracyjne, polisy ubezpieczeniowe, przeglądy techniczne, karty drogowe, umowy leasingowe','2024-07-11 14:31:17','2024-07-11 14:31:17'),(3,'Dokumenty finansowe','Faktury zakupowe, faktury sprzedażowe, umowy z kontrahentami, raporty finansowe, dokumenty bankowe','2024-07-11 14:31:17','2024-07-11 14:31:17'),(4,'Dokumenty projektowe','Projekty budowlane, kosztorysy, harmonogramy prac, pozwolenia na budowę, protokoły odbioru','2024-07-11 14:31:17','2024-07-11 14:31:17'),(5,'Dokumenty BHP','Oceny ryzyka zawodowego, instrukcje stanowiskowe, protokoły kontroli BHP, karty charakterystyki substancji niebezpiecznych','2024-07-11 14:31:17','2024-07-11 14:31:17'),(6,'Dokumenty jakości','Certyfikaty jakości materiałów, atesty i deklaracje zgodności, protokoły z testów i badań','2024-07-11 14:31:17','2024-07-11 14:31:17'),(7,'Dokumenty prawne','Umowy z podwykonawcami, umowy najmu/dzierżawy, pozwolenia i licencje, dokumenty sądowe','2024-07-11 14:31:17','2024-07-11 14:31:17'),(8,'Dokumenty marketingowe','Materiały promocyjne, prezentacje firmowe, referencje i rekomendacje','2024-07-11 14:31:17','2024-07-11 14:31:17'),(9,'Dokumenty techniczne','Instrukcje obsługi sprzętu, dokumentacje techniczne, schematy i rysunki techniczne','2024-07-11 14:31:17','2024-07-11 14:31:17'),(10,'Dokumenty administracyjne','Regulaminy wewnętrzne, procedury firmowe, korespondencja urzędowa','2024-07-11 14:31:17','2024-07-11 14:31:17'),(11,'Polisa inna','Polisy ubezpieczeniowe','2024-08-05 14:52:49','2024-08-05 14:55:53'),(12,'Polisa OC','polisa OC','2024-08-05 14:55:23','2024-08-05 14:55:23'),(13,'Polisa AC','Polisa AC','2024-08-05 14:55:36','2024-08-05 14:55:36'),(14,'Gwarancje','Gwarancje lub inne dokumenty potwierdzające gwarancje oraz jej czas trwania','2024-08-08 09:17:59','2024-08-08 09:17:59'),(15,'Aneksy','','2024-08-13 13:02:54','2024-08-13 13:02:54');

--
-- Table structure for table `document_templates`
--

CREATE TABLE `document_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `content` text DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  `editable_fields` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `form_structure` text DEFAULT NULL,
  `html_template` text DEFAULT NULL COMMENT 'Szablon HTML dokumentu',
  `css_styles` text DEFAULT NULL COMMENT 'Style CSS dla dokumentu',
  `background_image` varchar(255) DEFAULT NULL COMMENT 'Ścieżka do obrazu tła',
  PRIMARY KEY (`id`),
  KEY `category_id` (`category_id`),
  CONSTRAINT `document_templates_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `document_categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `document_templates`
--

INSERT INTO `document_templates` VALUES (3,'wzór','<h1>Karta szkolenia wstępnego</h1>\r\n<p>Imię i nazwisko pracownika: {{employee_name}}</p>\r\n<p>Firma: {{company_name}}</p>\r\n<p>Stanowisko: {{position}}</p>\r\n<p>Osoba przeprowadzająca instruktaż: {{instructor_name}}</p>\r\n<p>Data przeprowadzenia instruktażu stanowiskowego: {{workplace_instruction_date}}</p>\r\n<p>Data przeprowadzenia instruktażu ogólnego: {{general_instruction_date}}</p>',9,'{\r\n  \"EMPLOYEE_NAME\": {\"type\": \"text\", \"label\": \"Imię i nazwisko pracownika\"},\r\n  \"DEPARTMENT\": {\"type\": \"text\", \"label\": \"Nazwa komórki organizacyjnej\"},\r\n  \"GENERAL_INSTRUCTION_DATE\": {\"type\": \"date\", \"label\": \"Data instruktażu ogólnego\"},\r\n  \"GENERAL_INSTRUCTOR_NAME\": {\"type\": \"text\", \"label\": \"Imię i nazwisko instruktora ogólnego\"},\r\n  \"POSITION\": {\"type\": \"text\", \"label\": \"Stanowisko pracy\"},\r\n  \"POSITION_INSTRUCTION_DATE\": {\"type\": \"date\", \"label\": \"Data instruktażu stanowiskowego\"},\r\n  \"POSITION_INSTRUCTOR_NAME\": {\"type\": \"text\", \"label\": \"Imię i nazwisko instruktora stanowiskowego\"}\r\n}','2024-08-08 14:03:00','2024-08-14 21:11:28','[{\"name\":\"employee_name\",\"label\":\"Imi\\u0119 i nazwisko pracownika\",\"type\":\"text\",\"required\":true},{\"name\":\"employee_position\",\"label\":\"Stanowisko pracownika\",\"type\":\"text\",\"required\":true},{\"name\":\"employee_id\",\"label\":\"Numer identyfikacyjny pracownika\",\"type\":\"text\",\"required\":true},{\"name\":\"company_name\",\"label\":\"Nazwa firmy\",\"type\":\"text\",\"required\":true},{\"name\":\"company_address\",\"label\":\"Adres firmy\",\"type\":\"text\",\"required\":true},{\"name\":\"company_nip\",\"label\":\"NIP firmy\",\"type\":\"text\",\"required\":true},{\"name\":\"document_date\",\"label\":\"Data dokumentu\",\"type\":\"date\",\"required\":true},{\"name\":\"document_number\",\"label\":\"Numer dokumentu\",\"type\":\"text\",\"required\":true},{\"name\":\"supervisor_name\",\"label\":\"Imi\\u0119 i nazwisko prze\\u0142o\\u017conego\",\"type\":\"text\",\"required\":true},{\"name\":\"start_date\",\"label\":\"Data rozpocz\\u0119cia\",\"type\":\"date\",\"required\":false},{\"name\":\"end_date\",\"label\":\"Data zako\\u0144czenia\",\"type\":\"date\",\"required\":false},{\"name\":\"salary\",\"label\":\"Wynagrodzenie\",\"type\":\"number\",\"required\":false},{\"name\":\"working_hours\",\"label\":\"Wymiar godzin pracy\",\"type\":\"text\",\"required\":false},{\"name\":\"additional_info\",\"label\":\"Dodatkowe informacje\",\"type\":\"textarea\",\"required\":false}]','{{employe_first_name}}\r\n{{employe_last_name}}\r\n\r\n\r\n<h1>Umowa o pracę</h1>\r\n<p>Zawarta dnia {{document_date}} pomiędzy:</p>\r\n<p>{{company_name}} z siedzibą w {{company_address}}, NIP: {{company_nip}}</p>\r\n<p>a</p>\r\n<p>{{employee_name}}, zatrudnionym na stanowisku {{employee_position}}</p>\r\n<p>Numer pracownika: {{employee_id}}</p>\r\n<p>Warunki umowy:</p>\r\n<ul>\r\n  <li>Data rozpoczęcia pracy: {{start_date}}</li>\r\n  <li>Wymiar czasu pracy: {{working_hours}}</li>\r\n  <li>Wynagrodzenie: {{salary}} zł brutto</li>\r\n</ul>\r\n<p>Dodatkowe informacje: {{additional_info}}</p>\r\n<p>Podpisy:</p>\r\n<p>Pracodawca: ___________________ Pracownik: ___________________</p>\r\n','body {\r\n  font-family: Arial, sans-serif;\r\n  line-height: 1.6;\r\n  color: #333;\r\n}\r\nh1 {\r\n  color: #0056b3;\r\n  text-align: center;\r\n}\r\np {\r\n  margin-bottom: 10px;\r\n}\r\nul {\r\n  margin-left: 20px;\r\n}','/var/www/html/panel/uploads/background/66b79197ecdc0_Karta szkolenia wstępnego BHP.docx.pdf'),(6,'Karta szkolenia wstępnego BHP',NULL,5,NULL,'2024-08-10 16:10:45','2024-08-22 11:32:40','[{\"name\":\"employee_name\",\"label\":\"Imi\\u0119 i nazwisko pracownika\",\"type\":\"text\",\"required\":true},{\"name\":\"company_name\",\"label\":\"Firma pracownika\",\"type\":\"text\",\"required\":true},{\"name\":\"position\",\"label\":\"Stanowisko pracy\",\"type\":\"text\",\"required\":true},{\"name\":\"instructor_name\",\"label\":\"Imi\\u0119 i nazwisko osoby przeprowadzaj\\u0105cej instrukta\\u017c\",\"type\":\"text\",\"required\":true},{\"name\":\"workplace_instruction_date\",\"label\":\"Data przeprowadzenia instrukta\\u017cu stanowiskowego\",\"type\":\"text\",\"required\":true},{\"name\":\"general_instruction_date\",\"label\":\"Data przeprowadzenia instrukta\\u017cu og\\u00f3lnego\",\"type\":\"text\",\"required\":true}]','<!DOCTYPE html>\r\n<html lang=\"pl\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <title>Karta instruktażu pracownika</title>\r\n</head>\r\n<body>\r\n\r\n        <p class=\"employee-name\"><strong>{{employee_name}}</strong></p>\r\n        <p class=\"company-name\"><strong>{{company_name}}</strong></p>\r\n        <p class=\"position\"><strong>{{position}}</strong></p>\r\n        <p class=\"position2\"><strong>{{position}}</strong></p>    \r\n        <p class=\"instructor-name\"><strong>{{instructor_name}}</strong></p>\r\n        <p class=\"workplace-instruction-date\"><strong>{{workplace_instruction_date}}</strong></p>\r\n        <p class=\"general-instruction-date\"><strong>{{general_instruction_date}}</strong></p>\r\n        <p class=\"instructor-name2\"><strong>{{instructor_name}}</strong></p>\r\n        <p class=\"employee-first-name\"><strong>{{employee_first_name}}</strong></p>\r\n        <p class=\"employee-last-name\"><strong>{{employee_last_name}}</strong></p>\r\n\r\n</body>\r\n</html>','.employee-name {\r\n    position: absolute;\r\n    top: 180px;\r\n    left: 450px;\r\n}\r\n\r\n.employee-first-name {\r\n    position: absolute;\r\n    top: 505px;\r\n    left: 600px;\r\n}\r\n\r\n.employee-last-name {\r\n    position: absolute;\r\n    top: 525px;\r\n    left: 220px;\r\n}\r\n\r\n.company-name {\r\n    position: absolute;\r\n    top: 244px;\r\n    left: 400px;\r\n}\r\n\r\n.position {\r\n    position: absolute;\r\n    top: 422px;\r\n    left: 470px;\r\n}\r\n.position2 {\r\n    position: absolute;\r\n    top: 548px;\r\n    left: 170px;\r\n}\r\n\r\n.instructor-name {\r\n    position: absolute;\r\n    top: 320px;\r\n    left: 300px;\r\n}\r\n.instructor-name2 {\r\n    position: absolute;\r\n    top: 450px;\r\n    left: 550px;\r\n}\r\n.workplace-instruction-date {\r\n    position: absolute;\r\n    top: 295px;\r\n    left: 430px;\r\n}\r\n\r\n\r\n.general-instruction-date {\r\n    position: absolute;\r\n    top: 445px;\r\n    left: 330px;\r\n}','/var/www/html/kobas/uploads/background/66bfa34406003_Karta szkolenia wstępnego BHP.docx.pdf');

--
-- Table structure for table `documents`
--

CREATE TABLE `documents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `file_path` varchar(255) NOT NULL,
  `file_type` varchar(50) NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `company_id` int(11) DEFAULT NULL,
  `related_entity_type` enum('employee','vehicle','equipment','none') DEFAULT 'none',
  `related_entity_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_by` bigint(20) unsigned NOT NULL,
  `policy_number` varchar(50) DEFAULT NULL,
  `policy_start_date` date DEFAULT NULL,
  `policy_end_date` date DEFAULT NULL,
  `insurance_company` varchar(100) DEFAULT NULL,
  `is_generated` tinyint(1) DEFAULT 0,
  `template_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `category_id` (`category_id`),
  KEY `company_id` (`company_id`),
  KEY `created_by` (`created_by`),
  KEY `related_entity` (`related_entity_type`,`related_entity_id`),
  KEY `idx_template_id` (`template_id`),
  KEY `idx_is_generated` (`is_generated`),
  CONSTRAINT `documents_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `document_categories` (`id`) ON DELETE SET NULL,
  CONSTRAINT `documents_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  CONSTRAINT `documents_ibfk_3` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `fk_document_template` FOREIGN KEY (`template_id`) REFERENCES `document_templates` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=111 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `documents`
--

INSERT INTO `documents` VALUES (31,'Consectetur voluptas repellat.','Nemo quia qui animi sequi.','/var/www/html/kobas/uploads/documents/example_0.pdf','application/msword',9,12,'equipment',1,'2025-03-03 20:56:53','2025-03-03 20:56:53',24,'EZ69OSL14X','2024-05-05','2026-02-03','Lis',0,NULL),(32,'Quia magnam magnam.',NULL,'/var/www/html/kobas/uploads/documents/example_1.pdf','application/msword',13,12,'equipment',6,'2025-03-03 20:56:53','2025-03-03 20:56:53',21,'3PWYNWSEZ2','2024-11-28','2025-10-09','Lis',0,NULL),(33,'Sint illum nam.','Aliquam tempora eveniet itaque maiores enim reiciendis.','/var/www/html/kobas/uploads/documents/example_2.pdf','application/msword',4,12,'equipment',13,'2025-03-03 20:56:53','2025-03-03 20:56:53',21,'9TUS7P9SV1','2024-07-21','2025-12-01','Mróz-Tomaszewski',0,NULL),(34,'Totam suscipit tempore earum.','Autem quam provident dignissimos rerum.','/var/www/html/kobas/uploads/documents/example_3.pdf','application/pdf',13,14,'employee',40,'2025-03-03 20:56:53','2025-03-03 20:56:53',24,NULL,NULL,NULL,NULL,0,NULL),(35,'Corrupti odit est.','Et blanditiis enim veritatis sit ea culpa esse corrupti.','/var/www/html/kobas/uploads/documents/example_4.pdf','application/pdf',2,14,'employee',33,'2025-03-03 20:56:53','2025-03-03 20:56:53',21,NULL,NULL,NULL,NULL,0,NULL),(36,'Ullam tempora totam.',NULL,'/var/www/html/kobas/uploads/documents/example_5.pdf','image/jpeg',12,13,'vehicle',15,'2025-03-03 20:56:53','2025-03-03 20:56:53',23,NULL,NULL,NULL,NULL,0,NULL),(37,'Quas aspernatur.','Dolorem et temporibus sit qui officiis aut et eius.','/var/www/html/kobas/uploads/documents/example_6.pdf','image/jpeg',11,12,'employee',39,'2025-03-03 20:56:53','2025-03-03 20:56:53',23,NULL,NULL,NULL,NULL,0,NULL),(38,'Cumque vel dolores.',NULL,'/var/www/html/kobas/uploads/documents/example_7.pdf','application/msword',12,13,'employee',38,'2025-03-03 20:56:53','2025-03-03 20:56:53',22,'V1W0L627PV','2024-09-23','2025-06-21','Czarnecka-Zieliński',0,NULL),(39,'Enim tenetur qui.',NULL,'/var/www/html/kobas/uploads/documents/example_8.pdf','application/pdf',15,13,'vehicle',14,'2025-03-03 20:56:53','2025-03-03 20:56:53',25,NULL,NULL,NULL,NULL,0,NULL),(40,'Voluptatem iure iste.','Voluptas sed sit aliquid cum dolor rem sapiente.','/var/www/html/kobas/uploads/documents/example_9.pdf','application/msword',15,13,'equipment',3,'2025-03-03 20:56:53','2025-03-03 20:56:53',21,NULL,NULL,NULL,NULL,0,NULL),(41,'Autem voluptatem alias ex.','Et voluptatem corrupti quia quis corrupti doloribus.','/var/www/html/kobas/uploads/documents/example_10.pdf','application/msword',9,13,'vehicle',13,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(42,'Aut est nihil aspernatur vel.','Recusandae impedit in ullam nihil.','/var/www/html/kobas/uploads/documents/example_11.pdf','image/png',11,12,'employee',29,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,'QOD568E6QL','2025-02-03','2025-04-29','Czarnecka sp. z o.o.',0,NULL),(43,'Architecto quaerat fugiat.',NULL,'/var/www/html/kobas/uploads/documents/example_12.pdf','image/png',10,12,'employee',37,'2025-03-03 20:56:54','2025-03-03 20:56:54',23,NULL,NULL,NULL,NULL,0,NULL),(44,'Rerum quo quae et.','Omnis minima repudiandae et laborum iste qui.','/var/www/html/kobas/uploads/documents/example_13.pdf','image/png',12,14,'employee',41,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,'VNE0OSE7WR','2024-11-20','2025-09-05','Wójcik P.P.O.F',0,NULL),(45,'Dolores et.',NULL,'/var/www/html/kobas/uploads/documents/example_14.pdf','application/pdf',11,14,'employee',43,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,NULL,NULL,NULL,NULL,0,NULL),(46,'Qui cumque porro fuga.','Provident eum dolorem ut porro nostrum exercitationem deserunt.','/var/www/html/kobas/uploads/documents/example_15.pdf','application/msword',2,12,'vehicle',20,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,'LRF0NQM8TH','2024-07-25','2025-12-31','Szymczak sp. j.',0,NULL),(47,'Aut placeat mollitia.','Delectus qui ut neque id veritatis voluptatem.','/var/www/html/kobas/uploads/documents/example_16.pdf','application/msword',11,13,'equipment',10,'2025-03-03 20:56:54','2025-03-03 20:56:54',23,NULL,NULL,NULL,NULL,0,NULL),(48,'Laboriosam quo.','Aut officiis voluptatem aut voluptatem quo maxime.','/var/www/html/kobas/uploads/documents/example_17.pdf','image/jpeg',6,13,'employee',38,'2025-03-03 20:56:54','2025-03-03 20:56:54',24,NULL,NULL,NULL,NULL,0,NULL),(49,'Voluptatem quis quia.',NULL,'/var/www/html/kobas/uploads/documents/example_18.pdf','application/pdf',15,13,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(50,'Cum alias impedit.','Fuga commodi aut voluptate mollitia.','/var/www/html/kobas/uploads/documents/example_19.pdf','image/jpeg',3,12,'employee',37,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,'CQH87Q9YFX','2024-04-30','2025-11-08','Przybylska sp. k.',0,NULL),(51,'Nulla incidunt praesentium nisi.','Sint quibusdam facilis quidem consectetur dolorem quis sint.','/var/www/html/kobas/uploads/documents/example_20.pdf','application/pdf',4,13,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,NULL,NULL,NULL,NULL,0,NULL),(52,'Laudantium nesciunt minus et.','Et et odit soluta et natus.','/var/www/html/kobas/uploads/documents/example_21.pdf','image/png',12,12,'equipment',2,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,'49V337K5OH','2024-05-12','2025-09-01','Borkowski',0,NULL),(53,'Necessitatibus suscipit et.','Quia temporibus nihil harum laboriosam magnam.','/var/www/html/kobas/uploads/documents/example_22.pdf','image/jpeg',3,12,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,NULL,NULL,NULL,NULL,0,NULL),(54,'Praesentium omnis expedita.',NULL,'/var/www/html/kobas/uploads/documents/example_23.pdf','application/pdf',8,13,'equipment',8,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,NULL,NULL,NULL,NULL,0,NULL),(55,'In nam culpa.',NULL,'/var/www/html/kobas/uploads/documents/example_24.pdf','image/jpeg',15,13,'equipment',3,'2025-03-03 20:56:54','2025-03-03 20:56:54',23,'5F7JQ9NKKK','2024-07-12','2025-04-16','Wysocki S.K.A',0,NULL),(56,'Porro sit laboriosam.','Sed et repellendus enim qui ipsum odio.','/var/www/html/kobas/uploads/documents/example_25.pdf','image/png',2,12,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',24,'8BUTAPY7EV','2025-01-16','2026-02-23','Spółdzielnia Górska',0,NULL),(57,'Beatae autem earum.',NULL,'/var/www/html/kobas/uploads/documents/example_26.pdf','application/msword',8,14,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,'A2UU6ARFKR','2024-12-23','2026-01-21','Czarnecka s. c.',0,NULL),(58,'Excepturi consequuntur ut.','Nihil unde nisi accusantium.','/var/www/html/kobas/uploads/documents/example_27.pdf','application/pdf',10,12,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(59,'Vel veniam esse asperiores.','Odio fugit voluptate id exercitationem numquam adipisci ducimus.','/var/www/html/kobas/uploads/documents/example_28.pdf','application/pdf',8,14,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',24,NULL,NULL,NULL,NULL,0,NULL),(60,'Possimus nulla amet.','Nihil sint fugiat mollitia.','/var/www/html/kobas/uploads/documents/example_29.pdf','image/png',2,14,'employee',27,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,'241VDCKET9','2024-10-12','2025-10-22','Gajewski i syn',0,NULL),(61,'Illo architecto tenetur.','Quibusdam soluta amet ratione esse.','/var/www/html/kobas/uploads/documents/example_30.pdf','image/png',13,14,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,NULL,NULL,NULL,NULL,0,NULL),(62,'Ipsa magnam.','Alias et sunt et animi.','/var/www/html/kobas/uploads/documents/example_31.pdf','application/msword',14,13,'employee',41,'2025-03-03 20:56:54','2025-03-03 20:56:54',24,'KHMMRN4WAM','2024-03-05','2025-06-12','Zając S.K.A',0,NULL),(63,'Deserunt ab rerum minima.','Aut enim adipisci beatae quis tempore rerum.','/var/www/html/kobas/uploads/documents/example_32.pdf','image/jpeg',3,12,'vehicle',19,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(64,'Illum nobis consequuntur dolores.','Dicta neque quisquam autem eligendi illum repudiandae quam.','/var/www/html/kobas/uploads/documents/example_33.pdf','image/jpeg',6,12,'vehicle',16,'2025-03-03 20:56:54','2025-03-03 20:56:54',22,NULL,NULL,NULL,NULL,0,NULL),(65,'Illum porro veritatis dolorem.','Veniam quam vel et asperiores non modi illum.','/var/www/html/kobas/uploads/documents/example_34.pdf','application/msword',13,12,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(66,'Fugiat corporis aut.','Et nam doloribus aut nesciunt nisi.','/var/www/html/kobas/uploads/documents/example_35.pdf','image/jpeg',11,12,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',24,'4S9NP6RFYR','2024-08-22','2025-08-28','Woźniak-Wróblewska',0,NULL),(67,'Dolorem error sint.','Voluptatem animi maxime reprehenderit quam maxime eum.','/var/www/html/kobas/uploads/documents/example_36.pdf','application/msword',3,14,'equipment',13,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,NULL,NULL,NULL,NULL,0,NULL),(68,'Ut ut amet.','Nemo nulla tenetur quam blanditiis animi est et.','/var/www/html/kobas/uploads/documents/example_37.pdf','application/pdf',12,13,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',25,NULL,NULL,NULL,NULL,0,NULL),(69,'Adipisci et asperiores quasi.','Excepturi eum enim tenetur possimus odio.','/var/www/html/kobas/uploads/documents/example_38.pdf','image/jpeg',3,13,'none',NULL,'2025-03-03 20:56:54','2025-03-03 20:56:54',21,'WMY75AX6ZU','2025-02-06','2025-07-17','Lis s. c.',0,NULL);

--
-- Table structure for table `employee_medical_examinations`
--

CREATE TABLE `employee_medical_examinations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` bigint(20) unsigned NOT NULL,
  `examination_date` date NOT NULL,
  `expiration_date` date NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `employee_medical_examinations_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`),
  CONSTRAINT `employee_medical_examinations_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employee_medical_examinations`
--

INSERT INTO `employee_medical_examinations` VALUES (1,27,'2025-01-24','2026-01-30',21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(2,28,'2024-06-24','2026-01-16',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(3,30,'2024-05-11','2025-08-13',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(4,31,'2025-02-09','2025-05-29',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(5,33,'2024-11-23','2027-01-24',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(6,34,'2024-03-06','2025-06-13',21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(7,36,'2024-05-17','2026-06-17',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(8,37,'2024-05-10','2025-12-21',21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(9,40,'2024-06-27','2025-04-21',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(10,41,'2024-09-13','2025-09-20',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(11,43,'2024-10-02','2026-11-26',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(12,44,'2024-04-28','2027-01-03',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(13,46,'2024-07-29','2026-02-24',25,'2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `employee_safety_trainings`
--

CREATE TABLE `employee_safety_trainings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` bigint(20) unsigned NOT NULL,
  `training_date` date NOT NULL,
  `expiration_date` date NOT NULL,
  `training_type` varchar(255) NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `employee_safety_trainings_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`),
  CONSTRAINT `employee_safety_trainings_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employee_safety_trainings`
--

INSERT INTO `employee_safety_trainings` VALUES (1,27,'2024-06-20','2026-02-14','Przeciwpożarowe',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(2,28,'2024-07-25','2026-05-14','Pierwsza pomoc',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(3,30,'2024-04-19','2026-04-22','Okresowe BHP',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(4,31,'2024-07-17','2025-06-23','Pierwsza pomoc',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(5,32,'2024-06-25','2025-10-10','Przeciwpożarowe',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(6,33,'2024-12-13','2025-06-14','Przeciwpożarowe',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(7,34,'2024-04-07','2026-01-12','Wstępne BHP',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(8,35,'2024-03-20','2027-01-11','Przeciwpożarowe',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(9,36,'2024-06-06','2026-03-15','Przeciwpożarowe',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(10,37,'2024-04-04','2026-07-11','Wstępne BHP',25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(11,38,'2024-10-03','2025-06-13','Przeciwpożarowe',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(12,39,'2024-10-04','2026-07-15','Przeciwpożarowe',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(13,41,'2024-05-23','2026-11-19','Wstępne BHP',21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(14,42,'2024-06-06','2025-12-20','Wstępne BHP',25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(15,43,'2025-03-03','2027-01-08','Pierwsza pomoc',24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(16,44,'2024-10-16','2025-10-12','Okresowe BHP',22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(17,45,'2024-03-15','2026-05-13','Okresowe BHP',21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(18,46,'2024-12-01','2026-05-25','Przeciwpożarowe',25,'2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `employment_periods`
--

CREATE TABLE `employment_periods` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` bigint(20) unsigned NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `employment_periods_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`),
  CONSTRAINT `employment_periods_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employment_periods`
--

INSERT INTO `employment_periods` VALUES (23,27,'2020-11-23',NULL,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(24,28,'2021-12-30',NULL,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(25,29,'2023-11-14',NULL,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(26,30,'2022-10-24',NULL,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(27,31,'2023-02-06',NULL,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(28,32,'2023-08-13',NULL,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(29,33,'2024-01-17','2024-05-11',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(30,34,'2022-08-19',NULL,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(31,35,'2025-01-14','2025-08-27',25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(32,36,'2022-08-09',NULL,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(33,37,'2023-05-29',NULL,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(34,38,'2021-11-26','2024-12-15',25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(35,39,'2020-09-16','2024-04-27',25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(36,40,'2022-02-19',NULL,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(37,41,'2023-05-13',NULL,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(38,42,'2024-11-27','2025-10-06',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(39,43,'2020-12-10',NULL,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(40,44,'2022-06-22',NULL,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(41,45,'2020-07-21',NULL,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(42,46,'2025-01-23','2025-10-23',23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(63,67,'2025-03-07',NULL,9,'2025-03-08 11:26:47','2025-03-08 11:26:47');

--
-- Table structure for table `employment_records`
--

CREATE TABLE `employment_records` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` bigint(20) unsigned NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `employment_records_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`),
  CONSTRAINT `employment_records_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employment_records`
--


--
-- Table structure for table `equipment`
--

CREATE TABLE `equipment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `serial_number` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `purchase_date` date DEFAULT NULL,
  `company_id` int(11) DEFAULT NULL,
  `category` varchar(100) DEFAULT NULL,
  `status` varchar(50) DEFAULT NULL,
  `last_maintenance_date` date DEFAULT NULL,
  `next_maintenance_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `company_id` (`company_id`),
  CONSTRAINT `equipment_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `equipment`
--

INSERT INTO `equipment` VALUES (1,'Spawarka','LLECQ5YEPX','Ut eos repudiandae quisquam fugit pariatur pariatur quia.','2021-04-06',13,'Elektronika','Sprawny','2024-11-04','2025-04-20','2025-03-03 20:56:53','2025-03-03 20:56:53'),(2,'Młot pneumatyczny','G6TKVEXPIY','Ipsa sint est similique.','2023-06-20',14,'Elektronika','Sprawny',NULL,NULL,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(3,'Skaner','89AIMHEKOS','Quaerat cum unde natus suscipit.','2024-09-14',13,'Narzędzia','Sprawny','2024-11-04',NULL,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(4,'Agregat prądotwórczy','FP8HT8PR2D','Nisi voluptas reprehenderit ullam et.','2021-08-25',12,'Elektronika','Sprawny',NULL,'2025-11-15','2025-03-03 20:56:53','2025-03-03 20:56:53'),(5,'Laptop','6FRJSBP0QR','Sed autem ipsam sed dolor aliquam nam cupiditate.','2020-03-25',12,'Sprzęt ogrodniczy','Sprawny',NULL,'2025-08-03','2025-03-03 20:56:53','2025-03-03 20:56:53'),(6,'Kosiarka','0KO1PC3JSO','Ducimus expedita sed ut deserunt labore.','2024-06-03',13,'Narzędzia','W naprawie','2024-10-03','2025-11-18','2025-03-03 20:56:53','2025-03-03 20:56:53'),(7,'Wiertarka','IQHWVCBZDX','Recusandae voluptas aut sit natus.','2022-05-05',12,'Elektronika','Uszkodzony',NULL,NULL,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(8,'Drukarka','LVTPE4J4NI','Provident rerum ut corrupti.','2020-07-19',13,'Sprzęt ogrodniczy','W naprawie','2024-11-03',NULL,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(9,'Kosiarka','Z1RL4ZCVMC','Sit tenetur laudantium voluptatibus numquam sed.','2022-01-29',12,'Narzędzia','Wycofany','2024-11-06',NULL,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(10,'Tablet','JYLFBGXC2V','Sequi iure consequatur distinctio voluptatem pariatur consequatur.','2020-04-29',14,'Sprzęt budowlany','Wycofany','2024-11-22','2025-04-17','2025-03-03 20:56:53','2025-03-03 20:56:53'),(11,'Laptop','6NO9WN928D','Minima error atque consequatur commodi ea.','2022-07-01',14,'Sprzęt budowlany','Sprawny','2025-02-13','2025-11-14','2025-03-03 20:56:53','2025-03-03 20:56:53'),(12,'Spawarka','1L91MF9132','Placeat quae voluptas voluptas omnis ea placeat.','2021-12-03',14,'Sprzęt biurowy','Wycofany',NULL,'2025-09-11','2025-03-03 20:56:53','2025-03-03 20:56:53'),(13,'Młot pneumatyczny','53P8W0AA3I','Et modi ea vero eum.','2021-06-21',13,'Sprzęt budowlany','Wycofany','2025-02-02','2026-02-13','2025-03-03 20:56:53','2025-03-03 20:56:53'),(14,'Szlifierka','PCJP0OFRWT','Natus reiciendis doloribus cum et rem.','2020-11-01',13,'Sprzęt ogrodniczy','Wycofany',NULL,'2025-11-04','2025-03-03 20:56:53','2025-03-03 20:56:53'),(15,'Młot pneumatyczny','JY8X91SGHQ','Id mollitia delectus neque sit ullam velit sed molestiae.','2023-04-26',12,'Sprzęt budowlany','Sprawny',NULL,'2026-02-24','2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `projects`
--

CREATE TABLE `projects` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `company_id` int(11) NOT NULL,
  `manager_id` int(11) DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `budget` decimal(15,2) DEFAULT 0.00,
  `status` enum('planned','in_progress','completed','cancelled') NOT NULL DEFAULT 'planned',
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `company_id` (`company_id`),
  KEY `manager_id` (`manager_id`),
  KEY `created_by` (`created_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `projects`
--


--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `priority` enum('low','medium','high') NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('todo','in_progress','done') NOT NULL,
  `assigned_to` bigint(20) unsigned DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `assigned_to` (`assigned_to`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tasks`
--

INSERT INTO `tasks` VALUES (15,'Ut magni exercitationem voluptatum quaerat.','Qui temporibus temporibus ullam molestiae. Rerum nesciunt quidem laudantium consequatur. Necessitatibus laboriosam incidunt aut consequatur architecto nam in aspernatur.','high','2025-03-09','done',21,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(16,'Iste hic quo et consequuntur.','Aut omnis quia fugit dolorem culpa beatae repellendus. Quam sint beatae sed explicabo ut inventore et vitae. Ad recusandae eos voluptatum occaecati. Fugiat reiciendis sed ipsam laborum libero.','low','2025-03-17','in_progress',21,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(17,'Tempore quis eos natus autem.',NULL,'high','2025-05-26','done',25,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(18,'Est sit et hic consequuntur.','Voluptatem quo odit et consectetur. Numquam reprehenderit magni delectus. Illum et et ut tempore praesentium.','low','2025-06-03','todo',21,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(19,'Nihil ut corrupti.','Reiciendis mollitia veniam dolorem voluptate officiis voluptatem. Voluptas facilis eius veritatis ea. Ea accusamus accusamus fuga officiis sit. Quibusdam eius voluptas omnis omnis suscipit nostrum est.','low','2025-04-11','todo',NULL,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(20,'Corrupti dolor rerum fuga qui.','Et consequatur dolores consequatur molestiae magnam distinctio. Ut quidem in maxime qui eos. Odio est et sint consequatur et sit voluptatibus voluptatem.','low','2025-05-30','done',25,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(21,'Est ducimus nisi incidunt.',NULL,'low','2025-03-12','done',23,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(22,'Quia ipsum saepe autem ipsum consequuntur.','Eos qui nisi quis id soluta. Perferendis accusantium voluptatem harum repellendus quia. Aut sunt debitis neque quaerat repellendus. Tenetur porro molestiae ad vitae.','high','2025-04-06','in_progress',25,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(23,'Architecto id eligendi at dolorem.','Et asperiores quia enim dolorum est. Ut magnam sint velit. Assumenda autem facilis quo. Quam voluptas est incidunt sed veniam provident sint voluptatibus.','high','2025-05-21','in_progress',23,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(24,'Dolores minus eum et quas.',NULL,'low','2025-04-15','in_progress',24,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(25,'Aspernatur ipsa ex aperiam nihil.','Corrupti sit at quibusdam blanditiis. Exercitationem tempora voluptatum sed recusandae et aut. Nostrum ea eaque esse.','low','2025-05-11','todo',23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(26,'Esse necessitatibus neque doloremque ipsam alias.',NULL,'medium','2025-05-30','todo',24,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(27,'Sunt magni mollitia.','Ab quaerat nisi qui ipsam et aliquam neque blanditiis. Ut non ipsam earum veniam quas. Sequi quibusdam vel suscipit nostrum autem non quo ea.','low','2025-04-25','in_progress',23,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(28,'Perspiciatis quia id molestiae.','Est quisquam et ducimus provident. A quo iure iste. Sint quia tempore provident nulla blanditiis vero iste ut. Beatae sit ut culpa necessitatibus quisquam possimus nulla.','high','2025-04-01','in_progress',22,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(29,'Non sunt quasi aut sint.','Esse reprehenderit eos enim porro quo unde. Voluptatem et laboriosam et qui voluptatum eos vel.','medium','2025-04-25','todo',25,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(30,'A deleniti tempora ut nam eum.','In laboriosam eum id illo. Tenetur qui modi alias nihil reiciendis corrupti error rem. Nobis ut dolores tempore aliquid omnis.','medium','2025-05-06','in_progress',24,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(31,'Doloribus dolor consectetur quo enim.','Sint iusto velit tempore. Sit et tempore enim accusantium. Ratione suscipit quis aperiam aperiam quibusdam soluta ut.','low','2025-03-26','todo',25,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(32,'Laboriosam optio tenetur eaque.','Quod est magnam fugiat. Dolore fuga quos nostrum. Possimus sed quod provident officia. Quae officia est harum in possimus.','low',NULL,'in_progress',23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(33,'Ut officiis necessitatibus tempora vero.','Ducimus voluptas nam nesciunt pariatur at. Modi quaerat et voluptas dolores et. Perspiciatis similique saepe hic necessitatibus. Nobis quia et voluptatem delectus dolorem.','medium','2025-05-13','done',23,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(34,'Minima repellendus corporis architecto neque.','Fuga necessitatibus ab magnam nihil hic minus. Aut expedita voluptates autem et vel. Eos cumque molestiae soluta totam eligendi at dolor. Blanditiis repellat earum ex dolorem voluptatem minus consequatur. Corrupti aut id fuga incidunt.','low','2025-04-09','todo',22,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(35,'Repellat quo est.','Provident qui in sapiente. Quisquam in et perferendis dolor reprehenderit pariatur facere.','medium','2025-04-27','done',21,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(36,'Sit aut quae rem.','Quas alias et labore adipisci perspiciatis quam. Consequatur aut et id inventore. Sed dignissimos natus blanditiis. Cum vel odit est ut.','medium',NULL,'in_progress',23,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(37,'Sint eos nam nam earum.','Assumenda illo ut fugiat. Quia quae enim quos illum quaerat quia natus totam. Vel quo ut aut dolore neque quasi debitis.','low','2025-03-09','in_progress',23,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(38,'Et consequatur non quas sint.','Excepturi numquam fugiat sapiente vero doloremque voluptatibus. Voluptatem adipisci sed quis voluptates beatae occaecati repellendus ut. Eius temporibus sint accusantium id quia. Error qui impedit saepe velit aliquid harum eligendi sed.','low','2025-03-10','todo',23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(39,'Quam possimus excepturi enim molestiae vel.','Porro eaque ullam dolorum odit. Error et vero accusantium ea occaecati qui. Rem illum omnis laborum. Deserunt eum corrupti neque ut quos nam.','medium','2025-03-10','in_progress',24,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(40,'Ut quam ea aliquid accusamus.','Quod sed expedita saepe dolorem numquam. Nam quidem unde ut facere et suscipit ut.','low','2025-06-02','todo',23,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(41,'Qui perspiciatis et dolorem autem.','Doloribus molestiae porro cumque. Esse illum eius vitae non. Et non ipsum aut provident ut eum eligendi. Soluta repudiandae rerum quisquam recusandae minima sit consectetur.','medium','2025-04-20','done',23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(42,'Tempora reprehenderit nobis.','Sed omnis eum voluptatibus aut et maiores minima. Nisi perferendis ab natus doloribus. Earum eius sunt ducimus molestias. Et et consequuntur qui quo cupiditate autem necessitatibus.','medium','2025-05-17','in_progress',23,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(43,'Atque labore optio sint.','Molestiae quisquam voluptas rerum illum. Ut sed nisi perferendis excepturi rerum commodi atque dolor.','medium','2025-03-04','in_progress',24,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(44,'Odit perferendis nam accusamus ullam maiores.','Delectus sunt ea alias nihil aspernatur ut non et. Id dolores fuga sit id illum. Voluptatem aperiam numquam optio voluptas voluptatum est cupiditate. Perspiciatis recusandae qui quo enim incidunt minus.','high','2025-04-11','todo',23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `user_companies`
--

CREATE TABLE `user_companies` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `company_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_company_unique` (`user_id`,`company_id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_companies`
--

INSERT INTO `user_companies` VALUES (1,5,5,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(2,5,12,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(3,5,13,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(4,5,14,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(9,9,5,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(10,9,12,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(11,9,13,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(12,9,14,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(13,21,5,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(14,21,12,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(15,21,13,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(16,21,14,'2025-03-04 19:34:34','2025-03-05 20:18:45'),(36,8,5,'2025-03-08 22:04:18','2025-03-08 22:04:18');

--
-- Table structure for table `user_preferences`
--

CREATE TABLE `user_preferences` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `preference_key` varchar(50) NOT NULL,
  `value` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_preference_unique` (`user_id`,`preference_key`),
  CONSTRAINT `fk_user_preferences_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_preferences`
--

INSERT INTO `user_preferences` VALUES (122,21,'last_company_id','13','2025-03-03 20:56:54','2025-03-03 20:56:54'),(123,21,'last_cost_type_id','3','2025-03-03 20:56:54','2025-03-03 20:56:54'),(124,21,'last_relation_type','employee','2025-03-03 20:56:54','2025-03-03 20:56:54'),(125,22,'last_company_id','13','2025-03-03 20:56:54','2025-03-03 20:56:54'),(126,22,'last_cost_type_id','7','2025-03-03 20:56:54','2025-03-03 20:56:54'),(127,22,'last_relation_type','employee','2025-03-03 20:56:54','2025-03-03 20:56:54'),(128,23,'last_company_id','12','2025-03-03 20:56:54','2025-03-03 20:56:54'),(129,23,'last_cost_type_id','6','2025-03-03 20:56:54','2025-03-03 20:56:54'),(130,23,'last_relation_type','building_stage','2025-03-03 20:56:54','2025-03-03 20:56:54'),(131,24,'last_company_id','14','2025-03-03 20:56:54','2025-03-03 20:56:54'),(132,24,'last_cost_type_id','7','2025-03-03 20:56:54','2025-03-03 20:56:54'),(133,24,'last_relation_type','vehicle','2025-03-03 20:56:54','2025-03-03 20:56:54'),(134,25,'last_company_id','14','2025-03-03 20:56:54','2025-03-03 20:56:54'),(135,25,'last_cost_type_id','17','2025-03-03 20:56:54','2025-03-03 20:56:54'),(136,25,'last_relation_type','equipment','2025-03-03 20:56:54','2025-03-03 20:56:54'),(137,9,'last_company_id','5',NULL,NULL),(138,5,'last_company_id','5',NULL,NULL),(140,9,'remember_expires','1743958110',NULL,NULL),(141,8,'last_company_id','5',NULL,NULL);

--
-- Table structure for table `vehicle_inspections`
--

CREATE TABLE `vehicle_inspections` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `vehicle_id` bigint(20) unsigned NOT NULL,
  `inspection_date` date NOT NULL,
  `expiration_date` date NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `inspection_type` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `mileage` int(10) unsigned DEFAULT NULL COMMENT 'Przebieg w kilometrach',
  `service_actions` text DEFAULT NULL COMMENT 'Przeprowadzone czynności serwisowe',
  PRIMARY KEY (`id`),
  KEY `vehicle_id` (`vehicle_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `vehicle_inspections_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
  CONSTRAINT `vehicle_inspections_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicle_inspections`
--

INSERT INTO `vehicle_inspections` VALUES (31,13,'2023-03-10','2025-07-28',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Magnam molestiae eos tempore dolores alias.',7028,'Qui eaque placeat saepe qui incidunt aliquam. Soluta quam distinctio at molestias magni odio consequuntur. Optio aut sed facilis doloribus maiores vel cupiditate. Velit aperiam tempora iste eveniet nesciunt.'),(32,13,'2024-11-24','2025-08-27',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Explicabo laboriosam qui dolor repellat autem vitae vero.',16798,NULL),(33,13,'2023-06-13','2026-01-31',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Nulla necessitatibus officiis harum pariatur sit fugit accusamus.',32401,'Ipsum expedita incidunt dolores a et. Asperiores voluptatum voluptatum quas veritatis laboriosam hic necessitatibus officia. Molestiae reiciendis labore laborum officia rem excepturi. Et debitis exercitationem provident quidem doloribus unde.'),(34,14,'2024-07-03','2025-07-17',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,8721,'Dolorum est praesentium sunt sapiente non animi. Corrupti est suscipit vel voluptatem dolorum. Voluptas labore voluptatem voluptatem.'),(35,14,'2023-03-17','2025-05-27',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,26945,'Placeat suscipit vero sit et inventore et cumque autem. Enim non illo aut ducimus rerum. Soluta unde velit voluptatem eos explicabo.'),(36,14,'2023-12-05','2025-05-26',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny',NULL,45104,'Ad aliquid maiores nemo vel. Cupiditate maxime maxime accusantium illo eum. Vel praesentium quo consequatur dolores laudantium quae. Est voluptatem neque et.'),(37,14,'2023-03-23','2026-01-24',22,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,54312,'Itaque non incidunt omnis non illum. Aliquid accusantium aperiam voluptas voluptate harum modi. Sint iure sed inventore nobis.'),(38,15,'2023-05-17','2025-10-10',24,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Corporis quis iste id optio dolor impedit.',13940,'Perferendis praesentium aut architecto optio. Est aut deleniti doloribus a. Blanditiis architecto sit blanditiis magni expedita veritatis voluptatem.'),(39,15,'2023-09-03','2025-10-17',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Sit iure repellendus corporis repellat dolor.',29450,'Ea ut cumque ullam et nemo at. Voluptatibus est exercitationem molestiae consequatur numquam explicabo. Ratione nesciunt laboriosam possimus autem laboriosam quia. Molestiae praesentium est accusantium voluptas asperiores animi.'),(40,15,'2025-02-18','2025-07-29',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Corporis quidem consequatur voluptatem.',41348,'A amet dolorem nobis eos temporibus inventore. Laboriosam itaque corrupti et. Ipsum vero et iusto ullam aut pariatur. Quasi rerum tempore maxime quasi maxime est rem.'),(41,15,'2023-10-06','2025-12-18',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,57028,NULL),(42,15,'2024-01-07','2025-09-03',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Nesciunt reprehenderit minus placeat nihil.',76241,NULL),(43,16,'2023-08-27','2025-11-07',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,12878,'Et fugiat praesentium laudantium dolorem perferendis quis velit. Qui odio optio et sint sunt nihil consequuntur. Error qui nobis saepe repudiandae dolor.'),(44,16,'2023-05-04','2025-12-23',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny',NULL,23567,'Consectetur sint id ea accusamus. Est repellat veritatis veniam sit distinctio. Quam voluptatum possimus maiores provident enim omnis.'),(45,16,'2023-08-22','2025-11-07',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Vitae sit quo impedit nihil vitae laborum.',37723,'Vel dolor sapiente nihil. Omnis voluptas saepe aliquam. Est aut id natus autem dicta in deserunt. Recusandae itaque nesciunt repellat distinctio amet autem.'),(46,17,'2024-12-13','2025-04-09',24,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Soluta dignissimos voluptas nostrum quibusdam sapiente sed atque.',16290,'Et et officia aspernatur animi iste maiores. Facere dolor ducimus quaerat asperiores dignissimos animi. Eos ut illum est accusamus. Error esse illo fugit tempore possimus occaecati.'),(47,17,'2023-08-22','2025-05-15',22,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Et cum et nostrum ipsum dicta et eius.',29437,NULL),(48,17,'2024-01-05','2026-03-03',22,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny',NULL,46678,'Atque esse laborum ullam praesentium ex autem totam. Dolorum autem eum iure facilis nostrum. Animi quo est et enim. Et molestias velit iure totam.'),(49,17,'2024-03-30','2025-07-07',22,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny',NULL,54061,'Deserunt ipsum sequi sequi voluptatem et omnis officia. Esse asperiores ad et.'),(50,17,'2023-05-13','2026-02-20',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Possimus et non ut veritatis ut assumenda animi.',68754,NULL),(51,18,'2024-07-17','2025-05-12',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Omnis quia consequatur doloribus soluta et quam tempora.',12098,'Et molestias eum quaerat repellendus quaerat atque consectetur. Aliquid in voluptas inventore sunt fugit fuga commodi. Saepe magni aspernatur numquam vel sed.'),(52,18,'2024-08-08','2025-04-09',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Voluptatem non totam molestias officia.',31491,'Ut quam ea sapiente a maxime soluta minus. Ut eos aliquam sint corrupti. Explicabo consequatur est voluptatem molestias magnam voluptatum. Est tempore minus incidunt ad molestias earum et.'),(53,19,'2024-01-13','2025-06-20',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Voluptate earum ex rerum quo.',18512,'Consequatur facere consequatur non est. Repellat dicta natus ratione velit natus. Inventore aut nisi commodi quis nihil.'),(54,19,'2024-03-22','2025-09-21',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny',NULL,24404,NULL),(55,20,'2024-02-11','2025-11-26',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny',NULL,11321,'Eveniet harum tempora qui libero et. Et maxime natus doloremque omnis tempora ea nisi mollitia. Cupiditate ut est quos soluta maiores dolor rerum.'),(56,20,'2023-12-10','2025-07-19',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Non earum reiciendis nam quam veritatis ipsa.',30490,NULL),(57,21,'2024-12-16','2025-04-30',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Esse est quia dolorem nam a quia modi quos.',19530,NULL),(58,21,'2023-10-28','2025-07-26',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Amet impedit ea similique est.',35762,'Ducimus minima qui aut. Fugit omnis odio maiores rerum.'),(59,21,'2023-06-19','2025-05-21',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Magnam illo aut velit ab et.',46074,'Laboriosam mollitia explicabo beatae nemo sit aut. Excepturi laborum nam qui ipsa maiores et. Dolore facilis rerum explicabo rerum qui dolor cupiditate.'),(60,21,'2024-12-14','2025-07-31',23,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Et at et aut.',60425,NULL),(61,21,'2024-02-21','2026-02-21',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Suscipit saepe ratione dolore quia suscipit ratione vel praesentium.',73240,'Rerum ipsam est minima rerum reiciendis expedita nam eveniet. Perferendis amet autem quia culpa maxime. Beatae laboriosam voluptatem sunt eveniet. Aut occaecati a molestiae molestias nihil.'),(62,22,'2023-08-03','2025-04-22',21,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy',NULL,18974,'Blanditiis non velit quis nobis eaque enim porro perferendis. Recusandae aut occaecati vero repudiandae. Itaque et voluptates vitae aut sed qui. Libero voluptatem et ea et esse facilis vitae.'),(63,22,'2024-01-10','2025-04-13',24,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd serwisowy','Architecto rerum dolorem quibusdam perspiciatis sapiente unde.',29736,'Dolorum natus et amet ea laudantium commodi iusto. Aperiam qui consequatur cumque qui aut dolores minima. Cum ab iusto occaecati hic eveniet molestiae minima. Veniam id ut quisquam officiis dolores enim.'),(64,22,'2023-03-31','2026-02-04',25,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Laborum deleniti sunt odit voluptas voluptas sint quo.',35691,'Commodi omnis recusandae eaque et. Minus quam sequi temporibus adipisci sed. Architecto numquam tempora voluptatum dolor corrupti.'),(65,22,'2023-09-27','2025-09-29',22,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd techniczny','Error quidem labore accusamus qui et quia.',54780,'Ut vel sapiente consequatur magni. Maiores nobis aperiam incidunt illum sed eveniet et et. Quasi qui veritatis quae vel. Modi consequatur tempora deserunt hic quas consectetur sunt et.'),(66,22,'2023-10-15','2026-01-08',24,'2025-03-03 20:56:53','2025-03-03 20:56:53','Przegląd gwarancyjny','Est et repellat quia ut maxime facere.',71196,'Error fugit omnis iure nemo. Hic provident facilis nesciunt. Neque deleniti qui minus sit. Hic unde quos aut consequatur rerum ipsa excepturi.');

--
-- Table structure for table `vehicle_monthly_mileages`
--

CREATE TABLE `vehicle_monthly_mileages` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `vehicle_id` bigint(20) unsigned NOT NULL,
  `mileage_date` date NOT NULL,
  `mileage` int(10) unsigned NOT NULL,
  `mileage_difference` int(10) unsigned NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `vehicle_id` (`vehicle_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `vehicle_monthly_mileages_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
  CONSTRAINT `vehicle_monthly_mileages_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=295 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicle_monthly_mileages`
--

INSERT INTO `vehicle_monthly_mileages` VALUES (55,13,'2024-03-12',42804,580,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(56,13,'2024-04-12',44125,1321,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(57,13,'2024-05-12',45038,913,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(58,13,'2024-06-12',47807,2769,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(59,13,'2024-07-12',50154,2347,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(60,13,'2024-08-12',51413,1259,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(61,13,'2024-09-12',52562,1149,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(62,13,'2024-10-12',54542,1980,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(63,13,'2024-11-12',56478,1936,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(64,13,'2024-12-12',57178,700,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(65,13,'2025-01-12',59362,2184,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(66,13,'2025-02-12',60377,1015,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(67,14,'2024-03-10',25681,1932,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(68,14,'2024-04-10',26732,1051,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(69,14,'2024-05-10',29459,2727,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(70,14,'2024-06-10',30585,1126,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(71,14,'2024-07-10',32165,1580,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(72,14,'2024-08-10',33115,950,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(73,14,'2024-09-10',35988,2873,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(74,14,'2024-10-10',38297,2309,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(75,14,'2024-11-10',38972,675,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(76,14,'2024-12-10',41595,2623,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(77,14,'2025-01-10',42566,971,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(78,14,'2025-02-10',44335,1769,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(79,15,'2024-03-21',15296,1511,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(80,15,'2024-04-21',16000,704,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(81,15,'2024-05-21',17515,1515,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(82,15,'2024-06-21',19750,2235,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(83,15,'2024-07-21',22054,2304,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(84,15,'2024-08-21',23934,1880,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(85,15,'2024-09-21',26368,2434,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(86,15,'2024-10-21',28648,2280,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(87,15,'2024-11-21',29697,1049,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(88,15,'2024-12-21',32628,2931,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(89,15,'2025-01-21',34437,1809,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(90,15,'2025-02-21',35080,643,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(91,16,'2024-03-13',43259,2737,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(92,16,'2024-04-13',44987,1728,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(93,16,'2024-05-13',46519,1532,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(94,16,'2024-06-13',48161,1642,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(95,16,'2024-07-13',49537,1376,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(96,16,'2024-08-13',51279,1742,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(97,16,'2024-09-13',53211,1932,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(98,16,'2024-10-13',54881,1670,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(99,16,'2024-11-13',55924,1043,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(100,16,'2024-12-13',57162,1238,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(101,16,'2025-01-13',58347,1185,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(102,16,'2025-02-13',61067,2720,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(103,17,'2024-03-16',13520,708,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(104,17,'2024-04-16',15715,2195,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(105,17,'2024-05-16',17213,1498,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(106,17,'2024-06-16',20045,2832,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(107,17,'2024-07-16',22984,2939,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(108,17,'2024-08-16',24379,1395,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(109,17,'2024-09-16',25380,1001,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(110,17,'2024-10-16',27386,2006,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(111,17,'2024-11-16',29938,2552,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(112,17,'2024-12-16',32505,2567,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(113,17,'2025-01-16',34690,2185,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(114,17,'2025-02-16',36035,1345,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(115,18,'2024-03-29',29692,773,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(116,18,'2024-04-29',32607,2915,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(117,18,'2024-05-29',33728,1121,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(118,18,'2024-06-29',34694,966,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(119,18,'2024-07-29',37412,2718,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(120,18,'2024-08-29',38268,856,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(121,18,'2024-09-29',39808,1540,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(122,18,'2024-10-29',42457,2649,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(123,18,'2024-11-29',45445,2988,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(124,18,'2024-12-29',46122,677,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(125,18,'2025-01-29',47824,1702,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(126,18,'2025-03-01',50537,2713,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(127,19,'2024-03-12',22707,2212,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(128,19,'2024-04-12',24447,1740,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(129,19,'2024-05-12',27344,2897,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(130,19,'2024-06-12',29437,2093,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(131,19,'2024-07-12',30333,896,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(132,19,'2024-08-12',32145,1812,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(133,19,'2024-09-12',33530,1385,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(134,19,'2024-10-12',35359,1829,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(135,19,'2024-11-12',36296,937,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(136,19,'2024-12-12',38978,2682,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(137,19,'2025-01-12',40992,2014,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(138,19,'2025-02-12',42249,1257,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(139,20,'2024-03-19',45389,1368,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(140,20,'2024-04-19',47182,1793,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(141,20,'2024-05-19',48690,1508,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(142,20,'2024-06-19',50128,1438,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(143,20,'2024-07-19',50789,661,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(144,20,'2024-08-19',52097,1308,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(145,20,'2024-09-19',53300,1203,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(146,20,'2024-10-19',54469,1169,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(147,20,'2024-11-19',57103,2634,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(148,20,'2024-12-19',58660,1557,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(149,20,'2025-01-19',61056,2396,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(150,20,'2025-02-19',61655,599,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(151,21,'2024-03-26',44595,2510,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(152,21,'2024-04-26',46120,1525,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(153,21,'2024-05-26',48242,2122,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(154,21,'2024-06-26',49531,1289,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(155,21,'2024-07-26',51496,1965,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(156,21,'2024-08-26',53188,1692,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(157,21,'2024-09-26',53863,675,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(158,21,'2024-10-26',56511,2648,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(159,21,'2024-11-26',58379,1868,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(160,21,'2024-12-26',59857,1478,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(161,21,'2025-01-26',60751,894,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(162,21,'2025-02-26',62089,1338,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(163,22,'2024-03-24',46256,634,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(164,22,'2024-04-24',47416,1160,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(165,22,'2024-05-24',48303,887,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(166,22,'2024-06-24',51135,2832,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(167,22,'2024-07-24',53964,2829,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(168,22,'2024-08-24',55751,1787,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(169,22,'2024-09-24',56728,977,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(170,22,'2024-10-24',58141,1413,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(171,22,'2024-11-24',59359,1218,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(172,22,'2024-12-24',62325,2966,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(173,22,'2025-01-24',64877,2552,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(174,22,'2025-02-24',67805,2928,21,'2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `vehicle_operating_costs`
--

CREATE TABLE `vehicle_operating_costs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `vehicle_id` bigint(20) unsigned NOT NULL,
  `cost_date` date NOT NULL,
  `mileage` int(10) unsigned DEFAULT NULL,
  `cost_type` varchar(255) NOT NULL,
  `cost_net` decimal(10,2) NOT NULL,
  `cost_gross` decimal(10,2) NOT NULL,
  `description` text DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `vehicle_id` (`vehicle_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `vehicle_operating_costs_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
  CONSTRAINT `vehicle_operating_costs_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicle_operating_costs`
--


--
-- Table structure for table `vehicle_repairs`
--

CREATE TABLE `vehicle_repairs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `vehicle_id` bigint(20) unsigned NOT NULL,
  `repair_date` date NOT NULL,
  `mileage` int(10) unsigned DEFAULT NULL,
  `description` text NOT NULL,
  `cost` decimal(10,2) NOT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `vehicle_id` (`vehicle_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `vehicle_repairs_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
  CONSTRAINT `vehicle_repairs_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicle_repairs`
--

INSERT INTO `vehicle_repairs` VALUES (1,13,'2024-08-13',80349,'Nihil quia sed atque delectus sunt molestias.',1421.82,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(2,14,'2024-10-26',84616,'Rem sunt suscipit quia aut consectetur.',4449.15,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(3,15,'2024-12-07',88189,'Cumque officia tenetur a voluptatibus commodi.',1074.79,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(4,16,'2024-12-20',18036,'Aut cum neque quos aut.',4563.13,23,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(5,18,'2024-09-06',52738,'Quia sunt magni beatae quisquam consectetur.',4691.55,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(6,18,'2024-12-09',25942,'Rem et enim magni quo.',816.41,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(7,18,'2024-09-26',66708,'Quam consequatur dolorem repudiandae consequuntur.',1717.23,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(8,19,'2024-10-13',98236,'Dignissimos dolores laboriosam quae quibusdam molestiae dolore tempore.',2618.65,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(9,19,'2024-09-25',56115,'Fuga voluptas itaque qui et alias.',1345.84,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(10,20,'2024-11-03',83355,'Enim non et iusto est et.',2835.34,24,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(11,20,'2024-05-23',96561,'Eum maxime aperiam eligendi qui.',3919.92,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(12,21,'2024-10-21',45238,'Aut sint eveniet assumenda porro iste.',901.60,22,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(13,21,'2024-11-30',75844,'Et est quas itaque laudantium excepturi tenetur.',1968.58,21,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(14,21,'2024-08-06',42726,'Ab dolorem consequatur eos mollitia repellendus rerum tempore.',1998.66,25,'2025-03-03 20:56:53','2025-03-03 20:56:53'),(15,22,'2024-08-02',45342,'Quaerat et voluptatum qui quasi laboriosam ipsum maxime repudiandae.',4283.94,22,'2025-03-03 20:56:53','2025-03-03 20:56:53');

--
-- Table structure for table `vehicles`
--

CREATE TABLE `vehicles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `brand` varchar(255) NOT NULL,
  `model` varchar(255) NOT NULL,
  `year` int(11) NOT NULL,
  `registration_number` varchar(255) DEFAULT NULL,
  `vin` varchar(255) NOT NULL,
  `purchase_date` date NOT NULL,
  `company_id` int(11) DEFAULT NULL,
  `created_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `first_registration_date` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `vin` (`vin`),
  KEY `created_by` (`created_by`),
  KEY `fk_vehicles_company` (`company_id`),
  CONSTRAINT `fk_vehicles_company` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `vehicles_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicles`
--

INSERT INTO `vehicles` VALUES (13,'Toyota','nihil',2023,'FQC AMC8','PLBN9929H6J71KSNK','2022-02-07',12,24,'2025-03-03 20:56:53','2025-03-03 20:56:53','2021-12-04'),(14,'Audi','est',2020,'YP 7HIR','GFST86KUH1FKSR7ZN','2021-11-18',13,21,'2025-03-03 20:56:53','2025-03-03 20:56:53','2020-12-04'),(15,'Audi','nisi',2014,'VZL 914A3','1BRX49YZKZE8LLCPY','2025-02-03',12,23,'2025-03-03 20:56:53','2025-03-03 20:56:53','2019-04-19'),(16,'Opel','distinctio',2019,'NK D7EC4','SRBJBH06AWL4RBUXJ','2022-10-18',14,25,'2025-03-03 20:56:53','2025-03-03 20:56:53','2020-10-28'),(17,'Opel','vitae',2010,'ED 195AA','6WMRE5C51GCS421XR','2023-12-23',12,25,'2025-03-03 20:56:53','2025-03-03 20:56:53','2016-04-02'),(18,'Audi','facere',2018,'BL BD0RX','JJJEZ61YPUXL5GCMK','2021-07-26',12,23,'2025-03-03 20:56:53','2025-03-03 20:56:53','2020-08-19'),(19,'Audi','quo',2014,'DY 0WL5','Y5E1U43GEZKD2DY1T','2024-08-30',14,21,'2025-03-03 20:56:53','2025-03-03 20:56:53','2022-05-11'),(20,'Skoda','quo',2020,'NT V2LJU','H286P9BF8BZ09E2YC','2023-08-06',12,25,'2025-03-03 20:56:53','2025-03-03 20:56:53','2017-11-14'),(21,'Opel','distinctio',2017,'ISW 4E9W','P1UGX0V7DH3BX80K4','2020-08-21',14,25,'2025-03-03 20:56:53','2025-03-03 20:56:53','2017-06-17'),(22,'Ford','et',2021,'AC Y0EC7','UPGN242A41ZSYGR2T','2023-05-21',14,25,'2025-03-03 20:56:53','2025-03-03 20:56:53','2021-09-29'),(33,'bmw','szyb',2001,'sk443','22323232','2025-03-07',5,8,'2025-03-10 17:32:02','2025-03-10 17:32:02','2025-03-03'),(34,'audio','sypki',2000,NULL,'2321312323','2001-02-21',5,8,'2025-03-10 17:36:01','2025-03-10 17:36:01',NULL);


