| Current Path : /var/www/html/dyna-project/views/projects/ |
| Current File : /var/www/html/dyna-project/views/projects/footer.php.20210517 |
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
?>
<?php
$this->registerJs("$('#projects-start_dt').datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: true,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
todayHighlight: true,
});");
$this->registerJs("$('#projects-end_dt').datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: true,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
todayHighlight: true,
});");
$this->registerJs("$('.datepicker').datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: true,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
todayHighlight: true,
});");
?>
<script>
function addnewtask(rowID, rowPhaseID) {
var totaltask = $('#totaltask').val();
$.ajax({
url: "index.php?r=templates/addnewtask&totaltask=" + totaltask + '&rowPhaseID=' + rowPhaseID,
method: "GET",
success: function (response) {
if (response !== '') {
var newtotaltask = parseInt(totaltask) + 1;
$("#" + rowID).after(response);
$('#totaltask').val(newtotaltask);
$('#task_startdt_' + newtotaltask).datepicker("destroy");
$('#task_startdt_' + newtotaltask).datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: false,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
$('#task_enddt_' + newtotaltask).datepicker("destroy");
$('#task_enddt_' + newtotaltask).datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: false,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
$('#task_assignto_'+newtotaltask).selectpicker('refresh');
}
},
});
}
function addnewtask2(rowID, rowPhaseID) {
var totaltask = $('#totaltask').val();
$.ajax({
url: "index.php?r=templates/addnewtask2&totaltask=" + totaltask + '&rowPhaseID=' + rowPhaseID,
method: "GET",
success: function (response) {
if (response !== '') {
var newtotaltask = parseInt(totaltask) + 1;
$("#" + rowID).after(response);
$('#totaltask').val(newtotaltask);
$('#task_startdt_' + newtotaltask).datepicker("destroy");
$('#task_startdt_' + newtotaltask).datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: false,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
$('#task_enddt_' + newtotaltask).datepicker("destroy");
$('#task_enddt_' + newtotaltask).datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: false,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
$('#task_assignto_'+newtotaltask).selectpicker('refresh');
}
},
});
}
function calcprojectdue() {
var start_dt = $('#projects-start_dt').val();
$.ajax({
url: "index.php?r=projects/calcprojectdue",
method: "POST",
data: {"start_dt": start_dt},
success: function (response) {
$('#projects-end_dt').val(response);
$("#projects-end_dt").datepicker("destroy");
$('#projects-end_dt').datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: true,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
$('#projects-end_dt').datepicker("refresh");
},
});
updatetaskdate();
}
var countpic = 1;
function addpic() {
$.ajax({
url: "index.php?r=pic/addpic",
method: "POST",
data: {"countpic": countpic},
async: false,
success: function (response) {
$('#piclist').append(response);
$('#new_pic_user_' + countpic).selectpicker();
$('#new_pic_role_' + countpic).selectpicker();
},
});
countpic++;
}
function changerole(role, no) {
$.ajax({
url: "index.php?r=pic/changerole",
method: "POST",
data: {"role": role},
async: false,
success: function (response) {
$('#pic_user_' + no).find('option').not(':first').remove();
$('#pic_user_' + no).append(response);
$('#pic_user_' + no).selectpicker('refresh');
},
});
}
function checkform() {
var status = 1;
var msg = '';
if ($('#projects-name').val() === '') {
msg += 'Project Name cannot be blank<br/>';
status = 0;
}
if ($('#projects-staff_me').val() === '') {
msg += 'Marketing Executive cannot be blank<br/>';
status = 0;
}
if ($('#projects-staff_gd').val() === '') {
msg += 'Graphic Designer cannot be blank<br/>';
status = 0;
}
if ($('#projects-staff_cw').val() === '') {
msg += 'Content Writer cannot be blank<br/>';
status = 0;
}
if ($('#projects-staff_wd').val() === '') {
msg += 'Web Designer cannot be blank<br/>';
status = 0;
}
$('.brand_name').each(function () {
if ($(this).val() === '') {
msg += 'Brand Name cannot be blank<br>';
status = 0;
}
});
$('.taskno').each(function () {
if ($(this).val() === '') {
msg += 'Task No. cannot be blank<br/>';
status = 0;
}
});
$('.taskname').each(function () {
if ($(this).val() === '') {
msg += 'Task Name cannot be blank<br/>';
status = 0;
}
});
$('select.taskassignto').each(function () {
if ($(this).val() === '') {
msg += 'Task Assign To cannot be blank<br/>';
status = 0;
}
});
$('.task_duration').each(function () {
if ($(this).val() === '') {
msg += 'Task Duration cannot be blank<br/>';
status = 0;
}
});
$('.taskstardt').each(function () {
if ($(this).val() === '') {
msg += 'Task Start Date cannot be blank<br/>';
status = 0;
}
});
$('.taskenddt').each(function () {
if ($(this).val() === '') {
msg += 'Task End Date cannot be blank<br/>';
status = 0;
}
});
if (status === 0) {
Swal.fire({
title: 'Please complete the form',
html: msg,
type: 'warning'
});
}
if (status === 1)
$('#w0').submit();
}
function updatetaskdate() {
var start_dt = $('#projects-start_dt').val();
$('.task_duration').each(function () {
var duration = $(this).val();
var id = $(this).attr('id');
var arr = id.split('_');
var no = arr[2];
$('#task_startdt_' + no).val(start_dt);
$.ajax({
url: "index.php?r=projects/calctaskend",
method: "POST",
async: false,
data: {"duration": duration, "start_dt": start_dt},
success: function (response) {
var output = response.split('<--->');
$('#task_enddt_' + no).val(output[0]);
start_dt = output[1];
},
});
$('#task_startdt_' + no).datepicker("destroy");
$('#task_startdt_' + no).datepicker({
rtl: KTUtil.isRTL(),
todayHighlight: false,
orientation: 'bottom left',
format: 'yyyy-mm-dd',
clearBtn: false,
});
});
}
function changestafftask(type, selstaff) {
$('.assignto_' + type).val(selstaff);
$('.assignto_' + type).selectpicker('refresh');
}
function updatetaskenddate(no) {
var duration = $('#task_duration_' + no).val();
var start_dt = $('#task_startdt_' + no).val();
$.ajax({
url: "index.php?r=projects/calctaskend",
method: "POST",
async: false,
data: {"duration": duration, "start_dt": start_dt},
success: function (response) {
var output = response.split('<--->');
$('#task_enddt_' + no).val(output[0]);
},
});
}
</script>