diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index a32bcabd..c7bed1d3 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -1572,22 +1572,22 @@ class Gestion extends CI_Controller $this->insertPalier($plr_user_wallet_cash_national, "user_wallet_cash_national", $idConfig); break; case 'user_carte_wallet': -// $plr_user_cart_wallet_international = $_POST['plr_user_cart_wallet_international'] ?? null; + $plr_user_cart_wallet_international = $_POST['plr_user_cart_wallet_international'] ?? null; $plr_user_cart_wallet_national = $_POST['plr_user_cart_wallet_national'] ?? null; -// $plr_user_cart_cash_international = $_POST['plr_user_cart_cash_international'] ?? null; + $plr_user_cart_cash_international = $_POST['plr_user_cart_cash_international'] ?? null; $plr_user_cart_cash_national = $_POST['plr_user_cart_cash_national'] ?? null; -// $plr_hyp_user_cart_cash_international = $_POST['plr_hyp_user_cart_cash_international'] ?? null; + $plr_hyp_user_cart_cash_international = $_POST['plr_hyp_user_cart_cash_international'] ?? null; $plr_hyp_user_cart_cash_national = $_POST['plr_hyp_user_cart_cash_national'] ?? null; -// $plr_bank_user_cart_cash_international = $_POST['plr_bank_user_cart_cash_international'] ?? null; + $plr_bank_user_cart_cash_international = $_POST['plr_bank_user_cart_cash_international'] ?? null; $plr_bank_user_cart_cash_national = $_POST['plr_bank_user_cart_cash_national'] ?? null; -// $this->insertPalier($plr_user_cart_wallet_international, "user_cart_wallet_international", $idConfig,'paliers_commissions_wallet'); + $this->insertPalier($plr_user_cart_wallet_international, "user_cart_wallet_international", $idConfig,'paliers_commissions_wallet'); $this->insertPalier($plr_user_cart_wallet_national, "user_cart_wallet_national", $idConfig ,'paliers_commissions_wallet'); -// $this->insertPalier($plr_user_cart_cash_international, "user_cart_cash_international", $idConfig,'paliers_commissions_wallet'); + $this->insertPalier($plr_user_cart_cash_international, "user_cart_cash_international", $idConfig,'paliers_commissions_wallet'); $this->insertPalier($plr_user_cart_cash_national, "user_cart_cash_national", $idConfig,'paliers_commissions_wallet'); -// $this->insertPalier($plr_hyp_user_cart_cash_international, "hyp_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet'); + $this->insertPalier($plr_hyp_user_cart_cash_international, "hyp_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet'); $this->insertPalier($plr_hyp_user_cart_cash_national, "hyp_user_cart_cash_national", $idConfig,'paliers_commissions_wallet'); -// $this->insertPalier($plr_bank_user_cart_cash_international, "bank_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet'); + $this->insertPalier($plr_bank_user_cart_cash_international, "bank_user_cart_cash_international", $idConfig ,'paliers_commissions_wallet'); $this->insertPalier($plr_bank_user_cart_cash_national, "bank_user_cart_cash_national", $idConfig,'paliers_commissions_wallet'); break; diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 46d21d16..d845b526 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -1433,16 +1433,16 @@ class Hyperviseur_dash extends CI_Controller break; case 'user_carte_wallet': $data['plr_user_cart_wallet_national'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_national", $data['idConfig']); -// $data['plr_user_cart_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_international", $data['idConfig']); + $data['plr_user_cart_wallet_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_wallet_international", $data['idConfig']); $data['plr_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_national", $data['idConfig']); -// $data['plr_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_international", $data['idConfig']); + $data['plr_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("user_cart_cash_international", $data['idConfig']); $data['plr_hyp_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_national", $data['idConfig']); -// $data['plr_hyp_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_international", $data['idConfig']); + $data['plr_hyp_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("hyp_user_cart_cash_international", $data['idConfig']); $data['plr_bank_user_cart_cash_national'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_national", $data['idConfig']); -// $data['plr_bank_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_international", $data['idConfig']); + $data['plr_bank_user_cart_cash_international'] = $this->wallet_model->getPalierCommissionsWallet("bank_user_cart_cash_international", $data['idConfig']); $this->load->view('header_hyp', $data); $this->load->view('config_wallet_ilink_hyp/user_carte_wallet'); diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 99826eb9..bf47c1d2 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -364,7 +364,7 @@ $lang['rate_com_hyp_send_wallet_cart_ilink_international'] = "Hypervisor commiss $lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Bank commission rate on wallet-to-card transaction for national iLink user"; $lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Bank commission rate on wallet-to-card transaction for iLink international user"; $lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for sending a card to another national wallet"; -$lang['config_ilink_user_cart_autre_wallet'] = 'Card withdrawal to another wallet'; +$lang['config_ilink_user_cart_autre_wallet'] = 'Sending card to another wallet'; $lang['rate_com_user_cart_autre_wallet_international'] = 'Customer commission rate on international money withdrawal operation'; $lang['rate_com_user_cart_autre_wallet_national'] = "Customer commission rate for national money withdrawal operations"; $lang['rate_com_bank_user_cart_autre_wallet_international'] = "Bank commission rate for international money withdrawal operations"; diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index e058af86..df3cfd30 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -376,7 +376,7 @@ $lang['rate_com_bq_send_wallet_cart_ilink_national'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink national"; $lang['rate_com_bq_send_wallet_cart_ilink_international'] = "Taux de commission banque sur operation d'envoi de wallet vers carte pour utilisateur iLink international"; $lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur opération d'envoi de carte à un autre wallet national"; -$lang['config_ilink_user_cart_autre_wallet'] = 'Retrait de carte vers autre wallet'; +$lang['config_ilink_user_cart_autre_wallet'] = 'Envoi de carte vers autre wallet'; $lang['rate_com_user_cart_autre_wallet_international'] = "Taux de commission du client sur operation de retrait d'argent international"; $lang['rate_com_user_cart_autre_wallet_national'] = "Taux de commission du client sur operation de retrait d'argent national"; $lang['rate_com_bank_user_cart_autre_wallet_international'] = "Taux de commission de la banque sur operation de retrait d'argent international"; diff --git a/application/views/config_wallet_ilink_hyp/user_carte_wallet.php b/application/views/config_wallet_ilink_hyp/user_carte_wallet.php index bb05b287..d445b7a9 100755 --- a/application/views/config_wallet_ilink_hyp/user_carte_wallet.php +++ b/application/views/config_wallet_ilink_hyp/user_carte_wallet.php @@ -97,6 +97,41 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); +
+
+
+

