var item_list = [];
var item_list_word = [];
var item_list_mail = [];
var order_price = {};
var row_num = 0;
var prefecture_s;
var payment_s;
var charge_s;
var delivery_popup_flg = false;
var _index_name_nobori = ["size", "shape", "pocket", "pokedir", "sew", "fire", "material", "bag", "delivery"];
var _index_name_mini = ["size", "material", "pocket", "element", "bag", "delivery"];
var _index_name_silk = ["size", "color", "sew", "pokedir", "delivery", "fire", "bag"];
var _index_name_sankaku = ["size", "material", "cap", "pole", "poledir", "sew", "bag", "delivery"];
var _index_name_banner = ["size", "stand_kind", "material", "sew", "delivery"];
var _index_name_tebata = ["size", "material", "stick", "sew", "bag", "delivery"];
var _index_name_buzai = ["pole1", "pole2", "pole3", "base1", "base2", "base3", "base4", "base5", "crossbar1", "crossbar2", "crossbar3", "corerod1", "corerod2", "corerod3", "hacker1", "boll1", "pole4"];
var _index_name_oudanmaku = ["sew", "cut", "eyelet", "eyelet_dir", "hole", "holenum", "fire", "colorcmp"];
var _index_name_sutekan = ["product", "size", "custom_w", "custom_h", "custom_l", "material", "rope", "bag", "delivery"];
var _index_name_ryomen = ["size", "material", "pocket", "pokedir", "sew", "fire", "bag", "delivery"];
var _index_name_happi = ["size", "material", "delivery"];
var _index_name_tasuki = ["size", "material", "delivery"];
var _index_name_p_banner= ["size", "buzai", "fire", "bag", "material", "sew", "delivery"];
var _index_name_sail_banner= ["size", "buzai", "fire", "bag", "material", "sew", "delivery"];
var _index_name_senkyo = ["size", "material", "delivery"];
var _index_name_magsheet = ["material", "processing", "size_w", "size_h", "shape", "delivery"];
var _index_name_back_panel = ["product", "size", "buzai_type", "buzai", "buzai_yobi", "side", "joint", "fire", "delivery"];
var price_regex = /(\d)(?=(\d\d\d)+(?!\d))/g;
var $oudanmaku;
var tab_sub_comment = {
"mini-nobori": "小さいけれど主役級!
部材込みでセット納品です!",
"nobori": "インクジェット印刷のぼり",
"sankaku": "アミューズメント施設様ご用達。
個性的な装飾です。",
"silk-nobori": "大ロット・色数少なめならこちら。
裏抜け抜群。",
"banner": "設置が簡単で軽いのに目立つ!
催事やイベントに大活躍です。",
"tebata": "スポーツ観戦やイベント用に。
様々な用途に使える!",
"buzai": "のぼりと一緒にご注文はいかが?
のぼりの良き相棒達です。",
"sutekan": "水にも強く
1枚からフルカラー印刷可能",
"ryomen": "表面、裏面どちらも印刷できる",
"happi": "イベントやセールで
ド派手に演出!",
"tasuki": "選挙の必須品!",
"p-banner": "抜群の注目度を誇る曲線美",
"sailbanner": "ヨットの帆をイメージした
曲線の綺麗なバナー!",
"senkyo": "選挙看板",
"magsheet": "吸着力が強力なマグネットシート",
"back-panel": "イベントや展示会・記者会見
などに大活躍",
};
var oudanmaku_kind = ["pongee", "tropical", "tro-mat", "tarpaulin", "mesh-tarpaulin", "both-tarpaulin", "eco-tarpaulin"];
var uncheck_item_list = [];
//var settlment_url = "https://www.asjpayment.jp/cgi-bin/ps_payment_testcase.cgi";
var settlment_url = "https://www.asjpayment.jp/cgi-bin/ps_payment.cgi";
//var settlment_id = "9999999";
var settlment_id = "1982";
var cookie_age = "7776000"; //60×60×24×90
var _backprice_thr = "300";
var _msg_p_banner_flg = false;
var _msg_sail_banner_flg = false;
var _msg_ryomen_flg = false;
var _msg_nobori_flg = false;
var _delivery_days_nobori = {99:5, 299:6, 9999:7};
var _delivery_days_nobori_fast = {59:3, 299:4, 9999:5};
var _delivery_days_mini = {99:5, 199:6, 399:7, 699:8, 9999:9};
var _delivery_days_silk = {9999:6};
var _delivery_days_sankaku = {9999:5};
var _delivery_days_banner = {9999:5};
var _delivery_days_tebata = {499:5, 999:6, 1999:8, 9999:10};
var _delivery_days_sutekan = {299:5, 499:6, 999:7, 9999:8};
var _delivery_days_sutekan_kiwaku1 = {100:2, 299:5, 499:6, 999:7, 9999:8};
var _delivery_days_sutekan_slow = {199:10, 999:14, 9999:0xFF};
var _delivery_days_sutekan_hansha = {99:5, 299:6, 9999:0xFF};
var _delivery_days_sutekan_hansha_slow = {199:10, 999:14, 9999:0xFF};
var _delivery_days_ryomen = {9999:6};
var _delivery_days_happi = {10:10,50:14,100:16, 9999:20};
var _delivery_days_tasuki = {9999:5};
var _delivery_days_p_banner = {39:7, 9999:14};
var _delivery_days_p_banner_pole = {9999:7};
var _delivery_days_sail_banner = {29:5, 59:8, 89:9, 9999:10};
var _delivery_days_sail_banner_pole = {9999:5};
var _delivery_days_senkyo = {9999:5};
var _delivery_days_magsheet = {9999:5};
var _oudanmaku_num_tbl = [1,2,3,4,5,10,20,30,100];
$(window).load(function() {
if(window.sessionStorage.length > 0){
if(window.sessionStorage.getItem("data") != null){
item_list = JSON.parse(window.sessionStorage.getItem("data"));
if((item_list[0][0] & CATEGORY_MASK) == CATEGORY_OUDANMAKU){
$("#oudanmaku_kind").val(oudanmaku_kind.indexOf(item_list[0][3])+1);//横断幕タイプ初期化
}
}
if(item_list.length > ROW_NUM){
for(var i = 0; i < (item_list.length - ROW_NUM); i++){
add_row();
}
}
// $("input[name=note_agree]:checked").val(window.sessionStorage.getItem("agree"));
$("#CommentArea").children("textarea").val(window.sessionStorage.getItem("comment"));
payment_s = window.sessionStorage.getItem("payment");
$('input[name=payment_type]').val([payment_s]);
if(payment_s == "cash"){
$("#TotalPrice .commission").show();
}
else{
$("#TotalPrice .commission").hide();
}
$("#note_agree").prop("checked",window.sessionStorage.getItem("agree"));
// $("comment_warning").text(window.sessionStorage.getItem("comment"));
prefecture_s = window.sessionStorage.getItem("prefecture");
$("select.prefecture").val(prefecture_s);
if($("#FormTable").length){
params_set();
}
else{
refresh();
}
if(window.sessionStorage["user_company"]){
$("#user_company").val(window.sessionStorage.getItem("user_company"));
$("#user_person").val(window.sessionStorage.getItem("user_person"));
$("#user_postal").val(window.sessionStorage.getItem("user_postal"));
$("#user_address").val(window.sessionStorage.getItem("user_address"));
$("#user_tel").val(window.sessionStorage.getItem("user_tel"));
$("#user_email").val(window.sessionStorage.getItem("user_email"));
$("#member_id").val(window.sessionStorage.getItem("member_id"));
$("#member_email").val(window.sessionStorage.getItem("member_email"));
$("#send_in_company").val(window.sessionStorage.getItem("send_in_company"));
$("#send_in_tel").val(window.sessionStorage.getItem("send_in_tel"));
$("#send_in_postal").val(window.sessionStorage.getItem("send_in_postal"));
$("#send_in_address").val(window.sessionStorage.getItem("send_in_address"));
$("#CommentArea").children("textarea").val(window.sessionStorage.getItem("comment"));
}
if(window.sessionStorage["orderd_old_id"]
&& (window.location.href.split('/').pop() == "index.html" || window.location.href.split('/').pop() == "")){
$("#Reorder").find("div").html("
※インクジェット印刷の場合、前回と完全に同じ色での印刷はできかねます。
ご不安の方は色校正(オプション)のご利用をお薦めいたします。
" +
"※ポールや注水台などの部材に関しては、再度ご入力をお願い致します。
");
$("#Reorder").popup({closeButton: false,header:false});
}
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_req: 1
}
})
.fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1001]");
$("#ErrorPopup").popup();
})
.done(function(data){
if(data){
try {
data = $.parseJSON(data);
}
catch (e) {
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1002]");
$("#ErrorPopup").popup();
return;
}
jQuery.each(data, function(key,value) {
filename = "pic-" + key + ".jpg";
//既存のプレビューを削除
$preview = $("#TotalPrice .item").eq(key).children(".chk_pic");
$preview.empty();
// .prevewの領域の中にロードした画像を表示するimageタグを追加
$preview.append($('').attr({
src: 'upload/d98a8a05a2f2b2bbb8e76338bc9e8777/' + filename,
width: "50px",
class: "preview",
title: filename
}));
});
}
})
if(window.sessionStorage.getItem("settlment") == 1){
charge_s = window.sessionStorage.getItem("settlement_charge");
order_decide_mail();
window.sessionStorage.removeItem("settlment");
window.sessionStorage.removeItem("settlement_charge");
}
else if(window.sessionStorage.getItem("settlment") == 2){
window.sessionStorage.removeItem("settlment");
window.sessionStorage.removeItem("settlement_charge");
$("#ErrorPopup").find("div").html("クレジットカード決済に失敗しました。
クレジットカード番号などをお確かめの上、再度、処理を行なってください。");
$("#ErrorPopup").popup();
}
}
else{
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_clear: 1
}
})
.fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1003]");
$("#ErrorPopup").popup();
})
}
var url = new URL(window.location.href);
var params = url.searchParams;
if(params.get('page') != null){
$("#FormTable>thead .types>.sub_block>div>div[data-type=" + params.get('page') + "]").trigger("click",[true]);
}
});
$(function(){
$(document).on("input",".checknum", function () {
if (this.value.length > this.maxLength) {
this.value = this.value.slice(0, this.maxLength);
}
});
//disable状態の選択枝はクリックさせない
$('.item').click(function(e){
if($(this).hasClass("disabled")){
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
}
})
// 横断幕領域
$oudanmaku = $("[data-type='TypeOudanmaku']");
// タブ選択
$("#FormTable").find("thead .types>.sub_block>div>div").click(function(event, trigger){
$(this).parent().children(".on").removeClass("on");
$(this).addClass("on");
var index = $("#TotalPrice .item.active").attr("data-index");
var type = $(this).data("type");
var show_type = "";
var different = undefined;
if(type == "dummy"){
return;
}
else if(type != "oudanmaku"){
$("#FormTable").find("thead .types").children(".current").show();
$("#FormTable").find("thead .types").children(".current2").hide();
$("#FormTable").find("thead .types").children(".current")[0].firstChild.data = $(this).text();
$("#FormTable").find("thead .types").children(".current").children("p").html(tab_sub_comment[type]);
if(type == "buzai"){
$("#FormTable").find("thead .types").children(".current").addClass("long_text");
}
else{
$("#FormTable").find("thead .types").children(".current").removeClass("long_text");
}
if(type == "magsheet"){
$("#FormTable").find("thead .types").children(".current").addClass("long_text");
}
}
else{
$("#FormTable").find("thead .types").children(".current").hide();
$("#FormTable").find("thead .types").children(".current2").show();
}
switch(type){
case "info":
show_type = "TypeInfo";
break;
case "old-form":
//本発注画面に遷移
location.href='../cgi-bin/clipmail/form.htm';
break;
case "nobori":
show_type = "TypeNobori";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_NOBORI;
break;
case "mini-nobori":
show_type = "TypeMiniNobori";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_MINI_NOBORI;
break;
case "silk-nobori":
show_type = "TypeSilk";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_SILK_NOBORI;
break;
case "banner":
show_type = "TypeBanner";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_BANNER;
break;
case "sankaku":
show_type = "TypeSankaku";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_SANKAKU;
break;
case "tebata":
show_type = "TypeTebata";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_TEBATA;
break;
case "buzai":
show_type = "TypeBuzai";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_BUZAI;
break;
// 捨て看板
case "sutekan":
show_type = "TypeSutekan";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_SUTEKAN;
if($("input[name='payment_type']:checked").val() == "cash"){
$("input[name='payment_type']").attr("checked",false)
}
break;
// 両面のぼり
case "ryomen":
show_type = "TypeRyomen";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_RYOMEN;
break;
// 法被(はっぴ)
case "happi":
show_type = "TypeHappi";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_HAPPI;
break;
// タスキ・腕章
case "tasuki":
show_type = "TypeTasuki";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_TASUKI;
break;
// Pバナー
case "p_banner":
show_type = "TypeP-Banner";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_P_BANNER;
break;
// セイルバナー
case "sailbanner":
show_type = "TypeSailBanner";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_SAIL_BANNER;
break;
// 選挙看板
case "senkyo":
show_type = "TypeSenkyo";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_SENKYO;
if($("input[name='payment_type']:checked").val() == "cash"){
$("input[name='payment_type']").attr("checked",false)
}
break;
// 車用マグネットシート
case "magsheet":
show_type = "TypeMagsheet";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_MAGSHEET;
if($("input[name='payment_type']:checked").val() == "cash" && different){
$("input[name='payment_type']").attr("checked",false)
}
break;
// バックパネル
case "back_panel":
show_type = "TypeBackPanel";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_BACK_PANEL;
break;
default:
show_type = "TypeOudanmaku";
different = item_list[index] && (item_list[index][0] & CATEGORY_MASK) != CATEGORY_OUDANMAKU;//item_list[index][0] != TYPE_OUDANMAKU && item_list[index] != type;
if(different){
type = "pongee";
$("#oudanmaku_kind").val(oudanmaku_kind.indexOf(type)+1);
}
else if(item_list[index][3] != oudanmaku_kind[$("#oudanmaku_kind").find('option:selected').index()]){
type = item_list[index][3];
$("#oudanmaku_kind").val(oudanmaku_kind.indexOf(type)+1);
}
else{
type = oudanmaku_kind[$("#oudanmaku_kind").find('option:selected').index()];
}
$("#oudanmaku_kind").css({'background-color': $("#oudanmaku_kind").find('option:selected').css('background-color')});
oudanmaku_view_chng();
$("#FormTable").children("[data-type='TypeOudanmaku']").find(".prices td").each(function(){
var x = $(this).data("x");
var y = $(this).data("y");
var thr = 1;
if(item_list[index][12] && item_list[index][12] > 0){
_oudanmaku_num_tbl.some(function(v, i){
if(item_list[index][12] < v){
return true;
}
thr = v;
});
}
if(type == "tarpaulin"){
if(oudanmaku_prices_tarpaulin[thr][x] && oudanmaku_prices_tarpaulin[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_tarpaulin[thr][x][y]));
}
}
else if(type == "mesh-tarpaulin"){
if(oudanmaku_prices_mesh_tarpaulin[thr][x] && oudanmaku_prices_mesh_tarpaulin[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_mesh_tarpaulin[thr][x][y]));
}
}
else if(type == "both-tarpaulin"){
if(oudanmaku_prices_both_tarpaulin[thr][x] && oudanmaku_prices_both_tarpaulin[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_both_tarpaulin[thr][x][y]));
}
}
else if(type == "pongee"){
if(oudanmaku_prices_pongee[thr][x] && oudanmaku_prices_pongee[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_pongee[thr][x][y]));
}
}
else if(type == "tropical"){
if(oudanmaku_prices_tropical[thr][x] && oudanmaku_prices_tropical[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_tropical[thr][x][y]));
}
}
else if(type == "tro-mat"){
if(oudanmaku_prices_tromat[thr][x] && oudanmaku_prices_tromat[thr][x][y]){
$(this).children("span").text(separate(oudanmaku_prices_tromat[thr][x][y]));
}
}
else{
if(oudanmaku_prices[type][x] && oudanmaku_prices[type][x][y]){
$(this).children("span").text(separate(oudanmaku_prices[type][x][y]));
}
}
})
if(type == "tarpaulin"){
$("#FormTable").children("[data-type='TypeOudanmaku']").find(".prices .x1800").show();
} else {
$("#FormTable").children("[data-type='TypeOudanmaku']").find(".prices .x1800").hide();
}
/*
var i = 0;
$oudanmaku.find(".this_unit .unit_price_text").data("type", type);
var $units = $oudanmaku.find(".other_unit .unit_price_text");
if(type != "pongee") $units.eq(i++).html("ポンジ
の場合").data("type", "pongee");
if(type != "tropical") $units.eq(i++).html("トロピカル
の場合").data("type", "tropical");
if(type != "tro-mat") $units.eq(i++).html("トロマット
の場合").data("type", "tro-mat");
if(type != "tarpaulin") $units.eq(i++).html("ターポリン
の場合").data("type", "tarpaulin");
*/
break;
}
if(show_type == "TypeInfo"){
$("#Quotation").hide();
$("#NonInfoArea").hide();
} else {
$("#Quotation").show();
$("#NonInfoArea").show();
}
$("#FormTable").children("[data-type]").hide();
$("#FormTable").children("[data-type='" + show_type + "']").show();
$("[data-type='" + $(this).attr("id") + "']").show();
if(!trigger && (different !== undefined)){
if(item_list[index] && different){
var hit = false;
var row_cnt;
if(item_list.length < ROW_NUM){
row_cnt = ROW_NUM;
}
else{
row_cnt = item_list.length;
}
for(var i = 0; i < row_cnt; i++){
if(!item_list[i] || !item_list[i][0]){
index = i;
hit = true;
break;
}
}
if(!hit){
//delete item_list[index];
add_row();
index = item_list.length;
}
$("#TotalPrice .item").eq(index).click();
}
}
refresh();
});
// 見積書内項目クリック時イベント
$("#TotalPrice").on("click", ".item", function(){
if($(".OrderDecideTable").length){
return;
}
$("#TotalPrice .item").removeClass("active");
$(this).addClass("active");
var index = parseInt($(this).attr("data-index"));
var before_top = $("#TotalPrice").offset().top;
if(item_list[index] && item_list[index][0] > 0){
switch(item_list[index][0] & CATEGORY_MASK){
// のぼり
case CATEGORY_NOBORI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='nobori']").not("on").trigger("click", [true]);
break;
// ミニのぼり
case CATEGORY_MINI_NOBORI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='mini-nobori']").not("on").trigger("click", [true]);
break;
// シルクのぼり
case CATEGORY_SILK_NOBORI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='silk-nobori']").not("on").trigger("click", [true]);
break;
// 手旗
case CATEGORY_TEBATA:
$("#FormTable>thead .types>.sub_block>div>div[data-type='tebata']").not("on").trigger("click", [true]);
break;
// 三角旗
case CATEGORY_SANKAKU:
$("#FormTable>thead .types>.sub_block>div>div[data-type='sankaku']").not("on").trigger("click", [true]);
break;
// バナー
case CATEGORY_BANNER:
$("#FormTable>thead .types>.sub_block>div>div[data-type='banner']").not("on").trigger("click", [true]);
break;
// 部材
case CATEGORY_BUZAI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='buzai']").not("on").trigger("click", [true]);
break;
// 捨て看板
case CATEGORY_SUTEKAN:
$("#FormTable>thead .types>.sub_block>div>div[data-type='sutekan']").not("on").trigger("click", [true]);
break;
// 両面のぼり
case CATEGORY_RYOMEN:
$("#FormTable>thead .types>.sub_block>div>div[data-type='ryomen']").not("on").trigger("click", [true]);
break;
// 法被(はっぴ)
case CATEGORY_HAPPI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='happi']").not("on").trigger("click", [true]);
break;
// タスキ・腕章
case CATEGORY_TASUKI:
$("#FormTable>thead .types>.sub_block>div>div[data-type='tasuki']").not("on").trigger("click", [true]);
break;
// Pバナー
case CATEGORY_P_BANNER:
$("#FormTable>thead .types>.sub_block>div>div[data-type='p_banner']").not("on").trigger("click", [true]);
break;
// セイルバナー
case CATEGORY_SAIL_BANNER:
$("#FormTable>thead .types>.sub_block>div>div[data-type='sailbanner']").not("on").trigger("click", [true]);
break;
// 選挙用看板
case CATEGORY_SENKYO:
$("#FormTable>thead .types>.sub_block>div>div[data-type='senkyo']").not("on").trigger("click", [true]);
break;
// 車用マグネットシート
case CATEGORY_MAGSHEET:
$("#FormTable>thead .types>.sub_block>div>div[data-type='magsheet']").not("on").trigger("click", [true]);
break;
// 横断幕
case CATEGORY_OUDANMAKU:
$("#FormTable>thead .types>.sub_block>div>div[data-type='" + item_list[index][3] + "']").not("on").trigger("click", [true]);
break;
// バックパネル
case CATEGORY_BACK_PANEL:
$("#FormTable>thead .types>.sub_block>div>div[data-type='back_panel']").not("on").trigger("click", [true]);
break;
}
}
params_set();
$(window).scrollTop($(window).scrollTop() + $("#TotalPrice").offset().top - before_top);
})
// 追加ボタンによるスクロール
$("#TotalPrice").on("click", ".add", function(){
$('html,body').animate({scrollTop: $("#FormTable").offset().top}, 300);
var index = parseInt($(this).parent().parent().attr("data-index"));
var new_index = "";
//リスト内での空き場所を探索
for(var i=0; i < item_list.length; i++){
if($.isEmptyObject(item_list[i])){
new_index = i;
break;
}
}
if(new_index === ""){
new_index = item_list.length;
if(item_list.length >= ROW_NUM){
add_row();
}
}
});
// 削除ボタンによる削除
$("#TotalPrice").on("click", ".clear", function(){
var index = parseInt($(this).parent().parent().attr("data-index"));
$(this).parent().parent().children(".num").text("");
$(this).parent().parent().children(".number").text("");
// item_list.splice(index, 1); //削除
item_list[index] = [];//clear
// if(item_list.length > ROW_NUM){
// $("#TotalPrice .item.active").attr("data-index",index).remove();
// }
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_clear: 1,
list_no: index
}
}).done(function(text){
console.log(text);
}).fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1004]");
$("#ErrorPopup").popup();
})
//既存のプレビューを削除
$preview = $("#TotalPrice .item").eq(index).children(".chk_pic");
$preview.empty();
// .prevewの領域の中にロードした画像を表示するimageタグを追加
$preview.append($('').attr({
src: "css/image/prev_pic.png",
title: "no-image"
}));
/*
//空要素を削除
var st_idx=-1;
var end_idx=-1;
for(var i=0; i < item_list.length; i++){
if(jQuery.isEmptyObject(item_list[i])){
if(st_idx < 0){
st_idx = i;
}
end_idx = i;
}
else if(st_idx >= 0){
end_idx = i;
break;
}
}
if(st_idx != end_idx){
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_move: 1,
src_no: end_idx,
dis_no: st_idx
}
}).done(function(text){
console.log(text);
}).fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1005]");
$("#ErrorPopup").popup();
})
//既存のプレビューを削除
$preview_src = $("#TotalPrice .item").eq(end_idx).children(".chk_pic");
$preview_dis = $("#TotalPrice .item").eq(st_idx).children(".chk_pic");
$preview_dis.empty();
$preview_src.children("img").clone(true).appendTo($preview_dis);
$preview_src.empty();
// .prevewの領域の中にロードした画像を表示するimageタグを追加
$preview_src.append($('').attr({
src: "css/image/prev_pic.png",
title: "no-image"
}));
item_list.splice(st_idx, end_idx-st_idx); //削除
}
*/
params_set();
// refresh();
window.sessionStorage.setItem("data", JSON.stringify(item_list));
});
// カートクリアボタンによる削除
$("#Quotation").on("click", ".cartclr", function(){
if(item_list.length < ROW_NUM){
row_cnt = ROW_NUM;
}
else{
row_cnt = item_list.length;
}
for(var i = 0; i < row_cnt; i++){
//$("#TotalPrice .item").eq(i).children(".num").text("")
//$("#TotalPrice .item").eq(i).children(".number").text("")
item_list[i] = [];//clear
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_clear: 1,
list_no: i
}
}).done(function(text){
console.log(text);
}).fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1006]");
$("#ErrorPopup").popup();
})
//既存のプレビューを削除
$preview = $("#TotalPrice .item").eq(i).children(".chk_pic");
$preview.empty();
// .prevewの領域の中にロードした画像を表示するimageタグを追加
$preview.append($('').attr({
src: "css/image/prev_pic.png",
title: "no-image"
}));
}
params_set();
window.sessionStorage.setItem("data", JSON.stringify(item_list));
});
// コピーボタンによる追加
$("#TotalPrice").on("click", ".copy", function(){
var index = parseInt($(this).parent().parent().attr("data-index"));
var new_index = "";
//リスト内での空き場所を探索
for(var i=0; i < item_list.length; i++){
if($.isEmptyObject(item_list[i])){
new_index = i;
break;
}
}
if(new_index === ""){
new_index = item_list.length;
if(item_list.length >= ROW_NUM){
add_row();
}
}
item_list[new_index] = $.extend(true, [], item_list[index]);
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
list_copy: 1,
src_no:index,
dis_no:new_index
}
}).done(function(text){
console.log(text);
}).fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1007]");
$("#ErrorPopup").popup();
})
//コピー先のプレビューを追加
$preview_src = $("#TotalPrice .item").eq(index).children(".chk_pic");
$preview_dis = $("#TotalPrice .item").eq(new_index).children(".chk_pic");
$preview_dis.empty();
$preview_src.children("img").clone(true).appendTo($preview_dis);
window.sessionStorage.setItem("data", JSON.stringify(item_list));
});
// 入稿選択ボタン
$("#TotalPrice").on("click", ".draftchoice", function(){
if($(this).hasClass('draftdisabled')){
return;
}
$(this).parent().children("input[type='file']").trigger("click");
/* ## IEで1発目のChangeイベントを取得できないので、タグonchangeに移行(function draftChoiceChangeを参照)
$(this).parent().children("input[type='file']").click().on("change" , function(e) {
var index = parseInt($(this).parent().parent().attr("data-index"));
var file = e.target.files[0],
reader = new FileReader(),
$preview = $("#TotalPrice .item").eq(index).children(".chk_pic");
t = this;
//ファイルのアップロード
var fd = new FormData();
var file_tmp;
fd.append("file", file);
fd.append("draft_upload",1);
fd.append("submit",1);
fd.append("list_no",index);
$.ajax({
method: "POST",
dataType: "text",
processData: false,
contentType: false,
data: fd
}).done(function(text){
console.log(text);
if(text == "sent."){
$("#TotalPrice .item.active").find(".draftchoice").addClass("draftdisabled").text("アップロード済");
}
else{
$("#TotalPrice .item.active").find(".draftchoice").removeClass("draftdisabled").text("アップロード");
$("#TotalPrice .item.active").find("input[type='file']").replaceWith($("#TotalPrice .template").find("input[type='file']").clone());
$("#ErrorPopup").find("div").html("入稿データの取得に失敗しました。ファイルの容量等を見直してください。");
$("#ErrorPopup").popup();
}
}).fail(function(){
$("#ErrorPopup").find("div").html("入稿データの送信に失敗しました。ネットワーク状況をご確認ください。[code:1008]");
$("#ErrorPopup").popup();
});
});
*/
});
// 入稿クリアボタン
$("#TotalPrice").on("click", ".draftclear", function(){
var index = parseInt($(this).parent().parent().attr("data-index"));
$preview = $("#TotalPrice .item").eq(index).children(".chk_pic");
t = this;
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
draft_clear: 1,
list_no: index
}
}).done(function(text){
console.log(text);
$("#TotalPrice .item.active").find(".draftchoice").removeClass("draftdisabled").text("アップロード");
$("#TotalPrice .item.active").find("input[type='file']").replaceWith($("#TotalPrice .template").find("input[type='file']").clone());
}).fail(function(){
$("#ErrorPopup").find("div").html("エラーが発生しました。ネットワーク状況をご確認ください。[code:1009]");
$("#ErrorPopup").popup();
})
});
// 入稿送信ボタン
$("#PriceTable").on("click", "#draft_submit", function(){
var button_text = $(this).val();
var $button = $(this);
$button.prop("disabled", true).val("送信中...");
$("#MessagePopup").find("div").html("ご入稿データを送信中です。
しばらくお待ちください。");
$("#MessagePopup").popup();
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
draft_submit: 1
}
}).done(function(text){
console.log(text);
// ページ離脱イベントを削除
$(window).off('beforeunload', "");
location.href='thanks.html';
}).fail(function(){
$("#MessagePopup").find("div").html("ただいまシステムに障害が発生しております。
お不便おかけいたしますが、お見積もりフォームよりお見積りをご請求ください。
ErrorCode:0010");
$("#MessagePopup").popup();
})
.always(function(){
$button.prop("disabled", false).val(button_text);
params_set();
})
});
// 行追加
for(var i = 0; i < ROW_NUM; i++){
add_row();
}
$("#TotalPrice .item").eq(0).click();
// のぼり属性選択イベント
$("#SettingArea_Nobori .size1").click(function(){ params_set({0: 1}) })
$("#SettingArea_Nobori .size2").click(function(){ params_set({0: 2}) })
$("#SettingArea_Nobori .size3").click(function(){ params_set({0: 3}) })
$("#SettingArea_Nobori .size4").click(function(){ params_set({0: 4}) })
// $("#SettingArea_Nobori .size5").click(function(){ params_set({0: 5}) })
$("#SettingArea_Nobori .size6").click(function(){ params_set({0: 6}) })
$("#SettingArea_Nobori .shape1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Nobori .shape2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Nobori .shape3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Nobori .shape4").click(function(){ params_set({1: 4}) })
$("#SettingArea_Nobori .pocket1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Nobori .pocket2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Nobori .pocket3").click(function(){ params_set({2: 3}) })
$("#SettingArea_Nobori .pokedir1").click(function(){ params_set({3: 1}) })
$("#SettingArea_Nobori .pokedir2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Nobori .sew1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Nobori .sew2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Nobori .sew3").click(function(){ params_set({4: 3}) })
$("#SettingArea_Nobori .sew4").click(function(){ params_set({4: 4}) })
$("#SettingArea_Nobori .sew5").click(function(){ params_set({4: 5}) })
$("#SettingArea_Nobori .fire1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Nobori .fire2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Nobori .material1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Nobori .material2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Nobori .bag1").click(function(){ params_set({7: 1}) })
$("#SettingArea_Nobori .bag2").click(function(){ params_set({7: 2}) })
$("#SettingArea_Nobori .delivery1").click(function(){ params_set({8: 1}) })
$("#SettingArea_Nobori .delivery2").click(function(){ params_set({8: 2}) })
$("#SettingArea_Nobori .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({9: num})
refresh();
})
$("#SettingArea_Nobori .textw").change( function() {
params_set({11:$(this).val()});
})
$("#SettingArea_Nobori .texth").change( function() {
params_set({12:$(this).val()});
})
$("#ClrCmpSettingArea_Nobori .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Nobori .colorcmp2").click(function(){ params_set({30: 2}) })
$("#SettingArea_Mini .size1").click(function(){ params_set({0: 0x11}) })
$("#SettingArea_Mini .size2").click(function(){ params_set({0: 0x12}) })
$("#SettingArea_Mini .size3").click(function(){ params_set({0: 0x13}) })
$("#SettingArea_Mini .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Mini .material2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Mini .material3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Mini .pocket1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Mini .pocket2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Mini .element1").click(function(){ params_set({3: 1}) })
$("#SettingArea_Mini .element2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Mini .element3").click(function(){ params_set({3: 3}) })
$("#SettingArea_Mini .element4").click(function(){ params_set({3: 4}) })
$("#SettingArea_Mini .element5").click(function(){ params_set({3: 5}) })
$("#SettingArea_Mini .element6").click(function(){ params_set({3: 6}) })
$("#SettingArea_Mini .bag1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Mini .bag3").click(function(){ params_set({4: 3}) })
$("#SettingArea_Mini .delivery2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Mini .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({6: num})
refresh();
})
$("#ClrCmpSettingArea_Mini .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Mini .colorcmp2").click(function(){ params_set({30: 2}) })
$("#SettingArea_Silk .size1").click(function(){ params_set({0: 0x21}) })
$("#SettingArea_Silk .size2").click(function(){ params_set({0: 0x22}) })
$("#SettingArea_Silk .size3").click(function(){ params_set({0: 0x23}) })
$("#SettingArea_Silk .color1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Silk .color2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Silk .color3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Silk .color4").click(function(){ params_set({1: 4}) })
$("#SettingArea_Silk .color5").click(function(){ params_set({1: 5}) })
$("#SettingArea_Silk .sew1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Silk .sew2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Silk .sew3").click(function(){ params_set({2: 3}) })
$("#SettingArea_Silk .sew4").click(function(){ params_set({2: 4}) })
$("#SettingArea_Silk .pokedir1").click(function(){ params_set({3: 1}) })
$("#SettingArea_Silk .pokedir2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Silk .delivery2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Silk .fire1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Silk .fire2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Silk .bag1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Silk .bag2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Silk .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({7: num})
refresh();
})
$("#SettingArea_Sankaku .size1").click(function(){ params_set({0: 0x31}) })
$("#SettingArea_Sankaku .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Sankaku .cap1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Sankaku .cap2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Sankaku .pole1").click(function(){ params_set({3: 1}) })
$("#SettingArea_Sankaku .pole2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Sankaku .poledir1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Sankaku .poledir2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Sankaku .sew2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Sankaku .bag1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Sankaku .bag2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Sankaku .delivery2").click(function(){ params_set({7: 2}) })
$("#SettingArea_Sankaku .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({8: num})
refresh();
})
$("#ClrCmpSettingArea_Sankaku .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Sankaku .colorcmp2").click(function(){ params_set({30: 2}) })
$("#SettingArea_Banner .size1").click(function(){ params_set({0: 0x41}) })
$("#SettingArea_Banner .size2").click(function(){ params_set({0: 0x42}) })
$("#SettingArea_Banner .size3").click(function(){ params_set({0: 0x43}) })
$("#SettingArea_Banner .stand_kind1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Banner .stand_kind2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Banner .stand_kind3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Banner .material1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Banner .material2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Banner .material3").click(function(){ params_set({2: 3}) })
$("#SettingArea_Banner .sew2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Banner .delivery2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Banner .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({5: num})
refresh();
})
$("#ClrCmpSettingArea_Banner .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Banner .colorcmp2").click(function(){ params_set({30: 2}) })
$("#SettingArea_Tebata .size1").click(function(){ params_set({0: 0x51}) })
$("#SettingArea_Tebata .size2").click(function(){ params_set({0: 0x52}) })
$("#SettingArea_Tebata .size3").click(function(){ params_set({0: 0x53}) })
$("#SettingArea_Tebata .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Tebata .stick1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Tebata .stick2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Tebata .sew2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Tebata .bag1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Tebata .bag2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Tebata .delivery2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Tebata .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({6: num})
refresh();
})
$("#ClrCmpSettingArea_Tebata .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Tebata .colorcmp2").click(function(){ params_set({30: 2}) })
/* クリックイベント(捨て看板) */
/* var _index_name_sutekan = ["product", "size", "custom_w", "custom_h", "custom_l", "material", "delivery"]; */
$("#SettingArea_Sutekan .product1").click(function(){ params_set({0: 0x71}) })
$("#SettingArea_Sutekan .product2").click(function(){ params_set({0: 0x72}) })
$("#SettingArea_Sutekan .product3").click(function(){ params_set({0: 0x73}) })
$("#SettingArea_Sutekan .size1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Sutekan .size2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Sutekan .size3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Sutekan .size4").click(function(){ params_set({1: 4}) })
$("#SettingArea_Sutekan .size5").click(function(){ params_set({1: 5}) })
$("#SettingArea_Sutekan .size5_w").change( function() {
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({2: num});
})
$("#SettingArea_Sutekan .size5_h").change( function() {
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({3: num});
})
$("#SettingArea_Sutekan .size5_l").change( function() {
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({4: num});
})
$("#SettingArea_Sutekan .material1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Sutekan .material2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Sutekan .rope1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Sutekan .rope2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Sutekan .rope3").click(function(){ params_set({6: 3}) })
$("#SettingArea_Sutekan .bag1").click(function(){ params_set({7: 1}) })
$("#SettingArea_Sutekan .bag2").click(function(){ params_set({7: 2}) })
$("#SettingArea_Sutekan .delivery1").click(function(){ params_set({8: 1}) })
$("#SettingArea_Sutekan .delivery2").click(function(){ params_set({8: 2}) })
$("#SettingArea_Sutekan .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({9: num})
refresh();
})
$("#ClrCmpSettingArea_Sutekan .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Sutekan .colorcmp2").click(function(){ params_set({30: 2}) })
/* クリックイベント(両面のぼり) */
$("#SettingArea_Ryomen .size1").click(function(){ params_set({0: 0x81}) })
$("#SettingArea_Ryomen .size2").click(function(){ params_set({0: 0x82}) })
$("#SettingArea_Ryomen .size3").click(function(){ params_set({0: 0x83}) })
$("#SettingArea_Ryomen .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Ryomen .material2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Ryomen .pocket1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Ryomen .pocket2").click(function(){ params_set({2: 2}) })
$("#SettingArea_Ryomen .pokedir1").click(function(){ params_set({3: 1}) })
$("#SettingArea_Ryomen .pokedir2").click(function(){ params_set({3: 2}) })
$("#SettingArea_Ryomen .pokedir3").click(function(){ params_set({3: 3}) })
$("#SettingArea_Ryomen .sew1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Ryomen .sew2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Ryomen .sew3").click(function(){ params_set({4: 3}) })
$("#SettingArea_Ryomen .sew4").click(function(){ params_set({4: 4}) })
$("#SettingArea_Ryomen .sew5").click(function(){ params_set({4: 5}) })
$("#SettingArea_Ryomen .fire1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Ryomen .fire2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Ryomen .bag1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Ryomen .bag2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Ryomen .delivery1").click(function(){ params_set({7: 1}) })
$("#SettingArea_Ryomen .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({8: num})
refresh();
})
/* クリックイベント(法被(はっぴ)) */
$("#SettingArea_Happi .size1").click(function(){ params_set({0: 0x91}) })
$("#SettingArea_Happi .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Happi .material2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Happi .material3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Happi .delivery1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Happi .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({3: num})
refresh();
})
$("#ClrCmpSettingArea_Happi .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Happi .colorcmp2").click(function(){ params_set({30: 2}) })
/* クリックイベント(タスキ・腕章) */
$("#SettingArea_Tasuki .size1").click(function(){ params_set({0: 0xA1}) })
$("#SettingArea_Tasuki .size2").click(function(){ params_set({0: 0xA2}) })
$("#SettingArea_Tasuki .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Tasuki .delivery1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Tasuki .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({3: num})
refresh();
})
$("#ClrCmpSettingArea_Tasuki .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Tasuki .colorcmp2").click(function(){ params_set({30: 2}) })
/* クリックイベント(Pバナー) */
$("#SettingArea_P_Banner .size1").click(function(){ params_set({0: 0xB1}) })
$("#SettingArea_P_Banner .size2").click(function(){ params_set({0: 0xB2}) })
$("#SettingArea_P_Banner .size3").click(function(){ params_set({0: 0xB3}) })
$("#SettingArea_P_Banner .size4").click(function(){ params_set({0: 0xB4}) })
$("#SettingArea_P_Banner .buzai1").click(function(){ params_set({1: 1}) })
$("#SettingArea_P_Banner .buzai2").click(function(){ params_set({1: 2}) })
$("#SettingArea_P_Banner .buzai3").click(function(){ params_set({1: 3}) })
$("#SettingArea_P_Banner .fire1").click(function(){ params_set({2: 1}) })
$("#SettingArea_P_Banner .fire2").click(function(){ params_set({2: 2}) })
$("#SettingArea_P_Banner .bag1").click(function(){ params_set({3: 1}) })
$("#SettingArea_P_Banner .bag2").click(function(){ params_set({3: 2}) })
//4:material 5:sew 6:course
$("#SettingArea_P_Banner .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({7: num})
refresh();
})
$("#ClrCmpSettingArea_P-Banner .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_P-Banner .colorcmp2").click(function(){ params_set({30: 2}) })
/* クリックイベント(セイルバナー) */
$("#SettingArea_SailBanner .size1").click(function(){ params_set({0: 0xC1}) })
$("#SettingArea_SailBanner .size2").click(function(){ params_set({0: 0xC2}) })
$("#SettingArea_SailBanner .size3").click(function(){ params_set({0: 0xC3}) })
$("#SettingArea_SailBanner .buzai1").click(function(){ params_set({1: 1}) })
$("#SettingArea_SailBanner .buzai2").click(function(){ params_set({1: 2}) })
$("#SettingArea_SailBanner .buzai3").click(function(){ params_set({1: 3}) })
$("#SettingArea_SailBanner .fire1").click(function(){ params_set({2: 1}) })
$("#SettingArea_SailBanner .fire2").click(function(){ params_set({2: 2}) })
$("#SettingArea_SailBanner .bag1").click(function(){ params_set({3: 1}) })
$("#SettingArea_SailBanner .bag2").click(function(){ params_set({3: 2}) })
//4:material 5:sew 6:course
$("#SettingArea_SailBanner .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({7: num})
refresh();
})
$("#ClrCmpSettingArea_SailBanner .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_SailBanner .colorcmp2").click(function(){ params_set({30: 2}) })
/* 選挙看板 */
$("#SettingArea_Senkyo .size1").click(function(){ params_set({0: 0xD1}) })
$("#SettingArea_Senkyo .material1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Senkyo .material2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Senkyo .material3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Senkyo .delivery1").click(function(){ params_set({2: 1}) })
$("#SettingArea_Senkyo .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({3: num})
refresh();
})
$("#ClrCmpSettingArea_Senkyo .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Senkyo .colorcmp2").click(function(){ params_set({30: 2}) })
/* 車用マグネットシート */
$(".SettingArea_Magsheet .material1").click(function(){ params_set({0: 0xE1}) })
$(".SettingArea_Magsheet .material2").click(function(){ params_set({0: 0xE2}) })
$(".SettingArea_Magsheet .processing1").click(function(){ params_set({1: 1}) })
$(".SettingArea_Magsheet .processing2").click(function(){ params_set({1: 2}) })
$(".SettingArea_Magsheet .shape1").click(function(){ params_set({4: 1}) })
$(".SettingArea_Magsheet .shape2").click(function(){ params_set({4: 2}) })
$(".SettingArea_Magsheet .shape3").click(function(){ params_set({4: 3}) })
$(".SettingArea_Magsheet .delivery1").click(function(){ params_set({5: 1}) })
$(".SettingArea_Magsheet .delivery2").click(function(){ params_set({5: 2}) })
$(".SettingArea_Magsheet .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({6: num})
refresh();
})
$("#ClrCmpSettingArea_Magsheet .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Magsheet .colorcmp2").click(function(){ params_set({30: 2}) })
// マグネットシートサイズ変更
$("#magsheet_size_1, #magsheet_size_2").change(function(){
// if($("#magsheet_size_1").val() == "" || $("#magsheet_size_2").val() == "") return;
var index = $("#TotalPrice .item.active").attr("data-index");
size_1 = parseInt($("#magsheet_size_1").val());
size_2 = parseInt($("#magsheet_size_2").val());
$("#magsheet_size_1").val(size_1);
$("#magsheet_size_2").val(size_2);
if($("#magsheet_size_sel_l").val() == "width"){
set_x = size_1;
set_y = size_2;
}
else{
set_x = size_2;
set_y = size_1;
}
item_list[index][2] = set_x;
item_list[index][3] = set_y;
params_set();
})
// マグネットシート縦横変更
$("#magsheet_size_sel_l, #magsheet_size_sel_r").change(function(){
var val_tmp;
var index = $("#TotalPrice .item.active").attr("data-index");
if($(this).val() == "width"){
val_tmp = "height";
}
else{
val_tmp = "width";
}
if($(this).attr("id") == "magsheet_size_sel_l"){
$("#magsheet_size_sel_r").val(val_tmp);
if( val_tmp == "height" ){
item_list[index][2] = parseInt($("#magsheet_size_1").val(),10);
item_list[index][3] = parseInt($("#magsheet_size_2").val(),10);
}
else{
item_list[index][2] = parseInt($("#magsheet_size_2").val(),10);
item_list[index][3] = parseInt($("#magsheet_size_1").val(),10);
}
}
else{
$("#magsheet_size_sel_l").val(val_tmp);
if( val_tmp == "height" ){
item_list[index][2] = parseInt($("#magsheet_size_2").val(),10);
item_list[index][3] = parseInt($("#magsheet_size_1").val(),10);
}
else{
item_list[index][2] = parseInt($("#magsheet_size_1").val(),10);
item_list[index][3] = parseInt($("#magsheet_size_2").val(),10);
}
}
params_set();
})
/* クリックイベント(バックパネル) */
$("#SettingArea_Back_Panel .product1").click(function(){ params_set({0: 0x301}) })
$("#SettingArea_Back_Panel .product2").click(function(){ params_set({0: 0x302}) })
$("#SettingArea_Back_Panel .product3").click(function(){ params_set({0: 0x303}) })
$("#SettingArea_Back_Panel .product4").click(function(){ params_set({0: 0x304}) })
$("#SettingArea_Back_Panel .size1").click(function(){ params_set({1: 1}) })
$("#SettingArea_Back_Panel .size2").click(function(){ params_set({1: 2}) })
$("#SettingArea_Back_Panel .size3").click(function(){ params_set({1: 3}) })
$("#SettingArea_Back_Panel .size4").click(function(){ params_set({1: 4}) })
$("#SettingArea_Back_Panel .size5").click(function(){ params_set({1: 5}) })
$("#SettingArea_Back_Panel .size6").click(function(){ params_set({1: 6}) })
$("#SettingArea_Back_Panel .size7").click(function(){ params_set({1: 7}) })
$("#SettingArea_Back_Panel .size8").click(function(){ params_set({1: 8}) })
$("#SettingArea_Back_Panel .weight.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({1: 1, 2: 1, 3: num});
refresh();
})
$("#SettingArea_Back_Panel .water_weight.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({1: 1, 2: 2, 3: num});
refresh();
})
$("#SettingArea_Back_Panel .cube_weight.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({1: 1, 2: 3, 3: num});
refresh();
})
$("#SettingArea_Back_Panel .case.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({1: 1, 2: 4, 3: num});
refresh();
})
$("#SettingArea_Back_Panel .side1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Back_Panel .side2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Back_Panel .joint1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Back_Panel .joint2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Back_Panel .fire1").click(function(){ params_set({7: 1}) })
$("#SettingArea_Back_Panel .fire2").click(function(){ params_set({7: 2}) })
$("#SettingArea_Back_Panel .delivery1").click(function(){ params_set({8: 1}) })
$("#SettingArea_Back_Panel .delivery2").click(function(){ params_set({8: 2}) })
$("#SettingArea_Back_Panel .order.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({9: num})
refresh();
})
$("#ClrCmpSettingArea_Back_Panel .colorcmp1").click(function(){ params_set({30: 1}) })
$("#ClrCmpSettingArea_Back_Panel .colorcmp2").click(function(){ params_set({30: 2}) })
$("#SettingArea_Buzai .pole1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 1, 2: num})
refresh();
})
$("#SettingArea_Buzai .pole2.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 2, 2: num})
refresh();
})
$("#SettingArea_Buzai .pole3.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 3, 2: num})
refresh();
})
$("#SettingArea_Buzai .pole4.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 17, 2: num})
refresh();
})
$("#SettingArea_Buzai .base1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 4, 2: num})
refresh();
})
$("#SettingArea_Buzai .base2 input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 5, 2: num})
refresh();
})
$("#SettingArea_Buzai .base3 input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 6, 2: num})
refresh();
})
$("#SettingArea_Buzai .base4 input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 7, 2: num})
refresh();
})
$("#SettingArea_Buzai .base5 input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 8, 2: num})
refresh();
})
$("#SettingArea_Buzai .crossbar1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 9, 2: num})
refresh();
})
$("#SettingArea_Buzai .crossbar2.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 10, 2: num})
refresh();
})
$("#SettingArea_Buzai .crossbar3.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 11, 2: num})
refresh();
})
$("#SettingArea_Buzai .corerod1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 12, 2: num})
refresh();
})
$("#SettingArea_Buzai .corerod2.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 13, 2: num})
refresh();
})
$("#SettingArea_Buzai .corerod3.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 14, 2: num})
refresh();
})
$("#SettingArea_Buzai .hacker1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 15, 2: num})
refresh();
})
$("#SettingArea_Buzai .boll1.num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({0: 0x60, 1: 16, 2: num})
refresh();
})
$("#SettingArea_Oudanmaku .sew1").click(function(){ params_set({4: 1}) })
$("#SettingArea_Oudanmaku .sew2").click(function(){ params_set({4: 2}) })
$("#SettingArea_Oudanmaku .sew3").click(function(){ params_set({4: 3}) })
$("#SettingArea_Oudanmaku .sew4").click(function(){ params_set({4: 4}) })
$("#SettingArea_Oudanmaku .sew5").click(function(){ params_set({4: 5}) })
$("#SettingArea_Oudanmaku .sew6").click(function(){ params_set({4: 6}) })
$("#SettingArea_Oudanmaku .sew7").click(function(){ params_set({4: 7}) })
$("#SettingArea_Oudanmaku .cut1").click(function(){ params_set({5: 1}) })
$("#SettingArea_Oudanmaku .cut2").click(function(){ params_set({5: 2}) })
$("#SettingArea_Oudanmaku .eyelet1").click(function(){ params_set({6: 1}) })
$("#SettingArea_Oudanmaku .eyelet2").click(function(){ params_set({6: 2}) })
$("#SettingArea_Oudanmaku .eyelet_dir1").click(function(){ params_set({7: 1}) })
$("#SettingArea_Oudanmaku .eyelet_dir2").click(function(){ params_set({7: 2}) })
$("#SettingArea_Oudanmaku .hole1").click(function(){ params_set({8: 1}) })
$("#SettingArea_Oudanmaku .hole2").click(function(){ params_set({8: 2}) })
$("#SettingArea_Oudanmaku #oudanmaku_holenum").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({9: num});
})
$("#SettingArea_Oudanmaku .fire1").click(function(){ params_set({10: 1}) })
$("#SettingArea_Oudanmaku .fire2").click(function(){ params_set({10: 2}) })
$("#SettingArea_Oudanmaku .colorcmp1").click(function(){ params_set({11: 1}) })
$("#SettingArea_Oudanmaku .colorcmp2").click(function(){ params_set({11: 2}) })
$("#SettingArea_Oudanmaku .num input").on("keyup change", function(){
var num = parseInt($(this).val().replace(/,/g, ""), 10);
num = num > 0 ? num : 0;
params_set({12: num})
//price table change
$("#FormTable>thead .types>.sub_block>div>div[data-type=oudanmaku]").trigger("click",[true]);
refresh();
})
// 横断幕価格表クリック
var $oudanmaku_price_popup = null;
$oudanmaku.find(".prices td.num").on({
mousemove: function(e){
var offset = $(this).offset();
var $balloon = $("#OudanmakuPriceBalloon").show().css({
left: e.pageX + 10,
top : e.pageY + 10
})
$balloon.find(".x").text($(this).data("x"));
$balloon.find(".y").text($(this).data("y"));
$balloon.find(".price").text($(this).children("span").text());
},
mouseout: function(){
$("#OudanmakuPriceBalloon").hide();
},
click: function(){
// var type = $("#FormTable").find("thead .types>div.on").data("type");
var type = oudanmaku_kind[$("#oudanmaku_kind").find('option:selected').index()];
var index = $("#TotalPrice .item.active").attr("data-index");
$(this).closest("table").find("td.active").removeClass("active");
$(this).addClass("active");
var price;
var x = $(this).data("x");
var y = $(this).data("y");
$("#oudanmaku_size_sel_l").val("width");
$("#oudanmaku_size_sel_r").val("height");
$("#oudanmaku_size_1").val(x);
$("#oudanmaku_size_2").val(y);
if(type == "tarpaulin"){
price_tbl = oudanmaku_prices_tarpaulin;
}
else if(type == "mesh-tarpaulin"){
price_tbl = oudanmaku_prices_mesh_tarpaulin;
}
else if(type == "both-tarpaulin"){
price_tbl = oudanmaku_prices_both_tarpaulin;
}
else if(type == "pongee"){
price_tbl = oudanmaku_prices_pongee;
}
else if(type == "tropical"){
price_tbl = oudanmaku_prices_tropical;
}
else if(type == "tro-mat"){
price_tbl = oudanmaku_prices_tromat;
}
if(type == "tarpaulin" || type == "mesh-tarpaulin" || type == "both-tarpaulin"
|| type == "pongee" || type == "tropical" || type == "tro-mat"){
var thr = 1;
if(item_list[index][12] && item_list[index][12] > 0){
_oudanmaku_num_tbl.some(function(v, i){
if(item_list[index][12] < v){
return true;
}
thr = v;
});
}
price = price_tbl[thr][x][y];
$oudanmaku.find(".this_unit .unit_price").text(separate(price)).data("price", price);
$oudanmaku.find(".other_unit .unit_price_text").each(function(){
var xs = price_tbl[thr][x];
price = xs ? xs[y] : undefined;
if(price !== undefined){
$(this).next().text(separate(price)).data("price", price);
} else {
$(this).next().text("-").data("price", 0);
}
})
}
else{
price = oudanmaku_prices[type][x][y];
$oudanmaku.find(".this_unit .unit_price").text(separate(price)).data("price", price);
$oudanmaku.find(".other_unit .unit_price_text").each(function(){
var xs = oudanmaku_prices[$(this).data("type")][x];
price = xs ? xs[y] : undefined;
if(price !== undefined){
$(this).next().text(separate(price)).data("price", price);
} else {
$(this).next().text("-").data("price", 0);
}
})
}
// var quantity = oudanmaku_recalc();
item_list[index][0] = TYPE_OUDANMAKU;
item_list[index][1] = x;
item_list[index][2] = y;
item_list[index][3] = type;
// item_list[index][4] = quantity;
params_set();
}
});
// 横断幕サイズ変更
$("#oudanmaku_size_1,#oudanmaku_size_2").change(function(){
if($("#oudanmaku_size_1").val() == "" || $("#oudanmaku_size_2").val() == "") return;
var type = oudanmaku_kind[$("#oudanmaku_kind").find('option:selected').index()];
var index = $("#TotalPrice .item.active").attr("data-index");
$oudanmaku.find(".prices td.num").closest("table").find("td.active").removeClass("active");
if($("#oudanmaku_size_sel_l").val() == "width"){
set_x = parseInt($("#oudanmaku_size_1").val(),10);
set_y = parseInt($("#oudanmaku_size_2").val(),10);
}
else{
set_y = $("#oudanmaku_size_1").val();
set_x = $("#oudanmaku_size_2").val();
}
item_list[index][0] = TYPE_OUDANMAKU;
item_list[index][1] = set_x;
item_list[index][2] = set_y;
item_list[index][3] = type;
params_set();
})
// 横断幕縦横変更
$("#oudanmaku_size_sel_l, #oudanmaku_size_sel_r").change(function(){
var val_tmp;
var index = $("#TotalPrice .item.active").attr("data-index");
if($(this).val() == "width"){
val_tmp = "height";
}
else{
val_tmp = "width";
}
if($(this).attr("id") == "oudanmaku_size_sel_l"){
$("#oudanmaku_size_sel_r").val(val_tmp);
if( val_tmp == "height" ){
item_list[index][1] = parseInt($("#oudanmaku_size_1").val(),10);;
item_list[index][2] = parseInt($("#oudanmaku_size_2").val(),10);;
}
else{
item_list[index][1] = parseInt($("#oudanmaku_size_2").val(),10);;
item_list[index][2] = parseInt($("#oudanmaku_size_1").val(),10);;
}
}
else{
$("#oudanmaku_size_sel_l").val(val_tmp);
if( val_tmp == "height" ){
item_list[index][1] = parseInt($("#oudanmaku_size_2").val(),10);;
item_list[index][2] = parseInt($("#oudanmaku_size_1").val(),10);;
}
else{
item_list[index][1] = parseInt($("#oudanmaku_size_1").val(),10);;
item_list[index][2] = parseInt($("#oudanmaku_size_2").val(),10);;
}
}
params_set();
})
// 横断幕数量入力
// $oudanmaku.find("input.quantity").on("keydown keyup change", function(){
// var num = parseInt($(this).val().split(",").join(""))
// if(!(num > 0)) num = 0;
//
// $oudanmaku.find(".other_unit .quantity").text(separate(num)).data("quantity", num);
// oudanmaku_recalc();
// });
// 横断幕追加
$oudanmaku.find("input.add").click(function(){
var quantity = null;
// if(quantity = oudanmaku_recalc()){
var index = $("#TotalPrice .item.active").attr("data-index");
if(item_list[index] === undefined || item_list[index] === null) item_list[index] = [];
var $active_size = $(this).closest("table").find("td.active");
item_list[index][0] = TYPE_OUDANMAKU;
item_list[index][1] = $active_size.data("x");
item_list[index][2] = $active_size.data("y");
item_list[index][3] = $(this).prev().find(".unit_price_text").data("type");
// item_list[index][4] = quantity;
refresh();
// }
})
//横断幕ポップアップ
$("#Oudanmaku_Sew_Clk").click(function(){$("#OudanmakuPopup_Sew").popup({closeButton: false,header:false}) });
$("#Oudanmaku_Eyelet_Clk").click(function(){$("#OudanmakuPopup_Eyelet").popup({closeButton: false,header:false}) });
$("#Oudanmaku_Bag_Clk").click(function(){$("#OudanmakuPopup_Bag").popup({closeButton: false,header:false}) });
//捨て看板ポップアップ
$("#Sutekan_Bag_Clk").click(function(){$("#SutekanPopup_Bag").popup({closeButton: false,header:false}) });
//バックパネルポップアップ
$("#Back_Panel_Bag_Clk").click(function(){$("#Back_PanelPopup_Bag").popup({closeButton: false,header:false}) });
$("#Back_Panel_Joint_Clk").click(function(){$("#Back_PanelPopup_Joint").popup({closeButton: false,header:false}) });
// 都道府県選択
$("select.prefecture").change(function(){
var val = $(this).val();
$("select.prefecture").val(val);
refresh();
})
// 初期化
params_set({0: null});
// 見積書作成ボタン
$("#est_btn").click(function(){
var errors = [];
if($("select.prefecture" ).val() == 0) errors.push("送り先を選択してください。");
if($("#PostForm [name='company']" ).val().length == 0) errors.push("会社名を入力してください。");
// if($("#PostForm [name='name']" ).val().length == 0) errors.push("ご担当者様名を入力してください。");
// if($("#PostForm [name='telephone']" ).val().length == 0) errors.push("電話番号を入力してください。");
if(!$("#PostForm [name='mail']").val().match(/.+@.+\..+/)) errors.push("メールアドレスを入力してください。");
if(!$('input[name=payment_type]:eq(0)').prop('checked')
&& !$('input[name=payment_type]:eq(1)').prop('checked')
&& !$('input[name=payment_type]:eq(2)').prop('checked')
&& !$('input[name=payment_type]:eq(3)').prop('checked')
&& !$('input[name=payment_type]:eq(4)').prop('checked')
){
errors.push("支払い方法を選択してください。");
}
//if(!(parseInt($("#TotalPrice .total .price").text().replace(/,/g, ""), 10) > 0)) errors.push("ご依頼の商品を1枚以上選択してください。");
if(!(parseInt($("#TotalPrice .total .price").text().replace(/,/g, ""), 10) > 0)
&& $("#TotalPrice .total .price").text().indexOf('別途') == -1){
errors.push("ご依頼の商品を1枚以上選択してください。");
}
if(errors.length){
$("#ErrorPopup").find("div").html(errors.join("
"));
$("#ErrorPopup").popup();
return false;
} else {
var button_text = $(this).val();
var $button = $(this);
$button.prop("disabled", true).val("作成中...");
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
data: JSON.stringify(item_list),
data_word: JSON.stringify(item_list_word),
order_price: JSON.stringify(order_price),
prefecture: $("select.prefecture").val(),
company: $("#PostForm [name='company']").val(),
mail: $("#PostForm [name='mail']").val(),
// name: $("#PostForm [name='name']").val(),
// telephone: $("#PostForm [name='telephone']").val()
payment: $("input[name=payment_type]:checked").val()
}
})
.fail(function(){
$("#ErrorPopup").find("div").html("お見積書の送信に失敗しました。ネットワーク状況をご確認ください。[code:1010]");
$("#ErrorPopup").popup();
})
.done(function(data){
if(data == "sent."){
$("#MessagePopup").find("div").html("お客様のメールアドレスにお見積書を送信いたしました。");
} else {
console.log(data);
$("#MessagePopup").find("div").html("ただいま見積りシステムに障害が発生しております。
お不便おかけいたしますが、お見積もりフォームよりお見積りをご請求ください。");
}
$("#MessagePopup").popup();
})
.always(function(){
$button.prop("disabled", false).val(button_text);
params_set();
})
}
})
$("#PreviewCompany>div").width($("#PreviewCompany>div").width());
$("#PreviewName>div").width($("#PreviewName>div").width());
$("#PostForm [name='company']").on("keydown keyup change", function(){
$("#PreviewCompany>div").text($("#PostForm [name='company']").val());
});
$("#PostForm [name='name']").on("keydown keyup change", function(){
$("#PreviewName>div").text($("#PostForm [name='name']").val());
});
$("#ErrorPopup").find("input[type='button']").click(function(){ $(this).popupClose(); });
$("#MessagePopup").find("input[type='button']").click(function(){ $(this).popupClose(); });
$("#OrderDecidePopup").find("input[type='button']").click(function(){
$(this).popupClose();
//入稿画面に遷移
location.href='draft.html';
});
$("#NotesArea").find("input[type='button']").click(function(){
$("#est_form").hide();
$("#order_form").show();
$('#note_agree').prop('checked',true);
$(this).popupClose();
});
// 画像クリック
$(document).on('click', function(event) {
if ($(event.target).closest('.img_wrng').length) {
if(event.offsetX > 0 && event.offsetX < 30
&& event.offsetY > 30 && event.offsetY < 60){
$('.img_wrng').hide();
}
}
else if($(event.target).closest('#est_action').length) {
// $("#est_form").show("slow");
$("#est_form").fadeIn(700);
$("#order_form").hide();
}
else if($(event.target).closest('#order_action').length) {
if($('#order_form').is(':visible')){
var errors = [];
if($("select.prefecture" ).val() == 0) errors.push("送り先を選択してください。");
if(!$('input[name=payment_type]:eq(0)').prop('checked')
&& !$('input[name=payment_type]:eq(1)').prop('checked')
&& !$('input[name=payment_type]:eq(2)').prop('checked')
&& !$('input[name=payment_type]:eq(3)').prop('checked')
&& !$('input[name=payment_type]:eq(4)').prop('checked')
){
errors.push("支払い方法を選択してください。");
}
var row_cnt = item_list.length < ROW_NUM ? ROW_NUM : item_list.length;
var err_msg = 0;
for(var index = 0; index < row_cnt; index++){
if($("#TotalPrice .item").eq(index).children(".name").text()){
// && !$("#TotalPrice .item").eq(index).children(".price").text()){
if(uncheck_item_list[index].length > 0){
for(var err=0; err < uncheck_item_list[index].length; err++){
if(uncheck_item_list[index][err] != null){
errors.push("商品No." + (index+1) + ":" + uncheck_item_list[index][err]);
err_msg = 1;
}
}
}
else if(err_msg == 0){
err_msg = 2;
}
}
}
if(!(parseInt($("#TotalPrice .total .price").text().replace(/,/g, ""), 10) > 0)
&& $("#TotalPrice .total .price").text().indexOf('別途') == -1
&& err_msg != 1){
errors.push("ご依頼の商品を1枚以上選択してください。");
}
if(!$('#note_agree').prop('checked')) errors.push("注意事項に同意頂ける場合のみご注文ください。");
if(errors.length){
$("#ErrorPopup").find("div").html(errors.join("
"));
$("#ErrorPopup").popup();
return false;
} else {
window.sessionStorage.setItem("data", JSON.stringify(item_list));
window.sessionStorage.setItem("payment", $("input[name=payment_type]:checked").val());
window.sessionStorage.setItem("agree", $("#note_agree").prop("checked"));
window.sessionStorage.setItem("comment", $("#CommentArea").children("textarea").val());
window.sessionStorage.setItem("prefecture", $("select.prefecture").val());
//本発注画面に遷移
location.href='order.html';
}
}
else{
//注意事項表示
$("#NotesArea").popup({closeButton: false,header:false});
}
}
else if($(event.target).closest('#new_mem_btn').length) {
if($('#new_mem').is(':visible')){
$("#new_mem").hide();
}
else{
$("#new_mem").fadeIn(700);
}
}
else if($(event.target).closest('#other_send_action').length) {
if($('#other_send').is(':visible')){
$("#other_send").hide();
}
else{
$("#other_send").fadeIn(700);
}
}
else if($(event.target).closest('#order_chng').length) {
//前画面に遷移
location.href='index.html';
}
else if($(event.target).closest('#order_decide').length) {
var errors = [];
if(!$("#user_company").val()) errors.push("会社名を入力してください。");
if(!$("#user_postal").val()) errors.push("郵便番号を入力してください。");
if(!$("#user_address").val()) errors.push("ご住所を入力してください。");
if(!$("#user_tel").val()) errors.push("電話番号を入力してください。");
if(!$("#user_email").val()) errors.push("メールアドレスを入力してください。");
if(!$('#note_agree').prop('checked')) errors.push("注意事項に同意頂ける場合のみご注文ください。");
if(errors.length){
$("#ErrorPopup").find("div").html(errors.join("
"));
$("#ErrorPopup").popup();
return false;
} else {
window.sessionStorage.setItem("user_company", $("#user_company").val());
window.sessionStorage.setItem("user_person", $("#user_person").val());
window.sessionStorage.setItem("user_postal", $("#user_postal").val());
window.sessionStorage.setItem("user_address", $("#user_address").val());
window.sessionStorage.setItem("user_tel", $("#user_tel").val());
window.sessionStorage.setItem("user_email", $("#user_email").val());
window.sessionStorage.setItem("member_id", $("#member_id").val());
window.sessionStorage.setItem("member_email", $("#member_email").val());
window.sessionStorage.setItem("send_in_company", $("#send_in_company").val());
window.sessionStorage.setItem("send_in_tel", $("#send_in_tel").val());
window.sessionStorage.setItem("send_in_postal", $("#send_in_postal").val());
window.sessionStorage.setItem("send_in_address", $("#send_in_address").val());
window.sessionStorage.setItem("comment", $("#CommentArea").children("textarea").val());
if(payment_s=="credit"
&& Number(order_price["finalprice"].replace(/,/g, '')) > 0
&& Number(order_price["postage"].replace(/,/g, '')) > 0){
charge_no = 0;
$.ajax({
method: "POST",
dataType: "text",
data: {
submit: 1,
get_charge_no: 1
}
}).done(function(no){
if(no != null && no > 0){
charge_no = no;
$("#order_form").append('