- [MEMBER] Install 드라이버 추가.
- [CUSTOMER] Container 분리. Container 표시 방식 변경.
- [MAP] Container 교체 요청 기능 추가. Image 볼 수 있도록 추가.
- [INSTALL WAITLIST] Install 오더장 생성 페이지 추가.
- [INSTALL ORDER] Install 오더 현황 페이지 추가.
This commit is contained in:
Hyojin Ahn 2026-04-26 20:52:36 -04:00
parent 025e248bad
commit e7a4b6b539
20 changed files with 8809 additions and 957 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1815,6 +1815,491 @@ table.table-search-report .tb-list th {
z-index: 999;
}
/* Install wait list */
.waitlist-scroll {
height: calc(100vh - 260px); /* header + search 고려 */
overflow-y: auto;
}
.wait-card {
border-bottom: 1px solid #eee;
padding: 12px 16px;
cursor: pointer;
}
.wait-card:hover {
background: #f8f9fa;
}
.wait-card.trial-selected {
background: #fff8e1; /* 연한 노랑 */
border-color: #ffc107;
box-shadow: 0 0 0 2px rgba(255,193,7,.25);
}
.container-chips {
cursor: pointer;
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.container-chips .chip {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
line-height: 1.2;
padding: 3px 8px;
border-radius: 6px;
white-space: nowrap;
background: #e9ecef;
color: #333;
}
.container-chips .chip-company {
background: #e9ecef;
color: #333;
}
.container-chips .chip-restaurant {
background: #fff3cd; /* warning subtle */
color: #664d03;
border: 1px solid #ffecb5;
}
.container-chips .chip-flag {
margin-left: 4px;
padding: 0 6px;
font-size: 11px;
font-weight: 700;
border-radius: 999px;
background: #ffe69c;
color: #664d03;
}
.container-chips .chip-task {
background: #dee2e6;
color: #212529;
}
.container-chips .chip i {
font-size: 13px;
line-height: 1;
}
.container-chips .chip-count {
margin-left: 4px;
font-size: 11px;
font-weight: 600;
color: #495057;
}
.note-line {
display: flex;
gap: 6px;
align-items: flex-start;
}
.note-label {
font-size: 12px;
font-weight: 600;
color: #666;
min-width: 58px;
}
.note-text {
font-size: 12px;
line-height: 1.3;
}
/*modal*/
.modal-body {
overflow: hidden;
padding: 0;
}
.install-wait-viewport {
overflow: hidden;
width: 100%;
}
.install-wait-steps-wrapper {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 100%;
transition: transform 0.35s ease;
}
.install-wait-step {
padding: 1.25rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.install-wait-step > .step-content {
flex: 1;
}
.customer-row.selected {
background-color: #e7f1ff;
border-left: 4px solid #0d6efd;
padding-left: 0.75rem;
}
#btnStep1Next,
#btnStep2Next {
min-width: 48px;
transition: all 0.15s ease;
}
.iw-inline-ctrl {
height: 34px;
}
button.iw-inline-ctrl {
padding: 0 12px;
line-height: 1.2;
}
input.iw-inline-ctrl,
.iw-inline-ctrl input {
padding-top: 4px;
padding-bottom: 4px;
line-height: 1.2;
}
.input-group.iw-inline-ctrl {
display: flex;
align-items: stretch;
}
.input-group.iw-inline-ctrl .form-control {
height: 100%;
}
.iw-toggle-on {
background-color: #e7f1ff;
border-color: #0d6efd;
color: #0d6efd;
}
.iw-toggle-on:hover {
background-color: #dbe9ff;
}
.active-step {
background-color: #e7f1ff;
border-color: #0d6efd;
color: #0d6efd;
}
.active-step:hover {
background-color: #dbe9ff;
transform: translateX(2px);
}
.iw-job-grid {
display: grid;
grid-template-columns: repeat(5, 1fr); /* 항상 한 줄 */
gap: 0.5rem;
}
.iw-job-card {
display: flex;
align-items: center;
justify-content: center;
gap: 0.4rem;
padding: 0.6rem 0.5rem;
font-size: 0.9rem;
background: #fff;
border: 1px solid #dee2e6;
border-radius: 0.375rem;
cursor: pointer;
transition: all 0.15s ease;
}
.iw-job-card i {
font-size: 1rem;
}
.iw-job-card:hover {
background: #f1f5ff;
border-color: #b6c8ff;
}
.iw-job-card.active {
background: #e7f1ff;
border-color: #0d6efd;
color: #0d6efd;
}
.iw-container-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 0.5rem;
}
.iw-container-card {
border: 1px solid #dee2e6;
padding: 0.5rem;
border-radius: 0.375rem;
cursor: pointer;
text-align: center;
font-size: 0.85rem;
}
.iw-container-card.active {
background: #e7f1ff;
border-color: #0d6efd;
color: #0d6efd;
}
/**/
#iwScheduleDate,
#iwPhotos,
#iwRequestDate,
#iwRequestBy,
#iwSelectCapacity,
#iwRequestNote,
#iwCsNote,
#kwCustomer,
#iwMapDate
{
margin-bottom: 0px !important;
}
#iwSelectCapacity {
width: 75px;
}
#iwRequestBy{
padding-top: 0.875em;
padding-bottom: 0.875em;
}
.iw-action-row {
display: flex;
gap: 12px;
margin-bottom: 12px;
}
.iw-action-row .task-action-box {
flex: 1;
}
.iw-add-btn {
min-width: 70px;
height: 36px;
display: inline-flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
.iw-name, .customer-name {
display: inline-block;
max-width: 140px; /* 이름 최대 폭 */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
}
.iw-header {
background-color: var(--color-primary);
color: var(--color-white);
}
.iw-ui-control {
height: 36px;
display: flex;
align-items: center;
}
.iw-checkbox-wrap {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
cursor: pointer;
}
.iw-checkbox-wrap input {
transform: scale(1.3);
cursor: pointer;
}
.task-action-box {
flex: 1;
padding: 8px;
border: 1px solid #dee2e6;
border-radius: 6px;
background: #f8f9fa;
}
.task-action-title {
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
display: flex;
align-items: center;
gap: 4px;
margin-bottom: 4px;
}
.task-action-title.pickup {
color: #dc3545; /* bootstrap danger */
}
.task-action-title.install {
color: #198754; /* bootstrap success */
}
@media (max-width: 768px) {
.task-actions {
flex-direction: column;
}
}
#filterTwoPerson.active {
background-color: #212529;
color: #fff;
}
.container-card {
border:1px solid #ddd;
border-radius:6px;
padding:10px;
margin-bottom:8px;
background:#fff;
}
.container-card.inactive {
background:#f7f7f7;
opacity:0.85;
}
#containerCardWrap {
display: grid;
gap: 10px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1200px) {
#containerCardWrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
#containerCardWrap { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}
.flag-marker {
position: relative;
padding: 4px 8px;
border-radius: 6px;
font-size: 13px;
font-weight: 700;
white-space: nowrap;
box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.flag-body {
display: flex;
align-items: center;
gap: 6px;
}
.flag-tail {
position: absolute;
left: 50%;
bottom: -8px;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 8px solid;
border-top-color: var(--flag-bg);
}
.flag-order {
font-weight: 800;
}
.flag-icon {
font-size: 12px;
}
.install-map-legend{
position:absolute;
top:12px;
right:12px;
z-index:10;
min-width:140px;
max-width:220px;
background:rgba(255,255,255,0.95);
border:1px solid #dcdcdc;
border-radius:10px;
box-shadow:0 2px 10px rgba(0,0,0,0.08);
padding:10px 12px;
font-size:13px;
}
.install-map-legend-title{
font-weight:700;
margin-bottom:8px;
}
.install-map-legend-item{
display:flex;
align-items:center;
gap:8px;
margin-bottom:6px;
}
.install-map-legend-item:last-child{
margin-bottom:0;
}
.install-map-legend-swatch{
width:14px;
height:14px;
border-radius:50%;
flex:0 0 14px;
border:1px solid rgba(0,0,0,0.15);
}
.reorder-selected-row {
outline: 2px solid red;
}
.summary-bar {
position: relative;
}
.view-toggle {
display: flex;
border: 1px solid #ccc;
border-radius: 8px;
overflow: hidden;
background: #fff;
margin-left: 12px;
}
.view-toggle label {
margin: 0;
cursor: pointer;
}
.view-toggle input[type="radio"] {
display: none;
}
.view-toggle span {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 36px;
color: #666;
font-size: 18px;
background: #f1f1f1;
}
.view-toggle input[type="radio"]:checked + span {
background: #ffca1a;
color: #333;
}
tr.status-P {
background-color: #b9c2c9;
color: #343a42;
text-decoration: line-through;
opacity: 0.75;
}
tr.status-M {
background-color: #fff3cd; /* bootstrap warning light */
border-left: 4px solid #ff9800;
text-decoration: line-through;
opacity: 0.75;
}
tr.status-X {
background-color: #f8d7da; /* bootstrap danger light */
border-left: 4px solid #dc3545;
text-decoration: line-through;
opacity: 0.75;
}
/* ============================
photo
============================ */
.photo-card {
border: 1px solid #ddd;
border-radius: 10px;
padding: 10px;
background: #fafafa;
height: 100%;
}
.photo-header {
font-weight: 600;
font-size: 13px;
margin-bottom: 6px;
}
.photo-card.before .photo-header {
color: #6c757d;
}
.photo-card.after .photo-header {
color: #0d6efd;
}
.photo-body {
min-height: 80px;
display: flex;
flex-wrap: wrap;
gap: 6px;
}
/* 이미지 썸네일 */
.photo-body img {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 6px;
border: 1px solid #ccc;
}
/* ============================
Segmented Radio Button
============================ */
@ -1838,6 +2323,7 @@ table.table-search-report .tb-list th {
.radio-segment span {
display: block;
width: 100%;
text-align: center;
padding: 8px 0;
background: #e7e7e7;
@ -1877,4 +2363,4 @@ table.table-search-report .tb-list th {
.radio-segment label:last-child span {
border-radius: 0 0 5px 5px;
}
}
}

View File

@ -239,7 +239,9 @@
#map-modal-input .td-title-info,
#map-modal-history .td-title-info,
#map-modal-info .td-title-info,
#map-modal-note .td-title-info {
#map-modal-container-request .td-title-info,
#customerImageModal .td-title-info
{
background-color: var(--color-sub);
color: #fff;
}
@ -430,7 +432,9 @@
#map-modal-history .modal-header,
#map-modal-info .modal-header,
#map-modal-note .modal-header,
#map-modal-input .modal-header{
#map-modal-input .modal-header,
#map-modal-container-request .modal-header,
#customerImageModal .modal-header{
padding: 0px 15px !important;
}
@ -438,7 +442,9 @@
#map-modal-history .modal-header h4,
#map-modal-info .modal-header h4,
#map-modal-note .modal-header h4,
#map-modal-input .modal-header h4{
#map-modal-input .modal-header h4,
#map-modal-container-request .modal-header h4,
#customerImageModal .modal-header h4{
font-size: 18px !important;
}
@ -446,7 +452,9 @@
#map-modal-input .modal-content,
#map-modal-history .modal-content,
#map-modal-info .modal-content,
#map-modal-note .modal-content{
#map-modal-note .modal-content,
#map-modal-container-request .modal-content,
#customerImageModal .modal-content{
border-radius: 0.5em !important;
}
@ -454,7 +462,9 @@
#map-modal-input,
#map-modal-history,
#map-modal-info,
#map-modal-note{
#map-modal-note,
#map-modal-container-request,
#customerImageModal{
top: 55px;
@ -496,6 +506,12 @@
.btn-nearby-modal{
background-color: #e24400;
}
.btn-container-request {
background-color: #af415c;
}
.btn-image-modal {
background-color: #4195af;
}
.btn-info-modal{
background-color: var(--color-sub);
}
@ -694,17 +710,17 @@ input#Liter{
}
}
.map-grid-layout-col-3 {
.map-grid-layout-col-4 {
max-width: 1000px;
margin: 0 auto;
display: grid;
gap: .3rem;
}
@media (min-width: 300px) {
.map-grid-layout-col-3 { grid-template-columns: repeat(3, 1fr); }
.map-grid-layout-col-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 819px) {
.map-grid-layout-col-3 {
.map-grid-layout-col-4 {
max-width: 1000px;
margin: 0 auto;
display: grid;

View File

@ -1449,8 +1449,7 @@ class API extends CONF {
WHERE
td.d_customeruid = tc.c_uid
AND td.d_customeruid='".$_POST['c_uid']."'
AND td.d_orderdate='".$_POST['orderdate']."'
AND td.d_jobtype ='".($_POST['jobtype'] ?? 'UCO')."'"
AND td.d_orderdate='".$_POST['orderdate']."'"
);
$result = array();

File diff suppressed because it is too large Load Diff

View File

@ -107,8 +107,36 @@ $query = "SELECT *
$result=$jdb->nQuery($query, "list error");
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
for($i=0; $i<sizeof($list); $i++) {
// container
$rows = [];
$customer_uids = [];
while ($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
$customer_uids[] = (int)$r['c_uid'];
}
$customerContainerMap = [];
$customer_uids = array_values(array_unique($customer_uids));
if ($customer_uids) {
$in = implode(',', $customer_uids);
$sql_cc = "
SELECT cc_customer_uid, cc_type, cc_owner_type, cc_is_used, cc_has_lock, cc_has_wheel, cc_has_woodframe
FROM tbl_customer_container
WHERE cc_status = 'A'
AND cc_customer_uid IN ($in)
ORDER BY cc_customer_uid, cc_type, cc_uid
";
$rc = $jdb->nQuery($sql_cc, "Load customer containers error");
while ($c = mysqli_fetch_assoc($rc)) {
$cu = (int)$c['cc_customer_uid'];
if (!isset($customerContainerMap[$cu])) $customerContainerMap[$cu] = [];
$customerContainerMap[$cu][] = $c;
}
}
foreach ($rows as $list) {
for($i=0; $i<sizeof($list); $i++) {
//list($key, $value) = each($list);
foreach ( (Array) $list as $key => $value )
$$key = $value;
@ -121,13 +149,18 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
//$rtd=$jdb->fQuery($qry, "fetch query error");
//if ($MCOMPANY == "0" || $MCOMPANY == "") $companyStr = "-";
//else $companyStr = $rtd[CNAME];
$c_uid = (int)$list['c_uid'];
$c_phone = preg_replace('/[^A-Za-z0-9\-]/', '', $c_phone);
$c_phoneSTR = substr ($c_phone, 0, 3)."-".substr ($c_phone, 3, 3)."-".substr ($c_phone, 6, 4);
$c_nameSTR = str_replace("\\", "", $c_name);
$c_addressSTR = str_replace("\\", "", $c_address);
$c_containerSTR = str_replace("\\", "", $c_container);
$customerContainers = $customerContainerMap[$c_uid] ?? [];
ob_start();
include $_SERVER['DOCUMENT_ROOT'].'/lib/customer_container_chips.php';
$containerChipsHtml = ob_get_clean();
// $c_containerSTR = str_replace("\\", "", $c_container);
$c_statusSTR = $arrStatus[$c_status];
$c_istopSTR = ($c_is_top === 'A') ? 'A Rank' : (($c_is_top === 'G') ? 'Ghost' : '');
@ -161,9 +194,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
<td>$c_postal</td>
<td>$c_paymenttype </td>
<td>$c_rate </td>
<td>$c_maincontainer </td>
<td>$c_container </td>
<td>".trim($m_region)." </td>
<td>$containerChipsHtml </td>
<td>$m_initial </td>
<td>$c_phoneSTR </td>
<td>$c_statusSTR </td>
@ -178,7 +209,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if( $total_count < 1 ) {
$strList = "
<tr><td colspan='16' align=center height='30'><B>No Data</B></td></tr>
<tr><td colspan='15' align=center height='30'><B>No Data</B></td></tr>
";
}
@ -409,8 +440,6 @@ $(document).ready(function(){
<th class="col-payment"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_paymenttype">Payment</a></th>
<th class="col-rate"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_rate">Rate</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_maincontainer">Container</a></th>
<th class="col-detail"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_container">Detail</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=m_region">Region</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=m_initial">Driver</a></th>
<th class="th-width-phone"><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_phone">Phone</a></th>
<th><a href="/index_intranet.php?view=customer_list&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_wordStr?>&sorting_type=<?=$sorting_type?>&cstatus=<?=$cstatus?>&cistop=<?=$cistop?>&switch=c_status">Status</a></th>

View File

@ -147,9 +147,8 @@ if ($actionStr == "CUSTOMERINFO") {
$columns[] = "c_regionuid";
$columns[] = "c_region";
// integration flag
$columns[] = "c_is_transfer";
$columns[] = "c_manualvolume";
////////////
// data
@ -240,8 +239,7 @@ if ($actionStr == "CUSTOMERINFO") {
$values[] = $rt_dvr['m_regionuid'];
$values[] = str_replace("\\", "", trim($rt_dvr['m_region']));
// c_is_transfer
$values[] = "N";
$values[] = isset($_POST['isManual']) ? 'Y' : 'N';
//for ($i=0; $i < count($columns); $i++)
//echo "[$columns[$i]][$values[$i]]<br>";

View File

@ -28,52 +28,6 @@ if ($_SESSION['ss_LEVEL'] == 9) $listCnt = $rt_cfg['cfg_drivercnt'];
else $listCnt = $rt_cfg['cfg_forecastcnt'];
if ($listCnt == 0) $listCnt = 10000;
/*
echo"<br><br><br><br><br>";
for($i=0; $i<sizeof($_POST); $i++) {
list($key, $value) = each($_POST);
$$key = $value;
if(is_array($value))
{
$count = 400;
for($i = 0; $i < $count; $i ++) {
if ($value[$i]) echo "ARRAY[$key][$value[$i]]<br>";
}
}
else echo "[$key][$value]<br>";
print_r($_POST);
}
// exit;
*/
/*
// sorting
if($switch) {
$switched = $func -> switchOrder($switch, $switched);
if ($switch == "c_address") {
$add_switch_query .= " ORDER BY TRIM(SUBSTRING(c_address,LOCATE(' ',c_address)+1)) $switched,
CAST(TRIM(LEFT(c_address,LOCATE(' ',c_address) - 1)) AS SIGNED) $switched,";
} else {
$add_switch_query .= " ORDER BY $switch $switched, ";
}
$switched = $switch . "^" . $switched;
}else if($switched) {
$switched1 = explode("^", $switched);
$add_switch_query .= " ORDER BY $switched1[0] $switched1[1], ";
} else {
$add_switch_query .= " ORDER BY ";
}
$getSWHStr = $switched;
*/
// searching
if($key_word) {
@ -296,7 +250,7 @@ else $typeQRY = " AND (c_schedule = 'None') ";
if ($c_type_o == "O") $orderflagQRY = " AND c_orderflag = 0 ";
else $orderflagQRY = " ";;
$qry_driver = "SELECT * FROM tbl_member WHERE m_uid = '$c_driveruid' ";
$qry_driver = "SELECT m_initial, m_firstname, m_lastname FROM tbl_member WHERE m_uid = '$c_driveruid' ";
$rt_driver = $jdb->fQuery($qry_driver, "fetch query error");
// $query = "SELECT * FROM tbl_sampletypes
@ -304,9 +258,44 @@ $rt_driver = $jdb->fQuery($qry_driver, "fetch query error");
// where tbl_members.m_uid != ''
// ORDER BY tbl_members.m_uid DESC ";
// 중복 제거
$qryR_dupQRY = "";
if ($c_type_r == 'R') {
$orderdate = str_replace("-", "", $orderdate);
$qryR_dupQRY = " and c_uid not in (";
$qryR_dup = "SELECT * FROM tbl_request WHERE r_driveruid ='$c_driveruid' AND r_status = 'A' AND r_requestdate = '$orderdate'";
$result=$jdb->nQuery($qryR_dup, "list error");
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
for($i=0; $i<sizeof($list); $i++) {
foreach ( (Array) $list as $key => $value )
$$key = $value;
}
$qryR_dupQRY = $qryR_dupQRY . $r_customeruid . ',';
}
$qryR_dupQRY = $qryR_dupQRY . '0) '; // 의미없는 uid 추가
}
$qryS_dupQRY = "";
if ($c_type_p == 'P') {
$getWeekDay = strtoupper(date('D', strtotime($orderdate)));
$orderdate = str_replace("-", "", $orderdate);
$qryS_dupQRY = " and c_uid not in (";
$qryS_dup = "SELECT * FROM tbl_customer
WHERE c_driveruid ='$org_driveruid' AND c_status = 'A'
AND (c_schedulebasic = '$orderdate' OR (c_schedule = '1W' AND c_scheduleday LIKE '%".$getWeekDay."%'))";
$result=$jdb->nQuery($qryS_dup, "list error");
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
for($i=0; $i<sizeof($list); $i++) {
foreach ( (Array) $list as $key => $value )
$$key = $value;
}
$qryS_dupQRY = $qryS_dupQRY . $c_uid . ',';
}
$qryS_dupQRY = $qryS_dupQRY . '0) '; // 의미없는 uid 추가
}
//total record
$query = "SELECT COUNT(c_uid) FROM tbl_customer
WHERE c_uid <> '' AND c_status = 'A' " . $orderflagQRY. $driveruidQRY . $typeQRY . $add_srchquery . $newaccountQRY . $dormantaccountQRY . $fullcycleQRY . $fullquantityQRY . $containerQRY . $areaQRY;
WHERE c_uid <> '' AND c_status = 'A' " . $orderflagQRY. $driveruidQRY . $typeQRY . $add_srchquery . $newaccountQRY . $dormantaccountQRY . $fullcycleQRY . $fullquantityQRY . $containerQRY . $areaQRY . $qryR_dupQRY . $qryS_dupQRY;
//if ($qrySTR) {
// $qrySTRSTR = base64_decode($qrySTR);
@ -319,7 +308,7 @@ $total_count=$jdb->rQuery($query, "record query error");
$add_query .= " LIMIT ".$listCnt;
$query = "SELECT * FROM tbl_customer
WHERE c_uid <> '' AND c_status = 'A' " . $orderflagQRY. $driveruidQRY . $typeQRY . $add_srchquery . $newaccountQRY . $dormantaccountQRY . $fullcycleQRY . $fullquantityQRY . $containerQRY . $areaQRY .
WHERE c_uid <> '' AND c_status = 'A' " . $orderflagQRY. $driveruidQRY . $typeQRY . $add_srchquery . $newaccountQRY . $dormantaccountQRY . $fullcycleQRY . $fullquantityQRY . $containerQRY . $areaQRY . $qryR_dupQRY . $qryS_dupQRY .
$add_query_order . $add_query;
//if ($qrySTR) {
@ -335,10 +324,38 @@ $query = "SELECT * FROM tbl_customer
$result=$jdb->nQuery($query, "list error");
// container
$rows = [];
$customer_uids = [];
while ($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
$customer_uids[] = (int)$r['c_uid'];
}
$customerContainerMap = [];
$customer_uids = array_values(array_unique($customer_uids));
if ($customer_uids) {
$in = implode(',', $customer_uids);
$sql_cc = "
SELECT cc_customer_uid, cc_type, cc_owner_type, cc_is_used, cc_has_lock, cc_has_wheel, cc_has_woodframe
FROM tbl_customer_container
WHERE cc_status = 'A'
AND cc_customer_uid IN ($in)
ORDER BY cc_customer_uid, cc_type, cc_uid
";
$rc = $jdb->nQuery($sql_cc, "Load customer containers error");
while ($c = mysqli_fetch_assoc($rc)) {
$cu = (int)$c['cc_customer_uid'];
if (!isset($customerContainerMap[$cu])) $customerContainerMap[$cu] = [];
$customerContainerMap[$cu][] = $c;
}
}
$totalrowcnt = 1;
$list_number = 1;
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
foreach ($rows as $list) {
for($i=0; $i<sizeof($list); $i++) {
//list($key, $value) = each($list);
foreach ( (Array) $list as $key => $value )
@ -358,7 +375,10 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$c_nameSTR = str_replace("\\", "", $c_name);
$c_addressSTR = str_replace("\\", "", $c_address);
$c_containerSTR = str_replace("\\", "", $c_container);
$customerContainers = $customerContainerMap[$c_uid] ?? [];
ob_start();
include $_SERVER['DOCUMENT_ROOT'].'/lib/customer_container_chips.php';
$containerChipsHtml = ob_get_clean();
$c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3);
$c_fullquantitydateSTR = $func -> convertFormat ($c_fullquantitydate, 3);
$c_fullquantityActual = round(floatval($c_fullquantity + ($dDiff * $c_fullquantitydaily)));
@ -430,8 +450,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
<td>$list_numberSTR</td>
<td><a class='restaurant-link' onclick=\"javascript:window.open('/index_intranet.php?view=customer_detail&mode=update&c_uid=$c_uid&page=$page&key_word=$key_word&column=$column&switched=$getSWHStr&sorting_type=$sorting_type&switch=$switch','_blank');\" style='cursor:pointer;cursor:hand;'><b class='customer-info-detail'>$c_nameSTR</b></a>&nbsp;&nbsp; $driverPopup</td>
<td>$c_accountno</td>
<td>$c_maincontainer</td>
<td>$c_containerSTR</td>
<td>$containerChipsHtml</td>
<td>$c_paymenttype</td>
<td>$c_rate</td>
<td>$c_addressSTR</td>
@ -518,7 +537,6 @@ $('#c_fullcycle_".$c_uid."').on('change', function () { // changed
$strList .= "
<td style=\"text-align: right;margin-right: 20px;\">$c_mainvolume</td>
<td>$c_lastpickupdateSTR</td>
<!--td>$c_fullquantitydateSTR</td-->
<td style=\"text-align: right;margin-right: 20px;\">$c_fullquantitySTR</td>
@ -614,8 +632,7 @@ if ($c_type_r == 'R') {
<td>R</td>
<td><a class='restaurant-link' onclick=\"javascript:window.open('/index_intranet.php?view=customer_detail&mode=update&c_uid=$c_uid&page=$page&key_word=$key_word&column=$column&switched=$getSWHStr&sorting_type=$sorting_type&switch=$switch','_blank');\" style='cursor:pointer;cursor:hand;'><b class='customer-info-detail'>$c_nameSTR</b></a>&nbsp;&nbsp; $driverPopup</td>
<td>$c_accountno</td>
<td>$c_maincontainer</td>
<td>$c_containerSTR</td>
<td>$containerChipsHtml</td>
<td>$c_paymenttype</td>
<td>$c_rate</td>
<td>$c_addressSTR</td>
@ -623,7 +640,6 @@ if ($c_type_r == 'R') {
<td style=\"text-align: right;margin-right: 20px;\">$getLastYearQ</td>
<td style=\"text-align: right;margin-right: 20px;\">$getThisYearQ</td>
<td style=\"text-align: right;margin-right: 20px;\">$c_fullcycle</td>
<td style=\"text-align: right;margin-right: 20px;\">$c_mainvolume</td>
<td>$c_lastpickupdateSTR</td>
<!--td>$c_fullquantitydateSTR</td-->
<td style=\"text-align: right;margin-right: 20px;\">$c_fullquantitySTR</td>
@ -715,8 +731,7 @@ if ($c_type_p == 'P') {
<td>S</td>
<td><a class='restaurant-link' onclick=\"javascript:window.open('/index_intranet.php?view=customer_detail&mode=update&c_uid=$c_uid&page=$page&key_word=$key_word&column=$column&switched=$getSWHStr&sorting_type=$sorting_type&switch=$switch','_blank');\" style='cursor:pointer;cursor:hand;'><b class='customer-info-detail'>$c_nameSTR</b></a>&nbsp;&nbsp; $driverPopup</td>
<td>$c_accountno</td>
<td>$c_maincontainer</td>
<td>$c_containerSTR</td>
<td>$containerChipsHtml</td>
<td>$c_paymenttype</td>
<td>$c_rate</td>
<td>$c_addressSTR</td>
@ -724,7 +739,6 @@ if ($c_type_p == 'P') {
<td style=\"text-align: right;margin-right: 20px;\">$getLastYearQ</td>
<td style=\"text-align: right;margin-right: 20px;\">$getThisYearQ</td>
<td style=\"text-align: right;margin-right: 20px;\">$c_fullcycle</td>
<td style=\"text-align: right;margin-right: 20px;\">$c_mainvolume</td>
<td>$c_lastpickupdateSTR</td>
<!--td>$c_fullquantitydateSTR</td-->
<td style=\"text-align: right;margin-right: 20px;\">$c_fullquantitySTR</td>
@ -964,49 +978,6 @@ $(document).ready(function(){
</div><!--wrap-border-->
<!-- New -->
<!--
<div class="wrap-border">
<FORM action="/action_page.php" class="form-search-inner">
<table class="td-search">
<tr>
<td class="td-title"> <label for="Driver">Driver</label></td>
<td><input type="text" id="Driver" name="Driver" value="<?=htmlspecialchars($rt_driver['m_initial'], ENT_QUOTES)?>" readonly></td>
</tr>
<tr>
<td class="td-title"><label for="Area">Area</label></td>
<td><input type="text" id="Area" name="Area" value="<?=htmlspecialchars($areaSTR, ENT_QUOTES)?>" readonly></td>
</tr>
<tr>
<td class="td-title"><label for="Bin">Bin</label></td>
<td><input type="text" id="Bin" name="Bin" value="<?=htmlspecialchars($containerSTR, ENT_QUOTES)?>" readonly></td>
</tr>
</table>
<table class="td-search">
<tr>
<td class="td-title"><label for="Liter">Liter</label></td>
<td><input type="text" id="Liter" name="Liter" value="&gt; <?=$fullquantitySTR?>" readonly></td>
</tr>
<tr>
<td class="td-title"> <label for="Cycle">Cycle</label></td>
<td><input type="text" id="Cycle" name="Cycle" value="&gt; <?=$fullcycleSTR?>" readonly></td>
</tr>
<tr>
<td colspan="2" align="right">
<span class="box-request">Request</span>
<span class="box-will-call">Schedule</span>
<span class="box-period">Period</span>
</td>
</tr>
</table>
</FORM>
</div>
-->
<FORM NAME=orderoil id=orderoil class="orderoil" METHOD=POST ACTION="/lib/user_process.php" >
<input type=hidden name=actionStr value="ORDEROIL">
<input type=hidden name=mode value="insert">
@ -1019,8 +990,7 @@ $(document).ready(function(){
<th>No</th>
<th class="td-restaurant">Restaurant Name</th>
<th class="fore-account">Account</th>
<th class="fore-container">Container</th>
<th class="td-detail">Detail</th>
<th style="width: 200px;" class="fore-container">Container</th>
<th class="fore-payment">Payment</th>
<th class="fore-rate">Rate</th>
<th class="td-address">Address</th>
@ -1028,7 +998,6 @@ $(document).ready(function(){
<th style="text-align: right;margin-right: 10px;" class="fore-2021"><?=$getLastYear?></th>
<th style="text-align: right;margin-right: 10px;" class="fore-2023"><?=$getThisYear?></th>
<th style="text-align: right;margin-right: 10px;" class="fore-cycle">Cycle</th>
<th style="text-align: right;margin-right: 10px;" class="fore-2023">Main Vol.</th>
<th class="td-lastpu">Last PU</th>
<!--th class="td-nextpu">Next PU</th-->
<th>Liter</th>
@ -1039,59 +1008,6 @@ $(document).ready(function(){
<?=$strList_s?>
<?=$strList?>
<!--
<tr class="bg-request">
<td>1</td>
<td><a href="#" class="link-name">Restaurant Name</a></td>
<td>GD221150</td>
<td>400B </td>
<td>Every summer I try to find the biggest tree around to climb. My mom always complains that my socks stink after I get home from camp.
</td>
<td>CHQ </td>
<td>0.150 </td>
<td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
<td>Toronto</td>
<td>122,543 </td>
<td>331,700 </td>
<td>60 </td>
<td>2022-12-11 </td>
<td>2022-12-31 </td>
<td>900</td>
<td>
<label class="container-chk">
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr class="bg-request">
<td>2</td>
<td><a href="#" class="link-name">Restaurant Name</a></td>
<td>GD221150</td>
<td>400B </td>
<td>Every summer I try to find the biggest tree around to climb.</td>
<td>CHQ </td>
<td>0.150 </td>
<td>145 Kingston Rd. </td>
<td>Toronto</td>
<td>2,543 </td>
<td>1,700 </td>
<td>60 </td>
<td >2022-12-11 </td>
<td>2022-12-31 </td>
<td>900</td>
<td>
<label class="container-chk">
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
-->
</table>
</div>
@ -1105,22 +1021,6 @@ $(document).ready(function(){
<p class="estimate-wrap"><span class="txt-estimate">ESTIMATE : <span id="estimatetotal">0</span> L</span></p>
</div-->
<br><br>
<!--
<div class="container-inner">
<div class="pagination">
<a href="#" ><i class="bi bi-arrow-left"></i></a>
<a href="#"class="active">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#"><i class="bi bi-arrow-right"></i></a>
</div>
</div>
-->
<div class="grid-layout-col-2">
<? if ($setTag == "ENABLED") { ?>
@ -1143,36 +1043,6 @@ $(document).ready(function(){
</main><!-- End #main -->
<!--
<script>
$(document).ready(function(){
$('.quickPopup').click(function(){
var d_accountno = $(this).data('id');
// AJAX request
$.ajax({
url: 'lib/order_history.php',
type: 'post',
data: {d_accountno: d_accountno},
success: function(response){
// Add response in Modal body
$('.modal-content-quickPopup').html(response);
// Display Modal
//$('#myModalModify').modal('show');
}
});
});
});
</script>
-->
<!-- Filter Navi -->
<button type="button" data-toggle="modal" data-target="#sidebar-left" class="filter-icon d-flex align-items-center justify-content-center btn btn-primary pull-right">
<i class="bi bi-filter-left"></i>
@ -1195,45 +1065,6 @@ $(document).ready(function(){
<input type=hidden name=orderdate value="<?=$orderdate?>">
<table class="td-search">
<!--
<tr>
<td class="td-title"> <label for="Driver">Driver</label></td>
</tr>
<tr>
<td>
<label class="container-chk">D.C
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">H.Y
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">J.L
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">J.Y
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">T.K
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">All
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
-->
<tr>
<td class="td-title"><label for="Liter">Search</label></td>
@ -1325,18 +1156,6 @@ $(document).ready(function(){
<?=$a_textSTR?>
<!--
<label class="container-chk">GTAtest
<input type="checkbox" checked>
<span class="checkmark"></span>
</label>
<label class="container-chk">Downtown
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
-->
<label class="container-chk">All
<input type="checkbox" name="c_areaall" id="checkallarea" value="1">
<span class="checkmark"></span>
@ -1350,19 +1169,6 @@ $(document).ready(function(){
<td><hr></td>
</tr>
<!--
<tr>
<td class="td-title"> <label for="Cycle">Cycle</label></td>
</tr>
<tr>
<td><input type="text" id="Cycle" name="Cycle" placeholder="60"></td>
</tr>
<tr>
<td><hr></td>
</tr>
-->
<? if ($fflag == 1) { ?>
<tr>
<td class="td-title"><label for="Bin">Bin</label></td>
@ -1371,24 +1177,6 @@ $(document).ready(function(){
<td id="checkboxbin">
<?=$c_maincontainerSTR?>
<!--
<label class="container-chk">800B
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">600B
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container-chk">400B
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
-->
<label class="container-chk">All
<input type="checkbox" name="c_maincontainerall" id="checkallbin" value="1">
<span class="checkmark"></span>
@ -1448,13 +1236,6 @@ $(document).ready(function(){
</FORM>
<!--
<tr>
<td style="padding-top:10px">
<div class="text-center"><button class="btn-primary" type="submit">SEARCH</button></div>
</td>
</tr>
-->
</table>
@ -1467,20 +1248,6 @@ $(document).ready(function(){
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!--
<script>
$ (document).ready (function () {
$ (".modal a").not (".dropdown-toggle").on ("click", function () {
$ (".modal").modal ("hide");
});
});
</script>
-->
<!-- End Filter -->
<div class="modal fade" id="myModalPopup" tabindex="-1" role="dialog" aria-labelledby="myModalPopup" style="opacity: 0.5; padding-right: 0px !important;">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content" style="background-color:#F43700 !important; max-width:240px; margin: 0 auto;">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -109,6 +109,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>
<script src="/js/customer_image.js?v=20260213"></script>
<div class="loading-overlay">Loading...</div>
@ -646,7 +647,7 @@ function popup(){
<textarea id="c_location" class="textarea shortinfo-container-location" name="c_location" rows="2" cols="20">Inside Rest</textarea>
</td>
</tr>
<tr>
<!-- <tr>
<td class="td-title-info">Installation Image</td>
<td class="td-text-info" id="installImgArea" style="border-right:none;">
<span>Loading...</span>
@ -656,7 +657,7 @@ function popup(){
<a href="#" onclick="imagepopup(jQuery('#customerShortInfo .c_uid').val());">ADD</a>
</span>
</td>
</tr>
</tr> -->
</tbody>
</table>
<br>
@ -724,6 +725,105 @@ function popup(){
</div>
<!-- NOTE DETAIL MODAL Ends -->
<!-- SIMPLE INSTALL REQUEST MODAL -->
<div class="modal fade top map" id="map-modal-container-request" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<!-- HEADER -->
<div class="modal-header">
<h4 class="modal-title">
CONTAINER REQUEST -
<span id="simpleInstallCustomerName"></span>
</h4>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<!-- BODY -->
<div class="modal-body">
<div id="simpleInstallMeta" class="mb-2 small text-muted" style="display:none;">
<div id="simpleInstallPhotoWrap" class="mb-3" style="display:none;">
<div id="simpleInstallPhotoList" class="d-flex flex-wrap gap-2 mt-2"></div>
</div>
<div><strong>Status:</strong> <span id="siStatus"></span></div>
<div><strong>Requested by:</strong> <span id="siAddedBy"></span></div>
<div><strong>Requested at:</strong> <span id="siAddedAt"></span></div>
<div><strong>Scheduled:</strong> <span id="siScheduled"></span></div>
</div>
<!-- JOB TYPE -->
<div class="mb-3">
<label class="fw-bold">Request Type</label>
<div class="d-flex gap-2 mt-2">
<button type="button" class="btn btn-outline-primary simple-job-btn" data-job="INSTALL"> <i class="bi bi-plus-circle"></i> Add </button>
<button type="button" class="btn btn-outline-danger simple-job-btn" data-job="PICKUP"> <i class="bi bi-dash-circle"></i> Pickup </button>
<button type="button" class="btn btn-outline-warning simple-job-btn" data-job="EXCHANGE"> <i class="bi bi-arrow-left-right"></i> Exchange </button>
</div>
</div>
<!-- NOTE -->
<div class="mb-3">
<label class="fw-bold">Request Note</label>
<textarea id="simpleInstallNote" class="form-control" rows="2" placeholder="Enter request note"></textarea>
</div>
<!-- PHOTO -->
<div class="mb-3">
<label class="fw-bold">Photos</label>
<input type="file" id="simpleInstallPhotos" class="form-control" multiple accept="image/*">
</div>
<!-- HIDDEN DATA -->
<input type="hidden" id="simpleInstallCustomerUid">
<input type="hidden" id="simpleInstallDriverUid">
<!-- FOOTER BUTTON -->
<div class="text-center mt-4">
<button type="button" id="btnSimpleInstallDelete" class="btn btn-danger" style="display:none;">Delete Request</button>
<button type="button" id="btnSimpleInstallSubmit" class="btn btn-success" disabled>Submit Request</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModalPopup" tabindex="-1" role="dialog" aria-labelledby="myModalPopup" style="opacity: 0.5; padding-right: 0px !important;">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content" style="background-color:#2A9B56 !important; max-width:260px; margin: 0 auto;">
<div class="myModalPopup-body" style="text-align: center; border-radius: 5px; max-height:60px; font-size:18px; background-color:#2A9B56; color: #FFFFFF; font-weight: bold;padding:0.5em 1em; ">
</div>
</div>
</div>
</div>
</div>
<!-- image modal -->
<div class="modal fade top map" id="customerImageModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
CUSTOMER IMAGES -
<span id="imageCustomerName"></span>
</h4>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body" id="customerImageModalBody">
<div class="text-center text-muted py-5">
Loading images...
</div>
</div>
</div>
</div>
</div>
<div class="container">
<!-- Modal -->
<div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false" role="dialog">
@ -833,7 +933,8 @@ function popup(){
<script>
const SS_UID = <?= (int)($_SESSION['ss_UID'] ?? 0) ?>;
const SS_DRUID = <?= (int)($_SESSION['ss_DRUID'] ?? 0) ?>;
var center = { lat: 43.732188, lng: -79.571618 };
var currentLocation = { lat: 43.764693323038315, lon: -79.47762958134186 };
@ -1686,6 +1787,7 @@ function popup(){
duid: json.result[i]['duid'],
druid: json.result[i]['druid'],
rnote: json.result[i]['rnote'],
containers: json.result[i]['containers'] || [],
<? if ($_SESSION['ss_LEVEL'] == 9) { ?>
orderFlag: json.result[i]['orderFlag']
@ -2274,6 +2376,305 @@ function popup(){
jQuery("#map-modal-note #r_note").val(json.result['rnote']).attr("disabled",false);
}
window.SimpleInstall = {
customer_uid: null,
driver_uid: null,
job_type: null
};
document.addEventListener('click', function(e){
const btn = e.target.closest('.btn-container-request');
if (!btn) return;
const payload = {
c_uid: btn.dataset.cuid,
c_name: btn.dataset.cname,
driver_uid: btn.dataset.driver,
member_uid: btn.dataset.member
};
api('install_wait_get_active', { c_uid: payload.c_uid }, function(res){
if (!res || !res.ok) return;
if (res.exists) openSimpleInstallModal(payload, res.data);
else openSimpleInstallModal(payload, null);
});
});
document.addEventListener('click', function(e){
const btn = e.target.closest('.btn-image-modal');
if (!btn) return;
openCustomerImages(
btn.dataset.cuid,
btn.dataset.cname
);
});
function openSimpleInstallModal(data, existing = null) {
// 기본 세팅
SimpleInstall.customer_uid = data.c_uid;
SimpleInstall.driver_uid = data.driver_uid;
SimpleInstall.member_uid = data.member_uid;
document.getElementById('simpleInstallCustomerName').innerText = data.c_name;
document.getElementById('simpleInstallCustomerUid').value = data.c_uid;
document.getElementById('simpleInstallDriverUid').value = data.driver_uid;
const deleteBtn = document.getElementById('btnSimpleInstallDelete');
deleteBtn.style.display = 'none';
// 초기화
document.getElementById('simpleInstallPhotos').value = '';
document.getElementById('simpleInstallNote').value = '';
document.querySelectorAll('.simple-job-btn').forEach(b => b.classList.remove('active'));
// 메타 영역
const metaWrap = document.getElementById('simpleInstallMeta');
metaWrap.style.display = 'none';
document.getElementById('siStatus').innerText = '';
document.getElementById('siAddedBy').innerText = '';
document.getElementById('siAddedAt').innerText = '';
document.getElementById('siScheduled').innerText = '';
// 기본: 새로 생성 모드
SimpleInstall.iw_uid = null;
SimpleInstall.job_type = null;
// 기본: 입력 가능
setSimpleInstallEditable(true);
if (!existing) {
document.getElementById('btnSimpleInstallSubmit').disabled = true;
renderSimpleInstallPhotos([]);
return;
}
// 기존 요청 있음
SimpleInstall.iw_uid = existing.iw_uid;
SimpleInstall.job_type = existing.iw_work_type || null;
// 메타 표시
metaWrap.style.display = 'block';
document.getElementById('siStatus').innerText = existing.iw_status || '';
document.getElementById('siAddedBy').innerText = existing.iw_request_by_name || '';
document.getElementById('siAddedAt').innerText = (existing.iw_created_at || existing.iw_request_at || '');
const sched = existing.di_install_date ? (existing.di_install_date + (existing.di_install_time ? (' ' + existing.di_install_time) : '')) : '-';
document.getElementById('siScheduled').innerText = sched;
document.getElementById('simpleInstallNote').value = existing.iw_request_note || '';
// job 버튼 active
if (existing.iw_work_type) {
document.querySelectorAll('.simple-job-btn').forEach(btn=>{
btn.classList.toggle('active', btn.dataset.job === existing.iw_work_type);
});
}
// 상태별 권한
if (existing.iw_status === 'DRAFT') {
deleteBtn.style.display = 'inline-block';
setSimpleInstallEditable(true);
document.getElementById('btnSimpleInstallSubmit').disabled = false;
} else if (existing.iw_status === 'WAITING' || existing.iw_status === 'ASSIGNED') {
deleteBtn.style.display = 'none';
setSimpleInstallEditable(false);
document.getElementById('btnSimpleInstallSubmit').disabled = true;
} else {
// 안전장치
deleteBtn.style.display = 'none';
setSimpleInstallEditable(false);
document.getElementById('btnSimpleInstallSubmit').disabled = true;
}
// 사진 표시
if (existing && existing.photos) {
renderSimpleInstallPhotos(existing.photos);
} else {
renderSimpleInstallPhotos([]);
}
}
function setSimpleInstallEditable(canEdit) {
// note
document.getElementById('simpleInstallNote').disabled = !canEdit;
// photos
document.getElementById('simpleInstallPhotos').disabled = !canEdit;
// job buttons
document.querySelectorAll('.simple-job-btn').forEach(btn=>{
btn.disabled = !canEdit;
});
// Submit 버튼 텍스트는?
// document.getElementById('btnSimpleInstallSubmit').innerText = canEdit ? 'Save' : 'Locked';
}
function renderSimpleInstallPhotos(photos){
const wrap = document.getElementById('simpleInstallPhotoList');
const outer = document.getElementById('simpleInstallPhotoWrap');
if (!wrap || !outer) return;
wrap.innerHTML = '';
if (!photos || photos.length === 0) {
outer.style.display = 'none';
return;
}
outer.style.display = 'block';
photos.forEach(photo => {
if (!photo.imgPath) return;
const url = photo.imgPath;
const div = document.createElement('div');
div.style.width = '120px';
div.innerHTML = `
<img src="${url}"
style="width:100%; height:100px; object-fit:cover; border-radius:8px; border:1px solid #ddd;">
`;
wrap.appendChild(div);
});
}
function escapeHtml(str) {
if (str == null) return '';
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
document.querySelectorAll('.simple-job-btn').forEach(btn => {
btn.onclick = function() {
document.querySelectorAll('.simple-job-btn')
.forEach(b => b.classList.remove('active'));
this.classList.add('active');
SimpleInstall.job_type = this.dataset.job;
document.getElementById('btnSimpleInstallSubmit').disabled = false;
};
});
document.getElementById('btnSimpleInstallSubmit').onclick = function(){
if (!SimpleInstall.job_type) return;
this.disabled = true;
$installNote = document.getElementById('simpleInstallNote').value;
const payload = {
c_uid: SimpleInstall.customer_uid,
driver_uid: SimpleInstall.driver_uid,
member_uid: SimpleInstall.member_uid,
job_type: SimpleInstall.job_type,
request_note: $installNote
};
// 기존 draft면 update, 아니면 create
const action = SimpleInstall.iw_uid ? 'install_wait_update_draft' : 'install_wait_create_draft';
if (SimpleInstall.iw_uid) {
payload.iw_uid = SimpleInstall.iw_uid;
}
api(action, payload, function(res){
if (!res || !res.ok){
alert('Failed to save request');
document.getElementById('btnSimpleInstallSubmit').disabled = false;
return;
}
const iw_uid = SimpleInstall.iw_uid || res.iw_uid;
// 사진 처리
const files = document.getElementById('simpleInstallPhotos').files;
if (!files || files.length === 0){
finishSimpleInstall();
return;
}
const fd = new FormData();
fd.append('actionStr', 'ADDIMAGE');
fd.append('i_type', 'install_order');
fd.append('i_customeruid', SimpleInstall.customer_uid);
fd.append('i_memberuid', SimpleInstall.driver_uid);
fd.append('i_note', $installNote);
fd.append('i_sourceuid', iw_uid);
[...files].forEach(file => {
fd.append('upload_file[]', file);
});
fetch('/lib/user_process.php', {
method: 'POST',
body: fd
})
.then(() => finishSimpleInstall())
.catch(() => finishSimpleInstall());
});
};
document.getElementById('btnSimpleInstallDelete').onclick = function(){
if (!SimpleInstall.iw_uid) return;
if (!confirm('Are you sure you want to delete this draft?')) return;
this.disabled = true;
api('install_wait_delete_draft', {
iw_uid: SimpleInstall.iw_uid
}, function(res){
if (!res || !res.ok){
alert('Failed to delete draft');
document.getElementById('btnSimpleInstallDelete').disabled = false;
return;
}
$('#map-modal-container-request').modal('hide');
});
};
function finishSimpleInstall(){
$('#map-modal-container-request').modal('hide');
setTimeout(()=>{
location.reload(); // Map 리로드
}, 300);
}
function showPopupMessage_container(message, type = 'success', duration = 1200) {
const body = document.querySelector('#myModalPopup .myModalPopup-body');
if (!body) return;
body.innerHTML = message;
if (type === 'success') {
body.style.backgroundColor = '#2A9B56'; // green
} else {
body.style.backgroundColor = '#FF8205'; // orange
}
$('#myModalPopup').modal('show');
setTimeout(function () {
$('#myModalPopup').modal('hide');
}, duration);
}
function inqCurrent() {
onLoading();
removeCircle();
@ -2353,6 +2754,43 @@ function popup(){
}
}
$('#customerImageModal').on('shown.bs.modal', function () {
const body = document.getElementById('customerImageModalBody');
initCustomerImageSlider(body);
});
function openCustomerImages(customerUid, customerName) {
// const modal = new bootstrap.Modal(
// document.getElementById('customerImageModal')
// );
const nameEl = document.getElementById('imageCustomerName');
if (nameEl) {
nameEl.innerText = customerName || '';
}
const body = document.getElementById('customerImageModalBody');
body.innerHTML = '<div class="text-center text-muted py-5">Loading images...</div>';
//modal.show();
const params = new URLSearchParams({
customer_uid: customerUid,
i_type: 'ALL'
});
fetch('/lib/customer_image.php?' + params.toString())
.then(res => res.text())
.then(html => {
body.innerHTML = html;
})
.catch(err => {
console.error(err);
body.innerHTML = '<div class="text-danger text-center py-5">Failed to load images.</div>';
});
}
function inqNearby(coord){
removeCircle();
@ -2425,6 +2863,7 @@ function popup(){
function buildContent(property) {
let content = document.createElement("div");
const chipsHtml = renderContainerChips(property.containers);
content.classList.add("property");
let innerHtml = `
@ -2442,19 +2881,9 @@ function popup(){
<td class="td-text-info">
<span>${property.accountno}</span>
</td>
<td class="td-title-info">Container</td>
<td class="td-title-info">Pay & Rate</td>
<td class="td-text-info">
<span>${property.maincontainer}</span>
</td>
</tr>
<tr>
<td class="td-title-info">Payment</td>
<td class="td-text-info">
<span>${property.paymentType}</span>
</td>
<td class="td-title-info">Rate</td>
<td class="td-text-info">
<span>${property.rate}</span>
<span style="border: 1px solid #000000; padding:2px; margin-right:8px;">${property.paymentType}</span><span>${property.rate}</span>
</td>
</tr>
<tr>
@ -2479,35 +2908,128 @@ function popup(){
</tr>
</table>
<div class="address-row">
<div class="address-row" style="margin-bottom:0px;">
<div class="address-title">Address</div>
<div class="address-content">
<a href="https://www.google.com/maps/search/?api=1&query=${property.lat},${property.lon}"
<a href="https://www.google.com/maps/search/?api=1&query=${property.lat},${property.lon}" target="_blank"
class="address-link"
style="letter-spacing: 0.5px;"
target="_blank"
rel="noopener noreferrer">
${property.address}
<b>${property.address}</b>
</a>
</div>
</div>
<div class="text-center map-grid-layout-col-3">
<button type="button" class="mapBtn btn-info-modal" onClick="javscript:showShortInfo(${property.customerid});" data-toggle="modal" data-target="#map-modal-info"><i class="fa-solid fa-question"></i> Info</button>
<button type="submit" class="mapBtn btn-grey-modal" onClick="javascript:initHistory(${property.customerid});" data-toggle="modal" data-target="#map-modal-history"><i class="bi bi-folder2-open"></i> History</button>`;
<div class="address-row">
<div class="address-title">Container</div>
<div class="address-content">
${chipsHtml}
</div>
</div>`;
innerHtml += `
<div class="text-center map-grid-layout-col-4">
<!-- Row 1 -->
<button type="button"
class="mapBtn btn-info-modal"
data-toggle="modal"
data-target="#map-modal-info"
onClick="showShortInfo(${property.customerid});">
<i class="fa-solid fa-question mapBtn-ico"></i>
<div class="mapBtn-txt">Info</div>
</button>
<button type="button"
class="mapBtn btn-grey-modal"
data-toggle="modal"
data-target="#map-modal-history"
onClick="initHistory(${property.customerid});">
<i class="bi bi-folder2-open mapBtn-ico"></i>
<div class="mapBtn-txt">History</div>
</button>
<button type="button"
class="mapBtn btn-orange-modal ${(property.rnote && /\S/.test(property.rnote)) ? 'blink' : ''}"
data-toggle="modal"
data-target="#map-modal-note"
onClick="showShortNotice(${property.duid});">
<i class="fa fa-thumb-tack mapBtn-ico"></i>
<div class="mapBtn-txt">Notice</div>
</button>`;
if(`${property.date}` === 'null') {
innerHtml += `<button type="button" class="mapBtn btn-primary-modal addOrderBtn_${property.index}" data-toggle="modal" onClick="javascript:initAddOrder(${property.customerid},${property.index});"><i class="fa-solid fa-plus"></i> Add</button>`;
innerHtml += `<button type="button" class="mapBtn btn-red-modal hidden removeOrderBtn_${property.index}" data-toggle="modal" data-target="#modal-confirm" onClick="javascript:removeOrder(${property.customerid},${property.duid},${property.index},'${property.accountno}');"><i class="fa-solid fa-xmark"></i> Remove</button>`;
}else{
innerHtml += `<button type="button" class="mapBtn btn-primary-modal addOrderBtn_${property.index} hidden" data-toggle="modal" onClick="javascript:initAddOrder(${property.customerid},${property.index});"><i class="fa-solid fa-plus"></i> Add</button>`;
innerHtml += `<button type="button" ${property.orderFlag} class="mapBtn btn-red-modal removeOrderBtn_${property.index}" data-toggle="modal" data-target="#modal-confirm" onClick="javascript:removeOrder(${property.customerid},${property.duid},${property.index},'${property.accountno}');"><i class="fa-solid fa-xmark"></i> Remove</button>`;
innerHtml += `
<button type="button"
class="mapBtn btn-primary-modal addOrderBtn_${property.index}"
onClick="initAddOrder(${property.customerid},${property.index});">
<i class="fa-solid fa-plus mapBtn-ico"></i>
<div class="mapBtn-txt">Add</div>
</button>
`;
} else {
innerHtml += `
<button type="button"
${property.orderFlag}
class="mapBtn btn-red-modal removeOrderBtn_${property.index}"
data-toggle="modal"
data-target="#modal-confirm"
onClick="removeOrder(${property.customerid},${property.duid},${property.index},'${property.accountno}');">
<i class="fa-solid fa-xmark mapBtn-ico"></i>
<div class="mapBtn-txt">Remove</div>
</button>
`;
}
innerHtml += `<button type="submit" class="mapBtn btn-nearby" onClick="javascript:inqNearby('${property.lat}:${property.lon}');"><i class="fa-solid fa-diamond-turn-right"></i> Nearby</button>
<button type="submit" class="mapBtn btn-orange-modal ${(property.rnote && /\S/.test(property.rnote)) ? 'blink' : ''}" data-toggle="modal" data-target="#map-modal-note" onClick="javscript:showShortNotice(${property.duid});"><i class="fa fa-thumb-tack"></i> Notice</button>
<button type="submit" class="mapBtn btn-purple-modal" data-toggle="modal" data-target="#map-modal-input" onClick="javascript:initInput(${property.customerid},'${property.accountno}');"><i class="bi bi-truck"></i> Input</button>
</div>
</div>
</div>
innerHtml += `
<!-- Row 2 -->
<button type="button"
class="mapBtn btn-nearby"
onClick="inqNearby('${property.lat}:${property.lon}');">
<i class="fa-solid fa-diamond-turn-right mapBtn-ico"></i>
<div class="mapBtn-txt">Nearby</div>
</button>
<button type="button"
class="mapBtn btn-container-request"
data-toggle="modal"
data-target="#map-modal-container-request"
data-cuid="${property.customerid}"
data-cname="${property.store}"
data-member="${SS_UID}"
data-driver="${SS_DRUID}">
<i class="bi bi-database-fill mapBtn-ico"></i>
<div class="mapBtn-txt">Container</div>
</button>
<button type="button"
class="mapBtn btn-image-modal"
data-toggle="modal"
data-target="#customerImageModal"
data-cuid="${property.customerid}"
data-cname="${property.store}">
<i class="bi bi-image mapBtn-ico"></i>
<div class="mapBtn-txt">Image</div>
</button>
<button type="button"
class="mapBtn btn-purple-modal"
data-toggle="modal"
data-target="#map-modal-input"
onClick="initInput(${property.customerid},'${property.accountno}');">
<i class="bi bi-truck mapBtn-ico"></i>
<div class="mapBtn-txt">Input</div>
</button>
`;
innerHtml += `</div>`;
content.innerHTML = innerHtml;
return content;
}
@ -2530,6 +3052,57 @@ function popup(){
const url = `/lib/customer_image_upload_popup.php?c_uid=${c_uid}`;
window.open(url, "uploadImage", "width=600,height=750,scrollbars=yes");
}
function renderContainerChips(containers) {
if (!Array.isArray(containers) || containers.length === 0) return '';
const grouped = new Map();
for (const cc of containers) {
const key = [
cc.cc_type,
cc.cc_owner_type,
cc.cc_has_lock,
cc.cc_has_wheel,
cc.cc_has_woodframe
].join('|');
if (!grouped.has(key)) grouped.set(key, { cc, cnt: 0 });
grouped.get(key).cnt++;
}
let html = `<div class="container-chips inline-chips">`;
for (const { cc, cnt } of grouped.values()) {
const type = String(cc.cc_type || '').toUpperCase();
let icon = 'bi-box2';
if (type.includes('D')) icon = 'bi-database-fill';
else if (type.includes('B') && !type.includes('BUCKET')) icon = 'bi-archive-fill';
const isRestaurantOwned = (cc.cc_owner_type === 'O');
const chipClass = isRestaurantOwned ? 'chip chip-restaurant' : 'chip chip-company';
let optIcons = '';
if (cc.cc_has_lock === 'Y') optIcons += ' <i class="bi bi-lock-fill"></i>';
if (cc.cc_has_wheel === 'Y') optIcons += ' <i class="bi bi-gear-fill"></i>';
if (cc.cc_has_woodframe === 'Y') optIcons += ' <i class="bi bi-bounding-box-circles"></i>';
html += `
<span class="${chipClass}" title="${isRestaurantOwned ? 'Restaurant-owned (Do not remove)' : 'Customer container'}">
<i class="bi ${icon}"></i>
${cc.cc_type || ''}
${optIcons}
${isRestaurantOwned ? '<span class="chip-flag">O</span>' : ''}
${cnt > 1 ? `<span class="chip-count">x${cnt}</span>` : ''}
</span>
`;
}
html += `</div>`;
return html;
}
</script>

View File

@ -1,38 +1,4 @@
<?
//echo "<br><br><br><br>";
/*
for($i=0; $i<sizeof($_GET); $i++) {
list($key, $value) = each($_GET);
$$key = $value;
if(is_array($value))
{
$count = 10;
for($i = 0; $i < $count; $i ++) {
if ($value[$i]) echo "ARRAY[$key][$value[$i]]<br>";
}
}
else echo "[$key][$value]<br>";
//print_r($_POST);
}
for($i=0; $i<sizeof($_POST); $i++) {
list($key, $value) = each($_POST);
$$key = $value;
if(is_array($value))
{
$count = 10;
for($i = 0; $i < $count; $i ++) {
if ($value[$i]) echo "ARRAY[$key][$value[$i]]<br>";
}
}
else echo "[$key][$value]<br>";
//print_r($_POST);
}
*/
// Level 9 이하만 사용 가능
$func->checkLevelModal(9);
@ -90,18 +56,6 @@ $query = "SELECT COUNT(d_uid) FROM tbl_daily
$total_count=$jdb->rQuery($query, "record query error");
//echo "<br><br><br><br><br>[$total_count][$query]<br>";
//페이징변수설정
/*
if(!$page) $page = 1;
if(!$list_count) $list_count = $INIT_PAGECNT; //출력리스트 갯수
if(!$page_count) $page_count = $INIT_PAGEVIEWCNT; //출력페이지 갯수
$list_number = $total_count - (($page-1)*$list_count);
$start_number = $list_count * ($page-1);
$add_query .= " LIMIT $start_number, $INIT_PAGECNT";
*/
$list_number = $total_count;
$d_quantitySUM = 0;
@ -112,9 +66,39 @@ $query = "SELECT * FROM tbl_daily
$result=$jdb->nQuery($query, "list error");
while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
for($i=0; $i<sizeof($list); $i++) {
//list($key, $value) = each($list);
// Container
$rows = [];
$customer_uids = [];
while ($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
$customer_uids[] = (int)$r['d_customeruid'];
}
$customerContainerMap = [];
$customer_uids = array_values(array_unique($customer_uids));
if ($customer_uids) {
$in = implode(',', $customer_uids);
$sql_cc = "
SELECT cc_customer_uid, cc_type, cc_owner_type, cc_is_used, cc_has_lock, cc_has_wheel, cc_has_woodframe
FROM tbl_customer_container
WHERE cc_status = 'A'
AND cc_customer_uid IN ($in)
ORDER BY cc_customer_uid, cc_type, cc_uid
";
$rc = $jdb->nQuery($sql_cc, "Load customer containers error");
while ($c = mysqli_fetch_assoc($rc)) {
$cu = (int)$c['cc_customer_uid'];
if (!isset($customerContainerMap[$cu])) $customerContainerMap[$cu] = [];
$customerContainerMap[$cu][] = $c;
}
}
foreach ($rows as $list) {
for($i=0; $i<sizeof($list); $i++) {
//list($key, $value) = each($list);
foreach ( (Array) $list as $key => $value )
$$key = $value;
}
@ -140,6 +124,11 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$d_quantitySTR = number_format(floatval($d_quantity));
$d_quantitySUM = $d_quantitySUM + floatval($d_quantity);
$customerContainers = $customerContainerMap[$c_uid] ?? [];
ob_start();
include $_SERVER['DOCUMENT_ROOT'].'/lib/customer_container_chips.php';
$containerChipsHtml = ob_get_clean();
$qry_dvr = "SELECT dr_initial FROM tbl_driver WHERE dr_uid = '".$d_druid."' ";
$rt_dvr = $jdb->fQuery($qry_dvr, "fetch query error");
@ -244,21 +233,6 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$putNotePopup = "";
}
/*
if ($d_ruid != "") {
$qry_rnote = "SELECT r_note FROM tbl_request WHERE r_uid = '".$d_ruid."' ";
$rt_rnote = $jdb->fQuery($qry_rnote, "fetch query error");
$r_noteSTR = str_replace("\\", "", trim($rt_rnote[0]));
if ($r_noteSTR != "") $putNotePopup = "&nbsp;&nbsp; <a data-toggle='modal' style='cursor:pointer;cursor:hand;' class='customerShortNote' data-target='#myModalcustomerShortNote' data-id=\"$d_uid\" data-history-type='standard-access'>&#128204;</a>";
else $putNotePopup = "";
}
else {
$putNotePopup = "";
}
*/
$driverPopup = "<a data-toggle='modal' style='cursor:pointer;cursor:hand;' class='customerShortInfo' data-target='#myModalcustomerShortInfo' data-id=\"$d_customeruid\" data-history-type='standard-access'>&#10067;</a>";
if ($d_ordertype == "R" || $d_ordertype == "S") $list_numberSTR = $d_ordertype;
@ -276,7 +250,7 @@ while($list=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
</td>
<td><b><a onclick=\"javascript:window.open('/index_intranet.php?view=customer_detail&mode=update&c_uid=$c_uid&page=$page&key_word=$key_word&column=$column&switched=$getSWHStr&sorting_type=$sorting_type&switch=$switch','_blank');\" style='cursor:pointer;cursor:hand;' class=\"link-name\" ><b>$d_nameSTR</a></b>&nbsp;&nbsp; $driverPopup $putNotePopup</td>
<td>$d_accountno</td>
<td>$d_maincontainer</td>
<td>$containerChipsHtml</td>
<td>$d_paymenttype</td>
<td>$d_rate</td>
<td>$d_addressSTR</td>
@ -371,7 +345,6 @@ $('#c_fullcycle_".$c_uid."').on('change', function () { // changed
$strList .= "
<td>$d_lastpickupdateSTR</td>
<td>-</td>
<td>$d_containerSTR</td>
</tr>
";
@ -381,7 +354,7 @@ $('#c_fullcycle_".$c_uid."').on('change', function () { // changed
if( $total_count < 1 ) {
$strList = "
<tr><td colspan='21' align=center height='30'><B>No Data</B></td></tr>
<tr><td colspan='20' align=center height='30'><B>No Data</B></td></tr>
";
}
@ -460,16 +433,6 @@ $(function () {
$(".modal-footer #d_accountno").val(my_accountno_value);
})
});
/*
$(function () {
$(".pickupOrderClass").click(function () {
var my_id_value = $(this).data('id');
$("#pickupOrderModal #d_uid").val(my_id_value);
})
});
*/
</SCRIPT>
@ -681,68 +644,19 @@ function printDiv(divName) {
<th class="td-order-cycle">Cycle</th>
<th class="td-order-lastpu"><a href="/index_intranet.php?view=order_driver&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_word?>&sorting_type=<?=$sorting_type?>&d_orderdate=<?=$d_orderdate?>&d_druid=<?=$d_druid?>&switch=d_lastpickupdate">Last PU</a></th>
<th class="td-order-nextpu">Next PU</th>
<th class="td-order-detail"><a href="/index_intranet.php?view=order_driver&switched=<?=$getSWHStr?>&page=<?=$page?>&key_word=<?=$key_word?>&sorting_type=<?=$sorting_type?>&d_orderdate=<?=$d_orderdate?>&d_druid=<?=$d_druid?>&switch=d_container">Detail</a></th>
</tr>
<?=$strList?>
<!--
<tr class="bg-request">
<td>1</td>
<td><a href="#" class="link-name">Restaurant Name</a></td>
<td>GD221150</td>
<td>400B </td>
<td>Every summer I try to find the biggest tree around to climb. My mom always complains that my socks stink after I get home from camp.
</td>
<td>CHQ </td>
<td>0.150 </td>
<td>145 Kingston Rd. Nork Yorth, ON M1K 7Y8</td>
<td>Toronto</td>
<td>2,543 </td>
<td>1,700 </td>
<td>60 </td>
<td>2022-12-11 </td>
<td>2022-12-31 </td>
<td>900</td>
<td>350</td>
<td>2022-12-11 </td>
<td>
<button type="button" class="btn icon-pickup" data-bs-toggle="modal" data-bs-target="#pickup-modal" data-pickup-type="standard-access">
<i class="bi bi-truck icon-edit"></i>
</button>
</td>
<td>
<button type="button" class="btn icon-history" data-bs-toggle="modal" data-bs-target="#history-modal" data-history-type="standard-access">
<i class="bi bi-folder2-open icon-delete"></i>
</button>
</td>
</tr>
-->
</table>
</div>
<div class="container-inner">
<p class="estimate-wrap"><span class="txt-estimate">ACTUAL : <span id="estimatetotal"><?=number_format($d_quantitySUM)?></span> L</span></p>
</div>
<br><br>
<!--div class="container-inner">
<div class="pagination">
<a href="#" ><i class="bi bi-arrow-left"></i></a>
<a href="#"class="active">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#"><i class="bi bi-arrow-right"></i></a>
</div>
</div-->
<div class="col-lg-12">
<a class="btn-sub text-center width-200" href="/index_intranet.php?view=order_list">BACK</a>
</div>

View File

@ -8,7 +8,7 @@ $arrPaymenttype = array ('CA' => 'Cash', 'CHQ' => 'Cheque', 'DIRECT' => 'Direct
$arrBin = array ('D' => '200L Drum', '400B' => '400L Bin', '500B' => '500L Bin', '600B' => '600L Bin',
'700B' => '700L Bin', '800B' => '800L Bin', '1000B' => '1000L Bin',
'OB' => 'Owner\'s Bin' ,'OD' => 'Owner\'s Drum' , 'P' => 'Bucket', 'CB' => 'Customized Bin');
'P' => 'Bucket', 'CB' => 'Customized Bin');
$arrForm = array ('Not Yet' => 'Not Yet', 'Paper' => 'Paper', 'Electronic' => 'Electronic' );
$arrSchedule = array ('None' => 'None', '1W' => '1W', '2W' => '2W', '3W' => '3W', '4W' => '4W', '5W' => '5W', '6W' => '6W', 'Will Call' => 'Will Call' );

View File

@ -5,10 +5,13 @@ $userName = $_SESSION['ss_NAME'] ?? '';
// ---- Level Groups ----
$isAdmin = in_array($level, [1, 5]);
$isManager = in_array($level, [1, 5, 9]);
$canExport = in_array($level, [1, 5, 6, 7]);
$canOrder = ($level != 7);
$isManager = in_array($level, [1, 5]);
$isAccounting = ($level == 6);
$isMarketing = ($level == 7); // cannot order
$isInstallDriver= ($level == 8);
$isUcoDriver = ($level == 9);
$isCustomerOnly = ($level == 10);
$canExport = in_array($level, [1, 5, 6, 7]);
?>
<body>
@ -29,14 +32,38 @@ $isCustomerOnly = ($level == 10);
<?php else: ?>
<?php if ($isManager): ?>
<li class="dropdown">
<a href="#"><span>PLANNING</span> <i class="bi bi-chevron-down dropdown-indicator"></i></a>
<ul>
<li><a href="/index_intranet.php?view=forecast">FORECAST</a></li>
<li><a href="/index_intranet.php?view=install_wait_list">INSTALL WAIT LIST</a></li>
</ul>
</li>
<?php endif; ?>
<?php if ($isUcoDriver): ?>
<li><a href="/index_intranet.php?view=forecast">FORECAST</a></li>
<?php endif; ?>
<?php if ($canOrder): ?>
<?php if ($isManager || $isAccounting): ?>
<li class="dropdown">
<a href="#"><span>ORDER</span> <i class="bi bi-chevron-down dropdown-indicator"></i></a>
<ul>
<li><a href="/index_intranet.php?view=order_list">UCO ORDER</a></li>
<li><a href="/index_intranet.php?view=install_order">INSTALL ORDER</a></li>
</ul>
</li>
<?php endif; ?>
<?php if ($isUcoDriver): ?>
<li><a href="/index_intranet.php?view=order_list">ORDER</a></li>
<?php endif; ?>
<?php if ($isManager): ?>
<?php if ($isInstallDriver): ?>
<li><a href="/index_intranet.php?view=install_order">ORDER</a></li>
<?php endif; ?>
<?php if ($isManager || $isUcoDriver): ?>
<li><a href="/index_intranet.php?view=map">MAP</a></li>
<?php endif; ?>

View File

@ -0,0 +1,104 @@
function openCustomerImages(customerUid) {
const modalEl = document.getElementById('customerImageModal');
const modal = new bootstrap.Modal(modalEl);
const body = document.getElementById('customerImageModalBody');
body.innerHTML = '<div class="text-center text-muted py-5">Loading images...</div>';
modal.show();
const params = new URLSearchParams({
customer_uid: customerUid,
i_type: 'install_order'
});
fetch('/lib/customer_image.php?' + params.toString())
.then(res => res.text())
.then(html => {
body.innerHTML = html;
// HTML 주입 후, 슬라이더 초기화 (스크립트 실행 기대 X)
initCustomerImageSlider(body);
})
.catch(err => {
console.error(err);
body.innerHTML = '<div class="text-danger text-center py-5">Failed to load images.</div>';
});
}
function initCustomerImageSlider(scopeEl) {
const slider = scopeEl.querySelector('#customerImageSlider');
if (!slider) return;
let images = [];
let meta = [];
try {
images = JSON.parse(slider.dataset.images || '[]');
meta = JSON.parse(slider.dataset.meta || '[]');
} catch (e) {
console.error('slider json parse error', e);
return;
}
if (!images.length) return;
let currentIndex = 0;
const imgEl = scopeEl.querySelector('#sliderImage');
const idxEl = scopeEl.querySelector('#sliderIndex');
const metaEl = scopeEl.querySelector('#sliderMeta');
const btnPrev = scopeEl.querySelector('#btnPrevImage');
const btnNext = scopeEl.querySelector('#btnNextImage');
function formatCreated(str) {
// 기대 포맷: 20260205121137
if (!str) return '';
if (/^\d{14}$/.test(str)) {
return str.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, '$1-$2-$3 $4:$5:$6');
}
return str; // 이미 datetime 이면 그대로
}
function getTypeLabel(type) {
switch (type) {
case 'install':
return 'Install Image';
case 'install_order':
return 'Container Request Image';
default:
return type || '';
}
}
function update() {
imgEl.src = images[currentIndex];
idxEl.textContent = (currentIndex + 1);
const m = meta[currentIndex] || {};
metaEl.innerHTML =
'<b>Type:</b> ' + getTypeLabel(m.type || '') + '<br>' +
'<b>Note:</b> ' + ((m.note || '').replace(/\n/g, '<br>')) + '<br>' +
'<b>Created:</b> ' + formatCreated(m.created || '') + '<br>' +
'<b>By:</b> ' + (m.by || '');
}
// 이벤트 중복 방지: 버튼을 클론으로 교체해서 기존 리스너 제거
const prevClone = btnPrev.cloneNode(true);
const nextClone = btnNext.cloneNode(true);
btnPrev.parentNode.replaceChild(prevClone, btnPrev);
btnNext.parentNode.replaceChild(nextClone, btnNext);
prevClone.addEventListener('click', () => {
currentIndex = (currentIndex - 1 + images.length) % images.length;
update();
});
nextClone.addEventListener('click', () => {
currentIndex = (currentIndex + 1) % images.length;
update();
});
// 초기 렌더
update();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,249 @@
<div class="install-wait-viewport">
<div class="install-wait-steps-wrapper">
<!-- STEP 1 -->
<div class="install-wait-step" id="installWaitStep1">
<div class="step-content">
<div class="mb-3">
<div class="fw-bold">Step 1 of 3 - Select customer</div>
</div>
<hr>
<div class="mb-3">
<label class="form-label">Search customer</label>
<input type="text" id="customerSearchInput" class="form-control" placeholder="Customer / Account">
</div>
<div id="customerSearchResult" class="border rounded p-2" style="min-height:300px; max-height:300px; overflow-y:auto;">
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<button id="btnStep1Next" class="btn btn-sm btn-secondary d-flex align-items-center gap-1" disabled>
<span>Next</span>
<i class="bi bi-arrow-right"></i>
</button>
</div>
</div>
<!-- STEP 2 -->
<div class="install-wait-step" id="installWaitStep2">
<div class="step-content">
<div class="mb-3">
<div class="fw-bold">Step 2 of 3 - Job Type</div>
</div>
<hr>
<div class="mb-3 p-3 bg-light rounded">
<div class="row g-2">
<div class="col-md-4">
<label class="form-label small text-muted mb-1">Account</label>
<input type="text" id="iwCustomerAccount" class="form-control form-control-sm" readonly>
</div>
<div class="col-md-8">
<label class="form-label small text-muted mb-1">Customer name</label>
<input type="text" id="iwCustomerName" class="form-control form-control-sm">
</div>
<div class="col-md-12">
<label class="form-label small text-muted mb-1">Address</label>
<input type="text" id="iwCustomerAddress" class="form-control form-control-sm">
</div>
<div class="col-md-4">
<label class="form-label small text-muted mb-1">City</label>
<input type="text" id="iwCustomerCity" class="form-control form-control-sm">
</div>
<div class="col-md-4">
<label class="form-label small text-muted mb-1">Postal code</label>
<input type="text" id="iwCustomerPostal" class="form-control form-control-sm">
</div>
<div class="col-md-4">
<label class="form-label small text-muted mb-1">Phone</label>
<input type="text" id="iwCustomerPhone" class="form-control form-control-sm">
</div>
</div>
</div>
<div class="iw-job-grid">
<button class="iw-job-card" data-job="INSTALL">
<i class="bi bi-plus-square"></i>
<span>Install</span>
</button>
<button class="iw-job-card" data-job="PICKUP">
<i class="bi bi-dash-square"></i>
<span>Pickup</span>
</button>
<button class="iw-job-card" data-job="EXCHANGE">
<i class="bi bi-arrow-left-right"></i>
<span>Exchange</span>
</button>
<button class="iw-job-card" data-job="RELOCATE">
<i class="bi bi-arrows-move"></i>
<span>Relocate</span>
</button>
<button class="iw-job-card" data-job="CLEAN">
<i class="bi bi-brush"></i>
<span>Clean</span>
</button>
</div>
</div>
<div class="d-flex justify-content-between mt-4">
<button id="btnStep2Back" class="btn btn-sm btn-outline-secondary d-flex align-items-center gap-1">
<i class="bi bi-arrow-left"></i>
<span>Back</span>
</button>
<button id="btnStep2Next" class="btn btn-sm btn-secondary d-flex align-items-center gap-1" disabled>
<span>Next (Draft)</span>
<i class="bi bi-arrow-right"></i>
</button>
</div>
</div>
<div class="install-wait-step" id="installWaitStep3">
<div class="step-content">
<div class="mb-3">
<div class="fw-bold" id="iwStep3Title"></div>
</div>
<hr>
<!-- JS가 action box를 생성 -->
<div id="iwStep3ContainerArea" class="task-actions mt-2"></div>
<!-- Row 1 : Req date + Due date -->
<div class="row g-2 mb-3 align-items-end">
<div class="col-md-6">
<label class="form-label small">Request date</label>
<input type="text" id="iwRequestDate" class="form-control form-control-sm date-picker-form" autocomplete="off" placeholder="<?=date('Y-m-d')?>" readonly>
</div>
<div class="col-md-6">
<label class="form-label small">Due date</label>
<input type="text" id="iwScheduleDate" class="form-control form-control-sm date-picker-form" autocomplete="off" placeholder="yyyy-mm-dd" readonly>
</div>
</div>
<!-- Row 2 : Req By + Photos -->
<div class="row g-2 mb-3 align-items-end">
<div class="col-md-6">
<label class="form-label small">Request By</label>
<select id="iwRequestBy" class="form-select form-select-sm"></select>
</div>
<div class="col-md-6">
<div class="d-flex justify-content-between align-items-center">
<label class="form-label small">Photos</label>
<button type="button" id="btnViewPhotos" class="btn btn-sm btn-outline-primary d-none">
<i class="bi bi-image"></i> View
</button>
</div>
<input type="file" id="iwPhotos" class="form-control form-control-sm" multiple>
</div>
</div>
<!-- Row 3 : Request Note + CS Note -->
<div class="row g-2 mb-3">
<div class="col-md-6">
<label class="form-label small">Note from Request</label>
<textarea id="iwRequestNote" class="form-control form-control-sm" rows="2"></textarea>
</div>
<div class="col-md-6">
<label class="form-label small">Note for CS</label>
<textarea id="iwCsNote" class="form-control form-control-sm" rows="2"></textarea>
</div>
</div>
<!-- Row 4 : Two-person job + Recurring -->
<div class="row g-2 mb-3 align-items-start">
<!-- LEFT : Note for Install Driver -->
<div class="col-md-6">
<label class="form-label small">Note for Install Driver</label>
<textarea id="iwWorkNote" class="form-control form-control-sm" rows="2"></textarea>
</div>
<!-- RIGHT : Two-person + Recurring -->
<div class="col-md-6">
<label class="form-label small">Other Options</label>
<!-- Two-person row -->
<div class="row g-2 align-items-center mb-2">
<div class="col-md-4">
<button type="button"
id="btnTwoPerson"
class="btn btn-sm btn-outline-secondary w-100 d-flex align-items-center justify-content-center gap-2 iw-inline-ctrl">
<i class="bi bi-people"></i>
Two-person
</button>
</div>
<div class="col-md-8">
<div class="input-group input-group-sm iw-inline-ctrl">
<input id="iwTwoPersonReason"
class="form-control"
placeholder="Reason (required if enabled)"
disabled>
</div>
</div>
</div>
<!-- Recurring row -->
<div class="row g-2 align-items-center">
<div class="col-md-4">
<button type="button"
id="btnRecurring"
class="btn btn-sm btn-outline-secondary w-100 d-flex align-items-center justify-content-center gap-2 iw-inline-ctrl">
<i class="bi bi-arrow-repeat"></i>
Recurring
</button>
</div>
<div class="col-md-8">
<div class="input-group input-group-sm iw-inline-ctrl">
<input type="number"
id="iwRecurringDays"
class="form-control"
placeholder="Cycle (days)"
min="1"
disabled>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="d-flex justify-content-between mt-4">
<button id="btnStep3Back" class="btn btn-sm btn-outline-secondary d-flex align-items-center gap-1">
<i class="bi bi-arrow-left"></i><span>Back</span>
</button>
<button id="btnStep3Complete" class="btn btn-sm btn-success d-flex align-items-center gap-1">
<i class="bi bi-check-lg"></i>Complete</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,66 @@
<?php
if (empty($customerContainers) || !is_array($customerContainers)) return;
$groupedContainers = [];
/* group identical containers */
foreach ($customerContainers as $cc) {
$key = implode('|', [
$cc['cc_type'],
$cc['cc_owner_type'],
$cc['cc_has_lock'],
$cc['cc_has_wheel'],
$cc['cc_has_woodframe'],
]);
if (!isset($groupedContainers[$key])) {
$groupedContainers[$key] = [
'cc' => $cc,
'cnt' => 0
];
}
$groupedContainers[$key]['cnt']++;
}
?>
<div class="container-chips inline-chips">
<?php foreach ($groupedContainers as $g): ?>
<?php
$cc = $g['cc'];
$cnt = $g['cnt'];
$type = strtoupper($cc['cc_type']);
if (strpos($type, 'D') !== false) {
$icon = 'bi-database-fill';
} elseif (strpos($type, 'B') !== false && strpos($type, 'BUCKET') === false) {
$icon = 'bi-archive-fill';
} else {
$icon = 'bi-box2';
}
$isRestaurantOwned = ($cc['cc_owner_type'] === 'O');
$chipClass = $isRestaurantOwned ? 'chip chip-restaurant' : 'chip chip-company';
$optIcons = '';
if ($cc['cc_has_lock'] === 'Y') $optIcons .= ' <i class="bi bi-lock-fill"></i>';
if ($cc['cc_has_wheel'] === 'Y') $optIcons .= ' <i class="bi bi-gear-fill"></i>';
if ($cc['cc_has_woodframe'] === 'Y') $optIcons .= ' <i class="bi bi-bounding-box-circles"></i>';
?>
<span class="<?=$chipClass?>"
title="<?=$isRestaurantOwned ? 'Restaurant-owned (Do not remove)' : 'Customer container'?>">
<i class="bi <?=$icon?>"></i>
<?=$cc['cc_type']?>
<?=$optIcons?>
<?php if ($isRestaurantOwned): ?>
<span class="chip-flag">O</span>
<?php endif; ?>
<?php if ($cnt > 1): ?>
<span class="chip-count">x<?=$cnt?></span>
<?php endif; ?>
</span>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,136 @@
<?php
include $_SERVER['DOCUMENT_ROOT'].'/include/session_include.php';
$c_uid = intval($_GET['customer_uid'] ?? 0);
$i_type = trim($_GET['i_type'] ?? 'install_order');
$showInactive = intval($_GET['show_inactive'] ?? 0);
if (!$c_uid || !$i_type) {
echo '<div class="text-danger">Invalid request.</div>';
exit;
}
$i_type = mysqli_real_escape_string($jdb->DBConn, $i_type);
// type
$whereType = "";
if (strtoupper($i_type) !== 'ALL') {
$whereType = "AND i.i_type = '{$i_type}'";
}
// status
$statusWhere = "AND i.i_status = 'A'";
if ($showInactive) {
$statusWhere = "AND i.i_status IN ('A','I')";
}
$sql = "
SELECT i.*,
m.m_firstname,
m.m_lastname,
m.m_initial
FROM tbl_customer_image i
LEFT JOIN tbl_member m ON m.m_uid = i.i_createdby
WHERE i.i_customeruid = '{$c_uid}'
{$whereType}
{$statusWhere}
ORDER BY i.i_createddate DESC
";
//
$rlt = mysqli_query($jdb->DBConn, $sql);
if (!$rlt) {
echo '<div class="text-danger">Query error</div>';
exit;
}
// 결과 없을 때 체크
if (mysqli_num_rows($rlt) === 0) {
echo '<div class="text-muted text-center py-4">No images.</div>';
exit;
}
//
$images = [];
$meta = [];
while ($row = mysqli_fetch_assoc($rlt)) {
$files = explode(',', $row['i_filename']);
foreach ($files as $f) {
$f = trim($f);
if (!$f) continue; // 빈값
$images[] = $row['i_filepath'] . $f;
$meta[] = [
'note' => $row['i_note'] ?? '',
'created' => $row['i_createddate'] ?? '',
'by' => trim(($row['m_firstname'] ?? '').' '.($row['m_lastname'] ?? '')),
'type' => $row['i_type'] ?? ''
];
}
}
$total = count($images);
if ($total === 0) {
echo '<div class="text-muted text-center py-4">No images.</div>';
exit;
}
// JSON을 data-attribute로 심기
$imagesJson = htmlspecialchars(json_encode($images), ENT_QUOTES);
$metaJson = htmlspecialchars(json_encode($meta), ENT_QUOTES);
?>
<style>
.customer-image-slider { text-align:center; }
.customer-image-slider img {
max-width:100%;
max-height:60vh;
object-fit:contain;
border-radius:8px;
border:1px solid #ddd;
}
.slider-nav { display:flex; justify-content:space-between; margin-top:10px; }
.slider-nav button { min-width:100px; }
.slider-indicator { text-align:center; margin-top:6px; font-size:13px; color:#666; }
.slider-meta { margin-top:10px; font-size:13px; color:#555; line-height:1.4; }
</style>
<div id="customerImageSlider"
class="customer-image-slider"
data-images="<?=$imagesJson?>"
data-meta="<?=$metaJson?>">
<img id="sliderImage" src="<?=htmlspecialchars($images[0])?>" alt="Image">
<div class="slider-nav">
<button type="button"
id="btnPrevImage"
class="btn btn-outline-secondary btn-sm"
title="Previous">
<i class="bi bi-chevron-left"></i>
</button>
<button type="button"
id="btnNextImage"
class="btn btn-outline-secondary btn-sm"
title="Next">
<i class="bi bi-chevron-right"></i>
</button>
</div>
<div class="slider-indicator">
<span id="sliderIndex">1</span> / <?=$total?>
</div>
<div class="slider-meta" id="sliderMeta">
<b>Type:</b> <?=nl2br(htmlspecialchars($meta[0]['type']))?><br>
<b>Note:</b> <?=nl2br(htmlspecialchars($meta[0]['note']))?><br>
<b>Created:</b> <?=($meta[0]['created'] ? date('Y-m-d H:i', strtotime($meta[0]['created'])) : '')?><br>
<b>By:</b> <?=htmlspecialchars($meta[0]['by'])?>
</div>
</div>

View File

@ -546,15 +546,18 @@ if ($actionStr == "ADDIMAGE") {
if ($fileError != 0) continue;
// 확장자
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$allowedExt = ['jpg', 'jpeg', 'png', 'webp'];
if (!in_array($ext, $allowedExt)) continue;
// 새 파일명 생성
$newFileName = "IMG_".$i_customeruid."_".time().rand(1000,9999)."_".$i.".".$ext;
// 새 파일명 생성 (jpg로 통일)
$newFileName = "IMG_".$i_customeruid."_".time().rand(1000,9999)."_".$i.".jpg";
// 저장 경로
$savePath = $upload_folder . "/" . $newFileName;
if (!move_uploaded_file($fileTmp, $savePath)) {
// 이미지 압축 + 리사이즈 저장
if (!compressAndResizeImage($fileTmp, $savePath, $ext, 1200, 75)) {
continue;
}
@ -698,14 +701,20 @@ if ($actionStr == "UPDATEIMAGEFULL") {
if ($_FILES['upload_file']['error'][$i] != 0) continue;
$ext = pathinfo($_FILES['upload_file']['name'][$i], PATHINFO_EXTENSION);
$newName = "IMG_".$i_customeruid."_".time().rand(1000,9999)."_".$i.".".$ext;
$ext = strtolower(pathinfo($_FILES['upload_file']['name'][$i], PATHINFO_EXTENSION));
$savePath = $upload_folder . $newName;
$allowedExt = ['jpg', 'jpeg', 'png', 'webp'];
if (!in_array($ext, $allowedExt)) continue;
if (move_uploaded_file($_FILES['upload_file']['tmp_name'][$i], $savePath)) {
$newList[] = $newName;
}
// 파일명 jpg로 통일
$newName = "IMG_".$i_customeruid."_".time().rand(1000,9999)."_".$i.".jpg";
$savePath = $upload_folder . $newName;
// 압축 + 리사이즈
if (compressAndResizeImage($_FILES['upload_file']['tmp_name'][$i], $savePath, $ext, 1200, 75)) {
$newList[] = $newName;
}
}
}
@ -1206,6 +1215,60 @@ if ($actionStr == "SIGNATURE") {
exit();
}
function compressAndResizeImage($srcPath, $destPath, $ext, $maxWidth = 1200, $quality = 75) {
list($width, $height, $imageType) = getimagesize($srcPath);
if (!$width || !$height) return false;
switch ($imageType) {
case IMAGETYPE_JPEG:
$srcImg = imagecreatefromjpeg($srcPath);
break;
case IMAGETYPE_PNG:
$srcImg = imagecreatefrompng($srcPath);
break;
case IMAGETYPE_WEBP:
if (!function_exists('imagecreatefromwebp')) return false;
$srcImg = imagecreatefromwebp($srcPath);
break;
default:
return false;
}
if (!$srcImg) return false;
if ($width > $maxWidth) {
$newWidth = $maxWidth;
$newHeight = intval(($height / $width) * $newWidth);
} else {
$newWidth = $width;
$newHeight = $height;
}
$dstImg = imagecreatetruecolor($newWidth, $newHeight);
if ($imageType == IMAGETYPE_PNG || $imageType == IMAGETYPE_WEBP) {
imagealphablending($dstImg, false);
imagesavealpha($dstImg, true);
$transparent = imagecolorallocatealpha($dstImg, 0, 0, 0, 127);
imagefilledrectangle($dstImg, 0, 0, $newWidth, $newHeight, $transparent);
}
imagecopyresampled(
$dstImg, $srcImg,
0, 0, 0, 0,
$newWidth, $newHeight,
$width, $height
);
$result = imagejpeg($dstImg, $destPath, $quality);
imagedestroy($srcImg);
imagedestroy($dstImg);
return $result;
}
$msg = "Invalid data. Please try again.";
$func -> modalMsg ($msg, "/index_intranet.php");