lang->line('rate_com_user_cart_wallet_international'); ?>

+
+ +
+ + + + + + + + + result() as $row) { + echo " + + + + " . ' + '; + } + } + ?> + +
MinMaxTaux (%)lang->line('ceiling')?>
" . $fmt->format($row->min) . "" . $fmt->format($row->max) . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . "
+
+ +
+
+ +
@@ -130,6 +165,39 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+

lang->line('rate_com_user_cart_cash_international'); ?>

+
+ +
+ + + + + + + + + result() as $row) { + echo " + + + + " . ' + '; + } + } + ?> + +
MinMaxTaux (%)lang->line('ceiling')?>
" . $fmt->format($row->min) . "" . $fmt->format($row->max) . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . "
+
+ +
+
@@ -165,6 +233,41 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+

lang->line('rate_com_hyp_remove_cart_ilink_international'); ?>

+
+ +
+ + + + + + + + + result() as $row) { + echo " + + + + " . ' + '; + } + } + ?> + +
MinMaxTaux (%)lang->line('ceiling')?>
" . $fmt->format($row->min) . "" . $fmt->format($row->max) . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . "
+
+ +
+
+
+
@@ -198,6 +301,39 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+

lang->line('rate_com_bq_remove_cart_ilink_international'); ?>

+
+ +
+ + + + + + + + + result() as $row) { + echo " + + + + " . ' + '; + } + } + ?> + +
MinMaxTaux (%)lang->line('ceiling')?>
" . $fmt->format($row->min) . "" . $fmt->format($row->max) . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . "
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + result() as $row) { + echo " + + + + " . ' + + '; + } + } + ?> + +
MinMaxlang->line('rate'); ?> (%)lang->line('ceiling')?>Actions
" . $row->min . "" . $row->max . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . " + + + +
+
+
+ +
@@ -269,7 +454,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
@@ -306,6 +491,53 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + result() as $row) { + echo " + + + + " . ' + + '; + } + } + ?> + +
MinMaxlang->line('rate'); ?> (%)lang->line('ceiling')?>Actions
" . $row->min . "" . $row->max . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . " + + + 󨜢 +
+
+
@@ -355,6 +587,55 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + result() as $row) { + echo " + + + + " . ' + + '; + } + } + ?> + +
MinMaxlang->line('rate'); ?> (%)lang->line('ceiling')?>Actions
" . $row->min . "" . $row->max . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . " + + 󢕂 + +
+
+
+ +
@@ -365,7 +646,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
@@ -402,6 +683,53 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
+
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + result() as $row) { + echo " + + + + " . ' + + '; + } + } + ?> + +
MinMaxlang->line('rate'); ?> (%)lang->line('ceiling')?>Actions
" . $row->min . "" . $row->max . "" . $row->taux . "" . (isset($row->plafond) ? floatval($row->plafond) : '') . " + + 󢔤 + +
+
+
@@ -454,16 +782,16 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); if ($('#walletForm')[0].checkValidity()) { // Paliers - // let plr_hyp_user_cart_cash_international = getPaliersTable('hyp_user_cart_cash_international'); + let plr_hyp_user_cart_cash_international = getPaliersTable('hyp_user_cart_cash_international'); let plr_hyp_user_cart_cash_national = getPaliersTable('hyp_user_cart_cash_national'); - // let plr_user_cart_cash_international = getPaliersTable('user_cart_cash_international'); + let plr_user_cart_cash_international = getPaliersTable('user_cart_cash_international'); let plr_user_cart_cash_national = getPaliersTable('user_cart_cash_national'); - // let plr_user_cart_wallet_international = getPaliersTable('user_cart_wallet_international'); + let plr_user_cart_wallet_international = getPaliersTable('user_cart_wallet_international'); let plr_user_cart_wallet_national = getPaliersTable('user_cart_wallet_national'); - // let plr_bank_user_cart_cash_international = getPaliersTable('bank_user_cart_cash_international'); + let plr_bank_user_cart_cash_international = getPaliersTable('bank_user_cart_cash_international'); let plr_bank_user_cart_cash_national = getPaliersTable('bank_user_cart_cash_national'); @@ -478,7 +806,11 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); "plr_hyp_user_cart_cash_national": plr_hyp_user_cart_cash_national, "plr_user_cart_cash_national": plr_user_cart_cash_national, "plr_user_cart_wallet_national": plr_user_cart_wallet_national, - "plr_bank_user_cart_cash_national" : plr_bank_user_cart_cash_national + "plr_bank_user_cart_cash_national" : plr_bank_user_cart_cash_national, + "plr_hyp_user_cart_cash_international": plr_hyp_user_cart_cash_international, + "plr_user_cart_cash_international": plr_user_cart_cash_international, + "plr_user_cart_wallet_international": plr_user_cart_wallet_international, + "plr_bank_user_cart_cash_international": plr_bank_user_cart_cash_international }, success: function (data) { if (data == '200') { @@ -779,9 +1111,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); // Paliers nationaux -// Table 7 + // Table 7 var actions7 = $("#user_cart_cash_national td:last-child").html(); -// Append table with add row form on add new button click + // Append table with add row form on add new button click $(".new7").click(function () { if (!actions7) { actions7 = '\n' + @@ -801,7 +1133,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); $("#user_cart_cash_national tbody tr").eq(index + 1).find(".add7, .edit7").toggle(); $('[data-toggle="tooltip"]').tooltip(); }); -// Add row on add button click + // Add row on add button click $(document).on("click", ".add7", function () { var empty = false; var input = $(this).parents("tr").find('input[type="number"]'); @@ -844,7 +1176,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); $(".new7").removeAttr("disabled"); } }); -// Edit row on edit button click + // Edit row on edit button click $(document).on("click", ".edit7", function () { $(this).parents("tr").find("td:not(:last-child)").each(function (index) { if (index == 0) @@ -864,5 +1196,354 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); $(this).parents("tr").remove(); $(".new7").removeAttr("disabled"); }); + + + // Internationaux + + //Table 12 + var actions12 = $("#user_cart_wallet_international td:last-child").html(); + // Append table with add row form on add new button click + $(".new12").click(function () { + if (!actions12) { + actions12 = '\n' + + ' \n' + + ' '; + } + $(this).attr("disabled", "disabled"); + var index = $("#user_cart_wallet_international tbody tr:last-child").index(); + var row = '' + + '' + + '' + + '' + + '' + + ' ' + actions12 + '' + + ''; + $("#user_cart_wallet_international").append(row); + $("#user_cart_wallet_international tbody tr").eq(index + 1).find(".add12, .edit12").toggle(); + $('[data-toggle="tooltip"]').tooltip(); + }); + // Add row on add button click + $(document).on("click", ".add12", function () { + var empty = false; + var input = $(this).parents("tr").find('input[type="number"]'); + var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val()); + var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val()); + + input.each(function () { + if ($(this).attr('id') == 'min') { + if (min >= max) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else if ($(this).attr('id') == 'max') { + if (max <= min) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else { + if (!$(this)[0].checkValidity()) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } + }); + $(this).parents("tr").find(".error").first().focus(); + if (!empty) { + input.each(function () { + $(this).parent("td").html($(this).val()); + }); + $(this).parents("tr").find(".add12, .edit12").toggle(); + $(".new12").removeAttr("disabled"); + } + }); + // Edit row on edit button click + $(document).on("click", ".edit12", function () { + $(this).parents("tr").find("td:not(:last-child)").each(function (index) { + if (index == 0) + $(this).html(''); + if (index == 1) + $(this).html(''); + if (index == 2) + $(this).html(''); + if (index == 3) + $(this).html(''); + }); + $(this).parents("tr").find(".add12, .edit12").toggle(); + $(".new12").attr("disabled", "disabled"); + }); + // Delete row on delete button click + $(document).on("click", ".delete12", function () { + $(this).parents("tr").remove(); + $(".new12").removeAttr("disabled"); + }); + + + // Table 72 + var actions72 = $("#user_cart_cash_international td:last-child").html(); + // Append table with add row form on add new button click + $(".new72").click(function () { + if (!actions72) { + actions72 = '󠜫\n' + + ' \n' + + ' 󨜢'; + } + $(this).attr("disabled", "disabled"); + var index = $("#user_cart_cash_international tbody tr:last-child").index(); + var row = '' + + '' + + '' + + '' + + '' + + ' ' + actions72 + '' + + ''; + $("#user_cart_cash_international").append(row); + $("#user_cart_cash_international tbody tr").eq(index + 1).find(".add72, .edit72").toggle(); + $('[data-toggle="tooltip"]').tooltip(); + }); + // Add row on add button click + $(document).on("click", ".add72", function () { + var empty = false; + var input = $(this).parents("tr").find('input[type="number"]'); + var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val()); + var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val()); + + input.each(function () { + if ($(this).attr('id') == 'min') { + if (min >= max) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else if ($(this).attr('id') == 'max') { + if (max <= min) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else { + if (!$(this)[0].checkValidity()) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } + }); + $(this).parents("tr").find(".error").first().focus(); + if (!empty) { + input.each(function () { + $(this).parent("td").html($(this).val()); + }); + $(this).parents("tr").find(".add72, .edit72").toggle(); + $(".new72").removeAttr("disabled"); + } + }); + // Edit row on edit button click + $(document).on("click", ".edit72", function () { + $(this).parents("tr").find("td:not(:last-child)").each(function (index) { + if (index == 0) + $(this).html(''); + if (index == 1) + $(this).html(''); + if (index == 2) + $(this).html(''); + if (index == 3) + $(this).html(''); + }); + $(this).parents("tr").find(".add72, .edit72").toggle(); + $(".new72").attr("disabled", "disabled"); + }); +// Delete row on delete button click + $(document).on("click", ".delete72", function () { + $(this).parents("tr").remove(); + $(".new72").removeAttr("disabled"); + }); + + + // Table 42 + var actions42 = $("#hyp_user_cart_cash_international td:last-child").html(); + // Append table with add row form on add new button click + $(".new42").click(function () { + if (!actions42) { + actions42 = '\n' + + ' 󢕂\n' + + ' '; + } + $(this).attr("disabled", "disabled"); + var index = $("#hyp_user_cart_cash_international tbody tr:last-child").index(); + var row = '' + + '' + + '' + + '' + + '' + + ' ' + actions42 + '' + + ''; + $("#hyp_user_cart_cash_international").append(row); + $("#hyp_user_cart_cash_international tbody tr").eq(index + 1).find(".add42, .edit42").toggle(); + $('[data-toggle="tooltip"]').tooltip(); + }); + // Add row on add button click + $(document).on("click", ".add42", function () { + var empty = false; + var input = $(this).parents("tr").find('input[type="number"]'); + var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val()); + var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val()); + + input.each(function () { + if ($(this).attr('id') == 'min') { + if (min >= max) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else if ($(this).attr('id') == 'max') { + if (max <= min) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else { + if (!$(this)[0].checkValidity()) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } + }); + $(this).parents("tr").find(".error").first().focus(); + if (!empty) { + input.each(function () { + $(this).parent("td").html($(this).val()); + }); + $(this).parents("tr").find(".add42, .edit42").toggle(); + $(".new42").removeAttr("disabled"); + } + }); + // Edit row on edit button click + $(document).on("click", ".edit42", function () { + $(this).parents("tr").find("td:not(:last-child)").each(function (index) { + if (index == 0) + $(this).html(''); + if (index == 1) + $(this).html(''); + if (index == 2) + $(this).html(''); + if (index == 3) + $(this).html(''); + }); + $(this).parents("tr").find(".add42, .edit42").toggle(); + $(".new42").attr("disabled", "disabled"); + }); + // Delete row on delete button click + $(document).on("click", ".delete42", function () { + $(this).parents("tr").remove(); + $(".new42").removeAttr("disabled"); + }); + + + var actions52 = $("#bank_user_cart_cash_international td:last-child").html(); + // Append table with add row form on add new button click + $(".new52").click(function () { + if (!actions52) { + actions52 = '\n' + + ' 󢔤\n' + + ' '; + } + $(this).attr("disabled", "disabled"); + var index = $("#bank_user_cart_cash_international tbody tr:last-child").index(); + var row = '' + + '' + + '' + + '' + + '' + + ' ' + actions52 + '' + + ''; + $("#bank_user_cart_cash_international").append(row); + $("#bank_user_cart_cash_international tbody tr").eq(index + 1).find(".add52, .edit52").toggle(); + $('[data-toggle="tooltip"]').tooltip(); + }); + // Add row on add button click + $(document).on("click", ".add52", function () { + var empty = false; + var input = $(this).parents("tr").find('input[type="number"]'); + var min = parseFloat($(this).parents("tr").find('input[id="min"]').first().val()); + var max = parseFloat($(this).parents("tr").find('input[id="max"]').first().val()); + + input.each(function () { + if ($(this).attr('id') == 'min') { + if (min >= max) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else if ($(this).attr('id') == 'max') { + if (max <= min) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } else { + if (!$(this)[0].checkValidity()) { + $(this).addClass("error"); + $(this)[0].reportValidity(); + empty = true; + } else { + $(this).removeClass("error"); + } + } + }); + $(this).parents("tr").find(".error").first().focus(); + if (!empty) { + input.each(function () { + $(this).parent("td").html($(this).val()); + }); + $(this).parents("tr").find(".add52, .edit52").toggle(); + $(".new52").removeAttr("disabled"); + } + }); + // Edit row on edit button click + $(document).on("click", ".edit52", function () { + $(this).parents("tr").find("td:not(:last-child)").each(function (index) { + if (index == 0) + $(this).html(''); + if (index == 1) + $(this).html(''); + if (index == 2) + $(this).html(''); + if (index == 3) + $(this).html(''); + }); + $(this).parents("tr").find(".add52, .edit52").toggle(); + $(".new52").attr("disabled", "disabled"); + }); + // Delete row on delete button click + $(document).on("click", ".delete52", function () { + $(this).parents("tr").remove(); + $(".new52").removeAttr("disabled"); + }); });