Compare commits

...

6 Commits

Author SHA1 Message Date
yangsh
b0a0d319ef 문자발송내역 추가 2025-12-12 10:30:50 +09:00
yangsh
d43d280e23 페이지 부분수정 2025-12-11 17:30:10 +09:00
yangsh
2a855f789e sms일괄저장 추가 2025-12-11 17:25:43 +09:00
yangsh
7324d2d9ba 시스템관리 페이지 추가 2025-12-11 16:48:03 +09:00
yangsh
533d6b5d6b Ignore App.php 2025-12-11 16:47:24 +09:00
yangsh
3aca209291 Stop tracking Dockerfile 2025-12-11 16:45:25 +09:00
47 changed files with 6072 additions and 446 deletions

5
.gitignore vendored
View File

@@ -48,6 +48,11 @@ Vagrantfile
docker-compose*.yml docker-compose*.yml
Dockerfile Dockerfile
#-------------------------
# CI ignore
#-------------------------
app/Config/App.php
#------------------------- #-------------------------
# Temporary Files # Temporary Files
#------------------------- #-------------------------

View File

@@ -1,44 +0,0 @@
FROM php:8.4-apache
# 타임존 (옵션)
RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime \
&& echo Asia/Seoul > /etc/timezone
# mod_rewrite 활성화
RUN a2enmod rewrite
# 필수 라이브러리 + PHP 확장 설치 (intl, pdo_mysql, mysqli, gd, zip)
RUN apt-get update && apt-get install -y \
libicu-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
zip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install intl pdo pdo_mysql mysqli gd zip \
&& rm -rf /var/lib/apt/lists/*
# composer 바이너리 복사 (멀티스테이지)
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# DocumentRoot 를 CI4 public 으로 변경
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
# 기본 vhost 의 DocumentRoot 만 변경
RUN sed -ri -e 's!DocumentRoot /var/www/html!DocumentRoot ${APACHE_DOCUMENT_ROOT}!g' \
/etc/apache2/sites-available/000-default.conf
# CI4 public 디렉터리에 .htaccess 허용 + 접근 허용
RUN printf "<Directory /var/www/html/public>\n\
AllowOverride All\n\
Require all granted\n\
</Directory>\n" > /etc/apache2/conf-available/ci4.conf \
&& a2enconf ci4
WORKDIR /var/www/html
# writable 폴더 만들고 권한 부여
RUN mkdir -p /var/www/html/writable/upload/notice \
&& chown -R www-data:www-data /var/www/html/writable \
&& chmod -R 775 /var/www/html/writable

View File

@@ -7,7 +7,7 @@ class MenuCell
public function index() public function index()
{ {
$model = new MenuModel(); $model = new MenuModel();
$menus = $model->getMenuList(); $menus = $model->getMenuList(session('usr_level'));
$menuIcons = [ $menuIcons = [
'M1' => 'pe-7s-note2', 'M1' => 'pe-7s-note2',

View File

@@ -1,202 +0,0 @@
<?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:8800/';
/**
* 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 = [];
/**
* --------------------------------------------------------------------------
* 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 = '';
/**
* --------------------------------------------------------------------------
* 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;
}

View File

@@ -9,56 +9,102 @@ use CodeIgniter\Router\RouteCollection;
$routes->setAutoRoute(true); $routes->setAutoRoute(true);
/** /**
* 화면 * 공통 화면
*/ */
$routes->get('/login', 'Login::index');
$routes->get("/login", "Login::index"); $routes->get('/logout', 'Login::out');
$routes->get("/logout", "Login::out");
$routes->get('/', 'Home\Home::dashboard'); $routes->get('/', 'Home\Home::dashboard');
$routes->get('/home', 'Home\Home::dashboard'); $routes->get('/home', 'Home\Home::dashboard');
$routes->get('/board/notice/lists', 'Board\Notice::notice'); // 공지사항
$routes->get('/board/notice/detail/(:num)', 'Board\Notice::detail/$1'); // 공지사항 상세
$routes->get('/board/notice/write', 'Board\Notice::write'); // 공지사항 작성
$routes->get('/board/notice/modify/(:num)', 'Board\Notice::modify/$1'); // 공지사항 수정
/** /**
* 시스템관리 * 게시판 (board) 그룹
*/ */
$routes->get('/manage/user/lists', 'Manage\User::user'); // 사용자관리 $routes->group('board', ['namespace' => 'App\Controllers\Board'], function ($routes) {
$routes->get('/manage/dept/lists', 'Manage\Dept::dept'); // 조직관리
$routes->get('/manage/dept/getchkuser', 'Manage\Dept::getchkuser'); // 총괄팀장 페이지
$routes->get('/manage/menu/lists', 'Manage\Menu::lists'); // 메뉴관리 /**
$routes->get('/manage/dupl_phone/lists', 'Manage\Phone::lists'); // 전화확인관리 * 공지사항
$routes->get('/manage/loginlog/lists', 'Manage\LoginLog::lists'); // 로그인이력 */
$routes->get('notice/lists', 'Notice::notice');
$routes->get('notice/detail/(:num)', 'Notice::detail/$1');
$routes->get('notice/write', 'Notice::write');
$routes->get('notice/modify/(:num)', 'Notice::modify/$1');
// API
$routes->get('notice/getNoticeList', 'Notice::getNoticeList');
$routes->post('notice/actWrite', 'Notice::actWrite');
$routes->post('notice/actModify', 'Notice::actModify');
$routes->post('notice/remove', 'Notice::actRemove');
$routes->get('notice/download/(:num)', 'Notice::download/$1');
});
/** /**
* API ROUTES * 시스템관리 (manage) 그룹
*/ */
$routes->post('/login/chkLogin', 'Login::chkLogin'); // 로그인 요청 $routes->group('manage', ['namespace' => 'App\Controllers\Manage'], function ($routes) {
$routes->get('/board/notice/getNoticeList', 'Board\Notice::getNoticeList'); // 공지사항 목록 조회
$routes->post('/board/notice/actWrite', 'Board\Notice::actWrite'); // 공지사항 작성 요청
$routes->post('/board/notice/actModify', 'Board\Notice::actModify'); // 공지사항 작성 요청
$routes->post('/board/notice/remove', 'Board\Notice::actRemove'); // 공지사항 삭제 요청
$routes->get('/board/notice/download/(:num)', 'Board\Notice::download/$1'); // 첨부파일 다운로드
// 시스템관리 /** 화면 */
$routes->get('/manage/user/getUserList', 'Manage\User::getUserList'); // 유저 목록 조회
$routes->post('/manage/user/save', 'Manage\User::saveUser'); // 유저정보저장
$routes->post('/manage/user/remove', 'Manage\User::removeUser'); // 유저정보삭제
$routes->get('/manage/user/excel', 'Manage\User::excel'); // 유저 엑셀다운로드
$routes->get('/manage/dept/getDeptList', 'Manage\Dept::getDeptList'); // 조직목록 조회 $routes->get('sms/lists', 'Sms::lists');
$routes->get('/manage/dept/getUserList', 'Manage\Dept::getUserList'); // 유저 목록 조회 $routes->get('user/lists', 'User::user');
$routes->get('/manage/dept/getPdept', 'Manage\Dept::getPdept'); // 상위조직 조회 $routes->get('dept/lists', 'Dept::dept');
$routes->post('/manage/dept/saveDept', 'Manage\Dept::saveDept'); // 상위조직 조회 $routes->get('dept/getchkuser', 'Dept::getchkuser');
$routes->get('menu/lists', 'Menu::lists');
$routes->get('permit/lists', 'Permit::lists');
$routes->get('areas/lists', 'Areas::lists');
$routes->get('dupl_phone/lists', 'Phone::lists');
$routes->get('scomplex/lists', 'Scomplex::lists');
$routes->get('loginlog/lists', 'LoginLog::lists');
$routes->post('/manage/menu/getMenuList', 'Manage\Menu::getMenuList'); // 메뉴 목록 조회 /** API - SMS관리 */
$routes->get('sms/getSmsList', 'Sms::getSmsList');
$routes->get('sms/excel', 'Sms::excel');
$routes->get('/manage/dupl_phone/getDuplPhoneList', 'Manage\Phone::getDuplPhoneList'); // 전화확인 목록조회 /** API - 사용자관리 */
$routes->post('/manage/dupl_phone/savePhone', 'Manage\Phone::savePhone'); // 전화정보저장 $routes->get('user/getUserList', 'User::getUserList');
$routes->post('user/save', 'User::saveUser');
$routes->post('user/remove', 'User::removeUser');
$routes->get('user/excel', 'User::excel');
$routes->post('user/saveSms', 'User::saveSms');
$routes->get('/manage/loginlog/getLogList', 'Manage\LoginLog::getLogList'); // 로그 목록 조회 /** API - 조직관리 */
$routes->get('/manage/loginlog/excel', 'Manage\LoginLog::excel'); // 엑셀다운로드 $routes->get('dept/getDeptList', 'Dept::getDeptList');
$routes->get('dept/getUserList', 'Dept::getUserList');
$routes->get('dept/getPdept', 'Dept::getPdept');
$routes->post('dept/saveDept', 'Dept::saveDept');
/** API - 메뉴관리 */
$routes->post('menu/getMenuList', 'Menu::getMenuList');
$routes->post('menu/saveMenu', 'Menu::saveMenu');
/** API - 권한관리 */
$routes->get('permit/getMenuAuthList', 'Permit::getMenuAuthList');
$routes->post('permit/saveMenuAuth', 'Permit::saveMenuAuth');
/** API - 지역관리 */
$routes->post('areas/getAreaList', 'Areas::getAreaList');
$routes->get('areas/getSvcArea', 'Areas::getSvcArea');
$routes->post('areas/saveRegion', 'Areas::saveRegion');
$routes->post('areas/saveAllRegion', 'Areas::saveAllRegion');
/** API - 전화확인관리 */
$routes->get('dupl_phone/getDuplPhoneList', 'Phone::getDuplPhoneList');
$routes->post('dupl_phone/savePhone', 'Phone::savePhone');
$routes->get('dupl_phone/excel', 'Phone::excel');
/** API - 특이단지관리 */
$routes->get('scomplex/getScomplexList', 'Scomplex::getScomplexList');
$routes->post('scomplex/saveScomplex', 'Scomplex::saveScomplex');
$routes->get('scomplex/excel', 'Scomplex::excel');
/** API - 로그인로그관리 */
$routes->get('loginlog/getLogList', 'LoginLog::getLogList');
$routes->get('loginlog/excel', 'LoginLog::excel');
});
/**
* 로그인 API
*/
$routes->post('/login/chkLogin', 'Login::chkLogin');

View File

@@ -5,6 +5,7 @@ namespace Config;
use CodeIgniter\Config\BaseConfig; use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler; use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler; use CodeIgniter\Session\Handlers\FileHandler;
use CodeIgniter\Session\Handlers\RedisHandler;
class Session extends BaseConfig class Session extends BaseConfig
{ {
@@ -21,7 +22,8 @@ class Session extends BaseConfig
* *
* @var class-string<BaseHandler> * @var class-string<BaseHandler>
*/ */
public string $driver = FileHandler::class; // public string $driver = FileHandler::class;
public string $driver = RedisHandler::class;
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
@@ -57,7 +59,8 @@ class Session extends BaseConfig
* *
* IMPORTANT: You are REQUIRED to set a valid save path! * IMPORTANT: You are REQUIRED to set a valid save path!
*/ */
public string $savePath = WRITEPATH . 'session'; // public string $savePath = WRITEPATH . 'session';
public string $savePath = 'tcp://192.168.10.243:6379?database=0';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------

View File

@@ -19,7 +19,7 @@ abstract class BaseController extends Controller
// 메뉴 전역 로딩 // 메뉴 전역 로딩
$menuModel = new MenuModel(); $menuModel = new MenuModel();
$menus = $menuModel->getMenuList(); $menus = $menuModel->getMenuList(session('usr_level'));
$this->data['menus'] = $menus["mainMenu"]; $this->data['menus'] = $menus["mainMenu"];
} }
} }

View File

@@ -39,7 +39,4 @@ class Home extends BaseController
]); ]);
} }
} }

View File

@@ -0,0 +1,160 @@
<?php
namespace App\Controllers\manage;
use App\Controllers\BaseController;
use App\Models\manage\AreasModel;
class Areas extends BaseController
{
private $areaModel;
public function __construct()
{
$this->areaModel = new AreasModel();
}
// 지역코드조회
public function getAreaList()
{
$sido = $this->request->getPost('srcSido');
$gugun = $this->request->getPost('srcGugun');
$datas = $this->areaModel->getAreaList($sido, $gugun);
return $this->response->setJson($datas);
}
public function lists(): string
{
$sido = $this->areaModel->getAreaList();
$bonbu = $this->areaModel->getBonbuList();
$team = $this->areaModel->getTeamList();
$user = $this->areaModel->getUserList();
return view("pages/manage/areas/lists", [
'sido' => $sido,
'bonbu' => $bonbu,
'team' => $team,
'user' => $user,
]);
}
public function getSvcArea()
{
$start = (int) $this->request->getGet('start') ?: 0;
$end = (int) $this->request->getGet('length') ?: 10;
$srcSido = $this->request->getGet('srcSido'); // 시도
$srcGugun = $this->request->getGet('srcGugun'); // 시도
$srcDong = $this->request->getGet('srcDong'); // 시도
$region = "";
if (!empty($srcDong)) {
$region = substr($srcDong, 0, 8);
} else if (!empty($srcGugun)) {
$region = substr($srcGugun, 0, 5);
if (substr($region, 4) == "0") {
$region = substr($srcGugun, 0, 4);
}
} else if (!empty($srcSido)) {
$region = substr($srcSido, 0, 2);
}
$data = [
'region' => $region, // 지역코드
'srcUserbonbu' => $this->request->getGet('srcUserbonbu'), // 본부
'srcUserteam' => $this->request->getGet('srcUserteam'), // 팀
'positionYn' => $this->request->getGet('positionYn'), // 지정유무
];
$totalCount = $this->areaModel->getTotalCount($data);
$datas = $this->areaModel->getSvcArea($start, $end, $data);
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
'data' => $datas,
]);
}
// 지역관리정보저장
public function saveRegion()
{
try {
$json = $this->request->getJSON(true); // true = 배열로 반환
if (!$json) {
return $this->response->setJSON([
'status' => 'error',
'msg' => '데이터 누락'
]);
}
foreach ($json as $row) {
$regioncd = $row['region_cd'];
$bonbu = $row['bonbu'];
$team = $row['team'];
$user = $row['user'];
// UPDATE region_codes
$this->areaModel->saveRegion($regioncd, $team, $user);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
public function saveAllRegion()
{
try {
$json = $this->request->getJSON(true); // true = 배열로 반환
if (!$json) {
return $this->response->setJSON([
'status' => 'error',
'msg' => '데이터 누락'
]);
}
foreach ($json as $row) {
$regioncd = $row['region_cd'];
$bonbu = $row['bonbu'];
$team = $row['team'];
$user = $row['user'];
// UPDATE region_codes
$this->areaModel->saveRegion($regioncd, $team, $user);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
}

View File

@@ -25,7 +25,6 @@ class Menu extends BaseController
$params = []; $params = [];
$total = $this->menuModel->getTotalCount(); $total = $this->menuModel->getTotalCount();
$datas = $this->menuModel->getMenuList($params); $datas = $this->menuModel->getMenuList($params);
@@ -133,93 +132,37 @@ class Menu extends BaseController
} }
// private function buildTree(array $items, $parentId = 'ROOT', int $level = 0): array // 메뉴정보저장
// { public function saveMenu()
// $branch = []; {
try {
// $lft = 1; $data = [
// foreach ($items as $k => $item) { 'mnu_pid' => $this->request->getPost('mnu_pid'),
'mnu_id' => $this->request->getPost('mnu_id'),
'mnu_nm' => $this->request->getPost('mnu_nm'),
'mnu_url' => $this->request->getPost('mnu_url'),
'mnu_tp' => $this->request->getPost('mnu_tp'),
'view_odr' => $this->request->getPost('view_odr'),
'use_yn' => $this->request->getPost('use_yn'),
'usr_sq' => session('usr_sq'),
];
// // 현재 parentId의 자식인지 확인
// if ($item['mnu_pid'] === $parentId) {
// $item['lft'] = $lft; // INSERT UPDATE menu
$this->menuModel->saveMenu($data);
// if ($item['mnu_tp'] === 'R') { return $this->response->setJSON([
// $item['isLeaf'] = false; 'code' => '0',
// $item['rgt'] = 1 + (63 * 2 + 1); 'msg' => 'success'
// } else if ($item['mnu_tp'] === 'D') { ]);
// $item['level'] = 1;
// $item['menu_tp'] = 'D';
// $item['menu_tp_nm'] = '디렉토리';
// $item['iconCls'] = 'ui-icon-folder-open';
// $subCnt = 0; } catch (\Exception $e) {
// foreach ($items as $item2): return $this->response->setJSON([
'code' => '9',
// if (strpos($item2['mnu_id'], $item['mnu_id'] . '.') === 0) { 'msg' => $e->getMessage(),
// $subCnt++; ]);
// } }
}
// endforeach;
// $item['rgt'] = $lft + ($subCnt * 2) + 1;
// if ($subCnt === 0) {
// $item['isLeaf'] = true;
// } else {
// $item['isLeaf'] = false;
// }
// } else if ($item['mnu_tp'] == 'P') {
// $item['level'] = 2;
// $item['menu_tp'] = 'R';
// $item['menu_tp_nm'] = '화면';
// $item['iconCls'] = 'ui-icon-document';
// }
// // else {
// // // 예: 루트 R 같은 경우
// // $item['menu_tp'] = $item['mnu_tp'];
// // $item['menu_tp_nm'] = ($item['mnu_tp'] === 'R') ? '루트' : '메뉴';
// // $item['iconCls'] = 'ui-icon-home';
// // }
// // 자식 찾기 (⚠️ 여기 반드시 $this->buildTree)
// // $children = $this->buildTree($items, $item['mnu_id'], $level + 1);
// // if (!empty($children)) {
// // // 자식 정렬 (view_odr → mnu_id 순)
// // usort($children, function ($a, $b) {
// // $ao = $a['view_odr'] ?? 0;
// // $bo = $b['view_odr'] ?? 0;
// // if ($ao == $bo) {
// // return strcmp($a['mnu_id'], $b['mnu_id']);
// // }
// // return $ao <=> $bo;
// // });
// // $item['children'] = $children;
// // }
// $branch[] = $item;
// }
// $lft++;
// }
// // 현재 레벨도 정렬 (view_odr → mnu_id 순)
// usort($branch, function ($a, $b) {
// $ao = $a['view_odr'] ?? 0;
// $bo = $b['view_odr'] ?? 0;
// if ($ao == $bo) {
// return strcmp($a['mnu_id'], $b['mnu_id']);
// }
// return $ao <=> $bo;
// });
// return $branch;
// }
} }

View File

