2881 lines
99 KiB
PHP
2881 lines
99 KiB
PHP
<?
|
|
// Level 10 이하만 사용 가능
|
|
$func->checkLevelModal(10);
|
|
|
|
// Delete 기능 제한 (Admin : 1, Staff : 5, Accounting : 6 만 가능)
|
|
$permit = array("1", "5", "6");
|
|
if (in_array($_SESSION['ss_LEVEL'], $permit)) {
|
|
$setTag = "ENABLED";
|
|
}
|
|
else $setTag = "DISABLED";
|
|
|
|
// Admin 만 사용하는 기능을 위해
|
|
$permitAdm = array("1");
|
|
if (in_array($_SESSION['ss_LEVEL'], $permitAdm)) {
|
|
$setTagAdm = "ENABLED";
|
|
}
|
|
else $setTagAdm = "DISABLED";
|
|
|
|
$goStr = "switched=$switched&page=$page&key_word=$key_word&column=$column&sorting_type=$sorting_type&switch=$switch&cstatus=$cstatus";
|
|
|
|
//
|
|
if ($mode == "create" || $mode == "") {
|
|
$btnName = "CREATE";
|
|
$mode = "create";
|
|
$status = "1";
|
|
}
|
|
else if ($mode == "update") {
|
|
$btnName = "UPDATE";
|
|
//$admTag = "DISABLED";
|
|
}
|
|
|
|
// User data query
|
|
if ($mode == "update") {
|
|
|
|
if($c_uid == "") {
|
|
$msg = "Invalid data. Please try again.";
|
|
$func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr");
|
|
exit();
|
|
}
|
|
|
|
$query = "SELECT * FROM tbl_customer WHERE c_uid = '$c_uid'";
|
|
$result = $jdb->fQuery($query, "query error");
|
|
|
|
// No data
|
|
if ($result[0] =="") {
|
|
$msg = "Invalid data. Please try again.";
|
|
$func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr");
|
|
exit();
|
|
}
|
|
|
|
//echo "[$query]";
|
|
for($i=0; $i<sizeof($result); $i++) {
|
|
//list($key, $value) = each($result);
|
|
foreach ( (Array) $result as $key => $value )
|
|
$$key = $value;
|
|
}
|
|
|
|
$c_nameSTR = str_replace("\\", "", $c_name);
|
|
$c_payabletoSTR = str_replace("\\", "", $c_payableto);
|
|
$c_mailingaddrSTR = str_replace("\\", "", $c_mailingaddr);
|
|
$c_containerSTR = str_replace("\\", "", $c_container);
|
|
$c_locationSTR = str_replace("\\", "", $c_location);
|
|
|
|
//echo "<br><br><br><br><br>[".utf8_encode($c_phone)."]";
|
|
$c_phone = str_replace("\\", "", trim($c_phone));
|
|
$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_phoneextSTR = str_replace("\\", "", $c_phoneext);
|
|
|
|
$c_cellSTR = str_replace("\\", "", $c_cell);
|
|
$c_emailSTR = str_replace("\\", "", $c_email);
|
|
$c_addressSTR = str_replace("\\", "", $c_address);
|
|
$c_postalSTR = str_replace("\\", "", $c_postal);
|
|
$c_postalSTR = preg_replace('/[^A-Za-z0-9\-]/', '', $c_postalSTR);
|
|
$c_contractbySTR = str_replace("\\", "", $c_contractby);
|
|
|
|
$c_hstnoSTR = str_replace("\\", "", $c_hstno);
|
|
$c_identcodeSTR = str_replace("\\", "", $c_identcode);
|
|
|
|
$c_comment_riSTR = str_replace("\\", "", $c_comment_ri);
|
|
$c_comment_ciSTR = str_replace("\\", "", $c_comment_ci);
|
|
|
|
$c_form_euSTR = $func -> convertFormat ($c_form_eu, 3);
|
|
$c_form_corsiaSTR = $func -> convertFormat ($c_form_corsia, 3);
|
|
$c_contractdateSTR = $func -> convertFormat ($c_contractdate, 3);
|
|
$c_schedulebasicSTR = $func -> convertFormat ($c_schedulebasic, 3);
|
|
$c_fpickupSTR = $func -> convertFormat ($c_fpickup, 3);
|
|
$c_lastpickupdateSTR = $func -> convertFormat ($c_lastpickupdate, 3);
|
|
|
|
if ($c_inactivedate != "N/A") $c_inactivedateSTR = $func -> convertFormat ($c_inactivedate, 3);
|
|
else $c_inactivedateSTR = "N/A";
|
|
if ($c_inactivedateSTR == "-") $c_inactivedateSTR = str_replace("-", "", $c_inactivedateSTR);
|
|
|
|
if ($c_installdate != "N/A") $c_installdateSTR = $func -> convertFormat ($c_installdate, 3);
|
|
else $c_installdateSTR = "N/A";
|
|
|
|
if ($c_removaldate != "N/A") $c_removaldateSTR = $func -> convertFormat ($c_removaldate, 3);
|
|
else $c_removaldateSTR = "N/A";
|
|
|
|
if ($c_exchangedate != "N/A") $c_exchangedateSTR = $func -> convertFormat ($c_exchangedate, 3);
|
|
else $c_exchangedateSTR = "N/A";
|
|
|
|
//
|
|
function safeDate($val) {
|
|
if (!$val || $val === 'N/A') return null;
|
|
if (!preg_match('/^\d{8}$/', $val)) return null;
|
|
return $val;
|
|
}
|
|
|
|
$dates = [];
|
|
$d1 = safeDate($c_installdate);
|
|
$d2 = safeDate($c_exchangedate);
|
|
$d3 = safeDate($c_removaldate);
|
|
|
|
if ($d1) $dates[] = $d1;
|
|
if ($d2) $dates[] = $d2;
|
|
if ($d3) $dates[] = $d3;
|
|
|
|
$lastWork = !empty($dates) ? max($dates) : null;
|
|
|
|
$lastWorkSTR = $lastWork ? $func->convertFormat($lastWork, 3): 'N/A';
|
|
//
|
|
|
|
if ($c_switchformdate != "N/A") $c_switchformdateSTR = $func -> convertFormat ($c_switchformdate, 3);
|
|
else $c_switchformdateSTR = "N/A";
|
|
|
|
|
|
if (is_numeric($c_salescommissiondate)) $c_salescommissiondateSTR = $func -> convertFormat ($c_salescommissiondate, 7);
|
|
else $c_salescommissiondateSTR = $c_salescommissiondate;
|
|
|
|
|
|
// ===============================
|
|
// Customer Containers
|
|
// ===============================
|
|
$isManualChecked = ($c_manualvolume == 'Y') ? 'checked' : '';
|
|
|
|
$containerList = [];
|
|
|
|
$q2 = "
|
|
SELECT *
|
|
FROM tbl_customer_container
|
|
WHERE cc_customer_uid = '{$c_uid}'
|
|
ORDER BY cc_status, cc_uid DESC
|
|
";
|
|
|
|
$rlt = mysqli_query($jdb->DBConn, $q2);
|
|
|
|
while ($row = mysqli_fetch_array($rlt, MYSQLI_ASSOC)) {
|
|
$containerList[] = $row;
|
|
}
|
|
//
|
|
}
|
|
else {
|
|
$c_salescommissiondateSTR = "NOT YET";
|
|
$c_fullcycle = 0;
|
|
}
|
|
|
|
// Get Status Info
|
|
foreach ($arrStatus AS $key=>$value)
|
|
{
|
|
if ($key == $c_status) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_statusSTR .= "
|
|
<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
|
|
// Get Payment Info
|
|
foreach ($arrPaymenttype AS $key=>$value)
|
|
{
|
|
if ($key == $c_paymenttype) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_paymenttypeSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// Get Bin (Main Container) Info
|
|
foreach ($arrBin AS $key=>$value)
|
|
{
|
|
if ($key == $c_maincontainer) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_maincontainerSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// Get Pickup Schedule
|
|
foreach ($arrSchedule AS $key=>$value)
|
|
{
|
|
if ($key == $c_schedule) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_scheduleSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// Get Driver Info => Region
|
|
$curDR = "";
|
|
$qry_driver = "SELECT * FROM tbl_member WHERE m_level = 9 AND m_region != '' ORDER by m_initial ASC ";
|
|
$rt_driver = $jdb->nQuery($qry_driver, "list error");
|
|
|
|
while($lt_driver=mysqli_fetch_array($rt_driver, MYSQLI_ASSOC)) {
|
|
|
|
if ($lt_driver['m_uid'] == $c_driveruid) {
|
|
$selectStr = "selected";
|
|
$curDR = $lt_driver['m_currentdriver'];
|
|
}
|
|
else $selectStr = "";
|
|
|
|
$c_driveruidSTR .= "<option value='".$lt_driver['m_uid']."' $selectStr>".$lt_driver['m_region']." (".$lt_driver['m_defaultdriverinitial'].")</option>";
|
|
|
|
}
|
|
|
|
// Get Driver Info (Request)
|
|
$qry_dr = "SELECT * FROM tbl_driver WHERE dr_status = 'A' ORDER by dr_initial ASC ";
|
|
$rt_dr = $jdb->nQuery($qry_dr, "list error");
|
|
|
|
while($lt_dr=mysqli_fetch_array($rt_dr, MYSQLI_ASSOC)) {
|
|
|
|
if ($lt_dr['dr_uid'] == $curDR) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_driveruidSTRRQ .= "<option value='".$lt_dr['dr_uid']."' $selectStr>".$lt_dr['dr_initial']."</option>";
|
|
}
|
|
|
|
// Get City Info
|
|
$qry_city = "SELECT * FROM tbl_area WHERE a_status = 'A' ORDER by a_city ASC ";
|
|
$rt_city = $jdb->nQuery($qry_city, "list error");
|
|
|
|
while($lt_city=mysqli_fetch_array($rt_city, MYSQLI_ASSOC)) {
|
|
|
|
if ($lt_city['a_city'] == $c_city) {
|
|
$selectStr = "selected";
|
|
$a_textSTR = $lt_city['a_text'];
|
|
}
|
|
else {
|
|
$selectStr = "";
|
|
}
|
|
|
|
$c_citySTR .= "<option value='".$lt_city['a_city']."' $selectStr>".$lt_city['a_city']."</option>";
|
|
}
|
|
|
|
// get scheduled day info
|
|
$c_scheduledayTMP = explode('|', $c_scheduleday);
|
|
|
|
for ($i=0; $i < count($c_scheduledayTMP); $i++) {
|
|
if ($c_scheduledayTMP[$i] == "MON") $c_scheduledayMON = "checked";
|
|
if ($c_scheduledayTMP[$i] == "TUE") $c_scheduledayTUE = "checked";
|
|
if ($c_scheduledayTMP[$i] == "WED") $c_scheduledayWED = "checked";
|
|
if ($c_scheduledayTMP[$i] == "THU") $c_scheduledayTHU = "checked";
|
|
if ($c_scheduledayTMP[$i] == "FRI") $c_scheduledayFRI = "checked";
|
|
if ($c_scheduledayTMP[$i] == "SAT") $c_scheduledaySAT = "checked";
|
|
}
|
|
|
|
// Get Sale Person
|
|
$qry_sp = "SELECT * FROM tbl_salesperson WHERE s_status = 'A' ORDER by s_name ASC ";
|
|
$rt_sp = $jdb->nQuery($qry_sp, "list error");
|
|
|
|
while($lt_sp=mysqli_fetch_array($rt_sp, MYSQLI_ASSOC)) {
|
|
|
|
if ($lt_sp['s_name'] == $c_salesperson) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_salespersonSTR .= "<option value='".$lt_sp['s_name']."' $selectStr>".$lt_sp['s_name']."</option>";
|
|
|
|
}
|
|
|
|
// Get Form info
|
|
foreach ($arrForm AS $key=>$value)
|
|
{
|
|
if ($key == $c_form_new) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_form_newSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// Get Sales Method info
|
|
foreach ($arrSalesMethod AS $key=>$value)
|
|
{
|
|
if ($key == $c_salesmethod) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_salesmethodSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// Get Form info
|
|
foreach ($arrPaymentCycle AS $key=>$value)
|
|
{
|
|
//echo "[$key][$value]"; => [0][Waiting][1][Confirmed][E][Declined]...
|
|
|
|
if ($key == $c_paymentcycle) $selectStr = "selected";
|
|
else $selectStr = "";
|
|
|
|
$c_paymentcycleSTR .= "<option value='$key' $selectStr>$value</option>";
|
|
}
|
|
|
|
// 오늘 날짜의 오더장이 있는지 확인
|
|
// 있으면 정보를 가져와서 아래 조건 확인, 없는 경우 새로 생성
|
|
$qry_cnt_d = "SELECT COUNT(*) FROM tbl_daily WHERE d_customeruid = '$c_uid' AND d_orderdate = '".date("Ymd")."'";
|
|
$totcnt_d=$jdb->rQuery($qry_cnt_d, "record query error");
|
|
|
|
//
|
|
$pickupButtonHtml = "<button type='button' class='btn-primary text-center btn-width-230' data-bs-toggle='modal' data-bs-target='#input-pickup-modal' data-input-pickup-type='standard-access'>INPUT PICKUP</button>";
|
|
$PICKUPstr = "";
|
|
$add_qry = ($_SESSION['ss_LEVEL'] == 9) ? " AND dr_uid = '".$_SESSION['ss_DRUID']."' " : "";
|
|
|
|
// display 기본값
|
|
$setDisplayNEWStr = " DISPLAY:none; ";
|
|
$setDisplayBTNStr = " DISPLAY:block; ";
|
|
$setDisplaySIGNYESStr = " DISPLAY:none; ";
|
|
$setDisplaySIGNNEWStr = " DISPLAY:inline; ";
|
|
|
|
if ($mode == "update") {
|
|
|
|
if ($totcnt_d == 0) {
|
|
// 신규 pickup 입력 상태
|
|
$PICKUPstr = $pickupButtonHtml;
|
|
|
|
$d_orderdateSTR = date("Y-m-d");
|
|
$d_paymenttype = $c_paymenttype;
|
|
$d_customeruid = $c_uid;
|
|
|
|
} else {
|
|
// 기존 daily 정보 조회
|
|
$query = "SELECT * FROM tbl_daily WHERE d_customeruid = '$c_uid' AND d_orderdate = '".date("Ymd")."'";
|
|
$result = $jdb->fQuery($query, "fetch query error");
|
|
|
|
if (is_array($result)) {
|
|
foreach ($result as $key => $value) {
|
|
$$key = $value;
|
|
}
|
|
}
|
|
|
|
// update 모드 강제
|
|
$d_mode = "update";
|
|
$d_orderdateSTR = $func->convertFormat($d_orderdate, 3);
|
|
|
|
// pickup 버튼 노출 조건
|
|
$canInputPickup = (
|
|
($d_orderdate == date("Ymd") && $d_status != "F")
|
|
|| $_SESSION['ss_LEVEL'] == "1"
|
|
);
|
|
|
|
if ($canInputPickup) {
|
|
$PICKUPstr = $pickupButtonHtml;
|
|
}
|
|
|
|
// signature 처리
|
|
$d_payeenameSTR = str_replace("\\", "", $d_payeename);
|
|
$folderPath = getenv("DOCUMENT_ROOT")."/upload_sign/".$d_customeruid;
|
|
$signFilePath = $folderPath."/".trim($d_payeesign);
|
|
|
|
if (is_file($signFilePath)) {
|
|
$d_payeesignSTR = "<img style='border:1px solid;' src='/upload_sign/".$d_customeruid."/".$d_payeesign."'>";
|
|
|
|
$setDisplayNEWStr = " DISPLAY:inline; ";
|
|
$setDisplayBTNStr = " DISPLAY:none; ";
|
|
$setDisplaySIGNYESStr = " DISPLAY:inline; ";
|
|
$setDisplaySIGNNEWStr = " DISPLAY:none; ";
|
|
}
|
|
|
|
// note 조회
|
|
$qry_note = "SELECT * FROM tbl_note WHERE n_dailyuid = '$d_uid'";
|
|
$rt_note = $jdb->fQuery($qry_note, "fetch query error");
|
|
$n_noteSTRM = str_replace("\\", "", $rt_note['n_note']);
|
|
}
|
|
}
|
|
|
|
// Level 7, 8 은 pickup 버튼 숨김
|
|
if ($_SESSION['ss_LEVEL'] == 7 || $_SESSION['ss_LEVEL'] == 8) {
|
|
$PICKUPstr = "";
|
|
}
|
|
|
|
if ($mode == "update") {
|
|
// 현재 고객의 드라이버 정보
|
|
$qry_rg = "SELECT * FROM tbl_member WHERE m_uid = ".$c_driveruid;
|
|
$rt_rg = $jdb->fQuery($qry_rg, "list error");
|
|
|
|
// 활성 드라이버 목록
|
|
$qry_driver = "SELECT * FROM tbl_driver WHERE dr_uid >= 1 AND dr_status = 'A' $add_qry ORDER BY dr_initial ASC";
|
|
$rt_driver = $jdb->nQuery($qry_driver, "list error");
|
|
|
|
$c_driveruidSTRM = "";
|
|
|
|
while ($lt_driver = mysqli_fetch_array($rt_driver, MYSQLI_ASSOC)) {
|
|
$selected = "";
|
|
|
|
// 기본 선택값: member 의 current driver
|
|
if ($lt_driver['dr_uid'] == $rt_rg['m_currentdriver']) {
|
|
$selected = "selected";
|
|
}
|
|
|
|
// update 상태면 daily 의 d_druid 가 우선
|
|
if ($d_mode == "update") {
|
|
$selected = ($lt_driver['dr_uid'] == $d_druid) ? "selected" : "";
|
|
}
|
|
|
|
$c_driveruidSTRM .= "<option value='".$lt_driver['dr_uid']."' $selected>".$lt_driver['dr_initial']."</option>";
|
|
}
|
|
}
|
|
|
|
addLog ("add", "CUSTOMER DETAIL", "VIEW", $lguserid, $query, $c_uid);
|
|
|
|
?>
|
|
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
|
|
$(function () {
|
|
$('#c_contractdate, #c_form_eu, #c_form_corsia, #c_fpickup, #c_removaldate, #c_installdate, #c_exchangedate, #d_visitdate, #c_inactivedate, #c_switchformdate').datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
buttonImage: "/images/cal_red.png",
|
|
buttonImageOnly: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
firstDay: 7
|
|
});
|
|
$('#c_salescommissiondate').datepicker({
|
|
dateFormat: 'yy-mm',
|
|
buttonImage: "/images/cal_red.png",
|
|
buttonImageOnly: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
firstDay: 7
|
|
});
|
|
|
|
var array = [];
|
|
|
|
$('#r_requestdate').datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
minDate: "0D",
|
|
buttonImage: "/images/cal_red.png",
|
|
buttonImageOnly: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
firstDay: 7,
|
|
beforeShowDay: function(date) {
|
|
// Specific Date
|
|
if($.inArray($.datepicker.formatDate('yy-mm-dd', date ), array) > -1) return [false,"","Not available"];
|
|
else return [true,'',"Available"];
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#containerModal').on('shown.bs.modal', function () {
|
|
|
|
const $inputs = $('#cm_install_date, #cm_pickup_date');
|
|
|
|
$inputs.each(function(){
|
|
if ($(this).hasClass('hasDatepicker')) {
|
|
$(this).datepicker('destroy');
|
|
}
|
|
});
|
|
|
|
$inputs.datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
firstDay: 7,
|
|
beforeShow: function(input, inst) {
|
|
setTimeout(function(){
|
|
const rect = input.getBoundingClientRect();
|
|
|
|
inst.dpDiv.css({
|
|
position: 'fixed', //
|
|
top: rect.bottom + 'px', // viewport 기준
|
|
left: rect.left + 'px',
|
|
zIndex: 2147483647
|
|
});
|
|
}, 0);
|
|
}
|
|
});
|
|
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
<? if ($setTag == "DISABLED") { ?>
|
|
$(document).ready(function() {
|
|
|
|
$('#customer-button-id').prop('disabled', true);
|
|
$("#customer-button-id").css({'color': '#ffffff', 'background-color' : '#a5a5a5'});
|
|
|
|
});
|
|
<? } ?>
|
|
|
|
$(document).ready(function(){
|
|
|
|
// Decimal (ex 11, 11.0)
|
|
$("#c_rate, #d_quantity, #d_payamount, #c_mainvolume, #c_fullcycle, #c_fullcycleforced").on("input", function(evt) {
|
|
var self = $(this);
|
|
self.val(self.val().replace(/[^0-9\.]/g, ''));
|
|
if ((evt.which != 46 || self.val().indexOf('.') != -1) && (evt.which < 48 || evt.which > 57))
|
|
{
|
|
evt.preventDefault();
|
|
}
|
|
});
|
|
|
|
// Number Only (ex 1, 1000 not 10.1)
|
|
$('#c_expoilmonth').keyup(function(e)
|
|
{
|
|
if (/\D/g.test(this.value))
|
|
{
|
|
// Filter non-digits from input value.
|
|
this.value = this.value.replace(/\D/g, '');
|
|
}
|
|
});
|
|
|
|
// 알파벳 + 숫자 만 입력 가능. 6자리 제한.(maxlength="6") 소문자 입력시 자동 대문자로 변환
|
|
$('#c_postal').keyup(function (e) {
|
|
|
|
$(this).val($(this).val().toUpperCase());
|
|
var regex = new RegExp("^[a-zA-Z0-9]+$");
|
|
var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
|
|
|
|
if (regex.test(str)) {
|
|
return true;
|
|
}
|
|
e.preventDefault();
|
|
return false;
|
|
|
|
});
|
|
|
|
// 숫자만 입력가능 xxx-xxx-xxxx 형식으로 자동 - 삽입
|
|
$('#c_phone').on('input', function() {
|
|
var number = $(this).val().replace(/[^\d]/g, '')
|
|
if (number.length == 7) {
|
|
number = number.replace(/(\d{3})(\d{4})/, "$1-$2");
|
|
} else if (number.length == 10) {
|
|
number = number.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3");
|
|
}
|
|
$(this).val(number);
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<SCRIPT>
|
|
// xmlhttp RUN script
|
|
function xmlhttpPost(strURL, param, tagID) {
|
|
|
|
var xmlHttpReq = false;
|
|
var self = this;
|
|
|
|
// Mozilla/Safari
|
|
if (window.XMLHttpRequest) {
|
|
self.xmlHttpReq = new XMLHttpRequest();
|
|
}
|
|
|
|
// IE
|
|
else if (window.ActiveXObject) {
|
|
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
|
|
self.xmlHttpReq.open('POST', strURL, true);
|
|
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
self.xmlHttpReq.onreadystatechange = function() {
|
|
if (self.xmlHttpReq.readyState == 4) {
|
|
updatepage(self.xmlHttpReq.responseText, tagID);
|
|
}
|
|
}
|
|
self.xmlHttpReq.send(getquerystring(param));
|
|
}
|
|
|
|
function getquerystring(param) {
|
|
qstr = 's=' + escape(param); // NOTE: no '?' before querystring
|
|
return qstr;
|
|
}
|
|
|
|
function updatepage(str, tagID){
|
|
document.getElementById(tagID).innerHTML = str;
|
|
}
|
|
|
|
function checkAccountNo() {
|
|
var str = document.getElementById('c_accountno').value;
|
|
//alert(str);
|
|
|
|
str = str.toUpperCase();
|
|
|
|
if (str=="") {
|
|
//document.getElementById("PPMUNITPRICEid").value="";
|
|
//return;
|
|
}
|
|
|
|
if (window.XMLHttpRequest) {
|
|
// code for IE7+, Firefox, Chrome, Opera, Safari
|
|
xmlhttp=new XMLHttpRequest();
|
|
} else { // code for IE6, IE5
|
|
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
xmlhttp.onreadystatechange=function() {
|
|
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
|
|
var rt = xmlhttp.responseText;
|
|
|
|
if (rt.trim() >= 1) {
|
|
document.getElementById('accountNoValidateid').value = 0;
|
|
$('#myModal').find('.modal-body').text('This Account # is already in use. Please enter a different Account #.');
|
|
$('#myModal').modal('show');
|
|
$('#myModal').on('hidden.bs.modal', function () {
|
|
document.getElementById('c_accountno').value = "";
|
|
document.getElementById('c_accountno').focus();
|
|
});
|
|
|
|
return false;
|
|
}
|
|
else {
|
|
document.getElementById('accountNoValidateid').value = 1;
|
|
document.getElementById('c_accountno').value = str;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
xmlhttp.open("GET","/lib/checkaccountnolib.php?s="+str,true);
|
|
xmlhttp.send();
|
|
}
|
|
|
|
</SCRIPT>
|
|
|
|
<SCRIPT language=javascript>
|
|
$(document).ready(function() {
|
|
//set initial state.
|
|
$('#na').val($(this).is(':checked'));
|
|
|
|
$('#na').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_installdate').value = "N/A";
|
|
}
|
|
else {
|
|
document.getElementById('c_installdate').value = "";
|
|
}
|
|
|
|
$('#na').val($(this).is(':checked'));
|
|
});
|
|
|
|
//set initial state.
|
|
$('#rdna').val($(this).is(':checked'));
|
|
|
|
$('#rdna').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_removaldate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_removaldate').value = "";
|
|
}
|
|
|
|
$('#rdna').val($(this).is(':checked'));
|
|
});
|
|
|
|
//set initial state.
|
|
$('#iana').val($(this).is(':checked'));
|
|
|
|
$('#iana').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_inactivedate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_inactivedate').value = "";
|
|
}
|
|
|
|
$('#iana').val($(this).is(':checked'));
|
|
});
|
|
|
|
//set initial state.
|
|
$('#cena').val($(this).is(':checked'));
|
|
|
|
$('#cena').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_exchangedate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_exchangedate').value = "";
|
|
}
|
|
|
|
$('#cena').val($(this).is(':checked'));
|
|
});
|
|
|
|
|
|
//set initial state.
|
|
$('#fpna').val($(this).is(':checked'));
|
|
|
|
$('#fpna').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_fpickup').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_fpickup').value = "";
|
|
}
|
|
|
|
$('#fpna').val($(this).is(':checked'));
|
|
});
|
|
|
|
$('#sfna').val($(this).is(':checked'));
|
|
|
|
$('#sfna').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_switchformdate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_switchformdate').value = "";
|
|
}
|
|
|
|
$('#sfna').val($(this).is(':checked'));
|
|
});
|
|
|
|
$('#inna').val($(this).is(':checked'));
|
|
|
|
$('#inna').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_installdate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_installdate').value = "";
|
|
}
|
|
|
|
$('#inna').val($(this).is(':checked'));
|
|
});
|
|
|
|
$('#rena').val($(this).is(':checked'));
|
|
|
|
$('#rena').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_removaldate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_removaldate').value = "";
|
|
}
|
|
|
|
$('#rena').val($(this).is(':checked'));
|
|
});
|
|
|
|
$('#exna').val($(this).is(':checked'));
|
|
|
|
$('#exna').change(function() {
|
|
if($(this).is(":checked")) {
|
|
$(this).attr("checked", 1);
|
|
document.getElementById('c_exchangedate').value = "";
|
|
}
|
|
else {
|
|
document.getElementById('c_exchangedate').value = "";
|
|
}
|
|
|
|
$('#exna').val($(this).is(':checked'));
|
|
});
|
|
});
|
|
</SCRIPT>
|
|
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
$("#customerinfo").validate({
|
|
// Specify validation rules
|
|
ignore: ".ignore",
|
|
rules: {
|
|
c_accountno: {
|
|
required: true,
|
|
},
|
|
c_status: {
|
|
required: true,
|
|
},
|
|
c_inactivedate: {
|
|
required: function(elem) {
|
|
if ($("#c_status").val() == 'I') { return true; }
|
|
else { return false; }
|
|
},
|
|
},
|
|
c_name: {
|
|
required: true,
|
|
},
|
|
c_driveruid: {
|
|
required: true,
|
|
},
|
|
c_phone: {
|
|
required: true,
|
|
minlength: 10,
|
|
maxlength: 12,
|
|
},
|
|
},
|
|
messages: {
|
|
|
|
c_accountno: {
|
|
required: "Please input Account No",
|
|
},
|
|
c_status: {
|
|
required: "Please select Status",
|
|
},
|
|
c_inactivedate: {
|
|
required: "Please Input Inactive Date",
|
|
},
|
|
c_name: {
|
|
required: "Please input Restaurant name",
|
|
},
|
|
c_driveruid: {
|
|
required: "Please select Driver",
|
|
},
|
|
c_phone: {
|
|
required: "Please enter phone number (Number Only)",
|
|
minlength: "Phone number field accept only 10-15 digits",
|
|
maxlength: "Phone number field accept only 10-15 digits",
|
|
},
|
|
},
|
|
|
|
errorElement : 'div',
|
|
});
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
$("#addrequest").validate({
|
|
// Specify validation rules
|
|
ignore: ".ignore",
|
|
rules: {
|
|
r_requestdate: {
|
|
required: true,
|
|
},
|
|
r_driveruid: {
|
|
required: true,
|
|
},
|
|
},
|
|
messages: {
|
|
|
|
c_accountno: {
|
|
required: "Please input request date",
|
|
},
|
|
r_driveruid: {
|
|
required: "Please select driver",
|
|
},
|
|
},
|
|
|
|
errorElement : 'div',
|
|
});
|
|
|
|
|
|
});
|
|
</script>
|
|
<!-- Container Script -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function(){
|
|
|
|
let mode = 'ADD';
|
|
const modalEl = document.getElementById('containerModal');
|
|
const modal = new bootstrap.Modal(modalEl);
|
|
const c_uid = "<?=$c_uid?>";
|
|
|
|
function resetModal(){
|
|
document.getElementById('cm_cc_uid').value = '';
|
|
const typeEl = document.getElementById('cm_type');
|
|
typeEl.readOnly = false;
|
|
typeEl.disabled = false;
|
|
typeEl.value = '';
|
|
document.getElementById('cm_capacity').value = '';
|
|
const installDateEl = document.getElementById('cm_install_date');
|
|
installDateEl.disabled = false;
|
|
installDateEl.value = '';
|
|
const installNoteEl = document.getElementById('cm_install_note')
|
|
installNoteEl.readOnly = false;
|
|
installNoteEl.value = '';
|
|
document.getElementById('cm_pickup_date').value = '';
|
|
document.getElementById('cm_pickup_note').value = '';
|
|
document.querySelectorAll('.cm-opt').forEach(b=>{
|
|
b.classList.remove('active');
|
|
b.readOnly = false;
|
|
});
|
|
document.getElementById('cm_pickup_date_block').classList.add('d-none');
|
|
document.getElementById('cm_pickup_note_block').classList.add('d-none');
|
|
document.getElementById('cm_pickup_btn').classList.add('d-none');
|
|
document.getElementById('cm_save_btn').classList.remove('d-none');;
|
|
document.querySelectorAll('.cm-opt').forEach(b => b.disabled = false);
|
|
}
|
|
|
|
// 🔹 Add
|
|
const addBtn = document.getElementById('addContainer');
|
|
if(addBtn){
|
|
addBtn.onclick = function(){
|
|
mode = 'ADD';
|
|
resetModal();
|
|
document.getElementById('containerModalTitle').innerText = 'Add Container';
|
|
modal.show();
|
|
};
|
|
}
|
|
|
|
// 🔹 Edit
|
|
document.querySelectorAll('.btn-edit-install-wait').forEach(btn => {
|
|
btn.addEventListener('click', function (e) {
|
|
e.preventDefault();
|
|
|
|
mode = 'EDIT';
|
|
resetModal();
|
|
document.getElementById('cm_pickup_date_block').classList.add('d-none');
|
|
document.getElementById('cm_pickup_note_block').classList.add('d-none');
|
|
|
|
const cc_uid = e.currentTarget.getAttribute('data-cc-uid');
|
|
document.getElementById('cm_cc_uid').value = cc_uid;
|
|
|
|
document.getElementById('containerModalTitle').innerText = 'Edit Container';
|
|
modal.show();
|
|
|
|
fetchData(cc_uid);
|
|
});
|
|
});
|
|
|
|
// 🔹 Delete (Deactivate)
|
|
document.querySelectorAll('.btn-delete-install-wait').forEach(btn=>{
|
|
btn.addEventListener('click', function(e){
|
|
e.preventDefault();
|
|
mode = 'PICKUP';
|
|
resetModal();
|
|
|
|
const cc_uid = e.currentTarget.getAttribute('data-cc-uid');
|
|
document.getElementById('cm_cc_uid').value = cc_uid;
|
|
|
|
fetchData(cc_uid);
|
|
|
|
document.getElementById('containerModalTitle').innerText = 'Deactivate Container';
|
|
document.getElementById('cm_pickup_date_block').classList.remove('d-none');
|
|
document.getElementById('cm_pickup_note_block').classList.remove('d-none');
|
|
document.getElementById('cm_pickup_btn').classList.remove('d-none');
|
|
document.getElementById('cm_save_btn').classList.add('d-none');
|
|
|
|
modal.show();
|
|
});
|
|
});
|
|
|
|
// 🔹 옵션 토글
|
|
document.querySelectorAll('.cm-opt').forEach(btn=>{
|
|
btn.addEventListener('click', function(){
|
|
this.classList.toggle('active');
|
|
});
|
|
});
|
|
|
|
// 🔹 Save
|
|
document.getElementById('cm_save_btn').onclick = function(e){
|
|
e.preventDefault();
|
|
const payload = {
|
|
mode: mode,
|
|
cc_uid: document.getElementById('cm_cc_uid').value,
|
|
c_uid: c_uid,
|
|
type: document.getElementById('cm_type').value,
|
|
capacity: document.getElementById('cm_capacity').value,
|
|
is_used: document.querySelector('[data-opt="used"]').classList.contains('active') ? 'Y':'N',
|
|
has_lock: document.querySelector('[data-opt="lock"]').classList.contains('active') ? 'Y':'N',
|
|
has_wheel: document.querySelector('[data-opt="wheel"]').classList.contains('active') ? 'Y':'N',
|
|
has_frame: document.querySelector('[data-opt="frame"]').classList.contains('active') ? 'Y':'N',
|
|
owner_type: document.querySelector('[data-opt="owner"]').classList.contains('active') ? 'O':'C',
|
|
install_date: document.getElementById('cm_install_date').value,
|
|
pickup_date: document.getElementById('cm_pickup_date').value,
|
|
install_note: document.getElementById('cm_install_note').value,
|
|
pickup_note: document.getElementById('cm_pickup_note').value
|
|
};
|
|
api('customer_container_save', payload, function(res){
|
|
if(res.ok){
|
|
modal.hide();
|
|
location.reload();
|
|
}else{
|
|
alert('Error saving container');
|
|
}
|
|
});
|
|
};
|
|
|
|
document.getElementById('cm_pickup_btn').onclick = function(e){
|
|
e.preventDefault();
|
|
|
|
const payload = {
|
|
mode: 'PICKUP',
|
|
cc_uid: document.getElementById('cm_cc_uid').value,
|
|
c_uid: c_uid,
|
|
pickup_date: document.getElementById('cm_pickup_date').value,
|
|
pickup_note: document.getElementById('cm_pickup_note').value
|
|
};
|
|
|
|
api('customer_container_save', payload, function(res){
|
|
if(res.ok){
|
|
modal.hide();
|
|
location.reload();
|
|
}else{
|
|
alert('Error deactivating container');
|
|
}
|
|
});
|
|
};
|
|
|
|
function fetchData(cc_uid) {
|
|
api('get_customer_container_one', { cc_uid }, function (res) {
|
|
if (!res || !res.ok || !res.row) return;
|
|
const c = res.row;
|
|
const typeEl = document.getElementById('cm_type');
|
|
const capEl = document.getElementById('cm_capacity');
|
|
const installDateEl = document.getElementById('cm_install_date');
|
|
const pickupDateEl = document.getElementById('cm_pickup_date');
|
|
const installNoteEl = document.getElementById('cm_install_note');
|
|
const pickupNoteEl = document.getElementById('cm_pickup_note');
|
|
const pickupDateBlock = document.getElementById('cm_pickup_date_block');
|
|
const pickupNoteBlock = document.getElementById('cm_pickup_note_block');
|
|
const isActive = (c.cc_status === 'A');
|
|
|
|
// ===== 기본 값 세팅 =====
|
|
typeEl.value = c.cc_type || '';
|
|
capEl.value = c.cc_capacity || '';
|
|
installDateEl.value = c.cc_install_date ? String(c.cc_install_date).substring(0,10) : '';
|
|
pickupDateEl.value = c.cc_pickup_date ? String(c.cc_pickup_date).substring(0,10) : '';
|
|
installNoteEl.value = c.cc_install_note || '';
|
|
pickupNoteEl.value = c.cc_pickup_note || '';
|
|
|
|
// 옵션 초기화 후 세팅
|
|
document.querySelectorAll('.cm-opt').forEach(b=>{
|
|
b.classList.remove('active');
|
|
b.disabled = false;
|
|
});
|
|
|
|
if (c.cc_is_used === 'Y') document.querySelector('.cm-opt[data-opt="used"]').classList.add('active');
|
|
if (c.cc_has_lock === 'Y') document.querySelector('.cm-opt[data-opt="lock"]').classList.add('active');
|
|
if (c.cc_has_wheel === 'Y') document.querySelector('.cm-opt[data-opt="wheel"]').classList.add('active');
|
|
if (c.cc_has_woodframe === 'Y') document.querySelector('.cm-opt[data-opt="frame"]').classList.add('active');
|
|
if (c.cc_owner_type === 'O') document.querySelector('.cm-opt[data-opt="owner"]').classList.add('active');
|
|
|
|
// ===== 모드/상태 분기 =====
|
|
typeEl.disabled = false;
|
|
capEl.readOnly = false;
|
|
installDateEl.disabled = false;
|
|
installDateEl.readOnly = false;
|
|
installNoteEl.readOnly = false;
|
|
pickupDateEl.readOnly = true;
|
|
pickupNoteEl.readOnly = true;
|
|
pickupDateBlock.classList.add('d-none');
|
|
pickupNoteBlock.classList.add('d-none');
|
|
|
|
// ---- EDIT ----
|
|
if (mode === 'EDIT') {
|
|
typeEl.disabled = true;
|
|
if ((c.cc_type || '').toUpperCase() !== 'CB') {
|
|
capEl.readOnly = true;
|
|
}
|
|
if (isActive) {
|
|
// Active → install만 수정 가능
|
|
pickupDateBlock.classList.add('d-none');
|
|
pickupNoteBlock.classList.add('d-none');
|
|
} else {
|
|
// Inactive → remove만 수정 가능
|
|
capEl.readOnly = true;
|
|
installDateEl.disabled = true;
|
|
installNoteEl.readOnly = true;
|
|
|
|
document.querySelectorAll('.cm-opt').forEach(b => b.disabled = true);
|
|
|
|
pickupDateBlock.classList.remove('d-none');
|
|
pickupNoteBlock.classList.remove('d-none');
|
|
|
|
pickupDateEl.readOnly = false;
|
|
pickupNoteEl.readOnly = false;
|
|
}
|
|
}
|
|
|
|
// ---- REMOVE ----
|
|
if (mode === 'PICKUP') {
|
|
|
|
typeEl.disabled = true;
|
|
capEl.readOnly = true;
|
|
installDateEl.disabled = true;
|
|
installNoteEl.readOnly = true;
|
|
|
|
document.querySelectorAll('.cm-opt').forEach(b => b.disabled = true);
|
|
|
|
pickupDateBlock.classList.remove('d-none');
|
|
pickupNoteBlock.classList.remove('d-none');
|
|
|
|
pickupDateEl.readOnly = false;
|
|
pickupNoteEl.readOnly = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
let showInactive = false;
|
|
$(document).on('change', '#showInactive', function () {
|
|
const isChecked = $(this).is(':checked');
|
|
showInactive = isChecked;
|
|
document.querySelectorAll('.container-card').forEach(card => {
|
|
if (card.dataset.status !== 'A') {
|
|
card.style.display = isChecked ? 'block' : 'none';
|
|
}
|
|
});
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const usedBtn = document.getElementById('iwSelectUsed');
|
|
const optBtns = document.querySelectorAll('.iw-opt');
|
|
|
|
if (usedBtn) {
|
|
usedBtn.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
this.classList.toggle('active');
|
|
});
|
|
}
|
|
|
|
optBtns.forEach(btn => {
|
|
btn.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
this.classList.toggle('active');
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const typeSel = document.getElementById('cm_type');
|
|
const capInp = document.getElementById('cm_capacity');
|
|
|
|
if (!typeSel || !capInp) return;
|
|
|
|
typeSel.addEventListener('change', function() {
|
|
|
|
const val = this.value;
|
|
|
|
if (val === 'CB') {
|
|
capInp.readOnly = false;
|
|
capInp.value = '';
|
|
capInp.focus();
|
|
return;
|
|
}
|
|
|
|
capInp.readOnly = true;
|
|
|
|
if (val === 'D') {
|
|
capInp.value = '200';
|
|
return;
|
|
}
|
|
|
|
const m = val.match(/^(\d+)/);
|
|
capInp.value = m ? m[1] : '';
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript" src="/assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script type="text/javascript" src="/assets/js/jquery.signature.min.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/assets/css/jquery.signature.css">
|
|
|
|
|
|
<style>
|
|
.kbw-signature { width: 340px; height: 120px;}
|
|
#sig canvas{
|
|
/*width: 100% !important;*/
|
|
width: 100%;
|
|
height: auto;
|
|
border-bottom: 1px solid #BCBBBB;
|
|
}
|
|
|
|
.btn-clear{
|
|
color: #fff;
|
|
background: #BCBBBB;
|
|
|
|
border-radius: 5px;
|
|
border: 1px solid #BCBBBB;
|
|
float:right;
|
|
}
|
|
|
|
/* Map > Input > Sludge */
|
|
.number-input {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
}
|
|
|
|
.number-input input {
|
|
width: 100%;
|
|
text-align: center;
|
|
}
|
|
|
|
.number-input button {
|
|
padding: 5px 10px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* 기본 화살표 제거 */
|
|
.d_sludge::-webkit-inner-spin-button,
|
|
.d_sludge::-webkit-outer-spin-button {
|
|
-webkit-appearance: none;
|
|
margin: 0;
|
|
}
|
|
.d_sludge {
|
|
-moz-appearance: textfield;
|
|
}
|
|
|
|
.left, .right {
|
|
background: none;
|
|
border: none;
|
|
color: #77B469;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
margin: 0;
|
|
appearance: none;
|
|
box-shadow: none;
|
|
outline: none;
|
|
}
|
|
</style>
|
|
|
|
|
|
|
|
<SCRIPT language=javascript>
|
|
|
|
$(document).ready(function()
|
|
{
|
|
$('#signednew').change(function()
|
|
{
|
|
if(this.checked != true)
|
|
{
|
|
document.getElementById("signitureedid").style.display="inline";
|
|
document.getElementById("signitureid").style.display="none";
|
|
document.getElementById("clrbtnid").style.display="none";
|
|
}
|
|
else {
|
|
document.getElementById("signitureedid").style.display="none";
|
|
document.getElementById("signitureid").style.display="inline";
|
|
document.getElementById("clrbtnid").style.display="inline";
|
|
}
|
|
});
|
|
});
|
|
|
|
</SCRIPT>
|
|
|
|
|
|
<style>
|
|
.error{
|
|
color: red;
|
|
font-weight: 200;
|
|
padding:-1em;
|
|
}
|
|
</style>
|
|
|
|
|
|
<? include getenv("DOCUMENT_ROOT")."/include/message_js.php"; ?>
|
|
|
|
|
|
<main id="main" class="main">
|
|
|
|
<!-- ======= Breadcrumbs ======= -->
|
|
<div class="breadcrumbs">
|
|
<div class="container">
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<h2>CUSTOMER</h2>
|
|
<ol>
|
|
<li><a href="index.html">HOME</a></li>
|
|
<li>CUSTOMER</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<? if ($mode == "update") { ?>
|
|
<div class="wrap-border">
|
|
<table class=" col-float-right">
|
|
<tr>
|
|
<td>
|
|
<? if ($setTag == "ENABLED") { ?>
|
|
<button type="button" id="request-button-id" class="btn-blue-sub btn-width-200" data-bs-toggle="modal" data-bs-target="#request-modal" data-request-type="standard-access"> REQUEST </button>
|
|
<? } ?>
|
|
</td>
|
|
<td>
|
|
<?=$PICKUPstr?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</div><!--wrap-border-->
|
|
<? } ?>
|
|
|
|
</div><!--container Ends-->
|
|
</div><!-- Breadcrumbs Ends-->
|
|
<FORM NAME=customerinfo id=customerinfo METHOD=POST ACTION=/doc/customer_process.php >
|
|
|
|
<input type=hidden name=mode value="<?=$mode?>">
|
|
<input type=hidden name=actionStr value="CUSTOMERINFO">
|
|
<input type=hidden name=c_uid value="<?=$c_uid?>">
|
|
<input type=hidden name=c_forceddate value="<?=$c_forceddate?>">
|
|
<input type=hidden name=directurl value="index_intranet.php">
|
|
<input type=hidden name=accountNoValidate id='accountNoValidateid' value="">
|
|
|
|
<input type=hidden name=switched value="<?=$switched?>">
|
|
<input type=hidden name=page value="<?=$page?>">
|
|
<input type=hidden name=key_word value="<?=$key_word?>">
|
|
<input type=hidden name=column value="<?=$column?>">
|
|
<input type=hidden name=sorting_type value="<?=$sorting_type?>">
|
|
<input type=hidden name=switch value="<?=$switch?>">
|
|
<input type=hidden name=cstatus value="<?=$cstatus?>">
|
|
|
|
<section class="page">
|
|
|
|
|
|
<div class="container customer-info" data-aos="fade-up">
|
|
|
|
<div class="wrap-border">
|
|
<div class="h3-title-section">
|
|
<h3><span style="color:var(--color-primary);">Restaurant</span> Information</h3>
|
|
</div>
|
|
<table class="tb-info-box">
|
|
<tr>
|
|
<td class="td-title-info">Account No</td>
|
|
<td class="td-text-info">
|
|
<?php if($mode == "update"): ?> <!-- erp 연동키값(c_accountno)을 전달하기위해 hidden 을 추가하고 admTag 사용안함 -->
|
|
<input class="accountNo" type="text" id="c_accountno" name="c_accountno" required='required' onBlur="checkAccountNo();" VALUE="<?=$c_accountno?>" disabled>
|
|
<input type="hidden" name="c_accountno" value="<?=$c_accountno?>">
|
|
<?php else: ?>
|
|
<input class="accountNo" type="text" id="c_accountno" name="c_accountno" required='required' onBlur="checkAccountNo();" VALUE="<?=$c_accountno?>">
|
|
<?php endif; ?>
|
|
</td>
|
|
|
|
<td class="td-title-info">Status</td>
|
|
<td class="td-text-info">
|
|
<select name="c_status" id="c_status" required='required' class="custom-select">
|
|
<option value=''>Select</option>
|
|
<?=$c_statusSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Restaurant Name</td>
|
|
<td class="td-text-info">
|
|
<input class="restaurantName" type="text" id="c_name" name="c_name" required='required' value="<?=htmlspecialchars($c_nameSTR, ENT_QUOTES)?>" placeholder="Green Oil Inc">
|
|
</td>
|
|
|
|
<td class="td-title-info">Inactive Date <div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="iana" name="iana" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_inactivedate" name="c_inactivedate" value="<?=$c_inactivedateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Address</td>
|
|
<td class="td-text-info">
|
|
<input class="address" type="text" id="c_address" name="c_address" required='required' value="<?=htmlspecialchars($c_addressSTR, ENT_QUOTES)?>" placeholder="4490 Chesswood Dr Unit #9">
|
|
</td>
|
|
|
|
<td class="td-title-info">Region (Default Driver)</td>
|
|
<td class="td-text-info">
|
|
<select name="c_driveruid" id="c_driveruid" class="custom-select">
|
|
<option value=''>Select</option>
|
|
<?=$c_driveruidSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">City</td>
|
|
<td class="td-text-info">
|
|
<select name="c_city" id="c_city" class="custom-select" required='required' >
|
|
<option value=''>Select</option>
|
|
<?=$c_citySTR?>
|
|
</select>
|
|
</td>
|
|
|
|
<td class="td-title-info">Rate</td>
|
|
<td class="td-text-info">
|
|
<input class="rate" type="text" id="c_rate" name="c_rate" required='required' value="<?=$c_rate?>" placeholder="0.150" maxlength="6">
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
<td class="td-title-info">Postal Code</td>
|
|
<td class="td-text-info">
|
|
<input class="postalCode" type="text" id="c_postal" name="c_postal" value="<?=htmlspecialchars($c_postalSTR, ENT_QUOTES)?>" placeholder="M3J2B9" required='required' maxlength="6">
|
|
</td>
|
|
|
|
<td class="td-title-info">Payment</td>
|
|
<td class="td-text-info">
|
|
<select name="c_paymenttype" id="c_paymenttype" class="custom-select" required='required' >
|
|
<option value=''>Select</option>
|
|
<?=$c_paymenttypeSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Phone</td>
|
|
<td class="td-text-info">
|
|
<input class="phone" type="text" id="c_phone" name="c_phone" placeholder="416-777-8888" value="<?=htmlspecialchars($c_phoneSTR, ENT_QUOTES)?>" required='required' maxlength="12">
|
|
</td>
|
|
|
|
<td class="td-title-info">Area</td>
|
|
<td class="td-text-info">
|
|
<input class="area" type="text" id="a_text" name="a_text" value="<?=$a_textSTR?>" disabled>
|
|
</td>
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Cell</td>
|
|
<td class="td-text-info">
|
|
<input class="cell" type="text" id="c_cell" name="c_cell" placeholder="416-777-8888" value="<?=htmlspecialchars($c_cellSTR, ENT_QUOTES)?>">
|
|
</td>
|
|
|
|
<td class="td-title-info">Ext</td>
|
|
<td class="td-text-info">
|
|
<input class="cell" type="text" id="c_phoneext" name="c_phoneext" placeholder="1234" value="<?=htmlspecialchars($c_phoneextSTR, ENT_QUOTES)?>">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Cycle</td>
|
|
<td class="td-text-info">
|
|
<input class="cycle" type="text" id="c_fullcycle" name="c_fullcycle" placeholder="365" value="<?=$c_fullcycle?>" maxlength="6">
|
|
</td>
|
|
|
|
<td class="td-title-info">Container Location</td>
|
|
<td class="td-text-info">
|
|
<input class="containerLocation" type="text" id="c_location" name="c_location" value="<?=htmlspecialchars($c_locationSTR, ENT_QUOTES)?>" placeholder="beside of back door">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Forced Cycle</td>
|
|
<td class="td-text-info">
|
|
<input class="cycle" type="text" id="c_fullcycleforced" name="c_fullcycleforced" style='color:red;' placeholder="365" value="<?=$c_fullcycleforced?>" maxlength="6">
|
|
</td>
|
|
|
|
<td class="td-title-info">Pickup Schedule</td>
|
|
<td class="td-text-info">
|
|
<select name="c_schedule" id="c_schedule" class="custom-select" required='required'>
|
|
<option value=''>Select</option>
|
|
<?=$c_scheduleSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Expected Oil Volume Per Month</td>
|
|
<td class="td-text-info">
|
|
<input class="cycle" type="text" id="c_expoilmonth" name="c_expoilmonth" placeholder="100" value="<?=$c_expoilmonth?>" maxlength="7">
|
|
</td>
|
|
|
|
<td class="td-title-info">Pickup Weekday</td>
|
|
<td class="td-text-info">
|
|
|
|
<label class="container-chk">MON
|
|
<input type="checkbox" id="c_scheduleday_mon" name="c_scheduleday[]" value="MON" <?=$c_scheduledayMON?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
<label class="container-chk">TUE
|
|
<input type="checkbox" id="c_scheduleday_tue" name="c_scheduleday[]" value="TUE" <?=$c_scheduledayTUE?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
<label class="container-chk">WED
|
|
<input type="checkbox" id="c_scheduleday_wed" name="c_scheduleday[]" value="WED" <?=$c_scheduledayWED?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
<label class="container-chk">THU
|
|
<input type="checkbox" id="c_scheduleday_thu" name="c_scheduleday[]" value="THU" <?=$c_scheduledayTHU?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
<label class="container-chk">FRI
|
|
<input type="checkbox" id="c_scheduleday_fri" name="c_scheduleday[]" value="FRI" <?=$c_scheduledayFRI?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
<label class="container-chk">SAT
|
|
<input type="checkbox" id="c_scheduleday_sat" name="c_scheduleday[]" value="SAT" <?=$c_scheduledaySAT?>>
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">First Pickup<div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="fpna" name="fpna" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_fpickup" name="c_fpickup" value="<?=$c_fpickupSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Last Pickup</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_lastpickupdate" name="c_lastpickupdate" value="<?=$c_lastpickupdateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Comment</td>
|
|
<td class="td-text-info" colspan="3">
|
|
<input class="comment_ri" type="text" id="c_comment_ri" name="c_comment_ri" value="<?=htmlspecialchars($c_comment_riSTR, ENT_QUOTES)?>" placeholder="">
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div><!--wrap-border-->
|
|
|
|
<div class="btn-box">
|
|
<button type="submit" id="customer-button-id1" class="btn-save text-center" href="#">SAVE</button>
|
|
</div><!--btn-box Ends-->
|
|
|
|
</div><!--Container Ends-->
|
|
<!--Restaurant Information Ends-->
|
|
|
|
</section>
|
|
|
|
<section class="page">
|
|
<!--Container Information-->
|
|
<div class="container customer-info" data-aos="fade-up">
|
|
|
|
<div class="wrap-border">
|
|
<div class="h3-title-section">
|
|
<h3><span style="color:var(--color-primary);">Container</span> Information</h3>
|
|
</div>
|
|
<table class="tb-info-box">
|
|
<tr>
|
|
<td class="td-title-info">Main Container</td>
|
|
<td class="td-text-info">
|
|
<select name="c_maincontainer" id="c_maincontainer" class="custom-select">
|
|
<option value=''>Select</option>
|
|
<?=$c_maincontainerSTR?>
|
|
</select>
|
|
</td>
|
|
|
|
<td class="td-title-info">Main Volume
|
|
<div style="display: inline; float:right; padding-right: 30px;">Manual <input type="checkbox" id="isManual" name="isManual" value="1" title="If checked, this will not be automatically updated after INSTALL work" <?=$isManualChecked?>></div>
|
|
</td>
|
|
<td class="td-text-info">
|
|
<input class="cycle" type="text" id="c_mainvolume" name="c_mainvolume" placeholder="365" value="<?=$c_mainvolume?>" maxlength="4">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">First Install Date<div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="inna" name="inna" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_installdate" name="c_installdate" value="<?=$c_installdateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Removal Date<div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="rena" name="rena" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_removaldate" name="c_removaldate" value="<?=$c_removaldateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">Last Container Work Date<div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="exna" name="exna" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_exchangedate" name="c_exchangedate" value="<?=$c_exchangedateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-text-info" colspan="2">
|
|
<div class="btn-box">
|
|
<button type="submit" id="customer-button-id2" class="btn-save text-center" href="#">SAVE</button>
|
|
</div><!--btn-box Ends-->
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info"><span style="margin-right:10px;">Container</span><div style="display: inline; float:right; padding-right: 30px;">Show Inactive <input type="checkbox" id="showInactive" name="showInactive" value="1"></div>
|
|
<td class="td-text-info" colspan="3">
|
|
<!-- ==============================
|
|
Container Modal (Add / Edit / Remove)
|
|
================================== -->
|
|
<div class="modal fade" id="containerModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="containerModalTitle">Container</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
|
|
<div class="modal-body m-3">
|
|
|
|
<input type="hidden" id="cm_cc_uid">
|
|
|
|
<div class="mb-2">
|
|
<label>Type</label>
|
|
<select id="cm_type" class="form-select form-select-sm">
|
|
<option value=''>Select</option>
|
|
<?=$c_maincontainerSTR?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-2">
|
|
<label>Capacity (L)</label>
|
|
<input type="number" id="cm_capacity" class="form-control form-control-sm">
|
|
</div>
|
|
|
|
<div class="mb-4 d-flex gap-2">
|
|
<label>Options</label>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cm-opt" data-opt="used">Used</button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cm-opt" data-opt="lock"><i class="bi bi-lock-fill"></i></button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cm-opt" data-opt="wheel"><i class="bi bi-gear-fill"></i></button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cm-opt" data-opt="frame"><i class="bi bi-bounding-box-circles"></i></button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cm-opt" data-opt="owner">Owner</button>
|
|
</div>
|
|
|
|
<div class="mb-2">
|
|
<label>Install Date</label>
|
|
<input type="text" id="cm_install_date" name="cm_install_date" value="" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</div>
|
|
|
|
<div class="mb-2">
|
|
<label>Install Note</label>
|
|
<textarea id="cm_install_note" class="form-control form-control-sm"></textarea>
|
|
</div>
|
|
|
|
<div class="mb-2 d-none" id="cm_pickup_date_block">
|
|
<label>Pickup Date</label>
|
|
<input type="text" id="cm_pickup_date" name="cm_pickup_date" value="" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</div>
|
|
|
|
<div class="mb-2" id="cm_pickup_note_block">
|
|
<label>Pickup Note</label>
|
|
<textarea id="cm_pickup_note" class="form-control form-control-sm"></textarea>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button class="btn btn-danger d-none" id="cm_pickup_btn">Deactivate</button>
|
|
<button class="btn btn-primary" id="cm_save_btn">Save</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- ==============================
|
|
Container Modal End
|
|
================================== -->
|
|
|
|
<div style="margin-top:10px; margin-bottom:10px;">
|
|
<div class="d-flex gap-2 align-items-center flex-grow-1">
|
|
<button type="button" id="addContainer" class="btn btn-sm btn-success ms-2 iw-add-btn"><i class="bi bi-plus-lg"></i><span class="ms-1">Add</span></button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="containerCardWrap">
|
|
|
|
<?php if (empty($containerList)): ?>
|
|
<div style="color:#888;">No containers found.</div>
|
|
<?php else: ?>
|
|
|
|
<?php
|
|
function getContainerIcon($type) {
|
|
$type = strtoupper(trim($type));
|
|
if (strpos($type, 'D') !== false) {
|
|
return 'bi-database-fill';
|
|
} elseif (strpos($type, 'B') !== false && strpos($type, 'BUCKET') === false) {
|
|
return 'bi-archive-fill';
|
|
} else {
|
|
return 'bi-box2';
|
|
}
|
|
}
|
|
?>
|
|
|
|
<?php foreach ($containerList as $cc):
|
|
$isActive = ($cc['cc_status'] == 'A');
|
|
$installDate = !empty($cc['cc_install_at']) ? date('Y-m-d', strtotime($cc['cc_install_at'])) : '';
|
|
$installNote = $cc['cc_install_note'];
|
|
$pickupDate = !empty($cc['cc_pickup_at']) ? date('Y-m-d', strtotime($cc['cc_pickup_at'])) : '';
|
|
$pickupNote = $cc['cc_pickup_note'];
|
|
$capacity = $cc['cc_capacity'];
|
|
$icon = getContainerIcon($cc['cc_type']);
|
|
?>
|
|
|
|
<div class="container-card <?= $isActive ? 'active' : 'inactive' ?>" data-status="<?= $cc['cc_status'] ?>" style="<?= $isActive ? '' : 'display:none;' ?>">
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
|
|
<div class="container-chips flex-grow-1">
|
|
|
|
<?php
|
|
$isRestaurantOwned = ($cc['cc_owner_type'] === 'O');
|
|
$chipClass = $isRestaurantOwned ? 'chip chip-restaurant' : 'chip chip-company';
|
|
?>
|
|
|
|
<span class="<?= $chipClass ?>">
|
|
|
|
<i class="bi <?= $icon ?>"></i>
|
|
|
|
<?php if ($cc['cc_is_used'] == 'Y'): ?>
|
|
<span>Used</span>
|
|
<?php endif; ?>
|
|
|
|
<?= htmlspecialchars($cc['cc_type']) ?>
|
|
|
|
<?php if ($cc['cc_has_lock'] == 'Y'): ?>
|
|
<i class="bi bi-lock-fill"></i>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($cc['cc_has_wheel'] == 'Y'): ?>
|
|
<i class="bi bi-gear-fill"></i>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($cc['cc_has_woodframe'] == 'Y'): ?>
|
|
<i class="bi bi-bounding-box-circles"></i>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($isRestaurantOwned): ?>
|
|
<span class="chip-flag">O</span>
|
|
<?php endif; ?>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="gap-2">
|
|
<?php if ($isActive): ?>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary btn-edit-install-wait" data-cc-uid="<?=$cc['cc_uid']?>" title="Edit">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary btn-delete-install-wait" data-cc-uid="<?=$cc['cc_uid']?>" title="Delete">
|
|
<i class="bi bi-trash"></i>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php if (!$isActive): ?>
|
|
<span style="color:red;">Inactive</span>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary btn-edit-install-wait" data-cc-uid="<?=$cc['cc_uid']?>" title="Edit">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 하단 정보 -->
|
|
<div class="text-muted small mt-2">
|
|
<strong>Capacity:</strong> <?= $capacity ?>
|
|
</div>
|
|
|
|
<div class="text-muted small mt-2">
|
|
<strong>Installed:</strong> (<?= $cc['cc_install_date'] ?>)
|
|
<?php if (!empty($cc['cc_install_note'])): ?>
|
|
<?= htmlspecialchars($cc['cc_install_note']) ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if (!$isActive): ?>
|
|
<div class="text-muted small mt-1">
|
|
<strong>Picked Up:</strong> (<?= $cc['cc_pickup_date'] ?>)
|
|
<?php if (!empty($cc['cc_pickup_note'])): ?>
|
|
<?= htmlspecialchars($cc['cc_pickup_note']) ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div><!--wrap-border-->
|
|
</div>
|
|
<!--Container Information Ends-->
|
|
|
|
</section>
|
|
|
|
<section class="page">
|
|
|
|
|
|
<div class="container customer-info" data-aos="fade-up">
|
|
|
|
<div class="wrap-border">
|
|
<div class="h3-title-section">
|
|
<h3><span style="color:var(--color-primary);">Contact</span> Information</h3>
|
|
</div>
|
|
<table class="tb-info-box">
|
|
<tr>
|
|
<td class="td-title-info">Contract Date</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_contractdate" name="c_contractdate" value="<?=$c_contractdateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Sales Person</td>
|
|
<td class="td-text-info">
|
|
<select name="c_salesperson" id="c_salesperson" class="custom-select" required='required'>
|
|
<option value="">Select</option>
|
|
<?=$c_salespersonSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Form</td>
|
|
<td class="td-text-info">
|
|
<select name="c_form_new" id="c_form_new" class="custom-select">
|
|
<?=$c_form_newSTR?>
|
|
</select>
|
|
</td>
|
|
|
|
<td class="td-title-info">Sales Method</td>
|
|
<td class="td-text-info">
|
|
<select name="c_salesmethod" id="c_salesmethod" class="custom-select">
|
|
<?=$c_salesmethodSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">US</td>
|
|
<td class="td-text-info">
|
|
<select name="c_form_us" id="c_form_us" class="custom-select">
|
|
<option value="Y" <?=($c_form_us == "Y")?"selected":"";?>>Yes</option>
|
|
<option value="N" <?=($c_form_us == "N")?"selected":"";?>>No</option>
|
|
<option value="R" <?=($c_form_us == "R")?"selected":"";?>>Yes(R)</option>
|
|
</select>
|
|
</td>
|
|
|
|
<td class="td-title-info">Sale Commission Date</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_salescommissiondate" name="c_salescommissiondate" value="<?=$c_salescommissiondateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">EU Date</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_form_eu" name="c_form_eu" value="<?=$c_form_euSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Payable To</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_payableto" name="c_payableto" value="<?=htmlspecialchars($c_payabletoSTR, ENT_QUOTES)?>" placeholder="Green Oil Inc.">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">CORSIA Date</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_form_corsia" name="c_form_corsia" value="<?=$c_form_corsiaSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Payment Cycle</td>
|
|
<td class="td-text-info">
|
|
<select name="c_paymentcycle" id="c_paymentcycle" class="custom-select">
|
|
<option value="">Select</option>
|
|
<?=$c_paymentcycleSTR?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Switch Form Date <div style="display: inline; float:right; padding-right: 30px;">Init <input type="checkbox" id="sfna" name="sfna" value="1"></div></td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_switchformdate" name="c_switchformdate" value="<?=$c_switchformdateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly>
|
|
</td>
|
|
|
|
<td class="td-title-info">Mailing Address</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_mailingaddr" name="c_mailingaddr" value="<?=htmlspecialchars($c_mailingaddrSTR, ENT_QUOTES)?>" placeholder="4490 Chesswood Dr Unit #9, North York, ON M3J2B9">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Contact By</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_contractby" name="c_contractby" value="<?=$c_contractby?>" >
|
|
</td>
|
|
|
|
<td class="td-title-info">HST No</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_hstno" name="c_hstno" value="<?=htmlspecialchars($c_hstnoSTR, ENT_QUOTES)?>" placeholder="R121345678">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Email</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="c_email" name="c_email" value="<?=$c_emailSTR?>" placeholder="company@company.com">
|
|
</td>
|
|
|
|
<td class="td-title-info">Identification Code</td>
|
|
<td class="td-text-info">
|
|
<input class="c_identcode" type="text" id="c_identcode" name="c_identcode" value="<?=htmlspecialchars($c_identcodeSTR, ENT_QUOTES)?>" placeholder="">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Comment</td>
|
|
<td class="td-text-info" colspan="3">
|
|
<input class="comment_ci" type="text" id="c_comment_ci" name="c_comment_ci" value="<?=htmlspecialchars($c_comment_ciSTR, ENT_QUOTES)?>" placeholder="">
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
</div><!--wrap-border-->
|
|
|
|
<div class="btn-box">
|
|
<button type="submit" id="customer-button-id3" class="btn-save text-center" href="#">SAVE</button>
|
|
</div><!--btn-box Ends-->
|
|
|
|
</div>
|
|
<!--Contact Information Ends-->
|
|
|
|
</section>
|
|
|
|
</FORM>
|
|
|
|
|
|
|
|
|
|
<?
|
|
|
|
if ($_SESSION['ss_LEVEL'] == "1" || $_SESSION['ss_LEVEL'] == "5" || $_SESSION['ss_LEVEL'] == "6" || $_SESSION['ss_LEVEL'] == "7" ) {
|
|
$add_query = " ORDER BY n_uid DESC";
|
|
}
|
|
else if ($_SESSION['ss_LEVEL'] == "9" && $_SESSION['ss_UID'] == $c_driveruid) {
|
|
$add_query = " AND n_memberuid = '".$_SESSION['ss_UID']."' ORDER BY n_uid DESC";
|
|
}
|
|
else {
|
|
$msg = "Invalid User Level. Please try again.";
|
|
$func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr");
|
|
exit();
|
|
}
|
|
|
|
//total record
|
|
$query = "SELECT COUNT(n_uid) FROM tbl_note WHERE n_uid <> '' AND n_status != 'D' AND n_customeruid = '$c_uid' " . $add_query;
|
|
$total_count=$jdb->rQuery($query, "record query error");
|
|
//echo "[$total_count][$query]<br>";
|
|
|
|
//페이징변수설정
|
|
if(!$pageqna) $pageqna = 1;
|
|
if ($pageflag != "note") $pageqna = 1;
|
|
if(!$list_count) $list_count = $INIT_PAGECNT_NOTE; //출력리스트 갯수
|
|
if(!$page_count) $page_count = $INIT_PAGEVIEWCNT; //출력페이지 갯수
|
|
$list_number = $total_count - (($pageqna-1)*$list_count);
|
|
$start_number = $list_count * ($pageqna-1);
|
|
|
|
$add_query .= " LIMIT $start_number, $INIT_PAGECNT_NOTE";
|
|
$query_note = "SELECT * FROM tbl_note
|
|
where n_uid <> '' AND n_status != 'D' AND n_customeruid = '$c_uid' " . $add_query;
|
|
|
|
$result_note=$jdb->nQuery($query_note, "list error");
|
|
|
|
while($list_note=mysqli_fetch_array($result_note, MYSQLI_ASSOC)) {
|
|
for($i=0; $i<sizeof($list_note); $i++) {
|
|
//list($key, $value) = each($list_note);
|
|
foreach ( (Array) $list_note as $key => $value )
|
|
$$key = $value;
|
|
}
|
|
|
|
$n_noteSTR = str_replace("\\", "", $n_note);
|
|
$n_createddateSTR = $func -> convertFormat ($n_createddate, 1);
|
|
|
|
$qry_writer = "SELECT m_firstname, m_lastname FROM tbl_member WHERE m_uid = '$n_memberuid' ";
|
|
$rt_writer = $jdb->fQuery($qry_writer, "fetch query error");
|
|
|
|
if ($setTagAdm == "ENABLED") {
|
|
$OPTIONstr = "<a class=\"deleteClass btn-member\" data-toggle=\"modal\" data-target=\"#myModalDelete\" data-id=\"$n_uid\"><i class=\"bi bi-x-circle icon-delete\"></i></a>";
|
|
//$OPTIONTITLEstr = "OPTION";
|
|
}
|
|
else {
|
|
$OPTIONstr = "";
|
|
//$OPTIONTITLEstr = "";
|
|
}
|
|
|
|
$strList .= "
|
|
<tr>
|
|
<td class=\"td-text-info\">$list_number</td>
|
|
<td class=\"td-text-info\">$n_createddateSTR</td>
|
|
<td class=\"td-text-info\">".$rt_writer['m_firstname']." ".$rt_writer['m_lastname']."</td>
|
|
<td class=\"td-text-info\">$n_noteSTR</td>
|
|
<td class=\"td-text-info\" align=center>$OPTIONstr</td>
|
|
</tr>
|
|
";
|
|
|
|
$list_number--;
|
|
}
|
|
|
|
if( $total_count < 1 ) {
|
|
$strList = "<tr><td colspan='5' align=center height='30'><B>No Data</B></td></tr>";
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<SCRIPT TYPE="TEXT/JAVASCRIPT">
|
|
$(function () {
|
|
$(".deleteClass").click(function () {
|
|
var my_id_value = $(this).data('id');
|
|
$(".modal-footer #n_uid").val(my_id_value);
|
|
})
|
|
});
|
|
</SCRIPT>
|
|
|
|
<section class="page">
|
|
<div class="container customer-info" data-aos="fade-up">
|
|
<div class="wrap-border">
|
|
<div class="h3-title-section" style="display:flex; justify-content:space-between; align-items:center;">
|
|
<h3><span style="color:var(--color-primary);">Note</span></h3>
|
|
<? if ($mode == "update" && $_SESSION['ss_LEVEL'] != 7) { ?>
|
|
<div class="btn-box">
|
|
<button type="button" class="btn-save text-center" data-bs-toggle="modal" data-bs-target="#add-note-modal" data-add-note-type="standard-access">ADD</button>
|
|
</div>
|
|
<? } ?>
|
|
</div>
|
|
|
|
<p style="clear: both;"></p>
|
|
|
|
<table class="tb-info-box-note">
|
|
<tr>
|
|
<td class="td-title-info td-num" width="5%">No </td>
|
|
<td class="td-title-info td-date-note">Date </td>
|
|
<td class="td-title-info td-creator-note">Creator </td>
|
|
<td class="td-title-info td-note">Note </td>
|
|
<td class="td-title-info td-opt">Option </td>
|
|
</tr>
|
|
|
|
<?=$strList?>
|
|
</table>
|
|
</div><!--wrap-border-->
|
|
|
|
<div class="container-inner">
|
|
<div class="pagination">
|
|
<?
|
|
$page_string = "view=$view&c_uid=$c_uid&pageflag=note&key_word=$key_word&key_CTGSEQ=$key_CTGSEQ&column=$column&mode=$mode&switched=$getSWHStr&cstatus=$cstatus";
|
|
$paging = new PAGE('pageqna',$total_count,$list_count,$page_count,$pageqna,$page_string,'#c71930','','','#c71930','');
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="page">
|
|
<div class="container customer-info" data-aos="fade-up">
|
|
<div class="wrap-border">
|
|
<div class="h3-title-section" style="display:flex; justify-content:space-between; align-items:center;">
|
|
<h3><span style="color:var(--color-primary);">Image</span></h3>
|
|
<div class="btn-box">
|
|
<button type="button" class="btn-save text-center" onclick="imagepopup();">ADD</button>
|
|
</div>
|
|
</div>
|
|
|
|
<p style="clear: both;"></p>
|
|
<?php
|
|
// 이미지 가져오기
|
|
$qry_img = "
|
|
SELECT *
|
|
FROM tbl_customer_image tci
|
|
LEFT OUTER JOIN tbl_member tm ON tci.i_createdby = tm.m_uid
|
|
WHERE tci.i_customeruid = '$c_uid'
|
|
AND tci.i_status = 'A'
|
|
ORDER BY tci.i_uid DESC
|
|
";
|
|
$rt_img = $jdb->nQuery($qry_img, "image list error");
|
|
|
|
function getImageTypeLabel($type) {
|
|
switch ($type) {
|
|
case 'install':
|
|
return 'Install Image';
|
|
case 'install_order':
|
|
return 'Container Request Image';
|
|
case 'clean_before':
|
|
return 'Before Clean';
|
|
case 'clean_after':
|
|
return 'After Clean';
|
|
default:
|
|
return ucfirst(str_replace('_', ' ', $type));
|
|
}
|
|
}
|
|
|
|
if (mysqli_num_rows($rt_img) == 0) {
|
|
echo "<p>No images found.</p>";
|
|
} else {
|
|
echo '<div style="display:flex; flex-wrap:wrap; gap:16px;">';
|
|
|
|
while ($img = mysqli_fetch_array($rt_img, MYSQLI_ASSOC)) {
|
|
|
|
echo '<div style="
|
|
width:220px;
|
|
border:1px solid #ddd;
|
|
border-radius:8px;
|
|
padding:10px;
|
|
background:#fafafa;
|
|
position:relative;
|
|
">';
|
|
|
|
echo '
|
|
<button
|
|
class="btn btn-sm btn-danger btn-delete-image"
|
|
data-uid="'.htmlspecialchars($img['i_uid']).'"
|
|
style="
|
|
position:absolute;
|
|
top:6px;
|
|
right:6px;
|
|
padding:2px 6px;
|
|
font-size:11px;
|
|
"
|
|
title="Delete image"
|
|
>
|
|
<i class="bi bi-x"></i>
|
|
</button>
|
|
';
|
|
|
|
// 이미지 영역 (위)
|
|
echo '<div style="display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px;">';
|
|
|
|
$files = explode(",", $img['i_filename']);
|
|
foreach ($files as $f) {
|
|
$f = trim($f);
|
|
if (!$f) continue;
|
|
|
|
$imgPath = $img['i_filepath'] . $f;
|
|
|
|
echo '<img
|
|
src="'.htmlspecialchars($imgPath).'"
|
|
class="preview-img"
|
|
data-img="'.htmlspecialchars($imgPath).'"
|
|
style="
|
|
width:100px;
|
|
height:80px;
|
|
object-fit:cover;
|
|
border-radius:5px;
|
|
cursor:pointer;
|
|
border:1px solid #ccc;
|
|
"
|
|
>';
|
|
}
|
|
echo '</div>';
|
|
|
|
// 설명 영역 (아래)
|
|
echo '<div style="font-size:12px; line-height:1.4;">';
|
|
echo '
|
|
<div style="margin-bottom:5px;">
|
|
<span class="badge bg-secondary" style="font-size:11px;">
|
|
'.htmlspecialchars(getImageTypeLabel($img['i_type'])).'
|
|
</span>
|
|
</div>
|
|
|
|
<div><b>Note:</b> '.nl2br(htmlspecialchars($img['i_note'])).'</div>
|
|
<div><b>Created:</b> '.date("Y-m-d H:i", strtotime($img['i_createddate'])).'</div>
|
|
<div><b>By:</b> '
|
|
. htmlspecialchars($img['m_firstname'] ?? '')
|
|
. ' '
|
|
. htmlspecialchars($img['m_lastname'] ?? '')
|
|
.'</div>
|
|
';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>'; // card end
|
|
}
|
|
|
|
echo '</div>'; // wrapper end
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<div class="row text-center">
|
|
<div class="col-sm-4 item-inner">
|
|
<a class="btn-sub text-center" href="/index_intranet.php?view=customer_list&<?=$goStr?>">LIST</a>
|
|
</div>
|
|
</div>
|
|
|
|
</main><!-- End #main -->
|
|
|
|
<!-- Image Popup Modal -->
|
|
<div id="imagePreviewModal" class="modal fade">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">Image Detail</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body" style="text-align:center;">
|
|
|
|
<img id="previewLargeImg" src="" style="width:100%; max-height:80vh; object-fit:contain;">
|
|
|
|
<br><br>
|
|
|
|
<form id="deleteImageForm" method="POST" action="/lib/user_process.php">
|
|
<input type="hidden" name="actionStr" value="DELETEIMAGE">
|
|
<input type="hidden" name="i_uid" id="delete_i_uid">
|
|
<input type="hidden" name="i_customeruid" id="delete_i_customeruid" value="<?=$c_uid?>">
|
|
<input type="hidden" name="fileName" id="delete_fileName">
|
|
<input type="hidden" name="goStr" value="<?=$goStr?>">
|
|
</form>
|
|
|
|
<button id="btnDeleteImage" class="btn btn-danger" style="padding:8px 20px; font-size:16px;">DELETE</button>
|
|
|
|
<input type="hidden" id="currentImageUid">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Delete Confirm Modal -->
|
|
<div id="deleteConfirmModal" class="modal fade">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">Confirm Delete</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close">
|
|
<i class="bi bi-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
<p>Are you sure you want to delete this image?</p>
|
|
</div>
|
|
|
|
<div class="modal-footer text-center grid-layout-col-2" style="border: none;">
|
|
<button type="button" id="confirmDeleteBtn" class="btn-sub btn-danger">Delete</button>
|
|
<button type="button" class="btn-gray" data-bs-dismiss="modal">Cancel</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- CONTAINER EDIT IMAGE MODAL -->
|
|
<div class="modal fade" id="editModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">Edit Image</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;">
|
|
<i class="bi bi-x"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form method="post" action="/lib/user_process.php" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" name="actionStr" value="UPDATEIMAGEFULL">
|
|
<input type="hidden" name="i_uid" id="edit_i_uid">
|
|
<input type="hidden" name="i_customeruid" id="edit_c_uid">
|
|
<input type="hidden" name="i_type" id="edit_i_type">
|
|
<input type="hidden" name="goStr" value="<?=$goStr?>">
|
|
|
|
<!-- 기존 이미지 목록 -->
|
|
<div id="edit_image_list" style="margin-top:15px;"></div>
|
|
|
|
<!-- 새 이미지 업로드 -->
|
|
<label style="display:block; margin-top:15px;"><b>Upload New Images</b></label>
|
|
<input type="file" name="upload_file[]" multiple accept="image/*">
|
|
|
|
<!-- Note 수정 -->
|
|
<label style="display:block; margin-top:15px;"><b>Note</b></label>
|
|
<textarea id="edit_i_note" name="i_note" style="width:100%; height:80px;"></textarea>
|
|
|
|
<div class="text-center grid-layout-col-2" style="margin-top:20px;">
|
|
<button type="submit" class="btn-sub">Save Changes</button>
|
|
<button type="button" class="btn-gray" data-bs-dismiss="modal">Close</button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const typeSelect = document.querySelector("select[name='i_type']");
|
|
const fileInput = document.getElementById("uploadFileInput");
|
|
if (!typeSelect || !fileInput) return;
|
|
const previewImg = document.getElementById("imgPreview");
|
|
const previewContainer = document.getElementById("previewContainer");
|
|
|
|
// ---- 타입 변경 시 multiple 적용 ----
|
|
typeSelect.addEventListener("change", function () {
|
|
if (this.value === "container") {
|
|
fileInput.setAttribute("multiple", "multiple");
|
|
} else {
|
|
fileInput.removeAttribute("multiple");
|
|
}
|
|
|
|
// 타입 바뀌면 기존 프리뷰 초기화
|
|
previewImg.style.display = "none";
|
|
previewContainer.innerHTML = "";
|
|
});
|
|
|
|
// ---- 이미지 미리보기 ----
|
|
fileInput.addEventListener("change", function () {
|
|
|
|
previewContainer.innerHTML = ""; // 초기화
|
|
|
|
// INSTALL: 한 개만
|
|
if (fileInput.files.length === 1) {
|
|
const file = fileInput.files[0];
|
|
const reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
const img = document.createElement("img");
|
|
img.src = e.target.result;
|
|
img.style.width = "150px";
|
|
img.style.border = "1px solid #ccc";
|
|
img.style.padding = "3px";
|
|
previewContainer.appendChild(img);
|
|
};
|
|
|
|
reader.readAsDataURL(file);
|
|
} else {
|
|
// CONTAINER: 여러개 출력
|
|
Array.from(fileInput.files).forEach(file => {
|
|
const reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
const img = document.createElement("img");
|
|
img.src = e.target.result;
|
|
img.style.width = "120px";
|
|
img.style.marginRight = "8px";
|
|
img.style.marginBottom = "8px";
|
|
img.style.border = "1px solid #ccc";
|
|
img.style.padding = "3px";
|
|
previewContainer.appendChild(img);
|
|
};
|
|
|
|
reader.readAsDataURL(file);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
// Image add form 전체 초기화
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const modalEl = document.getElementById("image-upload-modal");
|
|
if (!modalEl) return;
|
|
|
|
modalEl.addEventListener("hidden.bs.modal", function () {
|
|
document.getElementById("uploadImageForm").reset();
|
|
const previewContainer = document.getElementById("previewContainer");
|
|
|
|
if (previewContainer) {
|
|
previewContainer.innerHTML = "";
|
|
}
|
|
|
|
const fileInput = document.getElementById("uploadFileInput");
|
|
if (fileInput) {
|
|
fileInput.value = "";
|
|
}
|
|
|
|
const typeSelect = document.querySelector("select[name='i_type']");
|
|
if (typeSelect) {
|
|
typeSelect.value = "install";
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
// Image popup
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
const images = document.querySelectorAll(".preview-img");
|
|
const modal = new bootstrap.Modal(document.getElementById("imagePreviewModal"));
|
|
const largeImg = document.getElementById("previewLargeImg");
|
|
|
|
images.forEach(img => {
|
|
img.addEventListener("click", function () {
|
|
largeImg.src = this.dataset.img;
|
|
|
|
document.getElementById("currentImageUid").value = this.dataset.uid;
|
|
document.getElementById("delete_i_customeruid").value = this.dataset.customeruid;
|
|
document.getElementById("delete_fileName").value = this.dataset.filename;
|
|
|
|
const deleteBtn = document.getElementById("btnDeleteImage");
|
|
if (this.dataset.type == "install") {
|
|
deleteBtn.style.display = "inline-block";
|
|
} else {
|
|
deleteBtn.style.display = "none";
|
|
}
|
|
|
|
modal.show();
|
|
});
|
|
});
|
|
});
|
|
|
|
// Delete image
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const modalEl = document.getElementById("deleteConfirmModal");
|
|
if (!modalEl) return;
|
|
|
|
const confirmModalObj = new bootstrap.Modal(modalEl);
|
|
|
|
// 삭제 버튼 클릭
|
|
document.addEventListener("click", function (e) {
|
|
const btn = e.target.closest(".btn-delete-image");
|
|
if (!btn) return;
|
|
|
|
const uid = btn.dataset.uid;
|
|
if (!uid) return;
|
|
|
|
// 현재 선택된 이미지 UID 저장
|
|
const uidInput = document.getElementById("currentImageUid");
|
|
if (uidInput) {
|
|
uidInput.value = uid;
|
|
}
|
|
|
|
confirmModalObj.show();
|
|
});
|
|
|
|
// confirm 버튼 클릭
|
|
const confirmBtn = document.getElementById("confirmDeleteBtn");
|
|
if (confirmBtn) {
|
|
confirmBtn.addEventListener("click", function () {
|
|
|
|
const uid = document.getElementById("currentImageUid")?.value;
|
|
if (!uid) return;
|
|
|
|
const formInput = document.getElementById("delete_i_uid");
|
|
if (formInput) {
|
|
formInput.value = uid;
|
|
}
|
|
|
|
const form = document.getElementById("deleteImageForm");
|
|
if (form) {
|
|
form.submit();
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
function openEditModal(uid, note, customeruid, filesString, filepath, type) {
|
|
|
|
document.getElementById("edit_i_uid").value = uid;
|
|
document.getElementById("edit_c_uid").value = customeruid;
|
|
document.getElementById("edit_i_note").value = note;
|
|
document.getElementById("edit_i_type").value = type;
|
|
|
|
const files = filesString.split(",");
|
|
let html = "<b>Existing Images</b><div>";
|
|
|
|
files.forEach(f => {
|
|
let fullPath = filepath + f.trim();
|
|
html += `
|
|
<div style='margin-top:10px; display:flex; align-items:center; gap:10px;'>
|
|
<img src="${fullPath}" style="width:80px; height:70px; object-fit:cover; border:1px solid #ccc; border-radius:5px;">
|
|
<label><input type="checkbox" name="delete_files[]" value="${f.trim()}"> Delete</label>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
html += "</div>";
|
|
document.getElementById("edit_image_list").innerHTML = html;
|
|
|
|
let modal = new bootstrap.Modal(document.getElementById('editModal'));
|
|
modal.show();
|
|
}
|
|
|
|
function closeEditModal() {
|
|
let modalEl = document.getElementById('editModal');
|
|
let modal = bootstrap.Modal.getInstance(modalEl);
|
|
modal.hide();
|
|
}
|
|
|
|
function imagepopup() {
|
|
const url = `/lib/customer_image_upload_popup.php?c_uid=<?=$c_uid?>&goStr=<?=$goStr?>`;
|
|
window.open(url, "uploadImage", "width=600,height=750,scrollbars=yes");
|
|
}
|
|
</script>
|
|
|
|
<!-- Modal delete Form -->
|
|
<div class="container">
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="myModalDelete" data-backdrop="static" role="dialog">
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">MESSAGE</h4>
|
|
<button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Are you sure to delete?</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
|
|
<FORM NAME=newModalDeleteForm METHOD=POST ACTION="/lib/user_process.php" id="newModalDeleteForm">
|
|
<input type=hidden name=actionStr value="DELETENOTE">
|
|
<input type=hidden name=actionPage value="">
|
|
<input type=hidden name=n_uid id=n_uid value="">
|
|
<input type=hidden name=c_uid id=c_uid value="<?=$c_uid?>">
|
|
<input type=hidden name=mode value="delete">
|
|
<input type=hidden name=goStr id=goStr value="<?=$goStr?>">
|
|
|
|
<div class="text-center grid-layout-col-2">
|
|
<button type="button" class="btn-gray" data-dismiss="modal">NO</button>
|
|
<button type="submit" class="btn-sub">YES</button>
|
|
</div>
|
|
|
|
</FORM>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Modal Add Note Form -->
|
|
<div id="add-note-modal" class="modal fade">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">ADD A NOTE</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<FORM NAME=addnote id=addnote METHOD=POST ACTION="/lib/user_process.php">
|
|
<input type=hidden name=actionStr value="ADDNOTE">
|
|
<input type=hidden name=actionPage value="">
|
|
<input type=hidden name=n_customeruid id=n_customeruid value="<?=$c_uid?>">
|
|
<input type=hidden name=n_memberuid id=n_memberuid value="<?=$_SESSION['ss_UID']?>">
|
|
<input type=hidden name=goStr id=goStr value="<?=$goStr?>">
|
|
<input type=hidden name=mode value="create">
|
|
|
|
<table class="tb-info-box">
|
|
<tr>
|
|
<td class="td-title-info">WRITER</td>
|
|
<td class="td-text-info"><?=$_SESSION['ss_NAME']?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">NOTE</td>
|
|
<td class="td-text-info">
|
|
<textarea id="n_note" class="textarea" name="n_note" rows="4" cols="20" required='required' ></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<div class="text-center grid-layout-col-2">
|
|
<button type="submit" class="btn-sub">ADD</button>
|
|
<button type="button" class="btn-gray" data-bs-dismiss="modal">CLOSE</button>
|
|
</div>
|
|
</FORM>
|
|
</div>
|
|
</div><!-- modal-content ends -->
|
|
</div><!-- modal-dialog ends -->
|
|
</div><!-- request-modal ends -->
|
|
|
|
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
//$("#email").val("");
|
|
//$('#userinfo')[0].reset();
|
|
|
|
$("#pickupOrder").validate({
|
|
// Specify validation rules
|
|
ignore: ".ignore",
|
|
rules: {
|
|
d_quantity: {
|
|
required: true,
|
|
//minlength: 6,
|
|
},
|
|
d_payamount: {
|
|
required: "#d_paystatuspaid:checked",
|
|
//minlength: 6,
|
|
},
|
|
},
|
|
messages: {
|
|
d_quantity: {
|
|
required: "Please input Oil Quantity",
|
|
//minlength: "Minimum of 6 characters.",
|
|
},
|
|
d_payamount: {
|
|
required: "Please input Cash Amount",
|
|
//minlength: "Minimum of 6 characters.",
|
|
},
|
|
},
|
|
|
|
errorElement : 'div',
|
|
|
|
submitHandler: function(form) {
|
|
//if (grecaptcha.getResponse(1) == '') alert("Error");
|
|
//else form.submit();
|
|
form.submit();
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
</script>
|
|
|
|
<div class="container">
|
|
<!-- Modal Input Pickup Form -->
|
|
<div id="input-pickup-modal" class="modal fade customer-info">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">ORDER DETAIL</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<FORM NAME=pickupOrder id=pickupOrder METHOD=POST ACTION="/lib/user_process.php">
|
|
<input type=hidden name=actionStr value="PICKUPORDERCUSTOMER">
|
|
<input type=hidden name=actionPage value="">
|
|
<input type=hidden name=d_uid id=d_uid value="<?=$d_uid?>">
|
|
<input type=hidden name=c_uid id=c_uid value="<?=$c_uid?>">
|
|
|
|
<input type=hidden name=d_driveruid id=d_driveruid value="<?=$c_driveruid?>">
|
|
|
|
<input type=hidden name=d_paymenttype id=d_paymenttype value="<?=$d_paymenttype?>">
|
|
<input type=hidden name=d_customeruid id=d_customeruid value="<?=$c_uid?>">
|
|
<input type=hidden name=d_mode id=d_mode value="<?=$d_mode?>">
|
|
<input type=hidden name=goStr id=goStr value="<?=$goStr?>">
|
|
|
|
<? if (trim($d_payeesign) != "") { ?>
|
|
<input type=hidden name=d_payeesign id=d_payeesign value="<?=$d_payeesign?>">
|
|
<? }?>
|
|
|
|
|
|
<table class="tb-info-box">
|
|
|
|
<tr>
|
|
<td class="td-title-info">Restaurant Name</td>
|
|
<td class="td-text-info shortinput-store-name"><?=$c_name?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Visited Date</td>
|
|
<td class="td-text-info">
|
|
<? if ($setTag == "ENABLED") { ?>
|
|
<input type="text" id="d_visitdate" name="d_visitdate" value="<?=$d_orderdateSTR?>" readonly>
|
|
<? } else { ?>
|
|
<input type="text" name="d_visitdate" value="<?=$d_orderdateSTR?>" readonly>
|
|
<? } ?>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Driver</td>
|
|
<td class="td-text-info">
|
|
<select id="d_druid" name="d_druid" class="custom-select">
|
|
<?=$c_driveruidSTRM?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Oil Quantity</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="d_quantity" name="d_quantity" placeholder="500" value="<?=$d_quantity?>" required='required' minlength="1" maxlength="10">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Sludge (%)</td>
|
|
<td class="td-text-info">
|
|
<div class="number-input">
|
|
<button class="left" type="button">▼</button>
|
|
<input type="number" class="d_sludge" id="d_sludge" name="d_sludge" value="<?= (isset($d_sludge) && trim((string)$d_sludge) !== '') ? $d_sludge : $c_sludge ?>" min="0" max="100" placeholder="50">
|
|
<button class="right" type="button">▲</button>
|
|
</div>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<? if ($d_paymenttype =="CA") { ?>
|
|
<tr>
|
|
<td class="td-title-info">Cash</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="d_payamount" name="d_payamount" value="<?=$d_payamount?>" placeholder="100" >
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Pay Status</td>
|
|
<td class="td-text-info">
|
|
|
|
<label class="container-chk">Paid
|
|
<input type="radio" name="d_paystatus" id="d_paystatuspaid" required='required' <?=($d_paystatus == "P")?"checked":"";?> value="P">
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
|
|
<label class="container-chk">UnPaid
|
|
<input type="radio" name="d_paystatus" id="d_paystatusunpaid" required='required' <?=($d_paystatus == "N" || $d_paystatus == "")?"checked":"";?> value="N">
|
|
<span class="checkmark"></span>
|
|
</label>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="td-title-info">Customer Name</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="d_payeename" name="d_payeename" value="<?=htmlspecialchars($d_payeenameSTR, ENT_QUOTES)?>" placeholder="Customer Name" >
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">Signature
|
|
<div id="newbtnid" style="<?=$setDisplayNEWStr?> float:right; padding-right: 10px;">New <input type="checkbox" id="signednew" name="signednew" value="1" ></div>
|
|
<div id="clrbtnid" style="<?=$setDisplayBTNStr?> float:right; padding-right: 10px;padding-bottom: 10px;"><button type="button" id="clear" class="btn-clear">Clear</button></div>
|
|
</td>
|
|
<td class="td-text-info">
|
|
<div id="signitureedid" style="<?=$setDisplaySIGNYESStr?>">
|
|
<?=$d_payeesignSTR?>
|
|
</div>
|
|
|
|
<div id="signitureid" style="<?=$setDisplaySIGNNEWStr?>">
|
|
<div id="sig" ></div>
|
|
<br/>
|
|
<textarea id="signature64" name="signed" class="textarea" style="display: none;width: 100%;"></textarea>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<? } ?>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Note</td>
|
|
<td class="td-text-info">
|
|
<textarea id="d_note" class="textarea" name="d_note" rows="4" cols="20"><?=$n_noteSTRM?></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<div class="text-center grid-layout-col-2">
|
|
<button type="submit" id="buttonADD" class="btn-sub">ADD</button>
|
|
<button type="button" class="btn-gray" data-bs-dismiss="modal">CLOSE</button>
|
|
</div>
|
|
</FORM>
|
|
</div>
|
|
|
|
</div><!-- modal-content ends -->
|
|
</div><!-- modal-dialog ends -->
|
|
</div><!-- input-pickup-modal ends -->
|
|
</div>
|
|
|
|
|
|
<!-- Modal Request Form -->
|
|
<div id="request-modal" class="modal fade customer-info">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">REQUEST</h4>
|
|
<button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<FORM NAME=addrequest id=addrequest METHOD=POST ACTION="/lib/user_process.php">
|
|
<input type=hidden name=actionStr value="ADDREQUEST">
|
|
<input type=hidden name=actionPage value="">
|
|
<input type=hidden name=r_customeruid id=r_customeruid value="<?=$c_uid?>">
|
|
<input type=hidden name=r_driveruid id=r_driveruid value="<?=$c_driveruid?>">
|
|
<input type=hidden name=r_memberuid id=r_memberuid value="<?=$_SESSION['ss_UID']?>">
|
|
<input type=hidden name=goStr id=goStr value="<?=$goStr?>">
|
|
<input type=hidden name=mode value="create">
|
|
|
|
<table class="tb-info-box">
|
|
<tr>
|
|
<td class="td-title-info">Request Date</td>
|
|
<td class="td-text-info">
|
|
<input type="text" id="r_requestdate" name="r_requestdate" value="<?=$r_requestdateSTR?>" placeholder="<?=date('Y-m-d')?>" readonly required='required' >
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">Driver</td>
|
|
<td class="td-text-info">
|
|
<select id="r_druid" name="r_druid" class="custom-select">
|
|
<option value=''>Select</option>
|
|
<?=$c_driveruidSTRRQ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="td-title-info">Note</td>
|
|
<td class="td-text-info">
|
|
<textarea id="r_note" class="textarea" name="r_note" rows="4" cols="20" ></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<div class="text-center grid-layout-col-2">
|
|
<button type="submit" class="btn-sub">REQUEST</button>
|
|
<button type="button" class="btn-gray" data-bs-dismiss="modal" >CLOSE</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div><!-- modal-content ends -->
|
|
</div><!-- modal-dialog ends -->
|
|
</div><!-- request-modal ends -->
|
|
|
|
|
|
|
|
<script>
|
|
/**
|
|
* Request type on click
|
|
*/
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const requestModal = document.getElementById('request-modal');
|
|
if (requestModal) {
|
|
requestModal.addEventListener('show.bs.modal', function (event) {
|
|
const trigger = event.relatedTarget;
|
|
if (!trigger) return;
|
|
});
|
|
}
|
|
|
|
const addNoteModal = document.getElementById('add-note-modal');
|
|
if (addNoteModal) {
|
|
addNoteModal.addEventListener('show.bs.modal', function (event) {
|
|
const trigger = event.relatedTarget;
|
|
if (!trigger) return;
|
|
});
|
|
}
|
|
|
|
const pickupModal = document.getElementById('input-pickup-modal');
|
|
if (pickupModal) {
|
|
pickupModal.addEventListener('show.bs.modal', function (event) {
|
|
const trigger = event.relatedTarget;
|
|
if (!trigger) return;
|
|
});
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var sig = $('#sig').signature({syncField: '#signature64', syncFormat: 'PNG', thickness: 2});
|
|
$('#clear').click(function(e) {
|
|
e.preventDefault();
|
|
sig.signature('clear');
|
|
$("#signature64").val('');
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
document.querySelectorAll('.number-input').forEach(container => {
|
|
const input = container.querySelector('.d_sludge');
|
|
const leftBtn = container.querySelector('.left');
|
|
const rightBtn = container.querySelector('.right');
|
|
const step = 5;
|
|
|
|
leftBtn.addEventListener('click', () => {
|
|
const min = input.min ? parseInt(input.min) : -Infinity;
|
|
let value = parseInt(input.value || 0);
|
|
if (value - step >= min) input.value = value - step;
|
|
});
|
|
|
|
rightBtn.addEventListener('click', () => {
|
|
const max = input.max ? parseInt(input.max) : Infinity;
|
|
let value = parseInt(input.value || 0);
|
|
if (value + step <= max) input.value = value + step;
|
|
});
|
|
});
|
|
});
|
|
|
|
function buildContent(property) {
|
|
$(".shortinput-store-name").text(property.name);
|
|
}
|
|
|
|
</script>
|