/*M!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19  Distrib 10.11.15-MariaDB, for Linux (x86_64)
--
-- Host: 127.0.0.1    Database: alhilkkw_business_soug_hanana
-- ------------------------------------------------------
-- Server version	10.11.15-MariaDB-cll-lve

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `business_settings`
--

DROP TABLE IF EXISTS `business_settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `business_settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `business_name` varchar(255) DEFAULT NULL,
  `business_address` text DEFAULT NULL,
  `business_phone` varchar(20) DEFAULT NULL,
  `business_email` varchar(255) DEFAULT NULL,
  `business_website` varchar(255) DEFAULT NULL,
  `business_logo` varchar(255) DEFAULT NULL,
  `invoice_prefix` varchar(10) NOT NULL DEFAULT 'INV',
  `invoice_number_start` int(11) NOT NULL DEFAULT 1000,
  `current_invoice_number` int(11) NOT NULL DEFAULT 1000,
  `receipt_prefix` varchar(10) NOT NULL DEFAULT 'RCP',
  `receipt_number_start` int(11) NOT NULL DEFAULT 1000,
  `current_receipt_number` int(11) NOT NULL DEFAULT 1000,
  `default_tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_label` varchar(50) NOT NULL DEFAULT 'Tax',
  `currency_symbol` varchar(10) NOT NULL DEFAULT 'CFA',
  `currency_code` varchar(3) NOT NULL DEFAULT 'XOF',
  `business_registration_number` varchar(255) DEFAULT NULL,
  `tax_identification_number` varchar(255) DEFAULT NULL,
  `invoice_footer_note` text DEFAULT NULL,
  `receipt_footer_note` text DEFAULT NULL,
  `show_logo_on_invoice` tinyint(1) NOT NULL DEFAULT 1,
  `show_logo_on_receipt` tinyint(1) NOT NULL DEFAULT 1,
  `date_format` varchar(20) NOT NULL DEFAULT 'd/m/Y',
  `time_format` varchar(20) NOT NULL DEFAULT 'H:i:s',
  `starting_year` int(11) NOT NULL DEFAULT 2026,
  `active_fiscal_year_id` bigint(20) unsigned DEFAULT NULL,
  `view_fiscal_year_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `business_settings`
--

LOCK TABLES `business_settings` WRITE;
/*!40000 ALTER TABLE `business_settings` DISABLE KEYS */;
INSERT INTO `business_settings` VALUES
(1,'S-H Business',NULL,NULL,NULL,NULL,NULL,'INV',1000,1017,'RCP',1000,1000,0.00,'Tax','CFA','XOF',NULL,NULL,NULL,NULL,1,1,'d/m/Y','H:i:s',2026,NULL,NULL,'2026-04-10 13:00:32','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `business_settings` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cache`
--

DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache`
--

LOCK TABLES `cache` WRITE;
/*!40000 ALTER TABLE `cache` DISABLE KEYS */;
/*!40000 ALTER TABLE `cache` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cache_locks`
--

DROP TABLE IF EXISTS `cache_locks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache_locks`
--

LOCK TABLES `cache_locks` WRITE;
/*!40000 ALTER TABLE `cache_locks` DISABLE KEYS */;
/*!40000 ALTER TABLE `cache_locks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cashier_balances`
--

DROP TABLE IF EXISTS `cashier_balances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cashier_balances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `current_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_sales` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_withdrawals` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_expenses` decimal(15,2) NOT NULL DEFAULT 0.00,
  `last_updated_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cashier_balances_user_id_unique` (`user_id`),
  KEY `cashier_balances_user_id_index` (`user_id`),
  CONSTRAINT `cashier_balances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cashier_balances`
--

LOCK TABLES `cashier_balances` WRITE;
/*!40000 ALTER TABLE `cashier_balances` DISABLE KEYS */;
INSERT INTO `cashier_balances` VALUES
(1,1,129000.00,129000.00,0.00,0.00,'2026-04-20 17:44:11','2026-04-10 16:29:31','2026-04-20 17:44:11'),
(2,2,57000.00,57000.00,0.00,0.00,'2026-04-20 18:00:56','2026-04-14 14:37:19','2026-04-20 18:00:56');
/*!40000 ALTER TABLE `cashier_balances` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cashier_transactions`
--

DROP TABLE IF EXISTS `cashier_transactions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `cashier_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `type` enum('sale','sale_edit','sale_cancel','withdrawal','expense') NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `direction` enum('credit','debit') NOT NULL,
  `description` text NOT NULL,
  `reference_id` bigint(20) unsigned DEFAULT NULL,
  `reference_type` varchar(255) DEFAULT NULL,
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `transaction_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cashier_transactions_user_id_transaction_date_index` (`user_id`,`transaction_date`),
  KEY `cashier_transactions_type_transaction_date_index` (`type`,`transaction_date`),
  KEY `cashier_transactions_reference_id_reference_type_index` (`reference_id`,`reference_type`),
  CONSTRAINT `cashier_transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cashier_transactions`
--

LOCK TABLES `cashier_transactions` WRITE;
/*!40000 ALTER TABLE `cashier_transactions` DISABLE KEYS */;
INSERT INTO `cashier_transactions` VALUES
(1,1,'sale',15000.00,'credit','Loan payment received: INV-1001',1,'Sale',0.00,15000.00,'{\"sale_id\":1,\"sale_number\":\"INV-1001\",\"customer\":\"Teyba Oumar\",\"payment_type\":\"loan_payment\"}','2026-04-10 16:29:31','2026-04-10 16:29:31','2026-04-10 16:29:31'),
(2,1,'sale',12000.00,'credit','Sale completed: INV-1002',2,'Sale',15000.00,27000.00,'{\"sale_id\":2,\"sale_number\":\"INV-1002\",\"customer\":\"Aicha Bechir\",\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-10 16:31:24','2026-04-10 16:31:24','2026-04-10 16:31:24'),
(3,1,'sale',78000.00,'credit','Sale completed: INV-1003',3,'Sale',27000.00,105000.00,'{\"sale_id\":3,\"sale_number\":\"INV-1003\",\"customer\":null,\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-12 15:17:23','2026-04-12 15:17:23','2026-04-12 15:17:23'),
(4,1,'sale',15000.00,'credit','Sale completed: INV-1004',4,'Sale',105000.00,120000.00,'{\"sale_id\":4,\"sale_number\":\"INV-1004\",\"customer\":\"Asma Oumar\",\"payment_method\":\"cash\",\"is_partial\":true}','2026-04-12 15:29:21','2026-04-12 15:29:21','2026-04-12 15:29:21'),
(5,2,'sale',12000.00,'credit','Sale completed: INV-1005',5,'Sale',0.00,12000.00,'{\"sale_id\":5,\"sale_number\":\"INV-1005\",\"customer\":\"Fatime\",\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-14 14:37:19','2026-04-14 14:37:19','2026-04-14 14:37:19'),
(6,2,'sale',10000.00,'credit','Sale completed: INV-1006',6,'Sale',12000.00,22000.00,'{\"sale_id\":6,\"sale_number\":\"INV-1006\",\"customer\":\"Zenouba\",\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-14 14:37:42','2026-04-14 14:37:42','2026-04-14 14:37:42'),
(7,2,'sale',25000.00,'credit','Sale completed: INV-1007',7,'Sale',22000.00,47000.00,'{\"sale_id\":7,\"sale_number\":\"INV-1007\",\"customer\":null,\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-15 13:36:16','2026-04-15 13:36:16','2026-04-15 13:36:16'),
(8,2,'sale',10000.00,'credit','Sale completed: INV-1008',8,'Sale',47000.00,57000.00,'{\"sale_id\":8,\"sale_number\":\"INV-1008\",\"customer\":null,\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-15 13:36:33','2026-04-15 13:36:33','2026-04-15 13:36:33'),
(9,1,'sale',7000.00,'credit','Loan payment received: INV-1004',4,'Sale',120000.00,127000.00,'{\"sale_id\":4,\"sale_number\":\"INV-1004\",\"customer\":\"Asma Oumar\",\"payment_type\":\"loan_payment\"}','2026-04-19 05:16:07','2026-04-19 05:16:07','2026-04-19 05:16:07'),
(10,1,'sale',2000.00,'credit','Loan payment received: INV-1004',4,'Sale',127000.00,129000.00,'{\"sale_id\":4,\"sale_number\":\"INV-1004\",\"customer\":\"Asma Oumar\",\"payment_type\":\"loan_payment\"}','2026-04-20 17:44:11','2026-04-20 17:44:11','2026-04-20 17:44:11'),
(11,2,'sale',15000.00,'credit','Sale completed: INV-1015',15,'Sale',57000.00,72000.00,'{\"sale_id\":15,\"sale_number\":\"INV-1015\",\"customer\":\"Fatime\",\"payment_method\":\"cash\",\"is_partial\":false}','2026-04-20 17:58:45','2026-04-20 17:58:45','2026-04-20 17:58:45'),
(12,2,'sale_cancel',15000.00,'debit','Sale cancelled/refunded: INV-1015',15,'Sale',72000.00,57000.00,'{\"sale_id\":15,\"sale_number\":\"INV-1015\",\"reason\":\"Sale cancelled\\/refunded\"}','2026-04-20 18:00:56','2026-04-20 18:00:56','2026-04-20 18:00:56');
/*!40000 ALTER TABLE `cashier_transactions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `categories`
--

DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `categories_is_active_index` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `categories`
--

LOCK TABLES `categories` WRITE;
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
INSERT INTO `categories` VALUES
(1,'Bags',NULL,NULL,1,'2026-04-10 13:18:30','2026-04-10 13:18:30'),
(2,'Electronics',NULL,NULL,1,'2026-04-10 13:18:41','2026-04-10 13:18:41');
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `clients`
--

DROP TABLE IF EXISTS `clients`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `clients` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `clients_phone_unique` (`phone`),
  KEY `clients_name_index` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `clients`
--

LOCK TABLES `clients` WRITE;
/*!40000 ALTER TABLE `clients` DISABLE KEYS */;
INSERT INTO `clients` VALUES
(1,'Bon','---',NULL,NULL,NULL,1,'2026-04-18 17:36:37','2026-04-20 17:53:52'),
(2,'Nadia','60 58 05 26',NULL,NULL,NULL,1,'2026-04-20 17:55:03','2026-04-20 17:55:03'),
(3,'Nadia\'s Clients','99 58 05 26',NULL,NULL,NULL,1,'2026-04-20 17:56:12','2026-04-20 17:56:12'),
(4,'Khadidja Oumar','61',NULL,NULL,NULL,1,'2026-04-20 17:56:56','2026-04-20 17:56:56'),
(5,'Fatime','62',NULL,NULL,NULL,1,'2026-04-20 17:58:45','2026-04-20 17:58:45'),
(6,'Asia','63',NULL,NULL,NULL,1,'2026-04-20 17:59:07','2026-04-20 17:59:07');
/*!40000 ALTER TABLE `clients` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `expense_types`
--

DROP TABLE IF EXISTS `expense_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `expense_types` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `color` varchar(7) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `expense_types_name_unique` (`name`),
  UNIQUE KEY `expense_types_color_unique` (`color`),
  KEY `expense_types_is_active_name_index` (`is_active`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `expense_types`
--

LOCK TABLES `expense_types` WRITE;
/*!40000 ALTER TABLE `expense_types` DISABLE KEYS */;
/*!40000 ALTER TABLE `expense_types` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `expenses`
--

DROP TABLE IF EXISTS `expenses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `expenses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `expense_type_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `description` text DEFAULT NULL,
  `expense_date` date NOT NULL,
  `receipt_number` varchar(255) DEFAULT NULL,
  `payment_method` varchar(255) NOT NULL DEFAULT 'cash',
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `expenses_expense_date_status_index` (`expense_date`,`status`),
  KEY `expenses_expense_type_id_status_index` (`expense_type_id`,`status`),
  KEY `expenses_user_id_expense_date_index` (`user_id`,`expense_date`),
  CONSTRAINT `expenses_expense_type_id_foreign` FOREIGN KEY (`expense_type_id`) REFERENCES `expense_types` (`id`),
  CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `expenses`
--

LOCK TABLES `expenses` WRITE;
/*!40000 ALTER TABLE `expenses` DISABLE KEYS */;
/*!40000 ALTER TABLE `expenses` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `failed_jobs`
--

DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `failed_jobs`
--

LOCK TABLES `failed_jobs` WRITE;
/*!40000 ALTER TABLE `failed_jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `failed_jobs` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `fiscal_years`
--

DROP TABLE IF EXISTS `fiscal_years`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `fiscal_years` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 0,
  `is_closed` tinyint(1) NOT NULL DEFAULT 0,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `fiscal_years`
--

LOCK TABLES `fiscal_years` WRITE;
/*!40000 ALTER TABLE `fiscal_years` DISABLE KEYS */;
/*!40000 ALTER TABLE `fiscal_years` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `job_batches`
--

DROP TABLE IF EXISTS `job_batches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `job_batches`
--

LOCK TABLES `job_batches` WRITE;
/*!40000 ALTER TABLE `job_batches` DISABLE KEYS */;
/*!40000 ALTER TABLE `job_batches` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `jobs`
--

DROP TABLE IF EXISTS `jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) unsigned NOT NULL,
  `reserved_at` int(10) unsigned DEFAULT NULL,
  `available_at` int(10) unsigned NOT NULL,
  `created_at` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `jobs`
--

LOCK TABLES `jobs` WRITE;
/*!40000 ALTER TABLE `jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `jobs` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `loan_histories`
--

DROP TABLE IF EXISTS `loan_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `loan_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `action` enum('created','payment_made','fully_paid','edited','cancelled') NOT NULL,
  `old_amount` decimal(15,2) DEFAULT NULL,
  `new_amount` decimal(15,2) DEFAULT NULL,
  `payment_amount` decimal(15,2) DEFAULT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loan_histories_sale_id_foreign` (`sale_id`),
  KEY `loan_histories_user_id_foreign` (`user_id`),
  CONSTRAINT `loan_histories_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loan_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `loan_histories`
--

LOCK TABLES `loan_histories` WRITE;
/*!40000 ALTER TABLE `loan_histories` DISABLE KEYS */;
INSERT INTO `loan_histories` VALUES
(1,1,1,'created',0.00,25000.00,NULL,'Loan created from POS sale',NULL,'2026-04-10 13:22:52','2026-04-10 13:22:52'),
(2,1,1,'payment_made',25000.00,10000.00,15000.00,'Payment received',NULL,'2026-04-10 16:29:34','2026-04-10 16:29:34'),
(3,4,1,'created',0.00,9000.00,NULL,'Loan created from POS sale',NULL,'2026-04-12 15:29:21','2026-04-12 15:29:21'),
(4,9,2,'created',0.00,30000.00,NULL,'Loan created from POS sale',NULL,'2026-04-15 13:37:19','2026-04-15 13:37:19'),
(5,4,2,'payment_made',9000.00,2000.00,7000.00,'Payment received',NULL,'2026-04-19 05:16:08','2026-04-19 05:16:08'),
(6,4,2,'fully_paid',2000.00,0.00,2000.00,'Payment received',NULL,'2026-04-20 17:44:12','2026-04-20 17:44:12'),
(7,10,2,'created',0.00,20000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:49:56','2026-04-20 17:49:56'),
(8,11,2,'created',0.00,50000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:50:31','2026-04-20 17:50:31'),
(9,12,2,'created',0.00,20000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:55:03','2026-04-20 17:55:03'),
(10,13,2,'created',0.00,50000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:56:12','2026-04-20 17:56:12'),
(11,14,2,'created',0.00,15000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:56:56','2026-04-20 17:56:56'),
(12,16,2,'created',0.00,15000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 17:59:07','2026-04-20 17:59:07'),
(13,17,2,'created',0.00,15000.00,NULL,'Loan created from POS sale',NULL,'2026-04-20 18:01:31','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `loan_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `loan_payments`
--

DROP TABLE IF EXISTS `loan_payments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `loan_payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `payment_method` enum('cash','card','mobile_payment') NOT NULL,
  `notes` text DEFAULT NULL,
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `payment_date` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loan_payments_sale_id_foreign` (`sale_id`),
  KEY `loan_payments_user_id_foreign` (`user_id`),
  CONSTRAINT `loan_payments_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loan_payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `loan_payments`
--

LOCK TABLES `loan_payments` WRITE;
/*!40000 ALTER TABLE `loan_payments` DISABLE KEYS */;
INSERT INTO `loan_payments` VALUES
(1,1,1,15000.00,'cash',NULL,25000.00,10000.00,'2026-04-10 19:29:31','2026-04-10 16:29:31','2026-04-10 16:29:31'),
(2,4,2,7000.00,'cash',NULL,9000.00,2000.00,'2026-04-19 08:16:07','2026-04-19 05:16:07','2026-04-19 05:16:07'),
(3,4,2,2000.00,'cash',NULL,2000.00,0.00,'2026-04-20 20:44:11','2026-04-20 17:44:11','2026-04-20 17:44:11');
/*!40000 ALTER TABLE `loan_payments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `markets`
--

DROP TABLE IF EXISTS `markets`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `markets` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `domain` varchar(255) NOT NULL,
  `db_name` varchar(255) NOT NULL,
  `db_user` varchar(255) NOT NULL,
  `db_password` varchar(255) NOT NULL,
  `app_name` varchar(255) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `markets_domain_unique` (`domain`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `markets`
--

LOCK TABLES `markets` WRITE;
/*!40000 ALTER TABLE `markets` DISABLE KEYS */;
INSERT INTO `markets` VALUES
(1,'soug_hanana.soug.com.tr','alhilkkw_soug_hanana','alhilkkw_soug_hanana','mama.1418','SOUG HANANA',1,NULL,NULL),
(2,'moussa.soug.com.tr','alhilkkw_moussa','alhilkkw_moussa','mama.1418','Moussa',1,NULL,NULL),
(3,'yeski.soug.com.tr','alhilkkw_yeski','alhilkkw_yeski','mama.1418','G YESKI',1,NULL,NULL);
/*!40000 ALTER TABLE `markets` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `migrations`
--

DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `migrations`
--

LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` VALUES
(1,'0001_01_01_000000_create_users_table',1),
(2,'0001_01_01_000001_create_cache_table',1),
(3,'0001_01_01_000002_create_jobs_table',1),
(4,'2024_01_01_000008_create_categories_table',1),
(5,'2025_08_20_204847_add_two_factor_columns_to_users_table',1),
(6,'2025_08_20_204856_create_personal_access_tokens_table',1),
(7,'2025_08_21_174432_create_products_table',1),
(8,'2025_08_21_174528_create_product_inventories_table',1),
(9,'2025_08_21_174637_create_product_histories_table',1),
(10,'2025_08_21_174721_create_sales_table',1),
(11,'2025_08_21_174757_create_sale_items_table',1),
(12,'2025_08_21_174838_create_product_variants_table',1),
(13,'2025_08_26_161417_create_sale_histories_table',1),
(14,'2025_09_03_142120_create_proformas_table',1),
(15,'2025_09_03_142121_create_proforma_items_table',1),
(16,'2025_09_07_121232_create_expense_types_table',1),
(17,'2025_09_07_121233_create_expenses_table',1),
(18,'2025_09_07_153315_create_cashier_balances_table',1),
(19,'2025_09_10_093456_add_loan_fields_to_sales_table',1),
(20,'2025_09_10_093456_create_loan_histories_table',1),
(21,'2025_09_10_093456_create_loan_payments_table',1),
(22,'2025_09_12_181425_create_business_settings_table',1),
(23,'2025_09_27_194618_create_permission_tables',1),
(24,'2025_10_31_164515_create_markets_table',1),
(25,'2025_11_27_135818_create_push_subscriptions_table',1),
(26,'2026_04_05_000001_add_starting_year_to_business_settings',1),
(27,'2026_04_05_220918_create_fiscal_years_table',1),
(28,'2026_04_07_071928_add_endpoint_hash_to_push_subscriptions',1);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `model_has_permissions`
--

DROP TABLE IF EXISTS `model_has_permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `model_has_permissions`
--

LOCK TABLES `model_has_permissions` WRITE;
/*!40000 ALTER TABLE `model_has_permissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `model_has_permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `model_has_roles`
--

DROP TABLE IF EXISTS `model_has_roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `model_has_roles`
--

LOCK TABLES `model_has_roles` WRITE;
/*!40000 ALTER TABLE `model_has_roles` DISABLE KEYS */;
INSERT INTO `model_has_roles` VALUES
(1,'App\\Models\\User',2);
/*!40000 ALTER TABLE `model_has_roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `password_reset_tokens`
--

DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `password_reset_tokens`
--

LOCK TABLES `password_reset_tokens` WRITE;
/*!40000 ALTER TABLE `password_reset_tokens` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_reset_tokens` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `permissions`
--

DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `permissions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `permissions`
--

LOCK TABLES `permissions` WRITE;
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` VALUES
(1,'view dashboard','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(2,'refresh dashboard','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(3,'view dashboard stats','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(4,'view users','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(5,'create users','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(6,'edit users','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(7,'delete users','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(8,'assign roles','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(9,'view roles','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(10,'create roles','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(11,'edit roles','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(12,'delete roles','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(13,'view categories','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(14,'create categories','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(15,'edit categories','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(16,'delete categories','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(17,'toggle category status','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(18,'view products','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(19,'create products','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(20,'edit products','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(21,'delete products','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(22,'manage product stock','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(23,'view product analytics','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(24,'access pos','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(25,'process sales','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(26,'cancel sales','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(27,'view sales history','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(28,'view sale details','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(29,'edit sales','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(30,'print receipts','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(31,'export sales','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(32,'view sale history','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(33,'view reports','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(34,'export reports','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(35,'generate advanced reports','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(36,'view business settings','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(37,'edit business settings','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(38,'view expenses','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(39,'create expenses','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(40,'edit expenses','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(41,'delete expenses','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(42,'approve expenses','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(43,'view loans','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(44,'manage loan payments','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(45,'mark loans paid','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(46,'view proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(47,'create proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(48,'edit proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(49,'delete proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(50,'confirm proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(51,'cancel proformas','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(52,'view cashier','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(53,'process withdrawals','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(54,'view cashier history','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(55,'export cashier reports','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(56,'view cashier balance','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(57,'view expense types','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(58,'create expense types','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(59,'edit expense types','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(60,'delete expense types','web','2026-04-10 14:58:44','2026-04-10 14:58:44');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `personal_access_tokens`
--

DROP TABLE IF EXISTS `personal_access_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) unsigned NOT NULL,
  `name` text NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`),
  KEY `personal_access_tokens_expires_at_index` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `personal_access_tokens`
--

LOCK TABLES `personal_access_tokens` WRITE;
/*!40000 ALTER TABLE `personal_access_tokens` DISABLE KEYS */;
/*!40000 ALTER TABLE `personal_access_tokens` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_histories`
--

DROP TABLE IF EXISTS `product_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `action` varchar(50) NOT NULL,
  `description` text NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data`)),
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_histories_product_id_created_at_index` (`product_id`,`created_at`),
  KEY `product_histories_action_index` (`action`),
  KEY `product_histories_user_id_index` (`user_id`),
  CONSTRAINT `product_histories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `product_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_histories`
--

LOCK TABLES `product_histories` WRITE;
/*!40000 ALTER TABLE `product_histories` DISABLE KEYS */;
INSERT INTO `product_histories` VALUES
(1,1,'created','Product created',1,'{\"name\":\"Bags\",\"description\":null,\"barcode\":\"PRD092846\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"5600.00\",\"selling_price\":\"12000.00\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":1,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-10T16:20:37.000000Z\",\"created_at\":\"2026-04-10T16:20:37.000000Z\",\"id\":1}','143.105.161.121','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-10 13:20:37','2026-04-10 13:20:37'),
(2,1,'stock_added','Added 12 units - Initial stock',1,'{\"quantity\":12,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":12,\"notes\":\"Product creation\"}','143.105.161.121','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-10 13:20:37','2026-04-10 13:20:37'),
(3,2,'created','Product created',1,'{\"name\":\"Astronot\",\"description\":null,\"barcode\":\"PRD000749\",\"category_id\":\"2\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"12000.00\",\"selling_price\":\"25000.00\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":1,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-10T16:22:24.000000Z\",\"created_at\":\"2026-04-10T16:22:24.000000Z\",\"id\":2}','143.105.161.121','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-10 13:22:24','2026-04-10 13:22:24'),
(4,2,'stock_added','Added 10 units - Initial stock',1,'{\"quantity\":10,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":10,\"notes\":\"Product creation\"}','143.105.161.121','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-10 13:22:24','2026-04-10 13:22:24'),
(5,2,'stock_removed','Removed 1 units - Sale',1,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":10,\"new_stock\":9,\"sale_id\":1,\"sale_number\":\"INV-1001\"}','143.105.161.121','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-10 13:22:52','2026-04-10 13:22:52'),
(6,1,'stock_removed','Removed 1 units - Sale',1,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":12,\"new_stock\":11,\"sale_id\":2,\"sale_number\":\"INV-1002\"}','154.73.161.230','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/29.0 Chrome/136.0.0.0 Mobile Safari/537.36','2026-04-10 16:31:24','2026-04-10 16:31:24'),
(7,1,'stock_removed','Removed 7 units - Sale',1,'{\"quantity\":7,\"reason\":\"Sale\",\"previous_stock\":11,\"new_stock\":4,\"sale_id\":3,\"sale_number\":\"INV-1003\"}','154.73.161.83','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-12 15:17:23','2026-04-12 15:17:23'),
(8,1,'stock_removed','Removed 2 units - Sale',1,'{\"quantity\":2,\"reason\":\"Sale\",\"previous_stock\":4,\"new_stock\":2,\"sale_id\":4,\"sale_number\":\"INV-1004\"}','154.73.161.83','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-12 15:29:21','2026-04-12 15:29:21'),
(9,1,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":2,\"new_stock\":1,\"sale_id\":5,\"sale_number\":\"INV-1005\"}','154.73.160.191','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-14 14:37:19','2026-04-14 14:37:19'),
(10,1,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":1,\"new_stock\":0,\"sale_id\":6,\"sale_number\":\"INV-1006\"}','154.73.160.191','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-14 14:37:42','2026-04-14 14:37:42'),
(11,1,'price_changed','Product pricing updated',2,'{\"old_prices\":{\"cost_price\":\"5600.00\",\"selling_price\":\"12000.00\",\"discount_price\":null},\"new_prices\":{\"cost_price\":\"6200.00\",\"selling_price\":\"12500.00\",\"discount_price\":null}}','154.73.163.54','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-14 15:27:40','2026-04-14 15:27:40'),
(12,1,'updated','Product updated',2,'{\"name\":{\"old\":\"Bags\",\"new\":\"Bags-2\"},\"cost_price\":{\"old\":\"5600.00\",\"new\":\"6200\"},\"selling_price\":{\"old\":\"12000.00\",\"new\":\"12500.00\"}}','154.73.163.54','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-14 15:27:40','2026-04-14 15:27:40'),
(13,1,'stock_added','Added 15 units - Restock - New shipment',2,'{\"quantity\":15,\"reason\":\"Restock - New shipment\",\"previous_stock\":0,\"new_stock\":15,\"notes\":null}','154.73.163.54','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-14 15:28:17','2026-04-14 15:28:17'),
(14,1,'stock_removed','Removed 2 units - Sale',2,'{\"quantity\":2,\"reason\":\"Sale\",\"previous_stock\":15,\"new_stock\":13,\"sale_id\":7,\"sale_number\":\"INV-1007\"}','143.105.161.94','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-15 13:36:16','2026-04-15 13:36:16'),
(15,1,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":13,\"new_stock\":12,\"sale_id\":8,\"sale_number\":\"INV-1008\"}','143.105.161.94','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-15 13:36:33','2026-04-15 13:36:33'),
(16,1,'stock_removed','Removed 2 units - Sale',2,'{\"quantity\":2,\"reason\":\"Sale\",\"previous_stock\":12,\"new_stock\":10,\"sale_id\":9,\"sale_number\":\"INV-1009\"}','143.105.161.94','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-15 13:37:19','2026-04-15 13:37:19'),
(17,3,'created','Product created',2,'{\"name\":\"Bags 3\",\"description\":null,\"barcode\":\"PRD139272\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"7500.00\",\"selling_price\":\"10000.00\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":1,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-20T20:45:55.000000Z\",\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"id\":3}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:45:55','2026-04-20 17:45:55'),
(18,3,'stock_added','Added 15 units - Initial stock',2,'{\"quantity\":15,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":15,\"notes\":\"Product creation\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:45:55','2026-04-20 17:45:55'),
(19,3,'stock_removed','Removed 2 units - Sale',2,'{\"quantity\":2,\"reason\":\"Sale\",\"previous_stock\":15,\"new_stock\":13,\"sale_id\":10,\"sale_number\":\"INV-1010\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:49:55','2026-04-20 17:49:55'),
(20,3,'stock_removed','Removed 5 units - Sale',2,'{\"quantity\":5,\"reason\":\"Sale\",\"previous_stock\":13,\"new_stock\":8,\"sale_id\":11,\"sale_number\":\"INV-1011\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:50:31','2026-04-20 17:50:31'),
(21,3,'stock_added','Added 5 units - Sale cancelled/refunded',2,'{\"quantity\":5,\"reason\":\"Error\",\"previous_stock\":8,\"new_stock\":13,\"sale_id\":11,\"sale_number\":\"INV-1011\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:51:49','2026-04-20 17:51:49'),
(22,3,'stock_added','Added 2 units - Sale cancelled/refunded',2,'{\"quantity\":2,\"reason\":\"Error\",\"previous_stock\":13,\"new_stock\":15,\"sale_id\":10,\"sale_number\":\"INV-1010\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:52:33','2026-04-20 17:52:33'),
(23,3,'stock_removed','Removed 2 units - Sale',2,'{\"quantity\":2,\"reason\":\"Sale\",\"previous_stock\":15,\"new_stock\":13,\"sale_id\":12,\"sale_number\":\"INV-1012\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:55:03','2026-04-20 17:55:03'),
(24,3,'stock_removed','Removed 5 units - Sale',2,'{\"quantity\":5,\"reason\":\"Sale\",\"previous_stock\":13,\"new_stock\":8,\"sale_id\":13,\"sale_number\":\"INV-1013\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:56:12','2026-04-20 17:56:12'),
(25,3,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":8,\"new_stock\":7,\"sale_id\":14,\"sale_number\":\"INV-1014\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:56:56','2026-04-20 17:56:56'),
(26,3,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":7,\"new_stock\":6,\"sale_id\":15,\"sale_number\":\"INV-1015\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:58:45','2026-04-20 17:58:45'),
(27,3,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":6,\"new_stock\":5,\"sale_id\":16,\"sale_number\":\"INV-1016\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 17:59:07','2026-04-20 17:59:07'),
(28,3,'stock_added','Added 1 units - Sale cancelled/refunded',2,'{\"quantity\":1,\"reason\":\"Error\",\"previous_stock\":5,\"new_stock\":6,\"sale_id\":15,\"sale_number\":\"INV-1015\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 18:00:56','2026-04-20 18:00:56'),
(29,3,'stock_removed','Removed 1 units - Sale',2,'{\"quantity\":1,\"reason\":\"Sale\",\"previous_stock\":6,\"new_stock\":5,\"sale_id\":17,\"sale_number\":\"INV-1017\"}','154.73.113.145','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36','2026-04-20 18:01:31','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `product_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_inventories`
--

DROP TABLE IF EXISTS `product_inventories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_inventories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `current_stock` int(11) NOT NULL DEFAULT 0,
  `reserved_stock` int(11) NOT NULL DEFAULT 0,
  `available_stock` int(11) NOT NULL DEFAULT 0,
  `last_stock_update` timestamp NULL DEFAULT NULL,
  `last_updated_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_inventories_last_updated_by_foreign` (`last_updated_by`),
  KEY `product_inventories_product_id_index` (`product_id`),
  KEY `product_inventories_available_stock_index` (`available_stock`),
  CONSTRAINT `product_inventories_last_updated_by_foreign` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`),
  CONSTRAINT `product_inventories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_inventories`
--

LOCK TABLES `product_inventories` WRITE;
/*!40000 ALTER TABLE `product_inventories` DISABLE KEYS */;
INSERT INTO `product_inventories` VALUES
(1,1,10,0,10,'2026-04-15 13:37:18',2,'2026-04-10 13:20:37','2026-04-15 13:37:18'),
(2,2,9,0,9,'2026-04-10 13:22:52',1,'2026-04-10 13:22:24','2026-04-10 13:22:52'),
(3,3,5,0,5,'2026-04-20 18:01:31',2,'2026-04-20 17:45:55','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `product_inventories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_variants`
--

DROP TABLE IF EXISTS `product_variants`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_variants` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `value` varchar(255) NOT NULL,
  `sku` varchar(255) NOT NULL,
  `price_adjustment` decimal(8,2) NOT NULL DEFAULT 0.00,
  `stock_quantity` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_variants_sku_unique` (`sku`),
  KEY `product_variants_product_id_is_active_index` (`product_id`,`is_active`),
  CONSTRAINT `product_variants_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_variants`
--

LOCK TABLES `product_variants` WRITE;
/*!40000 ALTER TABLE `product_variants` DISABLE KEYS */;
/*!40000 ALTER TABLE `product_variants` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `products`
--

DROP TABLE IF EXISTS `products`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) unsigned NOT NULL,
  `product_type` enum('market','store') NOT NULL,
  `unit` varchar(50) NOT NULL,
  `alert_quantity` int(11) NOT NULL DEFAULT 1,
  `cost_price` decimal(10,2) NOT NULL,
  `selling_price` decimal(10,2) NOT NULL,
  `discount_price` decimal(10,2) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `weight` decimal(8,3) DEFAULT NULL,
  `length` decimal(8,2) DEFAULT NULL,
  `width` decimal(8,2) DEFAULT NULL,
  `height` decimal(8,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_barcode_unique` (`barcode`),
  KEY `products_product_type_is_active_index` (`product_type`,`is_active`),
  KEY `products_category_id_is_active_index` (`category_id`,`is_active`),
  KEY `products_barcode_index` (`barcode`),
  KEY `products_is_active_index` (`is_active`),
  KEY `products_expiry_date_index` (`expiry_date`),
  KEY `products_product_type_index` (`product_type`),
  CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `products`
--

LOCK TABLES `products` WRITE;
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
INSERT INTO `products` VALUES
(1,'Bags-2',NULL,'PRD092846',1,'market','pcs',1,6200.00,12500.00,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'2026-04-10 13:20:37','2026-04-14 15:27:40',NULL),
(2,'Astronot',NULL,'PRD000749',2,'market','pcs',1,12000.00,25000.00,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'2026-04-10 13:22:24','2026-04-10 13:22:24',NULL),
(3,'Bags 3',NULL,'PRD139272',1,'market','pcs',1,7500.00,10000.00,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,'2026-04-20 17:45:55','2026-04-20 17:45:55',NULL);
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `proforma_items`
--

DROP TABLE IF EXISTS `proforma_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `proforma_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `proforma_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_barcode` varchar(255) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `proforma_items_proforma_id_index` (`proforma_id`),
  KEY `proforma_items_product_id_index` (`product_id`),
  CONSTRAINT `proforma_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `proforma_items_proforma_id_foreign` FOREIGN KEY (`proforma_id`) REFERENCES `proformas` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `proforma_items`
--

LOCK TABLES `proforma_items` WRITE;
/*!40000 ALTER TABLE `proforma_items` DISABLE KEYS */;
/*!40000 ALTER TABLE `proforma_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `proformas`
--

DROP TABLE IF EXISTS `proformas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `proformas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `proforma_number` varchar(255) NOT NULL,
  `proforma_type` enum('market','store') NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(20) DEFAULT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `status` enum('draft','sent','confirmed','expired','cancelled') NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `confirmed_by` bigint(20) unsigned DEFAULT NULL,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `sale_id` bigint(20) unsigned DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `proformas_proforma_number_unique` (`proforma_number`),
  KEY `proformas_confirmed_by_foreign` (`confirmed_by`),
  KEY `proformas_sale_id_foreign` (`sale_id`),
  KEY `proformas_proforma_type_status_index` (`proforma_type`,`status`),
  KEY `proformas_created_at_index` (`created_at`),
  KEY `proformas_status_index` (`status`),
  KEY `proformas_created_by_index` (`created_by`),
  KEY `proformas_expires_at_index` (`expires_at`),
  CONSTRAINT `proformas_confirmed_by_foreign` FOREIGN KEY (`confirmed_by`) REFERENCES `users` (`id`),
  CONSTRAINT `proformas_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `proformas_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `proformas`
--

LOCK TABLES `proformas` WRITE;
/*!40000 ALTER TABLE `proformas` DISABLE KEYS */;
/*!40000 ALTER TABLE `proformas` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `push_subscriptions`
--

DROP TABLE IF EXISTS `push_subscriptions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `push_subscriptions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `endpoint` text NOT NULL,
  `endpoint_hash` varchar(64) NOT NULL,
  `public_key` varchar(500) DEFAULT NULL,
  `auth_token` varchar(500) DEFAULT NULL,
  `content_encoding` varchar(255) NOT NULL DEFAULT 'aes128gcm',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `push_subscriptions_endpoint_hash_unique` (`endpoint_hash`),
  KEY `push_subscriptions_user_id_is_active_index` (`user_id`,`is_active`),
  CONSTRAINT `push_subscriptions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `push_subscriptions`
--

LOCK TABLES `push_subscriptions` WRITE;
/*!40000 ALTER TABLE `push_subscriptions` DISABLE KEYS */;
INSERT INTO `push_subscriptions` VALUES
(2,2,'https://fcm.googleapis.com/fcm/send/eAJbUUSrZlY:APA91bHZp_jZtlcGsw8mXXrqvdMfMxK-cngFl5CBtSQlTZD7DaTj0Qym3v37w0J0KC7e7CHi6PeBuEUmS7G7spie1Vy5Lp7NNNU9LjXOnBXWzEuLCmyhEUCEJK4B_kMPdxwQ0KZ6twbH','c5e48c0203c140d93c49df77f54b209c6471dfe2deea9c07afd9daeb74fe1ebb','BNi9UehrT-KYCVK9c2brsLoslrt8w-YpM3o-0I5kaL7pvaY3dQC2pDba2zenXSaqTJawkRXoagvZw7AYL7NwJPs','WI_x14PRVpTV9rFPpgjTiA','aes128gcm',1,'2026-04-20 18:01:35','2026-04-19 05:18:17','2026-04-20 18:01:35'),
(3,2,'https://fcm.googleapis.com/fcm/send/cItAdf7Qp1o:APA91bGiIG_EJV5qnwRqGyIUATqtCV-02TuxvqKZhyF8Dxgz0RCXlWwoW1R8anAwnZbXvZOIBOOuGP9LjuRNNhPrmXBXYHVz9X3ss3K3dqrcEvg-QmrpKmtYX5VXqSsU4NcNgfetYcZn','1f4d65178e62368cc7fd2ce296b82103253b0be9456e9163cc00ec0f264092e0','BCzbUME1OxSEh2qz-dos5wn5PwaSVxdOsC4h-NnMmidM8WfGqHSiOmUW2rr6iYFdxKMxNlHQgI9yhNmZulkU8_k','2kHamptYPMuAYsSs5cO_BA','aes128gcm',1,'2026-04-20 18:01:35','2026-04-20 17:55:16','2026-04-20 18:01:35');
/*!40000 ALTER TABLE `push_subscriptions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `role_has_permissions`
--

DROP TABLE IF EXISTS `role_has_permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `role_has_permissions`
--

LOCK TABLES `role_has_permissions` WRITE;
/*!40000 ALTER TABLE `role_has_permissions` DISABLE KEYS */;
INSERT INTO `role_has_permissions` VALUES
(1,1),
(1,2),
(1,3),
(1,4),
(2,1),
(2,2),
(2,3),
(3,1),
(3,2),
(3,3),
(4,1),
(4,2),
(5,1),
(5,2),
(6,1),
(6,2),
(7,1),
(7,2),
(8,1),
(8,2),
(9,1),
(9,2),
(10,1),
(10,2),
(11,1),
(11,2),
(12,1),
(12,2),
(13,1),
(13,2),
(13,3),
(13,4),
(14,1),
(14,2),
(14,3),
(15,1),
(15,2),
(15,3),
(16,1),
(16,2),
(17,1),
(17,2),
(17,3),
(18,1),
(18,2),
(18,3),
(18,4),
(19,1),
(19,2),
(19,3),
(20,1),
(20,2),
(20,3),
(21,1),
(21,2),
(22,1),
(22,2),
(22,3),
(22,4),
(23,1),
(23,2),
(23,3),
(24,1),
(24,2),
(24,3),
(24,4),
(25,1),
(25,2),
(25,3),
(25,4),
(26,1),
(26,2),
(27,1),
(27,2),
(27,3),
(27,4),
(28,1),
(28,2),
(28,3),
(28,4),
(29,1),
(29,2),
(29,3),
(30,1),
(30,2),
(30,3),
(30,4),
(31,1),
(31,2),
(31,3),
(32,1),
(32,2),
(32,3),
(33,1),
(33,2),
(33,3),
(33,4),
(34,1),
(34,2),
(34,3),
(35,1),
(35,2),
(36,1),
(36,2),
(37,1),
(37,2),
(38,1),
(38,2),
(38,3),
(39,1),
(39,2),
(39,3),
(40,1),
(40,2),
(40,3),
(41,1),
(41,2),
(42,1),
(42,2),
(43,1),
(43,2),
(43,3),
(43,4),
(44,1),
(44,2),
(44,3),
(44,4),
(45,1),
(45,2),
(46,1),
(46,2),
(46,3),
(46,4),
(47,1),
(47,2),
(47,3),
(47,4),
(48,1),
(48,2),
(48,3),
(48,4),
(49,1),
(49,2),
(49,4),
(50,1),
(50,4),
(51,1),
(51,4),
(52,1),
(52,2),
(52,3),
(52,4),
(53,1),
(53,2),
(53,3),
(53,4),
(54,1),
(54,2),
(54,3),
(55,1),
(55,2),
(56,1),
(56,2),
(56,3),
(56,4),
(57,1),
(57,2),
(57,3),
(57,4),
(58,1),
(58,2),
(58,3),
(59,1),
(59,2),
(59,3),
(60,1),
(60,2);
/*!40000 ALTER TABLE `role_has_permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `roles`
--

LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES
(1,'Super Admin','web','2026-04-10 14:58:44','2026-04-10 14:58:44'),
(2,'Admin','web','2026-04-10 14:58:45','2026-04-10 14:58:45'),
(3,'Manager','web','2026-04-10 14:58:45','2026-04-10 14:58:45'),
(4,'Seller','web','2026-04-10 14:58:45','2026-04-10 14:58:45');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sale_histories`
--

DROP TABLE IF EXISTS `sale_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sale_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `action` varchar(255) NOT NULL,
  `changes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`changes`)),
  `old_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`old_values`)),
  `new_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`new_values`)),
  `reason` text DEFAULT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `user_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_histories_sale_id_created_at_index` (`sale_id`,`created_at`),
  KEY `sale_histories_action_index` (`action`),
  KEY `sale_histories_user_id_foreign` (`user_id`),
  CONSTRAINT `sale_histories_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `sale_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sale_histories`
--

LOCK TABLES `sale_histories` WRITE;
/*!40000 ALTER TABLE `sale_histories` DISABLE KEYS */;
INSERT INTO `sale_histories` VALUES
(1,1,'created',NULL,NULL,'{\"sale_number\":\"INV-1001\",\"sale_type\":\"market\",\"customer_name\":\"Teyba Oumar\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"25000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"25000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-10T16:22:52.000000Z\",\"cashier_id\":1,\"is_loan\":true,\"loan_amount\":\"25000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-10T16:22:52.000000Z\",\"created_at\":\"2026-04-10T16:22:52.000000Z\",\"id\":1}','Sale created through POS',1,'admin','2026-04-10 13:22:52','2026-04-10 13:22:52'),
(2,1,'payment_received','{\"payment_status\":{\"old\":\"unpaid\",\"new\":\"partial\"},\"loan_amount\":{\"old\":\"25000.00\",\"new\":\"10000.00\"},\"collected_amount\":{\"old\":\"0.00\",\"new\":\"15000.00\"}}',NULL,'{\"payment_amount\":15000,\"payment_method\":\"cash\",\"payment_notes\":null,\"balance_after\":10000}','Payment received: 15,000 CFA via Cash',1,'admin','2026-04-10 16:29:31','2026-04-10 16:29:31'),
(3,2,'created',NULL,NULL,'{\"sale_number\":\"INV-1002\",\"sale_type\":\"market\",\"customer_name\":\"Aicha Bechir\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"12000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"12000.00\",\"paid_amount\":\"12000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-10T19:31:24.000000Z\",\"cashier_id\":1,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"12000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-10T19:31:24.000000Z\",\"created_at\":\"2026-04-10T19:31:24.000000Z\",\"id\":2}','Sale created through POS',1,'admin','2026-04-10 16:31:24','2026-04-10 16:31:24'),
(4,3,'created',NULL,NULL,'{\"sale_number\":\"INV-1003\",\"sale_type\":\"market\",\"customer_name\":null,\"customer_phone\":null,\"customer_email\":null,\"subtotal\":\"78050.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"50.00\",\"total_amount\":\"78000.00\",\"paid_amount\":\"78000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-12T18:17:23.000000Z\",\"cashier_id\":1,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"78000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-12T18:17:23.000000Z\",\"created_at\":\"2026-04-12T18:17:23.000000Z\",\"id\":3}','Sale created through POS',1,'admin','2026-04-12 15:17:23','2026-04-12 15:17:23'),
(5,4,'created',NULL,NULL,'{\"sale_number\":\"INV-1004\",\"sale_type\":\"market\",\"customer_name\":\"Asma Oumar\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"24000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"24000.00\",\"paid_amount\":\"15000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-12T18:29:21.000000Z\",\"cashier_id\":1,\"is_loan\":true,\"loan_amount\":\"9000.00\",\"collected_amount\":\"15000.00\",\"payment_status\":\"partial\",\"updated_at\":\"2026-04-12T18:29:21.000000Z\",\"created_at\":\"2026-04-12T18:29:21.000000Z\",\"id\":4}','Sale created through POS',1,'admin','2026-04-12 15:29:21','2026-04-12 15:29:21'),
(6,5,'created',NULL,NULL,'{\"sale_number\":\"INV-1005\",\"sale_type\":\"market\",\"customer_name\":\"Fatime\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"12000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"12000.00\",\"paid_amount\":\"12000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-14T17:37:19.000000Z\",\"cashier_id\":2,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"12000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-14T17:37:19.000000Z\",\"created_at\":\"2026-04-14T17:37:19.000000Z\",\"id\":5}','Sale created through POS',2,'Ayoub Oumar','2026-04-14 14:37:19','2026-04-14 14:37:19'),
(7,6,'created',NULL,NULL,'{\"sale_number\":\"INV-1006\",\"sale_type\":\"market\",\"customer_name\":\"Zenouba\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"10000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"10000.00\",\"paid_amount\":\"10000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-14T17:37:42.000000Z\",\"cashier_id\":2,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"10000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-14T17:37:42.000000Z\",\"created_at\":\"2026-04-14T17:37:42.000000Z\",\"id\":6}','Sale created through POS',2,'Ayoub Oumar','2026-04-14 14:37:42','2026-04-14 14:37:42'),
(8,7,'created',NULL,NULL,'{\"sale_number\":\"INV-1007\",\"sale_type\":\"market\",\"customer_name\":null,\"customer_phone\":null,\"customer_email\":null,\"subtotal\":\"25000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"25000.00\",\"paid_amount\":\"25000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-15T16:36:16.000000Z\",\"cashier_id\":2,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"25000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-15T16:36:16.000000Z\",\"created_at\":\"2026-04-15T16:36:16.000000Z\",\"id\":7}','Sale created through POS',2,'Ayoub Oumar','2026-04-15 13:36:16','2026-04-15 13:36:16'),
(9,8,'created',NULL,NULL,'{\"sale_number\":\"INV-1008\",\"sale_type\":\"market\",\"customer_name\":null,\"customer_phone\":null,\"customer_email\":null,\"subtotal\":\"10000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"10000.00\",\"paid_amount\":\"10000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-15T16:36:32.000000Z\",\"cashier_id\":2,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"10000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-15T16:36:32.000000Z\",\"created_at\":\"2026-04-15T16:36:32.000000Z\",\"id\":8}','Sale created through POS',2,'Ayoub Oumar','2026-04-15 13:36:33','2026-04-15 13:36:33'),
(10,9,'created',NULL,NULL,'{\"sale_number\":\"INV-1009\",\"sale_type\":\"market\",\"customer_name\":\"Soumayya\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"30000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"30000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"sale_date\":\"2026-04-15T16:37:18.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"30000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-15T16:37:18.000000Z\",\"created_at\":\"2026-04-15T16:37:18.000000Z\",\"id\":9}','Sale created through POS',2,'Ayoub Oumar','2026-04-15 13:37:19','2026-04-15 13:37:19'),
(11,4,'payment_received','{\"loan_amount\":{\"old\":\"9000.00\",\"new\":\"2000.00\"},\"collected_amount\":{\"old\":\"15000.00\",\"new\":\"22000.00\"}}',NULL,'{\"payment_amount\":7000,\"payment_method\":\"cash\",\"payment_notes\":null,\"balance_after\":2000}','Payment received: 7,000 CFA via Cash',2,'Ayoub Oumar','2026-04-19 05:16:07','2026-04-19 05:16:07'),
(12,9,'updated','{\"customer_name\":{\"old\":\"Soumayya\",\"new\":\"Sim Sim\"},\"customer_phone\":{\"old\":\"---\",\"new\":\"----\"}}',NULL,'{\"id\":9,\"sale_number\":\"INV-1009\",\"sale_type\":\"market\",\"customer_name\":\"Sim Sim\",\"customer_phone\":\"----\",\"customer_email\":null,\"subtotal\":\"30000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"30000.00\",\"loan_amount\":\"30000.00\",\"collected_amount\":\"0.00\",\"is_loan\":true,\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"payment_status\":\"unpaid\",\"sale_status\":\"completed\",\"notes\":null,\"cashier_id\":\"2\",\"client_id\":\"1\",\"sale_date\":\"2026-04-19T11:19:31.000000Z\",\"created_at\":\"2026-04-15T16:37:18.000000Z\",\"updated_at\":\"2026-04-19T08:19:31.000000Z\",\"items\":[{\"id\":9,\"sale_id\":\"9\",\"product_id\":\"1\",\"product_name\":\"Bags-2\",\"product_barcode\":null,\"quantity\":2,\"unit_price\":\"15000.00\",\"tax_rate\":\"0.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"30000.00\",\"created_at\":\"2026-04-15T16:37:19.000000Z\",\"updated_at\":\"2026-04-15T16:37:19.000000Z\"}],\"cashier\":{\"id\":2,\"name\":\"Ayoub Oumar\",\"email\":\"ayoub.oumar919@gmail.com\",\"user_type\":\"admin\",\"is_active\":true,\"preferred_language\":\"en\",\"email_verified_at\":\"2026-04-14T10:26:40.000000Z\",\"two_factor_confirmed_at\":null,\"current_team_id\":null,\"profile_photo_path\":null,\"created_at\":\"2026-04-14T10:26:40.000000Z\",\"updated_at\":\"2026-04-14T10:26:40.000000Z\",\"profile_photo_url\":\"https:\\/\\/ui-avatars.com\\/api\\/?name=A+O&color=7F9CF5&background=EBF4FF\"}}','Sale updated from POS interface',2,'Ayoub Oumar','2026-04-19 05:19:31','2026-04-19 05:19:31'),
(13,4,'payment_received','{\"payment_status\":{\"old\":\"partial\",\"new\":\"paid\"},\"loan_amount\":{\"old\":\"2000.00\",\"new\":\"0.00\"},\"collected_amount\":{\"old\":\"22000.00\",\"new\":\"24000.00\"},\"is_loan\":{\"old\":true,\"new\":false}}',NULL,'{\"payment_amount\":2000,\"payment_method\":\"cash\",\"payment_notes\":null,\"balance_after\":0}','Payment received: 2,000 CFA via Cash',2,'Ayoub Oumar','2026-04-20 17:44:11','2026-04-20 17:44:11'),
(14,10,'created',NULL,NULL,'{\"sale_number\":\"INV-1010\",\"sale_type\":\"market\",\"customer_name\":\"Naddoya\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"20000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"20000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":1,\"sale_date\":\"2026-04-20T20:49:55.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"20000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:49:55.000000Z\",\"created_at\":\"2026-04-20T20:49:55.000000Z\",\"id\":10}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:49:55','2026-04-20 17:49:55'),
(15,11,'created',NULL,NULL,'{\"sale_number\":\"INV-1011\",\"sale_type\":\"market\",\"customer_name\":\"Clien de Nadia\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"50000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"50000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":1,\"sale_date\":\"2026-04-20T20:50:31.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"50000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:50:31.000000Z\",\"created_at\":\"2026-04-20T20:50:31.000000Z\",\"id\":11}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:50:31','2026-04-20 17:50:31'),
(16,11,'cancelled','{\"sale_status\":{\"old\":\"completed\",\"new\":\"cancelled\"},\"payment_status\":{\"old\":\"unpaid\",\"new\":\"refunded\"}}',NULL,'{\"id\":11,\"sale_number\":\"INV-1011\",\"sale_type\":\"market\",\"customer_name\":\"Clien de Nadia\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"50000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"50000.00\",\"loan_amount\":\"50000.00\",\"collected_amount\":\"0.00\",\"is_loan\":true,\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"payment_status\":\"refunded\",\"sale_status\":\"cancelled\",\"notes\":\"\\n\\nCancelled: Error\",\"cashier_id\":\"2\",\"client_id\":\"1\",\"sale_date\":\"2026-04-20T20:50:31.000000Z\",\"created_at\":\"2026-04-20T20:50:31.000000Z\",\"updated_at\":\"2026-04-20T20:51:49.000000Z\",\"items\":[{\"id\":11,\"sale_id\":\"11\",\"product_id\":\"3\",\"product_name\":\"Bags 3\",\"product_barcode\":null,\"quantity\":5,\"unit_price\":\"10000.00\",\"tax_rate\":\"0.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"50000.00\",\"created_at\":\"2026-04-20T20:50:31.000000Z\",\"updated_at\":\"2026-04-20T20:50:31.000000Z\",\"product\":{\"id\":3,\"name\":\"Bags 3\",\"description\":null,\"barcode\":\"PRD139272\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"alert_quantity\":1,\"cost_price\":\"7500.00\",\"selling_price\":\"10000.00\",\"discount_price\":null,\"image\":null,\"expiry_date\":null,\"is_active\":true,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T20:45:55.000000Z\",\"deleted_at\":null,\"inventory\":{\"id\":3,\"product_id\":\"3\",\"current_stock\":13,\"reserved_stock\":0,\"available_stock\":13,\"last_stock_update\":\"2026-04-20T20:51:49.000000Z\",\"last_updated_by\":2,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T20:51:49.000000Z\"}}}],\"cashier\":{\"id\":2,\"name\":\"Ayoub Oumar\",\"email\":\"ayoub.oumar919@gmail.com\",\"user_type\":\"admin\",\"is_active\":true,\"preferred_language\":\"en\",\"email_verified_at\":\"2026-04-14T10:26:40.000000Z\",\"two_factor_confirmed_at\":null,\"current_team_id\":null,\"profile_photo_path\":null,\"created_at\":\"2026-04-14T10:26:40.000000Z\",\"updated_at\":\"2026-04-14T10:26:40.000000Z\",\"profile_photo_url\":\"https:\\/\\/ui-avatars.com\\/api\\/?name=A+O&color=7F9CF5&background=EBF4FF\"}}','Error',2,'Ayoub Oumar','2026-04-20 17:51:49','2026-04-20 17:51:49'),
(17,10,'cancelled','{\"sale_status\":{\"old\":\"completed\",\"new\":\"cancelled\"},\"payment_status\":{\"old\":\"unpaid\",\"new\":\"refunded\"}}',NULL,'{\"id\":10,\"sale_number\":\"INV-1010\",\"sale_type\":\"market\",\"customer_name\":\"Naddoya\",\"customer_phone\":\"---\",\"customer_email\":null,\"subtotal\":\"20000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"20000.00\",\"loan_amount\":\"20000.00\",\"collected_amount\":\"0.00\",\"is_loan\":true,\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"payment_status\":\"refunded\",\"sale_status\":\"cancelled\",\"notes\":\"\\n\\nCancelled: Error\",\"cashier_id\":\"2\",\"client_id\":\"1\",\"sale_date\":\"2026-04-20T20:49:55.000000Z\",\"created_at\":\"2026-04-20T20:49:55.000000Z\",\"updated_at\":\"2026-04-20T20:52:33.000000Z\",\"items\":[{\"id\":10,\"sale_id\":\"10\",\"product_id\":\"3\",\"product_name\":\"Bags 3\",\"product_barcode\":null,\"quantity\":2,\"unit_price\":\"10000.00\",\"tax_rate\":\"0.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"20000.00\",\"created_at\":\"2026-04-20T20:49:55.000000Z\",\"updated_at\":\"2026-04-20T20:49:55.000000Z\",\"product\":{\"id\":3,\"name\":\"Bags 3\",\"description\":null,\"barcode\":\"PRD139272\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"alert_quantity\":1,\"cost_price\":\"7500.00\",\"selling_price\":\"10000.00\",\"discount_price\":null,\"image\":null,\"expiry_date\":null,\"is_active\":true,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T20:45:55.000000Z\",\"deleted_at\":null,\"inventory\":{\"id\":3,\"product_id\":\"3\",\"current_stock\":15,\"reserved_stock\":0,\"available_stock\":15,\"last_stock_update\":\"2026-04-20T20:52:33.000000Z\",\"last_updated_by\":2,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T20:52:33.000000Z\"}}}],\"cashier\":{\"id\":2,\"name\":\"Ayoub Oumar\",\"email\":\"ayoub.oumar919@gmail.com\",\"user_type\":\"admin\",\"is_active\":true,\"preferred_language\":\"en\",\"email_verified_at\":\"2026-04-14T10:26:40.000000Z\",\"two_factor_confirmed_at\":null,\"current_team_id\":null,\"profile_photo_path\":null,\"created_at\":\"2026-04-14T10:26:40.000000Z\",\"updated_at\":\"2026-04-14T10:26:40.000000Z\",\"profile_photo_url\":\"https:\\/\\/ui-avatars.com\\/api\\/?name=A+O&color=7F9CF5&background=EBF4FF\"}}','Error',2,'Ayoub Oumar','2026-04-20 17:52:33','2026-04-20 17:52:33'),
(18,12,'created',NULL,NULL,'{\"sale_number\":\"INV-1012\",\"sale_type\":\"market\",\"customer_name\":\"Nadia\",\"customer_phone\":\"60 58 05 26\",\"customer_email\":null,\"subtotal\":\"20000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"20000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":2,\"sale_date\":\"2026-04-20T20:55:03.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"20000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:55:03.000000Z\",\"created_at\":\"2026-04-20T20:55:03.000000Z\",\"id\":12}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:55:03','2026-04-20 17:55:03'),
(19,13,'created',NULL,NULL,'{\"sale_number\":\"INV-1013\",\"sale_type\":\"market\",\"customer_name\":\"Nadia\'s Clients\",\"customer_phone\":\"99 58 05 26\",\"customer_email\":null,\"subtotal\":\"50000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"50000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":3,\"sale_date\":\"2026-04-20T20:56:12.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"50000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:56:12.000000Z\",\"created_at\":\"2026-04-20T20:56:12.000000Z\",\"id\":13}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:56:12','2026-04-20 17:56:12'),
(20,14,'created',NULL,NULL,'{\"sale_number\":\"INV-1014\",\"sale_type\":\"market\",\"customer_name\":\"Khadidja Oumar\",\"customer_phone\":\"61\",\"customer_email\":null,\"subtotal\":\"15000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":4,\"sale_date\":\"2026-04-20T20:56:56.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"15000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:56:56.000000Z\",\"created_at\":\"2026-04-20T20:56:56.000000Z\",\"id\":14}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:56:56','2026-04-20 17:56:56'),
(21,15,'created',NULL,NULL,'{\"sale_number\":\"INV-1015\",\"sale_type\":\"market\",\"customer_name\":\"Fatime\",\"customer_phone\":\"62\",\"customer_email\":null,\"subtotal\":\"15000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"paid_amount\":\"15000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":5,\"sale_date\":\"2026-04-20T20:58:45.000000Z\",\"cashier_id\":2,\"is_loan\":false,\"loan_amount\":\"0.00\",\"collected_amount\":\"15000.00\",\"payment_status\":\"paid\",\"updated_at\":\"2026-04-20T20:58:45.000000Z\",\"created_at\":\"2026-04-20T20:58:45.000000Z\",\"id\":15}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:58:45','2026-04-20 17:58:45'),
(22,16,'created',NULL,NULL,'{\"sale_number\":\"INV-1016\",\"sale_type\":\"market\",\"customer_name\":\"Asia\",\"customer_phone\":\"63\",\"customer_email\":null,\"subtotal\":\"15000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":6,\"sale_date\":\"2026-04-20T20:59:07.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"15000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T20:59:07.000000Z\",\"created_at\":\"2026-04-20T20:59:07.000000Z\",\"id\":16}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 17:59:07','2026-04-20 17:59:07'),
(23,15,'cancelled','{\"sale_status\":{\"old\":\"completed\",\"new\":\"cancelled\"},\"payment_status\":{\"old\":\"paid\",\"new\":\"refunded\"}}',NULL,'{\"id\":15,\"sale_number\":\"INV-1015\",\"sale_type\":\"market\",\"customer_name\":\"Fatime\",\"customer_phone\":\"62\",\"customer_email\":null,\"subtotal\":\"15000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"loan_amount\":\"0.00\",\"collected_amount\":\"15000.00\",\"is_loan\":false,\"paid_amount\":\"15000.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"payment_status\":\"refunded\",\"sale_status\":\"cancelled\",\"notes\":\"\\n\\nCancelled: Error\",\"cashier_id\":\"2\",\"client_id\":\"5\",\"sale_date\":\"2026-04-20T20:58:45.000000Z\",\"created_at\":\"2026-04-20T20:58:45.000000Z\",\"updated_at\":\"2026-04-20T21:00:56.000000Z\",\"items\":[{\"id\":15,\"sale_id\":\"15\",\"product_id\":\"3\",\"product_name\":\"Bags 3\",\"product_barcode\":null,\"quantity\":1,\"unit_price\":\"15000.00\",\"tax_rate\":\"0.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"created_at\":\"2026-04-20T20:58:45.000000Z\",\"updated_at\":\"2026-04-20T20:58:45.000000Z\",\"product\":{\"id\":3,\"name\":\"Bags 3\",\"description\":null,\"barcode\":\"PRD139272\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"alert_quantity\":1,\"cost_price\":\"7500.00\",\"selling_price\":\"10000.00\",\"discount_price\":null,\"image\":null,\"expiry_date\":null,\"is_active\":true,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T20:45:55.000000Z\",\"deleted_at\":null,\"inventory\":{\"id\":3,\"product_id\":\"3\",\"current_stock\":6,\"reserved_stock\":0,\"available_stock\":6,\"last_stock_update\":\"2026-04-20T21:00:56.000000Z\",\"last_updated_by\":2,\"created_at\":\"2026-04-20T20:45:55.000000Z\",\"updated_at\":\"2026-04-20T21:00:56.000000Z\"}}}],\"cashier\":{\"id\":2,\"name\":\"Ayoub Oumar\",\"email\":\"ayoub.oumar919@gmail.com\",\"user_type\":\"admin\",\"is_active\":true,\"preferred_language\":\"en\",\"email_verified_at\":\"2026-04-14T10:26:40.000000Z\",\"two_factor_confirmed_at\":null,\"current_team_id\":null,\"profile_photo_path\":null,\"created_at\":\"2026-04-14T10:26:40.000000Z\",\"updated_at\":\"2026-04-14T10:26:40.000000Z\",\"profile_photo_url\":\"https:\\/\\/ui-avatars.com\\/api\\/?name=A+O&color=7F9CF5&background=EBF4FF\"}}','Error',2,'Ayoub Oumar','2026-04-20 18:00:56','2026-04-20 18:00:56'),
(24,17,'created',NULL,NULL,'{\"sale_number\":\"INV-1017\",\"sale_type\":\"market\",\"customer_name\":\"Fatime\",\"customer_phone\":\"62\",\"customer_email\":null,\"subtotal\":\"15000.00\",\"tax_amount\":\"0.00\",\"discount_amount\":\"0.00\",\"total_amount\":\"15000.00\",\"paid_amount\":\"0.00\",\"change_amount\":\"0.00\",\"payment_method\":\"cash\",\"sale_status\":\"completed\",\"notes\":null,\"client_id\":5,\"sale_date\":\"2026-04-20T21:01:31.000000Z\",\"cashier_id\":2,\"is_loan\":true,\"loan_amount\":\"15000.00\",\"collected_amount\":\"0.00\",\"payment_status\":\"unpaid\",\"updated_at\":\"2026-04-20T21:01:31.000000Z\",\"created_at\":\"2026-04-20T21:01:31.000000Z\",\"id\":17}','Sale created through POS',2,'Ayoub Oumar','2026-04-20 18:01:31','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `sale_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sale_items`
--

DROP TABLE IF EXISTS `sale_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sale_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_barcode` varchar(255) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_items_sale_id_index` (`sale_id`),
  KEY `sale_items_product_id_index` (`product_id`),
  CONSTRAINT `sale_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `sale_items_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sale_items`
--

LOCK TABLES `sale_items` WRITE;
/*!40000 ALTER TABLE `sale_items` DISABLE KEYS */;
INSERT INTO `sale_items` VALUES
(1,1,2,'Astronot',NULL,1,25000.00,0.00,0.00,0.00,25000.00,'2026-04-10 13:22:52','2026-04-10 13:22:52'),
(2,2,1,'Bags',NULL,1,12000.00,0.00,0.00,0.00,12000.00,'2026-04-10 16:31:24','2026-04-10 16:31:24'),
(3,3,1,'Bags',NULL,7,11150.00,0.00,0.00,50.00,78000.00,'2026-04-12 15:17:23','2026-04-12 15:17:23'),
(4,4,1,'Bags',NULL,2,12000.00,0.00,0.00,0.00,24000.00,'2026-04-12 15:29:21','2026-04-12 15:29:21'),
(5,5,1,'Bags',NULL,1,12000.00,0.00,0.00,0.00,12000.00,'2026-04-14 14:37:19','2026-04-14 14:37:19'),
(6,6,1,'Bags',NULL,1,10000.00,0.00,0.00,0.00,10000.00,'2026-04-14 14:37:42','2026-04-14 14:37:42'),
(7,7,1,'Bags-2',NULL,2,12500.00,0.00,0.00,0.00,25000.00,'2026-04-15 13:36:16','2026-04-15 13:36:16'),
(8,8,1,'Bags-2',NULL,1,10000.00,0.00,0.00,0.00,10000.00,'2026-04-15 13:36:33','2026-04-15 13:36:33'),
(9,9,1,'Bags-2',NULL,2,15000.00,0.00,0.00,0.00,30000.00,'2026-04-15 13:37:19','2026-04-15 13:37:19'),
(10,10,3,'Bags 3',NULL,2,10000.00,0.00,0.00,0.00,20000.00,'2026-04-20 17:49:55','2026-04-20 17:49:55'),
(11,11,3,'Bags 3',NULL,5,10000.00,0.00,0.00,0.00,50000.00,'2026-04-20 17:50:31','2026-04-20 17:50:31'),
(12,12,3,'Bags 3',NULL,2,10000.00,0.00,0.00,0.00,20000.00,'2026-04-20 17:55:03','2026-04-20 17:55:03'),
(13,13,3,'Bags 3',NULL,5,10000.00,0.00,0.00,0.00,50000.00,'2026-04-20 17:56:12','2026-04-20 17:56:12'),
(14,14,3,'Bags 3',NULL,1,15000.00,0.00,0.00,0.00,15000.00,'2026-04-20 17:56:56','2026-04-20 17:56:56'),
(15,15,3,'Bags 3',NULL,1,15000.00,0.00,0.00,0.00,15000.00,'2026-04-20 17:58:45','2026-04-20 17:58:45'),
(16,16,3,'Bags 3',NULL,1,15000.00,0.00,0.00,0.00,15000.00,'2026-04-20 17:59:07','2026-04-20 17:59:07'),
(17,17,3,'Bags 3',NULL,1,15000.00,0.00,0.00,0.00,15000.00,'2026-04-20 18:01:31','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `sale_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sales`
--

DROP TABLE IF EXISTS `sales`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_number` varchar(255) NOT NULL,
  `sale_type` enum('market','store') NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(20) DEFAULT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `loan_amount` decimal(15,2) DEFAULT NULL,
  `collected_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `is_loan` tinyint(1) NOT NULL DEFAULT 0,
  `paid_amount` decimal(10,2) NOT NULL,
  `change_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('cash','card','mobile_payment') NOT NULL,
  `payment_status` enum('paid','partial','unpaid','refunded') NOT NULL DEFAULT 'paid',
  `sale_status` enum('completed','pending','cancelled','refunded') NOT NULL DEFAULT 'completed',
  `notes` text DEFAULT NULL,
  `cashier_id` bigint(20) unsigned NOT NULL,
  `client_id` bigint(20) unsigned DEFAULT NULL,
  `sale_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sales_sale_number_unique` (`sale_number`),
  KEY `sales_sale_type_sale_status_index` (`sale_type`,`sale_status`),
  KEY `sales_sale_date_index` (`sale_date`),
  KEY `sales_payment_status_index` (`payment_status`),
  KEY `sales_cashier_id_index` (`cashier_id`),
  KEY `sales_client_id_foreign` (`client_id`),
  CONSTRAINT `sales_cashier_id_foreign` FOREIGN KEY (`cashier_id`) REFERENCES `users` (`id`),
  CONSTRAINT `sales_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sales`
--

LOCK TABLES `sales` WRITE;
/*!40000 ALTER TABLE `sales` DISABLE KEYS */;
INSERT INTO `sales` VALUES
(1,'INV-1001','market','Bon','---',NULL,25000.00,0.00,0.00,25000.00,10000.00,15000.00,1,0.00,0.00,'cash','partial','completed',NULL,1,1,'2026-04-20 20:53:52','2026-04-10 13:22:52','2026-04-20 17:53:52'),
(2,'INV-1002','market','Bon','---',NULL,12000.00,0.00,0.00,12000.00,0.00,12000.00,0,12000.00,0.00,'cash','paid','completed',NULL,1,1,'2026-04-20 20:53:52','2026-04-10 16:31:24','2026-04-20 17:53:52'),
(3,'INV-1003','market',NULL,NULL,NULL,78050.00,0.00,50.00,78000.00,0.00,78000.00,0,78000.00,0.00,'cash','paid','completed',NULL,1,NULL,'2026-04-12 15:17:23','2026-04-12 15:17:23','2026-04-12 15:17:23'),
(4,'INV-1004','market','Bon','---',NULL,24000.00,0.00,0.00,24000.00,0.00,24000.00,0,15000.00,0.00,'cash','paid','completed',NULL,1,1,'2026-04-20 20:53:52','2026-04-12 15:29:21','2026-04-20 17:53:52'),
(5,'INV-1005','market','Bon','---',NULL,12000.00,0.00,0.00,12000.00,0.00,12000.00,0,12000.00,0.00,'cash','paid','completed',NULL,2,1,'2026-04-20 20:53:52','2026-04-14 14:37:19','2026-04-20 17:53:52'),
(6,'INV-1006','market','Bon','---',NULL,10000.00,0.00,0.00,10000.00,0.00,10000.00,0,10000.00,0.00,'cash','paid','completed',NULL,2,1,'2026-04-20 20:53:52','2026-04-14 14:37:42','2026-04-20 17:53:52'),
(7,'INV-1007','market',NULL,NULL,NULL,25000.00,0.00,0.00,25000.00,0.00,25000.00,0,25000.00,0.00,'cash','paid','completed',NULL,2,NULL,'2026-04-15 13:36:16','2026-04-15 13:36:16','2026-04-15 13:36:16'),
(8,'INV-1008','market',NULL,NULL,NULL,10000.00,0.00,0.00,10000.00,0.00,10000.00,0,10000.00,0.00,'cash','paid','completed',NULL,2,NULL,'2026-04-15 13:36:32','2026-04-15 13:36:32','2026-04-15 13:36:32'),
(9,'INV-1009','market','Bon','----',NULL,30000.00,0.00,0.00,30000.00,30000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,1,'2026-04-20 20:53:52','2026-04-15 13:37:18','2026-04-20 17:53:52'),
(10,'INV-1010','market','Bon','---',NULL,20000.00,0.00,0.00,20000.00,20000.00,0.00,1,0.00,0.00,'cash','refunded','cancelled','\n\nCancelled: Error',2,1,'2026-04-20 20:53:52','2026-04-20 17:49:55','2026-04-20 17:53:52'),
(11,'INV-1011','market','Bon','---',NULL,50000.00,0.00,0.00,50000.00,50000.00,0.00,1,0.00,0.00,'cash','refunded','cancelled','\n\nCancelled: Error',2,1,'2026-04-20 20:53:52','2026-04-20 17:50:31','2026-04-20 17:53:52'),
(12,'INV-1012','market','Nadia','60 58 05 26',NULL,20000.00,0.00,0.00,20000.00,20000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,2,'2026-04-20 17:55:03','2026-04-20 17:55:03','2026-04-20 17:55:03'),
(13,'INV-1013','market','Nadia\'s Clients','99 58 05 26',NULL,50000.00,0.00,0.00,50000.00,50000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,3,'2026-04-20 17:56:12','2026-04-20 17:56:12','2026-04-20 17:56:12'),
(14,'INV-1014','market','Khadidja Oumar','61',NULL,15000.00,0.00,0.00,15000.00,15000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,4,'2026-04-20 17:56:56','2026-04-20 17:56:56','2026-04-20 17:56:56'),
(15,'INV-1015','market','Fatime','62',NULL,15000.00,0.00,0.00,15000.00,0.00,15000.00,0,15000.00,0.00,'cash','refunded','cancelled','\n\nCancelled: Error',2,5,'2026-04-20 21:00:56','2026-04-20 17:58:45','2026-04-20 18:00:56'),
(16,'INV-1016','market','Asia','63',NULL,15000.00,0.00,0.00,15000.00,15000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,6,'2026-04-20 17:59:07','2026-04-20 17:59:07','2026-04-20 17:59:07'),
(17,'INV-1017','market','Fatime','62',NULL,15000.00,0.00,0.00,15000.00,15000.00,0.00,1,0.00,0.00,'cash','unpaid','completed',NULL,2,5,'2026-04-20 18:01:31','2026-04-20 18:01:31','2026-04-20 18:01:31');
/*!40000 ALTER TABLE `sales` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sessions`
--

DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sessions`
--

LOCK TABLES `sessions` WRITE;
/*!40000 ALTER TABLE `sessions` DISABLE KEYS */;
/*!40000 ALTER TABLE `sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `user_type` varchar(255) NOT NULL DEFAULT 'seller',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `preferred_language` varchar(5) NOT NULL DEFAULT 'en',
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `two_factor_secret` text DEFAULT NULL,
  `two_factor_recovery_codes` text DEFAULT NULL,
  `two_factor_confirmed_at` timestamp NULL DEFAULT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `current_team_id` bigint(20) unsigned DEFAULT NULL,
  `profile_photo_path` varchar(2048) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES
(1,'admin','admin@app.com','admin',0,'en','2026-04-10 14:58:45','$2y$12$eY7U5SfEjRw3bhQsyDdGTuc8Ysoz0fTtYCXyAKaIBLu8Rkgrvn4fK',NULL,NULL,NULL,NULL,NULL,NULL,'2026-04-10 14:58:45','2026-04-14 07:27:31'),
(2,'Ayoub Oumar','ayoub.oumar919@gmail.com','admin',1,'en','2026-04-14 07:26:40','$2y$12$1BDRNMk8Pye0Hk9T99jB1Obc8KMYMvkg2maib1/KPwHkn5Aj8LX7e',NULL,NULL,NULL,'fl07nsVxIeaedYtOVyeKYGH7vEKNtQUxKansflxHm7S2h5eCj2VjXyFnLFyY',NULL,NULL,'2026-04-14 07:26:40','2026-04-14 07:26:40');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `withdrawals`
--

DROP TABLE IF EXISTS `withdrawals`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `withdrawals` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `reason` text DEFAULT NULL,
  `status` enum('completed','cancelled') NOT NULL DEFAULT 'completed',
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `withdrawal_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `withdrawals_user_id_withdrawal_date_index` (`user_id`,`withdrawal_date`),
  KEY `withdrawals_status_withdrawal_date_index` (`status`,`withdrawal_date`),
  CONSTRAINT `withdrawals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `withdrawals`
--

LOCK TABLES `withdrawals` WRITE;
/*!40000 ALTER TABLE `withdrawals` DISABLE KEYS */;
/*!40000 ALTER TABLE `withdrawals` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-04-23 11:53:09