@@ -0,0 +1,104 @@
<?php
namespace App\Controllers\manage;
use App\Controllers\BaseController;
use App\Models\manage\PermitModel;
class Permit extends BaseController
{
private $permitModel;
public function __construct()
{
$this->permitModel = new PermitModel();
}
public function lists(): string
{
$usrLevel = $this->permitModel->getUsrLevel();
return view("pages/manage/permit/lists", [
'usrLevel' => $usrLevel,
]);
}
// 메뉴권한목록조회
public function getMenuAuthList()
{
$usrLevel = $this->request->getGet('usr_level');
$lists = $this->permitModel->getMenuAuthList($usrLevel);
if (!empty($lists)) {
foreach ($lists as $k => $d) {
$state = [];
if ($d['state'] === "selected") {
$state['selected'] = true;
$lists[$k]['state'] = $state;
} else {
$state['selected'] = false;
$lists[$k]['state'] = $state;
}
}
}
return $this->response->setJSON($lists);
}
// 메뉴권한정보저장
public function saveMenuAuth()
{
try {
$usrLevel = $this->request->getPost('usr_level');
if (empty($usrLevel)) {
return $this->response->setJSON([
'code' => '1',
'msg' => '그룹 데이터 누락'
]);
}
$menuArr = explode(',', $this->request->getPost('mnu_cd'));
if (empty($menuArr)) {
return $this->response->setJSON([
'code' => '1',
'msg' => '메뉴 데이터 누락'
]);
} else {
// DELETE menu_perms
$this->permitModel->deleteMenuPermit($usrLevel);
foreach ($menuArr as $m) {
$data = [
'mnuId' => $m,
'usrLevel' => $usrLevel,
'usrSq' => session('usr_sq'),
];
// INSERT menu_perms
$this->permitModel->saveMenuAuth($data);
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
}

View File

@@ -29,7 +29,11 @@ class Phone extends BaseController
$end = (int) $this->request->getGet('length') ?: 10; $end = (int) $this->request->getGet('length') ?: 10;
$data = [ $data = [
'srchTxt' => $this->request->getGet('search[value]') ?: '', 'cpid' => $this->request->getGet('cpid') ?: '',
's_date' => $this->request->getGet('s_date') ?: '',
'e_date' => $this->request->getGet('e_date') ?: '',
'phone' => $this->request->getGet('phone') ?: '',
'useYn' => $this->request->getGet('useYn') ?: '',
]; ];
$totalCount = $this->phoneModel->getTotalCount($data); $totalCount = $this->phoneModel->getTotalCount($data);
@@ -101,6 +105,33 @@ class Phone extends BaseController
} }
} }
// 엑셀다운로드
public function excel()
{
try {
$data = [
'cpid' => $this->request->getGet('cpid') ?: '',
's_date' => $this->request->getGet('s_date') ?: '',
'e_date' => $this->request->getGet('e_date') ?: '',
'phone' => $this->request->getGet('phone') ?: '',
'useYn' => $this->request->getGet('useYn') ?: '',
];
$datas = $this->phoneModel->getExcelPhoneList($data);
return $this->response->setJSON(body: [
'data' => $datas,
]);
} catch (\Exception $e) {
$e->getPrevious()->getTraceAsString();
}
}
// 연락처 유효성검사 // 연락처 유효성검사
private function validPhone($phone) private function validPhone($phone)

View File

