Fixed conflict between components
This commit is contained in:
parent
c4b05cb525
commit
ac77c45f30
@ -47,8 +47,11 @@ class SiswaController extends Controller
|
|||||||
|
|
||||||
$siswa = Siswa::where('nisn', $request->nisn)
|
$siswa = Siswa::where('nisn', $request->nisn)
|
||||||
->where('tanggal_lahir', $tanggalLahir)
|
->where('tanggal_lahir', $tanggalLahir)
|
||||||
->with($request->with)
|
|
||||||
->first();
|
->first();
|
||||||
|
if ($request->with !== null)
|
||||||
|
$siswa = $siswa->with($request->with);
|
||||||
|
|
||||||
|
$siswa = $siswa->first();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redirect with error if not found
|
* Redirect with error if not found
|
||||||
|
95
public/js/app.js
vendored
95
public/js/app.js
vendored
@ -4744,6 +4744,10 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var mithril__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mithril */ "./node_modules/mithril/mithril.mjs");
|
/* harmony import */ var mithril__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mithril */ "./node_modules/mithril/mithril.mjs");
|
||||||
/* harmony import */ var _components_SuratKelulusan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/SuratKelulusan */ "./resources/js/components/SuratKelulusan.js");
|
/* harmony import */ var _components_SuratKelulusan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/SuratKelulusan */ "./resources/js/components/SuratKelulusan.js");
|
||||||
/* harmony import */ var _components_SKHasilBelajar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/SKHasilBelajar */ "./resources/js/components/SKHasilBelajar.js");
|
/* harmony import */ var _components_SKHasilBelajar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/SKHasilBelajar */ "./resources/js/components/SKHasilBelajar.js");
|
||||||
|
/* harmony import */ var _models_Siswa__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./models/Siswa */ "./resources/js/models/Siswa.js");
|
||||||
|
/* harmony import */ var _models_AccessLog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models/AccessLog */ "./resources/js/models/AccessLog.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -4751,6 +4755,52 @@ mithril__WEBPACK_IMPORTED_MODULE_0__["default"].route.prefix('#');
|
|||||||
mithril__WEBPACK_IMPORTED_MODULE_0__["default"].route(document.body.querySelector('.container'), '/', {
|
mithril__WEBPACK_IMPORTED_MODULE_0__["default"].route(document.body.querySelector('.container'), '/', {
|
||||||
'/': _components_SuratKelulusan__WEBPACK_IMPORTED_MODULE_1__["default"],
|
'/': _components_SuratKelulusan__WEBPACK_IMPORTED_MODULE_1__["default"],
|
||||||
'/hasil-belajar': _components_SKHasilBelajar__WEBPACK_IMPORTED_MODULE_2__["default"]
|
'/hasil-belajar': _components_SKHasilBelajar__WEBPACK_IMPORTED_MODULE_2__["default"]
|
||||||
|
}); // Below is to handle Ctrl+P or MouseR->Print
|
||||||
|
|
||||||
|
window.addEventListener("beforeprint", function () {
|
||||||
|
if (mithril__WEBPACK_IMPORTED_MODULE_0__["default"].route.get() === '/hasil-belajar') {
|
||||||
|
// If the print button did not exists, show nothing when printing
|
||||||
|
if (document.body.querySelector('button.print-button') === null) document.body.style.display = 'none';else {
|
||||||
|
if (!component.confirmPrint) {
|
||||||
|
alert('Surat Keterangan ini hanya dapat dicetak satu kali. Lanjutkan?');
|
||||||
|
component.confirmPrint = 1;
|
||||||
|
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].create({
|
||||||
|
siswaId: _models_Siswa__WEBPACK_IMPORTED_MODULE_3__["default"].current.id,
|
||||||
|
src: 'sk-hasil-belajar'
|
||||||
|
}).then(function () {
|
||||||
|
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].fetch('sk-hasil-belajar');
|
||||||
|
})["catch"](function (e) {
|
||||||
|
if (e.code === 0) {
|
||||||
|
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].error = {
|
||||||
|
message: e.message,
|
||||||
|
errors: {
|
||||||
|
create: ['Terjadi kesalahan saat menghubungkan ke server.']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].error = JSON.parse(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEventListener("afterprint", function () {
|
||||||
|
if (mithril__WEBPACK_IMPORTED_MODULE_0__["default"].route.get() === '/hasil-belajar') {
|
||||||
|
// Give back the whole document.body
|
||||||
|
if (document.body.querySelector('button.print-button') === null) document.body.style.display = 'block'; // Hide the print button
|
||||||
|
|
||||||
|
if (document.body.querySelector('button.print-button') !== null) document.body.querySelector('button.print-button').style.display = 'none'; // To redraw the content to prevent printing
|
||||||
|
|
||||||
|
var nisn = document.body.querySelector('input[name=nisn]').value,
|
||||||
|
tanggalLahir = document.body.querySelector('input[name=tanggalLahir]').value;
|
||||||
|
_models_Siswa__WEBPACK_IMPORTED_MODULE_3__["default"].cariData({
|
||||||
|
nisn: nisn,
|
||||||
|
tanggalLahir: tanggalLahir,
|
||||||
|
src: 'sk-hasil-belajar',
|
||||||
|
"with": ['hasilBelajar', 'accessLog']
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -4778,7 +4828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
var component = {
|
var component = {
|
||||||
oninit: function oninit() {
|
oninit: function oninit() {
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].fetch('sk-hasil-belajar');
|
_models_Siswa__WEBPACK_IMPORTED_MODULE_3__["default"].current = {}, _models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].fetch('sk-hasil-belajar');
|
||||||
},
|
},
|
||||||
namaMapel: {
|
namaMapel: {
|
||||||
'agama': 'Pendidikan Agama',
|
'agama': 'Pendidikan Agama',
|
||||||
@ -4905,49 +4955,7 @@ var component = {
|
|||||||
}
|
}
|
||||||
}))), Object(mithril__WEBPACK_IMPORTED_MODULE_0__["default"])('tr', Object(mithril__WEBPACK_IMPORTED_MODULE_0__["default"])('td', 'Drs. Engkos Kosasih, M.M.'))])])])];
|
}))), Object(mithril__WEBPACK_IMPORTED_MODULE_0__["default"])('tr', Object(mithril__WEBPACK_IMPORTED_MODULE_0__["default"])('td', 'Drs. Engkos Kosasih, M.M.'))])])])];
|
||||||
}
|
}
|
||||||
}; // Below is to handle Ctrl+P or MouseR->Print
|
|
||||||
|
|
||||||
window.addEventListener("beforeprint", function () {
|
|
||||||
// If the print button did not exists, show nothing when printing
|
|
||||||
if (document.body.querySelector('button.print-button') === null) document.body.style.display = 'none';else {
|
|
||||||
if (!component.confirmPrint) {
|
|
||||||
alert('Surat Keterangan ini hanya dapat dicetak satu kali. Lanjutkan?');
|
|
||||||
component.confirmPrint = 1;
|
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].create({
|
|
||||||
siswaId: _models_Siswa__WEBPACK_IMPORTED_MODULE_3__["default"].current.id,
|
|
||||||
src: 'sk-hasil-belajar'
|
|
||||||
}).then(function () {
|
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].fetch('sk-hasil-belajar');
|
|
||||||
})["catch"](function (e) {
|
|
||||||
if (e.code === 0) {
|
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].error = {
|
|
||||||
message: e.message,
|
|
||||||
errors: {
|
|
||||||
create: ['Terjadi kesalahan saat menghubungkan ke server.']
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_4__["default"].error = JSON.parse(e.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
window.addEventListener("afterprint", function () {
|
|
||||||
// Give back the whole document.body
|
|
||||||
if (document.body.querySelector('button.print-button') === null) document.body.style.display = 'block'; // Hide the print button
|
|
||||||
|
|
||||||
if (document.body.querySelector('button.print-button') !== null) document.body.querySelector('button.print-button').style.display = 'none'; // To redraw the content to prevent printing
|
|
||||||
|
|
||||||
var nisn = document.body.querySelector('input[name=nisn]').value,
|
|
||||||
tanggalLahir = document.body.querySelector('input[name=tanggalLahir]').value;
|
|
||||||
_models_Siswa__WEBPACK_IMPORTED_MODULE_3__["default"].cariData({
|
|
||||||
nisn: nisn,
|
|
||||||
tanggalLahir: tanggalLahir,
|
|
||||||
src: 'sk-hasil-belajar',
|
|
||||||
"with": ['hasilBelajar', 'accessLog']
|
|
||||||
});
|
|
||||||
});
|
|
||||||
/* harmony default export */ __webpack_exports__["default"] = (component);
|
/* harmony default export */ __webpack_exports__["default"] = (component);
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -4972,6 +4980,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
var component = {
|
var component = {
|
||||||
oninit: function oninit() {
|
oninit: function oninit() {
|
||||||
|
_models_Siswa__WEBPACK_IMPORTED_MODULE_2__["default"].current = {};
|
||||||
_models_AccessLog__WEBPACK_IMPORTED_MODULE_3__["default"].fetch('surat-kelulusan');
|
_models_AccessLog__WEBPACK_IMPORTED_MODULE_3__["default"].fetch('surat-kelulusan');
|
||||||
},
|
},
|
||||||
view: function view() {
|
view: function view() {
|
||||||
|
56
resources/js/app.js
vendored
56
resources/js/app.js
vendored
@ -1,9 +1,65 @@
|
|||||||
import m from "mithril"
|
import m from "mithril"
|
||||||
import SuratKelulusan from "./components/SuratKelulusan"
|
import SuratKelulusan from "./components/SuratKelulusan"
|
||||||
import SKHasilBelajar from "./components/SKHasilBelajar"
|
import SKHasilBelajar from "./components/SKHasilBelajar"
|
||||||
|
import Siswa from "./models/Siswa"
|
||||||
|
import AccessLog from "./models/AccessLog"
|
||||||
|
|
||||||
m.route.prefix('#');
|
m.route.prefix('#');
|
||||||
m.route(document.body.querySelector('.container'), '/', {
|
m.route(document.body.querySelector('.container'), '/', {
|
||||||
'/': SuratKelulusan,
|
'/': SuratKelulusan,
|
||||||
'/hasil-belajar': SKHasilBelajar,
|
'/hasil-belajar': SKHasilBelajar,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Below is to handle Ctrl+P or MouseR->Print
|
||||||
|
window.addEventListener("beforeprint", function () {
|
||||||
|
if (m.route.get() === '/hasil-belajar') {
|
||||||
|
// If the print button did not exists, show nothing when printing
|
||||||
|
if (document.body.querySelector('button.print-button') === null)
|
||||||
|
document.body.style.display = 'none';
|
||||||
|
else {
|
||||||
|
if (!component.confirmPrint) {
|
||||||
|
alert('Surat Keterangan ini hanya dapat dicetak satu kali. Lanjutkan?');
|
||||||
|
component.confirmPrint = 1;
|
||||||
|
AccessLog.create({siswaId: Siswa.current.id, src: 'sk-hasil-belajar'}).then(() => {
|
||||||
|
AccessLog.fetch('sk-hasil-belajar');
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
if (e.code === 0) {
|
||||||
|
AccessLog.error = {
|
||||||
|
message: e.message,
|
||||||
|
errors: {
|
||||||
|
create: ['Terjadi kesalahan saat menghubungkan ke server.'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AccessLog.error = JSON.parse(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("afterprint", function () {
|
||||||
|
if (m.route.get() === '/hasil-belajar') {
|
||||||
|
// Give back the whole document.body
|
||||||
|
if (document.body.querySelector('button.print-button') === null)
|
||||||
|
document.body.style.display = 'block';
|
||||||
|
|
||||||
|
// Hide the print button
|
||||||
|
if (document.body.querySelector('button.print-button') !== null)
|
||||||
|
document.body.querySelector('button.print-button').style.display = 'none';
|
||||||
|
|
||||||
|
// To redraw the content to prevent printing
|
||||||
|
let nisn = document.body.querySelector('input[name=nisn]').value,
|
||||||
|
tanggalLahir = document.body.querySelector('input[name=tanggalLahir]').value;
|
||||||
|
Siswa.cariData({
|
||||||
|
nisn,
|
||||||
|
tanggalLahir,
|
||||||
|
src: 'sk-hasil-belajar',
|
||||||
|
with: ['hasilBelajar', 'accessLog'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
50
resources/js/components/SKHasilBelajar.js
vendored
50
resources/js/components/SKHasilBelajar.js
vendored
@ -6,6 +6,7 @@ import AccessLog from "../models/AccessLog"
|
|||||||
|
|
||||||
var component = {
|
var component = {
|
||||||
oninit: () => {
|
oninit: () => {
|
||||||
|
Siswa.current = {},
|
||||||
AccessLog.fetch('sk-hasil-belajar');
|
AccessLog.fetch('sk-hasil-belajar');
|
||||||
},
|
},
|
||||||
namaMapel: {
|
namaMapel: {
|
||||||
@ -350,53 +351,4 @@ var component = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Below is to handle Ctrl+P or MouseR->Print
|
|
||||||
window.addEventListener("beforeprint", function () {
|
|
||||||
// If the print button did not exists, show nothing when printing
|
|
||||||
if (document.body.querySelector('button.print-button') === null)
|
|
||||||
document.body.style.display = 'none';
|
|
||||||
else {
|
|
||||||
if (!component.confirmPrint) {
|
|
||||||
alert('Surat Keterangan ini hanya dapat dicetak satu kali. Lanjutkan?');
|
|
||||||
component.confirmPrint = 1;
|
|
||||||
AccessLog.create({siswaId: Siswa.current.id, src: 'sk-hasil-belajar'}).then(() => {
|
|
||||||
AccessLog.fetch('sk-hasil-belajar');
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
if (e.code === 0) {
|
|
||||||
AccessLog.error = {
|
|
||||||
message: e.message,
|
|
||||||
errors: {
|
|
||||||
create: ['Terjadi kesalahan saat menghubungkan ke server.'],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
AccessLog.error = JSON.parse(e.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("afterprint", function () {
|
|
||||||
// Give back the whole document.body
|
|
||||||
if (document.body.querySelector('button.print-button') === null)
|
|
||||||
document.body.style.display = 'block';
|
|
||||||
|
|
||||||
// Hide the print button
|
|
||||||
if (document.body.querySelector('button.print-button') !== null)
|
|
||||||
document.body.querySelector('button.print-button').style.display = 'none';
|
|
||||||
|
|
||||||
// To redraw the content to prevent printing
|
|
||||||
let nisn = document.body.querySelector('input[name=nisn]').value,
|
|
||||||
tanggalLahir = document.body.querySelector('input[name=tanggalLahir]').value;
|
|
||||||
Siswa.cariData({
|
|
||||||
nisn,
|
|
||||||
tanggalLahir,
|
|
||||||
src: 'sk-hasil-belajar',
|
|
||||||
with: ['hasilBelajar', 'accessLog'],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
export default component;
|
export default component;
|
||||||
|
1
resources/js/components/SuratKelulusan.js
vendored
1
resources/js/components/SuratKelulusan.js
vendored
@ -5,6 +5,7 @@ import AccessLog from "../models/AccessLog"
|
|||||||
|
|
||||||
var component = {
|
var component = {
|
||||||
oninit: () => {
|
oninit: () => {
|
||||||
|
Siswa.current = {};
|
||||||
AccessLog.fetch('surat-kelulusan');
|
AccessLog.fetch('surat-kelulusan');
|
||||||
},
|
},
|
||||||
view: () => {
|
view: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user