mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Proposals
This commit is contained in:
parent
ff53cd62e6
commit
91e8426e86
@ -4,6 +4,7 @@ namespace App\Http\ViewComposers;
|
|||||||
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use App\Models\ProposalSnippet;
|
use App\Models\ProposalSnippet;
|
||||||
|
use App\Models\Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClientPortalHeaderComposer.php.
|
* ClientPortalHeaderComposer.php.
|
||||||
@ -27,5 +28,21 @@ class ProposalComposer
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$view->with('snippets', $snippets);
|
$view->with('snippets', $snippets);
|
||||||
|
|
||||||
|
|
||||||
|
$documents = Document::scope()
|
||||||
|
->whereNull('invoice_id')
|
||||||
|
->whereNull('expense_id')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
foreach ($documents as $document) {
|
||||||
|
$data[] = [
|
||||||
|
'src' => $document->getUrl(),
|
||||||
|
'public_id' => $document->public_id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$view->with('documents', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class ProposalTemplatesSeeder extends Seeder
|
|||||||
$htmlFileName = $baseFileName . '.html';
|
$htmlFileName = $baseFileName . '.html';
|
||||||
$cssFileName = $baseFileName . '.css';
|
$cssFileName = $baseFileName . '.css';
|
||||||
if (file_exists($htmlFileName) && file_exists($cssFileName)) {
|
if (file_exists($htmlFileName) && file_exists($cssFileName)) {
|
||||||
$template = ProposalTemplate::whereName($design)->whereAccountId(0)->first();
|
$template = ProposalTemplate::whereName($design)->whereNull('account_id')->first();
|
||||||
|
|
||||||
if (! $template) {
|
if (! $template) {
|
||||||
$template = new ProposalTemplate();
|
$template = new ProposalTemplate();
|
||||||
|
@ -2738,6 +2738,12 @@ $LANG = array(
|
|||||||
'proposal_message' => 'To view your proposal for :amount, click the link below.',
|
'proposal_message' => 'To view your proposal for :amount, click the link below.',
|
||||||
'emailed_proposal' => 'Successfully emailed proposal',
|
'emailed_proposal' => 'Successfully emailed proposal',
|
||||||
'load_template' => 'Load Template',
|
'load_template' => 'Load Template',
|
||||||
|
'no_assets' => 'No images, drag to upload',
|
||||||
|
'add_image' => 'Add Image',
|
||||||
|
'select_image' => 'Select Image',
|
||||||
|
'upgrade_to_upload_images' => 'Upgrade to the enterprise plan to upload images',
|
||||||
|
'delete_image' => 'Delete Image',
|
||||||
|
'delete_image_help' => 'Warning: deleting the image will remove it from all proposals.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// http://t4t5.github.io/sweetalert/
|
// http://t4t5.github.io/sweetalert/
|
||||||
function sweetConfirm(success, text, title) {
|
function sweetConfirm(successCallback, text, title, cancelCallback) {
|
||||||
title = title || "{!! trans("texts.are_you_sure") !!}";
|
title = title || "{!! trans("texts.are_you_sure") !!}";
|
||||||
swal({
|
swal({
|
||||||
//type: "warning",
|
//type: "warning",
|
||||||
@ -122,8 +122,12 @@
|
|||||||
closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
allowOutsideClick: true,
|
allowOutsideClick: true,
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
success();
|
successCallback();
|
||||||
swal.close();
|
swal.close();
|
||||||
|
}).catch(function() {
|
||||||
|
if (cancelCallback) {
|
||||||
|
cancelCallback();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,17 @@ $(function() {
|
|||||||
type: 'none'
|
type: 'none'
|
||||||
},
|
},
|
||||||
assetManager: {
|
assetManager: {
|
||||||
assets: [],
|
assets: {!! json_encode($documents) !!},
|
||||||
noAssets: 'no assets TODO',
|
noAssets: "{{ trans('texts.no_assets') }}",
|
||||||
|
addBtnText: "{{ trans('texts.add_image') }}",
|
||||||
|
modalTitle: "{{ trans('texts.select_image') }}",
|
||||||
|
@if (Utils::isSelfHost() || $account->isEnterprise())
|
||||||
upload: {!! json_encode(url('/documents')) !!},
|
upload: {!! json_encode(url('/documents')) !!},
|
||||||
|
uploadText: "{{ trans('texts.dropzone_default_message') }}",
|
||||||
|
@else
|
||||||
|
upload: false,
|
||||||
|
uploadText: "{{ trans('texts.upgrade_to_upload_images') }}",
|
||||||
|
@endif
|
||||||
uploadName: 'files',
|
uploadName: 'files',
|
||||||
params: {
|
params: {
|
||||||
'_token': '{{ Session::getToken() }}',
|
'_token': '{{ Session::getToken() }}',
|
||||||
@ -56,6 +64,21 @@ $(function() {
|
|||||||
NINJA.formIsChanged = true;
|
NINJA.formIsChanged = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
grapesjsEditor.on('asset:remove', function(asset) {
|
||||||
|
sweetConfirm(function() {
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ url('/documents') }}/" + asset.attributes.public_id,
|
||||||
|
type: 'DELETE',
|
||||||
|
success: function(result) {
|
||||||
|
console.log('result: %s', result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, "{{ trans('texts.delete_image_help') }}", "{{ trans('texts.delete_image') }}", function() {
|
||||||
|
var assetManager = grapesjsEditor.AssetManager;
|
||||||
|
assetManager.add([asset.attributes]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user