@@ -0,0 +1,120 @@
<?php
namespace App\Controllers\manage;
use App\Controllers\BASeController;
use App\Models\manage\ScomplexModel;
class Scomplex extends BASeController
{
private $model;
public function __construct()
{
$this->model = new ScomplexModel();
}
public function lists(): string
{
$codes = $this->model->getCodeList();
return view("pages/manage/scomplex/lists", ['code' => $codes,]);
}
public function getScomplexList()
{
$start = (int) $this->request->getGet('start') ?: 0;
$end = (int) $this->request->getGet('length') ?: 10;
$data = [
'name' => $this->request->getGet('name'), // 단지명
'apporval_date' => $this->request->getGet('apporval_date'), // 사용승인일
'end_date' => $this->request->getGet('end_date'), // 승인종료일
'code' => $this->request->getGet('code'), // 단지코드
'cd' => $this->request->getGet('cd'), // 매물종류
'address' => $this->request->getGet('address'), // 주소
];
$totalCount = $this->model->getTotalCount($data);
$datas = $this->model->getScomplexList($start, $end, $data);
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
'data' => $datas,
]);
}
// 특이단지 정보 저장
public function saveScomplex()
{
try {
$type = $this->request->getPost('type');
$data = [
$this->request->getPost('sm_name'),
$this->request->getPost('sm_code'),
$this->request->getPost('sm_address'),
$this->request->getPost('codes'),
$this->request->getPost('sm_apporval_date'),
$this->request->getPost('sm_end_date'),
$this->request->getPost('sm_memo'),
session('usr_sq'),
];
if ($type === "create") {
// INSERT scomplex_manage
$this->model->insertScomplex($data);
} else if ($type === "update") {
array_push($data, $this->request->getPost('sm_seq'));
// UPDATE scomplex_manage
$this->model->updateScomplex($data);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 엑셀다운로드
public function excel()
{
try {
$data = [
'name' => $this->request->getGet('name'), // 단지명
'apporval_date' => $this->request->getGet('apporval_date'), // 사용승인일
'end_date' => $this->request->getGet('end_date'), // 승인종료일
'code' => $this->request->getGet('code'), // 단지코드
'cd' => $this->request->getGet('cd'), // 매물종류
'address' => $this->request->getGet('address'), // 주소
];
$datas = $this->model->getExcelScomplexList($data);
return $this->response->setJSON(body: [
'data' => $datas,
]);
} catch (\Exception $e) {
$e->getPrevious()->getTraceAsString();
}
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Controllers\manage;
use App\Controllers\BaseController;
use App\Models\manage\SmsModel;
class Sms extends BaseController
{
private $smsModel;
public function __construct()
{
$this->smsModel = new SmsModel();
}
public function lists(): string
{
return view("pages/manage/sms/lists");
}
public function getSmsList()
{
$start = (int) $this->request->getGet('start') ?: 0;
$end = (int) $this->request->getGet('length') ?: 10;
$data = [
'start_dt' => $this->request->getGet('start_dt'),
'end_dt' => $this->request->getGet('end_dt'),
'srchType' => $this->request->getGet('srchType'),
'srchTxt' => $this->request->getGet('srchTxt'),
];
$totalCount = $this->smsModel->getTotalCount($data);
$datas = $this->smsModel->getSmsList($start, $end, $data);
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
'data' => $datas,
]);
}
// 엑셀다운로드 - 내역
public function excel()
{
$data = [
'start_dt' => $this->request->getGet('start_dt'),
'end_dt' => $this->request->getGet('end_dt'),
'srchType' => $this->request->getGet('srchType'),
'srchTxt' => $this->request->getGet('srchTxt'),
];
$datas = $this->smsModel->getExcelList($data);
return $this->response->setJSON(body: [
'data' => $datas,
]);
}
}

View File

@@ -155,6 +155,30 @@ class User extends BaseController
} }
} }
// SMS 인증여부 일괄저장
public function saveSms()
{
try {
$useYn = $this->request->getPost('useYn') ?: 'Y';
// UPDATE users
$this->userModel->updateUserSmsYn($useYn);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 엑셀다운로드 // 엑셀다운로드
public function excel() public function excel()
{ {

View File

@@ -5,7 +5,7 @@ use CodeIgniter\Model;
class MenuModel extends Model class MenuModel extends Model
{ {
// 메뉴목록조회 // 메뉴목록조회
public function getMenuList() public function getMenuList($usrLevel)
{ {
$sql = "SELECT a.mnu_id, a.mnu_pid, a.mnu_nm, a.mnu_url $sql = "SELECT a.mnu_id, a.mnu_pid, a.mnu_nm, a.mnu_url
FROM menu AS a FROM menu AS a
@@ -16,7 +16,7 @@ class MenuModel extends Model
ORDER BY a.view_odr ASC ORDER BY a.view_odr ASC
"; ";
$query = $this->db->query($sql, binds: [1]); $query = $this->db->query($sql, binds: [$usrLevel]);
$mainMenuList = $query->getResultArray(); $mainMenuList = $query->getResultArray();
$sql = "SELECT a.mnu_id, a.mnu_pid, a.mnu_nm, a.mnu_url $sql = "SELECT a.mnu_id, a.mnu_pid, a.mnu_nm, a.mnu_url
@@ -27,7 +27,7 @@ class MenuModel extends Model
ORDER BY a.view_odr ASC ORDER BY a.view_odr ASC
"; ";
$query = $this->db->query($sql, [1]); $query = $this->db->query($sql, [$usrLevel]);
$subMenuList = $query->getResultArray(); $subMenuList = $query->getResultArray();
$data = [ $data = [

View File

@@ -0,0 +1,257 @@
<?php
namespace App\Models\manage;
use CodeIgniter\Model;
class AreasModel extends Model
{
// 지역 목록 조회
public function getAreaList($sido = '', $gugun = '')
{
if (!empty($gugun)) {
$gugun = substr($gugun, '0', '5');
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm" .
" FROM region_codes a" .
" LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,5),'00000')" .
" WHERE a.region_cd LIKE concat(?, '%')" .
" AND a.region_cd NOT LIKE '%00000'" .
" AND a.region_cd LIKE '%00'" .
" AND a.use_yn = 'Y'" .
" ORDER BY a.region_nm ASC";
$query = $this->db->query($sql, [$gugun]);
} else if (!empty($sido)) {
$chk_sido = substr($sido, '0', '2');
if ($chk_sido === '36') {
$sido = substr($sido, '0', '4');
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm " .
"FROM region_codes a " .
"LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,4),'000000') " .
"WHERE a.region_cd LIKE concat(?, '%') " .
"AND a.region_cd NOT LIKE '%000000' " .
"AND a.region_cd LIKE '%00' " .
"AND a.use_yn = 'Y' " .
"AND EXISTS (SELECT 'x' FROM region_codes c WHERE c.region_cd LIKE CONCAT(SUBSTR(a.region_cd,1,5),'%') AND c.region_cd > CONCAT(SUBSTR(a.region_cd,1,5),'00000')) " .
"ORDER BY a.region_nm ASC";
} else {
$sido = substr($sido, '0', '2');
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm" .
" FROM region_codes a" .
" LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,2),'00000000')" .
" WHERE a.region_cd LIKE concat(?, '%')" .
" AND a.region_cd NOT LIKE '%00000000'" .
" AND a.region_cd LIKE '%00000'" .
" AND a.use_yn = 'Y'" .
" AND EXISTS (SELECT 'x' FROM region_codes c WHERE c.region_cd LIKE CONCAT(SUBSTR(a.region_cd,1,5),'%') AND c.region_cd > CONCAT(SUBSTR(a.region_cd,1,5),'00000'))" .
" ORDER BY a.region_nm ASC";
}
$query = $this->db->query($sql, [$sido]);
} else {
$sql = "SELECT a.region_cd, a.region_nm " .
"FROM region_codes a " .
"WHERE (a.region_cd LIKE '%00000000' " .
"AND a.use_yn = 'Y') " .
"OR region_cd = 3611000000;";
$query = $this->db->query($sql);
}
return $query->getResultArray();
}
// 소속본부조회
public function getBonbuList()
{
$sql = "SELECT dept_sq, pdept_sq, dept_nm, dept_desc, dept_head, use_yn, depth, insert_tm, insert_usr, update_tm, update_usr, lft, rgt" .
" FROM departments" .
" WHERE depth = 1" .
" AND use_yn = 'Y'" .
" ORDER BY lft";
$query = $this->db->query($sql);
return $query->getResultArray();
}
// 소속팀 조회
public function getTeamList()
{
$sql = "SELECT dept_sq, pdept_sq, dept_nm" .
" FROM departments" .
" WHERE depth = 2" .
" AND use_yn = 'Y'" .
" ORDER BY dept_nm";
$query = $this->db->query($sql);
return $query->getResultArray();
}
// 유저 조회
public function getUserList()
{
$sql = "SELECT
a.usr_sq, a.usr_id, a.usr_nm, a.dept_sq
FROM users a
WHERE
a.usr_level IN ('3','4','40','5','50','6','60','61','62','7','8','70')
AND a.use_yn = 'Y'
AND EXISTS (
SELECT 'x' FROM departments a1 INNER JOIN departments a2 ON a2.lft BETWEEN a1.lft AND a1.rgt AND a2.use_yn = 'Y'
WHERE 1=1 AND a2.dept_sq = a.dept_sq AND a1.use_yn = 'Y'
)
ORDER BY a.usr_level DESC, a.usr_nm ASC ";
$query = $this->db->query($sql);
return $query->getResultArray();
}
public function getTotalCount($data)
{
$params = [];
$sql = "SELECT
COUNT(*) AS cnt
FROM
region_codes AS a
WHERE
a.use_yn = 'Y'
AND a.region_cd NOT LIKE '%00000000'
AND a.region_cd NOT LIKE '%00000' ";
if (!empty($data['region'])) {
$sql .= "AND a.region_cd LIKE CONCAT({$data['region']} ,'%') ";
}
if (!empty($data['srcUserteam'])) {
$sql .= "AND a.dept_sq = {$data['srcUserteam']} ";
} else if (!empty($data['srcUserbonbu'])) {
$sql1 = "SELECT lft, rgt FROM departments WHERE dept_sq = {$data['srcUserbonbu']}";
$res = $this->db->query($sql1);
$lft = $res->getRowArray();
$sql2 = "SELECT dept_sq FROM departments WHERE lft >= {$lft['lft']} AND rgt <= {$lft['rgt']}";
$res2 = $this->db->query($sql2);
$list = $res2->getResultArray();
$deptArr = [];
foreach ($list as $d) {
array_push($deptArr, $d['dept_sq']);
}
if (!empty($deptArr)) {
$in = implode(",", array_map("intval", $deptArr));
$sql .= " AND a.dept_sq IN ($in) ";
}
}
if (!empty($data['positionYn'])) {
if ($data['positionYn'] === "Y") {
$sql .= "AND a.dept_sq IS NOT NULL OR a.dept_sq != 0 ";
$sql .= "AND a.usr_sq IS NOT NULL OR a.usr_sq != 0 ";
} else {
$sql .= "AND a.dept_sq IS NULL OR a.dept_sq = 0 ";
$sql .= "AND a.usr_sq IS NULL OR a.usr_sq = 0 ";
}
}
$query = $this->db->query($sql);
return $query->getRow()->cnt;
}
public function getSvcArea($start, $end, $data)
{
$sql = "SELECT
region_cd, region_nm, dept_sq, (SELECT dept_nm FROM departments where dept_sq = a.dept_sq) dept_nm, (SELECT pdept_sq FROM departments where dept_sq = a.dept_sq) pdept_sq, usr_sq
FROM
region_codes AS a
WHERE
a.use_yn = 'Y'
AND a.region_cd NOT LIKE '%00000000'
AND a.region_cd NOT LIKE '%00000' ";
if (!empty($data['region'])) {
$sql .= "AND a.region_cd LIKE CONCAT({$data['region']} ,'%') ";
}
if (!empty($data['srcUserteam'])) {
$sql .= "AND a.dept_sq = {$data['srcUserteam']} ";
} else if (!empty($data['srcUserbonbu'])) {
$sql1 = "SELECT lft, rgt FROM departments WHERE dept_sq = {$data['srcUserbonbu']}";
$res = $this->db->query($sql1);
$lft = $res->getRowArray();
$sql2 = "SELECT dept_sq FROM departments WHERE lft >= {$lft['lft']} AND rgt <= {$lft['rgt']}";
$res2 = $this->db->query($sql2);
$list = $res2->getResultArray();
$deptArr = [];
foreach ($list as $d) {
array_push($deptArr, $d['dept_sq']);
}
if (!empty($deptArr)) {
$in = implode(",", array_map("intval", $deptArr));
$sql .= " AND a.dept_sq IN ($in) ";
}
}
if (!empty($data['positionYn'])) {
if ($data['positionYn'] === "Y") {
$sql .= "AND a.dept_sq IS NOT NULL OR a.dept_sq != 0 ";
$sql .= "AND a.usr_sq IS NOT NULL OR a.usr_sq != 0 ";
} else {
$sql .= "AND a.dept_sq IS NULL OR a.dept_sq = 0 ";
$sql .= "AND a.usr_sq IS NULL OR a.usr_sq = 0 ";
}
}
$sql .= "LIMIT {$start}, {$end}";
$query = $this->db->query($sql);
return $query->getResultArray();
}
// 이력관리정보저장
public function saveRegion($regionCd, $team, $user)
{
$sql = "UPDATE region_codes SET ";
$sql .= "dept_sq = {$team}, ";
$sql .= "usr_sq = {$user} ";
$sql .= "WHERE region_cd = '{$regionCd}'";
$this->db->query($sql);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
}

View File

@@ -23,8 +23,11 @@ class MenuModel extends Model
" (SELECT mnu_nm FROM menu WHERE mnu_id = a.mnu_pid) mnu_pid_nm, " . " (SELECT mnu_nm FROM menu WHERE mnu_id = a.mnu_pid) mnu_pid_nm, " .
" mnu_nm, " . " mnu_nm, " .
" mnu_tp, " . " mnu_tp, " .
" CASE WHEN mnu_tp = 'D' THEN '디렉토리' WHEN mnu_tp = 'P' THEN '화면' WHEN mnu_tp = 'R' THEN '루트' END AS mnu_tp_nm, " .
" mnu_url, " . " mnu_url, " .
" use_yn, " . " use_yn, " .
" CASE WHEN use_yn = 'Y' THEN '사용' ELSE '미사용' END AS use_yn_nm, " .
" view_odr, " .
" insert_tm, " . " insert_tm, " .
" (select usr_nm from users where usr_sq = a.insert_usr) insert_usr, " . " (select usr_nm from users where usr_sq = a.insert_usr) insert_usr, " .
" (select usr_nm from users where usr_sq = a.update_usr) update_usr, " . " (select usr_nm from users where usr_sq = a.update_usr) update_usr, " .
@@ -37,7 +40,7 @@ class MenuModel extends Model
// $sql .= " AND mnu_pid = {$params['pid']} "; // $sql .= " AND mnu_pid = {$params['pid']} ";
// } // }
$sql .= " ORDER BY CASE WHEN mnu_pid = 'ROOT' THEN 0 ELSE 1 END, mnu_id"; $sql .= " ORDER BY CASE WHEN mnu_pid = 'ROOT' THEN 0 ELSE 1 END, mnu_id, view_odr";
$query = $this->db->query($sql); $query = $this->db->query($sql);
@@ -47,4 +50,48 @@ class MenuModel extends Model
} }
// 메뉴정보저장
public function saveMenu($data)
{
$sql = "INSERT INTO menu ";
$sql .= "(mnu_id, mnu_pid, mnu_nm, mnu_tp, mnu_url, view_odr, use_yn, insert_tm, insert_usr, update_tm, update_usr) ";
$sql .= "VALUES ";
$sql .= "('{$data['mnu_id']}', ";
$sql .= " '{$data['mnu_pid']}', ";
$sql .= " '{$data['mnu_nm']}', ";
$sql .= " '{$data['mnu_tp']}', ";
$sql .= " '{$data['mnu_url']}', ";
$sql .= " {$data['view_odr']}, ";
$sql .= " '{$data['use_yn']}', ";
$sql .= " NOW(), ";
$sql .= " {$data['usr_sq']}, ";
$sql .= " NOW(), ";
$sql .= " {$data['usr_sq']}) ";
$sql .= "ON DUPLICATE KEY UPDATE ";
$sql .= " mnu_nm = '{$data['mnu_nm']}', ";
$sql .= " mnu_tp = '{$data['mnu_tp']}', ";
$sql .= " mnu_url = '{$data['mnu_url']}', ";
$sql .= " view_odr = {$data['view_odr']}, ";
$sql .= " use_yn = '{$data['use_yn']}', ";
$sql .= " update_tm = NOW(), ";
$sql .= " update_usr = {$data['usr_sq']}";
$this->db->query($sql);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
} }

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Models\manage;
use CodeIgniter\Model;
class PermitModel extends Model
{
public function getUsrLevel()
{
$sql = "SELECT cd_sq AS cd, cd_nm FROM codes WHERE category = 'USER_LEVEL' AND use_yn = 'Y' ORDER BY view_odr ASC ";
$query = $this->db->query($sql);
return $query->getResultArray();
}
// 메뉴권한목록조회
public function getMenuAuthList($usrLevel)
{
$sql = "SELECT
a.mnu_id AS id,
a.mnu_pid,
CASE WHEN a.mnu_pid = 'ROOT' THEN '#' WHEN a.mnu_pid = '0' THEN 'M' ELSE a.mnu_pid END AS `parent`,
(SELECT a.mnu_nm FROM menu WHERE mnu_id = a.mnu_pid) mnu_pid_nm,
a.mnu_nm AS text,
a.mnu_tp,
CASE WHEN a.mnu_tp = 'D' THEN '디렉토리' WHEN mnu_tp = 'P' THEN '화면' WHEN mnu_tp = 'R' THEN '루트' END AS mnu_tp_nm,
a.mnu_url,
CASE WHEN a.use_yn = 'Y' THEN '사용' ELSE '미사용' END AS use_yn_nm,
a.view_odr,
b.mgrp_sq,
CASE WHEN b.mgrp_sq IS NOT NULL THEN 'selected' ELSE '' END `state`
FROM
menu AS a
LEFT JOIN
menu_perms AS b ON b.mnu_id = a.mnu_id AND b.mgrp_sq = {$usrLevel}
WHERE 1=1
ORDER BY CASE WHEN id = 'ROOT' THEN 0 ELSE 1 END, a.mnu_id, a.view_odr
";
$query = $this->db->query($sql);
return $query->getResultArray();
}
// 메뉴권한 전체삭제
public function deleteMenuPermit($usrLevel)
{
$sql = "DELETE FROM menu_perms WHERE mgrp_sq = {$usrLevel} ";
$this->db->query($sql);
}
// 메뉴권한 등록
public function saveMenuAuth($data)
{
$sql = "INSERT INTO menu_perms ";
$sql .= "(mgrp_sq, mnu_id, prm_list, insert_tm, insert_usr, update_tm, update_usr) ";
$sql .= "VALUES ";
$sql .= "({$data['usrLevel']}, '{$data['mnuId']}', 'Y', NOW(), {$data['usrSq']}, NOW(), {$data['usrSq']}) ";
$this->db->query($sql);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
}

View File

@@ -17,13 +17,41 @@ class PhoneModel extends Model
public function getTotalCount($data) public function getTotalCount($data)
{ {
$params = [];
$sql = "SELECT $sql = "SELECT
COUNT(*) AS cnt COUNT(*) AS cnt
FROM FROM
dupl_phone_list AS a dupl_phone_list AS a
LEFT JOIN codes AS b ON a.cpid = b.cd AND b.category = 'CP_ID' "; LEFT JOIN codes AS b ON a.cpid = b.cd AND b.category = 'CP_ID' ";
$query = $this->db->query($sql); $sql .= "WHERE 1=1 ";
if (!empty($data['cpid'])) {
$sql .= "AND a.cpid = ?";
array_push($params, $data['cpid']);
}
if (!empty($data['s_date'])) {
$sql .= "AND a.s_date >= DATE(?) ";
array_push($params, $data['s_date']);
}
if (!empty($data['e_date'])) {
$sql .= "AND a.e_date <= DATE(?) ";
array_push($params, $data['e_date']);
}
if (!empty($data['phone'])) {
$sql .= "AND REPLACE(a.phone_number, '-', '') LIKE CONCAT('%', REPLACE(?, '-', ''), '%') ";
array_push($params, $data['phone']);
}
if (!empty($data['useYn'])) {
$sql .= "AND a.use_yn = ? ";
array_push($params, $data['useYn']);
}
$query = $this->db->query($sql, $params ?: []);
return $query->getRow()->cnt; return $query->getRow()->cnt;
} }
@@ -40,6 +68,34 @@ class PhoneModel extends Model
dupl_phone_list AS a dupl_phone_list AS a
LEFT JOIN codes AS b ON a.cpid = b.cd AND b.category = 'CP_ID' "; LEFT JOIN codes AS b ON a.cpid = b.cd AND b.category = 'CP_ID' ";
$sql .= "WHERE 1=1 ";
if (!empty($data['cpid'])) {
$sql .= "AND a.cpid = ?";
array_push($params, $data['cpid']);
}
if (!empty($data['s_date'])) {
$sql .= "AND a.s_date >= DATE(?) ";
array_push($params, $data['s_date']);
}
if (!empty($data['e_date'])) {
$sql .= "AND a.e_date <= DATE(?) ";
array_push($params, $data['e_date']);
}
if (!empty($data['phone'])) {
$sql .= "AND REPLACE(a.phone_number, '-', '') LIKE CONCAT('%', REPLACE(?, '-', ''), '%') ";
array_push($params, $data['phone']);
}
if (!empty($data['useYn'])) {
$sql .= "AND a.use_yn = ? ";
array_push($params, $data['useYn']);
}
$sql .= "ORDER BY a.use_yn ASC, a.s_date DESC "; $sql .= "ORDER BY a.use_yn ASC, a.s_date DESC ";
$sql .= " LIMIT ?, ?"; $sql .= " LIMIT ?, ?";
@@ -76,4 +132,93 @@ class PhoneModel extends Model
'success' => true, 'success' => true,
]; ];
} }
public function updateDuplPhone($data)
{
$sql = " UPDATE dupl_phone_list" .
" SET phone_number = ? " .
" , use_yn = ? " .
" , s_date = ? " .
" , e_date = ? " .
" , address = ? " .
" , owner = ? " .
" , applicant = ? " .
" , relation = ? " .
" , cpid = ? " .
" , memo = ? " .
" , insert_tm = SYSDATE() " .
" , insert_user_id = ? " .
" WHERE phone_number = ?";
$this->db->query($sql, $data);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
// 엑셀다운로드
function getExcelPhoneList($data)
{
$params = [];
$sql = "SELECT
a.phone_number AS '연락처'
, a.s_date AS '등록일'
, a.e_date AS '만료일'
, b.cd_nm AS '매체사'
, a.address AS '주소'
, a.owner AS '소유자'
, a.applicant AS '신청인'
, a.relation AS '관계'
, (CASE a.use_yn WHEN 'Y' THEN '사용' WHEN 'N' THEN '미사용' END) AS '사용유무'
, a.memo AS '메모'
FROM
dupl_phone_list AS a
LEFT JOIN codes AS b ON a.cpid = b.cd AND b.category = 'CP_ID' ";
$sql .= "WHERE 1=1 ";
if (!empty($data['cpid'])) {
$sql .= "AND a.cpid = ?";
array_push($params, $data['cpid']);
}
if (!empty($data['s_date'])) {
$sql .= "AND a.s_date >= DATE(?) ";
array_push($params, $data['s_date']);
}
if (!empty($data['e_date'])) {
$sql .= "AND a.e_date <= DATE(?) ";
array_push($params, $data['e_date']);
}
if (!empty($data['phone'])) {
$sql .= "AND REPLACE(a.phone_number, '-', '') LIKE CONCAT('%', REPLACE(?, '-', ''), '%') ";
array_push($params, $data['phone']);
}
if (!empty($data['useYn'])) {
$sql .= "AND a.use_yn = ? ";
array_push($params, $data['useYn']);
}
$sql .= "ORDER BY a.use_yn ASC, a.s_date DESC ";
$query = $this->db->query($sql, $params ?: []);
return $query->getResultArray();
}
} }

View File

@@ -0,0 +1,246 @@
<?php
namespace App\Models\manage;
use CodeIgniter\Model;
class ScomplexModel extends Model
{
public function getCodeList()
{
$sql = "SELECT * FROM codes WHERE category = 'ARTICLE_TYPE' ";
$query = $this->db->query($sql);
return $query->getResultArray();
}
public function getTotalCount($data)
{
$params = [];
$sql = "SELECT COUNT(*) AS cnt
FROM scomplex_manage AS sm
LEFT JOIN codes AS c ON c.cd = sm.codes AND c.category = 'ARTICLE_TYPE' ";
$sql .= "WHERE 1=1 ";
if (!empty($data['name'])) {
$sql .= "AND sm.sm_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['name']);
}
if (!empty($data['apporval_date'])) {
$sql .= "AND sm.sm_apporval_date >= DATE(?) ";
array_push($params, $data['apporval_date']);
}
if (!empty($data['end_date'])) {
$sql .= "AND sm.sm_end_date <= DATE(?) ";
array_push($params, $data['end_date']);
}
if (!empty($data['code'])) {
$sql .= "AND sm.sm_code LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['code']);
}
if (!empty($data['cd'])) {
$sql .= "AND sm.codes = ? ";
array_push($params, $data['cd']);
}
if (!empty($data['address'])) {
$sql .= "AND sm.sm_address LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['address']);
}
$query = $this->db->query($sql, $params ?: []);
return $query->getRow()->cnt;
}
public function getScomplexList($start, $end, $data)
{
$params = [];
$sql = "SELECT
sm.sm_seq AS sm_seq,
sm.sm_name AS sm_name,
sm.sm_code AS sm_code,
sm.sm_address AS sm_address,
c.cd AS cd ,
c.cd_nm AS cd_nm ,
sm.sm_apporval_date AS sm_apporval_date,
sm.sm_end_date AS sm_end_date,
sm.sm_memo AS sm_memo,
sm.insert_tm AS insert_tm,
sm.update_tm AS update_tm,
sm.insert_usr AS insert_usr,
sm.update_usr AS update_usr
FROM
scomplex_manage AS sm
LEFT JOIN
codes AS c ON c.cd = sm.codes AND c.category = 'ARTICLE_TYPE' ";
$sql .= "WHERE 1=1 ";
if (!empty($data['name'])) {
$sql .= "AND sm.sm_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['name']);
}
if (!empty($data['apporval_date'])) {
$sql .= "AND sm.sm_apporval_date >= DATE(?) ";
array_push($params, $data['apporval_date']);
}
if (!empty($data['end_date'])) {
$sql .= "AND sm.sm_end_date <= DATE(?) ";
array_push($params, $data['end_date']);
}
if (!empty($data['code'])) {
$sql .= "AND sm.sm_code LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['code']);
}
if (!empty($data['cd'])) {
$sql .= "AND sm.codes = ? ";
array_push($params, $data['cd']);
}
if (!empty($data['address'])) {
$sql .= "AND sm.sm_address LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['address']);
}
$sql .= "ORDER BY sm.insert_tm DESC ";
$sql .= "LIMIT ?, ? ";
$params[] = (int) $start;
$params[] = (int) $end;
$query = $this->db->query($sql, $params ?: []);
return $query->getResultArray();
}
public function insertScomplex($data)
{
$sql = "INSERT INTO scomplex_manage ";
$sql .= "(sm_name, sm_code, sm_address, codes, sm_apporval_date, sm_end_date, sm_memo, insert_tm, insert_usr) ";
$sql .= "VALUES ";
$sql .= "(?, ?, ?, ?, ?, ?, ?, NOW(), ?)";
$this->db->query($sql, $data);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
public function updateScomplex($data)
{
$sql = "UPDATE scomplex_manage SET ";
$sql .= "sm_name = ?,
sm_code = ?,
sm_address = ?,
codes = ?,
sm_apporval_date = ?,
sm_end_date = ?,
sm_memo = ?,
update_tm = ?,
update_usr = NOW() ";
$sql .= "WHERE sm_seq = ?";
$this->db->query($sql, $data);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
public function getExcelScomplexList($data)
{
$params = [];
$sql = "SELECT
sm.sm_name AS '단지명',
sm.sm_code AS '단지코드',
sm.sm_address AS '단지주소',
c.cd_nm AS '매물종류' ,
sm.sm_apporval_date AS '사용승인일',
sm.sm_end_date AS '승인종료일',
sm.sm_memo AS '메모',
sm.insert_tm AS '등록일'
FROM
scomplex_manage AS sm
LEFT JOIN
codes AS c ON c.cd = sm.codes AND c.category = 'ARTICLE_TYPE' ";
$sql .= "WHERE 1=1 ";
if (!empty($data['name'])) {
$sql .= "AND sm.sm_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['name']);
}
if (!empty($data['apporval_date'])) {
$sql .= "AND sm.sm_apporval_date >= DATE(?) ";
array_push($params, $data['apporval_date']);
}
if (!empty($data['end_date'])) {
$sql .= "AND sm.sm_end_date <= DATE(?) ";
array_push($params, $data['end_date']);
}
if (!empty($data['code'])) {
$sql .= "AND sm.sm_code LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['code']);
}
if (!empty($data['cd'])) {
$sql .= "AND sm.codes = ? ";
array_push($params, $data['cd']);
}
if (!empty($data['address'])) {
$sql .= "AND sm.sm_address LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['address']);
}
$sql .= "ORDER BY sm.insert_tm DESC ";
$query = $this->db->query($sql, $params ?: []);
return $query->getResultArray();
}
}

View File

@@ -0,0 +1,268 @@
<?php
namespace App\Models\manage;
use CodeIgniter\Model;
class SmsModel extends Model
{
public function getTotalCount($data)
{
$params = [];
$sql = "SELECT
COUNT(*) AS cnt
FROM
ums_log a
LEFT OUTER JOIN result b ON a.etc1 = b.rsrv_sq
LEFT OUTER JOIN departments c ON b.dept_sq = c.dept_sq
LEFT OUTER JOIN users d ON b.usr_sq = d.usr_sq
WHERE
a.`status` IS NOT NULL ";
if (!empty($data['start_dt']) && !empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time >= ? ";
$sql .= " AND a.send_time < ? ";
array_push($params, $data['start_dt'] . " 00:00:00");
array_push($params, $nextDay . " 00:00:00");
} else {
if (!empty($data['start_dt'])) {
$sql .= "AND a.send_time >= DATE(?) ";
array_push($params, $data['start_dt'] . " 00:00:00");
}
if (!empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time < ? ";
array_push($params, $nextDay . " 00:00:00");
}
}
if (!empty($data['srchTxt'])) {
switch ($data['srchType']) {
case '1':
$sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '2':
$sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '3':
$sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
default:
$sql .= "AND (
a.send_name LIKE CONCAT('%', ?, '%')
OR a.dest_name LIKE CONCAT('%', ?, '%')
OR a.dest_phone LIKE CONCAT('%', ?, '%')
)";
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
break;
}
}
$query = $this->db->query($sql, $params ?: []);
return $query->getRow()->cnt;
}
public function getSmsList($start, $end, $data)
{
$params = [];
$sql = "SELECT
a.cmid
, a.dest_phone
, a.dest_name
, a.send_phone
, a.send_name
, a.request_time
, a.send_time
, a.report_time
, a.subject
, a.msg_body
, (select cd_nm from codes where category = 'SMS_STATUS' AND cd = a.status) as status_nm
, (CASE WHEN a.status = 1 THEN '성공' ELSE '실패' END) AS status_nm
, status
, a.etc1
, a.etc2
, (SELECT category_nm FROM codes WHERE category = 'SMS_MSG_TYPE' AND cd = a.etc2) as cate_nm
, a.etc3
, b.rsrv_sq
, c.dept_nm
, d.usr_nm
FROM
ums_log a
LEFT OUTER JOIN result b ON a.etc1 = b.rsrv_sq
LEFT OUTER JOIN departments c ON b.dept_sq = c.dept_sq
LEFT OUTER JOIN users d ON b.usr_sq = d.usr_sq
WHERE
a.`status` IS NOT NULL ";
if (!empty($data['start_dt']) && !empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time >= ? ";
$sql .= " AND a.send_time < ? ";
array_push($params, $data['start_dt'] . " 00:00:00");
array_push($params, $nextDay . " 00:00:00");
} else {
if (!empty($data['start_dt'])) {
$sql .= "AND a.send_time >= DATE(?) ";
array_push($params, $data['start_dt'] . " 00:00:00");
}
if (!empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time < ? ";
array_push($params, $nextDay . " 00:00:00");
}
}
if (!empty($data['srchTxt'])) {
switch ($data['srchType']) {
case '1':
$sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '2':
$sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '3':
$sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
default:
$sql .= "AND (
a.send_name LIKE CONCAT('%', ?, '%')
OR a.dest_name LIKE CONCAT('%', ?, '%')
OR a.dest_phone LIKE CONCAT('%', ?, '%')
)";
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
break;
}
}
$sql .= "
ORDER BY a.request_time DESC
LIMIT ?, ? ";
$params[] = (int) $start;
$params[] = (int) $end;
$query = $this->db->query($sql, $params ?: []);
return $query->getResultArray();
}
public function getExcelList($data)
{
$params = [];
$sql = "SELECT
a.send_name AS '발신자'
, a.dest_name AS '수신자'
, a.send_time AS '발송일자'
, (SELECT category_nm FROM codes WHERE category = 'SMS_MSG_TYPE' AND cd = a.etc2) AS '발송구분'
, a.send_phone AS '발신번호'
, a.dest_phone AS '수신번호'
, (select cd_nm from codes where category = 'SMS_STATUS' AND cd = a.status) AS '발송상태'
FROM
ums_log a
LEFT OUTER JOIN result b ON a.etc1 = b.rsrv_sq
LEFT OUTER JOIN departments c ON b.dept_sq = c.dept_sq
LEFT OUTER JOIN users d ON b.usr_sq = d.usr_sq
WHERE
a.`status` IS NOT NULL ";
if (!empty($data['start_dt']) && !empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time >= ? ";
$sql .= " AND a.send_time < ? ";
array_push($params, $data['start_dt'] . " 00:00:00");
array_push($params, $nextDay . " 00:00:00");
} else {
if (!empty($data['start_dt'])) {
$sql .= "AND a.send_time >= DATE(?) ";
array_push($params, $data['start_dt'] . " 00:00:00");
}
if (!empty($data['end_dt'])) {
$nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day'));
$sql .= " AND a.send_time < ? ";
array_push($params, $nextDay . " 00:00:00");
}
}
if (!empty($data['srchTxt'])) {
switch ($data['srchType']) {
case '1':
$sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '2':
$sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
case '3':
$sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') ";
array_push($params, $data['srchTxt']);
break;
default:
$sql .= "AND (
a.send_name LIKE CONCAT('%', ?, '%')
OR a.dest_name LIKE CONCAT('%', ?, '%')
OR a.dest_phone LIKE CONCAT('%', ?, '%')
)";
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
array_push($params, $data['srchTxt']);
break;
}
}
$sql .= "
ORDER BY a.request_time DESC
";
$query = $this->db->query($sql, $params ?: []);
return $query->getResultArray();
}
}

View File

@@ -349,6 +349,28 @@ class UserModel extends Model
]; ];
} }
// 유저 SMS 인증정보 일괄 수정
public function updateUserSmsYn($useYn)
{
$sql = "UPDATE users
SET sms_auth_yn = {$useYn}}
WHERE use_yn = 'Y' ";
$this->db->query($sql);
if ($this->db->transStatus() === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
// 성공
return [
'success' => true,
];
}
// 엑셀 다운로드 조회 // 엑셀 다운로드 조회
public function getExcelUserList($data) public function getExcelUserList($data)
{ {

View File

@@ -32,19 +32,25 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php if (empty($statistics['reserve'])): ?>
$nRow = 1;
foreach ($statistics['reserve'] as $row):
?>
<tr> <tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th> <td class="text-center" colspan="3">데이터가 없습니다.</td>
<td class="text-center"><?= substr($row['rsrv_date'], 0, 10) ?></td>
<td class="text-center"><?= $row['rsrv_tm_ap'] ?></td>
</tr> </tr>
<?php else: ?>
<?php <?php
$nRow++; $nRow = 1;
endforeach; foreach ($statistics['reserve'] as $row):
?> ?>
<tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
<td class="text-center"><?= substr($row['rsrv_date'], 0, 10) ?></td>
<td class="text-center"><?= $row['rsrv_tm_ap'] ?></td>
</tr>
<?php
$nRow++;
endforeach;
?>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -60,8 +66,8 @@
<table class="mb-0 table"> <table class="mb-0 table">
<colgroup> <colgroup>
<col width="10%" /> <col width="10%" />
<col width="60%" /> <col width="70%" />
<col width="30%" /> <col width="20%" />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
@@ -71,13 +77,19 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($notice as $key => $n): ?> <?php if (empty($notice)): ?>
<tr onclick="location.href='board/notice/detail/<?= $n['bbs_sq'] ?>'"> <tr>
<th scope="row"><?= ($key + 1) ?></th> <td class="text-center" colspan="3">데이터가 없습니다.</td>
<td><?= $n["subject"] ?></td>
<td class="text-center"><?= $n["update_tm"] ?></td>
</tr> </tr>
<?php endforeach; ?> <?php else: ?>
<?php foreach ($notice as $key => $n): ?>
<tr onclick="location.href='board/notice/detail/<?= $n['bbs_sq'] ?>'">
<th scope="row"><?= ($key + 1) ?></th>
<td><?= $n["subject"] ?></td>
<td class="text-center"><?= $n["update_tm"] ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -99,19 +111,25 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php if (empty($statistics['status2'])): ?>
$nRow = 1;
foreach ($statistics['status2'] as $row):
?>
<tr> <tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th> <td class="text-center" colspan="3">데이터가 없습니다.</td>
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
</tr> </tr>
<?php else: ?>
<?php <?php
$nRow++; $nRow = 1;
endforeach; foreach ($statistics['status2'] as $row):
?> ?>
<tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
</tr>
<?php
$nRow++;
endforeach;
?>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -134,19 +152,25 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php if (empty($statistics['status3'])): ?>
$nRow = 1;
foreach ($statistics['status3'] as $row):
?>
<tr> <tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th> <td class="text-center" colspan="3">데이터가 없습니다.</td>
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
</tr> </tr>
<?php else: ?>
<?php <?php
$nRow++; $nRow = 1;
endforeach; foreach ($statistics['status3'] as $row):
?> ?>
<tr>
<th scope="row"> <?= substr($row['rcpt_tm'], 0, 10) ?></th>
<td class="text-center"><?= substr($row['photo_save_dt'], 0, 10) ?></td>
<td class="text-center"><?= $row['elapsed_dt'] ?></td>
</tr>
<?php
$nRow++;
endforeach;
?>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -0,0 +1,736 @@
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
th {
font-size: 11px;
}
#svcList tbody tr {
cursor: pointer;
}
.blockUI {
z-index: 1500 !important;
}
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style>
<h1>지역 관리</h1>
<div class="row">
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-body">
<form class="row align-items-end" id="frm_srch_info" onsubmit="return false;">
<div class="col-md-4">
<label class="form-label mb-1">지역검색</label>
<div class="row g-2">
<div class="col-4">
<select class="form-control" name="srcSido" id="srcSido">
<option value="">시/도</option>
<?php foreach ($sido as $s): ?>
<option value="<?= $s['region_cd'] ?>"><?= $s['region_nm'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-4">
<select class="form-control" name="srcGugun" id="srcGugun">
<option value="">시/군/구</option>
</select>
</div>
<div class="col-4">
<select class="form-control" name="srcDong" id="srcDong">
<option value="">읍/면/동</option>
</select>
</div>
</div>
</div>
<div class="col-md-2">
<label class="form-label mb-1">소속팀</label>
<div class="row g-2">
<div class="col-6">
<select class="form-control" name="srcUserbonbu" id="srcUserbonbu">
<option value="">선택</option>
<?php foreach ($bonbu as $d): ?>
<option value="<?= $d['dept_sq'] ?>"><?= $d['dept_nm'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-6">
<select class="form-control" name="srcUserteam" id="srcUserteam">
<option value="">선택</option>
</select>
</div>
</div>
</div>
<div class="col-md-1">
<label class="form-label mb-1">지정 유무</label>
<select class="form-control" name="positionYn">
<option value="">선택</option>
<option value="Y">지정</option>
<option value="N">미지정</option>
</select>
</div>
<!-- 검색 버튼 -->
<div class="col-md-1 d-grid">
<button type="button" class="btn btn-primary" id="btnSearch">
검색
</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-header">조직 관리</div>
<div class="card-body">
<table id="svcList" class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>지역코드</th>
<th>지역</th>
<th>관할조직</th>
</tr>
</thead>
<tbody>
<!-- 여기는 비워둠: AJAX로 채움 -->
</tbody>
</table>
</div>
<div class="card-footer d-flex gap-2">
<button type="button" class="btn btn-light" id="btnAllSave">
일괄저장
</button>
<button type="button" class="btn btn-primary" id="btnSave">
저장
</button>
</div>
</div>
</div>
</div>
<?= $this->section('modals') ?>
<div class="modal fade" id="regionModal" tabindex="-1" aria-labelledby="regionModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="regionModalLabel">관할조직 일괄저장</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="frm_region_info" class="needs-validation" onsubmit="return false;" novalidate>
<input type="hidden" name="type" value="create">
<!-- 1 row -->
<div class="row mb-3">
<div class="col-md-4">
<label class="form-label">소속본부</label>
<select id="mBonbu" class="form-select" required>
<option value="">본부 선택</option>
<?php foreach ($bonbu as $d): ?>
<option value="<?= $d['dept_sq'] ?>"><?= $d['dept_nm'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-4">
<label class="form-label">소속팀</label>
<select id="mTeam" class="form-select" required>
<option value="">팀 선택</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">담당자</label>
<select id="mUser" class="form-select" required>
<option value="">담당자 선택</option>
</select>
</div>
</div>
</form>
<div><small>현재 그리드의 데이터를 일괄 저장합니다.</small></div>
</div>
<div class="modal-footer d-flex gap-2">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="allSave">저장</button>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
<script type="text/javascript">
const tpl = document.querySelector('.my-loader-template');
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
$(function () {
$("#srcSido, #srcGugun").on("change", function (e) {
const targetId = this.id;
$.ajax({
url: "/manage/areas/getAreaList",
method: "POST",
dataType: "json",
data: {
'srcSido': $("#frm_srch_info [name=srcSido]").val(),
'srcGugun': $("#frm_srch_info [name=srcGugun]").val(),
},
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
switch (targetId) {
case "srcSido":
console.log(result)
$("#srcGugun").empty()
var str = "";
str += "<option value=''>시/군/구</option>";
if (result.length > 0) {
for (var i = 0; i < result.length; i++) {
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
}
}
$("#srcGugun").append(str);
break;
case "srcGugun":
$("#srcDong").empty()
var str = "";
str += "<option value=''>읍/면/동</option>";
if (result.length > 0) {
for (var i = 0; i < result.length; i++) {
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
}
}
$("#srcDong").append(str);
break;
}
}
});
});
$("#mBonbu, #mTeam").on("change", function (e) {
const targetId = this.id;
var str = "";
if (targetId === "mBonbu") {
const dept_sq = $("#mBonbu").val();
str += `<option value="">팀 선택</option>`;
if (teamArr.length > 0) {
for (var i = 0; i < teamArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
str += `
<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>
`;
}
}
}
$("#mTeam").html(str);
} else if (targetId === "mTeam") {
const dept_sq = $("#mTeam").val();
str += `<option value="">담당자 선택</option>`;
if (userArr.length > 0) {
for (var i = 0; i < userArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(userArr[i].dept_sq) === String(dept_sq)) {
str += `
<option value="${userArr[i].usr_sq}">${userArr[i].usr_nm}</option>
`;
}
}
}
$("#mUser").html(str);
}
});
$("#srcUserbonbu").on("change", function (e) {
const value = e.target.value
$("#srcUserteam").empty()
var str = "<option value=''>선택</option>"
if (teamArr != null) {
for (var i = 0; i < teamArr.length; i++) {
if (value === teamArr[i].pdept_sq) {
str += "<option value='" + teamArr[i].dept_sq + "'>" + teamArr[i].dept_nm + "</option>"
}
}
}
$("#srcUserteam").append(str)
});
let table = $('#svcList').DataTable({
language: lang_kor,
processing: true,
serverSide: false,
ajax: {
url: '/manage/areas/getSvcArea',
type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) {
d.srcSido = $("#frm_srch_info [name=srcSido]").val()
d.srcGugun = $("#frm_srch_info [name=srcGugun]").val()
d.srcDong = $("#frm_srch_info [name=srcDong]").val()
d.srcUserbonbu = $("#frm_srch_info [name=srcUserbonbu]").val()
d.srcUserteam = $("#frm_srch_info [name=srcUserteam]").val()
d.positionYn = $("#frm_srch_info [name=positionYn]").val()
d.start = d.start || 0
d.length = d.length || 10
}
},
"columnDefs": [
{ 'targets': '_all', "defaultContent": "" },
// { 'className': 'text-center', 'targets': [0, 2, 3, 4] },
],
columns: [
{
"data": null,
"width": "50px",
"render": function (data, type, row, meta) {
return meta.row + meta.settings._iDisplayStart + 1;
}
},
{ data: 'region_cd', "width": "150px" },
{ data: 'region_nm' },
{ data: null, "render": fn_region_render },
],
// 옵션들 예시
paging: true,
searching: false,
ordering: false,
serverSide: true,
});
$('#svcList tbody').on('click', 'tr', function () {
const row = table.row(this).data()
if (!row) return
// const modalEl = document.getElementById('regionModal');
// const myModal = new bootstrap.Modal(modalEl);
// myModal.show();
});
// [검색] 버튼 눌렀을 때 다시 조회
$('#btnSearch').on('click', function () {
table.ajax.reload()
});
// 본부선택 onchage
$('#svcList').on('change', '.bonbu', function () {
const bonbu = $(this).val();
const rowIdx = $(this).data('index')
if (!bonbu) return;
fn_team_render(bonbu, rowIdx)
});
// 팀선택 onchage
$('#svcList').on('change', '.team', function () {
const team = $(this).val();
const rowIdx = $(this).data('index')
if (!team) return;
fn_user_render(team, rowIdx)
});
// 지역관리 일괄저장 modal
$("#btnAllSave").on("click", function () {
const modalEl = document.getElementById('regionModal');
const myModal = new bootstrap.Modal(modalEl);
myModal.show();
});
// 지역관리정보저장
$("#btnSave").on("click", function () {
let rows = table.rows().data().toArray();
if (rows.length == 0) return;
for (var i = 0; i < rows.length; i++) {
var bonbu = $("#bonbu-" + i).val();
var team = $("#team-" + i).val();
var user = $("#user-" + i).val();
if (bonbu == "") {
Swal.fire({
title: (i + 1) + "행 본부 데이터 누락",
icon: "error"
});
return;
}
if (team == "") {
Swal.fire({
title: (i + 1) + "행 팀 데이터 누락",
icon: "error"
});
return;
}
if (user == "") {
Swal.fire({
title: (i + 1) + "행 담당자 데이터 누락",
icon: "error"
});
return;
}
rows[i].bonbu = $("#bonbu-" + i).val();
rows[i].team = $("#team-" + i).val();
rows[i].user = $("#user-" + i).val();
}
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
confirmButtonColor: "#3085d6",
cancelButtonColor: "#ff0000",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/manage/areas/saveRegion',
contentType: 'application/json; charset=UTF-8',
method: 'POST',
data: JSON.stringify(rows),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
$("#btnSearch").trigger('click')
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
})
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
});
// 지역관리 일괄저장
$("#allSave").on("click", function () {
let rows = table.rows().data().toArray();
if (rows.length == 0) return;
var bonbu = $("#mBonbu").val();
var team = $("#mTeam").val();
var user = $("#mUser").val();
if (bonbu == "") {
Swal.fire({
title: "본부 데이터 누락",
icon: "error"
});
return;
}
if (team == "") {
Swal.fire({
title: "팀 데이터 누락",
icon: "error"
});
return;
}
if (user == "") {
Swal.fire({
title: "담당자 데이터 누락",
icon: "error"
});
return;
}
for (var i = 0; i < rows.length; i++) {
rows[i].bonbu = bonbu;
rows[i].team = team;
rows[i].user = user;
}
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
confirmButtonColor: "#3085d6",
cancelButtonColor: "#ff0000",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/manage/areas/saveAllRegion',
contentType: 'application/json; charset=UTF-8',
method: 'POST',
data: JSON.stringify(rows),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
regionModalHide()
$("#btnSearch").trigger('click')
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
})
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
});
});
// 관할조직 render
function fn_region_render(data, type, row, meta) {
var str = ""
str += `
<div class="d-flex gap-1">
<div class="flex-fill">
`;
str += `<select class="form-control bonbu" id="bonbu-${meta.row}" data-index="${meta.row}">`;
str += `<option value="">본부 선택</option>`;
if (bonbuArr.length > 0) {
for (var i = 0; i < bonbuArr.length; i++) {
var selected = ""
if (bonbuArr[i].dept_sq === row.pdept_sq) selected = "selected"
str += `
<option value="${bonbuArr[i].dept_sq}" ${selected}>${bonbuArr[i].dept_nm}</option>
`;
}
}
str += `</select></div>`;
str += `<div class="flex-fill">`;
str += `<select class="form-control team" id="team-${meta.row}" data-index="${meta.row}">`;
str += `<option value="">팀 선택</option>`;
const currentBonbuSq = row.pdept_sq; // 현재 행에서 선택된 본부 sq
if (teamArr.length > 0) {
for (var i = 0; i < teamArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(teamArr[i].pdept_sq) === String(currentBonbuSq)) {
var selected = "";
if (teamArr[i].dept_sq === row.dept_sq) selected = "selected";
str += `
<option value="${teamArr[i].dept_sq}" ${selected}>${teamArr[i].dept_nm}</option>
`;
}
}
}
str += `</select></div>`;
str += `<div class="flex-fill">`;
str += `<select class="form-control team-user" id="user-${meta.row}">`;
str += `<option value="">담당자 선택</option>`;
if (userArr.length > 0) {
for (var i = 0; i < userArr.length; i++) {
if (userArr[i].dept_sq == row.dept_sq) {
var selected = ""
if (userArr[i].usr_sq === row.usr_sq) selected = "selected"
str += `
<option value="${userArr[i].usr_sq}" ${selected}>${userArr[i].usr_nm}</option>
`;
}
}
}
str += `</select></div>`;
str += `</div></div>`;
return str
}
// 팀 render
function fn_team_render(dept_sq, idx) {
str = `<option value="">팀 선택`;
if (teamArr.length > 0) {
for (var i = 0; i < teamArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
str += `<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>`;
}
}
}
$("#team-" + idx).html(str)
fn_user_render("", idx)
}
// 유저 render
function fn_user_render(dept_sq, idx) {
str = `<option value="">담당자 선택`;
if (dept_sq != "") {
if (userArr.length > 0) {
for (var i = 0; i < userArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(userArr[i].dept_sq) === String(dept_sq)) {
str += `<option value="${userArr[i].usr_sq}">${userArr[i].usr_nm}</option>`;
}
}
}
}
$("#user-" + idx).html(str)
}
function regionModalHide() {
const modalEl = document.getElementById('regionModal');
const modal = bootstrap.Modal.getInstance(modalEl); // 기존 인스턴스 가져오기
if (modal) {
modal.hide();
}
}
</script>
<?= $this->endSection() ?>

