Initial project import for team collaboration.

Exclude local docs, MCP, and secrets via gitignore.

Made-with: Cursor
This commit is contained in:
taekyoungc
2026-03-25 12:05:33 +09:00
commit 4e557d4be1
153 changed files with 16198 additions and 0 deletions

6
app/.htaccess Normal file
View File

@@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

15
app/Common.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/

202
app/Config/App.php Normal file
View File

@@ -0,0 +1,202 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL = 'http://localhost:8080/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = ['jongryangje.local', 'localhost'];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
public string $indexPage = 'index.php';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which server global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors:
*
* 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO': Uses $_SERVER['PATH_INFO']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public string $uriProtocol = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.
|
| By default, only these are allowed: `a-z 0-9~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = false;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string>
*/
public array $supportedLocales = ['en'];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/
public string $appTimezone = 'UTC';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* This determines which character set is used by default in various methods
* that require a character set to be provided.
*
* @see http://php.net/htmlspecialchars for a list of supported charsets.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security (HSTS) header will be set.
*/
public bool $forceGlobalSecureRequests = false;
/**
* --------------------------------------------------------------------------
* Reverse Proxy IPs
* --------------------------------------------------------------------------
*
* If your server is behind a reverse proxy, you must whitelist the proxy
* IP addresses from which CodeIgniter should trust headers such as
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false;
}

92
app/Config/Autoload.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH,
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [];
}

View File

@@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

View File

@@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@@ -0,0 +1,36 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Connection Options
* --------------------------------------------------------------------------
*
* Share connection options between requests.
*
* @var list<int>
*
* @see https://www.php.net/manual/en/curl.constants.php#constant.curl-lock-data-connect
*/
public array $shareConnectionOptions = [
CURL_LOCK_DATA_CONNECT,
CURL_LOCK_DATA_DNS,
];
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

198
app/Config/Cache.php Normal file
View File

@@ -0,0 +1,198 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\ApcuHandler;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
*
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array{storePath?: string, mode?: int}
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
*
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array{host?: string, port?: int, weight?: int, raw?: bool}
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
*
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array{
* host?: string,
* password?: string|null,
* port?: int,
* timeout?: int,
* async?: bool,
* persistent?: bool,
* database?: int
* }
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'async' => false, // specific to Predis and ignored by the native Redis extension
'persistent' => false,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'apcu' => ApcuHandler::class,
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Status Codes
* --------------------------------------------------------------------------
*
* HTTP status codes that are allowed to be cached. Only responses with
* these status codes will be cached by the PageCache filter.
*
* Default: [] - Cache all status codes (backward compatible)
*
* Recommended: [200] - Only cache successful responses
*
* You can also use status codes like:
* [200, 404, 410] - Cache successful responses and specific error codes
* [200, 201, 202, 203, 204] - All 2xx successful responses
*
* WARNING: Using [] may cache temporary error pages (404, 500, etc).
* Consider restricting to [200] for production applications to avoid
* caching errors that should be temporary.
*
* @var list<int>
*/
public array $cacheStatusCodes = [];
}

79
app/Config/Constants.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| Exit Status Codes
| --------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code

View File

@@ -0,0 +1,216 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Specifies a reporting endpoint to which violation reports ought to be sent.
*/
public ?string $reportTo = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// CSP DIRECTIVES SETTINGS
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to `'self'` if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = 'self';
/**
* Specifies valid sources for JavaScript <script> elements.
*
* @var list<string>|string
*/
public array|string $scriptSrcElem = 'self';
/**
* Specifies valid sources for JavaScript inline event
* handlers and JavaScript URLs.
*
* @var list<string>|string
*/
public array|string $scriptSrcAttr = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = 'self';
/**
* Specifies valid sources for stylesheets <link> elements.
*
* @var list<string>|string
*/
public array|string $styleSrcElem = 'self';
/**
* Specifies valid sources for stylesheets inline
* style attributes and `<style>` elements.
*
* @var list<string>|string
*/
public array|string $styleSrcAttr = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'self';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* @var list<string>|string
*/
public array|string $workerSrc = [];
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce placeholder for style tags.
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce placeholder for script tags.
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically?
*/
public bool $autoNonce = true;
}

107
app/Config/Cookie.php Normal file
View File

@@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @var ''|'Lax'|'None'|'Strict'
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

105
app/Config/Cors.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}

204
app/Config/Database.php Normal file
View File

@@ -0,0 +1,204 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
'foundRows' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
// /**
// * Sample database connection for SQLite3.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'database' => 'database.db',
// 'DBDriver' => 'SQLite3',
// 'DBPrefix' => '',
// 'DBDebug' => true,
// 'swapPre' => '',
// 'failover' => [],
// 'foreignKeys' => true,
// 'busyTimeout' => 1000,
// 'synchronous' => null,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for Postgre.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'public',
// 'DBDriver' => 'Postgre',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'failover' => [],
// 'port' => 5432,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for SQLSRV.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'dbo',
// 'DBDriver' => 'SQLSRV',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'encrypt' => false,
// 'failover' => [],
// 'port' => 1433,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for OCI8.
// *
// * You may need the following environment variables:
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => 'localhost:1521/XEPDB1',
// 'username' => 'root',
// 'password' => 'root',
// 'DBDriver' => 'OCI8',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'AL32UTF8',
// 'swapPre' => '',
// 'failover' => [],
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
/**
* This database connection is used when running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => '',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'synchronous' => null,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}

43
app/Config/DocTypes.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
namespace Config;
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

126
app/Config/Email.php Normal file
View File

@@ -0,0 +1,126 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* Which SMTP authentication method to use: login, plain
*/
public string $SMTPAuthMethod = 'login';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

117
app/Config/Encryption.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
* .env: encryption.key = (64 hex chars, e.g. php -r "echo bin2hex(random_bytes(32));")
*/
public string $key = '';
public function __construct()
{
parent::__construct();
$hex = (string) env('encryption.key', '');
$this->key = (strlen($hex) === 64 && ctype_xdigit($hex)) ? hex2bin($hex) : '';
}
/**
* --------------------------------------------------------------------------
* Previous Encryption Keys
* --------------------------------------------------------------------------
*
* When rotating encryption keys, add old keys here to maintain ability
* to decrypt data encrypted with previous keys. Encryption always uses
* the current $key. Decryption tries current key first, then falls back
* to previous keys if decryption fails.
*
* In .env file, use comma-separated string:
* encryption.previousKeys = hex2bin:9be8c64fcea509867...,hex2bin:3f5a1d8e9c2b7a4f6...
*
* @var list<string>|string
*/
public array|string $previousKeys = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

55
app/Config/Events.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function (): void {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
service('toolbar')->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
service('routes')->get('__hot-reload', static function (): void {
(new HotReloader())->run();
});
}
}
});

106
app/Config/Exceptions.php Normal file
View File

@@ -0,0 +1,106 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS
* --------------------------------------------------------------------------
* If set to `true`, DEPRECATED errors are only logged and no exceptions are
* thrown. This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

37
app/Config/Feature.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the legacy version.
*/
public bool $autoRoutesImproved = true;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
/**
* Use strict location negotiation.
*
* By default, the locale is selected based on a loose comparison of the language code (ISO 639-1)
* Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2).
*/
public bool $strictLocaleNegotiation = false;
}

111
app/Config/Filters.php Normal file
View File

@@ -0,0 +1,111 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'adminAuth' => \App\Filters\AdminAuthFilter::class,
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array{
* before: array<string, array{except: list<string>|string}>|list<string>,
* after: array<string, array{except: list<string>|string}>|list<string>
* }
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

73
app/Config/Format.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* --------------------------------------------------------------------------
* Maximum depth for JSON encoding.
* --------------------------------------------------------------------------
*
* This value determines how deep the JSON encoder will traverse nested structures.
*/
public int $jsonEncodeDepth = 512;
}

44
app/Config/Generators.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config/Honeypot.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

40
app/Config/Hostnames.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
namespace Config;
class Hostnames
{
// List of known two-part TLDs for subdomain extraction
public const TWO_PART_TLDS = [
'co.uk', 'org.uk', 'gov.uk', 'ac.uk', 'sch.uk', 'ltd.uk', 'plc.uk',
'com.au', 'net.au', 'org.au', 'edu.au', 'gov.au', 'asn.au', 'id.au',
'co.jp', 'ac.jp', 'go.jp', 'or.jp', 'ne.jp', 'gr.jp',
'co.nz', 'org.nz', 'govt.nz', 'ac.nz', 'net.nz', 'geek.nz', 'maori.nz', 'school.nz',
'co.in', 'net.in', 'org.in', 'ind.in', 'ac.in', 'gov.in', 'res.in',
'com.cn', 'net.cn', 'org.cn', 'gov.cn', 'edu.cn',
'com.sg', 'net.sg', 'org.sg', 'gov.sg', 'edu.sg', 'per.sg',
'co.za', 'org.za', 'gov.za', 'ac.za', 'net.za',
'co.kr', 'or.kr', 'go.kr', 'ac.kr', 'ne.kr', 'pe.kr',
'co.th', 'or.th', 'go.th', 'ac.th', 'net.th', 'in.th',
'com.my', 'net.my', 'org.my', 'edu.my', 'gov.my', 'mil.my', 'name.my',
'com.mx', 'org.mx', 'net.mx', 'edu.mx', 'gob.mx',
'com.br', 'net.br', 'org.br', 'gov.br', 'edu.br', 'art.br', 'eng.br',
'co.il', 'org.il', 'ac.il', 'gov.il', 'net.il', 'muni.il',
'co.id', 'or.id', 'ac.id', 'go.id', 'net.id', 'web.id', 'my.id',
'com.hk', 'edu.hk', 'gov.hk', 'idv.hk', 'net.hk', 'org.hk',
'com.tw', 'net.tw', 'org.tw', 'edu.tw', 'gov.tw', 'idv.tw',
'com.sa', 'net.sa', 'org.sa', 'gov.sa', 'edu.sa', 'sch.sa', 'med.sa',
'co.ae', 'net.ae', 'org.ae', 'gov.ae', 'ac.ae', 'sch.ae',
'com.tr', 'net.tr', 'org.tr', 'gov.tr', 'edu.tr', 'av.tr', 'gen.tr',
'co.ke', 'or.ke', 'go.ke', 'ac.ke', 'sc.ke', 'me.ke', 'mobi.ke', 'info.ke',
'com.ng', 'org.ng', 'gov.ng', 'edu.ng', 'net.ng', 'sch.ng', 'name.ng',
'com.pk', 'net.pk', 'org.pk', 'gov.pk', 'edu.pk', 'fam.pk',
'com.eg', 'edu.eg', 'gov.eg', 'org.eg', 'net.eg',
'com.cy', 'net.cy', 'org.cy', 'gov.cy', 'ac.cy',
'com.lk', 'org.lk', 'edu.lk', 'gov.lk', 'net.lk', 'int.lk',
'com.bd', 'net.bd', 'org.bd', 'ac.bd', 'gov.bd', 'mil.bd',
'com.ar', 'net.ar', 'org.ar', 'gov.ar', 'edu.ar', 'mil.ar',
'gob.cl', 'com.pl', 'net.pl', 'org.pl', 'gov.pl', 'edu.pl',
'co.ir', 'ac.ir', 'org.ir', 'id.ir', 'gov.ir', 'sch.ir', 'net.ir',
];
}

33
app/Config/Images.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*
* @deprecated 4.7.0 No longer used.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

63
app/Config/Kint.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

151
app/Config/Logger.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
use CodeIgniter\Log\Handlers\HandlerInterface;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string<HandlerInterface>, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* NOTE: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

65
app/Config/Migrations.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
/**
* --------------------------------------------------------------------------
* Enable/Disable Migration Lock
* --------------------------------------------------------------------------
*
* Locking is disabled by default.
*
* When enabled, it will prevent multiple migration processes
* from running at the same time by using a lock mechanism.
*
* This is useful in production environments to avoid conflicts
* or race conditions during concurrent deployments.
*/
public bool $lock = false;
}

534
app/Config/Mimes.php Normal file
View File

@@ -0,0 +1,534 @@
<?php
namespace Config;
/**
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'application/macbinary',
'application/mac-binary',
'application/octet-stream',
'application/x-binary',
'application/x-macbinary',
],
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'application/vnd.ms-excel',
'application/msexcel',
'application/x-msexcel',
'application/x-ms-excel',
'application/x-excel',
'application/x-dos_ms_excel',
'application/xls',
'application/x-xls',
'application/excel',
'application/download',
'application/vnd.ms-office',
'application/msword',
],
'ppt' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => [
'application/x-php',
'application/x-httpd-php',
'application/php',
'text/php',
'text/x-php',
'application/x-httpd-php-source',
],
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'audio/x-aiff',
'audio/aiff',
],
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'image/bmp',
'image/x-bmp',
'image/x-bitmap',
'image/x-xbitmap',
'image/x-win-bitmap',
'image/x-windows-bmp',
'image/ms-bmp',
'image/x-ms-bmp',
'application/bmp',
'application/x-bmp',
'application/x-win-bitmap',
],
'gif' => 'image/gif',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'application/pkix-crl',
'application/pkcs-crl',
],
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'video/mp4',
'video/x-f4v',
],
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
'model/stl',
'application/octet-stream',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

82
app/Config/Modules.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

32
app/Config/Optimize.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*
* WARNING: Do not use these options when running the app in the Worker Mode.
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}

37
app/Config/Pager.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}

78
app/Config/Paths.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

54
app/Config/Roles.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* 사용자 역할(mb_level) 코드 매핑
*
* Phase 2 메뉴·권한 제어 시 config('Roles')로 참조
*/
class Roles extends BaseConfig
{
/**
* mb_level 상수 (member.mb_level)
*/
public const LEVEL_SUPER_ADMIN = 4;
public const LEVEL_LOCAL_ADMIN = 3; // 지자체관리자
public const LEVEL_SHOP = 2; // 지정판매소
public const LEVEL_CITIZEN = 1; // 일반 사용자(시민)
/**
* mb_level → 한글명 매핑
*
* @var array<int, string>
*/
public array $levelNames = [
self::LEVEL_CITIZEN => '일반 사용자',
self::LEVEL_SHOP => '지정판매소',
self::LEVEL_LOCAL_ADMIN => '지자체관리자',
self::LEVEL_SUPER_ADMIN => 'super admin',
];
/**
* 자체 회원가입 시 기본 역할 (mb_level)
*/
public int $defaultLevelForSelfRegister = self::LEVEL_CITIZEN;
/**
* mb_level 유효 여부
*/
public function isValidLevel(int $level): bool
{
return isset($this->levelNames[$level]);
}
/**
* mb_level 한글명 반환
*/
public function getLevelName(int $level): string
{
return $this->levelNames[$level] ?? '알 수 없음';
}
}

58
app/Config/Routes.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
$routes->get('/', 'Home::index');
$routes->get('dashboard', 'Home::dashboard');
$routes->get('dashboard/classic-mock', 'Home::dashboardClassicMock');
$routes->get('dashboard/modern', 'Home::dashboardModern');
$routes->get('dashboard/dense', 'Home::dashboardDense');
$routes->get('dashboard/charts', 'Home::dashboardCharts');
$routes->get('bag/inventory-inquiry', 'Home::inventoryInquiry');
$routes->get('bag/waste-suibal-enterprise', 'Home::wasteSuibalEnterprise');
// Auth
$routes->get('login', 'Auth::showLoginForm');
$routes->post('login', 'Auth::login');
$routes->get('logout', 'Auth::logout');
$routes->get('register', 'Auth::showRegisterForm');
$routes->post('register', 'Auth::register');
// Admin (adminAuth 필터 적용)
$routes->group('admin', ['filter' => 'adminAuth'], static function ($routes): void {
$routes->get('select-local-government', 'Admin\SelectLocalGovernment::index');
$routes->post('select-local-government', 'Admin\SelectLocalGovernment::store');
$routes->get('/', 'Admin\Dashboard::index');
$routes->get('users', 'Admin\User::index');
$routes->get('users/create', 'Admin\User::create');
$routes->post('users/store', 'Admin\User::store');
$routes->get('users/edit/(:num)', 'Admin\User::edit/$1');
$routes->post('users/update/(:num)', 'Admin\User::update/$1');
$routes->post('users/delete/(:num)', 'Admin\User::delete/$1');
$routes->get('access/login-history', 'Admin\Access::loginHistory');
$routes->get('access/approvals', 'Admin\Access::approvals');
$routes->post('access/approve/(:num)', 'Admin\Access::approve/$1');
$routes->post('access/reject/(:num)', 'Admin\Access::reject/$1');
$routes->get('roles', 'Admin\Role::index');
$routes->get('menus', 'Admin\Menu::index');
$routes->get('menus/list', 'Admin\Menu::list');
$routes->post('menus/store', 'Admin\Menu::store');
$routes->post('menus/update/(:num)', 'Admin\Menu::update/$1');
$routes->post('menus/delete/(:num)', 'Admin\Menu::delete/$1');
$routes->post('menus/move', 'Admin\Menu::move');
// Local government & designated shop 관리
$routes->get('local-governments', 'Admin\LocalGovernment::index');
$routes->get('local-governments/create', 'Admin\LocalGovernment::create');
$routes->post('local-governments/store', 'Admin\LocalGovernment::store');
$routes->get('designated-shops', 'Admin\DesignatedShop::index');
$routes->get('designated-shops/create', 'Admin\DesignatedShop::create');
$routes->post('designated-shops/store', 'Admin\DesignatedShop::store');
$routes->get('designated-shops/edit/(:num)', 'Admin\DesignatedShop::edit/$1');
$routes->post('designated-shops/update/(:num)', 'Admin\DesignatedShop::update/$1');
$routes->post('designated-shops/delete/(:num)', 'Admin\DesignatedShop::delete/$1');
});

149
app/Config/Routing.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* If TRUE, the system will look for attributes on controller
* class and methods that can run before and after the
* controller/method.
*
* If FALSE, will ignore any attributes.
*/
public bool $useControllerAttributes = true;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = true;
}

86
app/Config/Security.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
}

32
app/Config/Services.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

128
app/Config/Session.php Normal file
View File

@@ -0,0 +1,128 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\ArrayHandler` (for testing)
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}

147
app/Config/Toolbar.php Normal file
View File

@@ -0,0 +1,147 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
/**
* --------------------------------------------------------------------------
* Ignored HTTP Headers
* --------------------------------------------------------------------------
*
* CodeIgniter Debug Toolbar normally injects HTML and JavaScript into every
* HTML response. This is correct for full page loads, but it breaks requests
* that expect only a clean HTML fragment.
*
* Libraries like HTMX, Unpoly, and Hotwire (Turbo) update parts of the page or
* manage navigation on the client side. Injecting the Debug Toolbar into their
* responses can cause invalid HTML, duplicated scripts, or JavaScript errors
* (such as infinite loops or "Maximum call stack size exceeded").
*
* Any request containing one of the following headers is treated as a
* client-managed or partial request, and the Debug Toolbar injection is skipped.
*
* @var array<string, string|null>
*/
public array $disableOnHeaders = [
'X-Requested-With' => 'xmlhttprequest', // AJAX requests
'HX-Request' => 'true', // HTMX requests
'X-Up-Version' => null, // Unpoly partial requests
];
}

262
app/Config/UserAgents.php Normal file
View File

@@ -0,0 +1,262 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* This file contains four arrays of user agent data. It is used by the
* User Agent Class to help identify browser, platform, robot, and
* mobile device data. The array keys are used to identify the device
* and the array values are used to set the actual name of the item.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'googlebot' => 'Googlebot',
'google-pagerenderer' => 'Google Page Renderer',
'google-read-aloud' => 'Google Read Aloud',
'google-safety' => 'Google Safety Bot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'bingpreview' => 'BingPreview',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
'duckduckbot' => 'DuckDuckBot',
'sogou' => 'Sogou Spider',
'exabot' => 'Exabot',
'bot' => 'Generic Bot',
'crawler' => 'Generic Crawler',
'spider' => 'Generic Spider',
];
}

44
app/Config/Validation.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

79
app/Config/View.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
/**
* Subdirectory within app/Views for namespaced view overrides.
*
* Namespaced views will be searched in:
*
* app/Views/{$appOverridesFolder}/{Namespace}/{view_path}.{php|html...}
*
* This allows application-level overrides for package or module views
* without modifying vendor source files.
*
* Examples:
* 'overrides' -> app/Views/overrides/Example/Blog/post/card.php
* 'vendor' -> app/Views/vendor/Example/Blog/post/card.php
* '' -> app/Views/Example/Blog/post/card.php (direct mapping)
*/
public string $appOverridesFolder = 'overrides';
}

50
app/Config/WorkerMode.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
namespace Config;
/**
* This configuration controls how CodeIgniter behaves when running
* in worker mode (with FrankenPHP).
*/
class WorkerMode
{
/**
* Persistent Services
*
* List of service names that should persist across requests.
* These services will NOT be reset between requests.
*
* Services not in this list will be reset for each request to prevent
* state leakage.
*
* Recommended persistent services:
* - `autoloader`: PSR-4 autoloading configuration
* - `locator`: File locator
* - `exceptions`: Exception handler
* - `commands`: CLI commands registry
* - `codeigniter`: Main application instance
* - `superglobals`: Superglobals wrapper
* - `routes`: Router configuration
* - `cache`: Cache instance
*
* @var list<string>
*/
public array $persistentServices = [
'autoloader',
'locator',
'exceptions',
'commands',
'codeigniter',
'superglobals',
'routes',
'cache',
];
/**
* Force Garbage Collection
*
* Whether to force garbage collection after each request.
* Helps prevent memory leaks at a small performance cost.
*/
public bool $forceGarbageCollection = true;
}

View File

@@ -0,0 +1,140 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\LocalGovernmentModel;
use App\Models\MemberApprovalRequestModel;
use App\Models\MemberModel;
use Config\Roles;
use App\Models\MemberLogModel;
class Access extends BaseController
{
private MemberLogModel $memberLogModel;
private MemberApprovalRequestModel $approvalModel;
private MemberModel $memberModel;
private Roles $roles;
public function __construct()
{
$this->memberLogModel = model(MemberLogModel::class);
$this->approvalModel = model(MemberApprovalRequestModel::class);
$this->memberModel = model(MemberModel::class);
$this->roles = config('Roles');
}
/**
* 로그인 이력 (기간 조회)
*/
public function loginHistory(): string
{
$start = $this->request->getGet('start');
$end = $this->request->getGet('end');
$builder = $this->memberLogModel->builder();
$builder->select('member_log.*');
$builder->orderBy('mll_regdate', 'DESC');
if ($start !== null && $start !== '') {
$builder->where('mll_regdate >=', $start . ' 00:00:00');
}
if ($end !== null && $end !== '') {
$builder->where('mll_regdate <=', $end . ' 23:59:59');
}
$list = $builder->get()->getResult();
return view('admin/layout', [
'title' => '로그인 이력',
'content' => view('admin/access/login_history', ['list' => $list, 'start' => $start, 'end' => $end]),
]);
}
public function approvals(): string
{
$status = (string) ($this->request->getGet('status') ?? MemberApprovalRequestModel::STATUS_PENDING);
$allowedStatus = [
MemberApprovalRequestModel::STATUS_PENDING,
MemberApprovalRequestModel::STATUS_APPROVED,
MemberApprovalRequestModel::STATUS_REJECTED,
];
if (! in_array($status, $allowedStatus, true)) {
$status = MemberApprovalRequestModel::STATUS_PENDING;
}
$builder = $this->approvalModel->builder();
$builder->select(
'member_approval_request.*, member.mb_id, member.mb_name, member.mb_lg_idx, local_government.lg_name'
);
$builder->join('member', 'member.mb_idx = member_approval_request.mb_idx', 'left');
$builder->join('local_government', 'local_government.lg_idx = member.mb_lg_idx', 'left');
$builder->where('member_approval_request.mar_status', $status);
$builder->orderBy('member_approval_request.mar_requested_at', 'DESC');
$list = $builder->get()->getResult();
return view('admin/layout', [
'title' => '승인 대기',
'content' => view('admin/access/approvals', [
'list' => $list,
'status' => $status,
'roles' => $this->roles,
]),
]);
}
public function approve(int $id)
{
$requestRow = $this->approvalModel->find($id);
if (! $requestRow) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', '승인 요청을 찾을 수 없습니다.');
}
if ($requestRow->mar_status !== MemberApprovalRequestModel::STATUS_PENDING) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', '이미 처리된 요청입니다.');
}
$requestedLevel = (int) $requestRow->mar_requested_level;
if ($requestedLevel === Roles::LEVEL_SUPER_ADMIN) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', 'super admin 역할 요청은 승인할 수 없습니다.');
}
$db = db_connect();
$db->transStart();
$this->memberModel->update((int) $requestRow->mb_idx, [
'mb_level' => $requestedLevel,
]);
$this->approvalModel->update($id, [
'mar_status' => MemberApprovalRequestModel::STATUS_APPROVED,
'mar_processed_at' => date('Y-m-d H:i:s'),
'mar_processed_by' => (int) (session()->get('mb_idx') ?? 0),
'mar_reject_reason' => null,
]);
$db->transComplete();
if (! $db->transStatus()) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', '승인 처리 중 오류가 발생했습니다.');
}
return redirect()->to(site_url('admin/access/approvals'))->with('success', '승인 처리되었습니다.');
}
public function reject(int $id)
{
$requestRow = $this->approvalModel->find($id);
if (! $requestRow) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', '승인 요청을 찾을 수 없습니다.');
}
if ($requestRow->mar_status !== MemberApprovalRequestModel::STATUS_PENDING) {
return redirect()->to(site_url('admin/access/approvals'))->with('error', '이미 처리된 요청입니다.');
}
$reason = trim((string) $this->request->getPost('reject_reason'));
if ($reason === '') {
$reason = '관리자 반려';
}
$this->approvalModel->update($id, [
'mar_status' => MemberApprovalRequestModel::STATUS_REJECTED,
'mar_reject_reason' => mb_substr($reason, 0, 255),
'mar_processed_at' => date('Y-m-d H:i:s'),
'mar_processed_by' => (int) (session()->get('mb_idx') ?? 0),
]);
return redirect()->to(site_url('admin/access/approvals'))->with('success', '반려 처리되었습니다.');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
class Dashboard extends BaseController
{
public function index(): string
{
return view('admin/layout', [
'title' => '대시보드',
'content' => view('admin/dashboard/index'),
]);
}
}

View File

