Browse Source

material integration

pull/1/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
1dde6ba8e5
  1. 26
      src/function/ganttConfig.js
  2. 55
      src/function/materialResource.js
  3. 10
      src/index.html

26
src/function/ganttConfig.js

@ -1,7 +1,9 @@
const ganttId = getUrlParameter("gantt_id");
const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id");
let base_url = getUrlParameter("base_url");
let base_url = getUrlParameter("base_url");
const adwIntegrationUrl = "http://ospro-api.adyawinsa.com:9083/api/";
const adwAuthToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA";
let userToVersionGanttId = 0
let activityId = 0;
@ -20,11 +22,11 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.request.use(async (config) => {
try{
$("body").addClass("loading");
$("body").addClass("loading");
}
catch(e)
{
$("body").removeClass("loading");
$("body").removeClass("loading");
alert('Error request' + e);
}
@ -33,12 +35,12 @@ axiosInstance.interceptors.request.use(async (config) => {
axiosInstance.interceptors.response.use(async (config) => {
try {
$("body").removeClass("loading");
$("body").removeClass("loading");
}
catch(e)
{
$("body").removeClass("loading");
alert('Error response' + e);
$("body").removeClass("loading");
alert('Error response' + e);
}
return config;
@ -61,11 +63,11 @@ $.ajaxSetup({
$(document).on({
ajaxStart: function(){
$("body").addClass("loading");
$("body").addClass("loading");
},
ajaxStop: function(){
$("body").removeClass("loading");
}
ajaxStop: function(){
$("body").removeClass("loading");
}
});
gantt.plugins({
@ -411,7 +413,7 @@ gantt.config.columns = createColumnsConfig({
gantt.config.reorder_grid_columns = true;
gantt.config.resize_rows = true;
gantt.config.grid_resize = true; // pro edition
gantt.config.grid_resize = true; // pro edition
gantt.config.min_column_width = 50;
gantt.config.scale_height = 20;
// gantt.config.row_height = 30;
@ -519,7 +521,7 @@ gantt.config.layout = {
// custom folder, file, collapse icons on activity
gantt.templates.grid_folder = function (item) {
// return "<div class='gantt_tree_icon gantt_folder_" + (item.$open ? "open" : "closed") + "'></div>";
// return "<div class='gantt_tree_icon gantt_folder_" + (item.$open ? "open" : "closed") + "'></div>";
return "";
};
gantt.templates.grid_file = function (item) {

55
src/function/materialResource.js

@ -9,18 +9,18 @@ function resetFormAssignMaterial() {
$('#btn-assign-material').prop("disabled", false);
};
var rupiah = document.getElementById('price-req-material');
rupiah.addEventListener('keyup', function (e) {
rupiah.value = formatRibuanInput(this.value);
var rupiah = document.getElementById('price-req-material');
rupiah.addEventListener('keyup', function (e) {
rupiah.value = formatRibuanInput(this.value);
});
var qty = document.getElementById('qty-req-material');
qty.addEventListener('keyup', function (e) {
qty.value = formatRibuanInput(this.value);
var qty = document.getElementById('qty-req-material');
qty.addEventListener('keyup', function (e) {
qty.value = formatRibuanInput(this.value);
});
$(document).ready(function () {
$(document).ready(function () {
var tableMaterial = $("#table-material").DataTable({
"processing": true,
"serverSide": true,
@ -132,6 +132,36 @@ $(document).ready(function () {
}
});
$('#select-material-integration').select2({
dropdownParent: materialModal,
placeholder: 'Pilih material',
allowClear: true,
ajax: {
url: `${adwIntegrationUrl}stock_master`,
type: "GET",
processData: false,
contentType: false,
headers: {
'Authorization': adwAuthToken,
},
processResults: function (data) {
var dataIntegrasiMaterial = [];
if (data) {
for(var i = 0; i < data.data.length; i++){
var newData = {
id: data.data[i].description,
text: data.data[i].description,
}
dataIntegrasiMaterial.push(newData);
}
}
return {
results: dataIntegrasiMaterial
};
}
}
});
$("#form-assign-material").on('submit', function (e) {
e.preventDefault();
@ -139,7 +169,7 @@ $(document).ready(function () {
$('#btn-assign-material').prop("disabled", true);
// /request-material/add
let desc_req_material = $("#description-req-material").val();
let desc_req_material = $("#select-material-integration").val();
let required_date = $("#required-date-req-material").val();
let plan_date = $("#required-date-plan-material").val();
let uom = $("#uom-req-material").val();
@ -156,7 +186,6 @@ $(document).ready(function () {
qty: formatReplaceTitikRibuan(qty_planning),
price: formatReplaceTitikRibuan(price)
}
console.log("PPPPP", payload);
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}request-material/add`,
@ -216,7 +245,7 @@ $(document).ready(function () {
}
});
// let material_id = $("#select-material").val();
// let material_id = $("#select-material").val();
// if (!material_id || material_id < 0) {
// gantt.alert("Please choose material to assign!");
@ -262,4 +291,4 @@ $(document).ready(function () {
}
});
});
});
});

10
src/index.html

@ -286,8 +286,8 @@
<div class="form-row">
<div class="col-md-2 form-group">
<label>Description</label>
<input type="text" id="description-req-material" name="descriptionReqMaterial"
class="form-control form-control-sm" />
<select id="select-material-integration" name="descriptionReqMaterial" class="form-control form-control-sm"
style="width:100%;"></select>
</div>
<div class="col-md-2 form-group">
<label>Price (IDR)</label>
@ -648,7 +648,7 @@
<label>Report Date</label>
<input type="date" id="ra_date_material" name="report_date" class="form-control form-control-sm"
required />
</div>
</div>
<div class="col-md-2 form-group">
<label>Volume Aktual</label>
<input type="text" id="volume_pekerjaan_material" name="qty"
@ -657,7 +657,7 @@
<div class="col-md-2 form-group">
<label>Foto</label>
<input type="file" id="foto_ra_material" name="files" class="form-control form-control-sm" />
</div>
</div>
<div class="col-md-4 form-group">
<label>Deskripsi</label>
<textarea id="ra_description_material" class="form-control form-control-sm" name="description"
@ -812,4 +812,4 @@
<script src="function/holiday.js"></script>
<script src="function/reportActivity.js"></script>
<script src="function/activityLocation.js"></script>
</body>
</body>

Loading…
Cancel
Save