mirror of https://github.com/itflow-org/itflow
Client File upload module created
This commit is contained in:
parent
d795db8097
commit
7408ae2a00
|
|
@ -0,0 +1,51 @@
|
|||
<div class="modal" id="addClientFileModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-upload"></i> Upload File</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $_GET['client_id']; ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label>New Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="new_name" placeholder="Leave blank to use the original filename">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-file"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="file_type" required>
|
||||
<option>Picture</option>
|
||||
<option>Document</option>
|
||||
<option>Backup</option>
|
||||
<option>Other</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>File</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_client_file" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
19
client.php
19
client.php
|
|
@ -38,24 +38,37 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_contact_id') AS num FROM client_contacts WHERE client_id = $client_id"));
|
||||
$num_contacts = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_location_id') AS num FROM client_locations WHERE client_id = $client_id"));
|
||||
$num_locations = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_asset_id') AS num FROM client_assets WHERE client_id = $client_id"));
|
||||
$num_assets = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_vendor_id') AS num FROM client_vendors WHERE client_id = $client_id"));
|
||||
$num_vendors = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_login_id') AS num FROM client_logins WHERE client_id = $client_id"));
|
||||
$num_logins = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_network_id') AS num FROM client_networks WHERE client_id = $client_id"));
|
||||
$num_networks = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_domain_id') AS num FROM client_domains WHERE client_id = $client_id"));
|
||||
$num_domains = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_application_id') AS num FROM client_applications WHERE client_id = $client_id"));
|
||||
$num_applications = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id AND invoice_number > 0"));
|
||||
$num_invoices = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id AND invoice_number = 0"));
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('file_id') AS num FROM files WHERE client_id = $client_id"));
|
||||
$num_files = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('recurring_invoice_id') AS num FROM recurring_invoices WHERE client_id = $client_id"));
|
||||
$num_recurring = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_note_id') AS num FROM client_notes WHERE client_id = $client_id"));
|
||||
$num_notes = $row['num'];
|
||||
|
||||
|
|
@ -112,7 +125,7 @@ if(isset($_GET['client_id'])){
|
|||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientInvoiceModal">New Invoice</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addRecurringInvoiceModal">New Recurring</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addQuoteModal">New Quote</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientAttachmentModal">New Attachment</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientFileModal">Upload File</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addClientNoteModal">New Note</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="client_print.php?client_id=<?php echo $client_id; ?>">Print</a>
|
||||
|
|
@ -153,7 +166,7 @@ if(isset($_GET['client_id'])){
|
|||
<?php include("add_recurring_invoice_modal.php"); ?>
|
||||
<?php include("add_invoice_payment_modal.php"); ?>
|
||||
<?php include("add_quote_modal.php"); ?>
|
||||
<?php include("add_client_attachment_modal.php"); ?>
|
||||
<?php include("add_client_file_modal.php"); ?>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM files WHERE client_id = $client_id ORDER BY file_id DESC"); ?>
|
||||
<h3>Pictures</h3>
|
||||
<hr>
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$file_id = $row['file_id'];
|
||||
$file_name = $row['file_name'];
|
||||
|
||||
?>
|
||||
<div class="col-2 mb-3">
|
||||
<?php echo $file_name; ?>
|
||||
<a href="#" data-toggle="modal" data-target="#viewClientFileModal<?php echo $file_id; ?>">
|
||||
<img class="img-fluid" src="<?php echo $file_name; ?>">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include("view_client_file_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
|
@ -99,12 +99,12 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if($num_attachments > 0){ ?>
|
||||
<?php if($num_files > 0){ ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=attachments">
|
||||
<a class="nav-link" href="?client_id=<?php echo $client_id; ?>&tab=files">
|
||||
<i class="fa fa-paperclip"></i><br>
|
||||
Attachments<br>
|
||||
<span class="badge badge-pill badge-dark"><?php echo $num_attachments; ?></span>
|
||||
Files<br>
|
||||
<span class="badge badge-pill badge-dark"><?php echo $num_files; ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ if(isset($_GET['tab'])){
|
|||
elseif($_GET['tab'] == "quotes"){
|
||||
include("client_quotes.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "attachments"){
|
||||
include("client_attachements.php");
|
||||
elseif($_GET['tab'] == "files"){
|
||||
include("client_files.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "notes"){
|
||||
include("client_notes.php");
|
||||
|
|
|
|||
22
post.php
22
post.php
|
|
@ -100,6 +100,8 @@ if(isset($_POST['add_client'])){
|
|||
mysqli_query($mysqli,"INSERT INTO client_domains SET client_domain_name = '$website', client_id = $client_id");
|
||||
}
|
||||
|
||||
mkdir("uploads/client_files/$client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Client added";
|
||||
|
||||
header("Location: clients.php");
|
||||
|
|
@ -1600,6 +1602,26 @@ if(isset($_GET['delete_client_login'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_client_file'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$file_type = strip_tags(mysqli_real_escape_string($mysqli,$_POST['file_type']));
|
||||
$new_name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['new_name']));
|
||||
|
||||
if($_FILES['file']['tmp_name']!='') {
|
||||
$path = "uploads/client_files/$client_id/";
|
||||
$path = $path . basename( $_FILES['file']['name']);
|
||||
$file_name = basename($path);
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $path);
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO files SET file_type = '$file_type', file_name = '$path', client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "File uploaded";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_client_note'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<div class="modal" id="viewClientFileModal<?php echo $file_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-paperclip"></i> <?php echo $file_name; ?></h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<center>
|
||||
<img class="img-fluid" src="<?php echo $file_name; ?>">
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue