123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?php $this->ajax_form('save_price'); ?>
- <input type="hidden" name="post_id" value="<?php echo $post->ID; ?>">
- <input type="hidden" name="reset" value="">
- <table class="table lens-table mb-3">
- <thead>
- </thead>
- <tbody>
- <tr>
- <th colspan="<?php echo $item_count + 1; ?>" class="aligh-center">
- <?php echo $post->post_title; ?>
- </th>
- </tr>
- <tr>
- <th rowspan="2">
- 항목
- </th>
- <?php foreach ($items as $item): ?>
- <td class="p-0">
- <img src="<?php echo wp_get_attachment_url($item['image']); ?>">
- </td>
- <?php endforeach; ?>
- </tr>
- <tr>
- <?php foreach ($items as $item): ?>
- <th>
- <?php echo $item['refractive']; ?>
- <input type="hidden" name="refractive[]" value="<?php echo $item['refractive']; ?>">
- </th>
- <?php endforeach; ?>
- </tr>
- <tr>
- <th>
- 가격
- </th>
- <?php foreach ($this->get_real_values($items, 'price') as $ref => $price): ?>
- <td>
- <?php if (!empty($price['value'])): ?>
- <?php $this->the_price($price); ?>
- <div class="input-group my-2">
- <div class="input-group-prepend">
- <span class="input-group-text">정상가</span>
- </div>
- <input type="number" name="price[]" class="form-control" value="<?php echo $user_prices['items'][$ref]['price'] ?? ''; ?>">
- </div>
- <div class="input-group my-2">
- <div class="input-group-prepend">
- <span class="input-group-text">할인가</span>
- </div>
- <input type="number" name="price_sale[]" class="form-control" value="<?php echo $user_prices['items'][$ref]['price_sale'] ?? ''; ?>">
- </div>
- <?php else: ?>
- <input type="hidden" name="price[]" value="">
- <input type="hidden" name="price_sale[]" value="">
- <?php endif; ?>
- </td>
- <?php endforeach; ?>
- </tr>
- <tr>
- <th>
- RX 가격
- </th>
- <?php foreach ($this->get_real_values($items, 'rx_price') as $ref => $price): ?>
- <td>
- <?php if (!empty($price['value'])): ?>
- <?php $this->the_price($price); ?>
- <div class="input-group my-2">
- <div class="input-group-prepend">
- <span class="input-group-text">정상가</span>
- </div>
- <input type="number" name="rx_price[]" class="form-control" value="<?php echo $user_prices['items'][$ref]['rx_price'] ?? ''; ?>">
- </div>
- <div class="input-group my-2">
- <div class="input-group-prepend">
- <span class="input-group-text">할인가</span>
- </div>
- <input type="number" name="rx_price_sale[]" class="form-control" value="<?php echo $user_prices['items'][$ref]['rx_price_sale'] ?? ''; ?>">
- </div>
- <?php else: ?>
- <input type="hidden" name="rx_price[]" value="">
- <input type="hidden" name="rx_price_sale[]" value="">
- <?php endif; ?>
- </td>
- <?php endforeach; ?>
- </tr>
- </tbody>
- </table>
- <div class="d-flex justify-content-center py-1">
- <label for="lens-sale" class="col-form-label mr-2">할인율</label>
- <div class="input-group mr-2" style="width: 160px;">
- <input type="number" name="sale" class="form-control" id="lens-sale" value="<?php echo $user_prices['sale'] ?? ''; ?>">
- <div class="input-group-append">
- <div class="input-group-text">%</div>
- </div>
- </div>
- <button type="button" class="btn btn-warning mr-3" id="reset-btn">초기화</button>
- <a href="<?php echo remove_query_arg('mode'); ?>" class="btn btn-secondary mr-2">취소</a>
- <button type="button" class="btn btn-primary" id="save-btn">저장</button>
- </div>
- </form>
- <?php $this->ajax_form('reset_price'); ?>
- <input type="hidden" name="post_id" id="reset-price" value="<?php echo $post->ID; ?>">
- </form>
- <script type="text/javascript">
- jQuery(function($) {
- $('#save-btn').click(function() {
- if (confirm('저장하시겠습니까?')) {
- $(this).closest('form').ajaxSubmit(function(response) {
- if (response.success) {
- location.href = '<?php echo remove_query_arg('mode'); ?>';
- } else {
- alert(response.data);
- }
- });
- }
- });
- $('#reset-btn').click(function() {
- $('input[name="reset"]').val('true');
- $('#reset-price').closest('form').ajaxSubmit(function(response) {
- location.href = '<?php echo remove_query_arg('mode'); ?>';
- });
- return false;
- });
- });
- </script>
|