@@ -0,0 +1,307 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\DesignatedShopModel;
use App\Models\LocalGovernmentModel;
use Config\Roles;
class DesignatedShop extends BaseController
{
private DesignatedShopModel $shopModel;
private LocalGovernmentModel $lgModel;
private Roles $roles;
public function __construct()
{
$this->shopModel = model(DesignatedShopModel::class);
$this->lgModel = model(LocalGovernmentModel::class);
$this->roles = config('Roles');
}
private function isSuperAdmin(): bool
{
return (int) session()->get('mb_level') === Roles::LEVEL_SUPER_ADMIN;
}
private function isLocalAdmin(): bool
{
return (int) session()->get('mb_level') === Roles::LEVEL_LOCAL_ADMIN;
}
/**
* 지정판매소 목록 (효과 지자체 기준: super admin = 선택 지자체, 지자체관리자 = mb_lg_idx)
*/
public function index()
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(site_url('admin'))
->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.');
}
$list = $this->shopModel
->where('ds_lg_idx', $lgIdx)
->orderBy('ds_idx', 'DESC')
->findAll();
// 지자체 이름 매핑용
$lgMap = [];
foreach ($this->lgModel->findAll() as $lg) {
$lgMap[$lg->lg_idx] = $lg->lg_name;
}
return view('admin/layout', [
'title' => '지정판매소 관리',
'content' => view('admin/designated_shop/index', [
'list' => $list,
'lgMap' => $lgMap,
]),
]);
}
/**
* 지정판매소 등록 폼 (효과 지자체 기준)
*/
public function create()
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.');
}
$currentLg = $this->lgModel->find($lgIdx);
if ($currentLg === null) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '선택한 지자체 정보를 찾을 수 없습니다.');
}
return view('admin/layout', [
'title' => '지정판매소 등록',
'content' => view('admin/designated_shop/create', [
'localGovs' => [],
'currentLg' => $currentLg,
]),
]);
}
/**
* 지정판매소 등록 처리
*/
public function store()
{
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '지정판매소 등록은 관리자만 가능합니다.');
}
$rules = [
'ds_name' => 'required|max_length[100]',
'ds_biz_no' => 'required|max_length[20]',
'ds_rep_name' => 'required|max_length[50]',
'ds_va_number' => 'permit_empty|max_length[50]',
'ds_email' => 'permit_empty|valid_email|max_length[100]',
];
if (! $this->validate($rules)) {
return redirect()->back()
->withInput()
->with('errors', $this->validator->getErrors());
}
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->back()
->withInput()
->with('error', '소속 지자체가 올바르지 않습니다.');
}
$lg = $this->lgModel->find($lgIdx);
if ($lg === null || (string) $lg->lg_code === '') {
return redirect()->back()
->withInput()
->with('error', '지자체 코드 정보를 찾을 수 없습니다.');
}
$dsShopNo = $this->generateNextShopNo($lgIdx, (string) $lg->lg_code);
$data = [
'ds_lg_idx' => $lgIdx,
'ds_mb_idx' => null,
'ds_shop_no' => $dsShopNo,
'ds_name' => (string) $this->request->getPost('ds_name'),
'ds_biz_no' => (string) $this->request->getPost('ds_biz_no'),
'ds_rep_name' => (string) $this->request->getPost('ds_rep_name'),
'ds_va_number' => (string) $this->request->getPost('ds_va_number'),
'ds_zip' => (string) $this->request->getPost('ds_zip'),
'ds_addr' => (string) $this->request->getPost('ds_addr'),
'ds_addr_jibun' => (string) $this->request->getPost('ds_addr_jibun'),
'ds_tel' => (string) $this->request->getPost('ds_tel'),
'ds_rep_phone' => (string) $this->request->getPost('ds_rep_phone'),
'ds_email' => (string) $this->request->getPost('ds_email'),
'ds_gugun_code' => (string) $lg->lg_code,
'ds_designated_at' => $this->request->getPost('ds_designated_at') ?: null,
'ds_state' => 1,
'ds_regdate' => date('Y-m-d H:i:s'),
];
$this->shopModel->insert($data);
return redirect()->to(site_url('admin/designated-shops'))
->with('success', '지정판매소가 등록되었습니다.');
}
/**
* 지정판매소 수정 폼 (효과 지자체 소속만 허용)
* 문서: docs/기본 개발계획/23-지정판매소_수정_삭제_기능.md
*/
public function edit(int $id)
{
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '권한이 없습니다.');
}
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '작업할 지자체가 선택되지 않았습니다.');
}
$shop = $this->shopModel->find($id);
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.');
}
$currentLg = $this->lgModel->find($lgIdx);
return view('admin/layout', [
'title' => '지정판매소 수정',
'content' => view('admin/designated_shop/edit', [
'shop' => $shop,
'currentLg' => $currentLg,
]),
]);
}
/**
* 지정판매소 수정 처리
*/
public function update(int $id)
{
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '권한이 없습니다.');
}
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '작업할 지자체가 선택되지 않았습니다.');
}
$shop = $this->shopModel->find($id);
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.');
}
$rules = [
'ds_name' => 'required|max_length[100]',
'ds_biz_no' => 'required|max_length[20]',
'ds_rep_name' => 'required|max_length[50]',
'ds_va_number' => 'permit_empty|max_length[50]',
'ds_email' => 'permit_empty|valid_email|max_length[100]',
'ds_state' => 'permit_empty|in_list[1,2,3]',
];
if (! $this->validate($rules)) {
return redirect()->back()
->withInput()
->with('errors', $this->validator->getErrors());
}
$data = [
'ds_name' => (string) $this->request->getPost('ds_name'),
'ds_biz_no' => (string) $this->request->getPost('ds_biz_no'),
'ds_rep_name' => (string) $this->request->getPost('ds_rep_name'),
'ds_va_number' => (string) $this->request->getPost('ds_va_number'),
'ds_zip' => (string) $this->request->getPost('ds_zip'),
'ds_addr' => (string) $this->request->getPost('ds_addr'),
'ds_addr_jibun' => (string) $this->request->getPost('ds_addr_jibun'),
'ds_tel' => (string) $this->request->getPost('ds_tel'),
'ds_rep_phone' => (string) $this->request->getPost('ds_rep_phone'),
'ds_email' => (string) $this->request->getPost('ds_email'),
'ds_designated_at' => $this->request->getPost('ds_designated_at') ?: null,
'ds_state' => (int) ($this->request->getPost('ds_state') ?: 1),
];
$this->shopModel->update($id, $data);
return redirect()->to(site_url('admin/designated-shops'))
->with('success', '지정판매소 정보가 수정되었습니다.');
}
/**
* 지정판매소 삭제 (물리 삭제, 효과 지자체 소속만 허용)
* 문서: docs/기본 개발계획/23-지정판매소_수정_삭제_기능.md
*/
public function delete(int $id)
{
if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '권한이 없습니다.');
}
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null || $lgIdx <= 0) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '작업할 지자체가 선택되지 않았습니다.');
}
$shop = $this->shopModel->find($id);
if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) {
return redirect()->to(site_url('admin/designated-shops'))
->with('error', '해당 지정판매소를 찾을 수 없거나 삭제할 수 없습니다.');
}
$this->shopModel->delete($id);
return redirect()->to(site_url('admin/designated-shops'))
->with('success', '지정판매소가 삭제되었습니다.');
}
/**
* 지자체별 다음 판매소번호 생성 (lg_code + 3자리 일련번호)
* 문서: docs/기본 개발계획/22-판매소번호_일련번호_결정.md §3
*/
private function generateNextShopNo(int $lgIdx, string $lgCode): string
{
$prefixLen = strlen($lgCode);
$existing = $this->shopModel->where('ds_lg_idx', $lgIdx)->findAll();
$maxSerial = 0;
foreach ($existing as $row) {
$no = $row->ds_shop_no;
if (strlen($no) === $prefixLen + 3 && str_starts_with($no, $lgCode)) {
$n = (int) substr($no, -3);
if ($n > $maxSerial) {
$maxSerial = $n;
}
}
}
return $lgCode . sprintf('%03d', $maxSerial + 1);
}
}

View File

@@ -0,0 +1,99 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\LocalGovernmentModel;
use Config\Roles;
class LocalGovernment extends BaseController
{
private LocalGovernmentModel $lgModel;
private Roles $roles;
public function __construct()
{
$this->lgModel = model(LocalGovernmentModel::class);
$this->roles = config('Roles');
}
private function isSuperAdmin(): bool
{
return (int) session()->get('mb_level') === Roles::LEVEL_SUPER_ADMIN;
}
/**
* 지자체 목록
*/
public function index()
{
if (! $this->isSuperAdmin()) {
return redirect()->to(site_url('admin'))
->with('error', '지자체 관리는 super admin만 접근할 수 있습니다.');
}
$list = $this->lgModel->orderBy('lg_idx', 'DESC')->findAll();
return view('admin/layout', [
'title' => '지자체 관리',
'content' => view('admin/local_government/index', ['list' => $list]),
]);
}
/**
* 지자체 등록 폼
*/
public function create()
{
if (! $this->isSuperAdmin()) {
return redirect()->to(site_url('admin/local-governments'))
->with('error', '지자체 등록은 super admin만 가능합니다.');
}
return view('admin/layout', [
'title' => '지자체 등록',
'content' => view('admin/local_government/create'),
]);
}
/**
* 지자체 등록 처리
*/
public function store()
{
if (! $this->isSuperAdmin()) {
return redirect()->to(site_url('admin/local-governments'))
->with('error', '지자체 등록은 super admin만 가능합니다.');
}
$rules = [
'lg_name' => 'required|max_length[100]',
'lg_code' => 'required|max_length[20]|is_unique[local_government.lg_code]',
'lg_sido' => 'required|max_length[50]',
'lg_gugun' => 'required|max_length[50]',
'lg_addr' => 'permit_empty|max_length[255]',
];
if (! $this->validate($rules)) {
return redirect()->back()
->withInput()
->with('errors', $this->validator->getErrors());
}
$data = [
'lg_name' => (string) $this->request->getPost('lg_name'),
'lg_code' => (string) $this->request->getPost('lg_code'),
'lg_sido' => (string) $this->request->getPost('lg_sido'),
'lg_gugun' => (string) $this->request->getPost('lg_gugun'),
'lg_addr' => (string) $this->request->getPost('lg_addr'),
'lg_state' => 1,
'lg_regdate' => date('Y-m-d H:i:s'),
];
$this->lgModel->insert($data);
return redirect()->to(site_url('admin/local-governments'))
->with('success', '지자체가 등록되었습니다.');
}
}

View File

@@ -0,0 +1,213 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\MenuModel;
use App\Models\MenuTypeModel;
use Config\Roles;
class Menu extends BaseController
{
private MenuModel $menuModel;
private MenuTypeModel $typeModel;
public function __construct()
{
$this->menuModel = model(MenuModel::class);
$this->typeModel = model(MenuTypeModel::class);
}
/**
* 메뉴 관리 화면 (목록 + 등록/수정 폼). 지자체별 메뉴만 조회·관리.
*/
public function index()
{
helper('admin');
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return redirect()->to(base_url('admin/select-local-government'))
->with('error', '메뉴를 관리하려면 먼저 지자체를 선택하세요.');
}
$types = $this->typeModel->orderBy('mt_sort', 'ASC')->findAll();
$mtIdx = (int) ($this->request->getGet('mt_idx') ?? 0);
if ($mtIdx <= 0 && ! empty($types)) {
// 기본 선택: 사이트 메뉴(mt_code=site), 없으면 첫 번째 타입
$siteType = $this->typeModel->where('mt_code', 'site')->first();
$mtIdx = $siteType ? (int) $siteType->mt_idx : (int) $types[0]->mt_idx;
}
$list = $mtIdx > 0 ? $this->menuModel->getAllByType($mtIdx, $lgIdx) : [];
// 현재 지자체에 메뉴가 없으면, mt_idx별로 기본 지자체(lg_idx=1)의 메뉴를 한 번 복사한다.
if ($mtIdx > 0 && empty($list)) {
$this->menuModel->copyDefaultsFromLg($mtIdx, 1, $lgIdx);
$list = $this->menuModel->getAllByType($mtIdx, $lgIdx);
}
// 트리 순서대로 상위 메뉴 바로 아래에 하위 메뉴가 오도록 평탄화
if (! empty($list)) {
$tree = build_menu_tree($list);
$list = flatten_menu_tree($tree);
}
$currentType = $mtIdx > 0 ? $this->typeModel->find($mtIdx) : null;
return view('admin/layout', [
'title' => '메뉴 관리',
'content' => view('admin/menu/index', [
'types' => $types,
'mtIdx' => $mtIdx,
'mtCode' => $currentType->mt_code ?? '',
'list' => $list,
'levelNames' => config('Roles')->levelNames,
]),
]);
}
/**
* 메뉴 목록 JSON (트리 정렬된 평면 배열). 현재 지자체만.
*/
public function list()
{
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return $this->response->setJSON(['status' => 0, 'msg' => '지자체를 선택하세요.']);
}
$mtIdx = (int) $this->request->getGet('mt_idx');
if ($mtIdx <= 0) {
return $this->response->setJSON(['status' => 0, 'msg' => 'mt_idx required']);
}
$list = $this->menuModel->getAllByType($mtIdx, $lgIdx);
return $this->response->setJSON(['status' => 1, 'data' => $list]);
}
/**
* 메뉴 등록 (현재 지자체 소속으로 저장)
*/
public function store()
{
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return redirect()->to(base_url('admin/select-local-government'))
->with('error', '메뉴를 등록하려면 먼저 지자체를 선택하세요.');
}
$mtIdx = (int) $this->request->getPost('mt_idx');
$mmPidx = (int) $this->request->getPost('mm_pidx');
$mmDep = (int) $this->request->getPost('mm_dep');
$mmName = trim((string) $this->request->getPost('mm_name'));
if ($mtIdx <= 0) {
return redirect()->back()->with('error', '메뉴 종류를 선택하세요.');
}
if ($mmName === '') {
return redirect()->back()->with('error', '메뉴명을 입력하세요.');
}
$mmNum = $this->menuModel->getNextNum($mtIdx, $lgIdx, $mmPidx, $mmDep);
$data = [
'mt_idx' => $mtIdx,
'lg_idx' => $lgIdx,
'mm_name' => $mmName,
'mm_link' => (string) $this->request->getPost('mm_link'),
'mm_pidx' => $mmPidx,
'mm_dep' => $mmDep,
'mm_num' => $mmNum,
'mm_cnode' => 0,
'mm_level' => $this->normalizeMmLevel($mtIdx),
'mm_is_view' => $this->request->getPost('mm_is_view') ? 'Y' : 'N',
];
$this->menuModel->insert($data);
if ($mmPidx > 0) {
$this->menuModel->updateCnode($mmPidx, 1);
}
return redirect()->back()->with('success', '메뉴가 등록되었습니다.');
}
/**
* 메뉴 수정 (현재 지자체 소속 메뉴만 허용)
*/
public function update(int $id)
{
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return redirect()->to(base_url('admin/select-local-government'))
->with('error', '지자체를 선택하세요.');
}
$row = $this->menuModel->find($id);
if (! $row) {
return redirect()->back()->with('error', '메뉴를 찾을 수 없습니다.');
}
if ((int) $row->lg_idx !== $lgIdx) {
return redirect()->back()->with('error', '해당 지자체의 메뉴만 수정할 수 있습니다.');
}
$data = [
'mm_name' => (string) $this->request->getPost('mm_name'),
'mm_link' => (string) $this->request->getPost('mm_link'),
'mm_level' => $this->normalizeMmLevel((int) $row->mt_idx),
'mm_is_view' => $this->request->getPost('mm_is_view') ? 'Y' : 'N',
];
$this->menuModel->update($id, $data);
return redirect()->back()->with('success', '메뉴가 수정되었습니다.');
}
/**
* 메뉴 삭제 (현재 지자체 소속만 허용, 하위 있으면 불가)
*/
public function delete(int $id)
{
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return redirect()->to(base_url('admin/select-local-government'))
->with('error', '지자체를 선택하세요.');
}
$row = $this->menuModel->find($id);
if (! $row || (int) $row->lg_idx !== $lgIdx) {
return redirect()->back()->with('error', '해당 지자체의 메뉴만 삭제할 수 있습니다.');
}
$result = $this->menuModel->deleteSafe($id);
if ($result['ok']) {
return redirect()->back()->with('success', '메뉴가 삭제되었습니다.');
}
return redirect()->back()->with('error', $result['msg']);
}
/**
* 순서 변경 (mm_idx[] 순서대로 mm_num 부여). 현재 지자체 메뉴만.
*/
public function move()
{
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return redirect()->to(base_url('admin/select-local-government'))
->with('error', '지자체를 선택하세요.');
}
$ids = $this->request->getPost('mm_idx');
if (! is_array($ids) || empty($ids)) {
return redirect()->back()->with('error', '순서를 적용할 메뉴가 없습니다.');
}
$this->menuModel->setOrder($ids, $lgIdx);
return redirect()->back()->with('success', '순서가 적용되었습니다.');
}
/**
* 노출 대상: 전체(mm_level_all)이면 빈 문자열, 아니면 선택한 레벨을 쉼표 구분 문자열로
*/
private function normalizeMmLevel(int $mtIdx): string
{
// 관리자 메뉴(admin)는 시민/판매소 노출을 허용하지 않음 → 지자체관리자(3)로 고정
$type = $this->typeModel->find($mtIdx);
if ($type && (string) $type->mt_code === 'admin') {
return (string) Roles::LEVEL_LOCAL_ADMIN;
}
if ($this->request->getPost('mm_level_all')) {
return '';
}
$levels = $this->request->getPost('mm_level');
if (! is_array($levels) || empty($levels)) {
return '';
}
$levels = array_map('intval', $levels);
// super admin(4)은 DB 저장 대상 아님. 1,2,3은 그대로 저장
$levels = array_filter($levels, static fn ($v) => $v > 0 && $v !== \Config\Roles::LEVEL_SUPER_ADMIN);
return implode(',', array_values($levels));
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use Config\Roles;
/**
* 역할(mb_level) 관리.
* 현재는 Config\Roles 기반 목록만 제공. 추후 role 테이블 연동 시 CRUD 확장.
*/
class Role extends BaseController
{
public function index(): string
{
$roles = config('Roles');
return view('admin/layout', [
'title' => '역할',
'content' => view('admin/role/index', ['roles' => $roles]),
]);
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\LocalGovernmentModel;
use Config\Roles;
class SelectLocalGovernment extends BaseController
{
/**
* 지자체 선택 화면 (super admin 전용)
*/
public function index()
{
if ((int) session()->get('mb_level') !== Roles::LEVEL_SUPER_ADMIN) {
return redirect()->to(site_url('admin'))->with('error', '지자체 선택은 super admin만 사용할 수 있습니다.');
}
$list = model(LocalGovernmentModel::class)
->where('lg_state', 1)
->orderBy('lg_name', 'ASC')
->findAll();
return view('admin/layout', [
'title' => '지자체 선택',
'content' => view('admin/select_local_government/index', [
'list' => $list,
]),
]);
}
/**
* 선택 처리: admin_selected_lg_idx 저장 후 관리자 대시보드로 이동
*/
public function store()
{
if ((int) session()->get('mb_level') !== Roles::LEVEL_SUPER_ADMIN) {
return redirect()->to(site_url('admin'))->with('error', '지자체 선택은 super admin만 사용할 수 있습니다.');
}
$lgIdx = (int) $this->request->getPost('lg_idx');
if ($lgIdx <= 0) {
return redirect()->back()
->with('error', '지자체를 선택해 주세요.');
}
$exists = model(LocalGovernmentModel::class)->find($lgIdx);
if ($exists === null) {
return redirect()->back()
->with('error', '선택한 지자체를 찾을 수 없습니다.');
}
session()->set('admin_selected_lg_idx', $lgIdx);
return redirect()->to(site_url('admin'))->with('success', $exists->lg_name . ' 지자체로 전환되었습니다.');
}
}

View File

@@ -0,0 +1,210 @@
<?php
namespace App\Controllers\Admin;
use App\Controllers\BaseController;
use App\Models\MemberApprovalRequestModel;
use App\Models\MemberModel;
use Config\Roles;
class User extends BaseController
{
private MemberModel $memberModel;
private MemberApprovalRequestModel $approvalModel;
private Roles $roles;
public function __construct()
{
$this->memberModel = model(MemberModel::class);
$this->approvalModel = model(MemberApprovalRequestModel::class);
$this->roles = config('Roles');
helper('pii_encryption');
}
/**
* 회원 목록
*/
public function index(): string
{
$list = $this->memberModel->orderBy('mb_idx', 'DESC')->findAll();
$approvalMap = [];
try {
$memberIds = array_map(static fn ($row) => (int) $row->mb_idx, $list);
if (! empty($memberIds)) {
$approvalRows = $this->approvalModel
->whereIn('mb_idx', $memberIds)
->orderBy('mar_idx', 'DESC')
->findAll();
foreach ($approvalRows as $approvalRow) {
$mbIdx = (int) $approvalRow->mb_idx;
if (! isset($approvalMap[$mbIdx])) {
$approvalMap[$mbIdx] = (string) $approvalRow->mar_status;
}
}
}
} catch (\Throwable $e) {
// 승인요청 테이블 미생성 등 예외 시 기존 상태 표시로 폴백
}
foreach ($list as $row) {
$row->mb_email = pii_decrypt($row->mb_email ?? '');
$row->mb_phone = pii_decrypt($row->mb_phone ?? '');
}
return view('admin/layout', [
'title' => '회원 관리',
'content' => view('admin/user/index', [
'list' => $list,
'roles' => $this->roles,
'approvalMap' => $approvalMap,
]),
]);
}
/**
* 회원 등록 폼
*/
public function create(): string
{
return view('admin/layout', [
'title' => '회원 등록',
'content' => view('admin/user/create', [
'roles' => $this->roles,
'assignableLevels' => $this->getAssignableLevels(),
]),
]);
}
/**
* 회원 등록 처리
*/
public function store()
{
$rules = [
'mb_id' => 'required|min_length[2]|max_length[50]|is_unique[member.mb_id]',
'mb_passwd' => 'required|min_length[4]|max_length[255]',
'mb_name' => 'required|max_length[50]',
'mb_email' => 'permit_empty|valid_email|max_length[100]',
'mb_phone' => 'permit_empty|max_length[20]',
'mb_level' => 'required',
];
if (! $this->validate($rules)) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
$allowedLevels = array_keys($this->getAssignableLevels());
$requestedLevel = (int) $this->request->getPost('mb_level');
if (! in_array($requestedLevel, $allowedLevels, true)) {
return redirect()->back()->withInput()->with('error', '현재 권한으로는 해당 역할을 등록할 수 없습니다.');
}
$data = [
'mb_id' => $this->request->getPost('mb_id'),
'mb_passwd' => password_hash((string) $this->request->getPost('mb_passwd'), PASSWORD_DEFAULT),
'mb_name' => $this->request->getPost('mb_name'),
'mb_email' => pii_encrypt($this->request->getPost('mb_email')),
'mb_phone' => pii_encrypt($this->request->getPost('mb_phone')),
'mb_level' => $requestedLevel,
'mb_state' => 1,
'mb_regdate' => date('Y-m-d H:i:s'),
'mb_latestdate' => null,
];
$this->memberModel->insert($data);
return redirect()->to(site_url('admin/users'))->with('success', '회원이 등록되었습니다.');
}
/**
* 회원 수정 폼
*/
public function edit(int $id): string
{
$member = $this->memberModel->find($id);
if (! $member) {
return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.');
}
$member->mb_email = pii_decrypt($member->mb_email ?? '');
$member->mb_phone = pii_decrypt($member->mb_phone ?? '');
return view('admin/layout', [
'title' => '회원 수정',
'content' => view('admin/user/edit', [
'member' => $member,
'roles' => $this->roles,
'assignableLevels' => $this->getAssignableLevels(),
]),
]);
}
/**
* 회원 수정 처리
*/
public function update(int $id)
{
$member = $this->memberModel->find($id);
if (! $member) {
return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.');
}
$rules = [
'mb_id' => "required|min_length[2]|max_length[50]|is_unique[member.mb_id,mb_idx,{$id}]",
'mb_name' => 'required|max_length[50]',
'mb_email' => 'permit_empty|valid_email|max_length[100]',
'mb_phone' => 'permit_empty|max_length[20]',
'mb_level' => 'required',
'mb_state' => 'required|in_list[0,1,2]',
];
$passwd = $this->request->getPost('mb_passwd');
if ($passwd !== '') {
$rules['mb_passwd'] = 'min_length[4]|max_length[255]';
}
if (! $this->validate($rules)) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
$allowedLevels = array_keys($this->getAssignableLevels());
$requestedLevel = (int) $this->request->getPost('mb_level');
if (! in_array($requestedLevel, $allowedLevels, true)) {
return redirect()->back()->withInput()->with('error', '현재 권한으로는 해당 역할로 수정할 수 없습니다.');
}
$data = [
'mb_id' => $this->request->getPost('mb_id'),
'mb_name' => $this->request->getPost('mb_name'),
'mb_email' => pii_encrypt($this->request->getPost('mb_email')),
'mb_phone' => pii_encrypt($this->request->getPost('mb_phone')),
'mb_level' => $requestedLevel,
'mb_state' => (int) $this->request->getPost('mb_state'),
];
if ($passwd !== '') {
$data['mb_passwd'] = password_hash($passwd, PASSWORD_DEFAULT);
}
$this->memberModel->update($id, $data);
return redirect()->to(site_url('admin/users'))->with('success', '회원 정보가 수정되었습니다.');
}
/**
* 현재 로그인한 관리자가 부여 가능한 역할 목록.
* super admin만 super admin(4) 부여 가능, 그 외는 1~3만 허용.
*
* @return array<int,string>
*/
private function getAssignableLevels(): array
{
$levelNames = $this->roles->levelNames;
$myLevel = (int) session()->get('mb_level');
if ($myLevel === Roles::LEVEL_SUPER_ADMIN) {
return $levelNames;
}
unset($levelNames[Roles::LEVEL_SUPER_ADMIN]);
return $levelNames;
}
/**
* 회원 삭제(탈퇴 처리: mb_state=0, mb_leavedate 기록)
*/
public function delete(int $id)
{
$member = $this->memberModel->find($id);
if (! $member) {
return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.');
}
$this->memberModel->update($id, [
'mb_state' => 0,
'mb_leavedate' => date('Y-m-d H:i:s'),
]);
return redirect()->to(site_url('admin/users'))->with('success', '회원이 탈퇴 처리되었습니다.');
}
}

300
app/Controllers/Auth.php Normal file
View File

@@ -0,0 +1,300 @@
<?php
namespace App\Controllers;
use App\Models\LocalGovernmentModel;
use App\Models\MemberApprovalRequestModel;
use App\Models\MemberLogModel;
use App\Models\MemberModel;
class Auth extends BaseController
{
/** mb_state: 1=정상, 2=정지, 0=탈퇴 */
private const MB_STATE_NORMAL = 1;
private const MB_STATE_BANNED = 2;
private const MB_STATE_LEAVE = 0;
public function showLoginForm()
{
if (session()->get('logged_in')) {
return redirect()->to('/');
}
return view('auth/login');
}
public function login()
{
$rules = [
'login_id' => 'required|max_length[50]',
'password' => 'required|max_length[255]',
];
$messages = [
'login_id' => [
'required' => '아이디를 입력해 주세요.',
'max_length' => '아이디는 50자 이하여야 합니다.',
],
'password' => [
'required' => '비밀번호를 입력해 주세요.',
'max_length' => '비밀번호는 255자 이하여야 합니다.',
],
];
if (! $this->validate($rules, $messages)) {
return redirect()->back()
->withInput()
->with('errors', $this->validator->getErrors());
}
$loginId = trim($this->request->getPost('login_id'));
$password = $this->request->getPost('password');
$memberModel = model(MemberModel::class);
$member = $memberModel->findByLoginId($loginId);
$approvalModel = model(MemberApprovalRequestModel::class);
$logData = $this->buildLogData($loginId, $member?->mb_idx);
if ($member === null) {
$this->insertMemberLog($logData, false, '회원 정보를 찾을 수 없습니다.');
return redirect()->back()
->withInput()
->with('error', '아이디 또는 비밀번호가 올바르지 않습니다.');
}
if ($member->mb_state === self::MB_STATE_LEAVE) {
$this->insertMemberLog($logData, false, '탈퇴한 회원입니다.');
return redirect()->back()
->withInput()
->with('error', '탈퇴한 회원입니다.');
}
if ($member->mb_state === self::MB_STATE_BANNED) {
$this->insertMemberLog($logData, false, '정지된 회원입니다.');
return redirect()->back()
->withInput()
->with('error', '정지된 회원입니다.');
}
if (! password_verify($password, $member->mb_passwd)) {
$this->insertMemberLog($logData, false, '비밀번호 불일치');
return redirect()->back()
->withInput()
->with('error', '아이디 또는 비밀번호가 올바르지 않습니다.');
}
// 승인 요청 상태 확인(공개 회원가입 사용자)
$latestApproval = $approvalModel->getLatestByMember((int) $member->mb_idx);
if ($latestApproval !== null) {
if ($latestApproval->mar_status === MemberApprovalRequestModel::STATUS_PENDING) {
$this->insertMemberLog($logData, false, '승인 대기 상태');
return redirect()->back()
->withInput()
->with('error', '관리자 승인 후 로그인 가능합니다.');
}
if ($latestApproval->mar_status === MemberApprovalRequestModel::STATUS_REJECTED) {
$this->insertMemberLog($logData, false, '승인 반려 상태');
return redirect()->back()
->withInput()
->with('error', '승인이 반려되었습니다. 관리자에게 문의해 주세요.');
}
}
// 로그인 성공
$sessionData = [
'mb_idx' => $member->mb_idx,
'mb_id' => $member->mb_id,
'mb_name' => $member->mb_name,
'mb_level' => $member->mb_level,
'mb_lg_idx' => $member->mb_lg_idx ?? null,
'logged_in' => true,
];
session()->set($sessionData);
$memberModel->update($member->mb_idx, [
'mb_latestdate' => date('Y-m-d H:i:s'),
]);
$this->insertMemberLog($logData, true, '로그인 성공', $member->mb_idx);
// 지자체 관리자 → 관리자 대시보드로 이동
if ((int) $member->mb_level === \Config\Roles::LEVEL_LOCAL_ADMIN) {
return redirect()->to(site_url('admin'))->with('success', '로그인되었습니다.');
}
// super admin → 지자체 선택 페이지로 이동 (선택 후 관리자 페이지 사용)
if ((int) $member->mb_level === \Config\Roles::LEVEL_SUPER_ADMIN) {
return redirect()->to(site_url('admin/select-local-government'))->with('success', '로그인되었습니다.');
}
return redirect()->to(site_url('/'))->with('success', '로그인되었습니다.');
}
public function logout()
{
if (session()->get('logged_in')) {
$mbIdx = session()->get('mb_idx');
$mbId = session()->get('mb_id');
$log = model(MemberLogModel::class)
->where('mb_idx', $mbIdx)
->where('mll_success', 1)
->orderBy('mll_idx', 'DESC')
->first();
if ($log !== null) {
model(MemberLogModel::class)->update($log->mll_idx, [
'mll_logout_date' => date('Y-m-d H:i:s'),
]);
} else {
model(MemberLogModel::class)->insert([
'mll_success' => 1,
'mb_idx' => $mbIdx,
'mb_id' => $mbId ?? '',
'mll_regdate' => date('Y-m-d H:i:s'),
'mll_ip' => $this->request->getIPAddress(),
'mll_msg' => '로그아웃',
'mll_useragent' => substr((string) $this->request->getUserAgent(), 0, 500),
'mll_logout_date' => date('Y-m-d H:i:s'),
]);
}
}
session()->destroy();
return redirect()->to('login')->with('success', '로그아웃되었습니다.');
}
public function showRegisterForm()
{
$localGovernments = model(LocalGovernmentModel::class)
->where('lg_state', 1)
->orderBy('lg_name', 'ASC')
->findAll();
return view('auth/register', [
'localGovernments' => $localGovernments,
]);
}
public function register()
{
$rules = [
'mb_id' => 'required|min_length[4]|max_length[50]|is_unique[member.mb_id]',
'mb_passwd' => 'required|min_length[4]|max_length[255]',
'mb_passwd_confirm' => 'required|matches[mb_passwd]',
'mb_name' => 'required|max_length[100]',
'mb_email' => 'permit_empty|valid_email|max_length[100]',
'mb_phone' => 'permit_empty|max_length[20]',
'mb_lg_idx' => 'permit_empty|is_natural_no_zero',
'mb_level' => 'required|in_list[1,2,3]',
];
$messages = [
'mb_id' => [
'required' => '아이디를 입력해 주세요.',
'min_length' => '아이디는 4자 이상이어야 합니다.',
'max_length' => '아이디는 50자 이하여야 합니다.',
'is_unique' => '이미 사용 중인 아이디입니다.',
],
'mb_passwd' => [
'required' => '비밀번호를 입력해 주세요.',
'min_length' => '비밀번호는 4자 이상이어야 합니다.',
'max_length' => '비밀번호는 255자 이하여야 합니다.',
],
'mb_passwd_confirm' => [
'required' => '비밀번호 확인을 입력해 주세요.',
'matches' => '비밀번호가 일치하지 않습니다.',
],
'mb_name' => [
'required' => '이름을 입력해 주세요.',
'max_length' => '이름은 100자 이하여야 합니다.',
],
'mb_email' => [
'valid_email' => '올바른 이메일 형식이 아닙니다.',
'max_length' => '이메일은 100자 이하여야 합니다.',
],
'mb_phone' => [
'max_length' => '연락처는 20자 이하여야 합니다.',
],
'mb_level' => [
'required' => '사용자 역할을 선택해 주세요.',
'in_list' => '유효하지 않은 역할입니다.',
],
];
if (! $this->validate($rules, $messages)) {
return redirect()->back()
->withInput()
->with('errors', $this->validator->getErrors());
}
$mbLevel = (int) $this->request->getPost('mb_level');
if (! config('Roles')->isValidLevel($mbLevel)) {
$mbLevel = config('Roles')->defaultLevelForSelfRegister;
}
$lgIdx = $this->request->getPost('mb_lg_idx');
$mbLgIdx = ($lgIdx !== null && $lgIdx !== '' && (int) $lgIdx > 0) ? (int) $lgIdx : null;
helper('pii_encryption');
$data = [
'mb_id' => $this->request->getPost('mb_id'),
'mb_passwd' => password_hash($this->request->getPost('mb_passwd'), PASSWORD_DEFAULT),
'mb_name' => $this->request->getPost('mb_name'),
'mb_email' => pii_encrypt($this->request->getPost('mb_email') ?? ''),
'mb_phone' => pii_encrypt($this->request->getPost('mb_phone') ?? ''),
'mb_lang' => 'ko',
// 공개 회원가입 시점에는 역할을 활성화하지 않고 기본 레벨로 생성(승인 후 requested_level 반영)
'mb_level' => \Config\Roles::LEVEL_CITIZEN,
'mb_group' => '',
'mb_lg_idx' => $mbLgIdx,
'mb_state' => 1,
'mb_regdate' => date('Y-m-d H:i:s'),
];
$memberModel = model(MemberModel::class);
if (! $memberModel->insert($data)) {
return redirect()->back()
->withInput()
->with('error', '회원가입 처리 중 오류가 발생했습니다. 다시 시도해 주세요.');
}
$newMemberIdx = (int) $memberModel->getInsertID();
$approvalModel = model(MemberApprovalRequestModel::class);
$approvalModel->insert([
'mb_idx' => $newMemberIdx,
'mar_requested_level' => $mbLevel,
'mar_status' => MemberApprovalRequestModel::STATUS_PENDING,
'mar_request_note' => '',
'mar_reject_reason' => null,
'mar_requested_at' => date('Y-m-d H:i:s'),
'mar_requested_by' => $newMemberIdx,
'mar_processed_at' => null,
'mar_processed_by' => null,
]);
return redirect()->to('login')->with('success', '회원가입이 완료되었습니다. 관리자 승인 후 로그인 가능합니다.');
}
private function buildLogData(string $mbId, ?int $mbIdx): array
{
return [
'mb_idx' => $mbIdx,
'mb_id' => $mbId,
'mll_regdate' => date('Y-m-d H:i:s'),
'mll_ip' => $this->request->getIPAddress(),
'mll_useragent' => substr((string) $this->request->getUserAgent(), 0, 500),
'mll_url' => current_url(),
'mll_referer' => $this->request->getServer('HTTP_REFERER'),
];
}
private function insertMemberLog(array $data, bool $success, string $msg, ?int $mbIdx = null): void
{
$data['mll_success'] = $success ? 1 : 0;
$data['mll_msg'] = $msg;
if ($mbIdx !== null) {
$data['mb_idx'] = $mbIdx;
}
model(MemberLogModel::class)->insert($data);
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
*
* Extend this class in any new controllers:
* ```
* class Home extends BaseController
* ```
*
* For security, be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Load here all helpers you want to be available in your controllers that extend BaseController.
// Caution: Do not put the this below the parent::initController() call below.
// $this->helpers = ['form', 'url'];
// Caution: Do not edit this line.
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// $this->session = service('session');
}
}

107
app/Controllers/Home.php Normal file
View File

@@ -0,0 +1,107 @@
<?php
namespace App\Controllers;
use App\Models\LocalGovernmentModel;
class Home extends BaseController
{
public function index()
{
if (session()->get('logged_in')) {
return $this->dashboard();
}
return view('welcome_message');
}
/**
* 로그인 후 원래 메인 화면 (admin 유사 레이아웃 + site 메뉴 호버 드롭다운)
*/
public function dashboard()
{
return view('bag/daily_inventory');
}
/**
* 디자인 시안(기존 /dashboard 연결 화면)
*/
public function dashboardClassicMock()
{
return $this->renderDashboard();
}
/**
* 로그인 후 메인 — 모던형(세로 사이드바) 레이아웃. URL: /dashboard/modern
*/
public function dashboardModern()
{
return view('bag/lg_dashboard_modern', [
'lgLabel' => $this->resolveLgLabel(),
]);
}
/**
* 로그인 후 메인 — 정보 집약형 종합 현황. URL: /dashboard/dense
*/
public function dashboardDense()
{
return view('bag/lg_dashboard_dense', [
'lgLabel' => $this->resolveLgLabel(),
]);
}
/**
* 로그인 후 메인 — 그래프 중심(Chart.js). URL: /dashboard/charts
*/
public function dashboardCharts()
{
return view('bag/lg_dashboard_charts', [
'lgLabel' => $this->resolveLgLabel(),
]);
}
/**
* 재고 조회(수불) 화면 (목업)
*/
public function inventoryInquiry()
{
return view('bag/inventory_inquiry');
}
/**
* 종량제 수불 그리드 (엔터프라이즈형 목업, 상단 가로 메뉴 + 병합 헤더 표)
*/
public function wasteSuibalEnterprise()
{
return view('bag/waste_suibal_enterprise');
}
protected function renderDashboard()
{
return view('bag/lg_dashboard', [
'lgLabel' => $this->resolveLgLabel(),
]);
}
/**
* 세션 mb_lg_idx 기준 지자체명 (DB 없거나 실패 시 데모용 문구)
*/
protected function resolveLgLabel(): string
{
try {
$idx = session()->get('mb_lg_idx');
if ($idx === null || $idx === '') {
return '로그인 지자체 (미지정)';
}
$row = model(LocalGovernmentModel::class)->find((int) $idx);
if ($row && isset($row->lg_name) && $row->lg_name !== '') {
return (string) $row->lg_name;
}
} catch (\Throwable $e) {
// 테이블 미생성 등
}
return '북구 (데모)';
}
}

View File

View File

0
app/Filters/.gitkeep Normal file
View File

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Filters;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Roles;
/**
* 관리자 전용 접근 필터.
* logged_in 이고 mb_level 이 SUPER_ADMIN(4) 또는 LOCAL_ADMIN(3) 일 때만 통과.
*/
class AdminAuthFilter implements FilterInterface
{
public function before(RequestInterface $request, $arguments = null)
{
if (! session()->get('logged_in')) {
return redirect()->to(site_url('login'))->with('error', '로그인이 필요합니다.');
}
$level = (int) session()->get('mb_level');
if ($level !== Roles::LEVEL_SUPER_ADMIN && $level !== Roles::LEVEL_LOCAL_ADMIN) {
return redirect()->to(site_url('/'))->with('error', '관리자만 접근할 수 있습니다.');
}
// Super admin: 지자체 미선택 시 지자체 선택 페이지로 유도 (지자체 선택·지자체 CRUD는 미선택도 허용)
$uri = $request->getUri();
$seg2 = $uri->getSegment(2);
$allowedWithoutSelection = ['select-local-government', 'local-governments'];
if ($level === Roles::LEVEL_SUPER_ADMIN && ! in_array($seg2, $allowedWithoutSelection, true)) {
$selected = session()->get('admin_selected_lg_idx');
if ($selected === null || $selected === '') {
return redirect()->to(site_url('admin/select-local-government'))->with('error', '작업할 지자체를 먼저 선택해 주세요.');
}
}
helper('admin');
return null;
}
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
return $response;
}
}

0
app/Helpers/.gitkeep Normal file
View File

View File

@@ -0,0 +1,158 @@
<?php
declare(strict_types=1);
use Config\Roles;
if (! function_exists('admin_effective_lg_idx')) {
/**
* 현재 로그인한 관리자가 작업 대상으로 사용하는 지자체 PK.
* Super admin → admin_selected_lg_idx, 지자체 관리자 → mb_lg_idx, 그 외 null.
*/
function admin_effective_lg_idx(): ?int
{
$level = (int) session()->get('mb_level');
if ($level === Roles::LEVEL_SUPER_ADMIN) {
$idx = session()->get('admin_selected_lg_idx');
return $idx !== null && $idx !== '' ? (int) $idx : null;
}
if ($level === Roles::LEVEL_LOCAL_ADMIN) {
$idx = session()->get('mb_lg_idx');
return $idx !== null && $idx !== '' ? (int) $idx : null;
}
return null;
}
}
if (! function_exists('get_admin_nav_items')) {
/**
* 관리자 상단 메뉴 항목 (DB menu 테이블, admin 타입, 현재 지자체·mb_level 기준, 평면 배열).
* 지자체 미선택(super admin)이면 빈 배열. 테이블/조회 실패 시에도 빈 배열.
*
* 하위 메뉴 포함 트리 구조가 필요하면 get_admin_nav_tree() 사용.
*/
function get_admin_nav_items(): array
{
try {
$lgIdx = admin_effective_lg_idx();
if ($lgIdx === null) {
return [];
}
$typeRow = model(\App\Models\MenuTypeModel::class)->getByCode('admin');
if (! $typeRow) {
return [];
}
$mbLevel = (int) session()->get('mb_level');
return model(\App\Models\MenuModel::class)->getVisibleByLevel((int) $typeRow->mt_idx, $mbLevel, $lgIdx);
} catch (\Throwable $e) {
return [];
}
}
}
if (! function_exists('build_menu_tree')) {
/**
* menu 평면 배열을 mm_pidx/mm_idx 기준 트리로 변환.
*
* @param array<int,object> $items
* @return array<int,object> 루트 노드 배열
*/
function build_menu_tree(array $items): array
{
$map = [];
foreach ($items as $item) {
$item->children = [];
$map[(int) $item->mm_idx] = $item;
}
$roots = [];
foreach ($map as $id => $item) {
$pidx = (int) $item->mm_pidx;
if ($pidx === 0 || ! isset($map[$pidx])) {
$roots[] = $item;
} else {
$map[$pidx]->children[] = $item;
}
}
return $roots;
}
}
if (! function_exists('flatten_menu_tree')) {
/**
* 트리 구조의 메뉴를 상위 → 하위 순으로 평면 배열로 풀어낸다.
* 관리자 메뉴 목록 화면에서 "부모 바로 아래에 자식"이 나오도록 하기 위한 용도.
*
* @param array<int,object> $tree
* @return array<int,object>
*/
function flatten_menu_tree(array $tree): array
{
$result = [];
$walk = function ($nodes) use (&$result, &$walk) {
foreach ($nodes as $node) {
$children = $node->children ?? [];
// children 속성은 목록에서 사용하지 않으므로 제거
unset($node->children);
$result[] = $node;
if (! empty($children)) {
$walk($children);
}
}
};
$walk($tree);
return $result;
}
}
if (! function_exists('get_admin_nav_tree')) {
/**
* 관리자 상단 메뉴 트리 (admin 타입, 현재 지자체·mb_level 기준).
* 1차 메뉴는 mm_pidx=0, 하위 메뉴는 children 속성으로 접근.
*/
function get_admin_nav_tree(): array
{
$flat = get_admin_nav_items();
if (empty($flat)) {
return [];
}
return build_menu_tree($flat);
}
}
if (! function_exists('get_site_nav_tree')) {
/**
* 일반 사이트 상단 메뉴 트리 (site 타입, 현재 회원의 지자체·mb_level 기준).
* 1차 메뉴는 mm_pidx=0, 하위 메뉴는 children 속성으로 접근.
*/
function get_site_nav_tree(): array
{
try {
$lgIdx = session()->get('mb_lg_idx');
// 시민 등 지자체 정보가 세션에 없으면 기본 지자체(1) 기준으로 메뉴를 보여 준다.
if ($lgIdx === null || $lgIdx === '') {
$lgIdx = 1;
}
$typeRow = model(\App\Models\MenuTypeModel::class)->getByCode('site');
if (! $typeRow) {
return [];
}
$mbLevel = (int) session()->get('mb_level');
$menuModel = model(\App\Models\MenuModel::class);
$flat = $menuModel->getVisibleByLevel((int) $typeRow->mt_idx, $mbLevel, (int) $lgIdx);
// 현재 지자체에 site 메뉴가 없으면, 기본 지자체(1)의 메뉴를 한 번 복사한 뒤 다시 시도
if (empty($flat)) {
$menuModel->copyDefaultsFromLg((int) $typeRow->mt_idx, 1, (int) $lgIdx);
$flat = $menuModel->getVisibleByLevel((int) $typeRow->mt_idx, $mbLevel, (int) $lgIdx);
}
if (empty($flat)) {
return [];
}
return build_menu_tree($flat);
} catch (\Throwable $e) {
return [];
}
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
/**
* PII(개인정보) 필드 암호화/복호화 헬퍼.
* encryption.key 가 .env에 설정된 경우에만 동작. 키가 없으면 평문 유지(기존 데이터 호환).
*
* 저장 형식: 암호화된 값은 "ENC:" + base64(암호문) 으로 저장. "ENC:" 없으면 평문(기존)으로 간주.
*/
if (! function_exists('pii_encrypt')) {
function pii_encrypt(?string $value): string
{
if ($value === null || $value === '') {
return '';
}
try {
$config = config('Encryption');
if ($config->key === '') {
return $value;
}
$encrypter = service('encrypter');
$encrypted = $encrypter->encrypt($value);
return 'ENC:' . base64_encode($encrypted);
} catch (Throwable) {
return $value;
}
}
}
if (! function_exists('pii_decrypt')) {
function pii_decrypt(?string $value): string
{
if ($value === null || $value === '') {
return '';
}
if (strpos($value, 'ENC:') !== 0) {
return $value;
}
try {
$config = config('Encryption');
if ($config->key === '') {
return $value;
}
$encrypter = service('encrypter');
$raw = base64_decode(substr($value, 4), true);
if ($raw === false) {
return $value;
}
return $encrypter->decrypt($raw);
} catch (Throwable) {
return $value;
}
}
}
/** 암호화 대상 개인정보 필드 (member 테이블) */
if (! defined('PII_ENCRYPTED_FIELDS')) {
define('PII_ENCRYPTED_FIELDS', ['mb_phone', 'mb_email']);
}

0
app/Language/.gitkeep Normal file
View File

View File

@@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

0
app/Libraries/.gitkeep Normal file
View File

0
app/Models/.gitkeep Normal file
View File

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class DesignatedShopModel extends Model
{
protected $table = 'designated_shop';
protected $primaryKey = 'ds_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'ds_lg_idx',
'ds_mb_idx',
'ds_shop_no',
'ds_name',
'ds_biz_no',
'ds_rep_name',
'ds_va_number',
'ds_zip',
'ds_addr',
'ds_addr_jibun',
'ds_tel',
'ds_rep_phone',
'ds_email',
'ds_gugun_code',
'ds_designated_at',
'ds_state',
'ds_regdate',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class LocalGovernmentModel extends Model
{
protected $table = 'local_government';
protected $primaryKey = 'lg_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'lg_name',
'lg_code',
'lg_sido',
'lg_gugun',
'lg_addr',
'lg_state',
'lg_regdate',
];
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class MemberApprovalRequestModel extends Model
{
public const STATUS_PENDING = 'pending';
public const STATUS_APPROVED = 'approved';
public const STATUS_REJECTED = 'rejected';
protected $table = 'member_approval_request';
protected $primaryKey = 'mar_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'mb_idx',
'mar_requested_level',
'mar_status',
'mar_request_note',
'mar_reject_reason',
'mar_requested_at',
'mar_requested_by',
'mar_processed_at',
'mar_processed_by',
];
public function getLatestByMember(int $mbIdx): ?object
{
return $this->where('mb_idx', $mbIdx)
->orderBy('mar_idx', 'DESC')
->first();
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class MemberLogModel extends Model
{
protected $table = 'member_log';
protected $primaryKey = 'mll_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'mll_success',
'mb_idx',
'mb_id',
'mll_regdate',
'mll_ip',
'mll_msg',
'mll_useragent',
'mll_logout_date',
'mll_url',
'mll_referer',
'mll_country',
'at_token',
];
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class MemberModel extends Model
{
protected $table = 'member';
protected $primaryKey = 'mb_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'mb_id',
'mb_passwd',
'mb_name',
'mb_email',
'mb_phone',
'mb_lang',
'mb_level',
'mb_group',
'mb_lg_idx',
'mb_state',
'mb_regdate',
'mb_latestdate',
'mb_leavedate',
];
/**
* mb_id로 회원 조회
*/
public function findByLoginId(string $mbId): ?object
{
return $this->where('mb_id', $mbId)->first();
}
/**
* mb_id 중복 여부
*/
public function isIdExists(string $mbId): bool
{
return $this->where('mb_id', $mbId)->countAllResults() > 0;
}
}

192
app/Models/MenuModel.php Normal file
View File

@@ -0,0 +1,192 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class MenuModel extends Model
{
protected $table = 'menu';
protected $primaryKey = 'mm_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'mt_idx', 'lg_idx', 'mm_name', 'mm_link', 'mm_pidx', 'mm_dep', 'mm_num', 'mm_cnode',
'mm_level', 'mm_is_view',
];
/**
* 메뉴 종류·지자체별 전체 항목 (정렬: num)
*/
public function getAllByType(int $mtIdx, int $lgIdx): array
{
return $this->where('mt_idx', $mtIdx)
->where('lg_idx', $lgIdx)
->orderBy('mm_num', 'ASC')
->findAll();
}
/**
* 특정 mb_level에 노출할 메뉴만 필터링 (mm_is_view=Y, mm_level에 해당 레벨 포함 또는 빈값).
* lg_idx 기준 해당 지자체 메뉴만 대상. super admin(4)은 mm_level 무관하게 해당 지자체 메뉴 전체 노출.
*/
public function getVisibleByLevel(int $mtIdx, int $mbLevel, int $lgIdx): array
{
$all = $this->getAllByType($mtIdx, $lgIdx);
if ($mbLevel === \Config\Roles::LEVEL_SUPER_ADMIN) {
return array_values(array_filter($all, static fn ($row) => (string) $row->mm_is_view === 'Y'));
}
$levelStr = (string) $mbLevel;
$out = [];
foreach ($all as $row) {
if ((string) $row->mm_is_view !== 'Y') {
continue;
}
if ($row->mm_level === '' || $row->mm_level === null) {
$out[] = $row;
continue;
}
$levels = array_map('trim', explode(',', (string) $row->mm_level));
if (in_array($levelStr, $levels, true)) {
$out[] = $row;
}
}
return $out;
}
public function getItem(int $mmIdx): ?object
{
return $this->find($mmIdx);
}
/**
* 하위 메뉴 개수
*/
public function getChildCount(int $mmIdx): int
{
return $this->where('mm_pidx', $mmIdx)->countAllResults();
}
/**
* 순서 변경 (mm_idx 배열 순서대로 mm_num 부여). 해당 지자체 소속 메뉴만 갱신.
*/
public function setOrder(array $mmIdxList, int $lgIdx): void
{
foreach ($mmIdxList as $i => $mmIdx) {
$row = $this->find((int) $mmIdx);
if ($row && (int) $row->lg_idx === $lgIdx) {
$this->update((int) $mmIdx, ['mm_num' => $i]);
}
}
}
/**
* 추가 시 같은 레벨에서 mm_num 결정 (동일 지자체·메뉴종류·부모·깊이 기준)
*/
public function getNextNum(int $mtIdx, int $lgIdx, int $mmPidx, int $mmDep): int
{
return $this->where('mt_idx', $mtIdx)
->where('lg_idx', $lgIdx)
->where('mm_pidx', $mmPidx)
->where('mm_dep', $mmDep)
->countAllResults();
}
/**
* 해당 메뉴가 지정 지자체 소속인지 여부
*/
public function belongsToLg(int $mmIdx, int $lgIdx): bool
{
$row = $this->select('mm_idx')->where('mm_idx', $mmIdx)->where('lg_idx', $lgIdx)->first();
return $row !== null;
}
/**
* 자식 있으면 삭제 불가
*/
public function deleteSafe(int $mmIdx): array
{
$row = $this->find($mmIdx);
if (! $row) {
return ['ok' => false, 'msg' => '메뉴를 찾을 수 없습니다.'];
}
$childCount = $this->getChildCount($mmIdx);
if ($childCount > 0) {
return ['ok' => false, 'msg' => '하위 메뉴가 있으면 삭제할 수 없습니다.'];
}
$this->delete($mmIdx);
if ((int) $row->mm_pidx > 0) {
$this->updateCnode((int) $row->mm_pidx, -1);
}
return ['ok' => true];
}
public function updateCnode(int $mmPidx, int $delta): void
{
$row = $this->find($mmPidx);
if (! $row) {
return;
}
$newVal = max(0, (int) $row->mm_cnode + $delta);
$this->update($mmPidx, ['mm_cnode' => $newVal]);
}
/**
* 기본 지자체의 메뉴 구조를 다른 지자체로 복사.
* mt_idx, srcLg, destLg 조합으로 이미 메뉴가 있으면 아무 작업도 하지 않는다.
*
* 기본 정책: srcLg(예: 1번 지자체)에 템플릿 메뉴가 있고,
* destLg(예: 남구청)에는 아직 메뉴가 없을 때 호출.
*/
public function copyDefaultsFromLg(int $mtIdx, int $srcLg, int $destLg): void
{
if ($srcLg === $destLg) {
return;
}
// 이미 대상 지자체에 메뉴가 있으면 복사하지 않음
if ($this->where('mt_idx', $mtIdx)->where('lg_idx', $destLg)->countAllResults() > 0) {
return;
}
// 원본 메뉴(트리 전체) 조회
$source = $this->where('mt_idx', $mtIdx)
->where('lg_idx', $srcLg)
->orderBy('mm_dep', 'ASC')
->orderBy('mm_num', 'ASC')
->findAll();
if (empty($source)) {
return;
}
$idMap = [];
foreach ($source as $row) {
$oldId = (int) $row->mm_idx;
$oldP = (int) $row->mm_pidx;
$newPidx = 0;
if ($oldP > 0 && isset($idMap[$oldP])) {
$newPidx = $idMap[$oldP];
}
$data = [
'mt_idx' => $mtIdx,
'lg_idx' => $destLg,
'mm_name' => $row->mm_name,
'mm_link' => $row->mm_link,
'mm_pidx' => $newPidx,
'mm_dep' => $row->mm_dep,
'mm_num' => $row->mm_num,
'mm_cnode' => $row->mm_cnode,
'mm_level' => $row->mm_level,
'mm_is_view' => $row->mm_is_view,
];
$this->insert($data);
$newId = (int) $this->getInsertID();
$idMap[$oldId] = $newId;
}
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class MenuTypeModel extends Model
{
protected $table = 'menu_type';
protected $primaryKey = 'mt_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = ['mt_code', 'mt_name', 'mt_sort'];
public function getByCode(string $code): ?object
{
return $this->where('mt_code', $code)->first();
}
}

0
app/ThirdParty/.gitkeep vendored Normal file
View File

View File

@@ -0,0 +1,66 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">권한 승인 대기</span>
</section>
<div class="border border-gray-300 p-4 mt-2">
<form method="get" action="<?= base_url('admin/access/approvals') ?>" class="mb-4 flex flex-wrap items-center gap-2 text-sm">
<label for="status" class="font-bold text-gray-700 shrink-0">상태</label>
<select id="status" name="status" class="border border-gray-300 rounded px-3 py-1.5 text-sm min-w-[12rem] w-48 max-w-full">
<option value="pending" <?= ($status ?? 'pending') === 'pending' ? 'selected' : '' ?>>승인 대기</option>
<option value="approved" <?= ($status ?? '') === 'approved' ? 'selected' : '' ?>>승인 완료</option>
<option value="rejected" <?= ($status ?? '') === 'rejected' ? 'selected' : '' ?>>반려</option>
</select>
<button type="submit" class="bg-btn-search text-white px-3 py-1 rounded-sm text-xs">조회</button>
</form>
<table class="w-full data-table">
<thead>
<tr>
<th>요청일</th>
<th>아이디</th>
<th>이름</th>
<th>지자체</th>
<th>요청 역할</th>
<th>상태</th>
<th>처리일</th>
<th>관리</th>
</tr>
</thead>
<tbody>
<?php if (empty($list)): ?>
<tr><td colspan="8" class="text-center text-gray-500 py-4">해당 상태의 요청이 없습니다.</td></tr>
<?php else: ?>
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->mar_requested_at ?? '-') ?></td>
<td class="text-center"><?= esc($row->mb_id ?? '-') ?></td>
<td class="text-center"><?= esc($row->mb_name ?? '-') ?></td>
<td class="text-center"><?= esc($row->lg_name ?? '-') ?></td>
<td class="text-center"><?= esc($roles->getLevelName((int) $row->mar_requested_level)) ?></td>
<td class="text-center">
<?php if (($row->mar_status ?? '') === 'pending'): ?>승인 대기<?php endif; ?>
<?php if (($row->mar_status ?? '') === 'approved'): ?>승인 완료<?php endif; ?>
<?php if (($row->mar_status ?? '') === 'rejected'): ?>반려<?php endif; ?>
</td>
<td class="text-center"><?= esc($row->mar_processed_at ?? '-') ?></td>
<td class="text-center">
<?php if (($row->mar_status ?? '') === 'pending'): ?>
<div class="flex items-center justify-center gap-1">
<form action="<?= base_url('admin/access/approve/' . $row->mar_idx) ?>" method="post" class="inline">
<?= csrf_field() ?>
<button type="submit" class="bg-green-600 text-white px-2 py-1 text-xs rounded">승인</button>
</form>
<form action="<?= base_url('admin/access/reject/' . $row->mar_idx) ?>" method="post" class="inline flex items-center gap-1">
<?= csrf_field() ?>
<input type="text" name="reject_reason" placeholder="반려사유(선택)" class="border border-gray-300 rounded px-2 py-1 text-xs w-28"/>
<button type="submit" class="bg-red-600 text-white px-2 py-1 text-xs rounded">반려</button>
</form>
</div>
<?php else: ?>
<span class="text-gray-500">처리완료</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,37 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<div class="flex items-center gap-4 text-sm">
<label class="font-bold text-gray-700">조회기간:</label>
<form method="GET" action="<?= base_url('admin/access/login-history') ?>" class="flex items-center gap-2">
<input type="date" name="start" class="border border-gray-300 rounded px-2 py-1 text-sm" value="<?= esc($start ?? '') ?>"/>
<span>~</span>
<input type="date" name="end" class="border border-gray-300 rounded px-2 py-1 text-sm" value="<?= esc($end ?? '') ?>"/>
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">조회</button>
</form>
</div>
</div>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
<tr>
<th>일시</th>
<th>아이디</th>
<th>성공</th>
<th>IP</th>
<th>메시지</th>
</tr>
</thead>
<tbody class="text-right">
<?php foreach ($list as $row): ?>
<tr>
<td class="text-left pl-2"><?= esc($row->mll_regdate ?? '') ?></td>
<td class="text-left pl-2"><?= esc($row->mb_id ?? '') ?></td>
<td class="text-center"><?= ! empty($row->mll_success) ? '성공' : '실패' ?></td>
<td class="text-left pl-2"><?= esc($row->mll_ip ?? '') ?></td>
<td class="text-left pl-2"><?= esc($row->mll_msg ?? '') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,3 @@
<div class="border border-gray-300 p-4">
<p class="text-sm text-gray-600">관리자 메인 화면입니다. 상단 메뉴에서 기능을 선택하세요.</p>
</div>

View File

@@ -0,0 +1,102 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">지정판매소 등록</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
<form action="<?= base_url('admin/designated-shops/store') ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<?php if (! empty($localGovs)): ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지자체 <span class="text-red-500">*</span></label>
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="ds_lg_idx" required>
<option value="">선택</option>
<?php foreach ($localGovs as $lg): ?>
<option value="<?= esc($lg->lg_idx) ?>" <?= (string) old('ds_lg_idx') === (string) $lg->lg_idx ? 'selected' : '' ?>>
<?= esc($lg->lg_name) ?> (<?= esc($lg->lg_code) ?>)
</option>
<?php endforeach; ?>
</select>
</div>
<?php elseif (! empty($currentLg)): ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지자체</label>
<div class="text-sm">
<span class="font-semibold"><?= esc($currentLg->lg_name) ?></span>
<span class="text-gray-500 ml-2">(<?= esc($currentLg->lg_code) ?>)</span>
</div>
<input type="hidden" name="ds_lg_idx" value="<?= esc($currentLg->lg_idx) ?>"/>
</div>
<?php endif; ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">판매소번호</label>
<div class="text-sm text-gray-600">등록 시 자동 부여 (지자체코드 + 일련번호 3자리)</div>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">상호명 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-72" name="ds_name" type="text" value="<?= esc(old('ds_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">사업자번호 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_biz_no" type="text" value="<?= esc(old('ds_biz_no')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">대표자명 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_rep_name" type="text" value="<?= esc(old('ds_rep_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">가상계좌</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="ds_va_number" type="text" value="<?= esc(old('ds_va_number')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">우편번호</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-32" name="ds_zip" type="text" value="<?= esc(old('ds_zip')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">도로명주소</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="ds_addr" type="text" value="<?= esc(old('ds_addr')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지번주소</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="ds_addr_jibun" type="text" value="<?= esc(old('ds_addr_jibun')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">일반전화</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_tel" type="text" value="<?= esc(old('ds_tel')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">대표 휴대전화</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_rep_phone" type="text" value="<?= esc(old('ds_rep_phone')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">이메일</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="ds_email" type="email" value="<?= esc(old('ds_email')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">구코드</label>
<div class="text-sm text-gray-600">해당 지자체(구·군) 코드로 등록 시 자동 설정</div>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지정일자</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="ds_designated_at" type="date" value="<?= esc(old('ds_designated_at')) ?>"/>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
<a href="<?= base_url('admin/designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,105 @@
<?php
$shop = $shop ?? null;
$currentLg = $currentLg ?? null;
if ($shop === null) {
return;
}
$v = fn ($key, $default = '') => old($key) !== null && old($key) !== '' ? old($key) : ($shop->{$key} ?? $default);
?>
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">지정판매소 수정</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
<form action="<?= base_url('admin/designated-shops/update/' . (int) $shop->ds_idx) ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<?php if ($currentLg !== null): ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지자체</label>
<div class="text-sm">
<span class="font-semibold"><?= esc($currentLg->lg_name) ?></span>
<span class="text-gray-500 ml-2">(<?= esc($currentLg->lg_code) ?>)</span>
</div>
</div>
<?php endif; ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">판매소번호</label>
<div class="text-sm font-mono"><?= esc($shop->ds_shop_no) ?></div>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">구코드</label>
<div class="text-sm font-mono"><?= esc($shop->ds_gugun_code) ?></div>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">상호명 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-72" name="ds_name" type="text" value="<?= esc($v('ds_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">사업자번호 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_biz_no" type="text" value="<?= esc($v('ds_biz_no')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">대표자명 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_rep_name" type="text" value="<?= esc($v('ds_rep_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">가상계좌</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="ds_va_number" type="text" value="<?= esc($v('ds_va_number')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">우편번호</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-32" name="ds_zip" type="text" value="<?= esc($v('ds_zip')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">도로명주소</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="ds_addr" type="text" value="<?= esc($v('ds_addr')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지번주소</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-96" name="ds_addr_jibun" type="text" value="<?= esc($v('ds_addr_jibun')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">일반전화</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_tel" type="text" value="<?= esc($v('ds_tel')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">대표 휴대전화</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" name="ds_rep_phone" type="text" value="<?= esc($v('ds_rep_phone')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">이메일</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="ds_email" type="email" value="<?= esc($v('ds_email')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">지정일자</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="ds_designated_at" type="date" value="<?= esc($v('ds_designated_at')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-28">영업상태</label>
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="ds_state">
<option value="1" <?= (string) $v('ds_state', '1') === '1' ? 'selected' : '' ?>>정상</option>
<option value="2" <?= (string) $v('ds_state', '1') === '2' ? 'selected' : '' ?>>폐업</option>
<option value="3" <?= (string) $v('ds_state', '1') === '3' ? 'selected' : '' ?>>직권해지</option>
</select>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
<a href="<?= base_url('admin/designated-shops') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,47 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<span class="text-sm font-bold text-gray-700">지정판매소 목록</span>
<a href="<?= base_url('admin/designated-shops/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">지정판매소 등록</a>
</div>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
<tr>
<th class="w-16">번호</th>
<th>지자체</th>
<th>판매소번호</th>
<th>상호명</th>
<th>대표자</th>
<th>사업자번호</th>
<th>가상계좌</th>
<th>상태</th>
<th>등록일</th>
<th class="w-28">작업</th>
</tr>
</thead>
<tbody class="text-right">
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->ds_idx) ?></td>
<td class="text-left pl-2"><?= esc($lgMap[$row->ds_lg_idx] ?? '') ?></td>
<td class="text-left pl-2"><?= esc($row->ds_shop_no) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_name) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_rep_name) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_biz_no) ?></td>
<td class="text-left pl-2"><?= esc($row->ds_va_number) ?></td>
<td class="text-center"><?= (int) $row->ds_state === 1 ? '정상' : ((int) $row->ds_state === 2 ? '폐업' : '직권해지') ?></td>
<td class="text-left pl-2"><?= esc($row->ds_regdate ?? '') ?></td>
<td class="text-center">
<a href="<?= base_url('admin/designated-shops/edit/' . (int) $row->ds_idx) ?>" class="text-blue-600 hover:underline text-sm">수정</a>
<form action="<?= base_url('admin/designated-shops/delete/' . (int) $row->ds_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('이 지정판매소를 삭제하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

154
app/Views/admin/layout.php Normal file
View File

@@ -0,0 +1,154 @@
<?php
helper('admin');
$uriObj = service('request')->getUri();
$n = $uriObj->getTotalSegments();
$uri = $n >= 2 ? $uriObj->getSegment(2) : '';
$seg3 = $n >= 3 ? $uriObj->getSegment(3) : '';
$mbLevel = (int) session()->get('mb_level');
$isSuperAdmin = ($mbLevel === \Config\Roles::LEVEL_SUPER_ADMIN);
$effectiveLgIdx = admin_effective_lg_idx();
$effectiveLgName = null;
if ($effectiveLgIdx) {
$lgRow = model(\App\Models\LocalGovernmentModel::class)->find($effectiveLgIdx);
$effectiveLgName = $lgRow ? $lgRow->lg_name : null;
}
$currentPath = trim((string) $uriObj->getPath(), '/');
if (str_starts_with($currentPath, 'index.php/')) {
$currentPath = substr($currentPath, strlen('index.php/'));
}
$adminNavTree = get_admin_nav_tree();
$isActive = static function (string $path) use ($uri, $seg3, $currentPath, $adminNavTree) {
if (! empty($adminNavTree)) {
return $currentPath === trim($path, '/');
}
if ($path === 'admin' || $path === '') return $uri === '';
if ($path === 'users') return $uri === 'users';
if ($path === 'login-history') return $uri === 'access' && $seg3 === 'login-history';
if ($path === 'approvals') return $uri === 'access' && $seg3 === 'approvals';
if ($path === 'roles') return $uri === 'roles';
if ($path === 'menus') return $uri === 'menus';
if ($path === 'local-governments') return $uri === 'local-governments';
if ($path === 'select-local-government') return $uri === 'select-local-government';
if ($path === 'designated-shops') return $uri === 'designated-shops';
return false;
};
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title><?= esc($title ?? '관리자') ?> - 쓰레기봉투 물류시스템</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&amp;display=swap" rel="stylesheet"/>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: { sans: ['"Malgun Gothic"', '"Noto Sans KR"', 'sans-serif'] },
colors: {
'system-header': '#ffffff',
'title-bar': '#2c3e50',
'control-panel': '#f8f9fa',
'btn-search': '#1c4e80',
'btn-excel-border': '#28a745',
'btn-excel-text': '#28a745',
'btn-print-border': '#ced4da',
'btn-exit': '#d9534f',
},
fontSize: { 'xxs': '0.65rem' }
}
}
}
</script>
<style data-purpose="table-layout">
.data-table { width: 100%; border-collapse: collapse; font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif; }
.data-table th, .data-table td { border: 1px solid #ccc; padding: 4px 8px; white-space: nowrap; font-size: 13px; }
.data-table th { background-color: #e9ecef; text-align: center; vertical-align: middle; font-weight: bold; color: #333; }
.data-table tbody tr:nth-child(even) td { background-color: #f9f9f9; }
.data-table tbody tr:nth-child(even) { background-color: #f9f9f9; }
.data-table tbody tr:hover td { background-color: #e6f7ff !important; }
.main-content-area { height: calc(100vh - 170px); overflow: auto; }
body { overflow: hidden; }
</style>
</head>
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased select-none">
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0 z-20">
<div class="flex items-center gap-4">
<div class="flex items-center gap-2">
<div class="w-6 h-6 flex items-center justify-center shrink-0">
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
</svg>
</div>
<a href="<?= base_url('admin') ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
</div>
<nav class="hidden md:flex gap-5 text-sm font-medium text-gray-600">
<?php if (! empty($adminNavTree)): ?>
<?php foreach ($adminNavTree as $navItem): ?>
<?php $hasChildren = ! empty($navItem->children); ?>
<div class="relative group">
<a class="<?= $isActive($navItem->mm_link) ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
href="<?= base_url($navItem->mm_link) ?>">
<?= esc($navItem->mm_name) ?>
</a>
<?php if ($hasChildren): ?>
<div class="absolute left-0 top-full hidden group-hover:block bg-white border border-gray-200 rounded shadow-lg min-w-[10rem] z-30">
<?php foreach ($navItem->children as $child): ?>
<a href="<?= base_url($child->mm_link) ?>"
class="block px-3 py-1.5 text-sm text-gray-700 hover:bg-blue-50 whitespace-nowrap">
<?= esc($child->mm_name) ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php else: ?>
<a class="<?= $isActive('') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin') ?>">대시보드</a>
<a class="<?= $isActive('users') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/users') ?>">회원 관리</a>
<a class="<?= $isActive('login-history') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/access/login-history') ?>">로그인 이력</a>
<a class="<?= $isActive('approvals') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/access/approvals') ?>">승인 대기</a>
<a class="<?= $isActive('roles') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/roles') ?>">역할</a>
<a class="<?= $isActive('menus') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/menus') ?>">메뉴</a>
<?php if ($isSuperAdmin): ?>
<a class="<?= $isActive('select-local-government') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/select-local-government') ?>">지자체 전환</a>
<a class="<?= $isActive('local-governments') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/local-governments') ?>">지자체</a>
<?php endif; ?>
<a class="<?= $isActive('designated-shops') ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" href="<?= base_url('admin/designated-shops') ?>">지정판매소</a>
<?php endif; ?>
</nav>
</div>
<div class="flex items-center gap-3">
<?php if ($effectiveLgName !== null): ?>
<span class="text-sm text-gray-600" title="현재 작업 지자체"><?= esc($effectiveLgName) ?></span>
<?php endif; ?>
<a href="<?= base_url('/') ?>" class="text-gray-500 hover:text-blue-600 text-sm">사이트</a>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-red-600 transition-colors inline-block p-1 rounded hover:bg-red-50" title="로그아웃">
<svg class="h-5 w-5 inline" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"/></svg> 종료
</a>
</div>
</header>
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
<?= esc($title ?? '관리자') ?>
</div>
<?php if (session()->getFlashdata('success')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-green-50 text-green-700 text-sm" role="alert"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm" role="alert"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('errors')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm space-y-1" role="alert">
<?php foreach (session()->getFlashdata('errors') as $err): ?><p><?= esc($err) ?></p><?php endforeach; ?>
</div>
<?php endif; ?>
<main class="main-content-area flex-grow bg-white p-4">
<?= $content ?>
</main>
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 flex items-center justify-between shrink-0">
<span>쓰레기봉투 물류시스템 관리자</span>
<span><?= date('Y.m.d (D) g:i:sA') ?></span>
</footer>
</body>
</html>

View File

@@ -0,0 +1,40 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">지자체 등록</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-xl">
<form action="<?= base_url('admin/local-governments/store') ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-24">지자체명 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-60" name="lg_name" type="text" value="<?= esc(old('lg_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-24">코드 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="lg_code" type="text" value="<?= esc(old('lg_code')) ?>" required/>
<span class="text-xs text-gray-500">행정 코드 등 식별용</span>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-24">시/도 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="lg_sido" type="text" value="<?= esc(old('lg_sido')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-24">구/군 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40" name="lg_gugun" type="text" value="<?= esc(old('lg_gugun')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-24">주소</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-72" name="lg_addr" type="text" value="<?= esc(old('lg_addr')) ?>"/>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
<a href="<?= base_url('admin/local-governments') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,35 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<span class="text-sm font-bold text-gray-700">지자체 목록</span>
<a href="<?= base_url('admin/local-governments/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">지자체 등록</a>
</div>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
<tr>
<th class="w-16">번호</th>
<th>지자체명</th>
<th>코드</th>
<th>/</th>
<th>/</th>
<th>상태</th>
<th>등록일</th>
</tr>
</thead>
<tbody class="text-right">
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->lg_idx) ?></td>
<td class="text-left pl-2"><?= esc($row->lg_name) ?></td>
<td class="text-left pl-2"><?= esc($row->lg_code) ?></td>
<td class="text-left pl-2"><?= esc($row->lg_sido) ?></td>
<td class="text-left pl-2"><?= esc($row->lg_gugun) ?></td>
<td class="text-center"><?= (int) $row->lg_state === 1 ? '사용' : '미사용' ?></td>
<td class="text-left pl-2"><?= esc($row->lg_regdate ?? '') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,469 @@
<?php
$types = $types ?? [];
$list = $list ?? [];
$mtIdx = (int) ($mtIdx ?? 0);
$mtCode = (string) ($mtCode ?? '');
$levelNames = $levelNames ?? [];
$superAdminLevel = \Config\Roles::LEVEL_SUPER_ADMIN;
?>
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<span class="text-sm font-bold text-gray-700">메뉴 관리</span>
<div class="flex items-center gap-2">
<?php if (! empty($types)): ?>
<form method="get" action="<?= base_url('admin/menus') ?>" class="flex items-center gap-2">
<label class="text-sm font-medium text-gray-700">메뉴 종류</label>
<select name="mt_idx" onchange="this.form.submit()" class="border border-gray-300 rounded pl-2 pr-7 py-1 text-sm min-w-[8rem]">
<?php foreach ($types as $t): ?>
<option value="<?= (int) $t->mt_idx ?>" <?= $mtIdx === (int) $t->mt_idx ? 'selected' : '' ?>><?= esc($t->mt_name) ?></option>
<?php endforeach; ?>
</select>
</form>
<?php endif; ?>
</div>
</div>
</section>
<div class="flex gap-4 mt-2 flex-wrap">
<div class="border border-gray-300 bg-white rounded p-4 flex-1 min-w-0" style="min-width: 320px;">
<h3 class="text-sm font-bold text-gray-700 mb-2">메뉴 목록</h3>
<?php if ($mtIdx <= 0): ?>
<p class="text-sm text-gray-600">메뉴 종류를 선택하세요.</p>
<?php elseif (empty($list)): ?>
<p class="text-sm text-gray-600">등록된 메뉴가 없습니다. 아래에서 등록하세요.</p>
<?php else: ?>
<form id="menu-move-form" method="post" action="<?= base_url('admin/menus/move') ?>">
<?= csrf_field() ?>
<input type="hidden" name="mt_idx" value="<?= $mtIdx ?>"/>
<table class="data-table w-full">
<thead>
<tr>
<th class="w-20 text-center text-xs font-medium text-gray-600">순서변경</th>
<th class="w-10">#</th>
<th>메뉴명</th>
<th>링크</th>
<th>노출 대상</th>
<th>사용</th>
<th class="w-24">작업</th>
</tr>
</thead>
<tbody>
<?php foreach ($list as $i => $row): ?>
<tr class="menu-row" data-mm-idx="<?= (int) $row->mm_idx ?>" data-mm-pidx="<?= (int) $row->mm_pidx ?>" data-mm-dep="<?= (int) $row->mm_dep ?>">
<td class="text-center align-middle">
<span class="menu-drag-handle cursor-move text-gray-400 select-none" title="드래그해서 순서를 변경하세요">↕</span>
</td>
<td class="text-center">
<input type="hidden" name="mm_idx[]" value="<?= (int) $row->mm_idx ?>"/>
<span class="menu-order-no"><?= (int) $row->mm_num + 1 ?></span>
</td>
<td class="text-left pl-2" style="padding-left: <?= (int) $row->mm_dep * 12 + 8 ?>px;">
<?php $dep = (int) $row->mm_dep; ?>
<span class="text-xs text-gray-400">
<?php if ($dep === 0): ?>
<?php elseif ($dep === 1): ?>
<?php else: ?>
└─
<?php endif; ?>
</span>
<span class="ml-1"><?= esc($row->mm_name) ?></span>
</td>
<td class="text-left pl-2 text-xs"><?= esc($row->mm_link) ?></td>
<td class="text-left pl-2 text-xs">
<?php
if ((string) $row->mm_level === '') {
echo '전체';
} else {
$levels = array_filter(explode(',', $row->mm_level), fn ($lv) => (int) trim($lv) !== $superAdminLevel);
$labels = array_map(fn ($lv) => $levelNames[trim($lv)] ?? trim($lv), $levels);
echo esc(implode(', ', $labels) ?: '전체');
}
?>
</td>
<td class="text-center"><?= (string) $row->mm_is_view === 'Y' ? 'Y' : 'N' ?></td>
<td class="text-center">
<button type="button"
class="text-blue-600 hover:underline text-sm menu-edit"
data-id="<?= (int) $row->mm_idx ?>"
data-name="<?= esc($row->mm_name) ?>"
data-link="<?= esc($row->mm_link) ?>"
data-level="<?= esc($row->mm_level) ?>"
data-view="<?= (string) $row->mm_is_view ?>"
data-dep="<?= (int) $row->mm_dep ?>">
수정
</button>
<?php if ($dep === 0): ?>
<button type="button"
class="text-green-700 hover:underline text-sm ml-1 menu-add-child"
data-id="<?= (int) $row->mm_idx ?>"
data-dep="<?= (int) $row->mm_dep ?>">
하위 메뉴 추가
</button>
<?php endif; ?>
<form action="<?= base_url('admin/menus/delete/' . (int) $row->mm_idx) ?>" method="post" class="inline ml-1" onsubmit="return confirm('이 메뉴를 삭제하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline text-sm">삭제</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="mt-2">
<button type="submit" class="bg-gray-600 text-white px-3 py-1 rounded text-sm">순서 적용</button>
</div>
</form>
<?php endif; ?>
</div>
<div class="border border-gray-300 bg-white rounded p-4 w-80 shrink-0">
<h3 class="text-sm font-bold text-gray-700 mb-2" id="form-title">메뉴 등록</h3>
<form id="menu-form" method="post" action="<?= base_url('admin/menus/store') ?>">
<?= csrf_field() ?>
<input type="hidden" name="mt_idx" value="<?= $mtIdx ?>"/>
<input type="hidden" name="mm_pidx" value="0"/>
<input type="hidden" name="mm_dep" value="0"/>
<input type="hidden" name="mm_idx_edit" id="mm_idx_edit" value=""/>
<div class="space-y-2 mb-3">
<label class="block text-sm font-medium text-gray-700">메뉴명</label>
<input type="text" name="mm_name" id="mm_name" required class="border border-gray-300 rounded px-2 py-1 w-full text-sm" placeholder="예: 대시보드"/>
</div>
<div class="space-y-2 mb-3">
<label class="block text-sm font-medium text-gray-700">링크</label>
<input type="text" name="mm_link" id="mm_link" class="border border-gray-300 rounded px-2 py-1 w-full text-sm" placeholder="예: admin/users"/>
</div>
<div class="space-y-2 mb-3">
<label class="block text-sm font-medium text-gray-700">노출 대상</label>
<?php if ($mtCode === 'admin'): ?>
<p class="text-sm text-gray-600">관리자 메뉴는 <b>지자체관리자</b>에게만 노출됩니다. (고정)</p>
<?php else: ?>
<div class="flex flex-wrap gap-x-4 gap-y-1">
<label class="inline-flex items-center gap-1">
<input type="checkbox" name="mm_level_all" id="mm_level_all" value="1" checked/>
<span class="text-sm">전체</span>
</label>
<?php foreach ($levelNames as $lv => $name): ?>
<?php if ((int) $lv === $superAdminLevel) { continue; } ?>
<label class="inline-flex items-center gap-1 mm-level-label">
<input type="checkbox" name="mm_level[]" value="<?= (int) $lv ?>" class="mm-level-cb"/>
<span class="text-sm"><?= esc($name) ?></span>
</label>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="space-y-2 mb-3">
<label class="inline-flex items-center gap-1">
<input type="checkbox" name="mm_is_view" value="1" id="mm_is_view" checked/>
<span class="text-sm">노출</span>
</label>
</div>
<div class="flex gap-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded text-sm" id="btn-submit">등록</button>
<button type="button" class="bg-gray-200 text-gray-700 px-4 py-1.5 rounded text-sm" id="btn-cancel-edit" style="display:none;">취소</button>
</div>
</form>
</div>
</div>
<style>
tr.menu-row.dragging {
opacity: 0.35;
}
body.menu-row-dragging {
user-select: none;
cursor: move;
}
tr.menu-drop-placeholder td {
padding: 0;
border: 0;
}
.menu-drop-placeholder-box {
margin: 4px 0;
height: 34px;
border: 2px dashed #60a5fa;
border-radius: 6px;
background: #eff6ff;
color: #1d4ed8;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<script>
(function(){
const form = document.getElementById('menu-form');
const formTitle = document.getElementById('form-title');
const btnSubmit = document.getElementById('btn-submit');
const btnCancel = document.getElementById('btn-cancel-edit');
const editIdInput = document.getElementById('mm_idx_edit');
const mmPidxInput = form.querySelector('[name="mm_pidx"]');
const mmDepInput = form.querySelector('[name="mm_dep"]');
const levelAll = document.getElementById('mm_level_all');
const levelCbs = document.querySelectorAll('.mm-level-cb');
const isAdminType = '<?= esc($mtCode) ?>' === 'admin';
const moveForm = document.getElementById('menu-move-form');
const tbody = moveForm ? moveForm.querySelector('tbody') : null;
let draggingRow = null;
if (!isAdminType && levelAll) {
// "전체" 체크 시: 다른 체크 해제
levelAll.addEventListener('change', function(){
if (levelAll.checked) {
levelCbs.forEach(function(cb){ cb.checked = false; });
}
});
// 다른 체크 선택 시: "전체" 자동 해제
levelCbs.forEach(function(cb){
cb.addEventListener('change', function(){
if (cb.checked) levelAll.checked = false;
});
});
form.addEventListener('submit', function(){
if (!levelAll.checked) {
var checked = [];
levelCbs.forEach(function(cb){ if (cb.checked) checked.push(cb.value); });
if (checked.length === 0) levelAll.checked = true;
}
});
}
document.querySelectorAll('.menu-edit').forEach(function(btn){
btn.addEventListener('click', function(){
const id = this.dataset.id;
const name = this.dataset.name;
const link = this.dataset.link || '';
const level = (this.dataset.level || '').toString().trim();
const view = this.dataset.view || 'Y';
const dep = parseInt(this.dataset.dep || '0', 10);
form.action = '<?= base_url('admin/menus/update/') ?>' + id;
form.querySelector('[name="mm_name"]').value = name;
form.querySelector('[name="mm_link"]').value = link;
mmPidxInput.value = '0';
mmDepInput.value = String(dep);
if (!isAdminType && levelAll) {
levelAll.checked = (level === '');
levelCbs.forEach(function(cb){
cb.checked = level !== '' && level.split(',').indexOf(cb.value) >= 0;
cb.setAttribute('name', 'mm_level[]');
});
if (level !== '' && !Array.prototype.some.call(levelCbs, function(cb){ return cb.checked; })) {
levelAll.checked = true;
levelCbs.forEach(function(cb){ cb.checked = false; });
}
}
form.querySelector('[name="mm_is_view"]').checked = (view === 'Y');
editIdInput.value = id;
formTitle.textContent = '메뉴 수정';
btnSubmit.textContent = '수정';
btnCancel.style.display = 'inline-block';
});
});
// 하위 메뉴 추가
document.querySelectorAll('.menu-add-child').forEach(function(btn){
btn.addEventListener('click', function(){
const parentId = this.dataset.id;
const parentDep = parseInt(this.dataset.dep || '0', 10);
form.action = '<?= base_url('admin/menus/store') ?>';
form.reset();
form.querySelector('[name="mt_idx"]').value = '<?= $mtIdx ?>';
mmPidxInput.value = parentId;
mmDepInput.value = String(parentDep + 1);
editIdInput.value = '';
formTitle.textContent = '하위 메뉴 등록';
btnSubmit.textContent = '등록';
btnCancel.style.display = 'inline-block';
// 노출 기본값 재설정
form.querySelector('[name="mm_is_view"]').checked = true;
if (!isAdminType && levelAll) {
levelAll.checked = true;
levelCbs.forEach(function(cb){
cb.checked = false;
cb.setAttribute('name', 'mm_level[]');
});
}
document.getElementById('mm_name').focus();
});
});
btnCancel.addEventListener('click', function(){
form.action = '<?= base_url('admin/menus/store') ?>';
form.reset();
form.querySelector('[name="mt_idx"]').value = '<?= $mtIdx ?>';
mmPidxInput.value = '0';
mmDepInput.value = '0';
form.querySelector('[name="mm_is_view"]').checked = true;
if (!isAdminType && levelAll) {
levelAll.checked = true;
levelCbs.forEach(function(cb){ cb.checked = false; cb.setAttribute('name', 'mm_level[]'); });
}
editIdInput.value = '';
formTitle.textContent = '메뉴 등록';
btnSubmit.textContent = '등록';
btnCancel.style.display = 'none';
});
// 메뉴 목록 행 드래그 정렬 (마우스 이벤트 기반)
if (tbody) {
const colCount = document.querySelectorAll('.data-table thead th').length || 7;
const makePlaceholder = function() {
const tr = document.createElement('tr');
tr.className = 'menu-drop-placeholder';
const td = document.createElement('td');
td.colSpan = colCount;
td.innerHTML = '<div class="menu-drop-placeholder-box">여기에 놓기</div>';
tr.appendChild(td);
return tr;
};
const refreshOrderNos = function() {
tbody.querySelectorAll('tr.menu-row').forEach(function(row, idx){
const noEl = row.querySelector('.menu-order-no');
if (noEl) noEl.textContent = String(idx + 1);
});
};
let placeholderRow = null;
let originalOrderIds = [];
let rafId = null;
let lastClientY = 0;
let draggingActive = false;
const collectCurrentOrderIds = function() {
return Array.prototype.slice.call(tbody.querySelectorAll('tr.menu-row')).map(function(row){
const idInput = row.querySelector('input[name="mm_idx[]"]');
return idInput ? idInput.value : '';
}).filter(Boolean);
};
const restoreOrderByIds = function(ids) {
if (!ids.length) return;
const rowMap = {};
tbody.querySelectorAll('tr.menu-row').forEach(function(row){
const idInput = row.querySelector('input[name="mm_idx[]"]');
if (idInput) rowMap[idInput.value] = row;
});
ids.forEach(function(id){
if (rowMap[id]) tbody.appendChild(rowMap[id]);
});
refreshOrderNos();
};
const updatePlaceholderPosition = function() {
rafId = null;
if (!draggingActive || !draggingRow || !placeholderRow) return;
const rows = Array.prototype.slice.call(tbody.querySelectorAll('tr.menu-row:not(.dragging)'));
let placed = false;
for (var i = 0; i < rows.length; i += 1) {
var box = rows[i].getBoundingClientRect();
var triggerY = box.top + (box.height * 0.25);
if (lastClientY < triggerY) {
if (placeholderRow !== rows[i]) {
tbody.insertBefore(placeholderRow, rows[i]);
}
placed = true;
break;
}
}
if (!placed) {
tbody.appendChild(placeholderRow);
}
};
const onMouseMove = function(e) {
if (!draggingActive) return;
lastClientY = e.clientY;
if (!rafId) {
rafId = window.requestAnimationFrame(updatePlaceholderPosition);
}
};
const clearDragState = function() {
if (rafId) {
window.cancelAnimationFrame(rafId);
rafId = null;
}
document.body.classList.remove('menu-row-dragging');
window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('mouseup', onMouseUp);
if (draggingRow) {
draggingRow.classList.remove('dragging');
}
if (placeholderRow && placeholderRow.parentNode) {
placeholderRow.parentNode.removeChild(placeholderRow);
}
placeholderRow = null;
draggingRow = null;
draggingActive = false;
};
var onMouseUp = function() {
if (!draggingActive || !draggingRow || !placeholderRow) {
clearDragState();
return;
}
var prevRow = placeholderRow.previousElementSibling;
tbody.insertBefore(draggingRow, placeholderRow);
refreshOrderNos();
var draggedDep = parseInt(draggingRow.dataset.mmDep || '0', 10);
var draggedPidx = parseInt(draggingRow.dataset.mmPidx || '0', 10);
if (draggedDep > 0) {
var valid = false;
if (prevRow && prevRow.classList.contains('menu-row')) {
var prevIdx = parseInt(prevRow.dataset.mmIdx || '0', 10);
var prevPidx = parseInt(prevRow.dataset.mmPidx || '0', 10);
if (prevRow === draggingRow) {
valid = true;
} else if (prevIdx === draggedPidx || prevPidx === draggedPidx) {
valid = true;
}
}
if (!valid) {
alert('하위 메뉴는 다른 상위 메뉴에는 들어갈 수 없습니다.');
restoreOrderByIds(originalOrderIds);
clearDragState();
return;
}
}
const approved = window.confirm('변경한 순서를 적용할까요?');
if (!approved) {
restoreOrderByIds(originalOrderIds);
} else {
moveForm.submit();
}
clearDragState();
};
tbody.querySelectorAll('.menu-drag-handle').forEach(function(handle){
handle.addEventListener('mousedown', function(e){
if (e.button !== 0) return;
const row = handle.closest('tr.menu-row');
if (!row) return;
e.preventDefault();
originalOrderIds = collectCurrentOrderIds();
draggingRow = row;
placeholderRow = makePlaceholder();
draggingActive = true;
row.classList.add('dragging');
document.body.classList.add('menu-row-dragging');
tbody.insertBefore(placeholderRow, row.nextSibling);
lastClientY = e.clientY;
updatePlaceholderPosition();
window.addEventListener('mousemove', onMouseMove, { passive: true });
window.addEventListener('mouseup', onMouseUp);
});
});
}
})();
</script>

View File

@@ -0,0 +1,22 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">역할 (mb_level)</span>
</section>
<div class="border border-gray-300 p-4 mt-2">
<p class="text-sm text-gray-600 mb-4">Config\Roles 기반 역할 목록입니다.</p>
<table class="w-full data-table">
<thead>
<tr>
<th class="w-24">코드</th>
<th>이름</th>
</tr>
</thead>
<tbody>
<?php foreach ($roles->levelNames as $code => $name): ?>
<tr>
<td class="text-center"><?= (int) $code ?></td>
<td class="text-left pl-2"><?= esc($name) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,21 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<p class="text-sm text-gray-700 mb-2">관리자 페이지에서 사용할 지자체를 선택하세요. 선택한 지자체 기준으로 목록·등록이 표시됩니다.</p>
</section>
<div class="border border-gray-300 overflow-auto mt-2 p-4">
<?php if (empty($list)): ?>
<p class="text-gray-600 py-4">등록된 지자체가 없습니다. <a href="<?= base_url('admin/local-governments') ?>" class="text-blue-600 hover:underline">지자체 관리</a>에서 먼저 등록하세요.</p>
<?php else: ?>
<form action="<?= base_url('admin/select-local-government') ?>" method="POST" class="space-y-3">
<?= csrf_field() ?>
<ul class="space-y-2">
<?php foreach ($list as $lg): ?>
<li class="flex items-center gap-2">
<input type="radio" name="lg_idx" id="lg_<?= $lg->lg_idx ?>" value="<?= (int) $lg->lg_idx ?>" class="rounded border-gray-300 text-blue-600 focus:ring-blue-500"/>
<label for="lg_<?= $lg->lg_idx ?>" class="text-sm font-medium text-gray-800 cursor-pointer"><?= esc($lg->lg_name) ?> (<?= esc($lg->lg_code) ?>)</label>
</li>
<?php endforeach; ?>
</ul>
<button type="submit" class="bg-btn-search text-white px-4 py-2 rounded-sm text-sm font-medium shadow hover:opacity-90 transition">선택하고 관리자 페이지로 이동</button>
</form>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,40 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">회원 등록</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-xl">
<form action="<?= base_url('admin/users/store') ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">아이디 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_id" name="mb_id" type="text" value="<?= esc(old('mb_id')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">비밀번호 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_passwd" name="mb_passwd" type="password" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">이름 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_name" name="mb_name" type="text" value="<?= esc(old('mb_name')) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">이메일</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_email" name="mb_email" type="email" value="<?= esc(old('mb_email')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">연락처</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_phone" name="mb_phone" type="text" value="<?= esc(old('mb_phone')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">역할 <span class="text-red-500">*</span></label>
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_level" name="mb_level" required>
<?php foreach (($assignableLevels ?? $roles->levelNames) as $lv => $name): ?>
<option value="<?= $lv ?>" <?= (string) old('mb_level') === (string) $lv ? 'selected' : '' ?>><?= esc($name) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">등록</button>
<a href="<?= base_url('admin/users') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,48 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<span class="text-sm font-bold text-gray-700">회원 수정</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-xl">
<form action="<?= base_url('admin/users/update/' . $member->mb_idx) ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">아이디 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_id" name="mb_id" type="text" value="<?= esc(old('mb_id', $member->mb_id)) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">비밀번호</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_passwd" name="mb_passwd" type="password" placeholder="변경 시에만 입력"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">이름 <span class="text-red-500">*</span></label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_name" name="mb_name" type="text" value="<?= esc(old('mb_name', $member->mb_name)) ?>" required/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">이메일</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_email" name="mb_email" type="email" value="<?= esc(old('mb_email', $member->mb_email ?? '')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">연락처</label>
<input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_phone" name="mb_phone" type="text" value="<?= esc(old('mb_phone', $member->mb_phone ?? '')) ?>"/>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">역할 <span class="text-red-500">*</span></label>
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-48" id="mb_level" name="mb_level" required>
<?php foreach (($assignableLevels ?? $roles->levelNames) as $lv => $name): ?>
<option value="<?= $lv ?>" <?= (string) old('mb_level', (string) $member->mb_level) === (string) $lv ? 'selected' : '' ?>><?= esc($name) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="flex flex-wrap items-center gap-2">
<label class="block text-sm font-bold text-gray-700 w-20">상태 <span class="text-red-500">*</span></label>
<select class="border border-gray-300 rounded px-3 py-1.5 text-sm min-w-[12rem] w-56 max-w-full" id="mb_state" name="mb_state" required>
<option value="1" <?= (int) old('mb_state', (int) $member->mb_state) === 1 ? 'selected' : '' ?>>정상</option>
<option value="2" <?= (int) old('mb_state', (int) $member->mb_state) === 2 ? 'selected' : '' ?>>정지</option>
<option value="0" <?= (int) old('mb_state', (int) $member->mb_state) === 0 ? 'selected' : '' ?>>탈퇴</option>
</select>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">저장</button>
<a href="<?= base_url('admin/users') ?>" class="bg-white text-black border border-btn-print-border px-4 py-1.5 rounded-sm text-sm shadow hover:bg-gray-50 transition">목록</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,55 @@
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<span class="text-sm font-bold text-gray-700">회원 목록</span>
<a href="<?= base_url('admin/users/create') ?>" class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">회원 등록</a>
</div>
</section>
<div class="border border-gray-300 overflow-auto mt-2">
<table class="w-full data-table">
<thead>
<tr>
<th class="w-16">번호</th>
<th>아이디</th>
<th>이름</th>
<th>이메일</th>
<th>역할</th>
<th>상태</th>
<th>가입일</th>
<th>관리</th>
</tr>
</thead>
<tbody class="text-right">
<?php foreach ($list as $row): ?>
<tr>
<td class="text-center"><?= esc($row->mb_idx) ?></td>
<td class="text-left pl-2"><?= esc($row->mb_id) ?></td>
<td class="text-left pl-2"><?= esc($row->mb_name) ?></td>
<td class="text-left pl-2"><?= esc($row->mb_email ?? '') ?></td>
<td class="text-center"><?= esc($roles->getLevelName((int) $row->mb_level)) ?></td>
<td class="text-center">
<?php
$approvalStatus = $approvalMap[(int) $row->mb_idx] ?? null;
if ($approvalStatus === 'pending') {
echo '승인대기';
} elseif ($approvalStatus === 'rejected') {
echo '승인반려';
} else {
echo ((int) $row->mb_state === 1 ? '정상' : ((int) $row->mb_state === 2 ? '정지' : '탈퇴'));
}
?>
</td>
<td class="text-left pl-2"><?= esc($row->mb_regdate ?? '') ?></td>
<td class="text-center">
<?php if ((int) $row->mb_state !== 0): ?>
<a href="<?= base_url('admin/users/edit/' . $row->mb_idx) ?>" class="text-blue-600 hover:underline">수정</a>
<form action="<?= base_url('admin/users/delete/' . $row->mb_idx) ?>" method="POST" class="inline ml-1" onsubmit="return confirm('탈퇴 처리하시겠습니까?');">
<?= csrf_field() ?>
<button type="submit" class="text-red-600 hover:underline">삭제</button>
</form>
<?php else: ?>—<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

73
app/Views/auth/login.php Normal file
View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>로그인 - 쓰레기봉투 물류시스템</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&amp;display=swap" rel="stylesheet"/>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: { sans: ['"Malgun Gothic"', '"Noto Sans KR"', 'sans-serif'] },
colors: {
'system-header': '#ffffff',
'title-bar': '#2c3e50',
'control-panel': '#f8f9fa',
'btn-search': '#1c4e80',
'btn-exit': '#d9534f',
}
}
}
}
</script>
<style>body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }</style>
</head>
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased">
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0">
<div class="flex items-center gap-2">
<div class="w-6 h-6 flex items-center justify-center shrink-0">
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
</svg>
</div>
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
</div>
</header>
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
로그인
</div>
<?php if (session()->getFlashdata('success')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-green-50 text-green-700 text-sm" role="alert"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm" role="alert"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('errors')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm space-y-1" role="alert">
<?php foreach (session()->getFlashdata('errors') as $error): ?><p><?= esc($error) ?></p><?php endforeach; ?>
</div>
<?php endif; ?>
<main class="flex-grow bg-control-panel border-b border-gray-300 p-6 flex items-center justify-center">
<section class="w-full max-w-md bg-white border border-gray-300 rounded shadow-sm p-6">
<form action="<?= base_url('login') ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="login_id">아이디</label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="login_id" name="login_id" type="text" placeholder="아이디" value="<?= esc(old('login_id')) ?>" autocomplete="username" autofocus/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="password">비밀번호</label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="password" name="password" type="password" placeholder="비밀번호" autocomplete="current-password"/>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-2 rounded-sm text-sm font-medium shadow hover:opacity-90 transition border border-transparent">로그인</button>
<a href="<?= base_url('register') ?>" class="bg-white text-gray-700 border border-gray-300 px-4 py-2 rounded-sm text-sm shadow hover:bg-gray-50 transition">회원가입</a>
</div>
</form>
</section>
</main>
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">쓰레기봉투 물류시스템</footer>
</body>
</html>

107
app/Views/auth/register.php Normal file
View File

@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>회원가입 - 쓰레기봉투 물류시스템</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&amp;display=swap" rel="stylesheet"/>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: { sans: ['"Malgun Gothic"', '"Noto Sans KR"', 'sans-serif'] },
colors: {
'system-header': '#ffffff',
'title-bar': '#2c3e50',
'control-panel': '#f8f9fa',
'btn-search': '#1c4e80',
'btn-exit': '#d9534f',
}
}
}
}
</script>
<style>body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }</style>
</head>
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen font-sans antialiased">
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0">
<div class="flex items-center gap-2">
<div class="w-6 h-6 flex items-center justify-center shrink-0">
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#2563eb"/><rect x="2" y="2" width="7" height="7" fill="white"/><rect x="5" y="5" width="9" height="9" fill="white"/>
</svg>
</div>
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
</div>
</header>
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium shrink-0">
회원가입
</div>
<?php if (session()->getFlashdata('error')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm" role="alert"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('errors')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-red-50 text-red-700 text-sm space-y-1" role="alert">
<?php foreach (session()->getFlashdata('errors') as $error): ?><p><?= esc($error) ?></p><?php endforeach; ?>
</div>
<?php endif; ?>
<main class="flex-grow bg-control-panel border-b border-gray-300 p-6 overflow-auto">
<section class="w-full max-w-md mx-auto bg-white border border-gray-300 rounded shadow-sm p-6">
<form action="<?= base_url('register') ?>" method="POST" class="space-y-4">
<?= csrf_field() ?>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_id">아이디 <span class="text-red-500">*</span></label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_id" name="mb_id" type="text" value="<?= esc(old('mb_id')) ?>" autocomplete="username" autofocus/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_passwd">비밀번호 <span class="text-red-500">*</span></label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_passwd" name="mb_passwd" type="password" autocomplete="new-password"/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_passwd_confirm">비밀번호 확인 <span class="text-red-500">*</span></label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_passwd_confirm" name="mb_passwd_confirm" type="password" autocomplete="new-password"/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_name">이름 <span class="text-red-500">*</span></label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_name" name="mb_name" type="text" value="<?= esc(old('mb_name')) ?>" autocomplete="name"/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_email">이메일</label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_email" name="mb_email" type="email" value="<?= esc(old('mb_email')) ?>"/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_phone">연락처</label>
<input class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_phone" name="mb_phone" type="tel" value="<?= esc(old('mb_phone')) ?>"/>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_lg_idx">지자체</label>
<select class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_lg_idx" name="mb_lg_idx">
<option value="">선택 안 함</option>
<?php if (! empty($localGovernments)): ?>
<?php foreach ($localGovernments as $lg): ?>
<option value="<?= $lg->lg_idx ?>" <?= (string) old('mb_lg_idx') === (string) $lg->lg_idx ? 'selected' : '' ?>><?= esc($lg->lg_name) ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
<div>
<label class="block text-sm font-bold text-gray-700 mb-1" for="mb_level">사용자 역할 <span class="text-red-500">*</span></label>
<select class="block w-full border border-gray-300 rounded px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500" id="mb_level" name="mb_level">
<?php foreach (config('Roles')->levelNames as $level => $name): ?>
<?php if ((int) $level === \Config\Roles::LEVEL_SUPER_ADMIN) continue; ?>
<option value="<?= $level ?>" <?= old('mb_level', config('Roles')->defaultLevelForSelfRegister) == $level ? 'selected' : '' ?>><?= esc($name) ?></option>
<?php endforeach; ?>
</select>
<p class="text-xs text-gray-500 mt-1">가입 후 관리자 승인 완료 시 로그인할 수 있습니다.</p>
</div>
<div class="flex gap-2 pt-2">
<button type="submit" class="bg-btn-search text-white px-4 py-2 rounded-sm text-sm font-medium shadow hover:opacity-90 transition">가입하기</button>
<a href="<?= base_url('login') ?>" class="bg-white text-gray-700 border border-gray-300 px-4 py-2 rounded-sm text-sm shadow hover:bg-gray-50 transition">로그인</a>
</div>
</form>
</section>
</main>
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 shrink-0">쓰레기봉투 물류시스템</footer>
</body>
</html>

View File

@@ -0,0 +1,637 @@
<?php
helper('admin');
$siteNavTree = get_site_nav_tree();
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>쓰레기봉투 물류시스템</title>
<!-- Tailwind CSS v3 with Plugins -->
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<!-- Font: Noto Sans KR -->
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&amp;display=swap" rel="stylesheet"/>
<!-- Tailwind Configuration for Custom Colors and Fonts -->
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['"Malgun Gothic"', '"Noto Sans KR"', 'sans-serif'],
},
colors: {
'system-header': '#ffffff',
'title-bar': '#2c3e50',
'control-panel': '#f8f9fa',
'btn-search': '#1c4e80',
'btn-excel-border': '#28a745',
'btn-excel-text': '#28a745',
'btn-print-border': '#ced4da',
'btn-print-text': '#000000',
'btn-exit': '#d9534f',
},
fontSize: {
'xxs': '0.65rem',
}
}
}
}
</script>
<!-- Custom CSS for Table Specifics and Scrollbars -->
<style data-purpose="table-layout">
/* High density table styles */
.data-table {
width: 100%;
border-collapse: collapse;
font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}
.data-table th, .data-table td {
border: 1px solid #ccc;
padding: 4px 8px;
white-space: nowrap;
font-size: 13px;
}
.data-table th {
background-color: #e9ecef;
text-align: center;
vertical-align: middle;
font-weight: bold;
color: #333;
}
/* Zebra striping */
.data-table tbody tr:nth-child(even) td:not([rowspan]) {
background-color: #f9f9f9;
}
.data-table tbody tr:nth-child(even) {
background-color: #f9f9f9;
}
.data-table tbody tr:hover td {
background-color: #e6f7ff !important;
}
/* Column specific alignments handled by classes in HTML, but defaults: */
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
/* Layout utilities */
body {
overflow: hidden;
}
.main-content-area {
height: calc(100vh - 170px);
overflow: auto;
}
</style>
</head>
<body class="bg-gray-100 text-gray-800 flex flex-col h-screen select-none">
<!-- BEGIN: Top Navigation -->
<header class="bg-white border-b border-gray-300 h-12 flex items-center justify-between px-4 shrink-0 z-20">
<div class="flex items-center gap-4">
<!-- Logo: 파란색 사각형에 흰색 사각형 두 개 겹친 형태 (데스크톱 앱 아이콘 스타일) -->
<div class="flex items-center gap-2">
<div class="w-6 h-6 flex items-center justify-center shrink-0">
<svg class="h-5 w-5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#2563eb"/>
<rect x="2" y="2" width="7" height="7" fill="white"/>
<rect x="5" y="5" width="9" height="9" fill="white"/>
</svg>
</div>
<a href="<?= base_url() ?>" class="text-base font-semibold text-gray-800 tracking-tight hover:text-blue-600">쓰레기봉투 물류시스템</a>
</div>
</div>
<!-- Nav Links -->
<nav class="hidden md:flex gap-5 text-sm font-medium text-gray-600">
<?php if (! empty($siteNavTree)): ?>
<?php
$uriObj = service('request')->getUri();
$currentPath = trim((string) $uriObj->getPath(), '/');
if (str_starts_with($currentPath, 'index.php/')) {
$currentPath = substr($currentPath, strlen('index.php/'));
}
?>
<?php foreach ($siteNavTree as $navItem): ?>
<?php $isActive = ($currentPath === trim((string) $navItem->mm_link, '/')); ?>
<div class="relative group">
<a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
href="<?= base_url($navItem->mm_link) ?>">
<?= esc($navItem->mm_name) ?>
</a>
<?php if (! empty($navItem->children)): ?>
<div class="absolute left-0 top-full hidden group-hover:block bg-white border border-gray-200 rounded shadow-lg min-w-[10rem] z-30">
<?php foreach ($navItem->children as $child): ?>
<a href="<?= base_url($child->mm_link) ?>"
class="block px-3 py-1.5 text-sm text-gray-700 hover:bg-blue-50 whitespace-nowrap">
<?= esc($child->mm_name) ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php else: ?>
<!-- DB 메뉴 미구현 시 기존 더미 메뉴 사용 -->
<a class="hover:text-blue-600" href="#">기본정보관리</a>
<a class="hover:text-blue-600" href="#">발주 입고 관리</a>
<a class="hover:text-blue-600" href="#">불출 관리</a>
<a class="text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3" href="#">재고 관리</a>
<a class="hover:text-blue-600" href="#">판매 관리</a>
<a class="hover:text-blue-600" href="#">판매 현황</a>
<a class="hover:text-blue-600" href="#">봉투 수불 관리</a>
<a class="hover:text-blue-600" href="#">통계 분석 관리</a>
<a class="hover:text-blue-600" href="#">창</a>
<a class="hover:text-blue-600" href="#">도움말</a>
<?php endif; ?>
</nav>
<?php
$mbLevel = (int) session()->get('mb_level');
$isAdmin = ($mbLevel === \Config\Roles::LEVEL_SUPER_ADMIN || $mbLevel === \Config\Roles::LEVEL_LOCAL_ADMIN);
?>
<!-- 관리자 이동 버튼(관리자만) · 종료 -->
<div class="flex items-center gap-2">
<?php if ($isAdmin): ?>
<a href="<?= base_url('admin') ?>" class="bg-btn-search text-white px-3 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent" title="관리자">관리자</a>
<?php endif; ?>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-red-600 transition-colors inline-block p-1 rounded hover:bg-red-50" title="로그아웃">
<svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</a>
</div>
</header>
<!-- END: Top Navigation -->
<?php if (session()->getFlashdata('success')): ?>
<div class="mx-4 mt-2 p-3 rounded-lg bg-green-50 text-green-700 text-sm" role="alert">
<?= esc(session()->getFlashdata('success')) ?>
</div>
<?php endif; ?>
<!-- BEGIN: Title Bar -->
<div class="bg-title-bar text-white px-4 py-2 text-sm font-medium flex items-center shrink-0 w-full">
<span class="opacity-80 mr-2">[w_gm804r]</span>
<span>일일 봉투 수불 현황</span>
</div>
<!-- END: Title Bar -->
<!-- BEGIN: Control Panel -->
<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
<div class="flex flex-wrap items-center justify-between gap-y-2">
<!-- Filter Inputs -->
<div class="flex items-center gap-4 text-sm whitespace-nowrap overflow-x-auto pb-1 md:pb-0">
<div class="flex items-center gap-2">
<label class="font-bold text-gray-700">조회기간:</label>
<div class="flex items-center bg-white border border-gray-300 rounded px-2 py-1">
<input class="w-24 text-center border-none p-0 focus:ring-0 text-sm" type="text" value="2024.01.01"/>
<span class="mx-1">~</span>
<input class="w-24 text-center border-none p-0 focus:ring-0 text-sm" type="text" value="2025.12.12"/>
<svg class="w-4 h-4 text-gray-400 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg>
</div>
</div>
<div class="flex items-center gap-2">
<label class="font-bold text-gray-700">봉투구분:</label>
<select class="border border-gray-300 rounded py-1 pl-2 pr-8 text-sm focus:ring-blue-500 focus:border-blue-500">
<option>전체</option>
</select>
</div>
<div class="flex items-center gap-2">
<label class="font-bold text-gray-700">봉투형식:</label>
<select class="border border-gray-300 rounded py-1 pl-2 pr-8 text-sm focus:ring-blue-500 focus:border-blue-500">
<option>전체 봉투</option>
</select>
</div>
<div class="flex items-center gap-2">
<label class="font-bold text-gray-700">대행소:</label>
<select class="border border-gray-300 rounded py-1 pl-2 pr-8 text-sm focus:ring-blue-500 focus:border-blue-500">
<option>북구</option>
</select>
</div>
</div>
<!-- Action Buttons -->
<div class="flex items-center gap-1.5 ml-auto">
<button class="bg-btn-search text-white px-4 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:opacity-90 transition border border-transparent">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg>
조회
</button>
<button class="bg-white text-btn-excel-text border border-btn-excel-border px-3 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:bg-green-50 transition">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 2l5 5h-5V4zM6 20V4h5v7h7v9H6z"></path></svg>
엑셀저장
</button>
<button class="bg-white text-black border border-btn-print-border px-3 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:bg-gray-50 transition">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg>
인쇄
</button>
<a href="<?= base_url('logout') ?>" class="bg-btn-exit text-white px-3 py-1.5 rounded-sm flex items-center gap-1 text-sm shadow hover:bg-red-700 transition border border-transparent">
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"></path></svg>
종료
</a>
</div>
</div>
</section>
<!-- END: Control Panel -->
<!-- BEGIN: Main Content Area (Table) -->
<main class="main-content-area flex-grow bg-white p-2">
<div class="border border-gray-300 h-full overflow-auto">
<table class="w-full data-table border-collapse">
<!-- BEGIN: Table Head -->
<thead><tr>
<th class="w-[100px] bg-gray-100 border border-gray-300" rowspan="2">일자</th>
<th class="min-w-[200px] bg-gray-100 border border-gray-300" rowspan="2">품 목</th>
<th class="w-[80px] bg-gray-100 border border-gray-300" rowspan="2">전일재고</th>
<th class="bg-gray-100 border border-gray-300" colspan="3">입고</th>
<th class="bg-gray-100 border border-gray-300" colspan="5">출고</th>
<th class="w-[80px] bg-gray-100 border border-gray-300" rowspan="2">잔량</th>
</tr>
<tr>
<!-- Under 입고 -->
<th class="w-[80px] bg-gray-100 border border-gray-300">입고</th>
<th class="w-[80px] bg-gray-100 border border-gray-300">반품</th>
<th class="w-[80px] bg-gray-100 border border-gray-300">입고계</th>
<!-- Under 출고 -->
<th class="w-[80px] bg-gray-100 border border-gray-300">판매</th>
<th class="w-[120px] bg-gray-100 border border-gray-300">일반불출/무료불출</th>
<th class="w-[80px] bg-gray-100 border border-gray-300">반품</th>
<th class="w-[80px] bg-gray-100 border border-gray-300">기타</th>
<th class="w-[80px] bg-gray-100 border border-gray-300">출고계</th>
</tr></thead>
<!-- END: Table Head -->
<!-- BEGIN: Table Body -->
<tbody class="text-right"><!-- Row 1 -->
<tr>
<td class="align-top text-center bg-white" rowspan="22">2024.01.01</td>
<td class="text-left pl-2">일반용 5L</td>
<td class="text-right pr-2">187,240</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">187,240</td>
</tr>
<!-- Row 2 -->
<tr>
<td class="text-left pl-2">일반용 5L</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">0</td>
</tr>
<!-- Row 3 -->
<tr>
<td class="text-left pl-2">일반용 10L</td>
<td class="text-right pr-2">159,428</td>
<td class="text-right pr-2">252,000</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">252,800</td>
<td class="text-right pr-2">8,580</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">8,580</td>
<td class="text-right pr-2 bg-gray-50">8,990</td>
<td class="text-right pr-2">402,848</td>
</tr>
<!-- Row 4 -->
<tr>
<td class="text-left pl-2">일반용 20L</td>
<td class="text-right pr-2">212,082</td>
<td class="text-right pr-2">201,000</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">201,600</td>
<td class="text-right pr-2">11,320</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">11,320</td>
<td class="text-right pr-2 bg-gray-50">11,320</td>
<td class="text-right pr-2">402,365</td>
</tr>
<!-- Row 5 -->
<tr>
<td class="text-left pl-2">일반용 50L</td>
<td class="text-right pr-2">7,605</td>
<td class="text-right pr-2">13,000</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">13,000</td>
<td class="text-right pr-2">540</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">540</td>
<td class="text-right pr-2 bg-gray-50">540</td>
<td class="text-right pr-2">20,065</td>
</tr>
<!-- Row 6 -->
<tr>
<td class="text-left pl-2">일반용 75L</td>
<td class="text-right pr-2">31,459</td>
<td class="text-right pr-2">22,600</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">22,600</td>
<td class="text-right pr-2">2,990</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">2,090</td>
<td class="text-right pr-2 bg-gray-50">3,640</td>
<td class="text-right pr-2">86,240</td>
</tr>
<!-- Row 7 -->
<tr>
<td class="text-left pl-2">일반용 100L</td>
<td class="text-right pr-2">11</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">11</td>
</tr>
<!-- Row 8 -->
<tr>
<td class="text-left pl-2">일반용 70L</td>
<td class="text-right pr-2">77,400</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">1,000</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">1,000</td>
<td class="text-right pr-2 bg-gray-50">1,000</td>
<td class="text-right pr-2">76,400</td>
</tr>
<!-- Row 9 -->
<tr>
<td class="text-left pl-2">공동주택용 20L</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
</tr>
<!-- Row 10 -->
<tr>
<td class="text-left pl-2">공동주택용 50L</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
</tr>
<!-- Row 11 -->
<tr>
<td class="text-left pl-2">공동주택용 120L</td>
<td class="text-right pr-2">11</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
</tr>
<!-- Row 12 -->
<tr>
<td class="text-left pl-2">재사용 봉투</td>
<td class="text-right pr-2">58,540</td>
<td class="text-right pr-2">27,000</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">27,000</td>
<td class="text-right pr-2">560</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">560</td>
<td class="text-right pr-2 bg-gray-50">560</td>
<td class="text-right pr-2">84,990</td>
</tr>
<!-- Row 13 -->
<tr>
<td class="text-left pl-2">음식물 2L</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
</tr>
<!-- Row 14 -->
<tr>
<td class="text-left pl-2">음식물 스티커 1L</td>
<td class="text-right pr-2">376,758</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">100</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">100</td>
<td class="text-right pr-2 bg-gray-50">180</td>
<td class="text-right pr-2">376,658</td>
</tr>
<!-- Row 15 -->
<tr>
<td class="text-left pl-2">음식물 스티커 2L</td>
<td class="text-right pr-2">231,542</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">100</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">100</td>
<td class="text-right pr-2 bg-gray-50">100</td>
<td class="text-right pr-2">231,422</td>
</tr>
<!-- Row 16 -->
<tr>
<td class="text-left pl-2">음식물 스티커 3L</td>
<td class="text-right pr-2">529,938</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">1,200</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">1,200</td>
<td class="text-right pr-2 bg-gray-50">1,200</td>
<td class="text-right pr-2">529,738</td>
</tr>
<!-- Row 17 -->
<tr>
<td class="text-left pl-2">음식물 스티커 70L</td>
<td class="text-right pr-2">751,036</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">1,400</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">1,400</td>
<td class="text-right pr-2 bg-gray-50">1,400</td>
<td class="text-right pr-2">750,030</td>
</tr>
<!-- Row 18 -->
<tr>
<td class="text-left pl-2">음식물 스티커 60L</td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">6</td>
</tr>
<!-- Row 19 -->
<tr>
<td class="text-left pl-2">음식물 스티커 120L</td>
<td class="text-right pr-2">209,743</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">80</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">80</td>
<td class="text-right pr-2 bg-gray-50">80</td>
<td class="text-right pr-2">209,663</td>
</tr>
<!-- Row 20 -->
<tr>
<td class="text-left pl-2">폐기물 스티커 1,000원</td>
<td class="text-right pr-2">161,676</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">300</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">300</td>
<td class="text-right pr-2 bg-gray-50">300</td>
<td class="text-right pr-2">161,376</td>
</tr>
<!-- Row 21 -->
<tr>
<td class="text-left pl-2">폐기물 스티커 3,000원</td>
<td class="text-right pr-2">98,018</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">120</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">120</td>
<td class="text-right pr-2 bg-gray-50">120</td>
<td class="text-right pr-2">97,999</td>
</tr>
<!-- Row 22 -->
<tr>
<td class="text-left pl-2">폐기물 스티커 5,000원</td>
<td class="text-right pr-2">61,631</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">40</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">40</td>
<td class="text-right pr-2 bg-gray-50">40</td>
<td class="text-right pr-2">61,591</td>
</tr>
<!-- Next Date Group Placeholder for later expansion or testing -->
<tr>
<td class="align-top text-center bg-white border-t-2 border-gray-400" rowspan="4">2024.01.03</td>
<td class="text-left pl-2 border-t-2 border-gray-400">폐기물 스티커 10,000원</td>
<td class="text-right pr-2 border-t-2 border-gray-400">44,860</td>
<td class="text-right pr-2 border-t-2 border-gray-400"></td>
<td class="text-right pr-2 border-t-2 border-gray-400"></td>
<td class="text-right pr-2 bg-gray-50 border-t-2 border-gray-400">0</td>
<td class="text-right pr-2 border-t-2 border-gray-400"></td>
<td class="text-right pr-2 border-t-2 border-gray-400"></td>
<td class="text-right pr-2 border-t-2 border-gray-400"></td>
<td class="text-right pr-2 border-t-2 border-gray-400">0</td>
<td class="text-right pr-2 bg-gray-50 border-t-2 border-gray-400">0</td>
<td class="text-right pr-2 border-t-2 border-gray-400">44,860</td>
</tr>
<tr>
<td class="text-left pl-2">일반용 5L</td>
<td class="text-right pr-2">187,240</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">187,240</td>
</tr>
<tr>
<td class="text-left pl-2">일반용 10L</td>
<td class="text-right pr-2">402,848</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">402,848</td>
</tr>
<tr>
<td class="text-left pl-2">일반용 10L</td>
<td class="text-right pr-2">402,365</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2"></td>
<td class="text-right pr-2">0</td>
<td class="text-right pr-2 bg-gray-50">0</td>
<td class="text-right pr-2">402,365</td>
</tr></tbody>
<!-- END: Table Body -->
</table>
</div>
</main>
<!-- END: Main Content Area -->
<!-- BEGIN: Footer -->
<footer class="bg-gray-200 border-t border-gray-300 px-4 py-1 text-xs text-gray-600 flex items-center justify-between shrink-0">
<div>Ready.....</div>
<div class="flex gap-4">
<span>북구</span>
<span>Ver..</span>
<span>2025.12.12 (금) 3:00:32PM</span>
</div>
</footer>
<!-- END: Footer -->
</body>
</html>

View File

@@ -0,0 +1,347 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>스마트 폐기물 관리 시스템 - 재고 관리</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<style data-purpose="custom-styles">
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');
body {
font-family: 'Noto Sans KR', sans-serif;
background-color: #f1f5f9; /* Tailwind slate-100 */
}
/* Table Styles */
.custom-table th, .custom-table td {
border: 1px solid #cbd5e1; /* Tailwind slate-300 */
}
.custom-table th {
background-color: #eaeaea;
font-weight: 500;
color: #334155;
padding: 0.5rem;
text-align: center;
vertical-align: middle;
}
.custom-table td {
padding: 0.5rem;
color: #334155; /* Tailwind slate-700 */
background-color: #ffffff;
}
.custom-table tbody tr:hover td {
background-color: #f8fafc; /* Tailwind slate-50 */
}
/* Scrollbar for table container */
.table-container {
max-height: calc(100vh - 200px);
overflow-y: auto;
}
/* Sidebar active state */
.sidebar-link.active {
background-color: #e0f0ff;
color: #1e548a;
}
</style>
</head>
<body class="h-screen flex flex-col overflow-hidden text-sm">
<!-- BEGIN: Top Header -->
<header class="bg-white border-b border-slate-200 h-14 flex items-center justify-between px-4 shrink-0">
<div class="flex items-center gap-2">
<div class="w-8 h-8 bg-green-500 rounded-md flex items-center justify-center text-white">
<i class="fa-solid fa-leaf"></i>
</div>
<h1 class="text-xl font-bold text-slate-800">스마트 폐기물 관리 시스템</h1>
</div>
<div>
<button class="p-2 text-slate-500 hover:text-slate-700">
<i class="fa-solid fa-arrow-right-from-bracket text-lg"></i>
</button>
</div>
</header>
<!-- END: Top Header -->
<div class="flex flex-1 overflow-hidden relative">
<!-- BEGIN: Left Sidebar -->
<aside class="w-20 bg-white border-r border-slate-200 flex flex-col items-center py-4 gap-2 shrink-0 overflow-y-auto">
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-border-all text-xl mb-1"></i>
<span class="text-[10px]">기본정보관리</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-boxes-stacked text-xl mb-1"></i>
<span class="text-[10px]">발주/입고 관리</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-truck-ramp-box text-xl mb-1"></i>
<span class="text-[10px]">불출 관리</span>
</a>
<a class="sidebar-link active w-full flex flex-col items-center justify-center py-3 text-sky-700 transition-colors" href="#">
<i class="fa-solid fa-warehouse text-xl mb-1"></i>
<span class="text-[10px]">재고 관리</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-cart-shopping text-xl mb-1"></i>
<span class="text-[10px]">판매 관리</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-chart-pie text-xl mb-1"></i>
<span class="text-[10px]">판매 현황</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-chart-line text-xl mb-1"></i>
<span class="text-[10px]">통계/분석 관리</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-solid fa-gear text-xl mb-1"></i>
<span class="text-[10px]">설정</span>
</a>
<a class="sidebar-link w-full flex flex-col items-center justify-center py-3 text-slate-600 hover:bg-slate-50 transition-colors" href="#">
<i class="fa-regular fa-circle-question text-xl mb-1"></i>
<span class="text-[10px]">도움말</span>
</a>
<div class="mt-auto pt-4">
<button class="p-2 text-slate-400 hover:text-slate-600">
<i class="fa-solid fa-arrow-right-to-bracket text-lg"></i>
</button>
</div>
</aside>
<!-- END: Left Sidebar -->
<!-- BEGIN: Main Content Area -->
<main class="flex-1 p-4 bg-slate-100 flex flex-col overflow-hidden min-w-0">
<!-- BEGIN: Filter Bar -->
<section class="bg-white border border-slate-200 rounded shadow-sm p-3 mb-4 flex flex-wrap items-center justify-between gap-4 shrink-0">
<div class="flex flex-wrap items-center gap-4">
<div class="flex items-center gap-2">
<label class="font-medium text-slate-700 whitespace-nowrap">조회기간:</label>
<input class="border border-slate-300 rounded px-2 py-1.5 text-sm focus:ring-sky-500 focus:border-sky-500 w-52" readonly type="text" value="2024.01.01 ~ 2025.12.12"/>
</div>
<div class="flex items-center gap-2">
<label class="font-medium text-slate-700 whitespace-nowrap">봉투구분:</label>
<select class="border border-slate-300 rounded px-2 py-1.5 text-sm focus:ring-sky-500 focus:border-sky-500 w-24">
<option>전체</option>
</select>
</div>
<div class="flex items-center gap-2">
<label class="font-medium text-slate-700 whitespace-nowrap">봉투형식:</label>
<select class="border border-slate-300 rounded px-2 py-1.5 text-sm focus:ring-sky-500 focus:border-sky-500 w-28">
<option>전체 봉투</option>
</select>
</div>
<div class="flex items-center gap-2">
<label class="font-medium text-slate-700 whitespace-nowrap">대행소:</label>
<select class="border border-slate-300 rounded px-2 py-1.5 text-sm focus:ring-sky-500 focus:border-sky-500 w-24">
<option>북구</option>
</select>
</div>
</div>
<div class="flex items-center gap-2">
<button class="bg-[#1e548a] hover:bg-blue-900 text-white px-4 py-1.5 rounded text-sm font-medium flex items-center gap-1 transition-colors">
<i class="fa-solid fa-magnifying-glass"></i> 검색
</button>
<button class="bg-white border border-[#2e7d32] text-[#2e7d32] hover:bg-green-50 px-4 py-1.5 rounded text-sm font-medium flex items-center gap-1 transition-colors">
<i class="fa-regular fa-file-excel"></i> Excel 내보내기
</button>
<button class="bg-white border border-slate-300 text-black hover:bg-slate-50 px-4 py-1.5 rounded text-sm font-medium flex items-center gap-1 transition-colors">
<i class="fa-solid fa-print"></i> 인쇄
</button>
<button class="bg-[#e53935] hover:bg-red-600 text-white px-4 py-1.5 rounded text-sm font-medium flex items-center gap-1 transition-colors">
<i class="fa-solid fa-power-off"></i> 종료
</button>
</div>
</section>
<!-- END: Filter Bar -->
<!-- BEGIN: Data Table -->
<section class="bg-white border border-slate-200 rounded shadow-sm flex-1 flex flex-col overflow-hidden">
<div class="table-container flex-1 w-full overflow-auto">
<table class="custom-table w-full whitespace-nowrap table-auto border-collapse">
<thead class="sticky top-0 z-10 shadow-sm">
<tr>
<th class="w-48 sticky left-0 z-20" rowspan="2">품목</th>
<th class="w-24" rowspan="2">전일재고</th>
<th class="w-72" colspan="3">입고</th>
<th class="w-96" colspan="5">출고</th>
<th class="w-24" rowspan="2">잔량</th>
</tr>
<tr>
<th class="w-24">입고</th>
<th class="w-24">반품</th>
<th class="w-24">입고계</th>
<th class="w-24">판매</th>
<th class="w-24 text-xs leading-tight">임의불출/무상불출</th>
<th class="w-24">반품</th>
<th class="w-24">기타</th>
<th class="w-24">출고계</th>
</tr>
</thead>
<tbody>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 5L</td>
<td class="text-right">187,240</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right font-medium">187,240</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 5L</td>
<td class="text-right">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right">0</td>
<td class="text-right font-medium">0</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 10L</td>
<td class="text-right">159,428</td>
<td class="text-right">252,000</td>
<td class="text-right"></td>
<td class="text-right font-medium">252,800</td>
<td class="text-right">8,580</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">8,580</td>
<td class="text-right font-medium">8,990</td>
<td class="text-right font-medium">402,848</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 20L</td>
<td class="text-right">212,082</td>
<td class="text-right">201,000</td>
<td class="text-right"></td>
<td class="text-right font-medium">201,600</td>
<td class="text-right">11,320</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">11,320</td>
<td class="text-right font-medium">11,320</td>
<td class="text-right font-medium">402,355</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 50L</td>
<td class="text-right">7,605</td>
<td class="text-right">13,000</td>
<td class="text-right"></td>
<td class="text-right font-medium">13,000</td>
<td class="text-right">540</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">540</td>
<td class="text-right font-medium">540</td>
<td class="text-right font-medium">20,065</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 75L</td>
<td class="text-right">31,459</td>
<td class="text-right">22,600</td>
<td class="text-right"></td>
<td class="text-right font-medium">22,600</td>
<td class="text-right">2,990</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">2,090</td>
<td class="text-right font-medium">3,640</td>
<td class="text-right font-medium">86,240</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 100L</td>
<td class="text-right">11</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right font-medium">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right font-medium">0</td>
<td class="text-right font-medium">11</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">일반용 70L</td>
<td class="text-right">77,400</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right font-medium">0</td>
<td class="text-right"></td>
<td class="text-right">1,000</td>
<td class="text-right"></td>
<td class="text-right">1,000</td>
<td class="text-right font-medium">1,000</td>
<td class="text-right font-medium">76,400</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">공동주택용 20L</td>
<td class="text-right">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right font-medium">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right font-medium">0</td>
<td class="text-right font-medium">0</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">공동주택용 50L</td>
<td class="text-right">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right font-medium">0</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">0</td>
<td class="text-right font-medium">0</td>
<td class="text-right font-medium">0</td>
</tr>
<tr>
<td class="sticky left-0 bg-white text-left font-medium z-10 shadow-[1px_0_0_#cbd5e1]">재사용 봉투</td>
<td class="text-right">58,540</td>
<td class="text-right">27,000</td>
<td class="text-right"></td>
<td class="text-right font-medium">27,000</td>
<td class="text-right">560</td>
<td class="text-right"></td>
<td class="text-right"></td>
<td class="text-right">560</td>
<td class="text-right font-medium">560</td>
<td class="text-right font-medium">84,990</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- END: Data Table -->
</main>
<!-- END: Main Content Area -->
</div>
<!-- BEGIN: Footer / Status Bar -->
<footer class="bg-[#e2e8f0] border-t border-slate-300 h-8 flex items-center justify-between px-4 shrink-0 text-xs text-slate-600">
<div>Ready.....</div>
<div class="flex gap-4">
<span>북구</span>
<span>Ver..</span>
<span>2025.12.12 () 3:00:32PM</span>
</div>
</footer>
<!-- END: Footer / Status Bar -->
</body>
</html>

View File

@@ -0,0 +1,282 @@
<?php
/**
* 로그인 후 첫 화면 — 업무 현황 대시보드 (차장님 지시: 재고·구매신청·그래프 + 추가 시안)
* 레이아웃: 봉투 수불 엔터프라이즈 페이지와 동일한 상단 가로 메뉴·연한 파란 제목바·하단 상태줄
*
* @var string $lgLabel 로그인 지자체 표시명
*/
$lgLabel = $lgLabel ?? '북구';
$mbName = session()->get('mb_name') ?? '담당자';
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>종량제 시스템 — 업무 현황</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<style>
body {
font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
font-size: 13px;
color: #333;
}
.nav-top a.nav-active {
color: #2b4c8c;
font-weight: 600;
border-bottom: 2px solid #2b4c8c;
padding-bottom: 2px;
margin-bottom: -2px;
}
.kpi-card { transition: box-shadow .15s; }
.kpi-card:hover { box-shadow: 0 4px 14px rgba(43, 76, 140, .12); }
.bar-fill {
height: 10px;
border-radius: 4px;
background: linear-gradient(90deg, #2b4c8c, #3b82f6);
}
</style>
</head>
<body class="bg-gray-50 flex flex-col min-h-screen">
<!-- 상단: 수불 엔터프라이즈와 동일 계열 -->
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-4 py-2 gap-4 flex-wrap">
<div class="flex items-center gap-3 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-lg">
<i class="fa-solid fa-recycle text-xl"></i>
<span>종량제 시스템</span>
</div>
<span class="hidden sm:inline text-xs text-gray-500 border-l border-gray-300 pl-3">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>
</div>
<nav class="nav-top hidden lg:flex flex-wrap items-center gap-4 xl:gap-5 text-sm font-medium text-gray-700">
<a class="nav-active flex items-center gap-1 whitespace-nowrap" href="<?= base_url('dashboard') ?>">
<i class="fa-solid fa-gauge-high"></i> 업무 현황
</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-regular fa-file-lines"></i> 문서 관리</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-box-open"></i> 규격</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-bag-shopping"></i> 봉투 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-table"></i> 데이터 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-clock-rotate-left"></i> 사용 내역</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/inventory-inquiry') ?>"><i class="fa-solid fa-boxes-stacked"></i> 재고 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/waste-suibal-enterprise') ?>"><i class="fa-solid fa-table-list"></i> 수불 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-chart-line"></i> 통계 분석</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-gear"></i> 설정</a>
</nav>
<div class="flex items-center gap-2 shrink-0">
<a href="<?= base_url('dashboard/modern') ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline" title="모던 레이아웃">모던</a>
<span class="text-gray-300 hidden sm:inline">|</span>
<a href="<?= base_url('dashboard/dense') ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline" title="정보 집약 종합">종합</a>
<span class="text-gray-300 hidden sm:inline">|</span>
<a href="<?= base_url('dashboard/charts') ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline" title="그래프 대시보드">차트</a>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-gray-800 p-1" title="로그아웃">
<i class="fa-solid fa-arrow-right-from-bracket text-lg"></i>
</a>
</div>
</div>
</header>
<main class="flex-1 flex flex-col min-h-0" data-purpose="dashboard-content">
<!-- 연한 파란 제목바 (수불 페이지와 동일 톤) -->
<div class="bg-[#eff5fb] border-b border-gray-300 px-4 py-2 flex flex-wrap justify-between items-center gap-2 text-sm font-semibold text-gray-800 shrink-0" data-purpose="page-title">
<span>
<i class="fa-solid fa-chart-pie text-[#2b4c8c] mr-2"></i>업무 현황 대시보드
<span class="text-xs font-normal text-gray-500">· 봉투 재고 · 구매신청 · 발주/승인 요약</span>
</span>
<div class="flex items-center gap-2">
<span class="text-xs font-normal text-gray-500"><i class="fa-regular fa-calendar mr-1"></i><?= date('Y.m.d (D)') ?></span>
<button type="button" class="text-gray-500 hover:text-gray-800 p-1" title="조건 설정"><i class="fa-solid fa-sliders"></i></button>
</div>
</div>
<!-- 대시보드용 경량 필터 (엔터프라이즈 필터바와 동일 계열) -->
<section class="p-2 border-b border-gray-300 bg-white shrink-0" data-purpose="dashboard-context">
<div class="flex flex-wrap items-center justify-between gap-3">
<div class="flex flex-wrap items-center gap-3 text-xs">
<span class="text-gray-600 font-medium">기준일</span>
<input type="text" readonly value="<?= date('Y.m.d') ?>" class="border border-gray-300 px-2 py-1 rounded w-28 shadow-sm">
<span class="text-gray-500">|</span>
<span class="text-gray-600">지자체 <strong class="text-gray-800"><?= esc($lgLabel) ?></strong></span>
<button type="button" class="bg-[#2b4c8c] hover:bg-blue-800 text-white px-3 py-1 rounded text-xs font-medium shadow flex items-center gap-1">
<i class="fa-solid fa-rotate"></i> 새로고침
</button>
</div>
<p class="text-[11px] text-gray-400">목업 데이터 · 연동 시 실시간 반영</p>
</div>
</section>
<div class="flex-1 overflow-y-auto p-4">
<?php if (session()->getFlashdata('success')): ?>
<div class="mb-3 p-3 rounded-lg bg-emerald-50 text-emerald-800 text-sm border border-emerald-200"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<!-- KPI -->
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 mb-4">
<div class="kpi-card bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<p class="text-xs text-gray-500 mb-1"><i class="fa-solid fa-triangle-exclamation text-amber-500 mr-1"></i>재고 부족 품목</p>
<p class="text-2xl font-bold text-gray-800">3</p>
<p class="text-[11px] text-gray-400 mt-1">안전재고 미만 봉투 종류</p>
</div>
<div class="kpi-card bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<p class="text-xs text-gray-500 mb-1"><i class="fa-solid fa-inbox text-sky-600 mr-1"></i>미처리 구매신청</p>
<p class="text-2xl font-bold text-sky-700">12</p>
<p class="text-[11px] text-gray-400 mt-1">지정판매소 · 금일 기준</p>
</div>
<div class="kpi-card bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<p class="text-xs text-gray-500 mb-1"><i class="fa-solid fa-truck-field text-emerald-600 mr-1"></i>이번 주 발주·입고</p>
<p class="text-2xl font-bold text-emerald-700">8 <span class="text-sm font-normal text-gray-500">건</span></p>
<p class="text-[11px] text-gray-400 mt-1">발주 5 · 입고완료 3</p>
</div>
<div class="kpi-card bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<p class="text-xs text-gray-500 mb-1"><i class="fa-solid fa-user-clock text-violet-600 mr-1"></i>승인 대기 회원</p>
<p class="text-2xl font-bold text-violet-700">4</p>
<p class="text-[11px] text-gray-400 mt-1">가입·권한 승인 요청</p>
</div>
</div>
<div class="grid grid-cols-1 xl:grid-cols-2 gap-4 mb-4">
<section class="bg-white border border-gray-200 rounded-lg shadow-sm p-4">
<div class="flex items-center justify-between mb-3">
<h3 class="font-semibold text-gray-800"><i class="fa-solid fa-chart-bar text-[#2b4c8c] mr-2"></i>봉투별 재고 현황</h3>
<span class="text-[11px] text-gray-400">낱장 환산 · 목업</span>
</div>
<?php
$stockRows = [
['label' => '일반용 5L', 'pct' => 92],
['label' => '일반용 10L', 'pct' => 78],
['label' => '일반용 20L', 'pct' => 65],
['label' => '음식물 스티커', 'pct' => 41],
['label' => '재사용 봉투', 'pct' => 88],
];
foreach ($stockRows as $r):
?>
<div class="mb-3 last:mb-0">
<div class="flex justify-between text-xs mb-1">
<span><?= esc($r['label']) ?></span>
<span class="text-gray-500"><?= (int) $r['pct'] ?>%</span>
</div>
<div class="h-2 bg-gray-100 rounded-full overflow-hidden">
<div class="bar-fill h-full" style="width: <?= (int) $r['pct'] ?>%"></div>
</div>
</div>
<?php endforeach; ?>
</section>
<section class="bg-white border border-gray-200 rounded-lg shadow-sm p-4">
<div class="flex items-center justify-between mb-3">
<h3 class="font-semibold text-gray-800"><i class="fa-solid fa-chart-line text-[#2b4c8c] mr-2"></i>최근 7일 구매신청·처리 추이</h3>
<span class="text-[11px] text-gray-400">건수</span>
</div>
<div class="flex items-end justify-between gap-1 h-48 px-1 border-b border-gray-200">
<?php
$days = [8, 12, 5, 14, 9, 11, 7];
$max = max($days);
foreach ($days as $i => $v):
$h = $max > 0 ? round(($v / $max) * 100) : 0;
?>
<div class="flex-1 flex flex-col items-center justify-end h-full group">
<span class="text-[10px] text-gray-500 mb-1"><?= $v ?></span>
<div class="w-full max-w-[2.5rem] rounded-t bg-gradient-to-t from-sky-800 to-sky-400 transition group-hover:opacity-90" style="height: <?= $h ?>%"></div>
<span class="text-[10px] text-gray-400 mt-1">D-<?= 6 - $i ?></span>
</div>
<?php endforeach; ?>
</div>
<p class="text-[11px] text-gray-500 mt-2 text-center">일별 신청 건수 · 처리 연동 예정</p>
</section>
</div>
<section class="bg-white border border-gray-200 rounded-lg shadow-sm overflow-hidden mb-4">
<div class="px-4 py-3 border-b border-gray-200 flex flex-wrap items-center justify-between gap-2 bg-gray-50/80">
<h3 class="font-semibold text-gray-800"><i class="fa-solid fa-list-ul text-[#2b4c8c] mr-2"></i>지정판매소 구매신청 (최근)</h3>
<button type="button" class="text-xs text-sky-700 hover:underline font-medium">전체 보기</button>
</div>
<div class="overflow-x-auto">
<table class="w-full text-xs">
<thead class="bg-gray-100 text-gray-600 border-b border-gray-200">
<tr>
<th class="text-left font-semibold px-4 py-2">신청일시</th>
<th class="text-left font-semibold px-4 py-2">판매소</th>
<th class="text-left font-semibold px-4 py-2">품목</th>
<th class="text-right font-semibold px-4 py-2">수량</th>
<th class="text-center font-semibold px-4 py-2">상태</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
<?php
$orders = [
['2025-02-26 09:12', '행복마트 북구점', '일반용 5L', '2,000장', '접수'],
['2025-02-26 08:45', '○○슈퍼', '음식물 스티커', '500장', '처리중'],
['2025-02-25 16:20', '△△상회', '일반용 20L', '박스 3', '완료'],
['2025-02-25 11:03', '□□편의점', '일반용 10L', '팩 12', '접수'],
['2025-02-24 14:50', '행복마트 북구점', '재사용 봉투', '1,200장', '완료'],
];
foreach ($orders as $o):
?>
<tr class="hover:bg-gray-50">
<td class="px-4 py-2.5 whitespace-nowrap"><?= esc($o[0]) ?></td>
<td class="px-4 py-2.5"><?= esc($o[1]) ?></td>
<td class="px-4 py-2.5"><?= esc($o[2]) ?></td>
<td class="px-4 py-2.5 text-right"><?= esc($o[3]) ?></td>
<td class="px-4 py-2.5 text-center">
<?php
$st = $o[4];
$cls = $st === '완료' ? 'bg-emerald-100 text-emerald-800' : ($st === '처리중' ? 'bg-amber-100 text-amber-800' : 'bg-gray-100 text-gray-700');
?>
<span class="inline-block px-2 py-0.5 rounded text-[11px] <?= $cls ?>"><?= esc($st) ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<div class="grid grid-cols-1 md:grid-cols-3 gap-3 mb-4">
<div class="bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<h4 class="text-sm font-semibold text-gray-800 mb-2"><i class="fa-solid fa-boxes-packing text-emerald-600 mr-1"></i>이번 주 발주·입고 요약</h4>
<ul class="text-xs text-gray-600 space-y-1.5">
<li class="flex justify-between"><span>발주 접수</span><strong>5건</strong></li>
<li class="flex justify-between"><span>입고 완료</span><strong class="text-emerald-700">3건</strong></li>
<li class="flex justify-between"><span>입고 예정(LOT)</span><strong>2건</strong></li>
</ul>
</div>
<div class="bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<h4 class="text-sm font-semibold text-gray-800 mb-2"><i class="fa-solid fa-user-check text-violet-600 mr-1"></i>승인 대기 회원</h4>
<p class="text-3xl font-bold text-violet-700">4</p>
<p class="text-xs text-gray-500 mt-1">지정판매소 · 일반 가입</p>
<button type="button" class="mt-3 w-full text-xs py-1.5 rounded border border-violet-200 text-violet-700 hover:bg-violet-50">승인 화면으로</button>
</div>
<div class="bg-white border border-gray-200 rounded-lg p-4 shadow-sm">
<h4 class="text-sm font-semibold text-gray-800 mb-2"><i class="fa-solid fa-arrow-right-arrow-left text-orange-600 mr-1"></i>최근 7일 봉투 수불 추이</h4>
<p class="text-xs text-gray-600">입고 <strong class="text-gray-800">+482</strong> / 출고 <strong class="text-gray-800">391</strong></p>
<div class="mt-2 h-16 flex items-end gap-0.5">
<?php foreach ([3, 5, 4, 6, 6, 5, 2] as $h): ?>
<div class="flex-1 bg-orange-200 rounded-t" style="height: <?= $h * 8 ?>%"></div>
<?php endforeach; ?>
</div>
</div>
</div>
<p class="text-[11px] text-gray-400 border-t border-gray-200 pt-3">
차장님 요청 반영: <strong>봉투별 재고</strong>·<strong>구매신청 리스트</strong>·그래프 /
추가 시안: <strong>발주·입고</strong>, <strong>승인 대기</strong>, <strong>수불 추이</strong>.
레이아웃은 <strong>수불 엔터프라이즈 화면</strong>과 동일한 상단 메뉴·제목바 스타일입니다.
</p>
</div>
</main>
<footer class="bg-[#e9ecef] border-t border-gray-300 px-4 py-1.5 text-xs text-gray-600 flex justify-between items-center shrink-0" data-purpose="status-bar">
<div class="flex items-center gap-2">
<span class="text-green-700"><i class="fa-solid fa-circle text-[6px] align-middle mr-1"></i>준비됨</span>
<span class="text-gray-400">|</span>
<span><?= esc($lgLabel) ?></span>
</div>
<div class="flex gap-4">
<span>Ver. 목업</span>
<span><?= date('Y.m.d (D) g:i A') ?></span>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,429 @@
<?php
/**
* 로그인 후 메인 — 그래프 중심 대시보드 (Chart.js 목업)
* 상단 메뉴바는 lg_dashboard.php 와 동일
*
* @var string $lgLabel
*/
$lgLabel = $lgLabel ?? '북구';
$mbName = session()->get('mb_name') ?? '담당자';
$dashClassic = base_url('dashboard/classic-mock');
$dashModern = base_url('dashboard/modern');
$dashDense = base_url('dashboard/dense');
$dashCharts = base_url('dashboard/charts');
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>종량제 시스템 — 통계·그래프 현황</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
<style>
body {
font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
font-size: 13px;
color: #333;
}
.nav-top a.nav-active {
color: #2b4c8c;
font-weight: 600;
border-bottom: 2px solid #2b4c8c;
padding-bottom: 2px;
margin-bottom: -2px;
}
.chart-card {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.chart-card h2 {
font-size: 12px;
font-weight: 700;
color: #1f2937;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid #f3f4f6;
background: #fafafa;
}
.chart-wrap { position: relative; height: 200px; padding: 0.5rem 0.75rem 0.75rem; }
.chart-wrap.tall { height: 280px; }
.chart-wrap.wide { height: 240px; }
</style>
</head>
<body class="bg-[#eef1f6] flex flex-col min-h-screen">
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-3 py-1.5 gap-3 flex-wrap">
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-base">
<i class="fa-solid fa-recycle text-lg"></i>
<span>종량제 시스템</span>
</div>
<span class="hidden sm:inline text-[11px] text-gray-500 border-l border-gray-300 pl-2">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>
</div>
<nav class="nav-top hidden lg:flex flex-wrap items-center gap-3 xl:gap-4 text-[13px] font-medium text-gray-700">
<a class="nav-active flex items-center gap-1 whitespace-nowrap" href="<?= esc($dashCharts) ?>">
<i class="fa-solid fa-gauge-high"></i> 업무 현황
</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-regular fa-file-lines"></i> 문서 관리</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-box-open"></i> 규격</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-bag-shopping"></i> 봉투 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-table"></i> 데이터 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-clock-rotate-left"></i> 사용 내역</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/inventory-inquiry') ?>"><i class="fa-solid fa-boxes-stacked"></i> 재고 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/waste-suibal-enterprise') ?>"><i class="fa-solid fa-table-list"></i> 수불 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-chart-line"></i> 통계 분석</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-gear"></i> 설정</a>
</nav>
<div class="flex items-center gap-1.5 shrink-0 text-[11px]">
<a href="<?= esc($dashClassic) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline">클래식</a>
<span class="text-gray-300 hidden md:inline">|</span>
<a href="<?= esc($dashModern) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline">모던</a>
<span class="text-gray-300 hidden md:inline">|</span>
<a href="<?= esc($dashDense) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline">종합</a>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-gray-800 p-1 ml-1" title="로그아웃">
<i class="fa-solid fa-arrow-right-from-bracket"></i>
</a>
</div>
</div>
</header>
<div class="bg-[#eff5fb] border-b border-gray-300 px-3 py-1.5 flex flex-wrap items-center justify-between gap-2 text-[12px] shrink-0">
<span class="font-semibold text-gray-800">
<i class="fa-solid fa-chart-column text-[#2b4c8c] mr-1"></i>통계·그래프 대시보드
<span class="font-normal text-gray-500 ml-1">· 목업 데이터 · Chart.js</span>
</span>
<span class="text-gray-600 text-[11px]"><i class="fa-regular fa-calendar mr-0.5"></i><?= date('Y-m-d H:i') ?> · <?= esc($lgLabel) ?></span>
</div>
<main class="flex-1 overflow-y-auto p-2 sm:p-3">
<?php if (session()->getFlashdata('success')): ?>
<div class="mb-2 p-2 rounded border border-green-200 bg-green-50 text-green-800 text-[11px]"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<!-- 1행: 도넛 2 + 막대 + 레이더 -->
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-2 mb-2">
<section class="chart-card">
<h2><i class="fa-solid fa-chart-pie text-[#2b4c8c] mr-1"></i>봉투 규격 출고 비중</h2>
<div class="chart-wrap"><canvas id="chDoughnutSpec"></canvas></div>
</section>
<section class="chart-card">
<h2><i class="fa-solid fa-circle-notch text-[#2b4c8c] mr-1"></i>구매신청 처리 단계</h2>
<div class="chart-wrap"><canvas id="chDoughnutFlow"></canvas></div>
</section>
<section class="chart-card">
<h2><i class="fa-solid fa-calendar-week text-[#2b4c8c] mr-1"></i>금주 일별 출고(천장)</h2>
<div class="chart-wrap"><canvas id="chBarWeek"></canvas></div>
</section>
<section class="chart-card">
<h2><i class="fa-solid fa-bullseye text-[#2b4c8c] mr-1"></i>운영 지표 (목업)</h2>
<div class="chart-wrap"><canvas id="chRadar"></canvas></div>
</section>
</div>
<!-- 2행: 월별 추이 라인 -->
<section class="chart-card mb-2">
<h2><i class="fa-solid fa-chart-line text-[#2b4c8c] mr-1"></i>월별 출고 vs 구매신청 건수 (최근 12개월)</h2>
<div class="chart-wrap tall"><canvas id="chLineYear"></canvas></div>
</section>
<!-- 3행: 품목 막대 + 판매소 가로막대 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2 mb-2">
<section class="chart-card">
<h2><i class="fa-solid fa-boxes-stacked text-[#2b4c8c] mr-1"></i>품목별 재고 (천 장)</h2>
<div class="chart-wrap wide"><canvas id="chBarSku"></canvas></div>
</section>
<section class="chart-card">
<h2><i class="fa-solid fa-store text-[#2b4c8c] mr-1"></i>판매소별 월 출고 TOP</h2>
<div class="chart-wrap wide"><canvas id="chBarHStore"></canvas></div>
</section>
</div>
<!-- 4행: 스택 막대 -->
<section class="chart-card mb-2">
<h2><i class="fa-solid fa-layer-group text-[#2b4c8c] mr-1"></i>분기별 입고 / 출고 / 조정 (천 장)</h2>
<div class="chart-wrap wide"><canvas id="chStackedQ"></canvas></div>
</section>
<!-- 5행: 영역 + 극좌표 누적 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2 mb-2">
<section class="chart-card">
<h2><i class="fa-solid fa-chart-area text-[#2b4c8c] mr-1"></i>누적 출고 추이 (올해)</h2>
<div class="chart-wrap"><canvas id="chAreaCum"></canvas></div>
</section>
<section class="chart-card">
<h2><i class="fa-solid fa-compass text-[#2b4c8c] mr-1"></i>요일·시간대 신청 분포 (극좌표)</h2>
<div class="chart-wrap"><canvas id="chPolarTime"></canvas></div>
</section>
</div>
<p class="text-center text-[10px] text-gray-400 py-1">
<a href="<?= esc($dashClassic) ?>" class="text-[#2b4c8c] hover:underline">/dashboard</a>
· <a href="<?= esc($dashModern) ?>" class="text-[#2b4c8c] hover:underline">/dashboard/modern</a>
· <a href="<?= esc($dashDense) ?>" class="text-[#2b4c8c] hover:underline">/dashboard/dense</a>
· <strong class="text-gray-600">/dashboard/charts</strong>
</p>
</main>
<script>
(function () {
const C = {
primary: '#2b4c8c',
blue: '#3b82f6',
teal: '#0d9488',
emerald: '#059669',
amber: '#d97706',
rose: '#e11d48',
violet: '#7c3aed',
slate: '#64748b',
grid: 'rgba(0,0,0,.06)',
};
Chart.defaults.font.family = "'Malgun Gothic','Apple SD Gothic Neo','Noto Sans KR',sans-serif";
Chart.defaults.font.size = 11;
Chart.defaults.color = '#4b5563';
const commonOpts = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { position: 'bottom', labels: { boxWidth: 10, padding: 8, font: { size: 10 } } },
},
};
const axisOpts = {
scales: {
x: { grid: { color: C.grid }, ticks: { maxRotation: 45, minRotation: 0, font: { size: 10 } } },
y: { grid: { color: C.grid }, ticks: { font: { size: 10 } }, beginAtZero: true },
},
};
new Chart(document.getElementById('chDoughnutSpec'), {
type: 'doughnut',
data: {
labels: ['일반 5L', '일반 10·20L', '음식물 스티커', '재사용', '기타'],
datasets: [{
data: [38, 22, 28, 9, 3],
backgroundColor: [C.primary, C.blue, C.teal, C.emerald, C.slate],
borderWidth: 0,
}],
},
options: { ...commonOpts, cutout: '58%' },
});
new Chart(document.getElementById('chDoughnutFlow'), {
type: 'doughnut',
data: {
labels: ['접수', '검토', '발주', '납품', '완료'],
datasets: [{
data: [12, 8, 6, 5, 42],
backgroundColor: [C.amber, C.blue, C.violet, C.teal, C.emerald],
borderWidth: 0,
}],
},
options: { ...commonOpts, cutout: '55%' },
});
new Chart(document.getElementById('chBarWeek'), {
type: 'bar',
data: {
labels: ['월', '화', '수', '목', '금', '토', '일'],
datasets: [{
label: '출고',
data: [42, 55, 48, 61, 58, 22, 8],
backgroundColor: C.primary,
borderRadius: 4,
}],
},
options: { ...commonOpts, ...axisOpts, plugins: { ...commonOpts.plugins, legend: { display: false } } },
});
new Chart(document.getElementById('chRadar'), {
type: 'radar',
data: {
labels: ['재고안정', '신청처리', '납기준수', '민원응대', '데이터품질'],
datasets: [
{
label: '이번 달',
data: [82, 76, 88, 71, 85],
borderColor: C.primary,
backgroundColor: 'rgba(43, 76, 140, 0.2)',
pointBackgroundColor: C.primary,
},
{
label: '전월',
data: [78, 80, 84, 75, 80],
borderColor: C.blue,
backgroundColor: 'rgba(59, 130, 246, 0.12)',
pointBackgroundColor: C.blue,
},
],
},
options: {
...commonOpts,
scales: {
r: {
beginAtZero: true,
max: 100,
ticks: { stepSize: 20, font: { size: 9 } },
grid: { color: C.grid },
pointLabels: { font: { size: 10 } },
},
},
},
});
new Chart(document.getElementById('chLineYear'), {
type: 'line',
data: {
labels: ['3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월', '1월', '2월'],
datasets: [
{
label: '출고(천 장)',
data: [320, 340, 310, 355, 380, 360, 370, 390, 400, 385, 410, 395],
borderColor: C.primary,
backgroundColor: 'rgba(43, 76, 140, 0.08)',
fill: true,
tension: 0.35,
pointRadius: 3,
},
{
label: '구매신청(건)',
data: [118, 125, 112, 130, 142, 128, 135, 140, 155, 148, 160, 152],
borderColor: C.teal,
backgroundColor: 'transparent',
tension: 0.35,
yAxisID: 'y1',
pointRadius: 3,
},
],
},
options: {
...commonOpts,
...axisOpts,
scales: {
x: axisOpts.scales.x,
y: { type: 'linear', position: 'left', grid: { color: C.grid }, title: { display: true, text: '출고', font: { size: 10 } } },
y1: {
type: 'linear',
position: 'right',
grid: { drawOnChartArea: false },
title: { display: true, text: '건수', font: { size: 10 } },
beginAtZero: true,
},
},
},
});
new Chart(document.getElementById('chBarSku'), {
type: 'bar',
data: {
labels: ['5L', '10L', '20L', '스티커', '재사용', '특수'],
datasets: [{
label: '재고',
data: [12.4, 8.2, 2.1, 15.0, 4.3, 0.9],
backgroundColor: [C.primary, C.blue, C.amber, C.teal, C.emerald, C.rose],
borderRadius: 4,
}],
},
options: {
...commonOpts,
...axisOpts,
indexAxis: 'x',
plugins: { ...commonOpts.plugins, legend: { display: false } },
},
});
new Chart(document.getElementById('chBarHStore'), {
type: 'bar',
data: {
labels: ['행복마트 북구', '◇◇할인점', '□□마트', '○○슈퍼', '△△상회'],
datasets: [{
label: '천 장',
data: [5.2, 4.8, 3.9, 3.5, 2.1],
backgroundColor: C.primary,
borderRadius: 4,
}],
},
options: {
...commonOpts,
indexAxis: 'y',
plugins: { ...commonOpts.plugins, legend: { display: false } },
scales: {
x: { grid: { color: C.grid }, beginAtZero: true, ticks: { font: { size: 10 } } },
y: { grid: { display: false }, ticks: { font: { size: 10 } } },
},
},
});
new Chart(document.getElementById('chStackedQ'), {
type: 'bar',
data: {
labels: ['1분기', '2분기', '3분기', '4분기(예)'],
datasets: [
{ label: '입고', data: [420, 450, 480, 460], backgroundColor: C.emerald, stack: 's' },
{ label: '출고', data: [380, 410, 440, 430], backgroundColor: C.primary, stack: 's' },
{ label: '조정', data: [12, 8, 15, 10], backgroundColor: C.amber, stack: 's' },
],
},
options: {
...commonOpts,
scales: {
x: { stacked: true, grid: { display: false }, ticks: { font: { size: 10 } } },
y: { stacked: true, grid: { color: C.grid }, ticks: { font: { size: 10 } }, beginAtZero: true },
},
},
});
new Chart(document.getElementById('chAreaCum'), {
type: 'line',
data: {
labels: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
datasets: [{
label: '누적 출고(만 장)',
data: [3.2, 6.8, 10.5, 14.2, 18.0, 21.5, 25.1, 28.9, 32.4, 36.0, 39.8, 43.5],
borderColor: C.blue,
backgroundColor: 'rgba(59, 130, 246, 0.25)',
fill: true,
tension: 0.4,
pointRadius: 0,
}],
},
options: { ...commonOpts, ...axisOpts, plugins: { ...commonOpts.plugins, legend: { display: true } } },
});
new Chart(document.getElementById('chPolarTime'), {
type: 'polarArea',
data: {
labels: ['평일 오전', '평일 오후', '평일 야간', '주말'],
datasets: [{
data: [28, 45, 8, 19],
backgroundColor: [
'rgba(43, 76, 140, 0.75)',
'rgba(13, 148, 136, 0.7)',
'rgba(217, 119, 6, 0.65)',
'rgba(124, 58, 237, 0.65)',
],
borderWidth: 1,
borderColor: '#fff',
}],
},
options: {
...commonOpts,
scales: {
r: {
ticks: { backdropColor: 'transparent', font: { size: 9 } },
grid: { color: C.grid },
pointLabels: { font: { size: 10 } },
},
},
},
});
})();
</script>
</body>
</html>

View File

@@ -0,0 +1,391 @@
<?php
/**
* 로그인 후 메인 — 정보 집약형 대시보드 (KPI·다중 표·알림·로그 한 화면)
* 상단 메뉴바는 lg_dashboard.php 와 동일
*
* @var string $lgLabel
*/
$lgLabel = $lgLabel ?? '북구';
$mbName = session()->get('mb_name') ?? '담당자';
$dashClassic = base_url('dashboard/classic-mock');
$dashModern = base_url('dashboard/modern');
$dashDense = base_url('dashboard/dense');
$dashCharts = base_url('dashboard/charts');
$kpiTop = [
['icon' => 'fa-triangle-exclamation', 'c' => 'text-amber-700', 'bg' => 'bg-amber-50', 'v' => '3', 'l' => '재고부족', 'sub' => '품목'],
['icon' => 'fa-cart-shopping', 'c' => 'text-sky-700', 'bg' => 'bg-sky-50', 'v' => '12', 'l' => '구매신청', 'sub' => '미처리'],
['icon' => 'fa-truck', 'c' => 'text-emerald-700', 'bg' => 'bg-emerald-50', 'v' => '8', 'l' => '발주·입고', 'sub' => '금주'],
['icon' => 'fa-user-clock', 'c' => 'text-violet-700', 'bg' => 'bg-violet-50', 'v' => '4', 'l' => '회원승인', 'sub' => '대기'],
['icon' => 'fa-store', 'c' => 'text-rose-700', 'bg' => 'bg-rose-50', 'v' => '127', 'l' => '지정판매소', 'sub' => '등록'],
['icon' => 'fa-boxes-stacked', 'c' => 'text-slate-700', 'bg' => 'bg-slate-100', 'v' => '48.2k', 'l' => '봉투재고', 'sub' => '장 합계'],
['icon' => 'fa-file-invoice', 'c' => 'text-orange-700', 'bg' => 'bg-orange-50', 'v' => '6', 'l' => '세금계산서', 'sub' => '발행대기'],
['icon' => 'fa-headset', 'c' => 'text-cyan-700', 'bg' => 'bg-cyan-50', 'v' => '2', 'l' => '민원·문의', 'sub' => '오늘'],
];
$stockRows = [
['일반 5L', '12,400', '안전', '3.2주'],
['일반 10L', '8,200', '주의', '1.8주'],
['일반 20L', '2,100', '부족', '0.6주'],
['음식물 스티커', '15,000', '안전', '5.1주'],
['재사용봉투', '4,300', '안전', '2.4주'],
['특수규격 A', '890', '부족', '0.3주'],
];
$orderRows = [
['PO-2025-0218', '○○상사', '일반 5L×2박스', '발주확인', '02-26 10:20'],
['PO-2025-0217', '△△유통', '스티커 500매', '납품중', '02-26 09:05'],
['PO-2025-0216', '□□종량제', '20L 혼합', '입고완료', '02-25 16:40'],
['REQ-8841', '행복마트 북구점', '5L 2,000장', '접수', '02-26 09:12'],
['REQ-8839', '○○슈퍼', '스티커 500', '처리중', '02-26 08:45'],
];
$logRows = [
['10:42', 'system', '일일 재고 스냅샷 생성 완료'],
['10:18', 'user', esc($mbName) . ' 로그인 (IP 마스킹)'],
['09:55', 'batch', '구매신청 자동 분배 3건'],
['09:30', 'admin', '판매소 코드 2건 갱신'],
['08:12', 'api', '세금계산서 연동 응답 정상'],
];
$storeSummary = [
['행복마트 북구점', '42', '정상', '02-26'],
['○○슈퍼', '38', '정상', '02-25'],
['△△상회', '15', '연체1건', '02-20'],
['□□마트', '29', '정상', '02-26'],
['◇◇할인점', '51', '정상', '02-26'],
];
$approvals = [
['김○○', '판매소', '02-26', '서류검토'],
['이○○', '일반', '02-25', '본인확인'],
['박○○', '판매소', '02-25', '주소불일치'],
];
$notices = [
'2월 말 정기 재고 실사 안내 — 2/28 17:00 마감',
'봉투 단가 조정 예고 — 3/1 적용 예정 (안내문 배포 완료)',
];
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>종량제 시스템 — 종합 현황 (정보집약)</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<style>
body {
font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
font-size: 12px;
color: #333;
}
.nav-top a.nav-active {
color: #2b4c8c;
font-weight: 600;
border-bottom: 2px solid #2b4c8c;
padding-bottom: 2px;
margin-bottom: -2px;
}
.dense-table th, .dense-table td { padding: 0.25rem 0.4rem; line-height: 1.25; }
.dense-table thead th { font-size: 11px; font-weight: 600; color: #555; background: #f3f4f6; border-bottom: 1px solid #d1d5db; }
.dense-table tbody td { border-bottom: 1px solid #eee; font-size: 11px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 36px; }
.spark span { flex: 1; background: linear-gradient(180deg, #3b82f6, #93c5fd); border-radius: 1px; min-width: 4px; }
</style>
</head>
<body class="bg-[#f0f2f5] flex flex-col min-h-screen">
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-3 py-1.5 gap-3 flex-wrap">
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-base">
<i class="fa-solid fa-recycle text-lg"></i>
<span>종량제 시스템</span>
</div>
<span class="hidden sm:inline text-[11px] text-gray-500 border-l border-gray-300 pl-2">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>
</div>
<nav class="nav-top hidden lg:flex flex-wrap items-center gap-3 xl:gap-4 text-[13px] font-medium text-gray-700">
<a class="nav-active flex items-center gap-1 whitespace-nowrap" href="<?= esc($dashDense) ?>">
<i class="fa-solid fa-gauge-high"></i> 업무 현황
</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-regular fa-file-lines"></i> 문서 관리</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-box-open"></i> 규격</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-bag-shopping"></i> 봉투 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-table"></i> 데이터 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-clock-rotate-left"></i> 사용 내역</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/inventory-inquiry') ?>"><i class="fa-solid fa-boxes-stacked"></i> 재고 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/waste-suibal-enterprise') ?>"><i class="fa-solid fa-table-list"></i> 수불 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-chart-line"></i> 통계 분석</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-gear"></i> 설정</a>
</nav>
<div class="flex items-center gap-1.5 shrink-0 text-[11px]">
<a href="<?= esc($dashClassic) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline">클래식</a>
<span class="text-gray-300 hidden md:inline">|</span>
<a href="<?= esc($dashModern) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline">모던</a>
<span class="text-gray-300 hidden md:inline">|</span>
<a href="<?= esc($dashCharts) ?>" class="text-[#2b4c8c] hover:underline whitespace-nowrap hidden md:inline" title="그래프 대시보드">차트</a>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-gray-800 p-1 ml-1" title="로그아웃">
<i class="fa-solid fa-arrow-right-from-bracket"></i>
</a>
</div>
</div>
</header>
<!-- 컴팩트 컨텍스트 바 -->
<div class="bg-[#eff5fb] border-b border-gray-300 px-3 py-1 flex flex-wrap items-center justify-between gap-2 text-[11px] shrink-0">
<span class="font-semibold text-gray-800">
<i class="fa-solid fa-table-columns text-[#2b4c8c] mr-1"></i>종합 운영 현황
<span class="font-normal text-gray-500 ml-1">· KPI · 재고 · 발주/신청 · 로그 · 판매소</span>
</span>
<div class="flex flex-wrap items-center gap-2 text-gray-600">
<span><i class="fa-regular fa-calendar mr-0.5"></i><?= date('Y-m-d (D) H:i') ?></span>
<span class="text-gray-300">|</span>
<span>기준지자체 <strong class="text-gray-800"><?= esc($lgLabel) ?></strong></span>
<button type="button" class="bg-[#2b4c8c] text-white px-2 py-0.5 rounded text-[11px]"><i class="fa-solid fa-rotate mr-0.5"></i>새로고침</button>
</div>
</div>
<main class="flex-1 overflow-y-auto p-2 sm:p-3">
<?php if (session()->getFlashdata('success')): ?>
<div class="mb-2 p-2 rounded border border-green-200 bg-green-50 text-green-800 text-[11px]"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<!-- 공지 티커 -->
<div class="mb-2 flex flex-wrap gap-2">
<?php foreach ($notices as $n): ?>
<div class="flex-1 min-w-[200px] flex items-center gap-2 bg-amber-50 border border-amber-200 text-amber-900 px-2 py-1 rounded text-[11px]">
<i class="fa-solid fa-bullhorn shrink-0"></i>
<span class="truncate" title="<?= esc($n) ?>"><?= esc($n) ?></span>
</div>
<?php endforeach; ?>
</div>
<!-- KPI 8칸 -->
<div class="grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-1.5 mb-2">
<?php foreach ($kpiTop as $k): ?>
<div class="bg-white border border-gray-200 rounded px-2 py-1.5 flex items-center gap-2 shadow-sm">
<div class="w-8 h-8 rounded <?= $k['bg'] ?> <?= $k['c'] ?> flex items-center justify-center shrink-0 text-sm">
<i class="fa-solid <?= esc($k['icon'], 'attr') ?>"></i>
</div>
<div class="min-w-0">
<div class="text-base font-bold text-gray-900 leading-tight"><?= esc($k['v']) ?></div>
<div class="text-[10px] text-gray-500 leading-tight"><?= esc($k['l']) ?></div>
<div class="text-[9px] text-gray-400"><?= esc($k['sub']) ?></div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="grid grid-cols-1 xl:grid-cols-12 gap-2 mb-2">
<!-- 재고 품목 -->
<section class="xl:col-span-4 bg-white border border-gray-200 rounded shadow-sm overflow-hidden">
<div class="px-2 py-1 border-b border-gray-200 bg-gray-50 flex justify-between items-center">
<h2 class="text-[11px] font-bold text-gray-800"><i class="fa-solid fa-warehouse text-[#2b4c8c] mr-1"></i>품목별 재고·소진예상</h2>
<a href="<?= base_url('bag/inventory-inquiry') ?>" class="text-[10px] text-blue-600 hover:underline">상세</a>
</div>
<div class="overflow-x-auto max-h-[220px] overflow-y-auto">
<table class="w-full dense-table text-left">
<thead>
<tr>
<th>품목</th>
<th class="text-right">재고(장)</th>
<th>상태</th>
<th class="text-right">소진</th>
</tr>
</thead>
<tbody>
<?php foreach ($stockRows as $r): ?>
<tr>
<td class="font-medium text-gray-800"><?= esc($r[0]) ?></td>
<td class="text-right tabular-nums"><?= esc($r[1]) ?></td>
<td>
<?php
$badge = match ($r[2]) {
'안전' => 'bg-emerald-100 text-emerald-800',
'주의' => 'bg-amber-100 text-amber-800',
'부족' => 'bg-red-100 text-red-800',
default => 'bg-gray-100 text-gray-700',
};
?>
<span class="text-[10px] px-1 py-0 rounded <?= $badge ?>"><?= esc($r[2]) ?></span>
</td>
<td class="text-right text-gray-600"><?= esc($r[3]) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<!-- 발주·구매신청 -->
<section class="xl:col-span-4 bg-white border border-gray-200 rounded shadow-sm overflow-hidden">
<div class="px-2 py-1 border-b border-gray-200 bg-gray-50 flex justify-between items-center">
<h2 class="text-[11px] font-bold text-gray-800"><i class="fa-solid fa-list-check text-[#2b4c8c] mr-1"></i>발주 / 구매신청 진행</h2>
<span class="text-[10px] text-gray-500">최근 5건</span>
</div>
<div class="overflow-x-auto max-h-[220px] overflow-y-auto">
<table class="w-full dense-table text-left">
<thead>
<tr>
<th>문서</th>
<th>상대</th>
<th>내용</th>
<th>단계</th>
<th class="text-right">시각</th>
</tr>
</thead>
<tbody>
<?php foreach ($orderRows as $r): ?>
<tr>
<td class="text-blue-700 font-mono text-[10px]"><?= esc($r[0]) ?></td>
<td class="truncate max-w-[4.5rem]" title="<?= esc($r[1]) ?>"><?= esc($r[1]) ?></td>
<td class="truncate max-w-[5rem]" title="<?= esc($r[2]) ?>"><?= esc($r[2]) ?></td>
<td><span class="text-[10px] bg-slate-100 px-1 rounded"><?= esc($r[3]) ?></span></td>
<td class="text-right text-gray-500 text-[10px] whitespace-nowrap"><?= esc($r[4]) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<!-- 시스템 로그 + 주간 막대 -->
<section class="xl:col-span-4 bg-white border border-gray-200 rounded shadow-sm overflow-hidden flex flex-col">
<div class="px-2 py-1 border-b border-gray-200 bg-gray-50">
<h2 class="text-[11px] font-bold text-gray-800"><i class="fa-solid fa-clock-rotate-left text-[#2b4c8c] mr-1"></i>최근 이벤트 로그</h2>
</div>
<ul class="flex-1 max-h-[140px] overflow-y-auto divide-y divide-gray-100 px-2 py-0.5">
<?php foreach ($logRows as $L): ?>
<li class="py-1 flex gap-2 text-[10px]">
<span class="text-gray-400 font-mono shrink-0 w-8"><?= esc($L[0]) ?></span>
<span class="shrink-0 w-12 text-center rounded bg-gray-100 text-gray-600"><?= esc($L[1]) ?></span>
<span class="text-gray-700"><?= $L[2] ?></span>
</li>
<?php endforeach; ?>
</ul>
<div class="border-t border-gray-100 px-2 py-1.5 bg-gray-50/80">
<div class="text-[10px] font-semibold text-gray-600 mb-1">주간 봉투 출고(천 장, 목업)</div>
<div class="spark" title="주간 추이">
<?php foreach ([40, 55, 48, 62, 58, 71, 65] as $h): ?>
<span style="height: <?= (int) $h ?>%"></span>
<?php endforeach; ?>
</div>
<div class="flex justify-between text-[9px] text-gray-400 mt-0.5">
<span>월</span><span>화</span><span>수</span><span>목</span><span>금</span><span>토</span><span>일</span>
</div>
</div>
</section>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2 mb-2">
<!-- 판매소 요약 -->
<section class="bg-white border border-gray-200 rounded shadow-sm overflow-hidden">
<div class="px-2 py-1 border-b border-gray-200 bg-gray-50 flex justify-between items-center">
<h2 class="text-[11px] font-bold text-gray-800"><i class="fa-solid fa-store text-[#2b4c8c] mr-1"></i>지정판매소 요약</h2>
<span class="text-[10px] text-gray-500">상위 5곳</span>
</div>
<table class="w-full dense-table">
<thead>
<tr>
<th>판매소명</th>
<th class="text-right">월 봉투(백장)</th>
<th>상태</th>
<th class="text-right">최종거래</th>
</tr>
</thead>
<tbody>
<?php foreach ($storeSummary as $s): ?>
<tr>
<td class="font-medium"><?= esc($s[0]) ?></td>
<td class="text-right tabular-nums"><?= esc($s[1]) ?></td>
<td>
<?php if ($s[2] === '정상'): ?>
<span class="text-[10px] text-emerald-700"><?= esc($s[2]) ?></span>
<?php else: ?>
<span class="text-[10px] text-red-600"><?= esc($s[2]) ?></span>
<?php endif; ?>
</td>
<td class="text-right text-gray-500"><?= esc($s[3]) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
<!-- 승인 대기 + 요약 숫자 -->
<section class="bg-white border border-gray-200 rounded shadow-sm overflow-hidden">
<div class="px-2 py-1 border-b border-gray-200 bg-gray-50">
<h2 class="text-[11px] font-bold text-gray-800"><i class="fa-solid fa-user-check text-[#2b4c8c] mr-1"></i>회원·판매소 승인 대기</h2>
</div>
<div class="grid grid-cols-3 gap-1 p-1.5 border-b border-gray-100 bg-gray-50/50 text-center">
<div>
<div class="text-lg font-bold text-[#2b4c8c]">4</div>
<div class="text-[9px] text-gray-500">전체 대기</div>
</div>
<div>
<div class="text-lg font-bold text-amber-600">2</div>
<div class="text-[9px] text-gray-500">오늘 접수</div>
</div>
<div>
<div class="text-lg font-bold text-gray-600">1.2일</div>
<div class="text-[9px] text-gray-500">평균 처리</div>
</div>
</div>
<table class="w-full dense-table">
<thead>
<tr>
<th>신청자</th>
<th>유형</th>
<th>접수일</th>
<th>메모</th>
</tr>
</thead>
<tbody>
<?php foreach ($approvals as $a): ?>
<tr>
<td><?= esc($a[0]) ?></td>
<td><?= esc($a[1]) ?></td>
<td class="text-gray-600"><?= esc($a[2]) ?></td>
<td class="text-gray-500 truncate max-w-[6rem]"><?= esc($a[3]) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
</div>
<!-- 하단: 비율 도넛 + 텍스트 브리핑 -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-2">
<div class="bg-white border border-gray-200 rounded shadow-sm p-2 flex items-center gap-3">
<div class="relative w-16 h-16 shrink-0 rounded-full" style="background: conic-gradient(#2b4c8c 0% 40%, #10b981 40% 70%, #f59e0b 70% 92%, #e5e7eb 92% 100%);">
<div class="absolute inset-2 rounded-full bg-white flex items-center justify-center text-[10px] font-bold text-gray-700">비중</div>
</div>
<div class="text-[10px] text-gray-600 space-y-0.5">
<div><span class="inline-block w-2 h-2 rounded-full bg-[#2b4c8c] mr-1"></span>일반 40%</div>
<div><span class="inline-block w-2 h-2 rounded-full bg-emerald-500 mr-1"></span>스티커 30%</div>
<div><span class="inline-block w-2 h-2 rounded-full bg-amber-500 mr-1"></span>대형/특수 22%</div>
</div>
</div>
<div class="md:col-span-2 bg-white border border-gray-200 rounded shadow-sm p-2">
<h3 class="text-[11px] font-bold text-gray-800 mb-1"><i class="fa-solid fa-clipboard-list text-[#2b4c8c] mr-1"></i>운영 브리핑 (목업)</h3>
<ul class="text-[11px] text-gray-600 space-y-0.5 list-disc list-inside">
<li>다음 주 예상 구매신청 <strong class="text-gray-900">약 28건</strong> (전주 대비 +12%)</li>
<li><strong class="text-red-700">일반 20L</strong>·<strong class="text-red-700">특수규격 A</strong> 발주 권고 — 안전재고 미달</li>
<li>세금계산서 <strong>6건</strong> 미발행 — 담당 회계에 알림 발송됨</li>
<li>지정판매소 <strong>△△상회</strong> 연체 1건 — 현장 점검 일정 3/3</li>
</ul>
</div>
</div>
<p class="text-center text-[10px] text-gray-400 mt-2">
레이아웃: <a href="<?= esc($dashClassic) ?>" class="text-[#2b4c8c] hover:underline">/dashboard</a>
· <a href="<?= esc($dashModern) ?>" class="text-[#2b4c8c] hover:underline">/dashboard/modern</a>
· <strong class="text-gray-600">/dashboard/dense</strong> (이 화면)
· <a href="<?= esc($dashCharts) ?>" class="text-[#2b4c8c] hover:underline">/dashboard/charts</a>
</p>
</main>
</body>
</html>

View File

@@ -0,0 +1,215 @@
<?php
/**
* 로그인 후 메인 대시보드 — 모던 콘텐츠 레이아웃
* 상단 메뉴바는 /dashboard(lg_dashboard.php)와 동일
*
* @var string $lgLabel
*/
$lgLabel = $lgLabel ?? '북구';
$mbName = session()->get('mb_name') ?? '담당자';
$dashClassic = base_url('dashboard/classic-mock');
$dashModern = base_url('dashboard/modern');
$dashDense = base_url('dashboard/dense');
$dashCharts = base_url('dashboard/charts');
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>종량제 시스템 — 업무 현황 (모던)</title>
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap" rel="stylesheet"/>
<style>
body {
font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
font-size: 13px;
color: #333;
}
.nav-top a.nav-active {
color: #2b4c8c;
font-weight: 600;
border-bottom: 2px solid #2b4c8c;
padding-bottom: 2px;
margin-bottom: -2px;
}
.stat-card { transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15,23,42,.08); }
</style>
</head>
<body class="bg-gray-50 flex flex-col min-h-screen">
<!-- 상단 메뉴: lg_dashboard.php 와 동일 구조·스타일 (현재 URL만 /dashboard/modern 반영) -->
<header class="border-b border-gray-300 bg-white shadow-sm shrink-0" data-purpose="top-navigation">
<div class="flex items-center justify-between px-4 py-2 gap-4 flex-wrap">
<div class="flex items-center gap-3 shrink-0">
<div class="flex items-center gap-2 text-green-700 font-bold text-lg">
<i class="fa-solid fa-recycle text-xl"></i>
<span>종량제 시스템</span>
</div>
<span class="hidden sm:inline text-xs text-gray-500 border-l border-gray-300 pl-3">
<?= esc($lgLabel) ?> · <strong class="text-gray-700"><?= esc($mbName) ?></strong>님
</span>
</div>
<nav class="nav-top hidden lg:flex flex-wrap items-center gap-4 xl:gap-5 text-sm font-medium text-gray-700">
<a class="nav-active flex items-center gap-1 whitespace-nowrap" href="<?= esc($dashModern) ?>">
<i class="fa-solid fa-gauge-high"></i> 업무 현황
</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-regular fa-file-lines"></i> 문서 관리</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-box-open"></i> 규격</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-bag-shopping"></i> 봉투 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-table"></i> 데이터 양식</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-clock-rotate-left"></i> 사용 내역</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/inventory-inquiry') ?>"><i class="fa-solid fa-boxes-stacked"></i> 재고 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="<?= base_url('bag/waste-suibal-enterprise') ?>"><i class="fa-solid fa-table-list"></i> 수불 현황</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-chart-line"></i> 통계 분석</a>
<a class="flex items-center gap-1 hover:text-blue-600 whitespace-nowrap" href="#"><i class="fa-solid fa-gear"></i> 설정</a>
</nav>
<div class="flex items-center gap-2 shrink-0">
<a href="<?= esc($dashClassic) ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline">클래식</a>
<span class="text-gray-300 hidden sm:inline">|</span>
<a href="<?= esc($dashDense) ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline" title="정보 집약 종합">종합</a>
<span class="text-gray-300 hidden sm:inline">|</span>
<a href="<?= esc($dashCharts) ?>" class="text-xs text-[#2b4c8c] hover:underline whitespace-nowrap hidden sm:inline" title="그래프 대시보드">차트</a>
<a href="<?= base_url('logout') ?>" class="text-gray-500 hover:text-gray-800 p-1" title="로그아웃">
<i class="fa-solid fa-arrow-right-from-bracket text-lg"></i>
</a>
</div>
</div>
</header>
<main class="flex-1 flex flex-col min-h-0 overflow-y-auto p-4 md:p-6">
<?php if (session()->getFlashdata('success')): ?>
<div class="mb-4 p-3 rounded-xl bg-emerald-50 text-emerald-800 text-sm border border-emerald-100"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<!-- 히어로 배너 -->
<section class="rounded-2xl bg-gradient-to-r from-slate-800 via-slate-800 to-emerald-900 text-white p-6 md:p-8 mb-6 shadow-lg relative overflow-hidden">
<div class="absolute top-0 right-0 w-64 h-64 bg-emerald-500/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2 pointer-events-none"></div>
<div class="relative">
<p class="text-emerald-300/90 text-sm font-medium mb-1"><?= esc($lgLabel) ?></p>
<h1 class="text-2xl md:text-3xl font-bold tracking-tight mb-2">안녕하세요, <?= esc($mbName) ?>님</h1>
<p class="text-slate-300 text-sm max-w-xl">오늘의 재고·구매신청·발주 요약을 한눈에 확인하세요. 다른 레이아웃은 <a href="<?= esc($dashClassic) ?>" class="text-emerald-300 underline hover:text-white">가로 메뉴형 대시보드</a>에서 볼 수 있습니다.</p>
</div>
</section>
<!-- KPI 카드 -->
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 md:gap-4 mb-6">
<div class="stat-card rounded-2xl bg-white border border-slate-100 p-4 shadow-sm">
<div class="w-10 h-10 rounded-xl bg-amber-100 text-amber-600 flex items-center justify-center mb-3"><i class="fa-solid fa-triangle-exclamation"></i></div>
<p class="text-2xl font-bold text-slate-900">3</p>
<p class="text-xs text-slate-500 mt-1">재고 부족 품목</p>
</div>
<div class="stat-card rounded-2xl bg-white border border-slate-100 p-4 shadow-sm">
<div class="w-10 h-10 rounded-xl bg-sky-100 text-sky-600 flex items-center justify-center mb-3"><i class="fa-solid fa-cart-arrow-down"></i></div>
<p class="text-2xl font-bold text-slate-900">12</p>
<p class="text-xs text-slate-500 mt-1">미처리 구매신청</p>
</div>
<div class="stat-card rounded-2xl bg-white border border-slate-100 p-4 shadow-sm">
<div class="w-10 h-10 rounded-xl bg-emerald-100 text-emerald-600 flex items-center justify-center mb-3"><i class="fa-solid fa-truck-ramp-box"></i></div>
<p class="text-2xl font-bold text-slate-900">8</p>
<p class="text-xs text-slate-500 mt-1">이번 주 발주·입고</p>
</div>
<div class="stat-card rounded-2xl bg-white border border-slate-100 p-4 shadow-sm">
<div class="w-10 h-10 rounded-xl bg-violet-100 text-violet-600 flex items-center justify-center mb-3"><i class="fa-solid fa-user-clock"></i></div>
<p class="text-2xl font-bold text-slate-900">4</p>
<p class="text-xs text-slate-500 mt-1">승인 대기 회원</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<!-- 링 차트 느낌 (CSS) -->
<div class="lg:col-span-1 rounded-2xl bg-white border border-slate-100 p-5 shadow-sm">
<h3 class="font-semibold text-slate-800 mb-4 text-sm">봉투 재고 비중</h3>
<div class="flex items-center justify-center gap-6">
<div class="relative w-36 h-36 rounded-full" style="background: conic-gradient(#10b981 0% 35%, #3b82f6 35% 62%, #f59e0b 62% 88%, #e2e8f0 88% 100%);">
<div class="absolute inset-3 rounded-full bg-white flex flex-col items-center justify-center text-center">
<span class="text-lg font-bold text-slate-800">100%</span>
<span class="text-[10px] text-slate-500">목업</span>
</div>
</div>
<ul class="text-xs space-y-2 text-slate-600">
<li class="flex items-center gap-2"><span class="w-2 h-2 rounded-full bg-emerald-500"></span> 일반용</li>
<li class="flex items-center gap-2"><span class="w-2 h-2 rounded-full bg-blue-500"></span> 스티커</li>
<li class="flex items-center gap-2"><span class="w-2 h-2 rounded-full bg-amber-500"></span> 재사용</li>
<li class="flex items-center gap-2"><span class="w-2 h-2 rounded-full bg-slate-200"></span> 기타</li>
</ul>
</div>
</div>
<!-- 미니 타임라인 스타일 구매신청 -->
<div class="lg:col-span-2 rounded-2xl bg-white border border-slate-100 p-5 shadow-sm">
<div class="flex items-center justify-between mb-4">
<h3 class="font-semibold text-slate-800 text-sm">지정판매소 구매신청</h3>
<button type="button" class="text-xs font-medium text-emerald-600 hover:text-emerald-800">전체</button>
</div>
<ul class="space-y-3">
<?php
$timeline = [
['행복마트 북구점', '일반용 5L · 2,000장', '09:12', '접수'],
['○○슈퍼', '음식물 스티커 · 500장', '08:45', '처리중'],
['△△상회', '일반용 20L · 박스 3', '어제', '완료'],
];
foreach ($timeline as $t):
$dot = $t[3] === '완료' ? 'bg-emerald-500' : ($t[3] === '처리중' ? 'bg-amber-400' : 'bg-slate-400');
?>
<li class="flex gap-3 text-sm">
<span class="w-2 shrink-0 mt-1.5"><span class="block w-2 h-2 rounded-full <?= $dot ?>"></span></span>
<div class="flex-1 min-w-0 border-b border-slate-50 pb-3">
<div class="flex justify-between gap-2">
<span class="font-medium text-slate-800 truncate"><?= esc($t[0]) ?></span>
<span class="text-xs text-slate-400 shrink-0"><?= esc($t[2]) ?></span>
</div>
<p class="text-xs text-slate-500 mt-0.5"><?= esc($t[1]) ?></p>
<span class="inline-block mt-1 text-[10px] px-2 py-0.5 rounded-md bg-slate-100 text-slate-600"><?= esc($t[3]) ?></span>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<!-- 표 형태 요약 (카드 안) -->
<div class="rounded-2xl bg-white border border-slate-100 shadow-sm overflow-hidden mb-4">
<div class="px-5 py-3 border-b border-slate-100 bg-slate-50/80">
<h3 class="font-semibold text-slate-800 text-sm">최근 신청 상세</h3>
</div>
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="text-left text-xs text-slate-500 border-b border-slate-100">
<th class="px-5 py-3 font-medium">일시</th>
<th class="px-5 py-3 font-medium">판매소</th>
<th class="px-5 py-3 font-medium">품목</th>
<th class="px-5 py-3 font-medium text-right">수량</th>
<th class="px-5 py-3 font-medium text-center">상태</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
<tr class="hover:bg-slate-50/80">
<td class="px-5 py-3 text-slate-600">2025-02-26 09:12</td>
<td class="px-5 py-3">행복마트 북구점</td>
<td class="px-5 py-3">일반용 5L</td>
<td class="px-5 py-3 text-right tabular-nums">2,000장</td>
<td class="px-5 py-3 text-center"><span class="text-xs px-2 py-1 rounded-lg bg-slate-100">접수</span></td>
</tr>
<tr class="hover:bg-slate-50/80">
<td class="px-5 py-3 text-slate-600">2025-02-26 08:45</td>
<td class="px-5 py-3">○○슈퍼</td>
<td class="px-5 py-3">음식물 스티커</td>
<td class="px-5 py-3 text-right tabular-nums">500장</td>
<td class="px-5 py-3 text-center"><span class="text-xs px-2 py-1 rounded-lg bg-amber-50 text-amber-800">처리중</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p class="text-center text-[11px] text-slate-400">
URL 비교 — <strong class="text-slate-600">클래식 레이아웃</strong> <code class="bg-slate-100 px-1 rounded">/dashboard</code>
· <strong class="text-slate-600">모던 콘텐츠(이 화면)</strong> <code class="bg-slate-100 px-1 rounded">/dashboard/modern</code>
· <a href="<?= esc($dashCharts) ?>" class="text-[#2b4c8c] hover:underline">/dashboard/charts</a>
<span class="block sm:inline mt-1 sm:mt-0">· 상단 메뉴는 동일</span>
</p>
</main>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More