-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpurchase_terms_and_conditions.php
197 lines (143 loc) · 6.73 KB
/
purchase_terms_and_conditions.php
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?php
include "header.php";
?>
<div class="kt-container kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor kt-grid--stretch">
<div class="kt-body kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor kt-grid--stretch" id="kt_body">
<div class="kt-content kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">
<div class="kt-container kt-grid__item kt-grid__item--fluid">
<div class="row">
<div class="kt-portlet">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">
<?= trans('Create New PO - Terms & Conditions') ?>
</h3>
</div>
</div>
<!--begin::Form-->
<form class="kt-form kt-form--label-right" id="po_tc_form">
<div class="kt-portlet__body" style="padding: 20px !important;">
<div class="Msg"></div>
<div class="form-group row">
<div class="col-lg-4">
<label><?= trans('Title') ?>:
</label>
<input type="text" id="title" name="title" class="form-control" />
</div>
<div class="col-lg-5">
<label class=""><?= trans('Description') ?>:</label>
<textarea class="form-control" id="desc" name="desc"></textarea>
</div>
<div class="col-lg-3">
<label style="height: 13px;"></label>
<div class="input-group">
<button type="button" onclick="SaveTC();" class="btn btn-primary">
<?= trans('SAVE') ?>
</button>
</div>
</div>
</div>
</form>
<!--end::Form-->
</div>
</div>
<div class="row" style="width: 100%;">
<div class="kt-portlet">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">
<?= trans('List of Terms & Conditions') ?>
</h3>
</div>
</div>
<!--begin::Table-->
<div class="table-responsive" style="padding: 7px 7px 7px 7px;">
<table class="table table-bordered" id="list_documntes">
<thead>
<th><?= trans('Title') ?></th>
<th><?= trans('Description') ?></th>
<th></th>
</thead>
<tbody id="tbody">
<?php
$terms = $api->get_records_from_table('0_po_terms_and_conditions',['*']);
foreach ($terms as $row) {
echo "<tr>";
echo "<td>".$row['title']."</td>";
echo "<td>".$row['description']."</td>";
echo "<td><a href='#' data-id='".$row['id']."' class='deleteTC btn btn-sm btn-danger'> DELETE</a></td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include "footer.php"; ?>
<script>
function SaveTC() {
var edit_id = $("#edit_id").val();
var params = {};
params.title = $("#title").val();
params.desc = $("#desc").val();
var cond = false;
if (cond) {
swal.fire(
'Check form data',
'Invalid data input. Please check',
'warning'
)
}
else {
AxisPro.APICall('POST', route('API_Call', {method: 'handleNewPOTermsAndCondition'}), params, function (data) {
if (data && data.status === 'FAIL') {
toastr.error(data.msg);
} else {
swal.fire(
data.status === 'SUCCESS' ? 'Success!' : 'FAILED',
data.msg,
data.status === 'SUCCESS' ? 'success' : 'warning'
).then(function () {
window.location.reload();
});
}
});
}
}
$(document).ready(function (e) {
$(document).on("click",".deleteTC", function () {
var id= $(this).data('id');
var params = {
id : id
};
swal.fire({
title: 'Are you sure?',
text: "Confirm whether you want to DELETE this Terms & Condition",
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, DELETE!'
}).then(function (result) {
if (result.value) {
AxisPro.APICall('POST', route('API_Call', {method: 'handleDeletePOTermsAndCondition'}), params, function (data) {
if (data && data.status === 'FAIL') {
toastr.error(data.msg);
} else {
swal.fire(
data.status === 'SUCCESS' ? 'Success!' : 'FAILED',
data.msg,
data.status === 'SUCCESS' ? 'success' : 'warning'
).then(function () {
window.location.reload();
});
}
});
}
});
})
});
</script>