File: /var/www/vhost/disk-apps/sigedo-dev.allup.com.co/public/js/views/covenantprograms.js
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 12);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./resources/js/views/covenantprograms.js":
/*!************************************************!*\
!*** ./resources/js/views/covenantprograms.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
$(document).ready(function () {
function getData() {
var program_id = document.getElementById("program_id").value;
var rotation_id = document.getElementById("rotation_id").value;
var services = $("#services").val();
var teacher_id = document.getElementById("teacher_id").value;
var code = document.getElementById("code").value;
var agent_name = document.getElementById("agent_name").value;
var agent_phone = document.getElementById("agent_phone").value;
var agent_email = document.getElementById("agent_email").value;
var approval_date = document.getElementById("approval_date").value;
var approval_number = document.getElementById("approval_number").value;
var quota_simultaneity = document.getElementById("quota_simultaneity").value;
var quantity_weeks = document.getElementById("quantity_weeks").value;
var quantity_hours = document.getElementById("quantity_hours").value;
if (!program_id || program_id == 0) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.program_required")
});
return;
}
if (!rotation_id || rotation_id == 0) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.rotation_required")
});
return;
}
if (!services || services.length == 0) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.services_required")
});
return;
}
if (!teacher_id || teacher_id == 0) {
teacher_id = null; // Swal.fire({
// type: "error",
// title: "Oops...",
// text: Lang.get("fronjs.teacher_required"),
// });
// return;
}
if (!code || code == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.code_required")
});
return;
}
if (!agent_name || agent_name == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.agent_name_required")
});
return;
}
if (!agent_phone || agent_phone == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.agent_phone_required")
});
return;
}
if (!agent_email || agent_email == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.agent_email_required")
});
return;
}
if (!approval_date || approval_date == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.approval_date_required")
});
return;
}
if (!approval_number || approval_number == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.approval_number_required")
});
return;
}
if (!quota_simultaneity || quota_simultaneity == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quota_simultaneity_required")
});
return;
}
if (parseInt(quota_simultaneity) < 1 || parseInt(quota_simultaneity) > 15) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quota_simultaneity_rank")
});
return;
}
if (!quantity_weeks || quantity_weeks == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quantity_weeks_required")
});
return;
}
if (parseInt(quantity_weeks) < 0 || parseInt(quantity_weeks) > 52) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quantity_weeks_rank")
});
return;
}
if (!quantity_hours || quantity_hours == "") {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quantity_hours_required")
});
return;
}
if (parseInt(quantity_hours) < 0 || parseInt(quantity_hours) > 66) {
Swal.fire({
type: "error",
title: "Oops...",
text: Lang.get("fronjs.quantity_hours_rank")
});
return;
}
var data = {
services: services,
program_id: program_id,
rotation_id: rotation_id,
teacher_id: teacher_id,
code: code,
agent_name: agent_name,
agent_phone: agent_phone,
agent_email: agent_email,
approval_date: approval_date,
approval_number: approval_number,
quota_simultaneity: quota_simultaneity,
quantity_weeks: quantity_weeks,
quantity_hours: quantity_hours
};
return data;
}
$("#button_create").on("click", function (e) {
e.preventDefault();
if (data = getData()) {
var covenant_id = $("#form_create").attr("covenant_id");
data.covenant_id = covenant_id;
Swal.fire({
title: Lang.get("fronjs.title_create"),
text: Lang.get("fronjs.text_create"),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: Lang.get("fronjs.yes"),
cancelButtonText: Lang.get("fronjs.not")
}).then(function (result) {
if (result.value) {
var laddaBtn = e.currentTarget;
var ladda = Ladda.create(laddaBtn);
ladda.start();
$.ajax({
url: "/covenantprograms/" + covenant_id + "/programs",
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(data),
success: function success(response) {
ladda.stop();
if (response.status) {
Swal.fire({
type: response.type,
title: response.title,
text: response.message,
showConfirmButton: true
}).then(function (val) {
$(location).attr("href", "/covenantprograms/" + covenant_id + "/programs");
});
} else {
Swal.fire({
type: response.type,
title: response.title,
text: response.message
});
}
}
});
}
});
}
});
$("#button_update").on("click", function (e) {
e.preventDefault();
var data = getData();
if (data) {
var covenant_id = $("#form_edit").attr("covenant_id");
data.covenant_id = covenant_id;
var covenantprogram_id = $("#form_edit").attr("covenantprogram_id");
var newData = Object.assign({
_method: $("input[name=_method]").val()
}, data);
Swal.fire({
title: Lang.get("fronjs.title_update"),
text: Lang.get("fronjs.text_update"),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: Lang.get("fronjs.yes"),
cancelButtonText: Lang.get("fronjs.not")
}).then(function (result) {
if (result.value) {
var laddaBtn = e.currentTarget;
var ladda = Ladda.create(laddaBtn);
ladda.start();
$.ajax({
url: "/covenantprograms/" + covenant_id + "/programs/" + covenantprogram_id + "/edit",
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(newData),
success: function success(response) {
ladda.stop();
if (response.status) {
Swal.fire({
type: response.type,
title: response.title,
text: response.message,
showConfirmButton: true
}).then(function (val) {
$(location).attr("href", "/covenantprograms/" + covenant_id + "/programs");
});
} else {
Swal.fire({
type: response.type,
title: response.title,
text: response.message
});
}
}
});
}
});
}
});
});
window.deleteRegistry = function (covenant_id, covenantprogram_id) {
var data = {
_method: "DELETE"
};
Swal.fire({
title: Lang.get("fronjs.title_delete"),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: Lang.get("fronjs.yes"),
cancelButtonText: Lang.get("fronjs.not"),
showLoaderOnConfirm: true,
allowOutsideClick: false,
allowEscapeKey: false,
preConfirm: function preConfirm(login) {
return new Promise(function (resolve, reject) {
$.ajax({
url: "/covenantprograms/" + covenantprogram_id + "/programs",
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(data),
success: function success(response) {
if (response.status) {
Swal.fire({
type: response.type,
title: response.title,
text: response.message,
showConfirmButton: true
}).then(function (val) {
$(location).attr("href", "/covenantprograms/" + covenant_id + "/programs");
});
} else {
Swal.fire({
type: response.type,
title: response.title,
text: response.message
});
}
}
});
});
}
}).then(function (result) {
console.log(result);
});
};
/***/ }),
/***/ 12:
/*!******************************************************!*\
!*** multi ./resources/js/views/covenantprograms.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! /Users/carlosarcos/Desktop/AlianSAP/huv_web/resources/js/views/covenantprograms.js */"./resources/js/views/covenantprograms.js");
/***/ })
/******/ });