-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocument_registration.php
More file actions
executable file
·113 lines (103 loc) · 4.89 KB
/
document_registration.php
File metadata and controls
executable file
·113 lines (103 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
require('includes/functions.php');
// Check if form is submitted successfully
if (isset($_POST["dt"]) && isset($_POST["dn"]) && isset($_POST["dd"]) && isset($_POST["fp"])) {
// Get form data
$document_type = urlencode($_POST['dt']);
$document_name = urlencode($_POST['dn']);
$document_description = urlencode($_POST['dd']);
$file_path = urlencode($_POST['fp']);
$data=get_api_data('https://apis.stmorg.in/documents/doc_registration?dt='.$document_type.'&dn='.$document_name.'&dd='.$document_description.'&fp='.$file_path.'');
$data=json_decode($data,true);
// Check for API errors
if ($data['status'] !== "success") {
echo "API error: " . $data['message'];
exit;
}else{
$ref_id=$data['data']['Reference Id'];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Generate Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<!-- <img src="logo_text.png" class="img-fluid" /> -->
<h1 class="card-title text-center">Service To Mankind</h1>
</div>
<div class="card-body">
<h3 class="card-title text-center">Generate Document</h3>
<form method="POST">
<div class="form-group">
<label for="document_type">Document Type</label>
<select class="form-control" id="document_type" name="dt" required>
<option value="">-- Select Document Type --</option>
<?php
// fetch all document types
$data=get_api_data('https://apis.stmorg.in/documents/doc_types');
$data=json_decode($data,true);
// Check for API errors
print_r($data);
if ($data['status'] !== "success") {
echo "API error: " . $data['data'];
exit;
}else{
foreach($data['data'] as $document_type){
echo "<option value='" . $document_type['doc_type_id'] . "'>" . $document_type['description'] . "</option>";
}
}
?>
</select>
</div>
<!-- document_name -->
<div class="form-group">
<label for="document_name">Document Name</label>
<input type="text" class="form-control" id="document_name" name="dn" />
</div>
<!-- file_path -->
<div class="form-group">
<label for="file_path">File Path</label>
<input type="text" class="form-control" id="file_path" name="fp" />
</div>
<div class="form-group">
<label for="note">Description</label>
<textarea class="form-control" id="note" name="dd" placeholder="Enter Description"
rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">
Generate Document
</button>
</form>
</div>
</div>
<!-- boostrap card for result -->
<?php if(isset($ref_id)){ ?>
<div class="card">
<div class="card-header">
<h3 class="card-title text-center">Result</h3>
</div>
<div class="card-body">
<?php
echo "<p>Reference ID: " . $ref_id . "</p>";
?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>