View File

@@ -13,6 +13,11 @@
.blockUI { .blockUI {
z-index: 1500 !important; z-index: 1500 !important;
} }
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style> </style>
<h1>조직 관리</h1> <h1>조직 관리</h1>
@@ -230,6 +235,14 @@
ajax: { ajax: {
url: '/manage/dept/getDeptList', url: '/manage/dept/getDeptList',
type: 'GET', type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) { data: function (d) {
d.srchDepth = $("#frm_srch_info [name=srchDepth]").val() d.srchDepth = $("#frm_srch_info [name=srchDepth]").val()
d.srcDeptNm = $("#frm_srch_info [name=srcDeptNm]").val() d.srcDeptNm = $("#frm_srch_info [name=srcDeptNm]").val()

View File

@@ -107,6 +107,14 @@
ajax: { ajax: {
url: '/manage/dept/getUserList', url: '/manage/dept/getUserList',
type: 'GET', type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) { data: function (d) {
d.start = d.start || 0 d.start = d.start || 0
d.length = d.length || 10 d.length = d.length || 10

View File

@@ -22,11 +22,17 @@
} }
</style> </style>
<h1>조직 관리</h1> <h1>로그인이력 관리</h1>
<div class="col-md-12 col-xl-12"> <div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card"> <div class="main-card mb-3 card">
<div class="card-header">조직 관리</div> <div class="card-header d-flex align-items-center">
<h3 class="card-title mb-0">로그인이력 목록</h3>
<div class="ms-auto d-flex align-items-center gap-3">
<button class="mb-2 me-2 border-0 btn-transition btn btn-shadow btn-outline-success"
id="excel-download">엑셀다운로드</button>
</div>
</div>
<div class="card-body"> <div class="card-body">
<table id="logList" class="table table-hover table-striped table-bordered"> <table id="logList" class="table table-hover table-striped table-bordered">
<thead> <thead>
@@ -46,10 +52,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="card-footer">
<button class="mb-2 me-2 border-0 btn-transition btn btn-shadow btn-outline-success"
id="excel-download">엑셀다운로드</button>
</div>
</div> </div>
</div> </div>
@@ -71,6 +73,14 @@
ajax: { ajax: {
url: '/manage/loginlog/getLogList', url: '/manage/loginlog/getLogList',
type: 'GET', type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) { data: function (d) {
d.start = d.start || 0 d.start = d.start || 0
d.length = d.length || 10 d.length = d.length || 10
@@ -112,6 +122,14 @@
method: "GET", method: "GET",
dataType: "json", dataType: "json",
data: $("#frm_srch_info").serialize(), data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) { success: function (result) {
downloadExcel(result.data); downloadExcel(result.data);
} }

View File

@@ -20,6 +20,11 @@
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 180px; max-width: 180px;
} }
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style> </style>
<h1>메뉴 관리</h1> <h1>메뉴 관리</h1>
@@ -38,15 +43,87 @@
<div class="main-card mb-3 card"> <div class="main-card mb-3 card">
<div class="card-header">메뉴 정보</div> <div class="card-header">메뉴 정보</div>
<div class="card-body"> <div class="card-body">
<form action="frm_menu_info" onsubmit="return false;"> <form method="POST" id="frm_menu_info" name="frm_menu_info" onsubmit="return false;">
<div class="form-group"> <input type="hidden" name="depth" value="ROOT" />
<input type="hidden" name="level" value="1" />
<!-- 상위메뉴 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">상위메뉴</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mnu_pid" readonly="readonly">
</div>
</div>
<!-- 메뉴아이디 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">메뉴아이디</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mnu_id">
</div>
</div>
<!-- 메뉴명 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">메뉴명</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mnu_nm">
</div>
</div>
<!-- 메뉴유형 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">메뉴유형</label>
<div class="col-sm-10">
<select class="form-control" name="mnu_tp">
<option value="">선 택</option>
<!-- <option value="R">루트</option> -->
<option value="D">디렉토리</option>
<option value="P">화면</option>
<!-- <option value="A">기능</option>
<option value="L">화면링크</option> -->
</select>
</div>
</div>
<!-- 경로 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">경로</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mnu_url">
</div>
</div>
<!-- 정렬순서 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">정렬순서</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="view_odr">
</div>
</div>
<!-- 사용여부 -->
<div class="position-relative row form-group mb-3">
<label class="col-sm-2 col-form-label">사용여부</label>
<div class="col-sm-10">
<select class="form-control" name="use_yn">
<option value="Y" selected>사용</option>
<option value="N">미사용</option>
</select>
</div>
</div> </div>
</form> </form>
</div> </div>
<div class="card-footer d-flex justify-content-end gap-2">
<button type="button" class="btn btn-success" id="btnNew">
신규
</button>
<button type="button" class="btn btn-primary" id="btnSave">
저장
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -64,9 +141,11 @@
const tpl = document.querySelector('.my-loader-template') const tpl = document.querySelector('.my-loader-template')
let date = new Date() let date = new Date()
var tbl;
$(function () { $(function () {
$("#menuList").jqGrid({ tbl = $("#menuList").jqGrid({
url: "/manage/menu/getMenuList", url: "/manage/menu/getMenuList",
datatype: "json", datatype: "json",
mtype: "POST", mtype: "POST",
@@ -84,14 +163,16 @@
viewrecords: true, viewrecords: true,
scrollrows: true, scrollrows: true,
treeGridModel: 'adjacency', treeGridModel: 'adjacency',
colNames: ['메뉴명', '메뉴ID', '메뉴유형코드', '메뉴유형', 'URL', '정렬순서'], colNames: ['메뉴명', '메뉴ID', '메뉴유형', 'URL', '정렬순서', '사용여부', '', ''],
colModel: [ colModel: [
{ name: 'mnu_nm', index: 'mnu_nm', width: 150 }, { name: 'mnu_nm', index: 'mnu_nm', width: 150 },
{ name: 'mnu_id', index: 'mnu_id', width: 80 }, { name: 'mnu_id', index: 'mnu_id', width: 80 },
{ name: 'menu_tp', index: 'menu_tp', width: 50, hidden: true }, { name: 'mnu_tp_nm', index: 'mnu_tp_nm', width: 80, align: "center" },
{ name: 'menu_tp_nm', index: 'menu_tp_nm', width: 100, align: "center" },
{ name: 'mnu_url', index: 'mnu_url', width: 200 }, { name: 'mnu_url', index: 'mnu_url', width: 200 },
{ name: 'view_odr', index: 'view_odr', width: 50, align: "center" } { name: 'view_odr', index: 'view_odr', width: 50, align: "center" },
{ name: 'use_yn_nm', index: 'use_yn_nm', width: 50, align: "center" },
{ name: 'mnu_tp', index: 'mnu_tp', hidden: true },
{ name: 'use_yn', index: 'use_yn', hidden: true },
], ],
jsonReader: { jsonReader: {
@@ -118,16 +199,167 @@
$("#menuList") $("#menuList")
.jqGrid('setGridParam', { datatype: 'local' }) .jqGrid('setGridParam', { datatype: 'local' })
.trigger("reloadGrid"); .trigger("reloadGrid");
} },
onSelectRow: function (index, row) {
var rowKey = $('#menuList').jqGrid('getGridParam', 'selrow');
if (rowKey) {
var data = $('#menuList').jqGrid('getRowData', rowKey);
$("#frm_menu_info [name=level]").val(data.level);
$("#frm_menu_info [name=mnu_pid]").val(data.mnu_pid);
$("#frm_menu_info [name=mnu_id]").val(data.mnu_id);
$("#frm_menu_info [name=mnu_nm]").val(data.mnu_nm);
$("#frm_menu_info [name=mnu_url]").val(data.mnu_url);
$("#frm_menu_info [name=mnu_tp]").val(data.mnu_tp);
$("#frm_menu_info [name=view_odr]").val(data.view_odr);
$("#frm_menu_info [name=use_yn]").val(data.use_yn);
}
},
}); });
// 신규 btn click
$("#btnNew").on("click", function () {
const level = $("#frm_menu_info [name=level]").val();
if (level === "2") {
$("#frm_menu_info [name=depth]").val("DIR");
// $("#frm_menu_info [name=level]").val("1");
Swal.fire({
title: "하위 메뉴 생성 불가",
icon: "warning"
});
return;
} else {
let id = $("#frm_menu_info [name=mnu_id]").val();
if (id === "M") id = "0";
$("#frm_menu_info")[0].reset();
$("#frm_menu_info [name=depth]").val("ROOT");
$("#frm_menu_info [name=level]").val("1");
$("#frm_menu_info [name=mnu_pid]").val(id);
}
});
// 저장 btn click
$("#btnSave").on("click", function () {
if ($("#frm_menu_info [name=mnu_id]").val() === "") {
Swal.fire({
title: "메뉴아이디를 입력해 주세요.",
icon: "warning"
});
return;
}
if ($("#frm_menu_info [name=mnu_nm]").val() === "") {
Swal.fire({
title: "메뉴명을 입력해 주세요.",
icon: "warning"
});
return;
}
if ($("#frm_menu_info [name=mnu_tp]").val() === "") {
Swal.fire({
title: "메뉴유형을 선택해 주세요.",
icon: "warning"
});
return;
}
if ($("#frm_menu_info [name=mnu_url]").val() === "") {
Swal.fire({
title: "경로를 입력해 주세요.",
icon: "warning"
});
return;
}
if ($("#frm_menu_info [name=view_odr]").val() === "") {
Swal.fire({
title: "순서를 입력해 주세요.",
icon: "warning"
});
return;
}
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
confirmButtonColor: "#3085d6",
cancelButtonColor: "#ff0000",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/manage/menu/saveMenu',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: $("#frm_menu_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
tbl.ajax.reload();
clearForm();
if (result.code == '0') {
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
});
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
});
}); });
// 폼초기화
function clearForm() {
$("#frm_menu_info")[0].reset();
$("#frm_menu_info [name=depth]").val("ROOT");
$("#frm_menu_info [name=level]").val("1");
$("#frm_menu_info [name=mnu_pid]").val("0");
}
</script> </script>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@@ -0,0 +1,270 @@
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
th {
font-size: 11px;
}
#logList tbody tr {
cursor: pointer;
}
.blockUI {
z-index: 1500 !important;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 180px;
}
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style>
<h1>권한 관리</h1>
<div class="row">
<div class="col-md-7 col-xl-7">
<div class="main-card mb-3 card">
<div class="card-header d-flex align-items-center">
<h3 class="card-title mb-0">메뉴 목록</h3>
<div class="card-tools d-flex align-items-center ms-auto gap-2">
<div class="input-group input-group-sm">
<select class="form-control" id="usrlevel">
<option value="">그룹 선택</option>
<?php foreach ($usrLevel as $d): ?>
<option value="<?= $d['cd'] ?>"><?= $d['cd_nm'] ?></option>
<?php endforeach; ?>
</select>
<button type="button" class="btn btn-primary btn-sm" id="btnSave">
저장
</button>
</div>
</div>
</div>
<div class="card-body">
<!-- <table id="menuList" class="table table-hover table-striped table-bordered"></table> -->
<div id="menuTree"></div>
</div>
</div>
</div>
<form class="form-horizontal" id="permissionSrcFrm" name="permissionSrcFrm">
<input type="hidden" name="usr_level" id="usr_level" />
<input type="hidden" name="mnu_cd" id="mnu_cd" />
</form>
</div>
<!-- The jqGrid language file code-->
<script type="text/javascript" src="//cdn.jsdelivr.net/jqgrid/4.6.0/i18n/grid.locale-kr.js">
</script>
<!-- The atual jqGrid code -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jqgrid/4.6.0/jquery.jqGrid.src.js">
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.15.5/css/ui.jqgrid.min.css">
<link rel="stylesheet" type="text/css" href="/plugin/css/jsTree/style.min.css">
<script src="/plugin/js/jqgrid/jstree.min.js"></script>
<script type="text/javascript">
const tpl = document.querySelector('.my-loader-template')
let date = new Date()
$(function () {
// 그룹 onchange
$("#usrlevel").on("change", function () {
if ($(this).val() === "") {
$('#menuTree').jstree('destroy');
return;
}
changeAuthCombo($(this).val());
});
// 저장 btn click
$("#btnSave").on("click", function () {
const usr_level = $("#usr_level").val();
if (usr_level === "") {
Swal.fire({
title: "그룹을 선택해 주세요.",
icon: "error"
});
return;
}
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
confirmButtonColor: "#3085d6",
cancelButtonColor: "#ff0000",
}).then((result) => {
if (result.isConfirmed) {
var checked_value = [];
checked_value.push($("#menuTree").jstree("get_checked"));
$("#menuTree .jstree-undetermined").parent().parent().each(function () {
checked_value.push(this.id);
});
$("#permissionSrcFrm [name=mnu_cd]").val(checked_value);
$.ajax({
url: '/manage/permit/saveMenuAuth',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: $("#permissionSrcFrm").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
});
setTimeout(() => {
location.reload();
}, 1500);
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
});
});
// 메뉴 목록 및 권한 조회
function changeAuthCombo(code) {
$("#usr_level").val(code);
$('#menuTree').jstree('destroy');
$.ajax({
url: '/manage/permit/getMenuAuthList',
type: 'GET',
dataType: 'json',
data: {
usr_level: code
},
beforeSend: function () {
// 호출 직전에 실행
console.log("로딩 시작");
blockUI.blockPage({
message: tpl
});
},
complete: function () {
// 완료 시(성공/실패 모두)
console.log("로딩 종료");
blockUI.unblockPage();
},
error: function (xhr) {
console.error("에러", xhr);
},
success: function (data) {
const filteredData = data;
$('#menuTree').jstree({
'core': {
'data': filteredData
},
'checkbox': {
keep_selected_style: false
},
'plugins': ['checkbox']
}).on('loaded.jstree', function () {
$('#menuTree').jstree('open_all');
});
setTimeout(() => {
uncheckedItem(data);
}, 500);
}
});
// $.getJSON('/manage/permit/getMenuAuthList?usr_level=' + code, function (data) {
// const filteredData = data;
// $('#menuTree').jstree({
// 'core': {
// 'data': filteredData
// },
// 'checkbox': {
// keep_selected_style: false
// },
// 'plugins': ['checkbox']
// }).on('loaded.jstree', function () {
// $('#menuTree').jstree('open_all');
// });
// setTimeout(() => {
// uncheckedItem(data);
// }, 500);
// });
}
function uncheckedItem(data) {
data.map(item => {
const newItem = { ...item };
if (newItem.state && newItem.state.selected === false) {
$('#menuTree').jstree('uncheck_node', newItem.id);
}
});
}
</script>
<?= $this->endSection() ?>

View File

@@ -13,6 +13,11 @@
.blockUI { .blockUI {
z-index: 1500 !important; z-index: 1500 !important;
} }
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style> </style>
<h1>전화확인 관리</h1> <h1>전화확인 관리</h1>
@@ -70,6 +75,11 @@
</button> </button>
</div> </div>
<div class="col-md-2">
<button type="button" class="btn btn-outline-success" id="btnExcel">
<i class="fa fas fa-file-excel-o"></i> 엑셀 다운로드
</button>
</div>
</form> </form>
</div> </div>
</div> </div>
@@ -248,9 +258,10 @@
url: '/manage/dupl_phone/getDuplPhoneList', url: '/manage/dupl_phone/getDuplPhoneList',
type: 'GET', type: 'GET',
data: function (d) { data: function (d) {
d.srchDepth = $("#frm_srch_info [name=srchDepth]").val() d.cpid = $("#frm_srch_info [name=cpid]").val()
d.srcDeptNm = $("#frm_srch_info [name=srcDeptNm]").val() d.s_date = $("#frm_srch_info [name=s_date]").val()
d.srcDeptHead = $("#frm_srch_info [name=srcDeptHead]").val() d.e_date = $("#frm_srch_info [name=e_date]").val()
d.phone = $("#frm_srch_info [name=phone_number]").val()
d.useYn = $("#frm_srch_info [name=useYn]").val() d.useYn = $("#frm_srch_info [name=useYn]").val()
d.srchType = $("#frm_srch_info [name=srchType]").val() d.srchType = $("#frm_srch_info [name=srchType]").val()
@@ -280,7 +291,7 @@
{ data: 'owner' }, { data: 'owner' },
{ data: 'applicant' }, { data: 'applicant' },
{ data: 'relation' }, { data: 'relation' },
{ data: 'use_yn_nm' }, { data: 'use_yn_nm', "width": "50px" },
{ data: 'memo', "width": "200px" }, { data: 'memo', "width": "200px" },
], ],
// 옵션들 예시 // 옵션들 예시
@@ -415,6 +426,28 @@
}); });
// 엑셀다운 click
$("#btnExcel").on("click", function () {
$.ajax({
url: "/manage/dupl_phone/excel",
method: "GET",
dataType: "json",
data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
downloadExcel(result.data);
}
});
});
}); });
@@ -427,5 +460,46 @@
} }
} }
// 엑셀 다운로드
function downloadExcel(data) {
const ws = XLSX.utils.json_to_sheet(data);
ws['!cols'] = [
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 80 },
{ wpx: 130 },
{ wpx: 80 },
{ wpx: 200 },
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
const blob = new Blob([wbout], { type: 'application/octet-stream' });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "전화확인관리" + getDateTimeString() + ".xlsx";
link.click();
URL.revokeObjectURL(link.href);
}
function getDateTimeString() {
const d = new Date();
const yyyy = d.getFullYear();
const mm = String(d.getMonth() + 1).padStart(2, '0');
const dd = String(d.getDate()).padStart(2, '0');
const hh = String(d.getHours()).padStart(2, '0');
const mi = String(d.getMinutes()).padStart(2, '0');
const ss = String(d.getSeconds()).padStart(2, '0');
return `${yyyy}${mm}${dd}${hh}${mi}${ss}`;
}
</script> </script>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@@ -0,0 +1,475 @@
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
th {
font-size: 11px;
}
#scomplexList tbody tr {
cursor: pointer;
}
.blockUI {
z-index: 1500 !important;
}
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style>
<h1>특이단지 관리</h1>
<div class="row">
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-body">
<form class="row g-3 align-items-end" id="frm_srch_info" onsubmit="return false;">
<!-- 1행 -->
<div class="col-md-2">
<label class="form-label">단지명</label>
<input type="text" class="form-control" name="name" placeholder="단지명 입력">
</div>
<div class="col-md-2">
<label class="form-label">사용 승인/종료일</label>
<div class="row g-2">
<div class="col-5">
<input type="date" class="form-control" name="apporval_date">
</div>
<div class="col-2 text-center" style="line-height: 35px;">~</div>
<div class="col-5">
<input type="date" class="form-control" name="end_date">
</div>
</div>
</div>
<div class="col-md-2">
<label class="form-label">매물 종류</label>
<select class="form-control" name="cd">
<option value="">선택</option>
<?php foreach ($code as $c): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endforeach; ?>
</select>
</div>
<!-- 2행 -->
<div class="col-md-1">
<label class="form-label">단지코드</label>
<input type="text" class="form-control" name="code">
</div>
<div class="col-md-3">
<label class="form-label">단지주소</label>
<input type="text" class="form-control" name="address">
</div>
<!-- 버튼 -->
<div class="col-md-1 d-grid">
<button type="button" class="btn btn-primary" id="btnSearch">
검색
</button>
</div>
<div class="col-md-1 d-grid">
<button type="button" class="btn btn-outline-success" id="btnExcel">
<i class="fa fas fa-file-excel-o"></i> 엑셀 다운로드
</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-header">조직 관리</div>
<div class="card-body">
<table id="scomplexList" class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>등록일자</th>
<th>단지코드</th>
<th>단지명</th>
<th>단지주소</th>
<th>매물종류</th>
<th>승인일자</th>
<th>종료일자</th>
</tr>
</thead>
<tbody>
<!-- 여기는 비워둠: AJAX로 채움 -->
</tbody>
</table>
</div>
<div class="card-footer">
<button type="button" class="btn btn-primary" id="addPhone">
등록
</button>
</div>
</div>
</div>
</div>
<?= $this->section('modals') ?>
<div class="modal fade" id="deptModal" tabindex="-1" aria-labelledby="deptModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="deptModalLabel">특이단지 정보</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="frm_scomplex_info" class="needs-validation" onsubmit="return false;" novalidate>
<input type="hidden" name="type" value="create" />
<input type="hidden" name="sm_seq" />
<div class="row g-3">
<!-- 단지명 -->
<div class="col-md-4">
<label for="name" class="form-label mb-1">단지명</label>
<input type="text" class="form-control" name="sm_name" id="sm_name" required>
</div>
<!-- 사용승인일 -->
<div class="col-md-4">
<label for="apporval_date" class="form-label mb-1">사용승인일</label>
<input type="date" class="form-control date_picker" name="sm_apporval_date"
id="sm_apporval_date" required>
</div>
<!-- 승인종료일 -->
<div class="col-md-4">
<label for="end_date" class="form-label mb-1">승인종료일</label>
<input type="date" class="form-control date_picker" name="sm_end_date" id="sm_end_date"
required>
</div>
<!-- 단지코드 -->
<div class="col-md-4">
<label for="code" class="form-label mb-1">단지코드</label>
<input type="text" class="form-control" name="sm_code" id="sm_code" required>
</div>
<!-- 단지주소 -->
<div class="col-6">
<label for="address" class="form-label mb-1">단지주소</label>
<input type="text" class="form-control" name="sm_address" id="sm_address" required>
</div>
<!-- 매물 종류 -->
<div class="col-md-2">
<label for="cd" class="form-label mb-1">매물 종류</label>
<select class="form-control" name="codes" id="codes" required>
<option value="">-매물종류-</option>
<?php foreach ($code as $c): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-12">
<label for="address" class="form-label mb-1">메모</label>
<textarea name="sm_memo" id="sm_memo" class="form-control" rows="2"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="phoneSave">저장</button>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
<script type="text/javascript">
const tpl = document.querySelector('.my-loader-template');
$(function () {
$("#srchBonbu").on("change", function (e) {
var dept_sq = e.target.value
$("#srchTeam").empty()
var str = "<option value=''>선택</option>"
if (teamArr != null) {
for (var i = 0; i < teamArr.length; i++) {
if (dept_sq === teamArr[i].pdept_sq) {
str += "<option value='" + teamArr[i].dept_sq + "'>" + teamArr[i].dept_nm + "</option>"
}
}
}
$("#srchTeam").append(str)
});
let table = $('#scomplexList').DataTable({
language: lang_kor,
processing: true,
serverSide: false,
ajax: {
url: '/manage/scomplex/getScomplexList',
type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) {
d.name = $("#frm_srch_info [name=name]").val()
d.apporval_date = $("#frm_srch_info [name=apporval_date]").val()
d.end_date = $("#frm_srch_info [name=end_date]").val()
d.code = $("#frm_srch_info [name=code]").val()
d.cd = $("#frm_srch_info [name=cd]").val()
d.address = $("#frm_srch_info [name=address]").val()
d.start = d.start || 0
d.length = d.length || 10
}
},
"columnDefs": [
{ 'targets': '_all', "defaultContent": "" },
// { 'className': 'text-center', 'targets': [0, 2, 3, 4] },
],
columns: [
{
"data": null,
"width": "50px",
"render": function (data, type, row, meta) {
return meta.row + meta.settings._iDisplayStart + 1;
}
},
{ data: 'insert_tm', "width": "150px" },
{ data: 'sm_code', "width": "70px" },
{ data: 'sm_name', "width": "200px" },
{ data: 'sm_address' },
{ data: 'cd_nm', "width": "80px" },
{ data: 'sm_apporval_date', "width": "80px" },
{ data: 'sm_end_date', "width": "80px" },
],
// 옵션들 예시
paging: true,
searching: false,
ordering: false,
serverSide: true,
});
$('#scomplexList tbody').on('click', 'tr', function () {
const row = table.row(this).data()
if (!row) return
const modalEl = document.getElementById('deptModal');
const myModal = new bootstrap.Modal(modalEl);
$("#frm_scomplex_info")[0].reset()
$("#frm_scomplex_info [name=type]").val("update")
$("#frm_scomplex_info [name=sm_seq]").val(row.sm_seq)
$("#frm_scomplex_info [name=sm_name]").val(row.sm_name)
$("#frm_scomplex_info [name=sm_code]").val(row.sm_code)
$("#frm_scomplex_info [name=sm_address]").val(row.sm_address)
$("#frm_scomplex_info [name=codes]").val(row.cd)
$("#frm_scomplex_info [name=sm_apporval_date]").val(row.sm_apporval_date)
$("#frm_scomplex_info [name=sm_end_date]").val(row.sm_end_date)
$("#frm_scomplex_info [name=sm_memo]").val(row.sm_memo)
myModal.show();
});
// [검색] 버튼 눌렀을 때 다시 조회
$('#btnSearch').on('click', function () {
table.ajax.reload()
});
// 유저 등록 모달
$("#addPhone").on("click", function () {
$("#frm_scomplex_info")[0].reset()
$("#frm_scomplex_info [name=type]").val("create")
$("#frm_scomplex_info [name=phone_number]").prop("readonly", false)
const modalEl = document.getElementById('deptModal');
const myModal = new bootstrap.Modal(modalEl);
myModal.show();
});
// 유저정보저장
$("#phoneSave").on("click", function () {
const form = document.getElementById('frm_scomplex_info');
let isValid = true;
// Bootstrap5 기본 validation 적용
if (!form.checkValidity()) {
isValid = false;
}
if (!isValid) {
form.classList.add('was-validated');
return;
}
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
closeOnConfirm: false,
closeOnCancel: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/manage/scomplex/saveScomplex',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: $("#frm_scomplex_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
deptModalHide()
$("#btnSearch").trigger('click')
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
})
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
})
});
// 엑셀다운 click
$("#btnExcel").on("click", function () {
$.ajax({
url: "/manage/scomplex/excel",
method: "GET",
dataType: "json",
data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
downloadExcel(result.data);
}
});
});
});
function deptModalHide() {
const modalEl = document.getElementById('deptModal');
const modal = bootstrap.Modal.getInstance(modalEl); // 기존 인스턴스 가져오기
if (modal) {
modal.hide();
}
}
// 엑셀 다운로드
function downloadExcel(data) {
const ws = XLSX.utils.json_to_sheet(data);
ws['!cols'] = [
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 150 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 150 },
{ wpx: 120 },
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
const blob = new Blob([wbout], { type: 'application/octet-stream' });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "특이단지관리" + getDateTimeString() + ".xlsx";
link.click();
URL.revokeObjectURL(link.href);
}
function getDateTimeString() {
const d = new Date();
const yyyy = d.getFullYear();
const mm = String(d.getMonth() + 1).padStart(2, '0');
const dd = String(d.getDate()).padStart(2, '0');
const hh = String(d.getHours()).padStart(2, '0');
const mi = String(d.getMinutes()).padStart(2, '0');
const ss = String(d.getSeconds()).padStart(2, '0');
return `${yyyy}${mm}${dd}${hh}${mi}${ss}`;
}
</script>
<?= $this->endSection() ?>

