/application/views/js_init/js_common_old.php
PHP | 935 lines | 835 code | 42 blank | 58 comment | 68 complexity | 11212aa5dc51d85fcaf62934c2dc25cb MD5 | raw file
Possible License(s): GPL-2.0, MIT, LGPL-3.0, LGPL-2.1, GPL-3.0
- <script>
- /* Cek nilai field is number */
- function is_number(){
- var passed= true;
- $(".is_number").each(function(){
- if( isNaN($(this).val()) == true ){
- $(this).css("backgroundColor","white");
- $(this).css("color","black");
-
- passed= false;
- $(this).css("backgroundColor","#f15c32");
- $(this).css("color","white");
- }
- });
-
- if( passed == false ){
- alert("<?= lang("abdi.alert_2") ?>"); //Nilai Salah
- }
-
- return passed;
- }
- /* DIGUNAKAN UNTUK CHECK PASSWORD PADA FORM ACCOUNT */
- function match_password(){
- password1= $('#Password').val();
- password2= $('#Password2').val();
-
- if( password1 == password2 ){
- return true;
- }else{
- alert("<?= lang("abdi.alert_18") ?>");
- return false;
- }
- }
-
- /* DIGUNAKAN UNTUK CHECK EMAIL PADA FORM ACCOUNT */
- function is_email(){
- email= $('#Email').val();
- var regexp= /^[a-z0-9\_\.]+[@]{1}[a-z]+\.[a-z]+$/;
- if( regexp.test(email) ){
- return true;
- }else{
- alert("<?= lang("abdi.alert_19") ?>");
- return false;
- }
- }
-
- function newKonsumenDetail(id)
- {
- $("#dialog4").dialog({
- title : '<?= lang("abdi.summary_information_detail") ?>',
- width: 'auto',
- height: 700,
- modal: true,
- show : "blind",
- hide : "blind",
- position: [200,0],
- buttons: {
- "Close" : function(){
- $(this).dialog('close');
- }
- },
- close: function() {
- $(this).empty();
- $('#jqTable').trigger('reloadGrid');
- },
- open : function()
- {
- $(this).append("<center><span><img src='<?php echo $this->config->item("img_url") ?>/dialogload.gif' /></span><br />Please Wait ....</center>");
- $(this).load("<?= $this->configlib->site_url() ?>/customer/dashboard/view_detail/" + id);
- }
- });
- //$("#dialog4").dialog("open");
- }
-
- function getDetail(id)
- {
- $("#dialog").dialog({
- title : '<?= lang("abdi.summary_information_detail") ?>',
- width: 900,
- height: 700,
- modal: true,
- show : "blind",
- hide : "blind",
- buttons: {
- "Close" : function(){
- $(this).dialog('close');
- }
- },
- close: function() {
- $(this).empty();
- $('#jqTable').trigger('reloadGrid');
- },
- open : function()
- {
- $(this).append("<center><span><img src='<?php echo $this->config->item("img_url") ?>/dialogload.gif' /></span><br />Please Wait ....</center>");
- $(this).load("<?= $this->configlib->site_url() ?>/customer/dashboard/view_detail/" + id);
- }
- });
- //$('#dialog').load("<?= $this->configlib->site_url() ?>/customer/dashboard/view_detail/" + id);
- }
-
- $(function(){
- id= "INV-02001-0911-52";
- initDialog("edit",id,"");
- $("#cusDialog").dialog("open");
- /*
- initDialog("add","","");
- $("#dialog").dialog("open");
- id= "STF10003";
- initDialog("edit",id,"");
- $("#cusDialog").dialog("open");
- */
- //
- $('#btnCari').click( function(){
- $("#jqTable").jqGrid('searchGrid', { multipleSearch: true, overlay: true, sopt:['cn','bw','eq','ne','lt','gt','ew'], onClose:function(){
- var grid = $("#jqTable");
- grid.jqGrid('setGridParam',{search:false});
- }});
- $btnreset= '<td class="EditButton" style="text-align:left">'+
- '<a class="fm-button ui-state-default ui-corner-all fm-button-icon-left' +
- ' ui-search" id="fbox_jqTable_reset_new">' +
- '<span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>Reset</a></td>';
- if( $('#fbox_jqTable_2 tr:eq(1)').find('#fbox_jqTable_reset_new').length == 0 ){
- $('#fbox_jqTable_2 tr:eq(1)').prepend($btnreset);
- $('#fbox_jqTable_reset').parent().remove();
- }
- });
- $('#fbox_jqTable_reset_new').live('click', function(){
- grid= $("#jqTable");
- filterparams= '{"groupOp":"AND","rules":[{"field":"IdKonsumen","op":"eq","data":""}],"groups":[]}';
- grid.jqGrid('setGridParam',{search: true});
- var postData = grid.jqGrid('getGridParam','postData');
- $.extend(postData,{filters:filterparams});
- grid.trigger("reloadGrid",[{page:1}]);
- });
-
- $('#fbox_jqTable_search').click( function(){
- alert('test');
- });
-
- $("#btnCustDetail")
- .click(function(){
- var id = $('#jqTable').jqGrid('getGridParam','selrow');
- if(id!=null)
- {
- getDetail(id);
- $("#dialog").dialog("open");
- }else{
- alert("<?= lang("abdi.alert_20") ?>");
- }
- })
-
- var Modme= '<?php echo $this->uri->segment("2"); ?>';
- var Funcme= '<?php echo $this->uri->segment("3"); ?>';
- $('#btnCusHistory,#btnJobHistory').click( function(e){
- UriMod= Modme+"/"+Funcme;
- regmodule= /^(customer\/history)$/;
- id = $('#jqTable').jqGrid('getGridParam','selrow');
- if( id != null ){
- if( e.target.id == "btnJobHistory" ){
- var UrlHistory= "<?php echo $this->configlib->site_url(); ?>/customer/jobcard_history/get/" +
- encodeURIComponent(id);
- window.open(UrlHistory);
- }else{
- if( regmodule.test(UriMod) ){
- var UrlHistory= "<?php echo $this->configlib->site_url(); ?>/customer/repair/purchase_history/" +
- encodeURIComponent(id);
- window.open(UrlHistory);
- }else{
- Idcustomer= $('tr#'+ id + ' td:eq(2)').attr('title');
- var UrlHistory= "<?php echo $this->configlib->site_url(); ?>/customer/repair/purchase_history/" +
- encodeURIComponent(Idcustomer);
- window.open(UrlHistory);
- }
- }
- }else{
- alert("<?= lang("abdi.alert_20") ?>");
- }
- });
-
- //Function when add button clicked
- var modul = "<?php echo $this->uri->segment(2); ?>";
- var subModul = "<?php echo $this->uri->segment(3); ?>";
- var modadd= modul + '/' + subModul;
- var IdAkses= '<?php echo $this->session->userdata('idAkses'); ?>';
- var regmodadd= /^(customer\/master|customer\/dashboard)$/;
-
- if( regmodadd.test(modadd) ) //Function for adding new customer master, this submodul use two form that need to submit together in one time
- {
- if( IdAkses=='CST' ){
- $('img[src*=delete_disable], a img#btnEdit').remove();
- }
-
- //Function when edit button clicked
- $("img#btnEdit").click(function(){
- var id = $('#jqTable').jqGrid('getGridParam','selrow');
- if(id == null)
- {
- alert("<?= lang("abdi.alert_20") ?>");
- }else{
- var arrFrm = new Array("frmAddCus","frmAddOther");
- initDialog("edit", id, arrFrm);
- $("#dialog").dialog("open");
- }
- })
-
- $("img#btnAdd").click(function(){
- var arrFrm = new Array("frmAddCus","frmAddOther");
- initDialog("add","",arrFrm);
- $("#dialog").dialog("open");
- });
- }else{
- $("img#btnAdd").click(function(){ //Defaut for submitting just one form in one time
- //alert("test");
- initDialog("add","","");
- $("#dialog").dialog("open");
- });
-
- $("img#btnEdit").click(function(){
- var id = $('#jqTable').jqGrid('getGridParam','selrow');
- if(id == null)
- {
- alert("<?= lang("abdi.alert_20") ?>");
- }else{
- initDialog("edit",id,"");
- //$("#cusDialog").dialog("open");
- }
- })
- }
-
- var regcusmaster= /^(customer\/master)$/;
- if( regmodadd.test(modadd) ) //Function for adding new customer master, this submodul use two form that need to submit together in one time
- {
- <?php #echo $this->configlib->site_url() . '/' . modul . '/' . subModul . '/xml'; ?>
- var url= '<?php echo $this->configlib->site_url(); ?>' + '/' + modul + '/' + subModul + '/xml';
- $("#jqTable").jqGrid('setGridParam', { url: url });
- $('#refresh_jqTable,#search_jqTable').remove();
- }
-
- //Function when delete button clicked
- $("img#btnDel").click(function(){
- var id = $('#jqTable').jqGrid('getGridParam','selrow');
- if(id == null)
- {
- alert("<?= lang("abdi.alert_20") ?>");
- }else{
- jDelete(id);
- }
- })
-
-
- //Init tipsy
- var regmodul= /^(audiogram|upload|report)$/;
- Modul='<?php echo $this->uri->segment(3); ?>';
- if( ! regmodul.test(Modul) ){
- $('#btnAdd, #btnEdit, #btnDel, #btnPrint, #btnExcel, img#btnDetail, #btnArrival, #btnCusHistory, #btnJobHistory, #btnCari,#btnLastVisit').tipsy({gravity: 'sw', fade: true});
- }
-
- })
-
- function jqGridSelected(obj,id)
- {
- $("#hiddenID").val(id);
- }
-
- function required(ignore)
- {
- var passed = true;
- $(".required").each(function(){
- if($.trim($(this).val())=="")
- {
- passed = false;
- $(this).css("backgroundColor","#f15c32");
- $(this).css("color","white");
- }
- });
-
- if(passed==false)
- {
- if(ignore==false)
- {
- alert("<?= lang("abdi.alert_3") ?>"); //Data Ga boleh kosong
- }
- return false;
- }else{
- return true;
- }
- }
- function confirmed()
- {
- if(required(false))
- {
- var passed = true;
- $(".confirmed").each(function(){
- if($.trim($(this).val())=="")
- {
- passed = false;
- $(this).css("backgroundColor","yellow");
- }
- });
-
- if(passed==false)
- {
- var ask = confirm("<?= lang("abdi.alert_6") ?>"); //Mengabaikan Beberapa Fields
- if(ask)
- {
- return true;
- }else{
- return false;
- }
- }else{
- return true;
- }
- }else{
- return true;
- }
- }
-
- function initDialog(act,id,frmID)
- {
- var isArray = false;
- var modul = '<?php echo $this->uri->segment("2"); ?>';
- var func = '<?php echo $this->uri->segment("3"); ?>';
- theUrl = "<?php echo $this->configlib->site_url(); ?>/" + modul + "/" + func + "/popup/" + act + "/" + encodeURIComponent(id);
- theSave = function(e){
- if(frmID.length==2)
- {
- isArray=true;
- var serial = new Array($("#" + frmID[0]).serialize(),$("#" + frmID[1]).serialize());
- }
-
- if(isArray) //Notice : this function is only submitted two form in same time
- {
- var allowBlank = confirmed();
- var mustFilled = required();
- //alert('test');
- if( allowBlank && mustFilled )
- {
- var success= true;
- var i =0;
- var idkonsumen= $('#IdKonsumen').val();
- while(i<=1 && success==true )
- {
- $(this).empty();
- $(this).append("<center><span><img src='<?php echo $this->config->item("img_url") ?>/dialogload.gif' /><br />Sending Form "+i+1+"</span></center>");
- $.post("<?php echo $this->configlib->site_url(); ?>/" + modul + "/master/save/" + act,serial[i],function(data){
- switch(data)
- {
- case "1" :
- success = true;
- break;
- case "0" :
- success = false;
- var msg = "<?= lang("abdi.alert_4") ?>"; //Data Gagal Simpan
- break;
- case "-1" :
- success = false;
- var msg = "<?= lang("abdi.alert_7") ?>"; //Error Hanya Pada Data yg Di save aja
- break;
- default :
- var msg = "Error : " + data;
- success = false;
- break;
- }
-
- });
- i = i +1;
- }
-
- if( success==false ){
- alert(msg);
- }
- if( success==true ){
- alert("<?= lang("abdi.alert_5") ?>") //Data Berhasil Disimpan
- elname= $(e.target).text();
- }
- $("#dialog").dialog("close");
-
- var modadd= modul + "/" + func;
- var regmodadd= /^(customer\/master|customer\/dashboard)$/;
- if( regmodadd.test(modadd) && elname == "Proceed"){
- //alert(idkonsumen);
- newKonsumenDetail(idkonsumen);
- //newKonsumenDetail('020010006');
- }
- }
- }else{
- if(frmID=="")
- frmID = $("#frmID").val(); //Get the form name to be serialized
- var serialized = $("#" + frmID).serialize();
- var allowBlank = confirmed();
- //var mustFilled = true;
- var mustFilled = required();
-
- /* Pengecekan tambahan untuk test password sama dan email pada Form frmAddAcc */
- /* -------------------------------------------------------------------------- */
- if( frmID=="frmAddAcc"){
- if( act=="add" ){
- mustFilled= match_password();
- if( mustFilled == true ){
- mustFilled = is_email();
- }
- }else{
- mustFilled= is_email();
- }
- }
-
- //Pengecekan tambahan untuk authorization add new repair
- if(frmID=="frmAddRepair")
- {
- var printRepairReceipt = false;
- switch($("#Authorization").val())
- {
- case "c" :
- //JIka user memilih cost estimate
- printRepairReceipt = true;
- alert("<?= lang("abdi.alert_42") ?>");
- break;
- default :
- //JIka user memilih immediate repair atau cost estimate if rep over
- //JIka nilai DP kecil dari Rp. 50.000
- if($("#DP").val()<50000)
- {
- alert("<?= lang("abdi.alert_43") ?>")
- $("#DP").focus();
- }else{
- printRepairReceipt = true;
- }
- break;
- }
- }else{
- var printRepairReceipt = true;
- }
- /*---------------------------------------------------------*/
- //var serialized = $("#" + frmID).serialize();
- var field_number= is_number();
-
- if(allowBlank && mustFilled && field_number && printRepairReceipt)
- {
- mockup='<?php echo $this->uri->segment(2) . "/" . $this->uri->segment(3); ?>';
- mockreg= /^(hrd\/master|marketing\/sales)$/;
- //if( mockup != "hrd/master" ){
- if( ! mockreg.test(mockup) ){
- grant_edit= $('#grant_edit').val();
- if( mockup == "customer/invoice" && grant_edit != "on" ){
- alert("Press F5 to enter your supervise key !");
- }else{
- /*
- $(this).empty();
- $(this).append("<center><span><img src='<?php echo $this->config->item("img_url") ?>/dialogload.gif' /><br /><?= lang("abdi.alert_21") ?> ....</span></center>");
- */
- var stat_dialog= true;
- $.post("<?php echo $this->configlib->site_url(); ?>/" + modul + "/" + func + "/save/" + act,serialized,function(data){
- dataParsed = data.split("~");
- switch(dataParsed[0])
- {
- case "1" :
- alert("<?= lang("abdi.alert_5") ?>");
- break;
- case "0" :
- alert("<?= lang("abdi.alert_4") ?> ");
- break;
- case "-1" :
- alert("<?= lang("abdi.alert_7") ?> ");
- break;
- case "R-OK" : //Print receipt for added repair
- alert("<?= lang("abdi.alert_5") ?>");
- var frmObjArr = serialized.split("&"); //Pecah value dari variable serialized untuk mendapatkan id repair
- var idRepairArr = frmObjArr[1].split("="); //Pecah lagi dengan splitter string '='
- var idRepair = idRepairArr[1];
- window.open("<?= $this->configlib->site_url(); ?>/customer/repair/print_receipt/" + idRepair,"Repair Receipt");
- alert("<?= lang("abdi.alert_8") ?>");
- break;
- case "R-OK-NORECEIPT" :
- alert("<?= lang("abdi.alert_5") ?>");
- break;
- case "S-OK" : //Print shipment
- var frmObjArr = serialized.split("&"); //Pecah value dari variable serialized untuk mendapatkan id shipment
- var idShipmentArr = frmObjArr[1].split("="); //Pecah lagi dengan splitter string '='
- var IdShipment = idShipmentArr[1];
- alert("<?= lang("abdi.alert_5") ?>");
- break;
- case "INV-OK" :
- var frmObjArr = serialized.split("&"); //Pecah value dari variable serialized untuk mendapatkan id invoice
- var idInvoiceArr = frmObjArr[3].split("="); //Pecah lagi dengan splitter string '='
- var idInvoice = idInvoiceArr[1];
- window.open("<?= $this->configlib->site_url(); ?>/customer/invoice/print_invoice/" + idInvoice,"Invoice");
- alert("<?= lang("abdi.alert_9") ?>");
- break;
- case "INV-OK-EDIT":
- var tanya = confirm("Data Succesfully Saved, Print Invoice ?");
- if(tanya)
- {
- window.open("<?= $this->configlib->site_url(); ?>/customer/invoice/print_invoice/" + dataParsed[1],"Invoice");
- }
- break;
- case "U-XSIST" :
- alert("<?= lang("abdi.alert_9") ?>");
- break;
- case "aud_error" : // Audiogram
- //alert("<?= lang("abdi.alert_5") ?>");
- //add_elem("error_db",$obj_dest,data);
- $obj_dest= $('#frmAddAudiogram');
- $(".error_db").remove();
- $new_elem= '<div class="error_db"></div>';
- $obj_dest.prepend($new_elem);
- $(".error_db").html(dataParsed[1]);
- stat_dialog= false;
- break;
- default :
- alert("Error : " + data);
- break;
- }
- });
- //alert(stat_dialog);
- /*
- if( stat_dialog ){
- $(this).dialog("close");
- }
- */
- /*
- $("#dialog").empty();
- $(this).dialog("close");
- */
- }
- }else if( mockup == "marketing/sales" ){
- var records = $("#tblcart").getGridParam("records");
- if(records==0)
- {
- alert("<?= lang("abdi.alert_35") ?>")
- }else{
- var ask = confirm("All changes cannot be undo after transaction proceeded, do you want to continue ?");
- if(ask)
- {
- var IdKonsumen = $("#IdKonsumen").val();
- Diskon= $('#alldiscount').val(); // Diskon semua belanja
- Subtotal= $('#subtotal').val(); // SubTotal
- Total= $('#totalcart').val(); // Total Cart setelah diskon
- DP= $('#downpayment').val(); // DP
- isLunas= ( $('#pay').is(':checked') ) ? 1 : 0; // Lunas atau tidak
- IdPembayaran= "CS";
-
- varpost= { "IdKonsumen": IdKonsumen, "Diskon": Diskon, "Subtotal": Subtotal, "Total": Total,
- "DP": DP, "isLunas": isLunas, "IdPembayaran": IdPembayaran };
- $.post("<?= $this->configlib->site_url() ?>/marketing/sales/proceed_trans", varpost,
- function(data){
- if( data != "no-lunas" ){
- idInvoice= data;
- url_tujuan= "<?= $this->configlib->site_url(); ?>/customer/invoice/print_invoice/" + idInvoice;
- //alert(url_tujuan);
- window.open(url_tujuan, "Invoice");
- $("#dialog").empty();
- $("#dialog").dialog("close");
- }
- })
- }
- }
- }else{
- alert("hrd");
- $("#dialog").parent().hide();
- url= "<?php echo $this->configlib->site_url(); ?>/" + modul + "/" + func + "/save/" + act;
- var fileopt = {
- url: url,
- success: function(data) {
- switch(data){
- case "1" :
- alert("<?= lang("abdi.alert_5") ?>");
- break;
- case "0" :
- alert("<?= lang("abdi.alert_4") ?> ");
- break;
- default :
- alert("Error : " + data);
- break;
- }
- $("#dialog").empty();
- $("#dialog").dialog("close");
- }
- }
- //alert(frmID);
- $("#frmAddKar").ajaxSubmit(fileopt);
- }
- }
- }
- }
-
- var modadd= modul + "/" + func;
- var regmodadd= /^(customer\/master|customer\/dashboard)$/;
- if( regmodadd.test(modadd) ){
- var theButton = {
- 'Save': theSave,
- 'Proceed': theSave,
- 'Cancel': function(e) {
- $(this).empty();
- $(this).dialog('close');
- $('#jqTable').trigger('reloadGrid');
- }
- }
- }else{
- var theButton = {
- Save: theSave,
- Cancel: function() {
- $(this).empty();
- $(this).dialog('close');
- $('#jqTable').trigger('reloadGrid');
- }
- }
- }
- var dialogOpt = modul + "/" + func;
- switch(dialogOpt)
- {
- case 'customer/master' :
- theWidth = 850;
- theHeight = 630;
- theTitle = "Add/Edit Customer Data";
- break;
- case 'customer/repair' :
- theWidth = 560;
- theHeight = 650;
- theTitle = "Form New Repair";
- break;
- case 'customer/shipment' :
- theWidth = 740;
- theHeight = 600;
- theTitle = "Add Delivery";
- break;
- case 'customer/invoice' :
- theWidth = 900;
- theHeight = "auto";
- theTitle = "Add/Edit Invoice";
- break;
- case 'marketing/product' :
- theWidth = 400;
- theHeight = 460;
- theTitle = "Add/Edit New Product";
- break;
- case 'calendar/calendar' :
- theWidth = 500;
- theHeight = 450;
- theTitle = "Add/Edit Booking";
- theButton = {
- Close : function(){
- $(this).dialog("close");
- }
- }
- break;
- case 'logistic/bo' :
- theWidth = 700;
- theHeight = 600;
- theTitle = "Branch Order - My Request";
- theButton = {
- Close : function(){
- $(this).dialog("close");
- }
- }
- break;
- case 'hrd/master' :
- theWidth = 750;
- theHeight = "auto";
- theTitle = "Add/Edit Employees";
- break;
- case 'marketing/vendor' :
- theWidth = 400;
- theHeight = 500;
- theTitle = "Add/Edit Vendor";
- break;
- case 'logistic/product_deliver' :
- theWidth = 700;
- theHeight = 530;
- theTitle = "Add/Edit Branch Delivery";
- break;
- case 'logistic/product_receive' :
- theWidth = 760;
- theHeight = 400;
- theTitle = "Add/Edit Branch Receive";
- break;
- case 'logistic/shipping_db' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit Shipping List";
- break;
- case 'customer/clinical' :
- theWidth = 600;
- theHeight = 700;
- theTitle = "Add/Edit Clinical Information";
- break;
- case 'customer/comment' :
- theWidth = 600;
- theHeight = 600;
- theTitle = "Add Comment Customer";
- break;
- case 'customer/area_difficulties' :
- theWidth = 600;
- theHeight = 600;
- theTitle = "Add Area of Difficulties";
- break;
- case 'customer/report_repair' :
- theTitle = "Select Branch"
- theWidth = 500;
- theHeight = "auto";
- theUrl = "<?= $this->configlib->site_url() . "/customer/report_repair/popup"; ?>";
- theButton = {
- "select and close" : function(){
- select_branch(); //Function ini ada di view vBrowseCabang
- $("#dialog").dialog("close");
- }
- }
- break;
- case 'settings/account' :
- theWidth = 480;
- theHeight = 440;
- theTitle = "Add/Edit User Account";
- break;
- case 'marketing/mediatype' :
- theWidth = 500;
- theHeight = 'auto';
- theTitle = "Add/Edit Media Type";
- break;
- case 'marketing/mediacat' :
- theWidth = 500;
- theHeight = 'auto';
- theTitle = "Add/Edit Media Category";
- break;
- case 'marketing/media' :
- theWidth = 500;
- theHeight = 'auto';
- theTitle = "Add/Edit Media";
- break;
- case 'marketing/mediaiklan' :
- theWidth = 500;
- theHeight = 'auto';
- theTitle = "Add/Edit Campaign";
- break;
- case 'marketing/event' :
- theWidth = 500;
- theHeight = 600;
- theTitle = "Add/Edit Event";
- break;
- case 'logistic/stock' :
- theWidth = 500;
- theHeight = 600;
- theTitle = "Add/Edit Stock";
- break;
- case 'customer/religion' :
- theWidth = 450;
- theHeight = 250;
- theTitle = "Add/Edit Religion";
- break;
- case 'settings/klinik' :
- theWidth = 450;
- theHeight = 'auto';
- theTitle = "Add/Edit Clinic";
- break;
- case 'customer/family' :
- theWidth = 450;
- theHeight = 250;
- theTitle = "Add/Edit Family";
- break;
- case 'customer/country' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit Country";
- break;
- case 'customer/region' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit Region";
- break;
- case 'customer/kota' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit City";
- break;
- case 'customer/sapaan' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Salutation";
- break;
- case 'hrd/department' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Department";
- break;
- case 'hrd/leave_type' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Leave Type";
- break;
- case 'hrd/assign_leave' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Assign Leave";
- break;
- case "hrd/attendance" :
- theWidth = 400;
- theHeight = 400;
- theTitle = "Add Attendance Data";
- break;
- case 'hrd/occupation' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Position";
- break;
- case 'customer/job' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Occupation";
- break;
- case 'marketing/category' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Product Category";
- break;
- case 'marketing/service' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Service";
- break;
- case 'marketing/portfolio_product' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit Portfolio Product";
- break;
- case 'master/user_akses' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit User Access";
- break;
- case 'master/user_modul' :
- theWidth = 450;
- theHeight = "auto";
- theTitle = "Add/Edit User Modul";
- break;
- case 'master/user_hak_akses' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit User Privilege Access";
- break;
- case 'customer/dokter_referal' :
- theWidth = 500;
- theHeight = "auto";
- theTitle = "Add/Edit Doctor Referal";
- break;
- case 'logistic/inventory' :
- theWidth = 500;
- theHeight = 300;
- theTitle = "Add/Edit inventory";
- break;
- case 'marketing/sales' :
- theWidth = 900;
- theHeight = "auto";
- theTitle = "Add/Edit Sales Transaction";
- /*
- theButton = {
- "Save" : function
- "Cancel" : function(){
- $(this).dialog("close");
- }
- }
- */
- break;
- default :
- return;
- }
-
- $("#dialog").dialog({
- title : theTitle,
- width: theWidth,
- height: theHeight,
- modal: true,
- show : "blind",
- hide : "blind",
- position: "top",
- buttons: theButton
- ,
- close: function() {
- $(this).dialog("destroy");
- $("#dialog").empty();
- var regmodtrig= /^(customer\/master)$/;
- if( ! regmodtrig.test(modadd) ){
- $('#jqTable').trigger('reloadGrid');
- }
- },
- open : function()
- {
- $(this).append("<center><span><img src='<?php echo $this->config->item("img_url") ?>/dialogload.gif' /></span><br /><?= lang("abdi.alert_21") ?> ....</center>");
- $(this).load(theUrl);
- }
- });
- }
-
- function jDelete(id)
- {
- var ctrl = "<?= $this->uri->segment(2) . '/' . $this->uri->segment(3) ?>";
- switch(ctrl)
- {
- case 'marketing/product' :
- var MataUang = $("#" + id + " td:nth-child(5)").text();
- var varToPost = {"id":id,"MataUang": MataUang};
- break;
- default :
- var varToPost = {"id":encodeURIComponent(id)};
- break;
- }
- var ask = confirm("<?= lang("abdi.alert_10") ?> : " + id + ", <?= lang("abdi.alert_11") ?> ?");
- if(ask)
- {
- $.post("<?php echo $this->configlib->site_url() . "/" . $this->uri->segment(2) . "/" . $this->uri->segment(3); ?>/delete/",varToPost,function(data){
- switch(data)
- {
- case "1" :
- alert("<?= lang("abdi.alert_12") ?>");
- $('#jqTable').trigger('reloadGrid');
- break;
- case "0" :
- alert("<?= lang("abdi.alert_13") ?>");
- $('#jqTable').trigger('reloadGrid');
- break;
- case "2" :
- alert("<?= lang("abdi.alert_14") ?>");
- $('#jqTable').trigger('reloadGrid');
- break;
- default :
- alert(data);
- break;
- }
- });
- }
- }
- </script>