ultimatepos/Modules/Project/Resources/views/project/show.blade.php

395 lines
18 KiB
PHP

@extends('layouts.app')
@section('title', __('project::lang.view_project'))
@section('content')
<section class="content-header">
<h1>
<i class="fas fa-check-circle"></i>
{{ucFirst($project->name)}}
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<!-- Custom Tabs -->
<!-- project_id to be used in datatable -->
<input type="hidden" name="project_id" id="project_id" value="{{$project->id}}">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="
@if($tab_view == 'overview')
active
@else
''
@endif">
<a href="#project_overview" data-toggle="tab" aria-expanded="true" data-url="{{action([\Modules\Project\Http\Controllers\ProjectController::class, 'show'], [$project->id]).'?view=overview'}}">
<i class="fas fa-tachometer-alt"></i>
@lang('project::lang.overview')
</a>
</li>
<li class="
@if($tab_view == 'activities')
active
@else
''
@endif">
<a href="#activities" data-toggle="tab" aria-expanded="true">
<i class="fas fa-chart-line"></i>
@lang('lang_v1.activities')
</a>
</li>
<li class="
@if($tab_view == 'project_task')
active
@else
''
@endif">
<a href="#project_task" data-toggle="tab" aria-expanded="true">
<i class="fa fa-tasks"></i>
@lang('project::lang.task')
</a>
</li>
@if(isset($project->settings['enable_timelog']) && $project->settings['enable_timelog'])
<li class="
@if($tab_view == 'time_log')
active
@else
''
@endif">
<a href="#time_log" data-toggle="tab" aria-expanded="true">
<i class="fas fa-clock"></i>
@lang('project::lang.time_logs')
</a>
</li>
@endif
@if(isset($project->settings['enable_notes_documents']) && $project->settings['enable_notes_documents'])
<li class="
@if($tab_view == 'documents_and_notes')
active
@else
''
@endif">
<a href="#documents_and_notes" data-toggle="tab" aria-expanded="true">
<i class="fas fa-file-image"></i>
@lang('project::lang.documents_and_notes')
</a>
</li>
@endif
@if((isset($project->settings['enable_invoice']) && $project->settings['enable_invoice']) && $is_lead_or_admin)
<li class="
@if($tab_view == 'project_invoices')
active
@else
''
@endif">
<a href="#project_invoices" data-toggle="tab" aria-expanded="true">
<i class="fa fa-file"></i>
@lang('project::lang.invoices')
</a>
</li>
@endif
@if(!empty($show_project_assets))
<li class="
@if($tab_view == 'project_assets')
active
@else
''
@endif">
<a href="#project_assets" data-toggle="tab" aria-expanded="true">
<i class="fas fa-industry"></i>
@lang('project::lang.assets_and_equipment')
</a>
</li>
@endif
@if(!empty($tms_installed) && auth()->user()->can('tms.shipments.view'))
<li class="
@if($tab_view == 'project_shipments')
active
@else
''
@endif">
<a href="#project_shipments" data-toggle="tab" aria-expanded="true">
<i class="fa fa-truck"></i>
@lang('project::lang.project_shipments')
</a>
</li>
@endif
@if($is_lead_or_admin)
<li class="
@if($tab_view == 'project_settings')
active
@else
''
@endif">
<a href="#project_settings" data-toggle="tab" aria-expanded="true">
<i class="fa fa-cogs"></i>
@lang('role.settings')
</a>
</li>
@endif
</ul>
<div class="tab-content">
<div class="tab-pane
@if($tab_view == 'overview')
active
@else
''
@endif" id="project_overview">
@includeIf('project::project.partials.overview')
</div>
<div class="tab-pane
@if($tab_view == 'activities')
active
@else
''
@endif" id="activities">
<ul class="timeline">
</ul>
</div>
<div class="tab-pane
@if($tab_view == 'project_task')
active
@else
''
@endif" id="project_task">
<div class="row">
<div class="col-md-3">
<div class="form-group">
{!! Form::label('assigned_to_filter', __('project::lang.assigned_to') . ':') !!}
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user"></i>
</span>
{!! Form::select('assigned_to_filter', $project_members, null, ['class' => 'form-control select2', 'placeholder' => __('messages.all'), 'style' => 'width: 100%;']); !!}
</div>
</div>
</div>
<div class="col-md-3 status_filter
@if(isset($project->settings['task_view']) &&
$project->settings['task_view'] == 'kanban')
hide
@endif">
<div class="form-group">
{!! Form::label('status_filter', __('sale.status') . ':') !!}
{!! Form::select('status_filter', $statuses, null, ['class' => 'form-control select2', 'placeholder' => __('messages.all'), 'style' => 'width: 100%;']); !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('priority_filter', __('project::lang.priority') .':') !!}
{!! Form::select('priority_filter', $priorities, null, ['class' => 'form-control select2', 'placeholder' => __('messages.all'), 'style' => 'width: 100%;']); !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('due_date_filter', __('project::lang.due_date') . ':') !!}
{!! Form::select('due_date_filter', $due_dates, null, ['class' => 'form-control select2', 'placeholder' => __('messages.all'), 'style' => 'width: 100%;']); !!}
</div>
</div>
</div>
@includeIf('project::task.index')
</div>
@if(isset($project->settings['enable_timelog']) && $project->settings['enable_timelog'])
<div class="tab-pane
@if($tab_view == 'time_log')
active
@else
''
@endif" id="time_log">
@includeIf('project::time_logs.index')
</div>
@endif
@if(isset($project->settings['enable_notes_documents']) && $project->settings['enable_notes_documents'])
<!-- model id like project_id, user_id -->
<input type="hidden" name="notable_id" id="notable_id" value="{{$project->id}}">
<!-- model name like App\User -->
<input type="hidden" name="notable_type" id="notable_type" value="Modules\Project\Entities\Project">
<div class="tab-pane document_note_body
@if($tab_view == 'documents_and_notes')
active
@else
''
@endif" id="documents_and_notes">
</div>
@endif
@if((isset($project->settings['enable_invoice']) && $project->settings['enable_invoice']) && $is_lead_or_admin)
<div class="tab-pane
@if($tab_view == 'project_invoices')
active
@else
''
@endif" id="project_invoices">
@includeif('project::invoice.index')
</div>
@endif
@if(!empty($show_project_assets))
<div class="tab-pane
@if($tab_view == 'project_assets')
active
@else
''
@endif" id="project_assets">
@includeIf('project::project.partials.equipment')
</div>
@endif
@if(!empty($tms_installed) && auth()->user()->can('tms.shipments.view'))
<div class="tab-pane
@if($tab_view == 'project_shipments')
active
@else
''
@endif" id="project_shipments">
@includeIf('project::project.partials.shipments')
</div>
@endif
@if($is_lead_or_admin)
<div class="tab-pane
@if($tab_view == 'project_settings')
active
@else
''
@endif" id="project_settings">
@includeIf('project::settings.create')
</div>
@endif
</div>
</div>
</div>
</div>
<div class="modal fade project_task_model" tabindex="-1" role="dialog"></div>
<div class="modal fade" tabindex="-1" role="dialog" id="time_log_model"></div>
<div class="modal fade view_project_task_model" tabindex="-1" role="dialog"></div>
<div class="modal fade payment_modal" tabindex="-1" role="dialog"
aria-labelledby="gridSystemModalLabel"></div>
<div class="modal fade edit_payment_modal" tabindex="-1" role="dialog"
aria-labelledby="gridSystemModalLabel"></div>
</section>
<link rel="stylesheet" href="{{ asset('modules/project/sass/project.css?v=' . $asset_v) }}">
@endsection
@section('javascript')
<script src="{{ asset('modules/project/js/project.js?v=' . $asset_v) }}"></script>
<script src="{{ asset('js/payment.js?v=' . $asset_v) }}"></script>
<script type="text/javascript">
var tab_view = '{!!$tab_view!!}';
if (tab_view == 'activities') {
initializeActivities();
} else if (tab_view == 'project_task') {
initializeProjectTaskDatatable();
} else if (tab_view == 'time_log') {
initializeTimeLogDatatable();
} else if (tab_view == 'documents_and_notes') {
initializeNotesDataTable();
} else if (tab_view == 'project_invoices') {
initializeInvoiceDatatable();
} else if (tab_view == 'project_assets') {
initializeProjectAssetsDatatables();
} else if (tab_view == 'project_shipments') {
initializeProjectShipmentsDatatable();
}
function initializeProjectAssetsDatatables() {
@if(!empty($maintenance_installed))
if ($('#project_equipment_table').length && !$.fn.DataTable.isDataTable('#project_equipment_table')) {
$('#project_equipment_table').DataTable({
processing: true,
serverSide: true,
ajax: '{{ action([\Modules\Project\Http\Controllers\ProjectEquipmentController::class, "equipment"], [$project->id]) }}',
columns: [
{ data: 'code', name: 'code' },
{ data: 'name', name: 'name' },
{ data: 'category_name', name: 'category_name', orderable: false, searchable: false },
{ data: 'line_name', name: 'line_name', orderable: false, searchable: false },
{ data: 'status_label', name: 'status', orderable: false, searchable: false },
{ data: 'action', name: 'action', orderable: false, searchable: false }
]
});
}
@endif
@if(!empty($asset_management_installed))
if ($('#project_assets_table').length && !$.fn.DataTable.isDataTable('#project_assets_table')) {
var assetsTable = $('#project_assets_table').DataTable({
processing: true,
serverSide: true,
ajax: '{{ action([\Modules\Project\Http\Controllers\ProjectEquipmentController::class, "assets"], [$project->id]) }}',
columns: [
{ data: 'asset_code', name: 'asset_code' },
{ data: 'name', name: 'name' },
{ data: 'quantity', name: 'quantity' },
{ data: 'unit_price', name: 'unit_price' },
{ data: 'action', name: 'action', orderable: false, searchable: false }
],
fnDrawCallback: function() {
__currency_convert_recursively($('#project_assets_table'));
}
});
}
@endif
}
$('a[href="#project_assets"]').on('shown.bs.tab', function() {
initializeProjectAssetsDatatables();
});
@if(!empty($tms_installed) && auth()->user()->can('tms.shipments.view'))
function initializeProjectShipmentsDatatable() {
if ($('#project_shipments_table').length && !$.fn.DataTable.isDataTable('#project_shipments_table')) {
$('#project_shipments_table').DataTable({
processing: true,
serverSide: true,
ajax: '{{ action([\Modules\Project\Http\Controllers\ProjectTmsController::class, "shipments"], [$project->id]) }}',
columns: [
{ data: 'ref_no', name: 'ref_no' },
{ data: 'shipment_type', name: 'shipment_type' },
{ data: 'status', name: 'status' },
{ data: 'driver_name', name: 'driver_name', orderable: false, searchable: false },
{ data: 'scheduled_at', name: 'scheduled_at' },
{ data: 'freight_cost', name: 'freight_cost' },
{ data: 'action', name: 'action', orderable: false, searchable: false }
]
});
}
}
$('a[href="#project_shipments"]').on('shown.bs.tab', function() {
initializeProjectShipmentsDatatable();
});
@can('tms.shipments.create')
$('#project_create_shipment_btn').on('click', function() {
var btn = $(this);
btn.prop('disabled', true);
$.post('{{ action([\Modules\Tms\Http\Controllers\ShipmentController::class, "createFromProject"], [$project->id]) }}', {
_token: '{{ csrf_token() }}'
}).done(function(res) {
if (res.success) {
toastr.success(res.msg);
if (res.redirect) { window.location.href = res.redirect; }
else { initializeProjectShipmentsDatatable(); }
} else {
toastr.error(res.msg || LANG.something_went_wrong);
}
}).fail(function() {
toastr.error(LANG.something_went_wrong);
}).always(function() {
btn.prop('disabled', false);
});
});
@endcan
@endif
</script>
@endsection