View File

@@ -0,0 +1,246 @@
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
th {
font-size: 11px;
}
#smsList tbody tr {
cursor: pointer;
}
.blockUI {
z-index: 1500 !important;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 180px;
}
</style>
<h1>SMS발송내역 관리</h1>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-body">
<form class="row align-items-end" id="frm_srch_info" onsubmit="return false;">
<!-- 소속본부 / 소속팀 -->
<div class="col-md-3">
<label class="form-label mb-1">발송일자</label>
<div class="row g-2">
<div class="col-5">
<input type="date" class="form-control" id="start_dt" name="start_dt" />
</div>
<div class="col-2 d-flex align-items-center justify-content-center">~</div>
<div class="col-5">
<input type="date" class="form-control" id="end_dt" name="end_dt" />
</div>
</div>
</div>
<div class="col-md-1">
<label class="form-label mb-1">검색유형</label>
<select class="form-control" name="srchType">
<option value="">선택</option>
<option value="1">발신자</option>
<option value="2">수신자</option>
<option value="3">수신번호</option>
</select>
</div>
<div class="col-md-1">
<label class="form-label mb-1">검색어</label>
<input type="text" class="form-control" name="srchTxt" />
</div>
<!-- 검색 버튼 -->
<div class="col-md-1 d-grid">
<button type="button" class="btn btn-primary" id="btnSearch">
검색
</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-header d-flex align-items-center">
<h3 class="card-title mb-0">SMS발송내역 목록</h3>
<div class="ms-auto d-flex align-items-center gap-3">
<button class="mb-2 me-2 border-0 btn-transition btn btn-shadow btn-outline-success"
id="excel-download">엑셀다운로드</button>
</div>
</div>
<div class="card-body">
<table id="smsList" class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th>순번</th>
<th>발신자</th>
<th>수신자</th>
<th>발송일자</th>
<th>발송구분</th>
<th>발신번호</th>
<th>수신번호</th>
<th>발송상태</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
<script type="text/javascript">
const tpl = document.querySelector('.my-loader-template')
let date = new Date()
$(function () {
$("#start_dt").val(dateFormat(date))
$("#end_dt").val(dateFormat(date))
let table = $('#smsList').DataTable({
language: lang_kor,
paging: true,
searching: false,
ordering: false,
serverSide: true,
ajax: {
url: '/manage/sms/getSmsList',
type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) {
d.start_dt = $("#frm_srch_info [name=start_dt]").val()
d.end_dt = $("#frm_srch_info [name=end_dt]").val()
d.srchType = $("#frm_srch_info [name=srchType]").val()
d.srchTxt = $("#frm_srch_info [name=srchTxt]").val()
d.start = d.start || 0
d.length = d.length || 10
}
},
"columnDefs": [
{ 'targets': '_all', "defaultContent": "" },
{ 'className': 'text-center', 'targets': [0, 1, 2, 3, 4, 5, 6, 7] },
{ targets: 6, className: "ellipsis" }
],
columns: [
{
"data": null,
"width": "50px",
"render": function (data, type, row, meta) {
return meta.row + meta.settings._iDisplayStart + 1;
}
},
{ data: 'send_name' },
{ data: 'dest_name' },
{ data: 'request_time' },
{ data: 'cate_nm' },
{ data: 'send_phone' },
{ data: 'dest_phone' },
{ data: 'status_nm' },
],
});
// 엑셀 다운로드 click
$("#excel-download").on("click", function () {
$.ajax({
url: "/manage/sms/excel",
method: "GET",
dataType: "json",
data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
downloadExcel(result.data);
}
});
});
// [검색] 버튼 눌렀을 때 다시 조회
$('#btnSearch').on('click', function () {
table.ajax.reload()
});
});
// 엑셀 다운로드
function downloadExcel(data) {
const ws = XLSX.utils.json_to_sheet(data);
ws['!cols'] = [
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
const blob = new Blob([wbout], { type: 'application/octet-stream' });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "문자발송내역" + getDateTimeString() + ".xlsx";
link.click();
URL.revokeObjectURL(link.href);
}
function getDateTimeString() {
const d = new Date();
const yyyy = d.getFullYear();
const mm = String(d.getMonth() + 1).padStart(2, '0');
const dd = String(d.getDate()).padStart(2, '0');
const hh = String(d.getHours()).padStart(2, '0');
const mi = String(d.getMinutes()).padStart(2, '0');
const ss = String(d.getSeconds()).padStart(2, '0');
return `${yyyy}${mm}${dd}${hh}${mi}${ss}`;
}
function dateFormat(date) {
let dateFormat2 = date.getFullYear() +
'-' + ((date.getMonth() + 1) < 9 ? "0" + (date.getMonth() + 1) : (date.getMonth() + 1)) +
'-' + ((date.getDate()) < 9 ? "0" + (date.getDate()) : (date.getDate()));
return dateFormat2;
}
</script>
<?= $this->endSection() ?>

View File

@@ -13,6 +13,11 @@
.blockUI { .blockUI {
z-index: 1500 !important; z-index: 1500 !important;
} }
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style> </style>
<h1>사용자 관리</h1> <h1>사용자 관리</h1>
@@ -23,7 +28,6 @@
<div class="card-body"> <div class="card-body">
<form class="row align-items-end" id="frm_srch_info" onsubmit="return false;"> <form class="row align-items-end" id="frm_srch_info" onsubmit="return false;">
<!-- 등급 -->
<div class="col-md-1"> <div class="col-md-1">
<label class="form-label mb-1">등급</label> <label class="form-label mb-1">등급</label>
<select class="form-control" name="srchLevel"> <select class="form-control" name="srchLevel">
@@ -103,7 +107,27 @@
<div class="col-md-12 col-xl-12"> <div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card"> <div class="main-card mb-3 card">
<div class="card-header">사용자 관리</div> <div class="card-header d-flex align-items-center">
<h3 class="card-title mb-0">사용자 목록</h3>
<!-- 오른쪽 영역 -->
<div class="ms-auto d-flex align-items-center gap-3">
<label class="mb-0 fw-semibold">
SMS인증여부 일괄변경
</label>
<div class="input-group input-group-sm" style="width: 200px;">
<select class="form-select" id="srcUseYn">
<option value="Y">사용</option>
<option value="N">미사용</option>
</select>
<button type="button" class="btn btn-primary" id="btnSmsSave">
저장
</button>
</div>
</div>
</div>
<div class="card-body"> <div class="card-body">
<table id="userList" class="table table-hover table-striped table-bordered"> <table id="userList" class="table table-hover table-striped table-bordered">
<thead> <thead>
@@ -306,8 +330,6 @@
} }
} }
console.log(str)
$("#srchTeam").append(str) $("#srchTeam").append(str)
}); });
@@ -320,6 +342,14 @@
ajax: { ajax: {
url: '/manage/user/getUserList', url: '/manage/user/getUserList',
type: 'GET', type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) { data: function (d) {
d.srchLevel = $("#frm_srch_info [name=srchLevel]").val() d.srchLevel = $("#frm_srch_info [name=srchLevel]").val()
d.srchBonbu = $("#frm_srch_info [name=srchBonbu]").val() d.srchBonbu = $("#frm_srch_info [name=srchBonbu]").val()
@@ -414,6 +444,71 @@
myModal.show(); myModal.show();
}); });
// SMS 일괄저장
$("#btnSmsSave").on("click", function () {
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
closeOnConfirm: false,
closeOnCancel: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/manage/user/saveSms',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: { 'useYn': $("#srcUseYn").val() },
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
userModalHide()
$("#btnSearch").trigger('click')
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
})
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
});
// 유저정보저장 // 유저정보저장
$("#userSave").on("click", function () { $("#userSave").on("click", function () {
@@ -504,10 +599,7 @@
} }
}); });
} }
});
})
}); });
@@ -594,6 +686,14 @@
method: "GET", method: "GET",
dataType: "json", dataType: "json",
data: $("#frm_srch_info").serialize(), data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) { success: function (result) {
downloadExcel(result.data); downloadExcel(result.data);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1 @@
!function(a){a.jgrid=a.jgrid||{},a.extend(a.jgrid,{"defaults":{"recordtext":"View {0} - {1} of {2}","emptyrecords":"No records to view","loadtext":"Loading...","pgtext":"Page {0} of {1}"},"search":{"caption":"Search...","Find":"Find","Reset":"Reset","odata":[{"oper":"eq","text":"equal"},{"oper":"ne","text":"not equal"},{"oper":"lt","text":"less"},{"oper":"le","text":"less or equal"},{"oper":"gt","text":"greater"},{"oper":"ge","text":"greater or equal"},{"oper":"bw","text":"begins with"},{"oper":"bn","text":"does not begin with"},{"oper":"in","text":"is in"},{"oper":"ni","text":"is not in"},{"oper":"ew","text":"ends with"},{"oper":"en","text":"does not end with"},{"oper":"cn","text":"contains"},{"oper":"nc","text":"does not contain"}],"groupOps":[{"op":"AND","text":"all"},{"op":"OR","text":"any"}]},"edit":{"addCaption":"Add Record","editCaption":"Edit Record","bSubmit":"Submit","bCancel":"Cancel","bClose":"Close","saveData":"Data has been changed! Save changes?","bYes":"Yes","bNo":"No","bExit":"Cancel","msg":{"required":"Field is required","number":"Please, enter valid number","minValue":"value must be greater than or equal to ","maxValue":"value must be less than or equal to","email":"is not a valid e-mail","integer":"Please, enter valid integer value","date":"Please, enter valid date value","url":"is not a valid URL. Prefix required ('http://' or 'https://')","nodefined":" is not defined!","novalue":" return value is required!","customarray":"Custom function should return array!","customfcheck":"Custom function should be present in case of custom checking!"}},"view":{"caption":"View Record","bClose":"Close"},"del":{"caption":"Delete","msg":"Delete selected record(s)?","bSubmit":"Delete","bCancel":"Cancel"},"nav":{"edittext":"","edittitle":"Edit selected row","addtext":"","addtitle":"Add new row","deltext":"","deltitle":"Delete selected row","searchtext":"","searchtitle":"Find records","refreshtext":"","refreshtitle":"Reload Grid","alertcap":"Warning","alerttext":"Please, select row","viewtext":"","viewtitle":"View selected row"},"col":{"caption":"Select columns","bSubmit":"Ok","bCancel":"Cancel"},"errors":{"errcap":"Error","nourl":"No url is set","norecords":"No records to process","model":"Length of colNames <> colModel!"},"formatter":{"integer":{"thousandsSeparator":",","defaultValue":"0"},"number":{"decimalSeparator":".","thousandsSeparator":",","decimalPlaces":2,"defaultValue":"0.00"},"currency":{"decimalSeparator":".","thousandsSeparator":",","decimalPlaces":2,"prefix":"","suffix":"","defaultValue":"0.00"},"date":{"dayNames":["Sun","Mon","Tue","Wed","Thr","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"monthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],"AmPm":["am","pm","AM","PM"],"S":function(a){return 11>a||a>13?["st","nd","rd","th"][Math.min((a-1)%10,3)]:"th"},"srcformat":"Y-m-d","newformat":"n/j/Y","parseRe":/[Tt\\\/:_;.,\t\s-]/,"masks":{"ISO8601Long":"Y-m-d H:i:s","ISO8601Short":"Y-m-d","ShortDate":"n/j/Y","LongDate":"l, F d, Y","FullDateTime":"l, F d, Y g:i:s A","MonthDay":"F d","ShortTime":"g:i A","LongTime":"g:i:s A","SortableDateTime":"Y-m-d\\TH:i:s","UniversalSortableDateTime":"Y-m-d H:i:sO","YearMonth":"F, Y"},"reformatAfterEdit":!1},"baseLinkUrl":"","showAction":"","target":"","checkbox":{"disabled":!0},"idName":"id"}})}(jQuery);

View File

@@ -0,0 +1 @@
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery","../grid.base"],a):a(jQuery)}(function(a){a.jgrid=a.jgrid||{},a.jgrid.hasOwnProperty("regional")||(a.jgrid.regional=[]),a.jgrid.regional.kr={defaults:{recordtext:"보기 {0} - {1} / {2}",emptyrecords:"표시할 행이 없습니다",loadtext:"조회중...",pgtext:"페이지 {0} / {1}",savetext:"Saving...",pgfirst:"First Page",pglast:"Last Page",pgnext:"Next Page",pgprev:"Previous Page",pgrecs:"Records per Page",showhide:"Toggle Expand Collapse Grid",pagerCaption:"Grid::Page Settings",pageText:"Page:",recordPage:"Records per Page",nomorerecs:"No more records...",scrollPullup:"Pull up to load more...",scrollPulldown:"Pull down to refresh...",scrollRefresh:"Release to refresh..."},search:{caption:"검색...",Find:"찾기",Reset:"초기화",odata:[{oper:"eq",text:"같다"},{oper:"ne",text:"같지 않다"},{oper:"lt",text:"작다"},{oper:"le",text:"작거나 같다"},{oper:"gt",text:"크다"},{oper:"ge",text:"크거나 같다"},{oper:"bw",text:"로 시작한다"},{oper:"bn",text:"로 시작하지 않는다"},{oper:"in",text:"내에 있다"},{oper:"ni",text:"내에 있지 않다"},{oper:"ew",text:"로 끝난다"},{oper:"en",text:"로 끝나지 않는다"},{oper:"cn",text:"내에 존재한다"},{oper:"nc",text:"내에 존재하지 않는다"},{oper:"nu",text:"is null"},{oper:"nn",text:"is not null"},{oper:"bt",text:"between"}],groupOps:[{op:"AND",text:"전부"},{op:"OR",text:"임의"}],operandTitle:"Click to select search operation.",resetTitle:"Reset Search Value",addsubgrup:"Add subgroup",addrule:"Add rule",delgroup:"Delete group",delrule:"Delete rule"},edit:{addCaption:"행 추가",editCaption:"행 수정",bSubmit:"전송",bCancel:"취소",bClose:"닫기",saveData:"자료가 변경되었습니다! 저장하시겠습니까?",bYes:"예",bNo:"아니오",bExit:"취소",msg:{required:"필수항목입니다",number:"유효한 번호를 입력해 주세요",minValue:"입력값은 크거나 같아야 합니다",maxValue:"입력값은 작거나 같아야 합니다",email:"유효하지 않은 이메일주소입니다",integer:"유효한 숫자를 입력하세요",date:"유효한 날짜를 입력하세요",url:"은 유효하지 않은 URL입니다. 문장앞에 다음단어가 필요합니다('http://' or 'https://')",nodefined:" 은 정의도지 않았습니다!",novalue:" 반환값이 필요합니다!",customarray:"사용자정의 함수는 배열을 반환해야 합니다!",customfcheck:"Custom function should be present in case of custom checking!"}},view:{caption:"행 조회",bClose:"닫기"},del:{caption:"삭제",msg:"선택된 행을 삭제하시겠습니까?",bSubmit:"삭제",bCancel:"취소"},nav:{edittext:"",edittitle:"선택된 행 편집",addtext:"",addtitle:"행 삽입",deltext:"",deltitle:"선택된 행 삭제",searchtext:"",searchtitle:"행 찾기",refreshtext:"",refreshtitle:"그리드 갱신",alertcap:"경고",alerttext:"행을 선택하세요",viewtext:"",viewtitle:"선택된 행 조회",savetext:"",savetitle:"Save row",canceltext:"",canceltitle:"Cancel row editing",selectcaption:"Actions..."},col:{caption:"열을 선택하세요",bSubmit:"확인",bCancel:"취소"},errors:{errcap:"오류",nourl:"설정된 url이 없습니다",norecords:"처리할 행이 없습니다",model:"colNames의 길이가 colModel과 일치하지 않습니다!"},formatter:{integer:{thousandsSeparator:",",defaultValue:"0"},number:{decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2,defaultValue:"0.00"},currency:{decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2,prefix:"",suffix:"",defaultValue:"0.00"},date:{dayNames:["Sun","Mon","Tue","Wed","Thr","Fri","Sat","일","월","화","수","목","금","토"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],AmPm:["am","pm","AM","PM"],S:function(a){return a<11||a>13?["st","nd","rd","th"][Math.min((a-1)%10,3)]:"th"},srcformat:"Y-m-d",newformat:"m-d-Y",parseRe:/[#%\\\/:_;.,\t\s-]/,masks:{ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",ShortDate:"Y/j/n",LongDate:"l, F d, Y",FullDateTime:"l, F d, Y g:i:s A",MonthDay:"F d",ShortTime:"g:i A",LongTime:"g:i:s A",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO",YearMonth:"F, Y"},reformatAfterEdit:!1,userLocalTime:!1},baseLinkUrl:"",showAction:"",target:"",checkbox:{disabled:!0},idName:"id"},colmenu:{sortasc:"Sort Ascending",sortdesc:"Sort Descending",columns:"Columns",filter:"Filter",grouping:"Group By",ungrouping:"Ungroup",searchTitle:"Get items with value that:",freeze:"Freeze",unfreeze:"Unfreeze",reorder:"Move to reorder"}}});

View File

@@ -0,0 +1,168 @@
/**
* jqGrid English Translation
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
/*global jQuery, define */
(function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
"jquery",
"../grid.base"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
$.jgrid = $.jgrid || {};
if(!$.jgrid.hasOwnProperty("regional")) {
$.jgrid.regional = [];
}
$.jgrid.regional["kr"] = {
defaults : {
recordtext: "보기 {0} - {1} / {2}",
emptyrecords: "표시할 행이 없습니다",
loadtext: "조회중...",
pgtext : "페이지 {0} / {1}",
savetext: "Saving...",
pgfirst : "First Page",
pglast : "Last Page",
pgnext : "Next Page",
pgprev : "Previous Page",
pgrecs : "Records per Page",
showhide: "Toggle Expand Collapse Grid",
// mobile
pagerCaption : "Grid::Page Settings",
pageText : "Page:",
recordPage : "Records per Page",
nomorerecs : "No more records...",
scrollPullup: "Pull up to load more...",
scrollPulldown : "Pull down to refresh...",
scrollRefresh : "Release to refresh..."
},
search : {
caption: "검색...",
Find: "찾기",
Reset: "초기화",
odata: [{ oper:'eq', text:"같다"},{ oper:'ne', text:"같지 않다"},{ oper:'lt', text:"작다"},{ oper:'le', text:"작거나 같다"},{ oper:'gt', text:"크다"},{ oper:'ge', text:"크거나 같다"},{ oper:'bw', text:"로 시작한다"},{ oper:'bn', text:"로 시작하지 않는다"},{ oper:'in', text:"내에 있다"},{ oper:'ni', text:"내에 있지 않다"},{ oper:'ew', text:"로 끝난다"},{ oper:'en', text:"로 끝나지 않는다"},{ oper:'cn', text:"내에 존재한다"},{ oper:'nc', text:"내에 존재하지 않는다"},{ oper:'nu', text:'is null'},{ oper:'nn', text:'is not null'}],
groupOps: [ { op: "AND", text: "전부" }, { op: "OR", text: "임의" } ],
operandTitle : "Click to select search operation.",
resetTitle : "Reset Search Value"
},
edit : {
addCaption: "행 추가",
editCaption: "행 수정",
bSubmit: "전송",
bCancel: "취소",
bClose: "닫기",
saveData: "자료가 변경되었습니다! 저장하시겠습니까?",
bYes : "예",
bNo : "아니오",
bExit : "취소",
msg: {
required:"필수항목입니다",
number:"유효한 번호를 입력해 주세요",
minValue:"입력값은 크거나 같아야 합니다",
maxValue:"입력값은 작거나 같아야 합니다",
email: "유효하지 않은 이메일주소입니다",
integer: "유효한 숫자를 입력하세요",
date: "유효한 날짜를 입력하세요",
url: "은 유효하지 않은 URL입니다. 문장앞에 다음단어가 필요합니다('http://' or 'https://')",
nodefined : " 은 정의도지 않았습니다!",
novalue : " 반환값이 필요합니다!",
customarray : "사용자정의 함수는 배열을 반환해야 합니다!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "행 조회",
bClose: "닫기"
},
del : {
caption: "삭제",
msg: "선택된 행을 삭제하시겠습니까?",
bSubmit: "삭제",
bCancel: "취소"
},
nav : {
edittext: "",
edittitle: "선택된 행 편집",
addtext:"",
addtitle: "행 삽입",
deltext: "",
deltitle: "선택된 행 삭제",
searchtext: "",
searchtitle: "행 찾기",
refreshtext: "",
refreshtitle: "그리드 갱신",
alertcap: "경고",
alerttext: "행을 선택하세요",
viewtext: "",
viewtitle: "선택된 행 조회",
savetext: "",
savetitle: "Save row",
canceltext: "",
canceltitle : "Cancel row editing",
selectcaption : "Actions..."
},
col : {
caption: "열을 선택하세요",
bSubmit: "확인",
bCancel: "취소"
},
errors : {
errcap : "오류",
nourl : "설정된 url이 없습니다",
norecords: "처리할 행이 없습니다",
model : "colNames의 길이가 colModel과 일치하지 않습니다!"
},
formatter : {
integer : {thousandsSeparator: ",", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
"일", "월", "화", "수", "목", "금", "토"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'm-d-Y',
parseRe : /[#%\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "Y/j/n",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false,
userLocalTime : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5
public/plugin/js/jqgrid/jstree.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,862 @@
/*
* http://github.com/deitch/jstree-grid
*
* This plugin handles adding a grid to a tree to display additional data
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Works only with jstree version >= 3.0.0
*
* $Date: 2015-11-29 $
* $Revision: 3.4.2 $
*/
/*jslint nomen:true */
/*jshint unused:vars */
/*global navigator, document, jQuery, define */
/* AMD support added by jochenberger per https://github.com/deitch/jstree-grid/pull/49
*
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'jstree'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var renderAWidth, renderATitle, getIndent, htmlstripre, findLastClosedNode, BLANKRE = /^\s*$/g,
IDREGEX = /[\\:&!^|()\[\]<>@*'+~#";,= \/${}%]/g, escapeId = function (id) {
return (id||"").replace(IDREGEX,'\\$&');
}, NODE_DATA_ATTR = "data-jstreegrid",
SPECIAL_TITLE = "_DATA_", LEVELINDENT = 24, styled = false, GRIDCELLID_PREFIX = "jsgrid_",GRIDCELLID_POSTFIX = "_col",
MINCOLWIDTH = 10,
findDataCell = function (from,id) {
return from.find("div["+NODE_DATA_ATTR+"='"+id+"']");
},
isClickedSep = false, toResize = null, oldMouseX = 0, newMouseX = 0;
/*jslint regexp:true */
htmlstripre = /<\/?[^>]+>/gi;
/*jslint regexp:false */
getIndent = function(node,tree) {
var div, i, li, width;
// did we already save it for this tree?
tree._gridSettings = tree._gridSettings || {};
if (tree._gridSettings.indent > 0) {
width = tree._gridSettings.indent;
} else {
// create a new div on the DOM but not visible on the page
div = $("<div></div>");
i = node.prev("i");
li = i.parent();
// add to that div all of the classes on the tree root
div.addClass(tree.get_node("#",true).attr("class"));
// move the li to the temporary div root
li.appendTo(div);
// attach to the body quickly
div.appendTo($("body"));
// get the width
width = i.width() || LEVELINDENT;
// detach the li from the new div and destroy the new div
li.detach();
div.remove();
// save it for the future
tree._gridSettings.indent = width;
}
return(width);
};
findLastClosedNode = function (tree,id) {
// first get our node
var ret, node = tree.get_node(id), children = node.children;
// is it closed?
if (!children || children.length <= 0 || !node.state.opened) {
ret = id;
} else {
ret = findLastClosedNode(tree,children[children.length-1]);
}
return(ret);
};
renderAWidth = function(node,tree) {
var depth, width,
fullWidth = parseInt(tree.settings.grid.columns[0].width,10) + parseInt(tree._gridSettings.treeWidthDiff,10);
// need to use a selector in jquery 1.4.4+
depth = tree.get_node(node).parents.length;
width = fullWidth - depth*getIndent(node,tree);
// the following line is no longer needed, since we are doing this inside a <td>
//a.css({"vertical-align": "top", "overflow":"hidden"});
return(fullWidth);
};
renderATitle = function(node,t,tree) {
var a = node.get(0).tagName.toLowerCase() === "a" ? node : node.children("a"), title, col = tree.settings.grid.columns[0];
// get the title
title = "";
if (col.title) {
if (col.title === SPECIAL_TITLE) {
title = tree.get_text(t);
} else if (t.attr(col.title)) {
title = t.attr(col.title);
}
}
// strip out HTML
title = title.replace(htmlstripre, '');
if (title) {
a.attr("title",title);
}
};
$.jstree.defaults.grid = {
width: 'auto'
};
$.jstree.plugins.grid = function(options,parent) {
this._initialize = function () {
if (!this._initialized) {
var s = this.settings.grid || {}, styles, container = this.element, gridparent = container.parent(), i,
gs = this._gridSettings = {
columns : s.columns || [],
treeClass : "jstree-grid-col-0",
context: s.contextmenu || false,
columnWidth : s.columnWidth,
defaultConf : {"*display":"inline","*+display":"inline"},
isThemeroller : !!this._data.themeroller,
treeWidthDiff : 0,
resizable : s.resizable,
stateful: s.stateful,
indent: 0
}, cols = gs.columns, treecol = 0;
// find which column our tree shuld go in
for (i=0;i<s.columns.length;i++) {
if (s.columns[i].tree) {
// save which column it was
treecol = i;
// do not check any others
break;
}
}
// set a unique ID for this table
this.uniq = Math.ceil(Math.random()*1000);
this.treecol = treecol;
this.rootid = container.attr("id");
var msie = /msie/.test(navigator.userAgent.toLowerCase());
if (msie) {
var version = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (version < 8) {
gs.defaultConf.display = "inline";
gs.defaultConf.zoom = "1";
}
}
// set up the classes we need
if (!styled) {
styled = true;
styles = [
'.jstree-grid-cell {vertical-align: top; overflow:hidden;margin-left:0;position:relative;width: 100%;padding-left:7px;white-space: nowrap;}',
'.jstree-grid-cell span {margin-right:0px;margin-right:0px;*display:inline;*+display:inline;white-space: nowrap;}',
'.jstree-grid-separator {position:absolute; top:0; right:0; height:24px; margin-left: -2px; border-width: 0 2px 0 0; *display:inline; *+display:inline; margin-right:0px;width:0px;}',
'.jstree-grid-header-cell {overflow: hidden; white-space: nowrap;padding: 1px 3px 2px 5px;}',
'.jstree-grid-header-themeroller {border: 0; padding: 1px 3px;}',
'.jstree-grid-header-regular {position:relative; background-color: #EBF3FD;}',
'.jstree-grid-resizable-separator {cursor: col-resize; width: 2px;}',
'.jstree-grid-separator-regular {border-color: #d0d0d0; border-style: solid;}',
'.jstree-grid-cell-themeroller {border: none !important; background: transparent !important;}',
'.jstree-grid-wrapper {width: 100%; overflow-x: auto;}',
'.jstree-grid-midwrapper {display: table-row; overflow: visible;}',
'.jstree-grid-width-auto {width:auto;display:block;}',
'.jstree-grid-column {display: table-cell; overflow: hidden;}',
'.jstree-grid-col-0 {width: 100%;}'
];
$('<style type="text/css">'+styles.join("\n")+'</style>').appendTo("head");
}
this.gridWrapper = $("<div></div>").addClass("jstree-grid-wrapper").appendTo(gridparent);
this.midWrapper = $("<div></div>").addClass("jstree-grid-midwrapper").appendTo(this.gridWrapper);
// set the wrapper width
if (s.width) {
this.gridWrapper.width(s.width);
}
// create the data columns
for (i=0;i<cols.length;i++) {
// create the column
$("<div></div>").addClass("jstree-grid-column jstree-grid-column-"+i+" jstree-grid-column-root-"+this.rootid).appendTo(this.midWrapper);
}
this.midWrapper.children("div:eq("+treecol+")").append(container);
container.addClass("jstree-grid-cell");
this._initialized = true;
}
};
this.init = function (el,options) {
parent.init.call(this,el,options);
this._initialize();
};
this.bind = function () {
parent.bind.call(this);
this._initialize();
this.element
.on("move_node.jstree create_node.jstree clean_node.jstree change_node.jstree", $.proxy(function (e, data) {
var target = this.get_node(data || "#",true);
this._prepare_grid(target);
}, this))
.on("delete_node.jstree",$.proxy(function (e,data) {
if (data.node.id !== undefined) {
var grid = this.gridWrapper, removeNodes = [data.node.id], i;
// add children to remove list
if (data.node && data.node.children_d) {
removeNodes = removeNodes.concat(data.node.children_d);
}
for (i=0;i<removeNodes.length;i++) {
findDataCell(grid,removeNodes[i]).remove();
}
}
}, this))
.on("close_node.jstree",$.proxy(function (e,data) {
this._hide_grid(data.node);
}, this))
.on("open_node.jstree",$.proxy(function (e,data) {
}, this))
.on("load_node.jstree",$.proxy(function (e,data) {
}, this))
.on("loaded.jstree", $.proxy(function (e) {
this._prepare_headers();
this.element.trigger("loaded_grid.jstree");
}, this))
.on("ready.jstree",$.proxy(function (e,data) {
// find the line-height of the first known node
var anchorHeight = this.element.find("li a:first").outerHeight();
$('<style type="text/css">div.jstree-grid-cell-root-'+this.rootid+' {line-height: '+anchorHeight+'px}</style>').appendTo("head");
// add container classes to the wrapper
this.gridWrapper.addClass(this.element.attr("class"));
},this))
.on("move_node.jstree",$.proxy(function(e,data){
var node = data.new_instance.element;
//renderAWidth(node,this);
// check all the children, because we could drag a tree over
node.find("li > a").each($.proxy(function(i,elm){
//renderAWidth($(elm),this);
},this));
},this))
.on("hover_node.jstree",$.proxy(function(node,selected,event){
var id = selected.node.id;
if (this._hover_node !== null && this._hover_node !== undefined) {
findDataCell(this.gridWrapper,this._hover_node).removeClass("jstree-hovered");
}
this._hover_node = id;
findDataCell(this.gridWrapper,id).addClass("jstree-hovered");
},this))
.on("dehover_node.jstree",$.proxy(function(node,selected,event){
var id = selected.node.id;
this._hover_node = null;
findDataCell(this.gridWrapper,id).removeClass("jstree-hovered");
},this))
.on("select_node.jstree",$.proxy(function(node,selected,event){
var id = selected.node.id;
findDataCell(this.gridWrapper,id).addClass("jstree-clicked");
this.get_node(selected.node.id,true).children("div.jstree-grid-cell").addClass("jstree-clicked");
},this))
.on("deselect_node.jstree",$.proxy(function(node,selected,event){
var id = selected.node.id;
findDataCell(this.gridWrapper,id).removeClass("jstree-clicked");
},this))
.on("deselect_all.jstree",$.proxy(function(node,selected,event){
// get all of the ids that were unselected
var ids = selected.node || [], i;
for (i=0;i<ids.length;i++) {
findDataCell(this.gridWrapper,ids[i]).removeClass("jstree-clicked");
}
},this))
.on("search.jstree", $.proxy(function (e, data) {
// search sometimes filters, so we need to hide all of the appropriate grid cells as well, and show only the matches
var grid = this.gridWrapper;
if(this._data.search.som) {
if(data.nodes.length) {
// hide all of the grid cells
grid.find('div.jstree-grid-cell-regular').hide();
// show only those that match
data.nodes.add(data.nodes.parentsUntil(".jstree")).filter(".jstree-node").each(function (i,node) {
var id = node.id;
if (id) {
findDataCell(grid,id).show();
}
});
}
}
return true;
}, this))
.on("clear_search.jstree", $.proxy(function (e, data) {
// search has been cleared, so we need to show all rows
this.gridWrapper.find('div.jstree-grid-cell').show();
return true;
}, this))
;
if (this._gridSettings.isThemeroller) {
this.element
.on("select_node.jstree",$.proxy(function(e,data){
data.rslt.obj.children("a").nextAll("div").addClass("ui-state-active");
},this))
.on("deselect_node.jstree deselect_all.jstree",$.proxy(function(e,data){
data.rslt.obj.children("a").nextAll("div").removeClass("ui-state-active");
},this))
.on("hover_node.jstree",$.proxy(function(e,data){
data.rslt.obj.children("a").nextAll("div").addClass("ui-state-hover");
},this))
.on("dehover_node.jstree",$.proxy(function(e,data){
data.rslt.obj.children("a").nextAll("div").removeClass("ui-state-hover");
},this));
}
if (this._gridSettings.stateful) {
this.element
.on("resize_column.jstree-grid",$.proxy(function(e,col,width){
localStorage['jstree-root-'+this.rootid+'-column-'+col] = width;
},this));
}
};
// tear down the tree entirely
this.teardown = function() {
var gw = this.gridWrapper, container = this.element, gridparent = gw.parent();
container.detach();
gw.remove();
gridparent.append(container);
parent.teardown.call(this);
};
// clean the grid in case of redraw or refresh entire tree
this._clean_grid = function (target,id) {
var grid = this.gridWrapper;
if (target) {
findDataCell(grid,id).remove();
} else {
// get all of the `div` children in all of the `td` in dataRow except for :first (that is the tree itself) and remove
grid.find("div.jstree-grid-cell-regular").remove();
}
};
// prepare the headers
this._prepare_headers = function() {
var header, i, col, gs = this._gridSettings,cols = gs.columns || [], width, defaultWidth = gs.columnWidth, resizable = gs.resizable || false,
cl, ccl, val, margin, last, tr = gs.isThemeroller, classAdd = (tr?"themeroller":"regular"), puller,
hasHeaders = false, gridparent = this.gridparent, rootid = this.rootid,
conf = gs.defaultConf,
borPadWidth = 0, totalWidth = 0;
// save the original parent so we can reparent on destroy
this.parent = gridparent;
// create the headers
for (i=0;i<cols.length;i++) {
//col = $("<col/>");
//col.appendTo(colgroup);
cl = cols[i].headerClass || "";
ccl = cols[i].columnClass || "";
val = cols[i].header || "";
if (val) {hasHeaders = true;}
if(gs.stateful && localStorage['jstree-root-'+rootid+'-column-'+i])
width = localStorage['jstree-root-'+rootid+'-column-'+i];
else
width = cols[i].width || defaultWidth;
// we only deal with borders if width is not auto and not percentages
borPadWidth = tr ? 1+6 : 2+8; // account for the borders and padding
if (width !== 'auto' && typeof(width) !== "string") {
width -= borPadWidth;
}
margin = i === 0 ? 3 : 0;
col = this.midWrapper.children("div.jstree-grid-column-"+i);
last = $("<div></div>").css(conf).css({"margin-left": margin}).addClass("jstree-grid-div-"+this.uniq+"-"+i+" "+(tr?"ui-widget-header ":"")+" jstree-grid-header jstree-grid-header-cell jstree-grid-header-"+classAdd+" "+cl+" "+ccl).html(val);
last.addClass((tr?"ui-widget-header ":"")+"jstree-grid-header jstree-grid-header-"+classAdd);
last.prependTo(col);
totalWidth += last.outerWidth();
puller = $("<div class='jstree-grid-separator jstree-grid-separator-"+classAdd+(tr ? " ui-widget-header" : "")+(resizable? " jstree-grid-resizable-separator":"")+"'>&nbsp;</div>").appendTo(last);
col.width(width);
col.css("min-width",width);
col.css("max-width",width);
}
last.addClass((tr?"ui-widget-header ":"")+"jstree-grid-header jstree-grid-header-last jstree-grid-header-"+classAdd);
// if there is no width given for the last column, do it via automatic
if (cols[cols.length-1].width === undefined) {
totalWidth -= width;
col.css({width:"auto"});
last.addClass("jstree-grid-width-auto").next(".jstree-grid-separator").remove();
}
if (hasHeaders) {
// save the offset of the div from the body
//gs.divOffset = header.parent().offset().left;
gs.header = header;
} else {
$("div.jstree-grid-header").hide();
}
if (!this.bound && resizable) {
this.bound = true;
$(document).mouseup(function () {
var ref, cols, width, headers, currentTree, colNum;
if (isClickedSep) {
colNum = toResize.prevAll(".jstree-grid-column").length;
currentTree = toResize.closest(".jstree-grid-wrapper").find(".jstree");
ref = $.jstree.reference(currentTree);
cols = ref.settings.grid.columns;
headers = toResize.parent().children("div.jstree-grid-column");
if (isNaN(colNum) || colNum < 0) { ref._gridSettings.treeWidthDiff = currentTree.find("ins:eq(0)").width() + currentTree.find("a:eq(0)").width() - ref._gridSettings.columns[0].width; }
width = ref._gridSettings.columns[colNum].width = parseFloat(toResize.css("width"));
isClickedSep = false;
toResize = null;
currentTree.trigger("resize_column.jstree-grid", [colNum,width]);
}
}).mousemove(function (e) {
if (isClickedSep) {
newMouseX = e.pageX;
var diff = newMouseX - oldMouseX,
oldPrevHeaderInner,
oldPrevColWidth, newPrevColWidth;
if (diff !== 0){
oldPrevHeaderInner = toResize.width();
oldPrevColWidth = parseFloat(toResize.css("width"));
// handle a Chrome issue with columns set to auto
// thanks to Brabus https://github.com/side-by-side
if (!oldPrevColWidth) {oldPrevColWidth = toResize.innerWidth();}
// make sure that diff cannot be beyond the left/right limits
diff = diff < 0 ? Math.max(diff,-oldPrevHeaderInner) : diff;
newPrevColWidth = oldPrevColWidth+diff;
// only do this if we are not shrinking past 0 on left - and limit it to that amount
if ((diff > 0 || oldPrevHeaderInner > 0) && newPrevColWidth > MINCOLWIDTH) {
toResize.width(newPrevColWidth+"px");
toResize.css("min-width",newPrevColWidth+"px");
toResize.css("max-width",newPrevColWidth+"px");
oldMouseX = newMouseX;
}
}
}
});
this.gridWrapper.on("selectstart", ".jstree-grid-resizable-separator", function () {
return false;
}).on("mousedown", ".jstree-grid-resizable-separator", function (e) {
isClickedSep = true;
oldMouseX = e.pageX;
toResize = $(this).closest("div.jstree-grid-column");
// the max rightmost position we will allow is the right-most of the wrapper minus a buffer (10)
return false;
})
.on("dblclick", ".jstree-grid-resizable-separator", function (e) {
var clickedSep = $(this), col = clickedSep.closest("div.jstree-grid-column"),
oldPrevColWidth = parseFloat(col.css("width")), newWidth = 0, diff,
colNum = col.prevAll(".jstree-grid-column").length,
oldPrevHeaderInner = col.width(), newPrevColWidth;
//find largest width
col.find(".jstree-grid-cell").each(function() {
var item = $(this), width;
item.css("position", "absolute");
item.css("width", "auto");
width = item.outerWidth();
item.css("position", "relative");
if (width>newWidth) {
newWidth = width;
}
});
diff = newWidth-oldPrevColWidth;
// make sure that diff cannot be beyond the left limits
diff = diff < 0 ? Math.max(diff,-oldPrevHeaderInner) : diff;
newPrevColWidth = (oldPrevColWidth+diff)+"px";
col.width(newPrevColWidth);
col.css("min-width",newPrevColWidth);
col.css("max-width",newPrevColWidth);
$(this).closest(".jstree-grid-wrapper").find(".jstree").trigger("resize_column.jstree-grid",[colNum,newPrevColWidth]);
});
}
};
/*
* Override redraw_node to correctly insert the grid
*/
this.redraw_node = function(obj, deep, is_callback, force_render) {
// first allow the parent to redraw the node
obj = parent.redraw_node.call(this, obj, deep, is_callback, force_render);
// next prepare the grid
if(obj) {
this._prepare_grid(obj);
}
return obj;
};
this.refresh = function () {
this._clean_grid();
return parent.refresh.apply(this,arguments);
};
/*
* Override set_id to update cell attributes
*/
this.set_id = function (obj, id) {
var old;
if(obj) {
old = obj.id;
}
var result = parent.set_id.apply(this,arguments);
if(result) {
if (old !== undefined) {
var grid = this.gridWrapper, oldNodes = [old], i;
// get children
if (obj && obj.children_d) {
oldNodes = oldNodes.concat(obj.children_d);
}
// update id in children
for (i=0;i<oldNodes.length;i++) {
findDataCell(grid,oldNodes[i])
.attr(NODE_DATA_ATTR, obj.id)
.attr('id', GRIDCELLID_PREFIX+obj.id+GRIDCELLID_POSTFIX+(i+1))
.removeClass(GRIDCELLID_PREFIX+old+GRIDCELLID_POSTFIX)
.addClass(GRIDCELLID_PREFIX+obj.id+GRIDCELLID_POSTFIX);
}
}
}
return result;
};
this._hide_grid = function (node) {
var children = node && node.children_d ? node.children_d : [], i;
// go through each column, remove all children with the correct ID name
for (i=0;i<children.length;i++) {
findDataCell(this.gridWrapper,children[i]).remove();
}
};
this.holdingCells = {};
this.getHoldingCells = function (obj,col,hc) {
var ret = $(), children = obj.children||[], child, i;
// run through each child, render it, and then render its children recursively
for (i=0;i<children.length;i++) {
child = GRIDCELLID_PREFIX+escapeId(children[i])+GRIDCELLID_POSTFIX+col;
if (hc[child] && obj.state.opened) {
ret = ret.add(hc[child]).add(this.getHoldingCells(this.get_node(children[i]),col,hc));
//delete hc[child];
}
}
return(ret);
};
/**
* put a grid cell in edit mode (input field to edit the data)
* @name edit(obj, col)
* @param {mixed} obj
* @param {obj} col definition
* @param {element} cell element, either span or wrapping div
*/
this._edit = function (obj, col, element) {
if(!obj) { return false; }
if (element) {
element = $(element);
if (element.prop("tagName").toLowerCase() === "div") {
element = element.children("span:first");
}
} else {
// need to find the element - later
return false;
}
var rtl = this._data.core.rtl,
w = this.element.width(),
t = obj.data[col.value],
h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
h2 = $("<"+"input />", {
"value" : t,
"class" : "jstree-rename-input",
"css" : {
"padding" : "0",
"border" : "1px solid silver",
"box-sizing" : "border-box",
"display" : "inline-block",
"height" : (this._data.core.li_height) + "px",
"lineHeight" : (this._data.core.li_height) + "px",
"width" : "150px" // will be set a bit further down
},
"blur" : $.proxy(function () {
var v = h2.val();
// save the value if changed
if(v === "" || v === t) {
v = t;
} else {
obj.data[col.value] = v;
this.element.trigger('update_cell.jstree-grid',{node:obj, col:col.value, value:v, old:t});
this._prepare_grid(this.get_node(obj,true));
}
h2.remove();
element.show();
}, this),
"keydown" : function (event) {
var key = event.which;
if(key === 27) {
this.value = t;
}
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
event.stopImmediatePropagation();
}
if(key === 27 || key === 13) {
event.preventDefault();
this.blur();
}
},
"click" : function (e) { e.stopImmediatePropagation(); },
"mousedown" : function (e) { e.stopImmediatePropagation(); },
"keyup" : function (event) {
h2.width(Math.min(h1.text("pW" + this.value).width(),w));
},
"keypress" : function(event) {
if(event.which === 13) { return false; }
}
}),
fn = {
fontFamily : element.css('fontFamily') || '',
fontSize : element.css('fontSize') || '',
fontWeight : element.css('fontWeight') || '',
fontStyle : element.css('fontStyle') || '',
fontStretch : element.css('fontStretch') || '',
fontVariant : element.css('fontVariant') || '',
letterSpacing : element.css('letterSpacing') || '',
wordSpacing : element.css('wordSpacing') || ''
};
element.hide();
element.parent().append(h2);
h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
};
this._prepare_grid = function (obj) {
var gs = this._gridSettings, c = gs.treeClass, _this = this, t, cols = gs.columns || [], width, tr = gs.isThemeroller,
tree = this.element, rootid = this.rootid,
classAdd = (tr?"themeroller":"regular"), img, objData = this.get_node(obj),
defaultWidth = gs.columnWidth, conf = gs.defaultConf, cellClickHandler = function (tree,node,val,col,t) {
return function(e) {
//node = tree.find("#"+node.attr("id"));
node.children(".jstree-anchor").trigger("click.jstree",e);
tree.trigger("select_cell.jstree-grid", [{value: val,column: col.header,node: node,grid:$(this),sourceName: col.value}]);
};
}, cellRightClickHandler = function (tree,node,val,col,t) {
return function (e) {
if (gs.context) {
e.preventDefault();
$.vakata.context.show(this,{ 'x' : e.pageX, 'y' : e.pageY },{
"edit":{label:"Edit","action": function (data) {
var obj = t.get_node(node);
_this._edit(obj,col,e.target);
}}
});
}
};
},
hoverInHandler = function (node, jsTreeInstance) {
return function() { jsTreeInstance.hover_node(node); };
},
hoverOutHandler = function (node, jsTreeInstance) {
return function() { jsTreeInstance.dehover_node(node); };
},
i, val, cl, wcl, ccl, a, last, valClass, wideValClass, span, paddingleft, title, gridCellName, gridCellParentId, gridCellParent,
gridCellPrev, gridCellPrevId, gridCellNext, gridCellNextId, gridCellChild, gridCellChildId,
col, content, tmpWidth, mw = this.midWrapper, dataCell, lid = objData.id,
peers = this.get_node(objData.parent).children,
// find my position in the list of peers. "peers" is the list of everyone at my level under my parent, in order
pos = jQuery.inArray(lid,peers),
hc = this.holdingCells, rendered = false, closed;
// get our column definition
t = $(obj);
// find the a children
a = t.children("a");
if (a.length === 1) {
closed = !objData.state.opened;
gridCellName = GRIDCELLID_PREFIX+escapeId(lid)+GRIDCELLID_POSTFIX;
gridCellParentId = objData.parent === "#" ? null : objData.parent;
a.addClass(c);
//renderAWidth(a,_this);
renderATitle(a,t,_this);
last = a;
for (i=0;i<cols.length;i++) {
if (this.treecol === i) {
continue;
}
col = cols[i];
dataCell = mw.children("div:eq("+i+")");
// get the cellClass, the wideCellClass, and the columnClass
cl = col.cellClass || "";
wcl = col.wideCellClass || "";
ccl = col.columnClass || "";
// add a column class to the dataCell
dataCell.addClass(ccl);
// get the contents of the cell - value could be a string or a function
if (col.value !== undefined && col.value !== null) {
if (typeof(col.value) === "function") {
val = col.value(objData);
} else if (objData.data !== null && objData.data !== undefined && objData.data[col.value] !== undefined) {
val = objData.data[col.value];
} else {
val = "";
}
} else {
val = "";
}
if (typeof(col.format) === "function") {
val = col.format(val);
}
// put images instead of text if needed
if (col.images) {
img = col.images[val] || col.images["default"];
if (img) {content = img[0] === "*" ? '<span class="'+img.substr(1)+'"></span>' : '<img src="'+img+'">';}
} else { content = val; }
// content cannot be blank, or it messes up heights
if (content === undefined || content === null || BLANKRE.test(content)) {
content = "&nbsp;";
}
// get the valueClass
valClass = col.valueClass && objData.data !== null && objData.data !== undefined ? objData.data[col.valueClass] || "" : "";
if (valClass && col.valueClassPrefix && col.valueClassPrefix !== "") {
valClass = col.valueClassPrefix + valClass;
}
// get the wideValueClass
wideValClass = col.wideValueClass && objData.data !== null && objData.data !== undefined ? objData.data[col.wideValueClass] || "" : "";
if (wideValClass && col.wideValueClassPrefix && col.wideValueClassPrefix !== "") {
wideValClass = col.wideValueClassPrefix + wideValClass;
}
// get the title
title = col.title && objData.data !== null && objData.data !== undefined ? objData.data[col.title] || "" : "";
// strip out HTML
title = title.replace(htmlstripre, '');
// get the width
paddingleft = 7;
width = col.width || defaultWidth;
if (width !== 'auto') {
width = tmpWidth || (width - paddingleft);
}
last = findDataCell(dataCell, lid);
if (!last || last.length < 1) {
last = $("<div></div>");
$("<span></span>").appendTo(last);
last.attr("id",gridCellName+i);
last.addClass(gridCellName);
last.attr(NODE_DATA_ATTR,lid);
}
// we need to put it in the dataCell - after the parent, but the position matters
// if we have no parent, then we are one of the root nodes, but still need to look at peers
// if we are first, i.e. pos === 0, we go right after the parent;
// if we are not first, and our previous peer (one before us) is closed, we go right after the previous peer cell
// if we are not first, and our previous peer is opened, then we have to find its youngest & lowest closed child (incl. leaf)
//
// probably be much easier to go *before* our next one
// but that one might not be drawn yet
// here is the logic for jstree drawing:
// it draws peers from first to last or from last to first
// it draws children before a parent
//
// so I can rely on my *parent* not being drawn, but I cannot rely on my previous peer or my next peer being drawn
// so we do the following:
// 1- We are the first child: install after the parent
// 2- Our previous peer is already drawn: install after the previous peer
// 3- Our previous peer is not drawn, we have a child that is drawn: install right before our first child
// 4- Our previous peer is not drawn, we have no child that is drawn, our next peer is drawn: install right before our next peer
// 5- Our previous peer is not drawn, we have no child that is drawn, our next peer is not drawn: install right after parent
gridCellPrevId = pos <=0 ? objData.parent : findLastClosedNode(this,peers[pos-1]);
gridCellPrev = findDataCell(dataCell,gridCellPrevId);
gridCellNextId = pos >= peers.length-1 ? "NULL" : peers[pos+1];
gridCellNext = findDataCell(dataCell,gridCellNextId);
gridCellChildId = objData.children && objData.children.length > 0 ? objData.children[0] : "NULL";
gridCellChild = findDataCell(dataCell,gridCellChildId);
gridCellParent = findDataCell(dataCell,gridCellParentId);
// if our parent is already drawn, then we put this in the right order under our parent
if (gridCellParentId) {
if (gridCellParent && gridCellParent.length > 0) {
if (gridCellPrev && gridCellPrev.length > 0) {
last.insertAfter(gridCellPrev);
} else if (gridCellChild && gridCellChild.length > 0) {
last.insertBefore(gridCellChild);
} else if (gridCellNext && gridCellNext.length > 0) {
last.insertBefore(gridCellNext);
} else {
last.insertAfter(gridCellParent);
}
rendered = true;
} else {
rendered = false;
}
// always put it in the holding cells, and then sort when the parent comes in, in case parent is (re)drawn later
hc[gridCellName+i] = last;
} else {
if (gridCellPrev && gridCellPrev.length > 0) {
last.insertAfter(gridCellPrev);
} else if (gridCellChild && gridCellChild.length > 0) {
last.insertBefore(gridCellChild);
} else if (gridCellNext && gridCellNext.length > 0) {
last.insertBefore(gridCellNext);
} else {
last.appendTo(dataCell);
}
rendered = true;
}
// do we have any children waiting for this cell? walk down through the children/grandchildren/etc tree
if (rendered) {
last.after(this.getHoldingCells(objData,i,hc));
}
// need to make the height of this match the line height of the tree. How?
span = last.children("span");
// create a span inside the div, so we can control what happens in the whole div versus inside just the text/background
span.addClass(cl+" "+valClass).html(content);
last = last.css(conf).addClass("jstree-grid-cell jstree-grid-cell-regular jstree-grid-cell-root-"+rootid+" jstree-grid-cell-"+classAdd+" "+wcl+ " " + wideValClass + (tr?" ui-state-default":"")).addClass("jstree-grid-col-"+i);
// add click handler for clicking inside a grid cell
last.click(cellClickHandler(tree,t,val,col,this));
last.on("contextmenu",cellRightClickHandler(tree,t,val,col,this));
last.hover(hoverInHandler(t, this), hoverOutHandler(t, this));
if (title) {
span.attr("title",title);
}
}
last.addClass("jstree-grid-cell-last"+(tr?" ui-state-default":""));
// if there is no width given for the last column, do it via automatic
if (cols[cols.length-1].width === undefined) {
last.addClass("jstree-grid-width-auto").next(".jstree-grid-separator").remove();
}
}
this.element.css({'overflow-y':'auto !important'});
};
// clean up holding cells
this.holdingCells = {};
// need to do alternating background colors or borders
};
}));