Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @section scripts {
- <script>
- $(document).ready(function () {
- AddTaskToUser = function () {
- @*$.get('@Url.Action("GetAddTask", "Users", new {userId = Model.User.Id})', )*@
- $.get('@(Url.Action("GetAddTask", "Users", new {userId = Model.User.Id}))',
- function (taskAssignPartialHtml) {
- bootbox.dialog({
- title: "Assign a Task",
- message: taskAssignPartialHtml,
- buttons: {
- cancel: {
- label: "Cancel",
- className: "btn-cancel",
- callback: function () { }
- },
- success: {
- label: "Add",
- className: "btn-success",
- callback: function () {
- $.ajax({
- type: "POST",
- url: '@Url.Action("AssignTaskFromPartial", "Users")',
- data: $('#taskForm').serialize(),
- success: function (result) {
- if (result) {
- if (result.result == true) {
- alert("hello");
- $("#userTasksDiv").load('@(Url.Action("GetUserTasks", "Users", new { userId = Model.User.Id }))', function () {
- //FormatRewardsTable();
- });
- }
- else {
- bootbox.dialog({
- title: "Error loading rewards",
- message: result.message,
- buttons: {
- cancel: {
- label: "OK",
- className: "btn-primary",
- callback: function () {
- }
- }
- }
- });
- }
- }
- },
- error: function (err) {
- alert("Ajax save error. " + err);
- }
- });
- }
- }
- }
- });
- });
- }
- AddCertToUser = function () {
- @*$.get('@Url.Action("GetAddTask", "Users", new {userId = Model.User.Id})', )*@
- $.get('@(Url.Action("GetAddCert", "Users", new {userId = Model.User.Id}))',
- function (certAssignPartialHtml) {
- bootbox.dialog({
- title: "Assign a Certification",
- message: certAssignPartialHtml,
- buttons: {
- cancel: {
- label: "Cancel",
- className: "btn-cancel",
- callback: function () { }
- },
- success: {
- label: "Add",
- className: "btn-success",
- callback: function () {
- $.ajax({
- type: "POST",
- url: '@Url.Action("AssignCertFromPartial", "Users")',
- data: $('#certForm').serialize(),
- success: function (result) {
- if (result) {
- if (result.result == true) {
- alert("hello");
- $("#userCertsDiv").load('@(Url.Action("GetUserCerts", "Users", new { userId = Model.User.Id }))', function () {
- //FormatRewardsTable();
- });
- }
- else {
- bootbox.dialog({
- title: "Error loading rewards",
- message: result.message,
- buttons: {
- cancel: {
- label: "OK",
- className: "btn-primary",
- callback: function () {
- }
- }
- }
- });
- }
- }
- },
- error: function (err) {
- alert("Ajax save error. " + err);
- }
- });
- }
- }
- }
- });
- });
- }
- });
- </script>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement