203 lines
7.4 KiB
PHP
203 lines
7.4 KiB
PHP
<style>
|
|
.table-responsive {
|
|
margin: 0 auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.table-bordered {
|
|
border: 1px solid #ddd;
|
|
}
|
|
|
|
.table-bordered th,
|
|
.table-bordered td {
|
|
border: 1px solid #ddd;
|
|
text-align: center;
|
|
}
|
|
|
|
.table-bordered th {
|
|
background-color: #f2f2f2;
|
|
}
|
|
</style>
|
|
<script>
|
|
// 쿠폰 사용 버튼 클릭 시 처리
|
|
function onCouponUse(event, form) {
|
|
event.preventDefault(); // 기본 폼 제출을 막기
|
|
if (!form) {
|
|
console.error("폼을 찾을 수 없습니다.");
|
|
return false; // 폼을 찾을 수 없으면 종료
|
|
}
|
|
console.log("쿠폰 사용 클릭됨");
|
|
|
|
// 각 요소 선택
|
|
const type = form.querySelector('select[name="type"]');
|
|
const title = form.querySelector('input[name="title"]');
|
|
const coupon_select = form.querySelector('select[name="coupon_select"]');
|
|
const coupon_note = form.querySelector('textarea[name="coupon_note"]');
|
|
|
|
// 요소가 존재하는지 확인
|
|
if (!type || !title || !coupon_select || !coupon_note) {
|
|
console.error("폼 내부에서 요소를 찾을 수 없습니다.");
|
|
return false; // 요소가 없으면 종료
|
|
}
|
|
|
|
// 값 가져오기
|
|
const typeValue = type.value;
|
|
const titleValue = title.value;
|
|
const couponSelectValue = coupon_select.value;
|
|
const couponNoteValue = coupon_note.value;
|
|
|
|
if (typeValue == "") {
|
|
alert("사용용도를 선택하세요");
|
|
return false;
|
|
}
|
|
if (titleValue == "") {
|
|
alert("사용내역을 입력하세요");
|
|
return false;
|
|
}
|
|
if (couponSelectValue == "") {
|
|
alert("사용쿠폰수를 선택하세요");
|
|
return false;
|
|
}
|
|
if (couponNoteValue == "") {
|
|
alert("비고내용을 입력하세요");
|
|
return false;
|
|
}
|
|
|
|
// 폼 액션을 설정하고 제출
|
|
form.action = "{{DBMS_SITE_HOST}}/dbms/client/coupon/use";
|
|
form.submit();
|
|
}
|
|
|
|
// 쿠폰 수정 버튼 클릭 시 처리
|
|
function onCouponUpdate(event, form) {
|
|
event.preventDefault(); // 기본 폼 제출을 막기
|
|
if (!form) {
|
|
console.error("폼을 찾을 수 없습니다.");
|
|
return false; // 폼을 찾을 수 없으면 종료
|
|
}
|
|
console.log("쿠폰 수정 클릭됨");
|
|
|
|
// 각 요소 선택
|
|
const type = form.querySelector('select[name="type"]');
|
|
const title = form.querySelector('input[name="title"]');
|
|
const coupon = form.querySelector('select[name="coupon"]');
|
|
const coupon_use = form.querySelector('input[name="coupon_use"]');
|
|
|
|
// 요소가 존재하는지 확인
|
|
if (!type || !title || !coupon || !coupon_use) {
|
|
console.error("폼 내부에서 요소를 찾을 수 없습니다.");
|
|
return false; // 요소가 없으면 종료
|
|
}
|
|
|
|
// 값 가져오기
|
|
const typeValue = type.value;
|
|
const titleValue = title.value;
|
|
const couponValue = coupon.value;
|
|
const couponUseValue = coupon_use.value;
|
|
|
|
if (typeValue == "") {
|
|
alert("사용용도를 선택하세요");
|
|
return false;
|
|
}
|
|
if (titleValue == "") {
|
|
alert("사용제목을 입력하세요");
|
|
return false;
|
|
}
|
|
if (isNaN(couponValue) || couponValue.trim() === "") {
|
|
alert("남은쿠폰수가 숫자가 아닌 값이 입력되었습니다!");
|
|
return false;
|
|
}
|
|
if (isNaN(couponUseValue) || couponUseValue.trim() === "") {
|
|
alert("사용된된쿠폰수가 숫자가 아닌 값이 입력되었습니다!");
|
|
return false;
|
|
}
|
|
|
|
// 폼 액션을 설정하고 제출
|
|
form.action = "{{DBMS_SITE_HOST}}/dbms/client/coupon/update";
|
|
form.submit();
|
|
}
|
|
|
|
// 쿠폰 리셋 버튼 클릭 시 처리
|
|
function onCouponReset(event, form) {
|
|
event.preventDefault(); // 기본 폼 제출을 막기
|
|
if (!form) {
|
|
console.error("폼을 찾을 수 없습니다.");
|
|
return false; // 폼을 찾을 수 없으면 종료
|
|
}
|
|
console.log("쿠폰 리셋 클릭됨");
|
|
|
|
// 폼 액션을 설정하고 제출
|
|
form.action = "{{DBMS_SITE_HOST}}/dbms/client/coupon/reset";
|
|
form.submit();
|
|
}
|
|
</script>
|
|
@if ($client)
|
|
<h3>고객명 : <a href="/serviceDetail.sev?client_code={{$client->getClientCode()}}">{{$client->getTitle()}}</a> / 쿠폰발급대상 : {{count($entities)}} 대</h3>
|
|
@endif
|
|
session:{{var_dump($session)}}
|
|
@if ($session->hasFlash('error'))<div class="alert alert-danger">{{$session->getFlash('error')}}</div>@endif
|
|
<div class="table-responsive" id="table">
|
|
<input type="hidden" id="token">
|
|
<table class="table table-bordered table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>No</th>
|
|
<th>고객명</th>
|
|
<th>서비스코드</th>
|
|
<th>장비명</th>
|
|
<th>사용용도</th>
|
|
<th>사용제목</th>
|
|
<th>남은수/사용된수</th>
|
|
<th>사용쿠폰수</th>
|
|
<th>비고</th>
|
|
<th>작업</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php $i=0 @endphp
|
|
@foreach($entities as $key=>$entity)
|
|
<tr>
|
|
<form method="post">
|
|
<input type="hidden" name="service_code" value="{{$entity->getServiceCode()}}">
|
|
<input type="hidden" name="member_code" value="{{$member ? $member->getPK() : ""}}">
|
|
<td>{{$total-(($curPage-1)*$perPage+$i)}}</td>
|
|
<td>{{$clients[$entity->getClientCode()]->getTitle()}}</td>
|
|
<td><a href="/serviceDetailSolo.sev?client_code={{$entity->getClientCode()}}&service_code={{$entity->getServiceCode()}}">{{$entity->getServiceCode()}}</td>
|
|
<td>{{$entity->getServerCode()}}</td>
|
|
<td>
|
|
<select name="type" style="width:100%">
|
|
<option value="">용도 선택</option>
|
|
@foreach(DBMS_CLIENT_COUPON_TYPE as $key => $value)
|
|
<option value="{{$key}}">{{$value}}</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
<td><input type="text" name="title" value="" style="width:100%"></td>
|
|
<td><input type="text" name="coupon" value="@if ($session->old('title')) ?? {{$entity->getCoupon()}}" @endif maxlength="3" size="3">/<input type="text" name="coupon_use" value="{{$entity->getUsedCoupon()}}" maxlength="3" size="3"> <a href="/IdcOnetimeList.sev?service_code={{$entity->getServiceCode()}}">내역</a>
|
|
</td>
|
|
<td>
|
|
<select name="coupon_select" style="width:100%">
|
|
<option value="">쿠폰수 선택</option>
|
|
@for($i=1; $i<=$entity->getCoupon(); $i++)
|
|
<option value="{{$i}}">{{$i}}개</option>
|
|
@endfor
|
|
</select>
|
|
</td>
|
|
<td><textarea name="coupon_note" rows="2" cols="40"></textarea></td>
|
|
<td>
|
|
<!-- <button type="button" onClick="onCouponUse(event, this.form)">사용</button>
|
|
<button type="button" onClick="onCouponUpdate(event, this.form)">수정</button>
|
|
<button type="button" onClick="onCouponReset(event, this.form)">RESET</button> -->
|
|
<input type="submit" value="사용" formaction=" {{DBMS_SITE_HOST}}/dbms/client/coupon/use">
|
|
<input type="submit" value="수정" formaction=" {{DBMS_SITE_HOST}}/dbms/client/coupon/update">
|
|
<input type="submit" value="RESET" formaction="{{DBMS_SITE_HOST}}/dbms/client/coupon/reset">
|
|
</td>
|
|
</form>
|
|
</tr>
|
|
@php $i++ @endphp
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div style=" text-align:center">{!!$pagination->render(DBMS_SITE_URL . "/IdcCouponUseMK.cup", ['client_code' => $client ? $client->getClientCode() : "", 'mkid' => $member ? $member->getPK() : "", 'curPage' => $curPage, 'perPage' => $perPage])!!}
|
|
</div> |