Last active
May 4, 2022 01:35
-
-
Save findawayer/e655d3b3325e8c875ba223b67f14266f to your computer and use it in GitHub Desktop.
Update seat tier ranges for Live@ admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 좌석 등급표 내의 <input />에 입력이 있을 때, | |
// `input` 이벤트에 반응해 좌석표 그래픽을 갱신하는 함수 | |
function updateTierRanges() { | |
var input = this; | |
var tiers = []; | |
// <input />의 현재 값을 대문자로 변환합니다. | |
input.value = input.value.toUpperCase(); | |
// 좌석 등급표의 각 <input />에서 값을 맵핑해서 | |
// 좌석표 그래픽에 반영합니다. | |
tiers = $('#concert-seat-tiers') | |
.find('input.tier-range') | |
.map(function (index) { | |
var $range = $(this); | |
var $row = $range.closest('tr'); | |
var id = $row.find('input.tier-id').val(); | |
var name = $row.find('input.tier-name').val(); | |
var ranges = $range.val(); | |
var cells = parseTierRanges(ranges); | |
var payload = { | |
id: id, | |
index: index, | |
name: name, | |
cells: cells, | |
}; | |
return payload; | |
}) | |
.get(); | |
data.tiers = tiers; | |
rerender(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment