text: $("#file-5").fileinput({uploadUrl:"/upload/post?type=gallery&token="+$("#token_gallery").val(),showBrowse:!1,uploadAsync:!1,browseOnZoneClick:!0,overwriteInitial:!1,allowedFileExtensions:["doc","docx","pdf","csv","xls","xlsx","jpg","jpeg","gif","png"],uploadIcon:'<i class="fa fa-upload"></i>',uploadClass:"btn btn-primary",uploadLabel:"Upload All",showRemove:!1,otherActionButtons:'<a class="btn btn-sm btn-edit gallerySetPrimary" {dataKey}>Set Primary</a>',layoutTemplates:{footer:'<div class="file-thumbnail-footer" style ="height:94px">\n   <div style="margin:5px 0">\n       <input class="file-caption-input form-control input-sm text-center" value="{caption}" placeholder="Enter caption..." data-fileid="{TAG_ID}" data-initcaption="{TAG_VALUE}">\n   </div>\n   {actions}\n</div>',fileIcon:'<i class="fa fa-file kv-caption-icon"></i> '},previewThumbTags:{"{TAG_VALUE}":"","{TAG_ID}":""},allowedPreviewTypes:null,uploadExtraData:function(){var e={};return $(":input.file-caption-input:visible").each(function(){var a=$(this),t=a.val();if(a.data("fileid"))a.data("initcaption")!=t&&(e["caption_update_"+a.data("fileid")]=t);else{var o=a.closest(".file-preview-frame"),i=o.data("fileindex");e["caption_"+i]=t}}),e}}).on("fileuploaded",function(){}).on("filebatchuploadsuccess",function(){}).on("filebeforedelete",function(){return!window.confirm("Are you sure you want to delete this file?")}),$("#file-6").fileinput({uploadUrl:"/upload/post?type=denah&token="+$("#token_denah").val(),showBrowse:!1,uploadAsync:!1,browseOnZoneClick:!0,overwriteInitial:!1,allowedFileExtensions:["doc","docx","pdf","csv","xls","xlsx","jpg","jpeg","gif","png"],uploadIcon:'<i class="fa fa-upload"></i>',uploadClass:"btn btn-primary",uploadLabel:"Upload All",showRemove:!1,otherActionButtons:'<a class="btn btn-sm btn-edit denahSetPrimary" {dataKey}>Set Primary</a>',layoutTemplates:{footer:'<div class="file-thumbnail-footer" style ="height:94px">\n   <div style="margin:5px 0">\n       <input class="file-caption-input form-control input-sm text-center" value="{caption}" placeholder="Enter caption..." data-fileid="{TAG_ID}" data-initcaption="{TAG_VALUE}">\n   </div>\n   {actions}\n</div>',fileIcon:'<i class="fa fa-file kv-caption-icon"></i> '},previewThumbTags:{"{TAG_VALUE}":"","{TAG_ID}":""},allowedPreviewTypes:null,uploadExtraData:function(){var e={};return $(":input.file-caption-input:visible").each(function(){var a=$(this),t=a.val();if(a.data("fileid"))a.data("initcaption")!=t&&(e["caption_update_"+a.data("fileid")]=t);else{var o=a.closest(".file-preview-frame"),i=o.data("fileindex");e["caption_"+i]=t}}),e}}).on("fileuploaded",function(){}).on("filebatchuploadsuccess",function(){}).on("filebeforedelete",function(){return!window.confirm("Are you sure you want to delete this file?")}),$(document).ready(function(){$.ajax({type:"GET",url:"/bridge/province",dataType:"json",success:function(e){$.each(e.data,function(e,a){$("#province").append('<option value="'+a.province_id+'">'+a.province_name+"</option>")})}}),$.ajax({type:"GET",url:"/bridge/propertytype",dataType:"json",data:{type:"project"},success:function(e){var a=1;$.each(e.data,function(e,t){$("#propertyType").append('<option value="'+t.property_type_id+'">'+t.property_type_name+"</option>"),1==a&&$("#propertyType").select2("val",t.property_type_id),a++})}}),$.ajax({type:"GET",url:"/developer/list/",dataType:"json",data:{type:"bridge"},success:function(e){$.each(e.data,function(e,a){$("#developerName").append('<option value="'+a.developer_id+'">'+a.developer_name+"</option>")})}}),$("input[type=checkbox],input[type=radio]").uniform(),$("select").select2()}),$(document).on("submit","#postProyek",function(e){if(e.preventDefault(),""==$("#projectName").val())return alert("Nama Proyek tidak boleh kosong"),$("#projectName").focus(),!1;if("0"==$("#developerName").val())return alert("Nama Developer tidak boleh kosong"),$("#developerName").focus(),!1;if(""==$("#startPrice").val())return alert("Harga Mulai tidak boleh kosong"),$("#startPrice").focus(),!1;if(""==$("#endPrice").val())return alert("Harga Akhir tidak boleh kosong"),$("#endPrice").focus(),!1;if(""==$("#desc").val())return alert("Deskripsi tidak boleh kosong"),$("#desc").focus(),!1;if("0"==$("#province").val())return alert("Provinsi tidak boleh kosong"),$("#province").focus(),!1;if("0"==$("#city").val())return alert("Kota tidak boleh kosong"),$("#city").focus(),!1;if("0"==$("#area").val())return alert("Area tidak boleh kosong"),$("#area").focus(),!1;if(""==$("#address").val())return alert("Alamat tidak boleh kosong"),$("#address").focus(),!1;if(""==$("#postcode").val())return alert("Kodepos tidak boleh kosong"),$("#postcode").focus(),!1;if(""==$("#unitTotalAll").val())return alert("Total Unit tidak boleh kosong"),$("#unitTotalAll").focus(),!1;$("#btn").hide(),$("#loading").show();var a=new FormData(this),t="/proyek-developer/post";$.ajax({type:"POST",url:t,data:a,success:function(){$("#btn").show(),$("#loading").hide(),alert("Yeeah.. You did it!!!")},error:function(){$("#btn").show(),$("#loading").hide(),alert("Urmhh.. You failed. Try again later!!!")},contentType:!1,processData:!1})}),$(document).on("click",".addUnit",function(){var e="";e+="<br>",e+='<div class="control-group"><label class="control-label">Nama Unit :</label>',e+='<div class="controls"><input type="text" name="unitName[]" id="unitName" class="span11" placeholder="Lavenia 2" />',e+="</div></div>",e+='<div class="control-group"><label class="control-label">Jumlah Unit :</label>',e+='<div class="controls"><input type="text" name="unitTotal[]" id="unitTotal" class="span11" placeholder="6" />',e+="</div></div>",e+='<div class="control-group"><label class="control-label">Harga :</label>',e+='<div class="controls"><input type="text" name="unitPrice[]" id="unitPrice" class="span11" placeholder="180.000.000" onkeypress="return isNumberKey(event)" onkeyup="numberFormat(this)" autocomplete="off" />',e+="</div></div>",e+='<div class="control-group"><label class="control-label">Tipe :</label>',e+='<div class="controls"><input type="text" name="unitType[]" id="unitType" class="span11" placeholder="90" />',e+="</div></div>",e+='<div class="control-group"><label class="control-label">LT/LB :</label>',e+='<div class="controls controls-row"><input type="text" name="unitLT[]" id="unitLT" placeholder="LT (120)" class="span5 m-wrap"><input type="text" name="unitLB[]" id="unitLB" placeholder="LB (90)" class="span5 m-wrap">',e+="</div></div>",e+='<div class="control-group"><label class="control-label">KT/KM :</label>',e+='<div class="controls controls-row"><input type="text" name="unitKT[]" id="unitKT" placeholder="KT (3)" class="span5 m-wrap"><input type="text" name="unitKM[]" id="unitKM" placeholder="KM (1)" class="span5 m-wrap">',e+="</div></div>",e+='<div class="control-group"><label class="control-label">Spesifikasi :</label>',e+='<div class="controls"><textarea class="span11" name="unitSpesifikasi[]" id="unitSpesifikasi" placeholder="Pondasi : Pondasi tapak + batu kali + sloof beton bertulang, Struktur : Beton bertulang" ></textarea>',e+="</div></div>",$(".listUnit").append(e)}),$(document).on("click",".denahSetPrimary",function(){var e=$(this).attr("data-key");$("#denahSetPrimary").val(e),alert("Set Primary Success")}),$(document).on("click",".gallerySetPrimary",function(){var e=$(this).attr("data-key");$("#gallerySetPrimary").val(e),alert("Set Primary Success")});