สุขุมวิท ฮอนด้า ออโตโมบิล - WECANFIX - บริษัท วีแคนฟิกซ์ จำกัด
สุขุมวิท ฮอนด้า ออโตโมบิล
จังหวัด กรุงเทพฯ เขต วัฒนา , 1319 ถนนสุขุมวิท แขวงพระโขนงเหนือ
02-391-6000
อู่ที่ใกล้กับ สุขุมวิท ฮอนด้า ออโตโมบิล
มีชัย ออโต้
อาร์เอ็มเอ ซิตี้ มอเตอร์ส สาขาพระราม 4 (ฟอร์ด)
ฟอร์ดอาร์เอ็มเอ ซิตี้ มอเตอร์ส
อินช์เคป (จากัวร์และแลนด์โรเวอร์)
เท็น ฮอนด้า ออโต้โมบิล (สำนักงานใหญ่)
ฉัตรเมืองจำกัด
'; $("#garage_review_box").html(item); } }); }, onClickPagination: function () { var requestReviews = Feature.requestReviews; $("#garage_review_box").on('click', "[name=btn_pagination]", function () { review_page = $(this).data("page"); requestReviews(); document.getElementById("garage_review_box").scrollIntoView(); }); }, onRatingStar: function () { var garage_rating_star = "[name=garage_rating_star]"; var check_star = false; $(garage_rating_star).on("mouseover", function () { var score = $(this).data("score"); if (!check_star) { $(garage_rating_star).each(function (index, element) { if (index <= (score - 1)) { $(element).addClass("active"); } else { $(element).removeClass("active"); } }); } }); $(garage_rating_star).on("mouseout", function () { var score = $(this).data("score"); if (!check_star) { $(garage_rating_star).each(function (index, element) { $(element).removeClass("active"); }); } }); $(garage_rating_star).on("click", function () { var score = $(this).data("score"); if (check_star) { $(garage_rating_star).each(function (index, element) { $(element).removeClass("active"); }); check_star = false; } else { $(garage_rating_star).each(function (index, element) { if (index < (score)) { $(element).addClass("active"); } }); check_star = true; } }); }, onClickReportReview: function () { $('#garage_review_box').on('click', '[name=report_review]', function () { var id = $(this).data('id'); $('#suggestion_review_id').val(id); }); }, validateReview: function () { var error = $('.alert-danger', $('#review_form')); var success = $('.alert-success', $('#review_form')); $('#review_form').validate({ errorElement: 'span', //default input error message container errorClass: 'help-block help-block-error', // default input error message class focusInvalid: false, // do not focus the last invalid input ignore: "", // validate all fields including form hidden input rules: { review_comment: { required: true, maxlength: 500 } }, invalidHandler: function (e, t) { success.hide(), error.show() //App.scrollTo(error, -200) }, errorPlacement: function (e, r) { var i = $(r).parent(".input-icon").children("i"); i.removeClass("fa-check").addClass("fa-warning"), i.attr("data-original-title", e.text()).tooltip({ container: "body" }); }, highlight: function (element) { $(element).closest(".form-group").removeClass("has-success").addClass("has-error"); }, unhighlight: function (element) { }, success: function (element, r) { var i = $(r).parent(".input-icon").children("i"); $(r).closest(".form-group").removeClass("has-error").addClass("has-success"), i.removeClass("fa-warning").addClass("fa-check"); }, submitHandler: function (form) { success.show(); error.hide(); } }); }, submitReview: function (active) { var review_score = $('[name=garage_rating_star].active').length; var data = new FormData(); data.append("id", 0); data.append("garage_id", 2085); //data.append("garage_booking_id", null); data.append("review_score", review_score); data.append("review_comment", $("#review_comment").val()); data.append("image_json_data", JSON.stringify(image_review_data)); data.append("active", active); if ('' != '' && '' == 1) { data.append("tracking_id", ); } App.blockUI({ target: "#review_modal .modal-dialog" }); $.ajax({ url: '/Garage/SubmitReviewGarage', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { App.unblockUI("#review_modal .modal-dialog"); if (result.startsWith('SUCCESS')) { bootbox.alert('เขียนรีวิวสำเร็จ', function () { window.location.href = '/Garage/GarageProfile/2085/%E0%B8%AA%E0%B8%B8%E0%B8%82%E0%B8%B8%E0%B8%A1%E0%B8%A7%E0%B8%B4%E0%B8%97-%E0%B8%AE%E0%B8%AD%E0%B8%99%E0%B8%94%E0%B9%89%E0%B8%B2-%E0%B8%AD%E0%B8%AD%E0%B9%82%E0%B8%95%E0%B9%82%E0%B8%A1%E0%B8%9A%E0%B8%B4%E0%B8%A5'; }); } else if (result.startsWith('ERROR')) { var err_value = result.split(':')[2]; switch (err_value) { case 901: bootbox.alert('เขียนรีวิวไม่สำเร็จ กรุณาล็อคอินเข้าสู่ระบบก่อนเพื่อทำการเขียนรีวิว ต้องการล็อคอิน?'); break; default: bootbox.alert(result.split(':')[1]); break; } } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert(xhr.status + " " + thrownError); } }); }, onSubmitReview: function () { var submitReviewFunction = Feature.submitReview; $('#btn_submit_review').on('click', function () { var active = 1; var review_score = $('[name=garage_rating_star].active').length; if (review_score == 0) { $("#text_required").css("color", "#db1313"); $("#text_required").html("กรุณากรอกคะแนนให้อู่รถนี้"); return; } if (!$("#review_form").valid()) { bootbox.alert("กรุณากรอกรายละเอียดการรีวิวค่ะ"); return; } else { submitReviewFunction(active); } }); }, submitDeleteReview: function (review_id) { var calculateReviewScore = Feature.calculateReviewScore; var requestReviews = Feature.requestReviews; App.blockUI(); var data = new FormData(); data.append("id", review_id); $.ajax({ url: '/Garage/SubmitDeleteReviewGarage', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { App.unblockUI(); if (result.startsWith('SUCCESS')) { bootbox.alert('ลบรีวิวสำเร็จ !', function () { requestReviews(); calculateReviewScore(); }); } else if (result.startsWith('ERROR')) { var err_value = result.split(':')[2]; switch (err_value) { case 901: bootbox.alert('ลบรีวิวไม่สำเร็จ กรุณาล็อคอินเข้าสู่ระบบก่อนเพื่อทำการลบรีวิว'); return; default: bootbox.alert("เกิดข้อผิดพลาดลบรีวิวไม่สำเร็จ"); return; } } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert(xhr.status + " " + thrownError); } }); }, onSubmitDeleteReview: function () { var submitDeleteReview = Feature.submitDeleteReview; $('#garage_review_box').on('click', '[name=delete_review]', function () { var review_id = $(this).data('id'); bootbox.confirm({ message: 'คุณต้องการที่จะลบรีวิวนี้ ?', buttons: { cancel: { label: ' ปิด' }, confirm: { label: ' ลบรีวิว' } }, callback: function (confirm) { if (confirm) { submitDeleteReview(review_id); } } }) }); }, calculateReviewScore: function () { App.blockUI(); var data = new FormData(); data.append("garage_id", 2085); $.ajax({ url: '/Garage/AjaxReviewScore', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { App.unblockUI(); if (result.startsWith('ERROR')) { bootbox.alert('ERROR' + result); return; } else { var resultData = JSON.parse(result); var reviewScoreResult = resultData["review_score"]; var totalScore = reviewScoreResult["total_score"]; var totalReview = reviewScoreResult["review_total"]; $('[name=total_review_score]').text(totalScore); //t-review_star var text_star = ''; for (var i = 0; i < 5; i++) { if (i < totalScore) { if (parseInt(totalScore, 10) == i && parseFloat(totalScore) % parseInt(totalScore, 10) >= 0.5) { text_star += ''; } else { text_star += ''; } } else { text_star += ''; } } $('#t-review_star').html(text_star); $('[name=total_review]').text(totalReview); $('#review_score_row_1').find('#review_garage_score_count_1').text(reviewScoreResult["review_star_1"] + ' คน'); $('#review_score_row_1').find('.item_middle .progress-bar') .attr('aria-valuenow', reviewScoreResult["review_s1"]) .attr('aria-valuemax', totalReview) .css('width', reviewScoreResult["review_s1"] + '%'); $('#review_score_row_2').find('#review_garage_score_count_2').text(reviewScoreResult["review_star_2"] + ' คน'); $('#review_score_row_2').find('.item_middle .progress-bar') .attr('aria-valuenow', reviewScoreResult["review_s2"]) .attr('aria-valuemax', totalReview) .css('width', reviewScoreResult["review_s2"] + '%'); $('#review_score_row_3').find('#review_garage_score_count_3').text(reviewScoreResult["review_star_3"] + ' คน'); $('#review_score_row_3').find('.item_middle .progress-bar') .attr('aria-valuenow', reviewScoreResult["review_s3"]) .attr('aria-valuemax', totalReview) .css('width', reviewScoreResult["review_s3"] + '%'); $('#review_score_row_4').find('#review_garage_score_count_4').text(reviewScoreResult["review_star_4"] + ' คน'); $('#review_score_row_4').find('.item_middle .progress-bar') .attr('aria-valuenow', reviewScoreResult["review_s4"]) .attr('aria-valuemax', totalReview) .css('width', reviewScoreResult["review_s4"] + '%'); $('#review_score_row_5').find('#review_garage_score_count_5').text(reviewScoreResult["review_star_5"] + ' คน'); $('#review_score_row_5').find('.item_middle .progress-bar') .attr('aria-valuenow', reviewScoreResult["review_s5"]) .attr('aria-valuemax', totalReview) .css('width', reviewScoreResult["review_s5"] + '%'); } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert(xhr.status + " " + thrownError); } }); }, fetchComments: function (review_id, comment_position) { var data = new FormData(); //App.blockUI({ // target: "#rowReview" + review_id + " .review-box" //}); data.append("review_id", review_id); data.append("comment_position", comment_position); $.ajax({ url: '/Garage/AjaxCommentReview', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { //App.unblockUI("#rowReview" + review_id + " .review-box"); if (result.startsWith('ERROR')) { bootbox.alert("การแสดงคอมเมนท์ไม่สำเร็จ"); } else { var jResult = JSON.parse(result); var jCommentResult = jResult["comment_result"]; var i, j, len = jCommentResult.length; $("#commentBox_" + review_id).removeClass("hidden"); var totalComment = Math.abs(jResult["totalComment"] - jResult["comment_result"].length - $("#commentBox_" + review_id + " div.panel-heading").length); $("#totalComment_" + review_id).text(totalComment + " ความคิดเห็น"); if (totalComment <= 0) { $("#totalComment_" + review_id).parent().remove(); } var item = ''; for (i = 0; i < len; i++) { var jComment = jCommentResult[i]; item += '
'; } if ($("#commentBox_" + review_id + " div.panel-heading").length < totalComment) { $("#commentBox_" + review_id).prepend(item); } else { $("#commentBox_" + review_id).append(item); } $("#comment_detail_" + review_id).val(''); setTimeout(function () { $('.lazy').lazy({ bind: 'event', threshold: "2000", onError: function (element) { $(element).prop("src", "https://www.wecanfix.co.th/content/assets/images/notfound.jpg"); } }).trigger('lazyload'); }, 200); } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert(xhr.status + " " + thrownError); } }); }, submitComment: function (comment_id, review_id, active) { var fetchCommentsFunction = Feature.fetchComments; App.blockUI(); var review_comment_detail = $("#comment_detail_" + review_id).val(); var data = new FormData(); data.append("id", comment_id); data.append("garage_id", 2085); data.append("garage_booking_id", ""); data.append("comment_at_review_id", review_id); data.append("review_score", 0); data.append("review_comment", review_comment_detail); data.append("image_json_data", JSON.stringify(image_review_data)); data.append("active", active); $.ajax({ url: '/Garage/SubmitReviewGarage', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { App.unblockUI(); if (result.startsWith('SUCCESS')) { //window.location.reload(); var comment_position = result.split(":")[1]; $("[name=btn_comment_total][data-id=" + review_id + "]").data("comment_total", comment_position); $("#commentBox_" + review_id).html(""); fetchCommentsFunction(review_id, 0); //window.location.reload(); } else if (result.startsWith('ERROR')) { var err_value = result.split(':')[2]; switch (err_value) { case 901: bootbox.confirm('คอมเม้นไม่สำเร็จ กรุณาล็อคอินเข้าสู่ระบบก่อนเพื่อทำการคอมเม้น ต้องการล็อคอิน?', function (confirm) { if (confirm) { window.location.href = "/Signin/Index"; } }); return; default: bootbox.alert("เกิดข้อผิดพลาดคอมเม้นไม่สำเร็จ"); return; } } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert(xhr.status + " " + thrownError); } }); }, onSubmitComment: function () { var submitComment = Feature.submitComment; $("#garage_review_box").on('click', '[name=btn_submit_comment]', function () { var review_id = $(this).data("review_id"); var comment_id = 0; var review_comment_detail = $("#comment_detail_" + review_id).val(); if (review_comment_detail != "") { var active = 1; submitComment(comment_id , review_id, active); } else { bootbox.alert("กรุณากรอกข้อความ"); return; } }); }, onTotalComment: function () { var fetchComments = Feature.fetchComments; $("#garage_review_box").on('click', '[name=btn_comment_total]', function () { var review_id = $(this).data("id"); var commentTotal = $(this).data("comment_total"); var comment_position = $("#commentBox_" + review_id + " div.panel-heading").length; if (comment_position < commentTotal) { fetchComments(review_id, comment_position + 1); } }); }, onRemoveComment: function () { var submitComment = Feature.submitComment; $('#garage_review_box').on('click', '[name=remove_comment]', function () { var comment_id = $(this).data('id'); var review_id = $(this).data('review_id'); bootbox.confirm({ message: 'คุณต้องการที่จะลบคอมเมนท์นี้ ?', buttons: { cancel: { label: ' ปิด' }, confirm: { label: ' ลบคอมเมนท์' } }, callback: function (confirm) { if (confirm) { submitComment(comment_id, review_id, 0); } } }) }); }, validateSuggestion: function () { var error = $('.alert-danger', $('#suggestion_form')); var success = $('.alert-success', $('#suggestion_form')); $('#suggestion_form').validate({ errorElement: 'span', //default input error message container errorClass: 'help-block help-block-error', // default input error message class focusInvalid: false, // do not focus the last invalid input ignore: "", // validate all fields including form hidden input rules: { suggestion_type: { required: true } }, invalidHandler: function (e, t) { success.hide(), error.show() //App.scrollTo(error, -200) }, errorPlacement: function (e, r) { var i = $(r).parent(".input-icon").children("i"); i.removeClass("fa-check").addClass("fa-warning"), i.attr("data-original-title", e.text()).tooltip({ container: "body" }); }, highlight: function (element) { $(element).closest(".form-group").removeClass("has-success").addClass("has-error"); }, unhighlight: function (element) { }, success: function (element, r) { var i = $(r).parent(".input-icon").children("i"); $(r).closest(".form-group").removeClass("has-error").addClass("has-success"), i.removeClass("fa-warning").addClass("fa-check"); }, submitHandler: function (form) { success.show(); error.hide(); } }); }, //onSubmitSuggestion: function () { // $("#garage_review_box").on('click', '#btn_submit_suggestion', function () { // var active = 1; // submitSuggestion(active); // }); //}, onSubmitSuggestion: function () { var submitSuggestion = Feature.submitSuggestion; $("#btn_submit_suggestion").on('click', function () { var id_review = $("#suggestion_review_id").val(); var suggestion_type_id = $("#suggestion_type").val(); var suggestion_detail = $("#report_detail").val(); var active = 1; if (!$('#suggestion_form').valid()) { bootbox.alert("กรุณากรอกข้อมูลให้ถูกต้องค่ะ"); return; } else { bootbox.confirm({ message: "กดปุ่มตกลงเพื่อแจ้งความไม่เหมาะสม", buttons: { cancel: { label: ' ปิด', className: '' }, confirm: { label: ' ตกลง', className: 'btn btn-primary' } }, callback: function (confirm) { if (confirm) { submitSuggestion(id_review, suggestion_type_id, suggestion_detail, active); } } }); } }); }, submitSuggestion: function (id_review, suggestion_type_id, suggestion_detail, active) { App.blockUI(); var data = new FormData(); data.append("review_id", id_review); data.append("suggestion_type_id", 1); data.append("suggestion_detail", suggestion_detail); data.append("image_json_data", JSON.stringify(image_suggestion_data)); data.append("active", active); $.ajax({ url: '/Garage/SubmitSuggestion', type: 'POST', data: data, cache: false, processData: false, contentType: false, success: function (result) { App.unblockUI(); if (result.startsWith('SUCCESS')) { bootbox.alert('รายงานความไม่เหมาะสมเรียบร้อยแล้วทางทีมงานจะทำการตรวจสอบความไม่เหมาะสมของการรีวิว', function () { window.location.reload(); }); } else if (result.startsWith('ERROR')) { var err_value = result.split(':')[1]; switch (err_value) { default: bootbox.alert(err_value); break; } } }, error: function (xhr, ajaxOptions, thrownError) { App.unblockUI(); bootbox.alert("รายงานไม่สำเร็จ " + xhr.status + " " + thrownError); } }); }, init: function () { this.initDatePicker(); this.initImageError(); this.initOwlCarousel(); this.initBindGallery(); this.onClickStarReview(); //this.onClickBookingBtn(); this.onClickPagination(); this.requestFavourite(); this.requestReviews(); //this.onClickMemberBooking(); this.onTotalComment(); } } }(); var getGarageNames = function () { $.ajax({ url: '/GarageBooking/GetGarageNames', success: function (result) { $('#garage-name').html(result); } }); } var openMultiBooking = function () { $.ajax({ url: '/GarageBooking/ShowMultiGarageBooking', success: function (result) { getGarageNames(); var modal = $('#booking-garage-detail'); modal.html(result); $('#modal-booking-multi').modal('show'); $('[id^="delete-booking-"]').click(function () { var id = $(this)[0].id.split('-')[2]; $.ajax({ url: '/GarageBooking/RemoveMultiGarageBooking?garage_id=' + id, success: function () { var lblCount = $('#multi-booking-count'); var divProfile = $('#multi-booking-garage-profile-' + id); var count = parseInt(lblCount.text()); lblCount.text(count-1); divProfile.slideUp(500, function () { divProfile.remove(); }); getGarageNames(); }, }); }); $('#btn-booking').click(function () { $('#modal-booking-multi').modal('hide'); $('#modal_booking_garage_id').val(''); $('#modal_booking').modal('show'); }); } }); }; $(document).ready(function () { Feature.init(); }); $(document).ready(function () { if ("" != "") { setTimeout(function () { document.getElementById('rowReview' + '').scrollIntoView(); $('#rowReview' + '' + ' .review-box').css({ 'box-shadow': '1px 2px 3px #bcc9f9', 'transition': 'opacity 1s ease-in' }); }, 500); } $('#btn-booking-now').click(function (e) { //$('#modal-booking-select').modal('hide'); $('#garage-name').html('สุขุมวิท ฮอนด้า ออโตโมบิล'); $('#modal_booking_garage_id').val(2085); $('#modal_booking').modal('show'); }); $('#btn-booking-multi').click(function (e) { $.ajax({ url: '/GarageBooking/AddMultiGarageBooking?garage_id=2085', success: function (result) { if (result.startsWith('SUCCESS')) { bootbox.alert('เลือกอู่ "สุขุมวิท ฮอนด้า ออโตโมบิล" เรียบร้อยแล้ว', function () { window.location = window.location.href.split('#')[0] + '?openmulti=1'; }); } else { bootbox.alert(result.split(':')[2], function () { }); } }, }); }); onClickCheckBookingHasInsurance(); onChangeVehicleBrand(); onClickBookingInsurance(); onClickMemberBooking(); onSubmitBooking(); $('#show-modal-booking-multi').click(function () { openMultiBooking(); }); });