1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/resources/views/projects/edit.blade.php

147 lines
4.4 KiB
PHP
Raw Normal View History

2016-11-29 18:47:26 +01:00
@extends('header')
@section('content')
{!! Former::open($url)
2017-11-30 20:17:50 +01:00
->addClass('col-lg-10 col-lg-offset-1 warn-on-exit main-form')
2018-03-14 12:03:30 +01:00
->autocomplete('off')
2016-11-29 18:47:26 +01:00
->method($method)
->rules([
'name' => 'required',
2016-12-15 13:17:10 +01:00
'client_id' => 'required',
2016-11-29 18:47:26 +01:00
]) !!}
@if ($project)
{!! Former::populate($project) !!}
{!! Former::populateField('task_rate', floatval($project->task_rate) ? Utils::roundSignificant($project->task_rate) : '') !!}
2017-12-24 20:24:23 +01:00
{!! Former::populateField('budgeted_hours', floatval($project->budgeted_hours) ? $project->budgeted_hours : '') !!}
2016-11-29 18:47:26 +01:00
@endif
<span style="display:none">
{!! Former::text('public_id') !!}
{!! Former::text('action') !!}
2016-11-29 18:47:26 +01:00
</span>
<div class="row">
2017-11-30 20:17:50 +01:00
<div class="col-lg-10 col-lg-offset-1">
2016-11-29 18:47:26 +01:00
<div class="panel panel-default">
<div class="panel-body">
2016-12-15 13:17:10 +01:00
@if ($project)
{!! Former::plaintext('client_name')
2017-06-04 21:47:21 +02:00
->value($project->client ? $project->client->present()->link : '') !!}
2016-12-15 13:17:10 +01:00
@else
{!! Former::select('client_id')
->addOption('', '')
->label(trans('texts.client'))
->addGroupClass('client-select') !!}
@endif
2016-11-29 18:47:26 +01:00
{!! Former::text('name') !!}
2017-12-24 16:13:47 +01:00
{!! Former::text('due_date')
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))
->addGroupClass('due_date')
->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
2017-12-24 16:23:43 +01:00
{!! Former::text('budgeted_hours') !!}
2017-12-24 16:13:47 +01:00
{!! Former::text('task_rate')
->placeholder($project && $project->client->task_rate ? $project->client->present()->taskRate : $account->present()->taskRate)
->help('task_rate_help') !!}
2016-11-29 18:47:26 +01:00
2017-12-24 16:13:47 +01:00
{!! Former::textarea('private_notes')->rows(4) !!}
2016-11-29 18:47:26 +01:00
</div>
</div>
</div>
</div>
<center class="buttons">
2017-07-31 21:14:14 +02:00
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/projects'))->appendIcon(Icon::create('remove-circle')) !!}
2016-11-29 18:47:26 +01:00
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
2017-12-24 20:17:21 +01:00
@if (false && $project && Auth::user()->can('create', ENTITY_TASK))
{!! DropdownButton::normal(trans('texts.more_actions'))
->withContents([
[
'url' => url('/tasks/create/' . ($project->client ? $project->client->public_id : '0'). '/' . $project->public_id),
'label' => trans('texts.new_task'),
],
[
'url' => 'javascript:submitAction("invoice")',
'label' => trans('texts.invoice_project'),
],
\DropdownButton::DIVIDER,
[
'url' => 'javascript:submitAction("archive")',
'label' => trans('texts.archive_project')
],
[
'url' => 'javascript:onDeleteClick()',
'label' => trans('texts.delete_project')
],
])
->large() !!}
@endif
2016-11-29 18:47:26 +01:00
</center>
{!! Former::close() !!}
<script>
2017-05-08 21:10:39 +02:00
var clients = {!! $clients !!};
var clientMap = {};
2016-11-29 18:47:26 +01:00
function submitAction(action) {
$('#action').val(action);
$('.main-form').submit();
}
function onDeleteClick() {
sweetConfirm(function() {
submitAction('delete');
});
}
2016-11-29 18:47:26 +01:00
$(function() {
var $clientSelect = $('select#client_id');
for (var i=0; i<clients.length; i++) {
var client = clients[i];
clientMap[client.public_id] = client;
2016-11-29 18:47:26 +01:00
var clientName = getClientDisplayName(client);
if (!clientName) {
continue;
}
$clientSelect.append(new Option(clientName, client.public_id));
}
@if ($clientPublicId)
$clientSelect.val({{ $clientPublicId }});
@endif
2016-12-15 13:17:10 +01:00
$clientSelect.combobox({highlighter: comboboxHighlighter}).change(function() {
var client = clientMap[$('#client_id').val()];
if (client && parseFloat(client.task_rate)) {
var rate = client.task_rate;
} else {
2017-12-25 20:18:24 +01:00
var rate = {{ $account->present()->taskRate ?: 0 }};
}
2017-12-01 14:05:20 +01:00
$('#task_rate').attr('placeholder', roundSignificant(rate, true));
});
2017-01-16 10:30:31 +01:00
2017-12-24 16:13:47 +01:00
$('#due_date').datepicker('update', '{{ $project ? Utils::fromSqlDate($project->due_date) : '' }}');
2017-01-16 10:30:31 +01:00
@if ($clientPublicId)
$('#name').focus();
@else
$('.client-select input.form-control').focus();
@endif
2016-11-29 18:47:26 +01:00
});
</script>
@stop