238 lines
10 KiB
PHP
238 lines
10 KiB
PHP
<form method="POST" action="?" id="frm_update_card">
|
|
<?php if (isset($card_id) && $card_id > 0) { ?>
|
|
<input type="hidden" name="id" value="<?= $card_id ?>" />
|
|
<?php } ?>
|
|
<input type="hidden" name="card_logic" value="" />
|
|
<div class="row">
|
|
<div class="col col-lg-4">
|
|
|
|
<div class="form-group">
|
|
<label for="categoryLabel">Template</label>
|
|
<?= $card_template ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="categoryLabel">Category <span class="required">*</span></label>
|
|
<?= $card_category ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="categoryLabel">Category Type</label>
|
|
<?= $card_type ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="categoryLabel">Card Time</label>
|
|
<?= $card_time ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="cansaveLabel">Can user save ?</label>
|
|
<?= $card_can_save ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="cardPictureslabel">Picture</label>
|
|
<?= $card_pictures ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="cardName">Card Id <span class="required">*</span></label>
|
|
<input type="text" class="form-control" id="cardName" name="card_name" maxlength="100" placeholder="Card Unique" value="<?= $card_name ?>" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="showTitleInput">Show Short Title</label>
|
|
<?= $use_short_title_combo ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="cardShortTitle">Card Short Title</label>
|
|
<input type="text" class="form-control" id="cardShortTitle" name="short_title" maxlength="35" placeholder="Card Short Title" value="<?= $short_title ?>" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="showTitleInput">Show Title</label>
|
|
<?= $card_titleshow ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="showDynamicKeyInput">Dynamic Card key</label>
|
|
<h3> <?= isset($dynamic_key)?$dynamic_key:'' ?></h3>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="activity_screen">Activity Screen</label>
|
|
<?= $activity_screen??'' ?>
|
|
</div>
|
|
</div>
|
|
<div class="col col-lg-4">
|
|
|
|
|
|
<div class="form-group">
|
|
<label for="cardTitle">Card Title <span class="required">*</span></label>
|
|
<input type="text" class="form-control" id="cardTitle" name="card_title" maxlength="100" placeholder="Card Title" value="<?= $card_title ?>" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="categoryLabel">Can Expire</label>
|
|
<?= $card_canexpire ?>
|
|
<br>
|
|
<label for="categoryLabel">Expiration date</label>
|
|
<input type="text" class="form-control" name="card_expiration" value="<?= $card_expiration ?>" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="cansaveLabel">Notification</label>
|
|
<?= $card_notify ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="description" id="description_label">Description <strong class="required">*</strong> <span>[250]</span></label>
|
|
<textarea class="form-control" name="description" id="description" rows="3" maxlength="250" placeholder="Description"><?= $description ?></textarea>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="long_description" id="long_description_label">Long Description <span>[400]</span></label>
|
|
<textarea class="form-control" name="long_description" id="long_description" rows="6" maxlength="400" placeholder="Long Description"><?= $long_description ?></textarea>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="button1">1st Button <span class="required">*</span></label>
|
|
<input type="text" class="form-control" name="button1" id="button1" maxlength="35" placeholder="Button 1" value="<?= $button1 ?>" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="button1_text">1st Button Text <span class="required">*</span></label>
|
|
<input type="text" class="form-control" name="button1_text" id="button1_text" maxlength="35" placeholder="Button 1 Text" value="<?= $button1_text ?>" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="behaveLabel">Blog Article Id <span class="required">*</span></label>
|
|
<?= $card_blog_id ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="show_area">Show Area</label>
|
|
<?= $show_area??'' ?>
|
|
</div>
|
|
</div>
|
|
<div class="col col-lg-4">
|
|
|
|
|
|
|
|
<div style="background-color: lightsteelblue; padding 3px;">
|
|
|
|
<div class="form-group">
|
|
<label for="cansaveLabel">Card Target</label>
|
|
<?= $target_key ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="cansaveLabel">Target Text[Used in pop up messages]</label>
|
|
<textarea class="form-control" name="target_text" id="targetTextCardlab" rows="3" maxlength="250" placeholder="Target Text"><?= $target_text ?></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="cansaveLabel">Status</label>
|
|
<?= $card_status ?>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="behaveLabel">Behavior <span class="required">*</span></label>
|
|
<?= $card_behavior ?>
|
|
</div>
|
|
<?php include("card_part_location.php"); ?>
|
|
<?php include("card_part_points.php"); ?>
|
|
<div class="form-group">
|
|
<label for="exampleFormControlTextarea1">Card List Order</label>
|
|
<input type="text" class="form-control" name="card_order" id="IDcard_order" maxlength="3" placeholder="List order 1-100" value="<?= $card_order ?>" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="exampleFormControlTextarea1">Card Background Color</label>
|
|
<input type="text" class="form-control" name="background_color" id="IDbackground_color" maxlength="6" placeholder="Color Code no #" value="<?= $background_color ?>" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="expiration">Expiration</label>
|
|
<?= $expiration??'' ?>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<button type="submit" name="go" class="btn btn-info btn-block btn-sm"><?= $form_button ?></button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="card" style="width: 100%; background-color:honeydew;">
|
|
<div class="card-body">
|
|
<?php if (isset($card_id) && $card_id > 0) { ?>
|
|
|
|
<button type="button" class="btn btn-danger btn-block btn-sm" data-toggle="modal" data-target="#exampleModalScrollable">More Setting</button>
|
|
|
|
<p class="card-text">We are ready to go on here.</p>
|
|
|
|
<?php } ?>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
<script>
|
|
window.TEMPLATE_ACTIVE_TIP = <?=$TEMPLATE_ACTIVE_TIP??-1?>;
|
|
$(function () {
|
|
const $frm_update_card = $("#frm_update_card");
|
|
$frm_update_card.on('submit', function() {
|
|
// check validation
|
|
const template_selected_id = $("select[name=card_template]").val();
|
|
const background_color = $("input[name=background_color]").val().trim();
|
|
const picture_select_value = $("select[name=card_pictures]").val().trim();
|
|
if(window.TEMPLATE_ACTIVE_TIP == template_selected_id){
|
|
if(background_color.length === 0){
|
|
alert('Invalid input - select Card Background Color for Active Tip template');
|
|
return false;
|
|
}
|
|
}else if(background_color.length === 0 && picture_select_value.length === 0){
|
|
alert('Invalid input - Please Select Card Background Picture');
|
|
return false;
|
|
}
|
|
// validate for "Blog Card" category require title
|
|
if($("#card_category").val() === "BLOGCARD" && $("#card_titleshow").val() != 1){
|
|
alert('Invalid input - Please select Show Title for Blog Card!');
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
$('input[name="card_expiration"]').daterangepicker({
|
|
singleDatePicker: true,
|
|
showDropdowns: true,
|
|
minYear: <?= date("Y") ?>,
|
|
maxYear: <?= date("Y") + 10 ?>, /*parseInt(moment().format('YYYY'),10),*/
|
|
locale: {
|
|
format: 'YYYY-MM-DD'
|
|
}
|
|
}, function (start, end, label) {
|
|
var years = moment().diff(start, 'years');
|
|
});
|
|
|
|
$("#long_description").keyup(function (){
|
|
let cur_length = $(this).val().length;
|
|
let max_length = $(this).attr("maxlength");
|
|
$("#long_description_label").find("span").html("["+cur_length+"/"+max_length+"]");
|
|
}).trigger('keyup');
|
|
$("#description").keyup(function (){
|
|
let cur_length = $(this).val().length;
|
|
let max_length = $(this).attr("maxlength");
|
|
$("#description_label").find("span").html("["+cur_length+"/"+max_length+"]");
|
|
}).trigger('keyup');
|
|
|
|
//reset errors
|
|
$frm_update_card.find('input').on('change', function(){
|
|
$(this).removeClass('error');
|
|
});
|
|
$frm_update_card.find('select').on('change', function(){
|
|
$(this).removeClass('error');
|
|
});
|
|
$frm_update_card.find('textarea').on('change', function(){
|
|
$(this).removeClass('error');
|
|
});
|
|
});
|
|
</script>
|